示例#1
0
  /** {@inheritDoc} */
  public void afterPropertiesSet() throws Exception {
    PathMatchingResourcePatternResolver resourcePatternResolver =
        new PathMatchingResourcePatternResolver();

    for (String location : locations) {
      Resource[] findings = resourcePatternResolver.getResources(location);

      for (Resource resource : findings) {
        if (resource.getFilename().endsWith(".xsd")) {
          log.info("Loading XSD schema resource " + resource.getFilename());
          SimpleXsdSchema schema = new SimpleXsdSchema(resource);
          schema.afterPropertiesSet();
          schemas.add(schema);
        } else if (resource.getFilename().endsWith(".wsdl")) {
          log.info("Loading WSDL schema resource " + resource.getFilename());
          WsdlXsdSchema wsdl = new WsdlXsdSchema(resource);
          wsdl.afterPropertiesSet();
          schemas.add(wsdl);
        } else {
          log.warn(
              "Skipped resource other than XSD schema for repository ("
                  + resource.getFilename()
                  + ")");
        }
      }
    }

    // Add default Citrus message schemas if available on classpath
    addCitrusSchema("citrus-mail-message");
    addCitrusSchema("citrus-ftp-message");
    addCitrusSchema("citrus-ssh-message");
  }
示例#2
0
 /**
  * Adds Citrus message schema to repository if available on classpath.
  *
  * @param schemaName
  */
 protected void addCitrusSchema(String schemaName)
     throws IOException, SAXException, ParserConfigurationException {
   Resource resource =
       new PathMatchingResourcePatternResolver()
           .getResource("classpath:com/consol/citrus/schema/" + schemaName + ".xsd");
   if (resource.exists()) {
     log.info("Loading XSD schema resource " + resource.getFilename());
     SimpleXsdSchema schema = new SimpleXsdSchema(resource);
     schema.afterPropertiesSet();
     schemas.add(schema);
   }
 }
示例#3
0
  @Override
  public void afterPropertiesSet() throws ParserConfigurationException, IOException, SAXException {
    Assert.notNull(wsdl, "wsdl file resource is required");
    Assert.isTrue(wsdl.exists(), "wsdl file resource '" + wsdl + " does not exist");

    try {
      loadSchemas();
    } catch (WSDLException e) {
      throw new BeanCreationException("Failed to load schema types from WSDL file", e);
    } catch (TransformerException e) {
      throw new BeanCreationException("Failed to load schema types from WSDL file", e);
    } catch (TransformerFactoryConfigurationError e) {
      throw new BeanCreationException("Failed to load schema types from WSDL file", e);
    }

    Assert.isTrue(!schemas.isEmpty(), "no schema types found in wsdl file resource");

    super.afterPropertiesSet();
  }