You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/06/21 16:35:45 UTC

svn commit: r191661 - in /incubator/beehive/sandbox/ekoneil/wsm/src/core: META-INF/services/ org/apache/beehive/wsm/processor2/ org/apache/beehive/wsm/processor2/apt/ org/apache/beehive/wsm/processor2/checker/ org/apache/beehive/wsm/processor2/generato...

Author: ekoneil
Date: Tue Jun 21 07:35:44 2005
New Revision: 191661

URL: http://svn.apache.org/viewcvs?rev=191661&view=rev
Log:
Initial checkin of new WSM annotation processor prototype.

This is currently *incomplete* but has the framework in place to do annotation processing and code generation in three stages:

- checking
- model construction (via JavaBeans and a factory)
- generation

using four distinct pieces of code:

- Jsr181AnnotationChecker
- model/factory/BeehiveWsMetadataFactory
- BeehiveWs* JavaBeans
- AxisGenerator (need a base class for this)

Lots of stuff is undone -- handling endpoint interfaces, some annotation checking, a generation abstraction, etc. 

BB: self
DRT: sandbox/ekoneil pass (all but WSM)


Added:
    incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/
    incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/ProcessorException.java
    incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/TwoPhaseAnnotationProcessor.java
    incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/apt/
    incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/apt/Jsr181AnnotationConstants.java
    incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/apt/WsmAnnotationProcessor.java
    incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/apt/WsmAnnotationProcessorFactory.java
    incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/checker/
    incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/checker/Jsr181AnnotationChecker.java
    incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/generator/
    incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/generator/AxisGenerator.java
    incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/
    incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/BeehiveWsTypeMetadata.java
    incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/
    incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/BeehiveWsMetadataFactory.java
    incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/BeehiveWsTypeMetadataFactory.java
    incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/impl/
    incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/impl/MirrorFactoryImpl.java
    incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/impl/ReflectionFactoryImpl.java
    incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/impl/WSDLFactoryImpl.java
Modified:
    incubator/beehive/sandbox/ekoneil/wsm/src/core/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory

Modified: incubator/beehive/sandbox/ekoneil/wsm/src/core/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
URL: http://svn.apache.org/viewcvs/incubator/beehive/sandbox/ekoneil/wsm/src/core/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory?rev=191661&r1=191660&r2=191661&view=diff
==============================================================================
--- incubator/beehive/sandbox/ekoneil/wsm/src/core/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory (original)
+++ incubator/beehive/sandbox/ekoneil/wsm/src/core/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory Tue Jun 21 07:35:44 2005
@@ -1,5 +1,5 @@
 #
 # This configures APT so the WsmAnnotationProcessorFactory can be used to process WSM annotations
 #
-org.apache.beehive.wsm.processor.apt.WsmAnnotationProcessorFactory
+org.apache.beehive.wsm.processor2.apt.WsmAnnotationProcessorFactory
 

Added: incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/ProcessorException.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/ProcessorException.java?rev=191661&view=auto
==============================================================================
--- incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/ProcessorException.java (added)
+++ incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/ProcessorException.java Tue Jun 21 07:35:44 2005
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.wsm.processor2;
+
+/**
+ * A simple exception wrapper class used for processor failures.
+ * It subclasses runtime exception because user errors that result in code
+ * generation failures are reported through the APT messager class.
+ */
+public class ProcessorException
+    extends RuntimeException {
+    
+    public ProcessorException(String msg, Exception e) {
+        super(msg, e);
+    }
+
+    public ProcessorException(String msg) {
+        super(msg);
+    }
+
+    public ProcessorException(Exception e) {
+        super("Code Generation Exception", e);
+    }
+}
+

