Exemplo n.º 1
0
 protected GeneratorBase(Model model, WsimportOptions options, ErrorReceiver receiver) {
   this.model = model;
   this.options = options;
   this.destDir = options.destDir;
   this.receiver = receiver;
   this.wsdlLocation = options.wsdlLocation;
   this.targetVersion = options.target.getVersion();
   this.cm = options.getCodeModel();
 }
Exemplo n.º 2
0
 protected void writeHandlerConfig(String className, JDefinedClass cls, WsimportOptions options) {
   Element e = options.getHandlerChainConfiguration();
   if (e == null) return;
   JAnnotationUse handlerChainAnn = cls.annotate(cm.ref(HandlerChain.class));
   NodeList nl = e.getElementsByTagNameNS("http://java.sun.com/xml/ns/javaee", "handler-chain");
   if (nl.getLength() > 0) {
     String fName = getHandlerConfigFileName(className);
     handlerChainAnn.param("file", fName);
     generateHandlerChainFile(e, className);
   }
 }
Exemplo n.º 3
0
  private void generateHandlerChainFile(Element hChains, String name) {
    String hcName = getHandlerConfigFileName(name);

    File packageDir = DirectoryUtil.getOutputDirectoryFor(name, destDir);
    File hcFile = new File(packageDir, hcName);

    options.addGeneratedFile(hcFile);

    try {
      IndentingWriter p = new IndentingWriter(new OutputStreamWriter(new FileOutputStream(hcFile)));
      Transformer it = XmlUtil.newTransformer();

      it.setOutputProperty(OutputKeys.METHOD, "xml");
      it.setOutputProperty(OutputKeys.INDENT, "yes");
      it.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
      it.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
      it.transform(new DOMSource(hChains), new StreamResult(p));
      p.close();
    } catch (Exception e) {
      throw new GeneratorException("generator.nestedGeneratorError", e);
    }
  }