--- old/src/share/jaxws_classes/com/sun/tools/internal/ws/processor/generator/GeneratorBase.java 2013-04-04 15:26:04.624611793 +0200 +++ new/src/share/jaxws_classes/com/sun/tools/internal/ws/processor/generator/GeneratorBase.java 2013-04-04 15:26:04.572611793 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -60,11 +60,11 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import javax.annotation.processing.Filer; +import javax.tools.FileObject; + +import javax.tools.StandardLocation; -/** - * - * @author WS Development Team - */ public abstract class GeneratorBase implements ModelVisitor { private File destDir; private String targetVersion; @@ -96,28 +96,33 @@ } } + @Override public void visit(Model model) throws Exception { for (Service service : model.getServices()) { service.accept(this); } } + @Override public void visit(Service service) throws Exception { for (Port port : service.getPorts()) { port.accept(this); } } + @Override public void visit(Port port) throws Exception { for (Operation operation : port.getOperations()) { operation.accept(this); } } + @Override public void visit(Operation operation) throws Exception { operation.getRequest().accept(this); - if (operation.getResponse() != null) + if (operation.getResponse() != null) { operation.getResponse().accept(this); + } Iterator faults = operation.getFaultsSet().iterator(); if (faults != null) { Fault fault; @@ -128,21 +133,20 @@ } } - public void visit(Parameter param) throws Exception { - } + @Override + public void visit(Parameter param) throws Exception {} - public void visit(Block block) throws Exception { - } + @Override + public void visit(Block block) throws Exception {} - public void visit(Response response) throws Exception { - } + @Override + public void visit(Response response) throws Exception {} + @Override + public void visit(Request request) throws Exception {} - public void visit(Request request) throws Exception { - } - - public void visit(Fault fault) throws Exception { - } + @Override + public void visit(Fault fault) throws Exception {} public List getJAXWSClassComment(){ return getJAXWSClassComment(targetVersion); @@ -162,8 +166,9 @@ cls = cm._class(className, type); } catch (JClassAlreadyExistsException e){ cls = cm._getClass(className); - if(cls == null) + if (cls == null) { throw e; + } } return cls; } @@ -181,8 +186,9 @@ protected void writeHandlerConfig(String className, JDefinedClass cls, WsimportOptions options) { Element e = options.getHandlerChainConfiguration(); - if(e == null) + 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"); @@ -199,17 +205,25 @@ } 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); + Filer filer = options.filer; try { - IndentingWriter p = - new IndentingWriter( - new OutputStreamWriter(new FileOutputStream(hcFile))); + IndentingWriter p; + FileObject jfo; + if (filer != null) { + jfo = filer.createResource(StandardLocation.SOURCE_OUTPUT, + Names.getPackageName(name), getHandlerConfigFileName(name)); + options.addGeneratedFile(new File(jfo.toUri())); + p = new IndentingWriter(new OutputStreamWriter(jfo.openOutputStream())); + } else { // leave for backw. compatibility now + String hcName = getHandlerConfigFileName(name); + File packageDir = DirectoryUtil.getOutputDirectoryFor(name, destDir); + File hcFile = new File(packageDir, hcName); + options.addGeneratedFile(hcFile); + p = new IndentingWriter(new OutputStreamWriter(new FileOutputStream(hcFile))); + } + Transformer it = XmlUtil.newTransformer(); it.setOutputProperty(OutputKeys.METHOD, "xml");