Added: incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/TwoPhaseAnnotationProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/TwoPhaseAnnotationProcessor.java?rev=191661&view=auto
==============================================================================
--- incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/TwoPhaseAnnotationProcessor.java (added)
+++ incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/TwoPhaseAnnotationProcessor.java Tue Jun 21 07:35:44 2005
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.wsm.processor2;
+
+import java.util.Collection;
+import java.util.Set;
+
+import com.sun.mirror.apt.AnnotationProcessor;
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.declaration.AnnotationTypeDeclaration;
+import com.sun.mirror.declaration.Declaration;
+
+/**
+ * The TwoPhaseAnnotationProcessor class is an abstract class that implements the APT
+ * AnnotationProcessor interface.   It breaks the work of the process() method of the
+ * AnnotationProcessor down into two distinct phases, represented as abstract method
+ * of TwoPhaseAnnotationProcessor that are to be implemented by concrete subclasses.
+ * The two phases of processing are:
+ * <ul>
+ * <li>The <b>check</b> phase is used to validate input Declarations that have been
+ * annotated with annotations claimed by the processor to ensure that it
+ * is semantically valid.  If the presence of the input Declaration implies the need
+ * to add new files, and those files need to be visible during the check phase for
+ * other Declarations, then the AnnotationProcessorEnvironment's Filer API should be
+ * used to add those files in this phase.  The adding of such files at this point
+ * should typically not result in their emission to persistent storage (i.e. disk),
+ * but rather be kept in memory to be referenced by the check phase of other
+ * Declarations.
+ * <li>The <b>generate</b> phase will actually emit any source, binary, or class files
+ * that are derived from the input Declaration, including files added via the Filer
+ * API during the check phase.  The Filer API may also be used in this phase to add
+ * new files, however, such additions will not be visible during the check phase of
+ * any Declarations.
+ * </ul>
+ * The benefits of breaking process() down into check() and generate() phases are:
+ * <ol>
+ * <li>Makes it possible to perform the semantic validation of Declarations without
+ * necessarily resulting in code generation.
+ * <li>Provides a clearer association between input Declarations and generator output.
+ * </ol>
+ * TwoPhaseAnnotationProcessor is intended provide a uniform mechanism for writing
+ * AnnotationProcessor implementations that can be used in tooling environments more
+ * sophisticated than command-line tools (that may not do all their work on source
+ * in a single pass).  Such environments will typically also provide implementations
+ * of the AnnotationProcessorEnvironment and associated interfaces (Messager,
+ * Filer etc).
+ */
+abstract public class TwoPhaseAnnotationProcessor
+    implements AnnotationProcessor {
+
+    private Set<AnnotationTypeDeclaration> _atds;
+    private AnnotationProcessorEnvironment _env;
+
+    public TwoPhaseAnnotationProcessor(Set<AnnotationTypeDeclaration> atds, AnnotationProcessorEnvironment env) {
+        _atds = atds;
+        _env = env;
+    }
+
+    /**
+     * Implements AnnotationProcessor.process() as two phases, "check" and "generate".
+     */
+    public void process() {
+        check();
+        generate();
+    }
+
+    /**
+     * Performs semantic validation of input Declarations that are annotated with
+     * annotations claimed by this AnnotationProcessor.
+     */
+    public void check() {
+        for(AnnotationTypeDeclaration atd : _atds) {
+            Collection<Declaration> decls = _env.getDeclarationsAnnotatedWith(atd);
+            for(Declaration decl : decls) {
+                check(decl);
+            }
+        }
+    }
+
+    /**
+     * Emits additional artifacts for input Declarations that are annotated with
+     * annotations claimed by this AnnotationProcessor.
+     */
+    public void generate()
+        throws ProcessorException {
+        for(AnnotationTypeDeclaration atd : _atds) {
+            Collection<Declaration> decls = _env.getDeclarationsAnnotatedWith(atd);
+            for(Declaration decl : decls) {
+                generate(decl);
+            }
+        }
+    }
+
+    /**
+     * The check method is responsible for all semantic validation of the input Declaration.
+     * All semantic warnings/errors associated with the input Declaration should
+     * be output during check via a Messager obtained from the
+     * AnnotationProcessorEnvironment.
+     * If the presence of the input Declaration implies the need to add new files,
+     * and those files need to be visible during the check phase for
+     * other Declarations, then the AnnotationProcessorEnvironment's Filer API should be
+     * used to add those files in this phase.  The adding of such files at this point
+     * should typically not result in their emission to persistent storage (i.e. disk),
+     * but rather be kept in memory to be referenced by the check phase of other
+     * Declarations.
+     */
+    abstract public void check(Declaration decl);
+
+    /**
+     * The generate method is responsible for the generation of any additional artifacts
+     * (source, class, or binary) that are derived from the input Declaration.
+     */
+    abstract public void generate(Declaration decl);
+
+    protected AnnotationProcessorEnvironment getAnnotationProcessorEnvironment() {
+        return _env;
+    }
+}

