001: /*
002: * Portions Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025: package com.sun.istack.internal.ws;
026:
027: import java.util.Collection;
028: import java.util.Collections;
029: import java.util.HashSet;
030: import java.util.Set;
031:
032: import com.sun.mirror.apt.*;
033: import com.sun.mirror.declaration.*;
034:
035: import com.sun.tools.internal.ws.processor.modeler.annotation.AnnotationProcessorContext;
036: import com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceAP;
037:
038: /*
039: * The JAX-WS {@com.sun.mirror.apt.AnnotationProcessorFactory AnnotationProcessorFactory}
040: * class used by the <a href="http://java.sun.com/j2se/1.5.0/docs/tooldocs/share/apt.html">APT</a>
041: * framework.
042: */
043: public class AnnotationProcessorFactoryImpl implements
044: AnnotationProcessorFactory {
045:
046: private static WebServiceAP wsAP;
047: /*
048: * Processor doesn't examine any options.
049: */
050: static final Collection<String> supportedOptions = Collections
051: .unmodifiableSet(new HashSet<String>());
052:
053: /*
054: * Supports javax.jws.*, javax.jws.soap.* and javax.xml.ws.* annotations.
055: */
056: static Collection<String> supportedAnnotations;
057: static {
058: Collection<String> types = new HashSet<String>();
059: types.add("javax.jws.HandlerChain");
060: types.add("javax.jws.Oneway");
061: types.add("javax.jws.WebMethod");
062: types.add("javax.jws.WebParam");
063: types.add("javax.jws.WebResult");
064: types.add("javax.jws.WebService");
065: types.add("javax.jws.soap.InitParam");
066: types.add("javax.jws.soap.SOAPBinding");
067: types.add("javax.jws.soap.SOAPMessageHandler");
068: types.add("javax.jws.soap.SOAPMessageHandlers");
069: types.add("javax.xml.ws.BeginService");
070: types.add("javax.xml.ws.EndService");
071: types.add("javax.xml.ws.BindingType");
072: types.add("javax.xml.ws.ParameterIndex");
073: types.add("javax.xml.ws.RequestWrapper");
074: types.add("javax.xml.ws.ResponseWrapper");
075: types.add("javax.xml.ws.ServiceMode");
076: types.add("javax.xml.ws.WebEndpoint");
077: types.add("javax.xml.ws.WebFault");
078: types.add("javax.xml.ws.WebServiceClient");
079: types.add("javax.xml.ws.WebServiceProvider");
080: types.add("javax.xml.ws.WebServiceRef");
081:
082: types.add("javax.xml.ws.security.MessageSecurity");
083: supportedAnnotations = Collections
084: .unmodifiableCollection(types);
085: }
086:
087: public AnnotationProcessorFactoryImpl() {
088: }
089:
090: public Collection<String> supportedOptions() {
091: return supportedOptions;
092: }
093:
094: public Collection<String> supportedAnnotationTypes() {
095: return supportedAnnotations;
096: }
097:
098: /*
099: * Return an instance of the {@link com.sun.istack.internal.ws.WSAP WSAP} AnnotationProcesor.
100: */
101: public AnnotationProcessor getProcessorFor(
102: Set<AnnotationTypeDeclaration> atds,
103: AnnotationProcessorEnvironment apEnv) {
104:
105: if (wsAP == null) {
106: AnnotationProcessorContext context = new AnnotationProcessorContext();
107: wsAP = new WebServiceAP(null, null, null, context);
108:
109: }
110: wsAP.init(apEnv);
111: return wsAP;
112: }
113: }
|