AnsweredAssumed Answered

Access to configuration from Java listener?

Question asked by ungawunga on May 20, 2013
I have a Java listener that is being triggered, and within it I'd like to get access to the spring-webscripts-config-custom.xml file located in the META-INF directory. (gets installed in tomcat\webapps\alfresco\WEB-INF\classes\META-INF )

I can access this via javascript using:
  var errors = config.scoped[ "MetadataErrors" ][ "metadataErrors" ].getChildren( "error" );

XML file contents:

<alfresco-config>
   <config evaluator="string-compare" condition="MetadataErrors">
      <metadataErrors>
         <error id="0" level="0">OK</error>



How can I get access to this from the Java side? What Spring bean do I need to inject into my Java listener to get access to this configuration?

I've tried the following:
      <property name="configService" ref="web.config" />

And that gives me access to the XMLConfigService reference, but that never seems to be initiated when I use it within the Java listener. All of its 'get' methods return null. getConfigElement, getGlobalConfig, etc…

The ConfigModel class has a method for retrieving the scoped config, but I don't know how to get access to that.
https://maven.alfresco.com/nexus/content/repositories/public/spring-surf-parent/apidocs/index.html?org/springframework/extensions/webscripts/ScriptConfigModel.html

Is that the correct class to go after for reading a configuration file?

What is the correct Spring bean to use for reading configuration information?

And a broader question: Is there a list of the Spring beans we can inject into our code and what they do?

Outcomes