Added: incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/apt/Jsr181AnnotationConstants.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/apt/Jsr181AnnotationConstants.java?rev=191661&view=auto
==============================================================================
--- incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/apt/Jsr181AnnotationConstants.java (added)
+++ incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/apt/Jsr181AnnotationConstants.java Tue Jun 21 07:35:44 2005
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.wsm.processor2.apt;
+
+interface Jsr181AnnotationConstants {
+
+    String JWS_PACKAGE_PREFIX = "javax.jws";
+    String SOAP_PACKAGE_PREFIX = "javax.jws.soap";
+
+    String WEB_SERVICE = "WebService";
+    String WEB_METHOD = "WebMethod";
+    String WEB_PARAM = "WebParam";
+    String ONE_WAY = "Oneway";
+    String WEB_RESULT = "WebResult";
+    String HANDLER_CHAIN = "HandlerChain";
+    String INIT_PARAM = "InitParam";
+    String SOAP_BINDING = "SOAPBinding";
+    String SOAP_MESSAGE_HANDLER = "SOAPMessageHandler";
+    String SOAP_MESSAGE_HANDLERS = "SOAPMessageHandlers";
+}

Added: incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/apt/WsmAnnotationProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/apt/WsmAnnotationProcessor.java?rev=191661&view=auto
==============================================================================
--- incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/apt/WsmAnnotationProcessor.java (added)
+++ incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/apt/WsmAnnotationProcessor.java Tue Jun 21 07:35:44 2005
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.wsm.processor2.apt;
+
+import org.apache.beehive.wsm.processor2.TwoPhaseAnnotationProcessor;
+import org.apache.beehive.wsm.processor2.generator.AxisGenerator;
+import org.apache.beehive.wsm.processor2.checker.Jsr181AnnotationChecker;
+import com.sun.mirror.declaration.Declaration;
+import com.sun.mirror.declaration.AnnotationTypeDeclaration;
+import com.sun.mirror.declaration.TypeDeclaration;
+import com.sun.mirror.declaration.EnumDeclaration;
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.apt.Messager;
+
+import java.util.Set;
+
+public class WsmAnnotationProcessor
+    extends TwoPhaseAnnotationProcessor {
+
+    public WsmAnnotationProcessor(Set<AnnotationTypeDeclaration> atds, AnnotationProcessorEnvironment env) {
+        super(atds, env);
+    }
+
+    public void check(Declaration decl) {
+        AnnotationProcessorEnvironment env = getAnnotationProcessorEnvironment();
+
+        if(!(decl instanceof TypeDeclaration) || decl instanceof EnumDeclaration)
+            return;
+
+        TypeDeclaration typeDecl = (TypeDeclaration)decl;
+        Jsr181AnnotationChecker checker = Jsr181AnnotationChecker.getInstance();
+        checker.setMessager(env.getMessager());
+        checker.check(typeDecl);
+    }
+
+    public void generate(Declaration decl) {
+        if(!(decl instanceof TypeDeclaration))
+            return;
+
+        AxisGenerator axisGenerator = AxisGenerator.getInstance();
+        axisGenerator.generate((TypeDeclaration)decl);
+    }
+}

