gpt4 book ai didi

org.opensaml.xml.XMLConfigurator.load()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 23:28:40 29 4
gpt4 key购买 nike

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

XMLConfigurator.load介绍

[英]Loads the configuration file(s) from the given file. If the file is a directory each file within the directory is loaded.
[中]从给定文件加载配置文件。如果文件是目录,则加载目录中的每个文件。

代码示例

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.wss4j

protected static void initializeXMLTooling(String[] providerConfigs) throws ConfigurationException {
  XMLConfigurator configurator = new XMLConfigurator();
  for (String config : providerConfigs) {
    //most are found in the Configuration.class classloader
    InputStream ins = Configuration.class.getResourceAsStream(config);
    if (ins == null) {
      //some are from us
      ins = OpenSAMLBootstrap.class.getResourceAsStream(config);
    }
    configurator.load(ins);
  }
}

代码示例来源:origin: org.apache.ws.security/wss4j

protected static void initializeXMLTooling(String[] providerConfigs) throws ConfigurationException {
  XMLConfigurator configurator = new XMLConfigurator();
  for (String config : providerConfigs) {
    //most are found in the Configuration.class classloader
    InputStream ins = Configuration.class.getResourceAsStream(config);
    if (ins == null) {
      //some are from us
      ins = OpenSAMLBootstrap.class.getResourceAsStream(config);
    }
    configurator.load(ins);
  }
}

代码示例来源:origin: io.apigee.opensaml/xmltooling

/**
 * Loads the configuration file(s) from the given file. If the file is a directory each file within the directory is
 * loaded.
 * 
 * @param configurationFile the configuration file(s) to be loaded
 * 
 * @throws ConfigurationException thrown if the configuration file(s) can not be be read or invalid
 */
public void load(File configurationFile) throws ConfigurationException {
  if (configurationFile == null || !configurationFile.canRead()) {
    log.error("Unable to read configuration file {}", configurationFile);
  }
  try {
    if (configurationFile.isDirectory()) {
      File[] configurations = configurationFile.listFiles();
      for (int i = 0; i < configurations.length; i++) {
        log.debug("Parsing configuration file {}", configurations[i].getAbsolutePath());
        load(new FileInputStream(configurations[i]));
      }
    } else {
      // Given file is not a directory so try to load it directly
      log.debug("Parsing configuration file {}", configurationFile.getAbsolutePath());
      load(new FileInputStream(configurationFile));
    }
  } catch (FileNotFoundException e) {
    // ignore, we already have the files
  }
}

代码示例来源:origin: org.opensaml/xmltooling

/**
 * Loads the configuration docuement.
 * 
 * @param configuration the configurationd document
 * @throws ConfigurationException thrown if the configuration file(s) can not be be read or invalid
 */
public void load(Document configuration) throws ConfigurationException {
  log.debug("Loading configuration from XML Document");
  log.trace("{}", XMLHelper.nodeToString(configuration.getDocumentElement()));
  // Schema validation
  log.debug("Schema validating configuration Document");
  validateConfiguration(configuration);
  log.debug("Configuration document validated");
  load(configuration.getDocumentElement());
}

代码示例来源:origin: io.apigee.opensaml/xmltooling

/**
 * Loads the configuration docuement.
 * 
 * @param configuration the configurationd document
 * @throws ConfigurationException thrown if the configuration file(s) can not be be read or invalid
 */
public void load(Document configuration) throws ConfigurationException {
  log.debug("Loading configuration from XML Document");
  log.trace("{}", XMLHelper.nodeToString(configuration.getDocumentElement()));
  // Schema validation
  log.debug("Schema validating configuration Document");
  validateConfiguration(configuration);
  log.debug("Configuration document validated");
  load(configuration.getDocumentElement());
}

代码示例来源:origin: org.opensaml/xmltooling

/**
 * Loads the configuration file(s) from the given file. If the file is a directory each file within the directory is
 * loaded.
 * 
 * @param configurationFile the configuration file(s) to be loaded
 * 
 * @throws ConfigurationException thrown if the configuration file(s) can not be be read or invalid
 */
public void load(File configurationFile) throws ConfigurationException {
  if (configurationFile == null || !configurationFile.canRead()) {
    log.error("Unable to read configuration file {}", configurationFile);
  }
  try {
    if (configurationFile.isDirectory()) {
      File[] configurations = configurationFile.listFiles();
      for (int i = 0; i < configurations.length; i++) {
        log.debug("Parsing configuration file {}", configurations[i].getAbsolutePath());
        load(new FileInputStream(configurations[i]));
      }
    } else {
      // Given file is not a directory so try to load it directly
      log.debug("Parsing configuration file {}", configurationFile.getAbsolutePath());
      load(new FileInputStream(configurationFile));
    }
  } catch (FileNotFoundException e) {
    // ignore, we already have the files
  }
}

代码示例来源:origin: org.opensaml/opensaml

/**
 * Initializes the XMLTooling library with an explicitly supplied set of object providers.
 * 
 * @param providerConfigs list of provider configuration files located on the classpath
 * 
 * @throws ConfigurationException thrown if there is a problem loading the configuration files
 */
protected static void initializeXMLTooling(String[] providerConfigs) throws ConfigurationException {
  Logger log = getLogger();
  Class clazz = Configuration.class;
  XMLConfigurator configurator = new XMLConfigurator();
  for (String config : providerConfigs) {
    log.debug("Loading XMLTooling configuration {}", config);
    configurator.load(clazz.getResourceAsStream(config));
  }
}

代码示例来源:origin: org.opensaml/xmltooling

/**
 * Loads a configuration file from an input stream.
 * 
 * @param configurationStream configuration stream
 * 
 * @throws ConfigurationException thrown if the given configuration is invalid or can not be read
 */
public void load(InputStream configurationStream) throws ConfigurationException {
  try {
    Document configuration = parserPool.parse(configurationStream);
    load(configuration);
  } catch (XMLParserException e) {
    log.error("Invalid configuration file", e);
    throw new ConfigurationException("Unable to create DocumentBuilder", e);
  }
}

代码示例来源:origin: io.apigee.opensaml/xmltooling

/**
 * Loads a configuration file from an input stream.
 * 
 * @param configurationStream configuration stream
 * 
 * @throws ConfigurationException thrown if the given configuration is invalid or can not be read
 */
public void load(InputStream configurationStream) throws ConfigurationException {
  try {
    Document configuration = parserPool.parse(configurationStream);
    load(configuration);
  } catch (XMLParserException e) {
    log.error("Invalid configuration file", e);
    throw new ConfigurationException("Unable to create DocumentBuilder", e);
  }
}

代码示例来源:origin: edu.internet2.middleware/shibboleth-common

/** {@inheritDoc} */
  public void afterPropertiesSet() throws Exception {
    DefaultBootstrap.bootstrap();
    
    if(configResources != null && !configResources.isEmpty()){
      XMLConfigurator configurator = new XMLConfigurator();
      for(Resource config : configResources){
        try{
          log.debug("Loading OpenSAML configuration file: {}", config.getLocation());
          configurator.load(config.getInputStream());
        }catch(Exception e){
          log.error("Unable to load OpenSAML configuration file: " + config.getLocation());
        }
      }
    }
    
    if (getParserPool() != null) {
      Configuration.setParserPool(getParserPool());
    }
    
  }
}

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