You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ng...@apache.org on 2006/10/31 06:56:21 UTC

svn commit: r469381 [2/2] - in /webservices/axis2/trunk/java/modules/jaxws: ./ src/javax/annotation/ src/org/apache/axis2/jaxws/context/ src/org/apache/axis2/jaxws/context/factory/ src/org/apache/axis2/jaxws/context/utils/ src/org/apache/axis2/jaxws/co...

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl1.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl1.java?view=auto&rev=469381
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl1.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl1.java Mon Oct 30 21:56:19 2006
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.axis2.jaxws.injection;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.annotation.Resource;
+import javax.xml.ws.WebServiceContext;
+
+import org.apache.axis2.jaxws.resourceinjection.sei.ResourceInjectionPortType;
+
+
+public class ResourceInjectionTestImpl1 {
+
+	@Resource
+	public WebServiceContext ctx = null;
+	
+	public ResourceInjectionTestImpl1() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+	
+	@PostConstruct
+	public void initialize(){
+		//Called after resource injection and before a method is called.
+		System.out.println("Calling PostConstruct to Initialize");
+	}
+	
+	@PreDestroy
+	public void distructor(){
+		//Called before the scope of request or session or application ends.
+		
+		System.out.println("Calling PreDestroy ");
+		
+	}
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl2.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl2.java?view=auto&rev=469381
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl2.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl2.java Mon Oct 30 21:56:19 2006
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.axis2.jaxws.injection;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.annotation.Resource;
+import javax.xml.ws.WebServiceContext;
+
+
+public class ResourceInjectionTestImpl2{
+
+	
+	public WebServiceContext ctx = null;
+	
+	public ResourceInjectionTestImpl2() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+	@PostConstruct
+	public void initialize(){
+		//Called after resource injection and before a method is called.
+		System.out.println("Calling PostConstruct to Initialize");
+	}
+	
+	@PreDestroy
+	public void distructor(){
+		//Called before the scope of request or session or application ends.
+		
+		System.out.println("Calling PreDestroy ");
+		
+	}
+	@Resource
+	public void setCtx(WebServiceContext ctx) {
+		this.ctx = ctx;
+	}
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl3.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl3.java?view=auto&rev=469381
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl3.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl3.java Mon Oct 30 21:56:19 2006
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.axis2.jaxws.injection;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.annotation.Resource;
+import javax.xml.ws.WebServiceContext;
+
+import org.apache.axis2.jaxws.resourceinjection.sei.ResourceInjectionPortType;
+
+
+public class ResourceInjectionTestImpl3 {
+
+	@Resource
+	private WebServiceContext ctx = null;
+	
+	public ResourceInjectionTestImpl3() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+	
+	@PostConstruct
+	public void initialize(){
+		//Called after resource injection and before a method is called.
+		System.out.println("Calling PostConstruct to Initialize");
+	}
+	
+	@PreDestroy
+	public void distructor(){
+		//Called before the scope of request or session or application ends.
+		
+		System.out.println("Calling PreDestroy ");
+		
+	}
+	public WebServiceContext getCtx(){
+		return ctx;
+	}
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl4.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl4.java?view=auto&rev=469381
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl4.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl4.java Mon Oct 30 21:56:19 2006
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.axis2.jaxws.injection;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.annotation.Resource;
+import javax.xml.ws.WebServiceContext;
+
+import org.apache.axis2.jaxws.resourceinjection.sei.ResourceInjectionPortType;
+
+
+public class ResourceInjectionTestImpl4 {
+
+	
+	private WebServiceContext ctx = null;
+	
+	public ResourceInjectionTestImpl4() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+	
+	@PostConstruct
+	public void initialize(){
+		//Called after resource injection and before a method is called.
+		System.out.println("Calling PostConstruct to Initialize");
+	}
+	
+	@PreDestroy
+	public void distructor(){
+		//Called before the scope of request or session or application ends.
+		
+		System.out.println("Calling PreDestroy ");
+		
+	}
+	@Resource
+	private void setCtx(WebServiceContext ctx) {
+		this.ctx = ctx;
+	}
+	
+	public WebServiceContext getCtx(){
+		return ctx;
+	}
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl5.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl5.java?view=auto&rev=469381
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl5.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl5.java Mon Oct 30 21:56:19 2006
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.axis2.jaxws.injection;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.annotation.Resource;
+import javax.xml.ws.WebServiceContext;
+
+
+public class ResourceInjectionTestImpl5 {
+
+	@Resource(type=WebServiceContext.class)
+	public WebServiceContext ctx = null;
+	
+	public ResourceInjectionTestImpl5() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+	
+	@PostConstruct
+	public void initialize(){
+		//Called after resource injection and before a method is called.
+		System.out.println("Calling PostConstruct to Initialize");
+	}
+	
+	@PreDestroy
+	public void distructor(){
+		//Called before the scope of request or session or application ends.
+		
+		System.out.println("Calling PreDestroy ");
+		
+	}
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTests.java?view=auto&rev=469381
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTests.java Mon Oct 30 21:56:19 2006
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.axis2.jaxws.injection;
+
+import javax.xml.ws.WebServiceContext;
+
+import junit.framework.TestCase;
+
+import org.apache.axis2.jaxws.context.WebServiceContextImpl;
+import org.apache.axis2.jaxws.resourceinjection.sei.ResourceInjectionPortType;
+import org.apache.axis2.jaxws.resourceinjection.sei.ResourceInjectionService;
+import org.apache.axis2.jaxws.server.endpoint.injection.ResourceInjector;
+import org.apache.axis2.jaxws.server.endpoint.injection.factory.ResourceInjectionFactory;
+
+
+public class ResourceInjectionTests extends TestCase {
+
+
+	private Object resource = new WebServiceContextImpl();
+	public ResourceInjectionTests() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+	public void testInjectionOnField(){
+		Object serviceInstance = new ResourceInjectionTestImpl1();
+		System.out.println("------------------------------");
+		System.out.println("Test : "+getName());
+		try{
+			ResourceInjector injector = ResourceInjectionFactory.createResourceInjector(WebServiceContext.class);
+			injector.inject(resource, serviceInstance);
+			ResourceInjectionTestImpl1 serviceImpl =(ResourceInjectionTestImpl1)serviceInstance;
+			assertNotNull(serviceImpl.ctx);
+			System.out.println("Resource Injected on Field");
+			System.out.println("------------------------------");
+		}catch(Exception e){
+			e.printStackTrace();
+			fail();
+		}
+	}
+	
+	public void testInjectionOnMethod(){
+		Object serviceInstance = new ResourceInjectionTestImpl2();
+		System.out.println("------------------------------");
+		System.out.println("Test : "+getName());
+		try{
+			ResourceInjector injector = ResourceInjectionFactory.createResourceInjector(WebServiceContext.class);
+			injector.inject(resource, serviceInstance);
+			ResourceInjectionTestImpl2 serviceImpl =(ResourceInjectionTestImpl2)serviceInstance;
+			assertNotNull(serviceImpl.ctx);
+			System.out.println("Resource Injected on Method");
+			System.out.println("------------------------------");
+		}catch(Exception e){
+			e.printStackTrace();
+			fail();
+		}
+	}
+	
+	public void testInjectionOnPrivateField(){
+		Object serviceInstance = new ResourceInjectionTestImpl3();
+		System.out.println("------------------------------");
+		System.out.println("Test : "+getName());
+		try{
+			ResourceInjector injector = ResourceInjectionFactory.createResourceInjector(WebServiceContext.class);
+			injector.inject(resource, serviceInstance);
+			ResourceInjectionTestImpl3 serviceImpl =(ResourceInjectionTestImpl3)serviceInstance;
+			assertNotNull(serviceImpl.getCtx());
+			System.out.println("Resource Injected on Private Field");
+			System.out.println("------------------------------");
+		}catch(Exception e){
+			e.printStackTrace();
+			fail();
+		}
+	}
+	
+	public void testInjectionOnProvateMethod(){
+		Object serviceInstance = new ResourceInjectionTestImpl4();
+		System.out.println("------------------------------");
+		System.out.println("Test : "+getName());
+		try{
+			ResourceInjector injector = ResourceInjectionFactory.createResourceInjector(WebServiceContext.class);
+			injector.inject(resource, serviceInstance);
+			ResourceInjectionTestImpl4 serviceImpl =(ResourceInjectionTestImpl4)serviceInstance;
+			assertNotNull(serviceImpl.getCtx());
+			System.out.println("Resource Injected using private Method");
+			System.out.println("------------------------------");
+		}catch(Exception e){
+			e.printStackTrace();
+			fail();
+		}
+	}
+	
+	public void testTypedResourceInjectionOnField(){
+		Object serviceInstance = new ResourceInjectionTestImpl5();
+		System.out.println("------------------------------");
+		System.out.println("Test : "+getName());
+		try{
+			ResourceInjector injector = ResourceInjectionFactory.createResourceInjector(WebServiceContext.class);
+			injector.inject(resource, serviceInstance);
+			ResourceInjectionTestImpl5 serviceImpl =(ResourceInjectionTestImpl5)serviceInstance;
+			assertNotNull(serviceImpl.ctx);
+			System.out.println("Resource Injected on Field");
+			System.out.println("------------------------------");
+		}catch(Exception e){
+			e.printStackTrace();
+			fail();
+		}
+	}
+
+	/*
+    public void testEchoWithResourceInjectionAndLifecycleMethods(){
+		System.out.println("------------------------------");
+		System.out.println("Test : "+getName());
+		try{
+			ResourceInjectionService service = new ResourceInjectionService();
+			ResourceInjectionPortType proxy = service.getResourceInjectionPort();
+			String response = proxy.echo("echo Request");
+			System.out.println("Response String = " +response);
+			System.out.println("------------------------------");
+		}catch(Exception e){
+			e.printStackTrace();
+			fail();
+		}
+	}
+    */
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/lifecycle/EndpointLifecycleTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/lifecycle/EndpointLifecycleTests.java?view=auto&rev=469381
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/lifecycle/EndpointLifecycleTests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/lifecycle/EndpointLifecycleTests.java Mon Oct 30 21:56:19 2006
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.axis2.jaxws.lifecycle;
+
+import org.apache.axis2.jaxws.registry.FactoryRegistry;
+import org.apache.axis2.jaxws.resourceinjection.ResourceInjectionPortTypeImpl;
+import org.apache.axis2.jaxws.server.endpoint.lifecycle.EndpointLifecycleManager;
+import org.apache.axis2.jaxws.server.endpoint.lifecycle.factory.EndpointLifecycleManagerFactory;
+
+import junit.framework.TestCase;
+
+
+public class EndpointLifecycleTests extends TestCase {
+	Object endpointInstance = new ResourceInjectionPortTypeImpl();
+	Object badObject = new Object();
+	public EndpointLifecycleTests() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+	/**
+	 * @param arg0
+	 */
+	public EndpointLifecycleTests(String arg0) {
+		super(arg0);
+		// TODO Auto-generated constructor stub
+	}
+	
+	public void testPostConstruct(){
+		System.out.println("------------------------------");
+		System.out.println("Test : "+getName());
+		try{
+			EndpointLifecycleManagerFactory elmf = (EndpointLifecycleManagerFactory)FactoryRegistry.getFactory(EndpointLifecycleManagerFactory.class);
+			assertNotNull(elmf);
+			EndpointLifecycleManager elm = elmf.createEndpointLifecycleManager(endpointInstance);
+			assertNotNull(elmf);
+			elm.invokePostConstruct();
+			System.out.println("------------------------------");
+		}catch(Exception e){
+			fail(e.getMessage());
+		}
+	}
+
+	public void testPreDestroy(){
+		System.out.println("------------------------------");
+		System.out.println("Test : "+getName());
+		try{
+			EndpointLifecycleManagerFactory elmf = (EndpointLifecycleManagerFactory)FactoryRegistry.getFactory(EndpointLifecycleManagerFactory.class);
+			assertNotNull(elmf);
+			EndpointLifecycleManager elm = elmf.createEndpointLifecycleManager(endpointInstance);
+			assertNotNull(elm);
+			elm.invokePreDestroy();
+			System.out.println("------------------------------");
+		}catch(Exception e){
+			fail(e.getMessage());
+		}
+	}
+	
+	public void testBadPostConstruct(){
+		System.out.println("------------------------------");
+		System.out.println("Test : "+getName());
+		try{
+			EndpointLifecycleManagerFactory elmf = (EndpointLifecycleManagerFactory)FactoryRegistry.getFactory(EndpointLifecycleManagerFactory.class);
+			assertNotNull(elmf);
+			EndpointLifecycleManager elm = elmf.createEndpointLifecycleManager(badObject);
+			assertNotNull(elmf);
+			elm.invokePostConstruct();
+			System.out.println("------------------------------");
+		}catch(Exception e){
+			fail(e.getMessage());
+		}
+	}
+
+	public void testBadPreDestroy(){
+		System.out.println("------------------------------");
+		System.out.println("Test : "+getName());
+		try{
+			EndpointLifecycleManagerFactory elmf = (EndpointLifecycleManagerFactory)FactoryRegistry.getFactory(EndpointLifecycleManagerFactory.class);
+			assertNotNull(elmf);
+			EndpointLifecycleManager elm = elmf.createEndpointLifecycleManager(badObject);
+			assertNotNull(elm);
+			elm.invokePreDestroy();
+			System.out.println("------------------------------");
+		}catch(Exception e){
+			fail(e.getMessage());
+		}
+	}
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/resourceinjection/META-INF/resourceinjection.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/resourceinjection/META-INF/resourceinjection.wsdl?view=auto&rev=469381
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/resourceinjection/META-INF/resourceinjection.wsdl (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/resourceinjection/META-INF/resourceinjection.wsdl Mon Oct 30 21:56:19 2006
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://resourceinjection.sample.test.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ResourceInjection" targetNamespace="http://resourceinjection.sample.test.org">
+  <wsdl:types>
+    <xsd:schema targetNamespace="http://resourceinjection.sample.test.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+      <xsd:element name="echoResponse">
+      	<xsd:complexType>
+      		<xsd:sequence>
+      			<xsd:element name="response" type="xsd:string"></xsd:element>
+      		</xsd:sequence>
+      	</xsd:complexType>
+      </xsd:element>
+      <xsd:element name="echo">
+      	<xsd:complexType>
+      		<xsd:sequence>
+      			<xsd:element name="arg" type="xsd:string"></xsd:element>
+      		</xsd:sequence>
+      	</xsd:complexType>
+      </xsd:element>
+    </xsd:schema>
+  </wsdl:types>
+  <wsdl:message name="echoResponse">
+    <wsdl:part element="tns:echoResponse" name="echoResponse"/>
+  </wsdl:message>
+  <wsdl:message name="echo">
+    <wsdl:part element="tns:echo" name="echo"/>
+  </wsdl:message>
+  <wsdl:portType name="ResourceInjectionPortType">
+    <wsdl:operation name="echo">
+      <wsdl:input message="tns:echo"/>
+      <wsdl:output message="tns:echoResponse"/>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="ResourceInjectionBinding" type="tns:ResourceInjectionPortType">
+    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+    <wsdl:operation name="echo">
+      <soap:operation soapAction="http://resourceinjection.sample.test.org/NewOperation"/>
+      <wsdl:input>
+        <soap:body use="literal"/>
+      </wsdl:input>
+      <wsdl:output>
+        <soap:body use="literal"/>
+      </wsdl:output>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:service name="ResourceInjectionService">
+    <wsdl:port binding="tns:ResourceInjectionBinding" name="ResourceInjectionPort">
+      <soap:address location="http://localhost:8080/axis2/services/ResourceInjectionService"/>
+    </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/resourceinjection/META-INF/services.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/resourceinjection/META-INF/services.xml?view=auto&rev=469381
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/resourceinjection/META-INF/services.xml (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/resourceinjection/META-INF/services.xml Mon Oct 30 21:56:19 2006
@@ -0,0 +1,12 @@
+<serviceGroup>
+ <service name="ResourceInjectionService">
+  <messageReceivers>
+   <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.jaxws.server.JAXWSMessageReceiver"/>
+  </messageReceivers>
+  <parameter locked="false" name="ServiceClass">org.apache.axis2.jaxws.resourceinjection.ResourceInjectionPortTypeImpl</parameter>
+  <operation name="invoke" mep="http://www.w3.org/2004/08/wsdl/in-out">
+    <actionMapping/>
+  </operation>
+ </service>
+</serviceGroup>
+

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/resourceinjection/ResourceInjectionPortTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/resourceinjection/ResourceInjectionPortTypeImpl.java?view=auto&rev=469381
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/resourceinjection/ResourceInjectionPortTypeImpl.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/resourceinjection/ResourceInjectionPortTypeImpl.java Mon Oct 30 21:56:19 2006
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.axis2.jaxws.resourceinjection;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
+
+import org.apache.axis2.jaxws.resourceinjection.sei.ResourceInjectionPortType;
+
+@WebService(endpointInterface="org.apache.axis2.jaxws.resourceinjection.sei.ResourceInjectionPortType")
+public class ResourceInjectionPortTypeImpl implements ResourceInjectionPortType {
+
+	@Resource
+	public WebServiceContext ctx = null;
+	
+	public ResourceInjectionPortTypeImpl() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.axis2.jaxws.resourceinjection.sei.ResourceInjectionPortType#echo(java.lang.String)
+	 */
+	public String echo(String arg) {
+		String response = "Response of Activities on Server;";
+		if(ctx != null){
+			response = response + "WebServiceContext injected;";
+			MessageContext msgContext = ctx.getMessageContext();
+			if(msgContext !=null){
+				response = response + "MessageContext was also found;";
+			}
+			else{
+				response = response + "MessageContext not found;";
+			}
+		}
+		else{
+			response = response + "WebServiceContext not found;";
+		}
+	
+		return response;
+	}
+	
+	@PostConstruct
+	public void initialize(){
+		//Called after resource injection and before a method is called.
+		System.out.println("Calling PostConstruct to Initialize");
+	}
+	
+	@PreDestroy
+	public void distructor(){
+		//Called before the scope of request or session or application ends.
+		
+		System.out.println("Calling PreDestroy ");
+		
+	}
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/resourceinjection/sei/ResourceInjectionPortType.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/resourceinjection/sei/ResourceInjectionPortType.java?view=auto&rev=469381
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/resourceinjection/sei/ResourceInjectionPortType.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/resourceinjection/sei/ResourceInjectionPortType.java Mon Oct 30 21:56:19 2006
@@ -0,0 +1,29 @@
+
+package org.apache.axis2.jaxws.resourceinjection.sei;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+
+@WebService(name = "ResourceInjectionPortType", targetNamespace = "http://resourceinjection.sample.test.org")
+public interface ResourceInjectionPortType {
+
+
+    /**
+     * 
+     * @param arg
+     * @return
+     *     returns java.lang.String
+     */
+    @WebMethod(action = "http://resourceinjection.sample.test.org/NewOperation")
+    @WebResult(name = "response", targetNamespace = "")
+    @RequestWrapper(localName = "echo", targetNamespace = "http://resourceinjection.sample.test.org", className = "org.test.sample.resourceinjection.Echo")
+    @ResponseWrapper(localName = "echoResponse", targetNamespace = "http://resourceinjection.sample.test.org", className = "org.test.sample.resourceinjection.EchoResponse")
+    public String echo(
+        @WebParam(name = "arg", targetNamespace = "")
+        String arg);
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/resourceinjection/sei/ResourceInjectionService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/resourceinjection/sei/ResourceInjectionService.java?view=auto&rev=469381
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/resourceinjection/sei/ResourceInjectionService.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/resourceinjection/sei/ResourceInjectionService.java Mon Oct 30 21:56:19 2006
@@ -0,0 +1,55 @@
+
+package org.apache.axis2.jaxws.resourceinjection.sei;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+
+@WebServiceClient(name = "ResourceInjectionService", targetNamespace = "http://resourceinjection.sample.test.org", wsdlLocation = "resourceinjection.wsdl")
+public class ResourceInjectionService
+    extends Service
+{
+
+    private final static URL RESOURCEINJECTIONSERVICE_WSDL_LOCATION;
+
+    private static String wsdlLocation="/test/org/apache/axis2/jaxws/resourceinjection/META-INF/resourceinjection.wsdl";
+    static {
+        URL url = null;
+        try {
+        	try{
+	        	String baseDir = new File(".").getCanonicalPath();
+	        	wsdlLocation = new File(baseDir + wsdlLocation).getAbsolutePath();
+        	}catch(Exception e){
+        		e.printStackTrace();
+        	}
+        	File file = new File(wsdlLocation);
+        	url = file.toURL();
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        }
+        RESOURCEINJECTIONSERVICE_WSDL_LOCATION = url;
+    }
+
+    public ResourceInjectionService(URL wsdlLocation, QName serviceName) {
+        super(wsdlLocation, serviceName);
+    }
+
+    public ResourceInjectionService() {
+        super(RESOURCEINJECTIONSERVICE_WSDL_LOCATION, new QName("http://resourceinjection.sample.test.org", "ResourceInjectionService"));
+    }
+
+    /**
+     * 
+     * @return
+     *     returns ResourceInjectionPortType
+     */
+    @WebEndpoint(name = "ResourceInjectionPort")
+    public ResourceInjectionPortType getResourceInjectionPort() {
+        return (ResourceInjectionPortType)super.getPort(new QName("http://resourceinjection.sample.test.org", "ResourceInjectionPort"), ResourceInjectionPortType.class);
+    }
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org