Added: incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/apt/WsmAnnotationProcessorFactory.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/apt/WsmAnnotationProcessorFactory.java?rev=191661&view=auto
==============================================================================
--- incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/apt/WsmAnnotationProcessorFactory.java (added)
+++ incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/apt/WsmAnnotationProcessorFactory.java Tue Jun 21 07:35:44 2005
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.wsm.processor2.apt;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Arrays;
+import java.util.Set;
+
+import com.sun.mirror.apt.AnnotationProcessorFactory;
+import com.sun.mirror.apt.AnnotationProcessor;
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.declaration.AnnotationTypeDeclaration;
+
+public class WsmAnnotationProcessorFactory
+    implements AnnotationProcessorFactory, Jsr181AnnotationConstants {
+
+    private static final Collection<String> SUPPORTED_ANNOTATIONS =
+        Collections.unmodifiableCollection(Arrays.asList(new String[]{
+            JWS_PACKAGE_PREFIX + "." + WEB_SERVICE,
+            JWS_PACKAGE_PREFIX + "." + WEB_METHOD,
+            JWS_PACKAGE_PREFIX + "." + WEB_PARAM,
+            JWS_PACKAGE_PREFIX + "." + ONE_WAY,
+            JWS_PACKAGE_PREFIX + "." + WEB_RESULT,
+            JWS_PACKAGE_PREFIX + "." + HANDLER_CHAIN,
+            SOAP_PACKAGE_PREFIX + "." + INIT_PARAM,
+            SOAP_PACKAGE_PREFIX + "." + SOAP_BINDING,
+            SOAP_PACKAGE_PREFIX + "." + SOAP_MESSAGE_HANDLER,
+            SOAP_PACKAGE_PREFIX + "." + SOAP_MESSAGE_HANDLERS
+        }));
+
+    private static final Collection<String> supportedOptions = Collections.emptySet();
+
+    public Collection<String> supportedAnnotationTypes() {
+        return SUPPORTED_ANNOTATIONS;
+    }
+
+    public Collection<String> supportedOptions() {
+        return supportedOptions;
+    }
+
+    public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> atds, AnnotationProcessorEnvironment env) {
+        return new WsmAnnotationProcessor(atds, env);
+    }
+}

