Package org.codehaus.enunciate

Examples of org.codehaus.enunciate.EnunciateException


    if (!isDisabled()) {
      if (getWebAppConfig() != null && !getWebAppConfig().getGlobalServletFilters().isEmpty()) {
        for (WebAppComponent globalServletFilter : getWebAppConfig().getGlobalServletFilters()) {
          if (globalServletFilter.getName() == null) {
            throw new EnunciateException("A global servlet filter (as specified in the enunciate config) requires a name.");
          }
          if (globalServletFilter.getClassname() == null) {
            throw new EnunciateException("A global servlet filter (as specified in the enunciate config) requires a classname.");
          }
        }
      }
    }
  }
View Full Code Here


      if (getWebAppConfig() != null && !getWebAppConfig().getCopyResources().isEmpty()) {
        AntPatternMatcher matcher = new AntPatternMatcher();
        for (CopyResources copyResource : getWebAppConfig().getCopyResources()) {
          String pattern = copyResource.getPattern();
          if (pattern == null) {
            throw new EnunciateException("A pattern must be specified for copying resources.");
          }

          if (!matcher.isPattern(pattern)) {
            warn("'%s' is not a valid pattern.  Resources NOT copied!", pattern);
            continue;
View Full Code Here

        model.put("webappAttributes", webAppConfig.getWebXmlAttributes());
      }
      processTemplate(getWebXmlTemplateURL(), model);
    }
    catch (TemplateException e) {
      throw new EnunciateException("Error processing web.xml template file.", e);
    }

    File mergedWebXml = webXML;
    WebAppConfig webAppConfig = getWebAppConfig();
    if ((webAppConfig != null) && (webAppConfig.getMergeWebXMLURL() != null || webAppConfig.getMergeWebXML() != null)) {
      URL webXmlToMerge = webAppConfig.getMergeWebXMLURL();
      if (webXmlToMerge == null) {
        webXmlToMerge = enunciate.resolvePath(webAppConfig.getMergeWebXML()).toURL();
      }

      try {
        Document source1Doc = loadMergeXml(webXmlToMerge.openStream());
        NodeModel.simplify(source1Doc);
        Document source2Doc = loadMergeXml(new FileInputStream(webXML));
        NodeModel.simplify(source2Doc);

        Map<String, String> mergedAttributes = new HashMap<String, String>();
        NamedNodeMap source2Attributes = source2Doc.getDocumentElement().getAttributes();
        for (int i = 0; i < source2Attributes.getLength(); i++) {
          mergedAttributes.put(source2Attributes.item(i).getNodeName(), source2Attributes.item(i).getNodeValue());
        }
        NamedNodeMap source1Attributes = source1Doc.getDocumentElement().getAttributes();
        for (int i = 0; i < source1Attributes.getLength(); i++) {
          mergedAttributes.put(source1Attributes.item(i).getNodeName(), source1Attributes.item(i).getNodeValue());
        }

        model.put("source1", NodeModel.wrap(source1Doc.getDocumentElement()));
        model.put("source2", NodeModel.wrap(source2Doc.getDocumentElement()));
        model.put("mergedAttributes", mergedAttributes);
        processTemplate(getMergeWebXmlTemplateURL(), model);
      }
      catch (TemplateException e) {
        throw new EnunciateException("Error while merging web xml files.", e);
      }

      File mergeTarget = new File(getGenerateDir(), "merged-web.xml");
      if (!mergeTarget.exists()) {
        throw new EnunciateException("Error: " + mergeTarget + " doesn't exist.");
      }

      debug("Merged %s and %s into %s...", webXmlToMerge, webXML, mergeTarget);
      mergedWebXml = mergeTarget;
    }

    if ((webAppConfig != null) && (webAppConfig.getWebXMLTransformURL() != null || webAppConfig.getWebXMLTransform() != null)) {
      URL transformURL = webAppConfig.getWebXMLTransformURL();
      if (transformURL == null) {
        transformURL = enunciate.resolvePath(webAppConfig.getWebXMLTransform()).toURI().toURL();
      }

      debug("web.xml transform has been specified as %s.", transformURL);
      try {
        StreamSource source = new StreamSource(transformURL.openStream());
        Transformer transformer = TransformerFactory.newInstance().newTransformer(source);
        debug("Transforming %s to %s.", mergedWebXml, destWebXML);
        transformer.transform(new StreamSource(new FileReader(mergedWebXml)), new StreamResult(destWebXML));
      }
      catch (TransformerException e) {
        throw new EnunciateException("Error during transformation of the web.xml (stylesheet " + transformURL + ", file " + mergedWebXml + ")", e);
      }
    }
    else {
      enunciate.copyFile(mergedWebXml, destWebXML);
    }
View Full Code Here

        }
      });
      doc = builder.parse(inputStream);
    }
    catch (Exception e) {
      throw new EnunciateException("Error parsing web.xml file for merging", e);
    }
    return doc;
  }
