gpt4 book ai didi

org.opensaml.xml.XMLConfigurator类的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 22:54:40 26 4
gpt4 key购买 nike

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

XMLConfigurator介绍

[英]Reads in an XML configuration and configures the XMLTooling library accordingly.
[中]读入XML配置并相应地配置XMLTooling库。

代码示例

代码示例来源: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.opensaml/xmltooling

if (objectProviders.getLength() > 0) {
  log.debug("Preparing to load ObjectProviders");
  initializeObjectProviders((Element) objectProviders.item(0));
  log.debug("ObjectProviders load complete");
if (validatorSuitesNodes.getLength() > 0) {
  log.debug("Preparing to load ValidatorSuites");
  initializeValidatorSuites((Element) validatorSuitesNodes.item(0));
  log.debug("ValidatorSuites load complete");
if (idAttributesNodes.getLength() > 0) {
  log.debug("Preparing to load IDAttributes");
  initializeIDAttributes((Element) idAttributesNodes.item(0));
  log.debug("IDAttributes load complete");

代码示例来源: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: 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: io.apigee.opensaml/xmltooling

configuration = (Element) objectProvider.getElementsByTagNameNS(XMLConstants.XMLTOOLING_CONFIG_NS,
    "BuilderClass").item(0);
builder = (XMLObjectBuilder) createClassInstance(configuration);
marshaller = (Marshaller) createClassInstance(configuration);
unmarshaller = (Unmarshaller) createClassInstance(configuration);

代码示例来源: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/xmltooling

configuration = (Element) objectProvider.getElementsByTagNameNS(XMLConstants.XMLTOOLING_CONFIG_NS,
    "BuilderClass").item(0);
builder = (XMLObjectBuilder) createClassInstance(configuration);
marshaller = (Marshaller) createClassInstance(configuration);
unmarshaller = (Unmarshaller) createClassInstance(configuration);

代码示例来源: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: 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: 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

if (objectProviders.getLength() > 0) {
  log.debug("Preparing to load ObjectProviders");
  initializeObjectProviders((Element) objectProviders.item(0));
  log.debug("ObjectProviders load complete");
if (validatorSuitesNodes.getLength() > 0) {
  log.debug("Preparing to load ValidatorSuites");
  initializeValidatorSuites((Element) validatorSuitesNodes.item(0));
  log.debug("ValidatorSuites load complete");
if (idAttributesNodes.getLength() > 0) {
  log.debug("Preparing to load IDAttributes");
  initializeIDAttributes((Element) idAttributesNodes.item(0));
  log.debug("IDAttributes load complete");

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

"qualifiedName"));
validator = (Validator) createClassInstance(validatorElement);
validatorSuite.registerValidator(validatorQName, validator);

代码示例来源: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: 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: io.apigee.opensaml/xmltooling

"qualifiedName"));
validator = (Validator) createClassInstance(validatorElement);
validatorSuite.registerValidator(validatorQName, validator);

代码示例来源: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());
    }
    
  }
}

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