Added: incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/checker/Jsr181AnnotationChecker.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/checker/Jsr181AnnotationChecker.java?rev=191661&view=auto
==============================================================================
--- incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/checker/Jsr181AnnotationChecker.java (added)
+++ incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/checker/Jsr181AnnotationChecker.java Tue Jun 21 07:35:44 2005
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.wsm.processor2.checker;
+
+import java.util.Collection;
+import javax.jws.WebService;
+import javax.jws.Oneway;
+import javax.jws.WebMethod;
+import javax.jws.HandlerChain;
+import javax.jws.soap.SOAPMessageHandlers;
+
+import com.sun.mirror.declaration.TypeDeclaration;
+import com.sun.mirror.declaration.ClassDeclaration;
+import com.sun.mirror.declaration.InterfaceDeclaration;
+import com.sun.mirror.declaration.Modifier;
+import com.sun.mirror.declaration.MethodDeclaration;
+import com.sun.mirror.apt.Messager;
+import com.sun.mirror.type.VoidType;
+
+/**
+ *
+ */
+public class Jsr181AnnotationChecker {
+
+    public static Jsr181AnnotationChecker getInstance() {
+        return new Jsr181AnnotationChecker();
+    }
+
+    private Messager _messager = null;
+
+    private Jsr181AnnotationChecker() {
+    }
+
+    public void setMessager(Messager messager) {
+        _messager = messager;
+    }
+
+    public void check(TypeDeclaration typeDecl) {
+
+        if(typeDecl instanceof ClassDeclaration)
+            validateClassDeclaration((ClassDeclaration)typeDecl);
+        else if(typeDecl instanceof InterfaceDeclaration)
+            validateInterfaceDeclaration((InterfaceDeclaration)typeDecl);
+        else assert false : "Should not get here";
+
+        /* todo: check the methods on the web service */
+        Collection<? extends MethodDeclaration> methods = typeDecl.getMethods();
+        for(MethodDeclaration methodDecl : methods) {
+            validateMethod(methodDecl);
+        }
+    }
+
+    private void validateClassDeclaration(ClassDeclaration classDecl) {
+
+        WebService wsAnnotation = classDecl.getAnnotation(WebService.class);
+        if(wsAnnotation == null) {
+            _messager.printError("No @WebService annotation found");
+        }
+
+        Collection<Modifier> modifiers = classDecl.getModifiers();
+        if(modifiers.contains(Modifier.ABSTRACT))
+            _messager.printError("@WebService implementation bean must not be abstract");
+
+        if(modifiers.contains(Modifier.FINAL))
+            _messager.printError("@WebService implementation bean must not be final");
+
+        /* todo: check that this is an outer class */
+
+        /* todo: check for a default constructor */
+
+        /* todo: ensure no finalize() method */
+
+        /* todo: 4.1.5 -- ensure that in the presence of an endpointInterface no other annotations exist */
+
+        HandlerChain handlerChain = classDecl.getAnnotation(HandlerChain.class);
+        SOAPMessageHandlers soapHandlers = classDecl.getAnnotation(SOAPMessageHandlers.class);
+
+        if(handlerChain != null && soapHandlers != null) {
+            /* todo: print error */
+        }
+
+        /* todo: check WSDL location */
+
+        /* todo: validate SOAPHandler annotations */
+
+        /* todo: validate HandlerChain annotation */
+    }
+
+    private void validateInterfaceDeclaration(InterfaceDeclaration intfDecl) {
+        /* todo: need to validate the endpoint interface */
+    }
+
+    private void validateMethod(MethodDeclaration methodDecl) {
+
+        Oneway oneway = methodDecl.getAnnotation(Oneway.class);
+        if(oneway != null) {
+            if(!(methodDecl.getReturnType() instanceof VoidType))
+                _messager.printError("@Oneway method " + methodDecl.getSimpleName() + " has illegal return type: " + methodDecl.getReturnType());
+
+            if(methodDecl.getThrownTypes().size() > 0)
+                _messager.printError("@oneway method " + methodDecl.getSimpleName() + " can not declare exceptions");
+
+            /* todo: ensure no OUT or INOUT parameters */
+        }
+
+        WebMethod webMethod = methodDecl.getAnnotation(WebMethod.class);
+        if(webMethod != null) {
+
+            /* todo: check public */
+            if(!(methodDecl.getModifiers().contains(Modifier.PUBLIC)))
+                _messager.printError("@WebMethod '" + methodDecl.getSimpleName() + "' must be public.");
+
+            /* todo: check not throwing RemoteException */
+
+            /* todo: check additional exceptions */
+
+            /* todo: something about return types? */
+
+            /* skipped checks -- are these still valid?
+                 - @Oneway and @WebMethod mutually exclusive
+             */
+        }
+    }
+}

