gpt4 book ai didi

org.springframework.extensions.config.xml.XMLConfigService.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-26 10:31:05 25 4
gpt4 key购买 nike

本文整理了Java中org.springframework.extensions.config.xml.XMLConfigService.<init>()方法的一些代码示例,展示了XMLConfigService.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLConfigService.<init>()方法的具体详情如下:
包路径:org.springframework.extensions.config.xml.XMLConfigService
类名称:XMLConfigService
方法名:<init>

XMLConfigService.<init>介绍

[英]Constructs an XMLConfigService using the given config source
[中]使用给定的配置源构造XMLConfigService

代码示例

代码示例来源:origin: deas/alfresco

protected XMLConfigService initXMLConfigService(List<String> xmlConfigFilenames)
  {
    List<String> configFiles = new ArrayList<String>();
    for (String filename : xmlConfigFilenames)
    {
      String path = getResourcesDir() + filename;
      assertFileIsValid(path);
      configFiles.add(path);
    }
    XMLConfigService svc = new XMLConfigService(new FileConfigSource(configFiles));
    svc.initConfig();
    return svc;
  }
}

代码示例来源:origin: deas/alfresco

/**
 * Tests the use of the HTTP source config
 * 
 * TODO: Enable this test when we have an HTTP config resource to load!
 */
public void xtestHTTPSource()
{
  List<String> configFile = new ArrayList<String>(1);
  configFile.add("http://localhost:8080/configservice/config-http.xml");
  XMLConfigService svc = new XMLConfigService(new HTTPConfigSource(configFile));
  svc.initConfig();
  
  Config config = svc.getGlobalConfig();
  assertNotNull(config);
}

代码示例来源:origin: deas/alfresco

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;
  }
}

代码示例来源:origin: deas/alfresco

protected XMLConfigService initXMLConfigService(String xmlConfigFile)
{
  String fullFileName = getResourcesDir() + xmlConfigFile;
  assertFileIsValid(fullFileName);

  XMLConfigService svc = new XMLConfigService(new FileConfigSource(
      fullFileName));
  svc.initConfig();
  return svc;
}

代码示例来源:origin: deas/alfresco

/**
 * Loads a config file from filesystem or classpath
 *  
 * In case of file resource, just provide the file name relative to resourceDir
 * In case of classpath resources, just provide the resource URI, without with the prepending classpath: string 
 * @param xmlConfigFile
 * @return
 */
protected XMLConfigService initXMLConfigService(String xmlConfigFile)
{
  XMLConfigService svc = null;
  if(loadFromClasspath)
  {
    svc = new XMLConfigService(new ClassPathConfigSource(xmlConfigFile));
  }
  else
  {
    String fullFileName = getResourcesDir() + xmlConfigFile;
    assertFileIsValid(fullFileName);
    svc = new XMLConfigService(new FileConfigSource(fullFileName));
  }
  svc.initConfig();
  return svc;
}

代码示例来源:origin: deas/alfresco

/**
 * Tests the use of the class path source config
 * 
 * TODO: Enable this test when we have a classpath config resource to load!
 */
public void xtestClasspathSource()
{
  String configFile = "org/configservice/config-classpath.xml"; 
  XMLConfigService svc = new XMLConfigService(new ClassPathConfigSource(configFile));
  svc.initConfig();
  
  Config config = svc.getGlobalConfig();
  assertNotNull(config);
}

代码示例来源:origin: deas/alfresco

configFiles.add("jar:*!/META-INF/web-client-config-custom.xml");
UrlConfigSource configSrc = new UrlConfigSource(configFiles, true);
XMLConfigService svc = new XMLConfigService(configSrc);
svc.initConfig();

代码示例来源:origin: deas/alfresco

XMLConfigService svc = new XMLConfigService(new UrlConfigSource(configFile, true));
svc.initConfig();
svc = new XMLConfigService(new UrlConfigSource(configFile, true));
svc.initConfig();
svc = new XMLConfigService(new UrlConfigSource(configFile, true));
svc.initConfig();

代码示例来源:origin: deas/alfresco

/**
 * Tests the config service's ability to reset
 */
public void testReset()
{
  // setup the config service
  String configFile = getResourcesDir() + "config.xml";
  XMLConfigService svc = new XMLConfigService(new FileConfigSource(configFile));
  svc.initConfig();
  // try and get the global item
  Config unitTest = svc.getConfig("Unit Test");
  assertNotNull("unitTest should not be null", unitTest);
  
  // reset the config service then try to retrieve some config again
  svc.reset();
  unitTest = svc.getConfig("Unit Test");
  assertNotNull("unitTest should not be null", unitTest);
}

代码示例来源:origin: deas/alfresco

configFiles.add(getResourcesDir() + "config.xml");
configFiles.add(getResourcesDir() + "config-multi.xml");
XMLConfigService svc = new XMLConfigService(new FileConfigSource(configFiles));
svc.initConfig();

代码示例来源:origin: deas/alfresco

configFiles.add(getResourcesDir() + "config.xml");
configFiles.add(getResourcesDir() + "config-areas.xml");
XMLConfigService svc = new XMLConfigService(new FileConfigSource(configFiles));
svc.initConfig();

代码示例来源:origin: deas/alfresco

/**
 * Tests loading config from a known JAR file
 */
public void testJarSource()
{
  String resDir = this.getResourcesDir();
  String jarFile = "jar:file:" + resDir + "custom-config.jar!/META-INF/web-client-config-custom.xml";
  JarConfigSource source = new JarConfigSource(jarFile);
  XMLConfigService svc = new XMLConfigService(source);
  svc.initConfig();
 
  // make sure the global config is present
  Config config = svc.getGlobalConfig();
  assertNotNull(config);
    // make sure the from address is present and correct
  ConfigElement clientElem = config.getConfigElement("client");
  assertNotNull(clientElem);
  ConfigElement fromAddressElem = clientElem.getChild("from-email-address");
  assertNotNull(fromAddressElem);
  String fromAddress = fromAddressElem.getValue();
  assertEquals("From address should be 'me@somewhere.net'", "me@somewhere.net", fromAddress);
}

代码示例来源:origin: deas/alfresco

configFiles.add(getResourcesDir() + "config.xml");
configFiles.add(getResourcesDir() + "config-replace.xml");
XMLConfigService svc = new XMLConfigService(new FileConfigSource(configFiles));
svc.initConfig();

代码示例来源:origin: deas/alfresco

configFiles.add(getResourcesDir() + "config.xml");
configFiles.add(getResourcesDir() + "config-multi.xml");
XMLConfigService svc = new XMLConfigService(new FileConfigSource(configFiles));
svc.initConfig();

代码示例来源:origin: deas/alfresco

XMLConfigService svc = new XMLConfigService(new FileConfigSource(configFile));
svc.initConfig();

代码示例来源:origin: deas/alfresco

XMLConfigService svc = new XMLConfigService(new FileConfigSource(configFile));
svc.initConfig();

代码示例来源:origin: deas/alfresco

XMLConfigService svc = new XMLConfigService(new FileConfigSource(configFile));
svc.setProperties(new Resource[] {new FileSystemResource(getResourcesDir() + "config-props.properties")});
svc.init();

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com