Package org.codehaus.enunciate.config

Examples of org.codehaus.enunciate.config.EnunciateConfiguration


   */
  protected void validate(EnunciateFreemarkerModel model) throws ModelValidationException {
    debug("Validating the model...");
    Messager messager = getMessager();
    ValidatorChain validator = new ValidatorChain();
    EnunciateConfiguration config = this.enunciate.getConfig();
    Set<String> disabledRules = new TreeSet<String>(config.getDisabledRules());
    if (this.enunciate.isModuleEnabled("rest")) {
      //if the REST module is enabled, disable the validation rule that
      //fails if the module is not enabled.
      disabledRules.add("disabled.rest.module");
    }

    Validator coreValidator = config.getValidator();
    if (coreValidator instanceof ConfigurableRules) {
      ((ConfigurableRules) coreValidator).disableRules(disabledRules);
    }
    validator.addValidator("core", coreValidator);
    debug("Default validator added to the chain.");
    for (DeploymentModule module : config.getEnabledModules()) {
      Validator moduleValidator = module.getValidator();
      if (moduleValidator != null) {
        if (moduleValidator instanceof ConfigurableRules) {
          ((ConfigurableRules)moduleValidator).disableRules(disabledRules);
        }
        validator.addValidator(module.getName(), moduleValidator);
        debug("Validator for module %s added to the chain.", module.getName());
      }
    }

    if (!config.isAllowEmptyNamespace()) {
      validator.addValidator("emptyns", new EmptyNamespaceValidator());
    }

    ValidationResult validationResult = validate(model, validator);

View Full Code Here


  @Override
  public void initModel(EnunciateFreemarkerModel model) {
    super.initModel(model);

    if (!isDisabled()) {
      EnunciateConfiguration config = model.getEnunciateConfig();
      for (WsdlInfo wsdlInfo : model.getNamespacesToWSDLs().values()) {
        for (EndpointInterface ei : wsdlInfo.getEndpointInterfaces()) {
          String path = "/soap/" + ei.getServiceName();
          if (config != null) {
            path = config.getDefaultSoapSubcontext() + '/' + ei.getServiceName();
            if (config.getSoapServices2Paths().containsKey(ei.getServiceName())) {
              path = config.getSoapServices2Paths().get(ei.getServiceName());
            }
          }

          ei.putMetaData("soapPath", path);
        }
View Full Code Here

      }
    }

    MavenSpecificEnunciate enunciate = loadMavenSpecificEnunciate(sourceDirs);
    enunciate.setJavacCheck(this.javacCheck);
    EnunciateConfiguration config = createEnunciateConfiguration();
    config.setLabel(project.getArtifactId());
    if (this.configFile != null) {
      try {
        loadConfig(config, this.configFile);
      }
      catch (Exception e) {
View Full Code Here

   * Create an Enunciate configuration.
   *
   * @return The enunciate configuration.
   */
  protected EnunciateConfiguration createEnunciateConfiguration() {
    return new EnunciateConfiguration();
  }
View Full Code Here

  @Override
  public void initModel(EnunciateFreemarkerModel model) {
    super.initModel(model);

    if (!isDisabled()) {
      EnunciateConfiguration config = model.getEnunciateConfig();
      if (enableJaxws) {
        for (WsdlInfo wsdlInfo : model.getNamespacesToWSDLs().values()) {
          for (EndpointInterface ei : wsdlInfo.getEndpointInterfaces()) {
            String path = "/soap/" + ei.getServiceName();
            if (config != null) {
              path = config.getDefaultSoapSubcontext() + '/' + ei.getServiceName();
              if (config.getSoapServices2Paths().containsKey(ei.getServiceName())) {
                path = config.getSoapServices2Paths().get(ei.getServiceName());
              }
            }

            ei.putMetaData("soapPath", path);
          }
View Full Code Here

    }
  }

  @Override
  protected EnunciateConfiguration createEnunciateConfiguration() {
    EnunciateConfiguration configuration = new EnunciateConfiguration(Arrays.asList((DeploymentModule) new ExportListDeploymentModule()));
    configuration.setExcludeUnreferencedClasses(false);
    return configuration;
  }
View Full Code Here

  /**
   * Sets up the default model.
   */
  protected void setupDefaultModel() throws EnunciateException {
    //set up the default root model.
    EnunciateConfiguration config = new EnunciateConfiguration(new ArrayList<DeploymentModule>());
    config.setValidator(new BaseValidator()); //skip the validation...
    Enunciate enunciate = new Enunciate(new String[0]);
    enunciate.setConfig(config);
    new EnunciateAnnotationProcessor(enunciate).process();
  }
View Full Code Here

  public void testGenerateDocsXML() throws Exception {
    DocumentationDeploymentModule module = new DocumentationDeploymentModule();
    module.setCopyright("myco");
    module.setTitle("mytitle");
    module.setSplashPackage("org.codehaus.enunciate.samples.docs.pckg1");
    EnunciateConfiguration config = new EnunciateConfiguration(Arrays.asList((DeploymentModule) module));
    config.setExcludeUnreferencedClasses(false);
    config.setIncludeReferencedClasses(false);
    Enunciate enunciate = new Enunciate(getAllJavaFiles(getSamplesDir()));
    enunciate.setConfig(config);
    enunciate.setTarget(Enunciate.Target.BUILD);
    enunciate.setRuntimeClasspath(getInAPTClasspath());
    module.setBase(enunciate.createTempDir().getAbsolutePath());
View Full Code Here

    return new DocsOnlyMavenSpecificEnunciate(sourceFiles);
  }

  @Override
  protected EnunciateConfiguration createEnunciateConfiguration() {
    EnunciateConfiguration config = super.createEnunciateConfiguration();
    WebAppConfig webAppConfig = config.getWebAppConfig();
    if (webAppConfig == null) {
      webAppConfig = new WebAppConfig();
      config.setWebAppConfig(webAppConfig);
    }
    webAppConfig.setDisabled(true);
    return config;
  }
View Full Code Here

          wsdlInfo.setProperty("inlineSchema", customConfig.isInlineSchema());
        }
      }

      EnunciateConfiguration config = model.getEnunciateConfig();
      for (WsdlInfo wsdlInfo : model.getNamespacesToWSDLs().values()) {
        for (EndpointInterface ei : wsdlInfo.getEndpointInterfaces()) {
          if (!ei.getMetaData().containsKey("soapPath")) {
            //if we don't have the soap path set by some other jax-ws implementation provider module
            //then we need to set it ourselves.

            String path = "/soap/" + ei.getServiceName();
            if (config != null) {
              path = config.getDefaultSoapSubcontext() + '/' + ei.getServiceName();
              if (config.getSoapServices2Paths().containsKey(ei.getServiceName())) {
                path = config.getSoapServices2Paths().get(ei.getServiceName());
              }
            }

            ei.putMetaData("soapPath", path);
          }
        }
      }

      for (RootResource resource : model.getRootResources()) {
        for (ResourceMethod resourceMethod : resource.getResourceMethods(true)) {
          if (!resourceMethod.getMetaData().containsKey("defaultSubcontext")) {
            //if we don't have the defaultSubcontext set by some other jax-rs implementation provider module
            //then we need to set it ourselves.

            resourceMethod.putMetaData("defaultSubcontext", config == null ? "/rest" : config.getDefaultRestSubcontext());
          }
        }
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.codehaus.enunciate.config.EnunciateConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.