Added: incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/generator/AxisGenerator.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/generator/AxisGenerator.java?rev=191661&view=auto
==============================================================================
--- incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/generator/AxisGenerator.java (added)
+++ incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/generator/AxisGenerator.java Tue Jun 21 07:35:44 2005
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.wsm.processor2.generator;
+
+import com.sun.mirror.declaration.TypeDeclaration;
+import org.apache.beehive.wsm.processor2.model.BeehiveWsTypeMetadata;
+import org.apache.beehive.wsm.processor2.model.factory.BeehiveWsMetadataFactory;
+import org.apache.beehive.wsm.processor2.model.factory.BeehiveWsTypeMetadataFactory;
+
+import javax.jws.WebService;
+
+public class AxisGenerator {
+
+    public static final AxisGenerator getInstance() {
+        return new AxisGenerator();
+    }
+
+    private AxisGenerator() {
+    }
+
+    public void generate(TypeDeclaration typeDecl) {
+
+        BeehiveWsTypeMetadataFactory factory =
+            BeehiveWsMetadataFactory.create(BeehiveWsMetadataFactory.FactoryType.MIRROR);
+
+        BeehiveWsTypeMetadata wsMetadata = factory.create(typeDecl);
+
+        /* todo: serialize the object model */
+        
+    }
+}

Added: incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/BeehiveWsTypeMetadata.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/BeehiveWsTypeMetadata.java?rev=191661&view=auto
==============================================================================
--- incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/BeehiveWsTypeMetadata.java (added)
+++ incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/BeehiveWsTypeMetadata.java Tue Jun 21 07:35:44 2005
@@ -0,0 +1,162 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.wsm.processor2.model;
+
+import org.apache.beehive.wsm.model.BeehiveWsSOAPBindingInfo;
+import org.apache.beehive.wsm.model.BeehiveWsMethodMetadata;
+import org.apache.beehive.wsm.model.ValidationException;
+import org.apache.beehive.wsm.model.BeehiveWsSOAPMessageHandlerInfo;
+import org.apache.beehive.wsm.model.java.JavaTypeInfo;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.util.Collections;
+
+/**
+   todo: need to complete the implementation of this JavaBean layer.
+ */
+public class BeehiveWsTypeMetadata {
+
+    private String _handlerConfigFileName = null;
+    private String _handlerConfigName = null;
+    private String _siValue = null;
+    private String _wsName = null;
+    private String _wsServiceName = null;
+    private String _wsTargetNamespace = null;
+    private String _wsEndpointInterface = null;
+    private String _wsWsdlLocation = null;
+    private String _wsClassName = null;
+    private ArrayList<BeehiveWsSOAPMessageHandlerInfo> _soapHandlers = new ArrayList<BeehiveWsSOAPMessageHandlerInfo>();
+    private HashMap<String, BeehiveWsMethodMetadata> _methodMap = new HashMap<String, BeehiveWsMethodMetadata>();
+    private BeehiveWsSOAPBindingInfo _soapBindingInfo = null;
+
+    public String getHcFileName() {
+        return _handlerConfigFileName;
+    }
+
+    public void setHcFileName(String hcFileName) {
+        _handlerConfigFileName = hcFileName;
+    }
+
+    public String getHcName() {
+        return _handlerConfigName;
+    }
+
+    public void setHcName(String hcName) {
+        _handlerConfigName = hcName;
+    }
+
+    public String getSiValue() {
+        return _siValue;
+    }
+
+    public void setSiValue(String siValue) {
+        _siValue = siValue;
+    }
+
+    public BeehiveWsSOAPBindingInfo getSoapBinding() {
+        return _soapBindingInfo;
+    }
+
+    public void setSoapBinding(BeehiveWsSOAPBindingInfo soapBinding) {
+        _soapBindingInfo = soapBinding;
+    }
+
+    public String getWsName() {
+        return _wsName;
+    }
+
+    public void setWsName(String wsName) {
+        _wsName = wsName;
+    }
+
+    public String getWsServiceName() {
+        return _wsServiceName;
+    }
+
+    public void setWsServiceName(String wsServiceName) {
+        _wsServiceName = wsServiceName;
+    }
+
+    public String getWsTargetNamespace() {
+        return _wsTargetNamespace;
+    }
+
+    public void setWsTargetNamespace(String wsTargetNamespace) {
+        _wsTargetNamespace = wsTargetNamespace;
+    }
+
+    public String[] getTargetNamespaceParts() {
+        /* todo: implement */
+        throw new UnsupportedOperationException("NYI");
+    }
+
+    public String getWsEndpointInterface() {
+        return _wsEndpointInterface;
+    }
+
+    public void setWsEndpointInterface(String wsEndpointInterface) {
+        _wsEndpointInterface = wsEndpointInterface;
+    }
+
+    public String getWsWsdlLocation() {
+        return _wsWsdlLocation;
+    }
+
+    public void setWsWsdlLocation(String wsWsdlLocation) {
+        _wsWsdlLocation = wsWsdlLocation;
+    }
+
+    public Collection<? extends BeehiveWsMethodMetadata> getMethods() {
+        return Collections.unmodifiableCollection(_methodMap.values());
+    }
+
+    public BeehiveWsMethodMetadata getMethod(String methodName, Class... paramTypes) {
+        /* todo: implement */
+        throw new UnsupportedOperationException("NYI");
+    }
+
+    public void addMethod(BeehiveWsMethodMetadata method)
+        throws ValidationException {
+        /* todo: implement */
+        throw new UnsupportedOperationException("NYI");
+    }
+
+    public List<? extends BeehiveWsSOAPMessageHandlerInfo> getSoapHandlers() {
+        return Collections.unmodifiableList(_soapHandlers);
+    }
+
+    public void addSOAPHandler(BeehiveWsSOAPMessageHandlerInfo soapHandler) {
+        _soapHandlers.add(soapHandler);
+    }
+
+    public String getClassName() {
+        return _wsClassName;
+    }
+
+    public void setClassName(String className) {
+        _wsClassName = className;
+    }
+
+    public void merge(JavaTypeInfo jt)
+        throws Exception {
+        /* todo: is this needed? */
+    }
+}

