You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by mm...@apache.org on 2004/09/09 19:48:25 UTC
svn commit: rev 43617 - in incubator/beehive/trunk/wsm: . drt/tests/org/apache/beehive/wsm/jsr181/model drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations src/runtime/org/apache/beehive/wsm/jsr181/model
Author: mmerz
Date: Thu Sep 9 10:48:24 2004
New Revision: 43617
Added:
incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/Jsr181ModelTest.java
incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeDocumentWrapper.java
incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeHandlerChainAnnotation.java
incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeInitParamAnnotation.java
incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeOneWayAnnotation.java
incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeQName.java
incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeSOAPMessageHandlerAnnotation.java
incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeSOAPMessageHandlersAnnotation.java
incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeSecurityIdentityAnnotation.java
incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeSecurityRoleAnnotation.java
incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeWebMethodAnnotation.java
Modified:
incubator/beehive/trunk/wsm/ (props changed)
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/InitParamInfo.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/QNameInfo.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/SOAPMessageHandlerInfo.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/SecurityRolesInfo.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/WebServiceMETHODMetadata.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/WebServicePARAMETERMetadata.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/WebServiceTYPEMetadata.java
Log:
Added junit test for the model, bug fixes, and fakeannotations to support the tests.
Contributor: Daryoush Mehrtash
Added: incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/Jsr181ModelTest.java
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/Jsr181ModelTest.java Thu Sep 9 10:48:24 2004
@@ -0,0 +1,349 @@
+package org.apache.beehive.wsm.jsr181.model;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.jws.InitParam;
+import javax.jws.QName;
+import javax.jws.soap.SOAPBinding;
+import javax.jws.soap.SOAPMessageHandler;
+
+import org.apache.beehive.wsm.jsr181.model.fakeAnnotations.FakeDocumentWrapper;
+import org.apache.beehive.wsm.jsr181.model.fakeAnnotations.FakeHandlerChainAnnotation;
+import org.apache.beehive.wsm.jsr181.model.fakeAnnotations.FakeInitParamAnnotation;
+import org.apache.beehive.wsm.jsr181.model.fakeAnnotations.FakeOneWayAnnotation;
+import org.apache.beehive.wsm.jsr181.model.fakeAnnotations.FakeQName;
+import org.apache.beehive.wsm.jsr181.model.fakeAnnotations.FakeSOAPBindingAnnotation;
+import org.apache.beehive.wsm.jsr181.model.fakeAnnotations.FakeSOAPMessageHandlerAnnotation;
+import org.apache.beehive.wsm.jsr181.model.fakeAnnotations.FakeSOAPMessageHandlersAnnotation;
+import org.apache.beehive.wsm.jsr181.model.fakeAnnotations.FakeSecurityIdentityAnnotation;
+import org.apache.beehive.wsm.jsr181.model.fakeAnnotations.FakeSecurityRoleAnnotation;
+import org.apache.beehive.wsm.jsr181.model.fakeAnnotations.FakeWebMethodAnnotation;
+import org.apache.beehive.wsm.jsr181.model.fakeAnnotations.FakeWebServiceAnnotation;
+
+import junit.framework.TestCase;
+
+public class Jsr181ModelTest extends TestCase {
+
+ public void setUp() {
+ }
+
+ public void tearDown() {
+ }
+
+ // test TYPE level annotations
+
+ public void testTYPERequiredAnnotations() throws Exception {
+ // test to make sure the Type throws an exception if there are no
+ // WebMethod annotation defined.
+ Collection<WebServiceMETHODMetadata> methodMetadata = new ArrayList<WebServiceMETHODMetadata>();
+ Collection<Annotation> typeAnnotations = new ArrayList<Annotation>();
+ typeAnnotations.add(new FakeSOAPBindingAnnotation(
+ SOAPBinding.Style.RPC, SOAPBinding.Use.ENCODED,
+ SOAPBinding.ParameterStyle.DEFAULT));
+ try {
+ WebServiceTYPEMetadata type = new WebServiceTYPEMetadata(
+ typeAnnotations, "a.b.c.testclass", methodMetadata);
+ assertTrue(
+ "Error, the TYPE annotation should fail without @WebService",
+ false);
+ } catch (IllegalArgumentException e) {
+ // good case
+ }
+ }
+
+ public void testTYPEWebServiceDefaults() throws Exception {
+ Collection<WebServiceMETHODMetadata> methodMetadata = new ArrayList<WebServiceMETHODMetadata>();
+ Collection<Annotation> typeAnnotations = new ArrayList<Annotation>();
+ typeAnnotations.add(new FakeWebServiceAnnotation("", "", "", "", ""));
+ WebServiceTYPEMetadata type = new WebServiceTYPEMetadata(
+ typeAnnotations, "a.b.c.testclass", methodMetadata);
+ assertTrue("Invalid WebService Name, got: " + type.getWsName(), type
+ .getWsName().compareTo("testclass") == 0);
+ assertTrue(type.getWsServiceName().compareTo("testclassService") == 0);
+ assertTrue(type.getWsWsdlLocation().length() == 0);
+ assertTrue("Invalid target name space: " + type.getWsTargetNamespace(),
+ type.getWsTargetNamespace().compareTo("http://c.b.a") == 0);
+ }
+
+ public void testTYPEWebServiceAnnotation() throws Exception {
+ Collection<WebServiceMETHODMetadata> methodMetadata = new ArrayList<WebServiceMETHODMetadata>();
+ Collection<Annotation> typeAnnotations = new ArrayList<Annotation>();
+ typeAnnotations.add(new FakeWebServiceAnnotation("testname",
+ "testserviceName", "testwsdllocation", "testtargetnamespace",
+ "testendpointinterface"));
+ WebServiceTYPEMetadata type = new WebServiceTYPEMetadata(
+ typeAnnotations, "a.b.c.testclass", methodMetadata);
+ assertTrue(type.getWsName().compareTo("testname") == 0);
+ assertTrue(type.getWsServiceName().compareTo("testserviceName") == 0);
+ assertTrue(type.getWsWsdlLocation().compareTo("testwsdllocation") == 0);
+ assertTrue(type.getWsTargetNamespace().compareTo("testtargetnamespace") == 0);
+
+ }
+
+ public void testTYPESOAPBindingAnnotationDefaults() throws Exception {
+ Collection<WebServiceMETHODMetadata> methodMetadata = new ArrayList<WebServiceMETHODMetadata>();
+ Collection<Annotation> typeAnnotations = new ArrayList<Annotation>();
+ typeAnnotations.add(new FakeWebServiceAnnotation("testname",
+ "testserviceName", "testwsdllocation", "testtargetnamespace",
+ "testendpointinterface"));
+ typeAnnotations.add(new FakeSOAPBindingAnnotation(
+ SOAPBinding.Style.DEFAULT, SOAPBinding.Use.DEFAULT,
+ SOAPBinding.ParameterStyle.DEFAULT));
+ WebServiceTYPEMetadata type = new WebServiceTYPEMetadata(
+ typeAnnotations, "a.b.c.testclass", methodMetadata);
+ assertTrue(type.getSoapBinding().getStyle() == SOAPBinding.Style.DOCUMENT);
+ assertTrue(type.getSoapBinding().getUse() == SOAPBinding.Use.LITERAL);
+ assertTrue(type.getSoapBinding().getParameterStyle() == SOAPBinding.ParameterStyle.WRAPPED);
+ }
+
+ public void testTYPESOAPBindingAnnotation() throws Exception {
+ Collection<WebServiceMETHODMetadata> methodMetadata = new ArrayList<WebServiceMETHODMetadata>();
+ Collection<Annotation> typeAnnotations = new ArrayList<Annotation>();
+ typeAnnotations.add(new FakeWebServiceAnnotation("", "", "", "", ""));
+
+ typeAnnotations.add(new FakeSOAPBindingAnnotation(
+ SOAPBinding.Style.RPC, SOAPBinding.Use.ENCODED,
+ SOAPBinding.ParameterStyle.BARE));
+ WebServiceTYPEMetadata type = new WebServiceTYPEMetadata(
+ typeAnnotations, "a.b.c.testclass", methodMetadata);
+ assertTrue(type.getSoapBinding().getStyle() == SOAPBinding.Style.RPC);
+ assertTrue(type.getSoapBinding().getUse() == SOAPBinding.Use.ENCODED);
+ assertTrue(type.getSoapBinding().getParameterStyle() == SOAPBinding.ParameterStyle.BARE);
+ }
+
+ // no test for default HandlerChains, all fields are required in the
+ // @HandlerChain
+
+ public void testTYPEHandlerChainAnnotation() throws Exception {
+ Collection<WebServiceMETHODMetadata> methodMetadata = new ArrayList<WebServiceMETHODMetadata>();
+ Collection<Annotation> typeAnnotations = new ArrayList<Annotation>();
+ typeAnnotations.add(new FakeWebServiceAnnotation("", "", "", "", ""));
+
+ typeAnnotations.add(new FakeHandlerChainAnnotation("testfile",
+ "testname"));
+ WebServiceTYPEMetadata type = new WebServiceTYPEMetadata(
+ typeAnnotations, "a.b.c.testclass", methodMetadata);
+ assertTrue(type.getHcFileName() == "testfile");
+ assertTrue(type.getHcName() == "testname");
+ }
+
+ // test empty handler list
+ public void testTYPESoapMessageHandlersDefaults1() throws Exception {
+ Collection<WebServiceMETHODMetadata> methodMetadata = new ArrayList<WebServiceMETHODMetadata>();
+ Collection<Annotation> typeAnnotations = new ArrayList<Annotation>();
+ typeAnnotations.add(new FakeWebServiceAnnotation("", "", "", "", ""));
+
+ FakeSOAPMessageHandlerAnnotation[] emptyHandlers = new FakeSOAPMessageHandlerAnnotation[0];
+ typeAnnotations
+ .add(new FakeSOAPMessageHandlersAnnotation(emptyHandlers));
+ WebServiceTYPEMetadata type = new WebServiceTYPEMetadata(
+ typeAnnotations, "a.b.c.testclass", methodMetadata);
+ assertTrue(type.getSoapHandlers().size() == 0);
+
+ }
+
+ // test a single default handler in the handlers list
+ public void testTYPESoapMessageHandlersDefaults2() throws Exception {
+ Collection<WebServiceMETHODMetadata> methodMetadata = new ArrayList<WebServiceMETHODMetadata>();
+ Collection<Annotation> typeAnnotations = new ArrayList<Annotation>();
+ typeAnnotations.add(new FakeWebServiceAnnotation("", "", "", "", ""));
+
+ SOAPMessageHandler[] defaultHandlers = new FakeSOAPMessageHandlerAnnotation[1];
+ defaultHandlers[0] = new FakeSOAPMessageHandlerAnnotation("",
+ "soaphandlerclass", new FakeInitParamAnnotation[0],
+ new String[0], new FakeQName[0]);
+ typeAnnotations.add(new FakeSOAPMessageHandlersAnnotation(
+ defaultHandlers));
+ WebServiceTYPEMetadata type = new WebServiceTYPEMetadata(
+ typeAnnotations, "a.b.c.testclass", methodMetadata);
+ assertTrue("number of handlers returned: "
+ + type.getSoapHandlers().size(),
+ type.getSoapHandlers().size() == 1);
+ SOAPMessageHandlerInfo handler = type.getSoapHandlers().get(0);
+ assertTrue(handler.getName().compareTo("soaphandlerclass") == 0);
+ assertTrue(handler.getClassName().compareTo("soaphandlerclass") == 0);
+ assertTrue(handler.getParams().size() == 0);
+ assertTrue(handler.getRoles().size() == 0);
+ assertTrue(handler.getHeaders().size() == 0);
+ }
+
+ public void testTYPESoapMessageHandlers() throws Exception {
+ Collection<WebServiceMETHODMetadata> methodMetadata = new ArrayList<WebServiceMETHODMetadata>();
+ Collection<Annotation> typeAnnotations = new ArrayList<Annotation>();
+ typeAnnotations.add(new FakeWebServiceAnnotation("", "", "", "", ""));
+
+ InitParam[] params = { new FakeInitParamAnnotation("paramname",
+ "paramvalue") };
+ String[] roles = { "messagehandlerroles" };
+ QName[] headers = { new FakeQName("messagehanderheadernamespace",
+ "messagehanderheaderlocalname") };
+ SOAPMessageHandler[] defaultHandlers = { new FakeSOAPMessageHandlerAnnotation(
+ "", "soaphandlerclass", params, roles, headers) };
+ typeAnnotations.add(new FakeSOAPMessageHandlersAnnotation(
+ defaultHandlers));
+ WebServiceTYPEMetadata type = new WebServiceTYPEMetadata(
+ typeAnnotations, "a.b.c.testclass", methodMetadata);
+ assertTrue("number of handlers returned: "
+ + type.getSoapHandlers().size(),
+ type.getSoapHandlers().size() == 1);
+ SOAPMessageHandlerInfo handler = type.getSoapHandlers().get(0);
+ assertTrue(handler.getName().compareTo("soaphandlerclass") == 0);
+ assertTrue(handler.getClassName().compareTo("soaphandlerclass") == 0);
+ assertTrue(handler.getParams().size() == 1);
+ assertTrue(handler.getRoles().size() == 1);
+ assertTrue(handler.getHeaders().size() == 1);
+
+ InitParamInfo p = handler.getParams().iterator().next();
+ assert (p.getName().compareTo("paramname") == 0);
+ assert (p.getValue().compareTo("paramvalue") == 0);
+
+ assert (handler.getRoles().iterator().next().compareTo(
+ "messagehandlerroles") == 0);
+
+ QNameInfo q = handler.getHeaders().iterator().next();
+ assert (q.getNamespaceURI().compareTo("messagehanderheadernamespace") == 0);
+ assert (q.getLocalName().compareTo("messagehanderheaderlocalname") == 0);
+ }
+
+ public void testTYPESecurityRolesDefaults() throws Exception {
+ Collection<WebServiceMETHODMetadata> methodMetadata = new ArrayList<WebServiceMETHODMetadata>();
+ Collection<Annotation> typeAnnotations = new ArrayList<Annotation>();
+ typeAnnotations.add(new FakeWebServiceAnnotation("", "", "", "", ""));
+ typeAnnotations.add(new FakeSecurityRoleAnnotation(null, null));
+ WebServiceTYPEMetadata type = new WebServiceTYPEMetadata(
+ typeAnnotations, "a.b.c.testclass", methodMetadata);
+
+ assertNull(type.getSecurityRoles().getRolesAllowed());
+ assertNull(type.getSecurityRoles().getRolesReferenced());
+
+ }
+
+ public void testTYPESecurityRoles() throws Exception {
+ Collection<WebServiceMETHODMetadata> methodMetadata = new ArrayList<WebServiceMETHODMetadata>();
+ Collection<Annotation> typeAnnotations = new ArrayList<Annotation>();
+ typeAnnotations.add(new FakeWebServiceAnnotation("", "", "", "", ""));
+ String[] rolesAllowed = { "rolesallowed" };
+ String[] rolesReferenced = { "rolesreferenced" };
+ typeAnnotations.add(new FakeSecurityRoleAnnotation(rolesAllowed,
+ rolesReferenced));
+ WebServiceTYPEMetadata type = new WebServiceTYPEMetadata(
+ typeAnnotations, "a.b.c.testclass", methodMetadata);
+
+ assertTrue(type.getSecurityRoles().getRolesAllowed().size() == 1);
+ assertTrue(type.getSecurityRoles().getRolesAllowed().iterator().next()
+ .compareTo("rolesallowed") == 0);
+ assertTrue(type.getSecurityRoles().getRolesReferenced().size() == 1);
+ assertTrue(type.getSecurityRoles().getRolesReferenced().iterator()
+ .next().compareTo("rolesreferenced") == 0);
+ }
+
+ public void testTYPESecurityIdentityDefaults() throws Exception {
+ Collection<WebServiceMETHODMetadata> methodMetadata = new ArrayList<WebServiceMETHODMetadata>();
+ Collection<Annotation> typeAnnotations = new ArrayList<Annotation>();
+ typeAnnotations.add(new FakeWebServiceAnnotation("", "", "", "", ""));
+ typeAnnotations.add(new FakeSecurityIdentityAnnotation(null));
+ WebServiceTYPEMetadata type = new WebServiceTYPEMetadata(
+ typeAnnotations, "a.b.c.testclass", methodMetadata);
+
+ assertNull(type.getSiRunAs());
+
+ }
+
+ public void testTYPESecurityIdentity() throws Exception {
+ Collection<WebServiceMETHODMetadata> methodMetadata = new ArrayList<WebServiceMETHODMetadata>();
+ Collection<Annotation> typeAnnotations = new ArrayList<Annotation>();
+ typeAnnotations.add(new FakeWebServiceAnnotation("", "", "", "", ""));
+ typeAnnotations
+ .add(new FakeSecurityIdentityAnnotation("runasidentity"));
+ WebServiceTYPEMetadata type = new WebServiceTYPEMetadata(
+ typeAnnotations, "a.b.c.testclass", methodMetadata);
+
+ assertTrue(type.getSiRunAs().compareTo("runasidentity") == 0);
+ }
+
+ //TODO: test METHOD level
+ public void testMETHODRequiredAnnotations() throws Exception {
+ Collection<Annotation> methodAnnotations = new ArrayList<Annotation>();
+ try {
+ WebServiceMETHODMetadata method = new WebServiceMETHODMetadata(
+ methodAnnotations, "methodname", Void.class, null);
+ assertTrue(
+ "Error, the METHOD annotation should fail without @WebMethod",
+ false);
+ } catch (IllegalArgumentException e) {
+ // good case
+ }
+
+ methodAnnotations.add(new FakeWebMethodAnnotation("", ""));
+ try {
+ WebServiceMETHODMetadata method = new WebServiceMETHODMetadata(
+ methodAnnotations, null, Void.class, null);
+ assertTrue(
+ "Error, the METHOD annotation should fail without method name",
+ false);
+ } catch (IllegalArgumentException e) {
+ // good case
+ }
+ try {
+ WebServiceMETHODMetadata method = new WebServiceMETHODMetadata(
+ methodAnnotations, "methodName", null, null);
+ assertTrue(
+ "Error, the METHOD annotation should fail without return type class",
+ false);
+ } catch (IllegalArgumentException e) {
+ // good case
+ }
+ }
+
+ public void testMETHODWebMethodDefaults() throws Exception {
+ Collection<Annotation> methodAnnotations = new ArrayList<Annotation>();
+ methodAnnotations.add(new FakeWebMethodAnnotation("", ""));
+ WebServiceMETHODMetadata method = new WebServiceMETHODMetadata(
+ methodAnnotations, "methodname", Void.class, null);
+ assertTrue(method.getWmOperationName().compareTo("methodname") == 0);
+ assertTrue(method.getWmAction().length() == 0);
+
+ }
+
+ public void testMETHODWebMethod() throws Exception {
+ Collection<Annotation> methodAnnotations = new ArrayList<Annotation>();
+ methodAnnotations.add(new FakeWebMethodAnnotation("operationname", "action"));
+ WebServiceMETHODMetadata method = new WebServiceMETHODMetadata(
+ methodAnnotations, "methodname", Void.class, null);
+ assertTrue(method.getWmOperationName().compareTo("operationname") == 0);
+ assertTrue(method.getWmAction().compareTo("action") == 0);
+
+ }
+
+ public void testMETHODOneWayDefaults() throws Exception {
+ Collection<Annotation> methodAnnotations = new ArrayList<Annotation>();
+ methodAnnotations.add(new FakeWebMethodAnnotation("operationname", "action"));
+ WebServiceMETHODMetadata method = new WebServiceMETHODMetadata(
+ methodAnnotations, "methodname", String.class, null);
+ assertFalse(method.isOneWay());
+ }
+
+ public void testMETHODOneWay() throws Exception {
+ Collection<Annotation> methodAnnotations = new ArrayList<Annotation>();
+ methodAnnotations.add(new FakeWebMethodAnnotation("operationname", "action"));
+ methodAnnotations.add(new FakeOneWayAnnotation());
+ WebServiceMETHODMetadata method = new WebServiceMETHODMetadata(
+ methodAnnotations, "methodname", String.class, null);
+ assertTrue(method.isOneWay());
+ }
+
+ public void testMETHODWebResultsDefaults() throws Exception {
+
+ }
+
+ public void testMETHODWebResults() throws Exception {
+
+ }
+ //TODO: test PARAMETER level annotation
+
+ // TODO: test combination of type, method, annotation
+}
+
Added: incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeDocumentWrapper.java
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeDocumentWrapper.java Thu Sep 9 10:48:24 2004
@@ -0,0 +1,64 @@
+package org.apache.beehive.wsm.jsr181.model.fakeAnnotations;
+
+
+import java.lang.annotation.Annotation;
+
+import javax.jws.QName;
+import javax.jws.soap.DocumentWrapper;
+/*
+ * 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:$
+ */
+
+//org.apache.beehive.wsm.jsr181.model.fakeAnnotations.FakeDocumentWrapper.java
+public class FakeDocumentWrapper implements Annotation, DocumentWrapper {
+
+ String requestElementNameSpaceURI;
+ String requestElementLocalName;
+ String responseElementNameSpaceURI;
+ String responseElementLocalName;
+ /**
+ *
+ */
+ public FakeDocumentWrapper(String requestElementNameSpaceURI, String requestElementLocalName, String responseElementNameSpaceURI, String responseElementLocalName) {
+ this.requestElementNameSpaceURI=requestElementNameSpaceURI;
+ this.requestElementLocalName=requestElementLocalName;
+ this.responseElementNameSpaceURI=responseElementNameSpaceURI;
+ this.responseElementLocalName=responseElementLocalName;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.annotation.Annotation#annotationType()
+ */
+ public Class< ? extends Annotation> annotationType() {
+ return DocumentWrapper.class;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jws.soap.DocumentWrapper#requestElement()
+ */
+ public QName requestElement() {
+ return new FakeQName(requestElementNameSpaceURI, requestElementLocalName);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jws.soap.DocumentWrapper#responseElement()
+ */
+ public QName responseElement() {
+ return new FakeQName(responseElementNameSpaceURI, responseElementLocalName);
+ }
+
+}
Added: incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeHandlerChainAnnotation.java
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeHandlerChainAnnotation.java Thu Sep 9 10:48:24 2004
@@ -0,0 +1,60 @@
+package org.apache.beehive.wsm.jsr181.model.fakeAnnotations;
+
+
+import java.lang.annotation.Annotation;
+
+import javax.jws.HandlerChain;
+
+/*
+ * 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:$
+ */
+
+//org.apache.beehive.wsm.jsr181.model.fakeAnnotations.FakeHandlerChainAnnotation.java
+public class FakeHandlerChainAnnotation implements Annotation, HandlerChain {
+
+ String file;
+ String name;
+ /**
+ *
+ */
+ public FakeHandlerChainAnnotation(String file, String name) {
+ this.file=file;
+ this.name=name;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.annotation.Annotation#annotationType()
+ */
+ public Class< ? extends Annotation> annotationType() {
+ return HandlerChain.class;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jws.HandlerChain#file()
+ */
+ public String file() {
+ return file;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jws.HandlerChain#name()
+ */
+ public String name() {
+ return name;
+ }
+
+}
Added: incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeInitParamAnnotation.java
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeInitParamAnnotation.java Thu Sep 9 10:48:24 2004
@@ -0,0 +1,60 @@
+package org.apache.beehive.wsm.jsr181.model.fakeAnnotations;
+
+
+import java.lang.annotation.Annotation;
+
+import javax.jws.InitParam;
+/*
+ * 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:$
+ */
+
+//org.apache.beehive.wsm.jsr181.model.fakeAnnotations.FakeInitParamAnnotation.java
+public class FakeInitParamAnnotation implements Annotation, InitParam {
+
+ private String name;
+ private String value;
+
+ /**
+ *
+ */
+ public FakeInitParamAnnotation(String name, String value) {
+ this.name=name;
+ this.value=value;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.annotation.Annotation#annotationType()
+ */
+ public Class< ? extends Annotation> annotationType() {
+ return InitParam.class;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jws.InitParam#name()
+ */
+ public String name() {
+ return name;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jws.InitParam#value()
+ */
+ public String value() {
+ return value;
+ }
+
+}
Added: incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeOneWayAnnotation.java
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeOneWayAnnotation.java Thu Sep 9 10:48:24 2004
@@ -0,0 +1,42 @@
+package org.apache.beehive.wsm.jsr181.model.fakeAnnotations;
+
+
+import java.lang.annotation.Annotation;
+
+import javax.jws.Oneway;
+/*
+ * 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:$
+ */
+
+//org.apache.beehive.wsm.jsr181.model.fakeAnnotations.FakeOneWayAnnotation.java
+public class FakeOneWayAnnotation implements Annotation, Oneway {
+
+ /**
+ *
+ */
+ public FakeOneWayAnnotation() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.annotation.Annotation#annotationType()
+ */
+ public Class< ? extends Annotation> annotationType() {
+ return Oneway.class;
+ }
+
+}
Added: incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeQName.java
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeQName.java Thu Sep 9 10:48:24 2004
@@ -0,0 +1,59 @@
+package org.apache.beehive.wsm.jsr181.model.fakeAnnotations;
+
+
+import java.lang.annotation.Annotation;
+
+import javax.jws.QName;
+/*
+ * 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:$
+ */
+
+//org.apache.beehive.wsm.jsr181.model.fakeAnnotations.FakeQName.java
+public class FakeQName implements QName, Annotation {
+
+ String nameSpaceURI;
+ String localName;
+ /**
+ *
+ */
+ public FakeQName(String nameSpaceURI, String localName) {
+ this.nameSpaceURI=nameSpaceURI;
+ this.localName=localName;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jws.QName#namespaceURI()
+ */
+ public String namespaceURI() {
+ return nameSpaceURI;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jws.QName#localName()
+ */
+ public String localName() {
+ return localName;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.annotation.Annotation#annotationType()
+ */
+ public Class< ? extends Annotation> annotationType() {
+ return QName.class;
+ }
+
+}
Added: incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeSOAPMessageHandlerAnnotation.java
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeSOAPMessageHandlerAnnotation.java Thu Sep 9 10:48:24 2004
@@ -0,0 +1,100 @@
+package org.apache.beehive.wsm.jsr181.model.fakeAnnotations;
+
+
+import java.lang.annotation.Annotation;
+
+import javax.jws.InitParam;
+import javax.jws.QName;
+import javax.jws.soap.SOAPMessageHandler;
+/*
+ * 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:$
+ */
+
+//org.apache.beehive.wsm.jsr181.model.fakeAnnotations.FakeSOAPMessageHandlerAnnotation.java
+public class FakeSOAPMessageHandlerAnnotation implements Annotation,
+ SOAPMessageHandler {
+
+ String name;
+ String className;
+ InitParam[] initParams;
+ String[] roles;
+ QName[] headers;
+
+ /**
+ * @param name
+ * @param className
+ * @param initParams
+ * @param roles
+ * @param headers
+ */
+ public FakeSOAPMessageHandlerAnnotation(String name, String className,
+ InitParam[] initParams, String[] roles, QName[] headers) {
+ super();
+ this.name = name;
+ this.className = className;
+ this.initParams = initParams;
+ this.roles = roles;
+ this.headers = headers;
+ }
+
+
+
+
+ /* (non-Javadoc)
+ * @see java.lang.annotation.Annotation#annotationType()
+ */
+ public Class< ? extends Annotation> annotationType() {
+ return SOAPMessageHandler.class;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jws.soap.SOAPMessageHandler#name()
+ */
+ public String name() {
+ return name;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jws.soap.SOAPMessageHandler#className()
+ */
+ public String className() {
+ return className;
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jws.soap.SOAPMessageHandler#initParams()
+ */
+ public InitParam[] initParams() {
+ return initParams;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jws.soap.SOAPMessageHandler#roles()
+ */
+ public String[] roles() {
+ return roles;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jws.soap.SOAPMessageHandler#headers()
+ */
+ public QName[] headers() {
+ return headers;
+ }
+
+}
Added: incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeSOAPMessageHandlersAnnotation.java
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeSOAPMessageHandlersAnnotation.java Thu Sep 9 10:48:24 2004
@@ -0,0 +1,53 @@
+package org.apache.beehive.wsm.jsr181.model.fakeAnnotations;
+
+
+import java.lang.annotation.Annotation;
+
+import javax.jws.soap.SOAPMessageHandler;
+import javax.jws.soap.SOAPMessageHandlers;
+/*
+ * 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:$
+ */
+
+//org.apache.beehive.wsm.jsr181.model.fakeAnnotations.FakeSOAPMessageHandlersAnnotation.java
+public class FakeSOAPMessageHandlersAnnotation implements Annotation,
+ SOAPMessageHandlers {
+
+ SOAPMessageHandler[] value;
+ /**
+ *
+ */
+ public FakeSOAPMessageHandlersAnnotation(SOAPMessageHandler[] value) {
+ this.value=value;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.annotation.Annotation#annotationType()
+ */
+ public Class< ? extends Annotation> annotationType() {
+ // TODO Auto-generated method stub
+ return SOAPMessageHandlers.class;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jws.soap.SOAPMessageHandlers#value()
+ */
+ public SOAPMessageHandler[] value() {
+ return value;
+ }
+
+}
Added: incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeSecurityIdentityAnnotation.java
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeSecurityIdentityAnnotation.java Thu Sep 9 10:48:24 2004
@@ -0,0 +1,53 @@
+package org.apache.beehive.wsm.jsr181.model.fakeAnnotations;
+
+
+import java.lang.annotation.Annotation;
+
+import javax.jws.SecurityIdentity;
+/*
+ * 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:$
+ */
+
+//org.apache.beehive.wsm.jsr181.model.fakeAnnotations.FakeSecurityIdentityAnnotation.java
+public class FakeSecurityIdentityAnnotation implements Annotation,
+ SecurityIdentity {
+
+ private String runAs;
+
+ /**
+ *
+ */
+ public FakeSecurityIdentityAnnotation(String runAs) {
+ super();
+ this.runAs = runAs;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.annotation.Annotation#annotationType()
+ */
+ public Class< ? extends Annotation> annotationType() {
+ return SecurityIdentity.class;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jws.SecurityIdentity#runAs()
+ */
+ public String runAs() {
+ return runAs;
+ }
+
+}
Added: incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeSecurityRoleAnnotation.java
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeSecurityRoleAnnotation.java Thu Sep 9 10:48:24 2004
@@ -0,0 +1,60 @@
+package org.apache.beehive.wsm.jsr181.model.fakeAnnotations;
+
+import java.lang.annotation.Annotation;
+
+import javax.jws.SecurityRoles;
+/*
+ * 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:$
+ */
+
+//org.apache.beehive.wsm.jsr181.model.fakeAnnotations.FakeSecurityRoleAnnotation.java
+public class FakeSecurityRoleAnnotation implements Annotation, SecurityRoles {
+
+ private String[] rolesAllowed;
+ private String[] rolesReferenced;
+
+ /**
+ *
+ */
+ public FakeSecurityRoleAnnotation(String[] rolesAllowed, String[] rolesReferenced) {
+ super();
+ this.rolesAllowed = rolesAllowed;
+ this.rolesReferenced = rolesReferenced;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.annotation.Annotation#annotationType()
+ */
+ public Class< ? extends Annotation> annotationType() {
+ return SecurityRoles.class;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jws.SecurityRoles#rolesAllowed()
+ */
+ public String[] rolesAllowed() {
+ return rolesAllowed;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jws.SecurityRoles#rolesReferenced()
+ */
+ public String[] rolesReferenced() {
+ return rolesReferenced;
+ }
+
+}
Added: incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeWebMethodAnnotation.java
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/model/fakeAnnotations/FakeWebMethodAnnotation.java Thu Sep 9 10:48:24 2004
@@ -0,0 +1,61 @@
+package org.apache.beehive.wsm.jsr181.model.fakeAnnotations;
+
+
+import java.lang.annotation.Annotation;
+
+import javax.jws.WebMethod;
+/*
+ * 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:$
+ */
+
+//org.apache.beehive.wsm.jsr181.model.fakeAnnotations.FakeWebMethodAnnotation.java
+public class FakeWebMethodAnnotation implements Annotation, WebMethod {
+
+ private String operationName;
+ private String action;
+
+ /**
+ *
+ */
+ public FakeWebMethodAnnotation(String operationName, String action) {
+ super();
+ this.operationName = operationName;
+ this.action = action;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.annotation.Annotation#annotationType()
+ */
+ public Class< ? extends Annotation> annotationType() {
+ return WebMethod.class;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jws.WebMethod#operationName()
+ */
+ public String operationName() {
+ return operationName;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.jws.WebMethod#action()
+ */
+ public String action() {
+ return action;
+ }
+
+}
Modified: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/InitParamInfo.java
==============================================================================
--- incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/InitParamInfo.java (original)
+++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/InitParamInfo.java Thu Sep 9 10:48:24 2004
@@ -1,5 +1,7 @@
package org.apache.beehive.wsm.jsr181.model;
+import javax.jws.InitParam;
+
/*
* Copyright 2004 The Apache Software Foundation
*
@@ -19,42 +21,58 @@
*/
public class InitParamInfo {
-
String name;
+
String value;
-
-
/**
- *
+ *
*/
- public InitParamInfo() {
+ public InitParamInfo(InitParam a) {
super();
+ initFromAnnotation(a);
}
+
+ /**
+ * @param a
+ */
+ private void initFromAnnotation(InitParam a) {
+ if (null != a) {
+ setName(a.name());
+ setValue(a.value());
+ }
+ // no defaults
+
+ }
+
/**
* @return Returns the name.
*/
public String getName() {
return name;
}
+
/**
- * @param name The name to set.
+ * @param name
+ * The name to set.
*/
public void setName(String name) {
this.name = name;
}
+
/**
* @return Returns the value.
*/
public String getValue() {
return value;
}
+
/**
- * @param value The value to set.
+ * @param value
+ * The value to set.
*/
public void setValue(String value) {
this.value = value;
}
-
-}
+}
\ No newline at end of file
Modified: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/QNameInfo.java
==============================================================================
--- incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/QNameInfo.java (original)
+++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/QNameInfo.java Thu Sep 9 10:48:24 2004
@@ -23,20 +23,31 @@
private String namespaceURI = null;
private String localName = null;
- public QNameInfo(QName qName) {
+ public QNameInfo(QName annotation) {
+ initFromAnnotation(annotation);
+ }
+
+
+/**
+ * @param a
+ */
+ private void initFromAnnotation(QName qName) {
+ if(null != qName) {
this.namespaceURI = qName.namespaceURI();
this.localName = qName.localName();
-
+ }
+ // no defaults
+
}
- public QNameInfo() {
- }
-
-
- public QNameInfo(String namespaceURI, String localName) {
- this.namespaceURI = namespaceURI;
- this.localName = localName;
- }
+// public QNameInfo() {
+// }
+//
+//
+// public QNameInfo(String namespaceURI, String localName) {
+// this.namespaceURI = namespaceURI;
+// this.localName = localName;
+// }
public String getNamespaceURI() {
return namespaceURI;
Modified: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/SOAPMessageHandlerInfo.java
==============================================================================
--- incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/SOAPMessageHandlerInfo.java (original)
+++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/SOAPMessageHandlerInfo.java Thu Sep 9 10:48:24 2004
@@ -1,5 +1,6 @@
package org.apache.beehive.wsm.jsr181.model;
+import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -31,14 +32,22 @@
public class SOAPMessageHandlerInfo {
String name;
String className;
- Collection<InitParam> params = new ArrayList<InitParam>();
+ Collection<InitParamInfo> params = new ArrayList<InitParamInfo>();
Collection<String> roles = new ArrayList<String>();
- Collection<QName> headers = new ArrayList<QName>();
+ Collection<QNameInfo> headers = new ArrayList<QNameInfo>();
/**
*
*/
- public SOAPMessageHandlerInfo() {
- super();
+ public SOAPMessageHandlerInfo(SOAPMessageHandler annotation) {
+ setName(annotation.name());
+ setClassName(annotation.className());
+ for (InitParam p : annotation.initParams()) {
+ addInitParam(new InitParamInfo(p));
+ }
+ addRoles(Arrays.asList(annotation.roles()));
+ for (QName q : annotation.headers()) {
+ addHeader(new QNameInfo(q));
+ }
}
/**
* @return Returns the className.
@@ -67,33 +76,33 @@
/**
* @return Returns the headers.
*/
- public Collection<QName> getHeaders() {
+ public Collection<QNameInfo> getHeaders() {
return Collections.unmodifiableCollection(headers);
}
- public void addHeader(QName header) {
- headers.add(header);
+ public void addHeader(QNameInfo header) {
+ this.headers.add(header);
}
/**
* @param collection
*/
- private void addHeaders(Collection<QName> headers) {
+ private void addHeaders(Collection<QNameInfo> headers) {
this.headers.addAll(headers);
}
/**
* @return Returns the params.
*/
- public Collection<InitParam> getParams() {
+ public Collection<InitParamInfo> getParams() {
return Collections.unmodifiableCollection(params);
}
- public void addInitParam(InitParam param) {
- params.add(param);
+ public void addInitParam(InitParamInfo param) {
+ this.params.add(param);
}
- public void addInitParam(Collection<InitParam> params) {
- params.addAll(params);
+ public void addInitParam(Collection<InitParamInfo> params) {
+ this.params.addAll(params);
}
/**
* @return Returns the roles.
@@ -103,24 +112,11 @@
}
public void addRole(String role) {
- roles.add(role);
+ this.roles.add(role);
}
public void addRoles(Collection<String> roles) {
- roles.addAll(roles);
- }
- /**
- * @param handler
- * @return
- */
- public SOAPMessageHandlerInfo initFromAnnotation(SOAPMessageHandler annotation) {
- setName(annotation.name());
- setClassName(annotation.className());
- addInitParam(Arrays.asList(annotation.initParams()));
- addRoles(Arrays.asList(annotation.roles()));
- addHeaders(Arrays.asList(annotation.headers()));
-
- return null;
+ this.roles.addAll(roles);
}
-
+
}
Modified: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/SecurityRolesInfo.java
==============================================================================
--- incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/SecurityRolesInfo.java (original)
+++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/SecurityRolesInfo.java Thu Sep 9 10:48:24 2004
@@ -6,6 +6,7 @@
import java.util.Collections;
import javax.jws.SecurityRoles;
+
/*
* Copyright 2004 The Apache Software Foundation
*
@@ -26,19 +27,18 @@
public class SecurityRolesInfo {
- Collection<String> rolesAllowed = new ArrayList<String>();
- Collection<String> rolesReferenced = new ArrayList<String>();
-
-
+ Collection<String> rolesAllowed = null;
+
+ Collection<String> rolesReferenced = null;
+
/**
- *
+ *
*/
public SecurityRolesInfo() {
super();
}
-
-
- public SecurityRolesInfo (SecurityRoles annotation) {
+
+ public SecurityRolesInfo(SecurityRoles annotation) {
initFromAnnotation(annotation);
}
@@ -46,29 +46,44 @@
* @return Returns the wrRolesAllowed.
*/
public Collection<String> getRolesAllowed() {
+ if (null == rolesAllowed)
+ return null;
return Collections.unmodifiableCollection(rolesAllowed);
}
-
+
public void addRolesAllowed(String role) {
+ if (null == rolesAllowed)
+ rolesAllowed = new ArrayList<String>();
rolesAllowed.add(role);
}
-
+
public void addRolesAllowed(Collection<String> roles) {
- rolesAllowed.addAll(roles);
- }
+ if (null == rolesAllowed)
+ rolesAllowed = new ArrayList<String>(roles);
+ else
+ rolesAllowed.addAll(roles);
+ }
+
/**
- * @return Returns the wrRolesReferenced.
+ * @return Returns the RolesReferenced.
*/
- public Collection<String> getWrRolesReferenced() {
+ public Collection<String> getRolesReferenced() {
+ if (null == rolesReferenced)
+ return null;
return Collections.unmodifiableCollection(rolesReferenced);
}
-
+
public void addRolesReferenced(String role) {
+ if (null == rolesReferenced)
+ rolesReferenced = new ArrayList<String>();
rolesReferenced.add(role);
}
-
+
public void addRolesReferenced(Collection<String> roles) {
- rolesReferenced.addAll(roles);
+ if (null == rolesReferenced)
+ rolesReferenced = new ArrayList<String>(roles);
+ else
+ rolesReferenced.addAll(roles);
}
/**
@@ -76,11 +91,11 @@
* @return
*/
private SecurityRolesInfo initFromAnnotation(SecurityRoles annotation) {
- addRolesAllowed(Arrays.asList(annotation.rolesAllowed()));
- addRolesReferenced(Arrays.asList(annotation.rolesReferenced()));
+ if (null != annotation.rolesAllowed())
+ addRolesAllowed(Arrays.asList(annotation.rolesAllowed()));
+ if (null != annotation.rolesReferenced())
+ addRolesReferenced(Arrays.asList(annotation.rolesReferenced()));
return null;
- }
-
-
-
-}
+ }
+
+}
\ No newline at end of file
Modified: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/WebServiceMETHODMetadata.java
==============================================================================
--- incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/WebServiceMETHODMetadata.java (original)
+++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/WebServiceMETHODMetadata.java Thu Sep 9 10:48:24 2004
@@ -60,19 +60,16 @@
private Class javaReturnType;
-
-
/**
- *
+ *
*/
public WebServiceMETHODMetadata() {
super();
}
-
-
+
public WebServiceMETHODMetadata(Collection<Annotation> annotations,
String javaMethodName, Class javaReturnType,
- List<WebServicePARAMETERMetadata> webParams) {
+ List< ? extends WebServicePARAMETERMetadata> webParams) {
// check parameters
if ((null == javaMethodName) || (null == javaReturnType)) {
throw new IllegalArgumentException(
@@ -92,27 +89,21 @@
// add defaults
if (a.annotationType() == javax.jws.Oneway.class) {
initFromAnnotation((javax.jws.Oneway) a);
- enforceAnnotationRules((javax.jws.Oneway) a);
} else if (a.annotationType() == javax.jws.SecurityRoles.class) {
initFromAnnotation((javax.jws.SecurityRoles) a);
- enforceAnnotationRules((javax.jws.SecurityRoles) a);
} else if (a.annotationType() == javax.jws.WebMethod.class) {
initFromAnnotation((javax.jws.WebMethod) a);
- enforceAnnotationRules((javax.jws.WebMethod) a);
} else if (a.annotationType() == javax.jws.WebResult.class) {
initFromAnnotation((javax.jws.WebResult) a);
- enforceAnnotationRules((javax.jws.WebResult) a);
} else if (a.annotationType() == javax.jws.soap.DocumentWrapper.class) {
initFromAnnotation((javax.jws.soap.DocumentWrapper) a);
- enforceAnnotationRules((javax.jws.soap.DocumentWrapper) a);
} else if (a.annotationType() == javax.jws.soap.SOAPBinding.class) {
initFromAnnotation((javax.jws.soap.SOAPBinding) a);
- enforceAnnotationRules((javax.jws.soap.SOAPBinding) a);
} else {
// todo: warning -- unknown annotation
@@ -120,56 +111,32 @@
}
// set WebServicePARAMETERMetadata
- int i = 0;
- for (WebServicePARAMETERMetadata wspm : webParams) {
- i++;
- // todo check defaults for wspm
- if (0 == wspm.getWpName().length()) {
- if (wspm.getSourceName() == null
- || wspm.getSourceName().length() == 0)
- wspm.setWpName("param_" + i);
- else
- wspm.setWpName(wspm.getSourceName());
- }
-
- addParam(wspm);
- }
- }
-
-
- private void enforceAnnotationRules(javax.jws.Oneway ow) {
- // no defaults to handle
- }
-
- private void enforceAnnotationRules(javax.jws.SecurityRoles sr) {
- // no defaults to handle
- }
+ if (null != webParams) {
+ int i = 0;
+ for (WebServicePARAMETERMetadata wspm : webParams) {
+ i++;
+ // todo check defaults for wspm
+ if (0 == wspm.getWpName().length()) {
+ if (wspm.getSourceName() == null
+ || wspm.getSourceName().length() == 0)
+ wspm.setWpName("param_" + i);
+ else
+ wspm.setWpName(wspm.getSourceName());
+ }
- private void enforceAnnotationRules(javax.jws.WebMethod wm) {
- // deferred --> requires TYPE information: targetNamespace
- }
-
- private void enforceAnnotationRules(javax.jws.WebResult wr) {
- if (0 == getWrName().length()) {
- setWrName("result");
+ addParam(wspm);
+ }
}
}
- private void enforceAnnotationRules(javax.jws.soap.DocumentWrapper dw) {
- // deferred --> requires TYPE information: targetNamespace
- }
-
- private void enforceAnnotationRules(javax.jws.soap.SOAPBinding sb) {
- // deferred --> requires TYPE information: SOAPBinding
- }
-
/**
* @param annotation
*/
private void initFromAnnotation(SecurityRoles annotation) {
- if (null == annotation)
- return;
- setSecurityRoles(new SecurityRolesInfo(annotation));
+ if (null != annotation) {
+ setSecurityRoles(new SecurityRolesInfo(annotation));
+ }
+ // no defaults to handle
return;
}
@@ -177,9 +144,10 @@
* @param annotation
*/
private void initFromAnnotation(SOAPBinding annotation) {
- if (null == annotation)
- return;
- setSoapBinding(new SOAPBindingInfo(annotation));
+ if (null != annotation) {
+ setSoapBinding(new SOAPBindingInfo(annotation));
+ }
+ // deferred --> requires TYPE information: SOAPBinding
}
@@ -187,19 +155,25 @@
* @param annotation
*/
private void initFromAnnotation(DocumentWrapper annotation) {
- if (null == annotation)
- return;
- setDwRequestElement(new QNameInfo(annotation.requestElement()));
- setDwResponseElement(new QNameInfo(annotation.responseElement()));
+ if (null != annotation) {
+ setDwRequestElement(new QNameInfo(annotation.requestElement()));
+ setDwResponseElement(new QNameInfo(annotation.responseElement()));
+ }
+ // deferred --> requires TYPE information: targetNamespace
+
}
/**
* @param annotation
*/
private void initFromAnnotation(WebResult annotation) {
- if (null == annotation)
- return;
- setWrName(annotation.name());
+ if (null != annotation) {
+ setWrName(annotation.name());
+ }
+ if (0 == getWrName().length()) {
+ setWrName("result");
+ }
+
}
/**
@@ -211,16 +185,21 @@
else
setOneWay(true);
+ // no defaults to handle
+
}
/**
* @param webMethodAnnotation
*/
private void initFromAnnotation(WebMethod annotation) {
- if (null == annotation)
- return;
- setWmAction(annotation.action());
- setWmOperationName(annotation.operationName());
+ if (null != annotation) {
+ setWmAction(annotation.action());
+ setWmOperationName(annotation.operationName());
+ }
+ if(getWmOperationName() == null || getWmOperationName().length() == 0) setWmOperationName(javaMethodName);
+ if(getWmAction() == null || getWmAction().length() == 0) setWmAction("");
+
}
/**
Modified: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/WebServicePARAMETERMetadata.java
==============================================================================
--- incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/WebServicePARAMETERMetadata.java (original)
+++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/WebServicePARAMETERMetadata.java Thu Sep 9 10:48:24 2004
@@ -72,8 +72,7 @@
// add defaults
if (a.annotationType() == javax.jws.WebParam.class) {
initFromAnnotation((javax.jws.WebParam) a);
- enforceAnnotationRules((javax.jws.WebParam) a);
-
+
}
}
@@ -139,14 +138,16 @@
* @param webParam
*/
private void initFromAnnotation(WebParam annotation) {
- setWpName(annotation.name());
- setWpMode(annotation.mode());
- setWpHeader(annotation.header());
- }
-
- private void enforceAnnotationRules(javax.jws.WebParam wp) {
+ if (null != annotation) {
+ setWpName(annotation.name());
+ setWpMode(annotation.mode());
+ setWpHeader(annotation.header());
+ }
// deferred --> requires METHOD information: position
+
}
+
+
/**
* @return Returns the sourceName.
Modified: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/WebServiceTYPEMetadata.java
==============================================================================
--- incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/WebServiceTYPEMetadata.java (original)
+++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/WebServiceTYPEMetadata.java Thu Sep 9 10:48:24 2004
@@ -60,17 +60,13 @@
private String javaFQClassName;
-
-
-
/**
- *
+ *
*/
public WebServiceTYPEMetadata() {
super();
}
-
-
+
static public WebServiceTYPEMetadata buildWSMetadata(String filename)
throws InvalidFileType {
if (filename.endsWith(".java") || filename.endsWith(".jws")) {
@@ -84,9 +80,9 @@
}
}
- public WebServiceTYPEMetadata( Collection<Annotation> annotations,
+ public WebServiceTYPEMetadata(Collection<Annotation> annotations,
String fqClassName,
- Collection<WebServiceMETHODMetadata> webMethods) {
+ Collection< ? extends WebServiceMETHODMetadata> webMethods) {
super();
// check parameters
if ((null == fqClassName) || (0 == fqClassName.length())) {
@@ -102,40 +98,34 @@
// extract information from annotations
for (Annotation a : annotations) {
if (a.annotationType() == javax.jws.WebService.class) {
- initFromAnnotation((javax.jws.WebService)a);
- enforceAnnotationRules((javax.jws.WebService)a);
+ initFromAnnotation((javax.jws.WebService) a);
}
// @HandlerChain
else if (a.annotationType() == javax.jws.HandlerChain.class) {
- initFromAnnotation((javax.jws.HandlerChain)a);
- enforceAnnotationRules((javax.jws.HandlerChain)a);
+ initFromAnnotation((javax.jws.HandlerChain) a);
}
// @SecurityIdentity
else if (a.annotationType() == javax.jws.SecurityIdentity.class) {
- initFromAnnotation((javax.jws.SecurityIdentity)a);
- enforceAnnotationRules((javax.jws.SecurityIdentity)a);
+ initFromAnnotation((javax.jws.SecurityIdentity) a);
}
// @SecurityRoles
else if (a.annotationType() == javax.jws.SecurityRoles.class) {
- initFromAnnotation((javax.jws.SecurityRoles)a);
- enforceAnnotationRules((javax.jws.SecurityRoles)a);
+ initFromAnnotation((javax.jws.SecurityRoles) a);
}
// @SOAPBinding (TYPE-level)
else if (a.annotationType() == javax.jws.soap.SOAPBinding.class) {
- initFromAnnotation((javax.jws.soap.SOAPBinding)a);
- enforceAnnotationRules((javax.jws.soap.SOAPBinding)a);
+ initFromAnnotation((javax.jws.soap.SOAPBinding) a);
}
// @SOAPMessageHandlers
else if (a.annotationType() == javax.jws.soap.SOAPMessageHandlers.class) {
- initFromAnnotation((javax.jws.soap.SOAPMessageHandlers)a);
- enforceAnnotationRules((javax.jws.soap.SOAPMessageHandlers)a);
- }
- else {
- //TODO: What to do with annotations that are not specified in 181, for now ignore them.
+ initFromAnnotation((javax.jws.soap.SOAPMessageHandlers) a);
+ } else {
+ //TODO: What to do with annotations that are not specified in
+ // 181, for now ignore them.
}
}
@@ -148,45 +138,59 @@
}
}
- // todo: check if SOAPMessageHandlers() is used anywhere -> throw error!
- private void enforceAnnotationRules(javax.jws.HandlerChain hc) {
- // no defaults to handle
- }
-
- private void enforceAnnotationRules(javax.jws.SecurityIdentity si) {
- // no defaults to handle
- }
+ protected void initFromAnnotation(WebService annotation) {
+ if (null != annotation) {
+ setWsName(annotation.name());
+ setWsServiceName(annotation.serviceName());
+ setWsTargetNamespace(annotation.targetNamespace());
+ setWsWsdlLocation(annotation.wsdlLocation());
+ }
- private void enforceAnnotationRules(javax.jws.SecurityRoles sr) {
- // no defaults to handle
- }
+ // name
+ String name;
+ if (javaFQClassName.indexOf('.') == -1)
+ name = javaFQClassName;
+ else {
+ int index = javaFQClassName.lastIndexOf('.');
- private void enforceAnnotationRules(javax.jws.WebService ws) {
- String className = "";
- String packageName = "";
+ name = javaFQClassName.substring(index + 1);
+ }
- // name
if (0 == getWsName().length()) {
- setWsName(className);
+ setWsName(name);
}
// serviceName
if (0 == getWsServiceName().length()) {
- setWsServiceName(className + "Service");
+ setWsServiceName(name + "Service");
}
// targetNamespace
if (0 == getWsTargetNamespace().length()) {
- setWsTargetNamespace(packageName);
+
+ // remove the class name from the end of the FQClassName
+ String packageName = javaFQClassName.substring(0, javaFQClassName
+ .length()
+ - name.length());
+ // need to remove the "." at the end of the name?
+ if (packageName.endsWith("."))
+ packageName = packageName
+ .substring(0, packageName.length() - 1);
+
+ setWsTargetNamespace(packageName + "/" + name + "/"); // Correct?
}
+
}
- private void enforceAnnotationRules(javax.jws.soap.SOAPBinding sb) {
+ private void initFromAnnotation(SOAPBinding annotation) {
+ if (null != annotation) {
+ setSoapBinding(new SOAPBindingInfo(annotation));
+ }
SOAPBindingInfo sbi = getSoapBinding();
if (null == sbi) {
throw new IllegalArgumentException(
"illegal SOAPBinding annotation on WebService class:\n\t"
- + sb);
+ + sbi);
}
// style
@@ -205,59 +209,53 @@
sbi
.setParameterStyle(javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED);
}
- }
-
- // todo: check if SOAPMessageHandlers() is used anywhere -> throw error!
- private void enforceAnnotationRules(javax.jws.soap.SOAPMessageHandlers smh) {
- // no defaults to handle
- }
-
- protected void initFromAnnotation(WebService annotation) {
- if (null == annotation)
- return;
- setWsName(annotation.name());
- setWsServiceName(annotation.serviceName());
- setWsTargetNamespace(annotation.targetNamespace());
- setWsWsdlLocation(annotation.wsdlLocation());
}
- private void initFromAnnotation(SOAPBinding annotation) {
- if (null == annotation)
- return;
- setSoapBinding(new SOAPBindingInfo(annotation));
- }
-
private void initFromAnnotation(HandlerChain annotation) {
- if (null == annotation)
- return;
- setHcFileName(annotation.file());
- setHcName(annotation.name());
+ if (null != annotation) {
+ setHcFileName(annotation.file());
+ setHcName(annotation.name());
+ }
+ // todo: check if SOAPMessageHandlers() is used anywhere -> throw error!
+ // no defaults to handle
}
private void initFromAnnotation(SOAPMessageHandlers annotation) {
- if (null == annotation)
- return;
- SOAPMessageHandler[] soapMsgHandlerArray = annotation.value();
-
- for (int i = 0; i < soapMsgHandlerArray.length; i++) {
- addSOAPHandler(new SOAPMessageHandlerInfo()
- .initFromAnnotation(soapMsgHandlerArray[i]));
+ if (null != annotation) {
+ SOAPMessageHandler[] soapMsgHandlerArray = annotation.value();
+
+ for (int i = 0; i < soapMsgHandlerArray.length; i++) {
+ addSOAPHandler(new SOAPMessageHandlerInfo(
+ soapMsgHandlerArray[i]));
+ }
}
+ // todo: check if SOAPMessageHandlers() is used anywhere -> throw error!
+ // walk through the handlers make sure the name is set, or it is
+ // defaulted to the classname
+ for (SOAPMessageHandlerInfo messageHandlerInfo : getSoapHandlers()) {
+ if (messageHandlerInfo.getName().length() == 0) {
+ messageHandlerInfo.setName(messageHandlerInfo.getClassName());
+ }
+ }
+
}
private void initFromAnnotation(SecurityRoles annotation) {
- if (null == annotation)
- return;
- setSecurityRoles(new SecurityRolesInfo(annotation));
+ if (null != annotation) {
+ setSecurityRoles(new SecurityRolesInfo(annotation));
+ }
+ // no defaults to handle
}
private void initFromAnnotation(SecurityIdentity annotation) {
- if (null == annotation)
- return;
- setSiRunAs(annotation.runAs());
+ if (null != annotation) {
+ setSiRunAs(annotation.runAs());
+ }
+ // no defaults to handle
+
}
public boolean validate() {