Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Configurable repository service

Hello, I am doing a repository service that needs to be configurable from the SystemAdministration>systemConfiguration>contentManagement>RepositoryService Menu at the portal, just like all the standard repository services that I can see there..¿Is it possible?

I have tried with the service-profile tag in the portalapp.xml (like with the IViews), but it does not work..I have also tried with the *.co.xml and *.cc.xml, but I do not know the structure of the xml nor the tags to use...

Finally I do not know how to access to the service properties declared, in my code...

thanks

Former Member
Former Member replied

Hi,

After you created repository service you can add attribute in cc.xml file:

<ConfigClass name="com.epam.test.repservice.MyRepositoryService"  extends="RepositoryService">
 <attribute name="class" type="class" constant="com.epam.test.repservice.MyRepositoryService"/>
  <attribute name="myattr1" type="string" /> 
 </ConfigClass>

and in co.xml:

<Configurable configclass="com.epam.test.repservice.MyRepositoryService">
 <property name="name" value="com.epam.test.repservice.MyRepositoryService" />
 <property name="active" value="true" />
 <property name="description" />
 <property name="myattr1" value="myvalue1" /> 
 </Configurable>

It's an example of getting properties:

  protected void startUpImpl(Collection repositoryManagers) throws ConfigurationException, StartupException {
    
    try  {
		Properties props = convertConfigToProperties(config);
		if(props!=null) {
			Set keys = props.keySet();
			
			for(Iterator it = keys.iterator(); it.hasNext(); ) {
				Object key = it.next();
				Object value = props.get(key);
				
				System.out.println("key = " + key + " value = " + value);
			}
			
		}
    }
    catch (Exception e) {
      throw new StartupException(e.getMessage(), e);
    }
    
  }

Also you can add some debug in reconfigure(IConfiguration config) method and see your properties.

Regards,

Andrei

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question