Added: incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/BeehiveWsMetadataFactory.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/BeehiveWsMetadataFactory.java?rev=191661&view=auto
==============================================================================
--- incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/BeehiveWsMetadataFactory.java (added)
+++ incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/BeehiveWsMetadataFactory.java Tue Jun 21 07:35:44 2005
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.wsm.processor2.model.factory;
+
+public class BeehiveWsMetadataFactory {
+
+    public enum FactoryType {
+        MIRROR, REFLECT, WSDL
+    }
+
+    private BeehiveWsMetadataFactory() {
+    }
+
+    public static final BeehiveWsTypeMetadataFactory create(FactoryType factoryType) {
+        String className = null;
+        if(factoryType == FactoryType.MIRROR)
+            className = "org.apache.beehive.wsm.processor2.model.factory.impl.MirrorFactoryImpl";
+        else throw new IllegalArgumentException("Can not create factory of type " + factoryType);
+
+        BeehiveWsTypeMetadataFactory factory = null;
+        try {
+            Class clazz = Class.forName(className);
+            factory = (BeehiveWsTypeMetadataFactory)clazz.newInstance();
+        }
+        catch(ClassNotFoundException e) {
+
+        }
+        catch(InstantiationException e) {
+
+        }
+        catch(IllegalAccessException e) {
+
+        }
+
+        return factory;
+    }
+}

Added: incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/BeehiveWsTypeMetadataFactory.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/BeehiveWsTypeMetadataFactory.java?rev=191661&view=auto
==============================================================================
--- incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/BeehiveWsTypeMetadataFactory.java (added)
+++ incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/BeehiveWsTypeMetadataFactory.java Tue Jun 21 07:35:44 2005
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.wsm.processor2.model.factory;
+
+import org.apache.beehive.wsm.processor2.model.BeehiveWsTypeMetadata;
+
+public abstract class BeehiveWsTypeMetadataFactory {
+
+    public abstract BeehiveWsTypeMetadata create(Object obj);
+}