View Full Code Here

      debug("No package directory specified, assigned %s.", packageDir);
      setPackageDir(packageDir);
    }

    if (packageDir.equals(getBuildDir())) {
      throw new EnunciateException("The package output directory cannot be the same as the build directory. " +
        "(BTW, if you don't specify a package output directory, a suitable temp directory wil be created for you.)");
    }

    for (DeploymentModule deploymentModule : this.config.getAllModules()) {
      if (!deploymentModule.isDisabled()) {
View Full Code Here

      debug("No build directory specified, assigned %s.", buildDir);
      setBuildDir(buildDir);
    }

    if (buildDir.equals(getCompileDir())) {
      throw new EnunciateException("The build output directory cannot be the same as the compile directory. " +
        "(BTW, if you don't specify a build output directory, a suitable temp directory wil be created for you.)");
    }

    for (DeploymentModule deploymentModule : this.config.getAllModules()) {
      if (!deploymentModule.isDisabled()) {
View Full Code Here

      debug("No compile directory specified, assigned %s.", destdir);
      setCompileDir(destdir);
    }

    if (compileDir.equals(getBuildDir())) {
      throw new EnunciateException("The compile output directory cannot be the same as the generate directory. " +
        "(BTW, if you don't specify a compile output directory, a suitable temp directory wil be created for you.)");
    }

    for (DeploymentModule deploymentModule : this.config.getAllModules()) {
      if (!deploymentModule.isDisabled()) {
View Full Code Here

        moduleList.append(conjunction).append(module);
        if (it.hasNext()) {
          conjunction = ", ";
        }
      }
      throw new EnunciateException("There are multiple modules that are configured to be JAX-WS providers: " + moduleList +
        ". You might have unnecessary modules on the classpath. Anyway, you must disable all but one JAX-WS provider module.");
    }

    if (jaxrsProviderModules.size() > 1) {
      StringBuilder moduleList = new StringBuilder();
      Iterator<String> it = jaxrsProviderModules.iterator();
      String conjunction = "";
      while (it.hasNext()) {
        String module = it.next();
        if (!it.hasNext()) {
          conjunction = " and ";
        }
        moduleList.append(conjunction).append(module);
        if (it.hasNext()) {
          conjunction = ", ";
        }
      }
      throw new EnunciateException("There are multiple modules that are configured to be JAX-RS providers: " + moduleList +
        ". You might have unnecessary modules on the classpath. Anyway, you must disable all but one JAX-RS provider module.");
    }
  }
View Full Code Here

    }

    EnunciateAnnotationProcessorFactory apf = new EnunciateAnnotationProcessorFactory(this, additionalApiClasses);
    com.sun.tools.apt.Main.process(apf, args.toArray(new String[args.size()]));
    if (!apf.hasBeenProcessed()) {
      throw new EnunciateException("The invocation of APT has failed. See http://jira.codehaus.org/browse/ENUNCIATE-771 for a case where this has been seen. There is no explanation for this error.");
    }
    apf.throwAnyErrors();
  }
View Full Code Here

    }

    compileDir.mkdirs();
    int procCode = com.sun.tools.javac.Main.compile(args.toArray(new String[args.size()]));
    if (procCode != 0) {
      throw new EnunciateException("compile failed.");
    }
  }
View Full Code Here

TOP

Related Classes of org.codehaus.enunciate.EnunciateException

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.