How to add custom properties to config page?
Accepted answer
<code>
<extension point="com.ibm.team.repository.service.serviceProvider">
<serviceProvider
componentId="com.xx.remoterepository"
implementationClass="com.xx.repository.service.RepositoryFileService">
<provides>
<providedService interface="com.xx.repository.service.IRepositoryFileService"/>
</provides>
<prerequisites>
<requiredService
interface="com.ibm.team.repository.common.internal.IRepositoryRemoteService">
</requiredService>
<configurationProperties >
<configurationProperty
accessPolicy="OPEN"
default="128"
name="sfdc.VolumeSize"
description="Max size (in MegaBytes) of files to copy into the RTC repository"
displayableName="Maximum file size to copy"
required="true"
type="INTEGER"
updatePolicy="NO_RESTART_REQUIRED">
</configurationProperty>
<configurationProperty
accessPolicy="OPEN"
default="idrive"
name="sfdc.VolumePrefix"
description="the network share name of the Shared volume (FTP server)"
displayableName="FTP Volume Share name"
required="true"
type="STRING"
updatePolicy="NO_RESTART_REQUIRED">
</configurationProperty>
</configurationProperties>
</prerequisites>
</serviceProvider>
</extension>
</code>
3 other answers
All configuration properties must be declared via extension point using the configurationProperties element. This element is nested within a prerequisites element. The prerequisites element is included in both serviceProvider elements as well as extensionService elements.
As mentioned previously, configuration properties are owned by a particular service. When the activate method is called on a service, it can safely assume that all of its required configuration properties are accessible via protected methods on AbstractService. These methods are called get****ConfigProperty(propertyName). The stars are replaced with one of the four valid types(Integer, Long, Boolean, String)
<extension
point="com.ibm.team.repository.service.serviceProvider">
<serviceProvider
componentId="componentId"
implementationClass="implementationClass">
<provides>
</provides>
<prerequisites>
<configurationProperties>
<configurationProperty
accessPolicy="OPEN"
default="localhost"
description="HOSTNAME"
displayableName="HOSTNAME"
name="HOSTNAME"
required="true"
type="STRING"
updatePolicy="NO_RESTART_REQUIRED">
</configurationProperty>
</configurationProperties>
</prerequisites>
</serviceProvider>
</extension>
Comments
I tried using the code you pasted assuming that you don't actually have the <br> tags in the code. I see the following error in my log:
10:22:06,438 [Start Level Event Dispatcher] ERROR ository.common.transport.AbstractElementDescriptor - Failed to process 'prerequisites' child named 'configurationproperties'
10:22:06,439 [Start Level Event Dispatcher] ERROR ository.common.transport.AbstractElementDescriptor - The foo bundle's plugin.xml file contains a <provides> element that does not contain at least one nested element.
java.lang.IllegalArgumentException: The foo bundle's plugin.xml file contains a <provides> element that does not contain at least one nested element.
Have you looked at your application's logs for errors? My guess is that you will see the same error in there.
Change your <provides> tag to something like this and see if it works:
<provides>
<providedService interface="interface">
</providedService>
</provides>
Yes, the XML contains the providedService tag, too. It was the copy-paste to fail... -.-
package com.xx.repository.service;
public interface IRepositoryFileService {
// ...
}
package com.xx.repository.service;
import com.ibm.team.repository.service.AbstractService;
public class RepositoryFileService extends AbstractService implements IRepositoryFileService {
public RepositoryFileService() {
super();
}
@Override
public void activate() {
// ...
}
}
Comments
sounds like your plugin did not load, cause you forgot to identify the service NAME
this is from yours
<provides>
</provides>
this from mine
<provides> <providedservice interface="com.xx.repository.service.IRepositoryFileService"/> </provides>
You're right, I forgot to request the Jazz server reset...