org.springframework.extensions.config.ConfigSource Java Examples

The following examples show how to use org.springframework.extensions.config.ConfigSource. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MimetypeMapTest.java    From alfresco-data-model with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void setConfigService(final String mimetypes)
{
    ConfigSource configSource = new ConfigSource()
    {
        @Override
        public List<ConfigDeployment> getConfigDeployments()
        {
            String xml =
                "<alfresco-config area=\"mimetype-map\">" +
                "  <config evaluator=\"string-compare\" condition=\"Mimetype Map\">" +
                "    <mimetypes>" +
                       mimetypes +
                "    </mimetypes>" +
                "  </config>" +
                "</alfresco-config>";
            List<ConfigDeployment> configs = new ArrayList<ConfigDeployment>();
            configs.add(new ConfigDeployment("name", new ByteArrayInputStream(xml.getBytes())));
            return configs;
        }
    };

    ConfigService configService = new XMLConfigService(configSource);
    ((XMLConfigService) configService).initConfig();
    ((MimetypeMap)mimetypeService).setConfigService(configService);
}
 
Example #2
Source File: BaseTest.java    From alfresco-core with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected XMLConfigService initXMLConfigService(List<String> xmlConfigFilenames)
{
    List<String> configFiles = new ArrayList<String>();
    for (String filename : xmlConfigFilenames)
    {
        // if we load from classpath then no need to prepend the resources dir (which will be .equals("classpath:")
        String path = ((loadFromClasspath) ? "" : getResourcesDir()) + filename;
        assertFileIsValid(path);
        configFiles.add(path);
    }
    ConfigSource configSource = (loadFromClasspath) ? new ClassPathConfigSource(configFiles) : new FileConfigSource(configFiles);
    XMLConfigService svc = new XMLConfigService(configSource);
    svc.initConfig();
    return svc;
}
 
Example #3
Source File: RepoXMLConfigService.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Constructs an XMLConfigService using the given config source
 */
public RepoXMLConfigService(ConfigSource configSource)
{
    super(configSource);
}