Added: incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/impl/MirrorFactoryImpl.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/impl/MirrorFactoryImpl.java?rev=191661&view=auto
==============================================================================
--- incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/impl/MirrorFactoryImpl.java (added)
+++ incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/impl/MirrorFactoryImpl.java Tue Jun 21 07:35:44 2005
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.wsm.processor2.model.factory.impl;
+
+import org.apache.beehive.wsm.processor2.model.BeehiveWsTypeMetadata;
+import org.apache.beehive.wsm.processor2.model.factory.BeehiveWsTypeMetadataFactory;
+import com.sun.mirror.declaration.TypeDeclaration;
+
+import javax.jws.WebService;
+
+public class MirrorFactoryImpl
+    extends BeehiveWsTypeMetadataFactory {
+
+    private static final String SERVICE_SUFFIX = "Service";
+
+    public BeehiveWsTypeMetadata create(Object obj) {
+        assert obj instanceof TypeDeclaration;
+
+        TypeDeclaration typeDecl = (TypeDeclaration)obj;
+        WebService ws = typeDecl.getAnnotation(WebService.class);
+
+        BeehiveWsTypeMetadata wsMetadata = new BeehiveWsTypeMetadata();
+
+        if(ws.name().trim().length() == 0)
+            wsMetadata.setWsName(typeDecl.getSimpleName());
+        else wsMetadata.setWsName(ws.name());
+
+        if(ws.serviceName().trim().length() == 0)
+            wsMetadata.setWsServiceName(typeDecl.getSimpleName() + SERVICE_SUFFIX);
+        else wsMetadata.setWsServiceName(ws.serviceName());
+
+        wsMetadata.setWsTargetNamespace(ws.targetNamespace());
+        wsMetadata.setWsWsdlLocation(ws.wsdlLocation());
+        wsMetadata.setWsEndpointInterface(ws.endpointInterface());
+
+        /* todo: compute the targetNamespace correctly */
+
+        /* todo: HandlerChain.class */
+
+        /* todo: SOAPBinding.class */
+
+        /* todo: SOAPMessageHandlers.class */
+
+        /* todo: WebMethod(s) */
+
+        return wsMetadata;
+    }
+}

Added: incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/impl/ReflectionFactoryImpl.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/impl/ReflectionFactoryImpl.java?rev=191661&view=auto
==============================================================================
--- incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/impl/ReflectionFactoryImpl.java (added)
+++ incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/impl/ReflectionFactoryImpl.java Tue Jun 21 07:35:44 2005
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.wsm.processor2.model.factory.impl;
+
+import org.apache.beehive.wsm.processor2.model.BeehiveWsTypeMetadata;
+import org.apache.beehive.wsm.processor2.model.factory.BeehiveWsTypeMetadataFactory;
+
+class ReflectionFactoryImpl
+    extends BeehiveWsTypeMetadataFactory {
+
+    public BeehiveWsTypeMetadata create(Object obj) {
+        /* todo: implement */
+        throw new UnsupportedOperationException("NYI");
+    }
+}

Added: incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/impl/WSDLFactoryImpl.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/impl/WSDLFactoryImpl.java?rev=191661&view=auto
==============================================================================
--- incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/impl/WSDLFactoryImpl.java (added)
+++ incubator/beehive/sandbox/ekoneil/wsm/src/core/org/apache/beehive/wsm/processor2/model/factory/impl/WSDLFactoryImpl.java Tue Jun 21 07:35:44 2005
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.wsm.processor2.model.factory.impl;
+
+import org.apache.beehive.wsm.processor2.model.BeehiveWsTypeMetadata;
+import org.apache.beehive.wsm.processor2.model.factory.BeehiveWsTypeMetadataFactory;
+
+class WSDLFactoryImpl
+    extends BeehiveWsTypeMetadataFactory {
+
+    public BeehiveWsTypeMetadata create(Object obj) {
+        /* todo: implement */
+        throw new UnsupportedOperationException("NYI");
+    }
+
+}