cancel
Showing results for 
Search instead for 
Did you mean: 

Configurable repository service

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Answers (0)