You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ga...@apache.org on 2007/06/25 19:47:00 UTC
svn commit: r550565 - in
/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws:
handler/ handler/lifecycle/ handler/lifecycle/factory/
handler/lifecycle/impl/ injection/ lifecycle/ registry/
server/endpoint/injection/ server/endpoint/i...
Author: gawor
Date: Mon Jun 25 10:46:58 2007
New Revision: 550565
URL: http://svn.apache.org/viewvc?view=rev&rev=550565
Log:
added lifecycle manager for handlers (just like for endpoints)
Added:
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/lifecycle/
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/lifecycle/factory/
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/lifecycle/factory/HandlerLifecycleManager.java (with props)
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/lifecycle/factory/HandlerLifecycleManagerFactory.java (with props)
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/lifecycle/impl/
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/lifecycle/impl/HandlerLifecycleManagerImpl.java (with props)
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/injection/
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/injection/ResourceInjectionException.java (with props)
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/lifecycle/
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/lifecycle/BaseLifecycleManager.java (with props)
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/lifecycle/LifecycleException.java (with props)
Removed:
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/injection/impl/ResourceInjectionException.java
Modified:
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerResolverImpl.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/registry/FactoryRegistry.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/injection/ResourceInjector.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/injection/factory/ResourceInjectionFactory.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/injection/impl/WebServiceContextInjectorImpl.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/EndpointLifecycleException.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/EndpointLifecycleManager.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/factory/EndpointLifecycleManagerFactory.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/impl/EndpointLifecycleManagerImpl.java
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerResolverImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerResolverImpl.java?view=diff&rev=550565&r1=550564&r2=550565
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerResolverImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerResolverImpl.java Mon Jun 25 10:46:58 2007
@@ -18,37 +18,36 @@
*/
package org.apache.axis2.jaxws.handler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.HandlerResolver;
+import javax.xml.ws.handler.LogicalHandler;
+import javax.xml.ws.handler.PortInfo;
+import javax.xml.ws.handler.soap.SOAPHandler;
+
import org.apache.axis2.java.security.AccessController;
import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.axis2.jaxws.core.MessageContext;
import org.apache.axis2.jaxws.description.EndpointDescription;
-import org.apache.axis2.jaxws.description.ServiceDescription;
import org.apache.axis2.jaxws.description.xml.handler.HandlerChainType;
import org.apache.axis2.jaxws.description.xml.handler.HandlerChainsType;
import org.apache.axis2.jaxws.description.xml.handler.HandlerType;
+import org.apache.axis2.jaxws.handler.lifecycle.factory.HandlerLifecycleManager;
+import org.apache.axis2.jaxws.handler.lifecycle.factory.HandlerLifecycleManagerFactory;
import org.apache.axis2.jaxws.i18n.Messages;
-import org.apache.axis2.jaxws.runtime.description.injection.ResourceInjectionServiceRuntimeDescription;
-import org.apache.axis2.jaxws.runtime.description.injection.impl.ResourceInjectionServiceRuntimeDescriptionBuilder;
-import org.apache.axis2.jaxws.server.endpoint.lifecycle.EndpointLifecycleException;
+import org.apache.axis2.jaxws.registry.FactoryRegistry;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import javax.xml.namespace.QName;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.handler.Handler;
-import javax.xml.ws.handler.HandlerResolver;
-import javax.xml.ws.handler.LogicalHandler;
-import javax.xml.ws.handler.PortInfo;
-import javax.xml.ws.handler.soap.SOAPHandler;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
/*
* This class should be created by the ServiceDelegate.
* HandlerResolverImpl.getHandlerChain(PortInfo) will be called by the
@@ -141,7 +140,7 @@
// which is where one might get the portinfo object. We still have the
// passed-in variable, however, due to the spec
- ArrayList handlers = new ArrayList<Handler>();
+ ArrayList<Handler> handlers = new ArrayList<Handler>();
/*
* TODO: do a better job checking that the return value matches up
@@ -172,21 +171,17 @@
// or will schema not allow it?
String portHandler = handlerType.getHandlerClass().getValue();
Handler handler;
- // instantiate portHandler class
+
+ // Create temporary MessageContext to pass information to HandlerLifecycleManager
+ MessageContext ctx = new MessageContext();
+ ctx.setEndpointDescription(endpointDesc);
+
+ HandlerLifecycleManager hlm = createHandlerlifecycleManager();
+
+ // instantiate portHandler class
try {
- // TODO: review: ok to use system classloader?
- handler = (Handler) loadClass(portHandler).newInstance();
- // TODO: must also do resource injection according to JAXWS 9.3.1
- callHandlerPostConstruct(handler, endpointDesc.getServiceDescription());
- } catch (ClassNotFoundException e) {
- // TODO: should we just ignore this problem?
- // TODO: NLS log and throw
- throw ExceptionFactory.makeWebServiceException(e);
- } catch (InstantiationException ie) {
- // TODO: should we just ignore this problem?
- // TODO: NLS log and throw
- throw ExceptionFactory.makeWebServiceException(ie);
- } catch (IllegalAccessException e) {
+ handler = hlm.createHandlerInstance(ctx, loadClass(portHandler));
+ } catch (Exception e) {
// TODO: should we just ignore this problem?
// TODO: NLS log and throw
throw ExceptionFactory.makeWebServiceException(e);
@@ -215,7 +210,12 @@
return handlers;
}
-
+ private HandlerLifecycleManager createHandlerlifecycleManager() {
+ HandlerLifecycleManagerFactory elmf = (HandlerLifecycleManagerFactory)FactoryRegistry
+ .getFactory(HandlerLifecycleManagerFactory.class);
+ return elmf.createHandlerLifecycleManager();
+ }
+
private static Class loadClass(String clazz) throws ClassNotFoundException {
try {
return forName(clazz, true, getContextClassLoader());
@@ -274,55 +274,6 @@
return cl;
}
- private static void callHandlerPostConstruct(Handler handler, ServiceDescription serviceDesc) throws WebServiceException {
- ResourceInjectionServiceRuntimeDescription resInj = ResourceInjectionServiceRuntimeDescriptionBuilder.create(serviceDesc, handler.getClass());
- if (resInj != null) {
- Method pcMethod = resInj.getPostConstructMethod();
- if (pcMethod != null) {
- if(log.isDebugEnabled()){
- log.debug("Invoking Method with @PostConstruct annotation");
- }
- invokeMethod(handler, pcMethod, null);
- if(log.isDebugEnabled()){
- log.debug("Completed invoke on Method with @PostConstruct annotation");
- }
- }
- }
- }
-
-
- /*
- * Helper method to destroy all instantiated Handlers once the runtime
- * is done with them.
- */
- private static void callHandlerPreDestroy(Handler handler, ServiceDescription serviceDesc) throws WebServiceException {
- ResourceInjectionServiceRuntimeDescription resInj = ResourceInjectionServiceRuntimeDescriptionBuilder.create(serviceDesc, handler.getClass());
- if (resInj != null) {
- Method pcMethod = resInj.getPreDestroyMethod();
- if (pcMethod != null) {
- if(log.isDebugEnabled()){
- log.debug("Invoking Method with @PostConstruct annotation");
- }
- invokeMethod(handler, pcMethod, null);
- if(log.isDebugEnabled()){
- log.debug("Completed invoke on Method with @PostConstruct annotation");
- }
- }
- }
- }
-
- private static void invokeMethod(Handler handlerInstance, Method m, Object[] params) throws WebServiceException{
- try{
- m.invoke(handlerInstance, params);
- }catch(InvocationTargetException e){
- // TODO perhaps a "HandlerLifecycleException" would be better?
- throw ExceptionFactory.makeWebServiceException(e);
- }catch(IllegalAccessException e){
- // TODO perhaps a "HandlerLifecycleException" would be better?
- throw ExceptionFactory.makeWebServiceException(e);
- }
- }
-
private static boolean chainResolvesToPort(HandlerChainType handlerChainType, PortInfo portinfo) {
List<String> protocolBindings = handlerChainType.getProtocolBindings();
Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/lifecycle/factory/HandlerLifecycleManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/lifecycle/factory/HandlerLifecycleManager.java?view=auto&rev=550565
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/lifecycle/factory/HandlerLifecycleManager.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/lifecycle/factory/HandlerLifecycleManager.java Mon Jun 25 10:46:58 2007
@@ -0,0 +1,44 @@
+/*
+ * 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.handler.lifecycle.factory;
+
+import javax.xml.ws.handler.Handler;
+
+import org.apache.axis2.jaxws.core.MessageContext;
+import org.apache.axis2.jaxws.injection.ResourceInjectionException;
+import org.apache.axis2.jaxws.lifecycle.LifecycleException;
+
+/*
+ * HandlerLifecycleManager is responsible to invoke lifycycle methods on Handler.
+ */
+public interface HandlerLifecycleManager {
+
+ public Handler createHandlerInstance(MessageContext mc, Class handlerClass)
+ throws LifecycleException, ResourceInjectionException;
+
+ /*
+ * Invokes method on endpoint marked with @PostConstruct annotation.
+ */
+ public void invokePostConstruct() throws LifecycleException;
+
+ /*
+ * Invokes method on endpoint marked with @preDestroy annotation.
+ */
+ public void invokePreDestroy() throws LifecycleException;
+}
Propchange: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/lifecycle/factory/HandlerLifecycleManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/lifecycle/factory/HandlerLifecycleManagerFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/lifecycle/factory/HandlerLifecycleManagerFactory.java?view=auto&rev=550565
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/lifecycle/factory/HandlerLifecycleManagerFactory.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/lifecycle/factory/HandlerLifecycleManagerFactory.java Mon Jun 25 10:46:58 2007
@@ -0,0 +1,31 @@
+/*
+ * 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.handler.lifecycle.factory;
+
+import org.apache.axis2.jaxws.handler.lifecycle.impl.HandlerLifecycleManagerImpl;
+
+public class HandlerLifecycleManagerFactory {
+
+ public HandlerLifecycleManagerFactory() {
+ }
+
+ public HandlerLifecycleManager createHandlerLifecycleManager() {
+ return new HandlerLifecycleManagerImpl();
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/lifecycle/factory/HandlerLifecycleManagerFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/lifecycle/impl/HandlerLifecycleManagerImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/lifecycle/impl/HandlerLifecycleManagerImpl.java?view=auto&rev=550565
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/lifecycle/impl/HandlerLifecycleManagerImpl.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/lifecycle/impl/HandlerLifecycleManagerImpl.java Mon Jun 25 10:46:58 2007
@@ -0,0 +1,62 @@
+/*
+ * 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.handler.lifecycle.impl;
+
+import javax.xml.ws.handler.Handler;
+
+import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.axis2.jaxws.core.MessageContext;
+import org.apache.axis2.jaxws.description.ServiceDescription;
+import org.apache.axis2.jaxws.handler.lifecycle.factory.HandlerLifecycleManager;
+import org.apache.axis2.jaxws.injection.ResourceInjectionException;
+import org.apache.axis2.jaxws.lifecycle.BaseLifecycleManager;
+import org.apache.axis2.jaxws.lifecycle.LifecycleException;
+import org.apache.axis2.jaxws.runtime.description.injection.ResourceInjectionServiceRuntimeDescription;
+import org.apache.axis2.jaxws.runtime.description.injection.ResourceInjectionServiceRuntimeDescriptionFactory;
+
+public class HandlerLifecycleManagerImpl extends BaseLifecycleManager implements HandlerLifecycleManager {
+
+ public Handler createHandlerInstance(MessageContext mc, Class handlerClass) throws LifecycleException, ResourceInjectionException {
+ if (handlerClass == null) {
+ throw ExceptionFactory.makeWebServiceException("Handler class must be passed");
+ }
+
+ ServiceDescription serviceDesc = mc.getEndpointDescription().getServiceDescription();
+ ResourceInjectionServiceRuntimeDescription injectionDesc = null;
+ if (serviceDesc != null) {
+ injectionDesc = ResourceInjectionServiceRuntimeDescriptionFactory.get(serviceDesc, handlerClass);
+ }
+
+ try {
+ this.instance = handlerClass.newInstance();
+ } catch (InstantiationException e) {
+ throw ExceptionFactory.makeWebServiceException(e);
+ } catch (IllegalAccessException e) {
+ throw ExceptionFactory.makeWebServiceException(e);
+ }
+
+ //Invoke PostConstruct
+ if (injectionDesc != null && injectionDesc.getPostConstructMethod() != null) {
+ invokePostConstruct(injectionDesc.getPostConstructMethod());
+ }
+
+ return (Handler)this.instance;
+ }
+
+}
Propchange: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/lifecycle/impl/HandlerLifecycleManagerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/injection/ResourceInjectionException.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/injection/ResourceInjectionException.java?view=auto&rev=550565
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/injection/ResourceInjectionException.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/injection/ResourceInjectionException.java Mon Jun 25 10:46:58 2007
@@ -0,0 +1,48 @@
+/*
+ * 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;
+
+public class ResourceInjectionException extends Exception {
+
+ /**
+ *
+ */
+ public ResourceInjectionException() {
+ super();
+ }
+
+ /** @param message */
+ public ResourceInjectionException(String message) {
+ super(message);
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public ResourceInjectionException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /** @param cause */
+ public ResourceInjectionException(Throwable cause) {
+ super(cause);
+ }
+
+}
Propchange: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/injection/ResourceInjectionException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/lifecycle/BaseLifecycleManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/lifecycle/BaseLifecycleManager.java?view=auto&rev=550565
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/lifecycle/BaseLifecycleManager.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/lifecycle/BaseLifecycleManager.java Mon Jun 25 10:46:58 2007
@@ -0,0 +1,139 @@
+/*
+ * 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 java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+
+import org.apache.axis2.jaxws.i18n.Messages;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public abstract class BaseLifecycleManager {
+
+ private static final Log log = LogFactory.getLog(BaseLifecycleManager.class);
+
+ protected Object instance;
+
+ public void invokePostConstruct() throws LifecycleException {
+ if (instance == null) {
+ throw new LifecycleException(Messages.getMessage("EndpointLifecycleManagerImplErr1"));
+ }
+ Method method = getPostConstructMethod();
+ if (method != null) {
+ invokePostConstruct(method);
+ }
+ }
+
+ protected void invokePostConstruct(Method method) throws LifecycleException {
+ if (log.isDebugEnabled()) {
+ log.debug("Invoking Method with @PostConstruct annotation");
+ }
+ invokeMethod(method, null);
+ if (log.isDebugEnabled()) {
+ log.debug("Completed invoke on Method with @PostConstruct annotation");
+ }
+ }
+
+ public void invokePreDestroy() throws LifecycleException {
+ if (instance == null) {
+ throw new LifecycleException(Messages.getMessage("EndpointLifecycleManagerImplErr1"));
+ }
+ Method method = getPreDestroyMethod();
+ if (method != null) {
+ invokePreDestroy(method);
+ }
+ }
+
+ protected void invokePreDestroy(Method method) throws LifecycleException {
+ if (log.isDebugEnabled()) {
+ log.debug("Invoking Method with @PreDestroy annotation");
+ }
+ invokeMethod(method, null);
+ if (log.isDebugEnabled()) {
+ log.debug("Completed invoke on Method with @PreDestroy annotation");
+ }
+ }
+
+ protected void invokeMethod(Method m, Object[] params) throws LifecycleException {
+ try {
+ m.invoke(instance, params);
+ } catch (InvocationTargetException e) {
+ throw new LifecycleException(e);
+ } catch (IllegalAccessException e) {
+ throw new LifecycleException(e);
+ }
+ }
+
+ protected Method getPostConstructMethod() {
+ // REVIEW: This method should not be called in performant situations.
+ // Plus the super class methods are not being considered
+
+ //return Method with @PostConstruct Annotation.
+ if (instance != null) {
+ Class endpointClazz = instance.getClass();
+ Method[] methods = endpointClazz.getMethods();
+
+ for (Method method : methods) {
+ if (isPostConstruct(method)) {
+ return method;
+ }
+ }
+ }
+ return null;
+ }
+
+ protected Method getPreDestroyMethod() {
+ // REVIEW: This method should not be called in performant situations.
+ // Plus the super class methods are not being considered
+ //return Method with @PreDestroy Annotation
+ if (instance != null) {
+ Class endpointClazz = instance.getClass();
+ Method[] methods = endpointClazz.getMethods();
+
+ for (Method method : methods) {
+ if (isPreDestroy(method)) {
+ return method;
+ }
+ }
+ }
+ return null;
+ }
+
+ protected boolean isPostConstruct(Method method) {
+ Annotation[] annotations = method.getDeclaredAnnotations();
+ for (Annotation annotation : annotations) {
+ return PostConstruct.class.isAssignableFrom(annotation.annotationType());
+ }
+ return false;
+ }
+
+ protected boolean isPreDestroy(Method method) {
+ Annotation[] annotations = method.getDeclaredAnnotations();
+ for (Annotation annotation : annotations) {
+ return PreDestroy.class.isAssignableFrom(annotation.annotationType());
+ }
+ return false;
+ }
+
+}
Propchange: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/lifecycle/BaseLifecycleManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/lifecycle/LifecycleException.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/lifecycle/LifecycleException.java?view=auto&rev=550565
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/lifecycle/LifecycleException.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/lifecycle/LifecycleException.java Mon Jun 25 10:46:58 2007
@@ -0,0 +1,45 @@
+/*
+ * 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;
+
+public class LifecycleException extends Exception {
+
+ public LifecycleException() {
+ super();
+ }
+
+ /** @param message */
+ public LifecycleException(String message) {
+ super(message);
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public LifecycleException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /** @param cause */
+ public LifecycleException(Throwable cause) {
+ super(cause);
+ }
+
+}
Propchange: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/lifecycle/LifecycleException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/registry/FactoryRegistry.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/registry/FactoryRegistry.java?view=diff&rev=550565&r1=550564&r2=550565
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/registry/FactoryRegistry.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/registry/FactoryRegistry.java Mon Jun 25 10:46:58 2007
@@ -17,6 +17,7 @@
package org.apache.axis2.jaxws.registry;
+import org.apache.axis2.jaxws.handler.lifecycle.factory.HandlerLifecycleManagerFactory;
import org.apache.axis2.jaxws.message.databinding.impl.JAXBBlockFactoryImpl;
import org.apache.axis2.jaxws.message.databinding.impl.OMBlockFactoryImpl;
import org.apache.axis2.jaxws.message.databinding.impl.SOAPEnvelopeBlockFactoryImpl;
@@ -58,6 +59,7 @@
table.put(XMLPartFactory.class, new XMLPartFactoryImpl());
table.put(SAAJConverterFactory.class, new SAAJConverterFactoryImpl());
table.put(EndpointLifecycleManagerFactory.class, new EndpointLifecycleManagerFactory());
+ table.put(HandlerLifecycleManagerFactory.class, new HandlerLifecycleManagerFactory());
table.put(ClassFinderFactory.class, new ClassFinderFactory());
table.put(EndpointDispatcherFactory.class, new EndpointDispatcherFactory());
table.put(ExecutorFactory.class, new JAXWSExecutorFactory());
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/injection/ResourceInjector.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/injection/ResourceInjector.java?view=diff&rev=550565&r1=550564&r2=550565
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/injection/ResourceInjector.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/injection/ResourceInjector.java Mon Jun 25 10:46:58 2007
@@ -18,7 +18,7 @@
*/
package org.apache.axis2.jaxws.server.endpoint.injection;
-import org.apache.axis2.jaxws.server.endpoint.injection.impl.ResourceInjectionException;
+import org.apache.axis2.jaxws.injection.ResourceInjectionException;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/injection/factory/ResourceInjectionFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/injection/factory/ResourceInjectionFactory.java?view=diff&rev=550565&r1=550564&r2=550565
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/injection/factory/ResourceInjectionFactory.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/injection/factory/ResourceInjectionFactory.java Mon Jun 25 10:46:58 2007
@@ -18,12 +18,12 @@
*/
package org.apache.axis2.jaxws.server.endpoint.injection.factory;
+import javax.xml.ws.WebServiceContext;
+
import org.apache.axis2.jaxws.i18n.Messages;
+import org.apache.axis2.jaxws.injection.ResourceInjectionException;
import org.apache.axis2.jaxws.server.endpoint.injection.ResourceInjector;
-import org.apache.axis2.jaxws.server.endpoint.injection.impl.ResourceInjectionException;
import org.apache.axis2.jaxws.server.endpoint.injection.impl.WebServiceContextInjectorImpl;
-
-import javax.xml.ws.WebServiceContext;
public class ResourceInjectionFactory {
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/injection/impl/WebServiceContextInjectorImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/injection/impl/WebServiceContextInjectorImpl.java?view=diff&rev=550565&r1=550564&r2=550565
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/injection/impl/WebServiceContextInjectorImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/injection/impl/WebServiceContextInjectorImpl.java Mon Jun 25 10:46:58 2007
@@ -18,16 +18,6 @@
*/
package org.apache.axis2.jaxws.server.endpoint.injection.impl;
-import org.apache.axis2.java.security.AccessController;
-import org.apache.axis2.jaxws.context.WebServiceContextImpl;
-import org.apache.axis2.jaxws.i18n.Messages;
-import org.apache.axis2.jaxws.server.endpoint.injection.WebServiceContextInjector;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.annotation.Resource;
-import javax.xml.ws.WebServiceContext;
-import javax.xml.ws.handler.MessageContext;
import java.lang.annotation.Annotation;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Field;
@@ -37,6 +27,18 @@
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.List;
+
+import javax.annotation.Resource;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
+
+import org.apache.axis2.java.security.AccessController;
+import org.apache.axis2.jaxws.context.WebServiceContextImpl;
+import org.apache.axis2.jaxws.i18n.Messages;
+import org.apache.axis2.jaxws.injection.ResourceInjectionException;
+import org.apache.axis2.jaxws.server.endpoint.injection.WebServiceContextInjector;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
public class WebServiceContextInjectorImpl implements WebServiceContextInjector {
private static final Log log = LogFactory.getLog(WebServiceContextInjectorImpl.class);
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/EndpointLifecycleException.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/EndpointLifecycleException.java?view=diff&rev=550565&r1=550564&r2=550565
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/EndpointLifecycleException.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/EndpointLifecycleException.java Mon Jun 25 10:46:58 2007
@@ -18,19 +18,17 @@
*/
package org.apache.axis2.jaxws.server.endpoint.lifecycle;
+import org.apache.axis2.jaxws.lifecycle.LifecycleException;
-public class EndpointLifecycleException extends Exception {
-
+public class EndpointLifecycleException extends LifecycleException {
public EndpointLifecycleException() {
super();
- // TODO Auto-generated constructor stub
}
/** @param message */
public EndpointLifecycleException(String message) {
super(message);
- // TODO Auto-generated constructor stub
}
/**
@@ -39,13 +37,11 @@
*/
public EndpointLifecycleException(String message, Throwable cause) {
super(message, cause);
- // TODO Auto-generated constructor stub
}
/** @param cause */
public EndpointLifecycleException(Throwable cause) {
super(cause);
- // TODO Auto-generated constructor stub
}
}
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/EndpointLifecycleManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/EndpointLifecycleManager.java?view=diff&rev=550565&r1=550564&r2=550565
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/EndpointLifecycleManager.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/EndpointLifecycleManager.java Mon Jun 25 10:46:58 2007
@@ -19,7 +19,8 @@
package org.apache.axis2.jaxws.server.endpoint.lifecycle;
import org.apache.axis2.jaxws.core.MessageContext;
-import org.apache.axis2.jaxws.server.endpoint.injection.impl.ResourceInjectionException;
+import org.apache.axis2.jaxws.injection.ResourceInjectionException;
+import org.apache.axis2.jaxws.lifecycle.LifecycleException;
/*
* EndpointLifecycleManager is responsible to invoke lifycycle methods on Endpoint. An Endpoint could be a
@@ -37,15 +38,15 @@
* @return
*/
public Object createServiceInstance(MessageContext mc, Class serviceImplClass)
- throws EndpointLifecycleException, ResourceInjectionException;
+ throws LifecycleException, ResourceInjectionException;
/*
* Invokes method on endpoint marked with @PostConstruct annotation.
*/
- public void invokePostConstruct() throws EndpointLifecycleException;
+ public void invokePostConstruct() throws LifecycleException;
/*
* Invokes method on endpoint marked with @preDestroy annotation.
*/
- public void invokePreDestroy() throws EndpointLifecycleException;
+ public void invokePreDestroy() throws LifecycleException;
}
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/factory/EndpointLifecycleManagerFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/factory/EndpointLifecycleManagerFactory.java?view=diff&rev=550565&r1=550564&r2=550565
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/factory/EndpointLifecycleManagerFactory.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/factory/EndpointLifecycleManagerFactory.java Mon Jun 25 10:46:58 2007
@@ -23,13 +23,10 @@
import org.apache.axis2.jaxws.server.endpoint.lifecycle.EndpointLifecycleManager;
import org.apache.axis2.jaxws.server.endpoint.lifecycle.impl.EndpointLifecycleManagerImpl;
-
public class EndpointLifecycleManagerFactory {
-
public EndpointLifecycleManagerFactory() {
super();
- // TODO Auto-generated constructor stub
}
public EndpointLifecycleManager createEndpointLifecycleManager(Object endpointInstance)
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/impl/EndpointLifecycleManagerImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/impl/EndpointLifecycleManagerImpl.java?view=diff&rev=550565&r1=550564&r2=550565
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/impl/EndpointLifecycleManagerImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/lifecycle/impl/EndpointLifecycleManagerImpl.java Mon Jun 25 10:46:58 2007
@@ -18,7 +18,14 @@
*/
package org.apache.axis2.jaxws.server.endpoint.lifecycle.impl;
+import java.lang.reflect.Method;
+
+import javax.xml.ws.WebServiceContext;
+
+import org.apache.axis2.Constants;
import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.Parameter;
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.context.WebServiceContextImpl;
import org.apache.axis2.jaxws.context.factory.MessageContextFactory;
@@ -27,51 +34,35 @@
import org.apache.axis2.jaxws.description.ServiceDescription;
import org.apache.axis2.jaxws.handler.SoapMessageContext;
import org.apache.axis2.jaxws.i18n.Messages;
+import org.apache.axis2.jaxws.lifecycle.BaseLifecycleManager;
+import org.apache.axis2.jaxws.lifecycle.LifecycleException;
import org.apache.axis2.jaxws.runtime.description.injection.ResourceInjectionServiceRuntimeDescription;
import org.apache.axis2.jaxws.runtime.description.injection.ResourceInjectionServiceRuntimeDescriptionFactory;
import org.apache.axis2.jaxws.server.endpoint.injection.ResourceInjector;
import org.apache.axis2.jaxws.server.endpoint.injection.WebServiceContextInjector;
import org.apache.axis2.jaxws.server.endpoint.injection.factory.ResourceInjectionFactory;
-import org.apache.axis2.jaxws.server.endpoint.injection.impl.ResourceInjectionException;
-import org.apache.axis2.jaxws.server.endpoint.lifecycle.EndpointLifecycleException;
import org.apache.axis2.jaxws.server.endpoint.lifecycle.EndpointLifecycleManager;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.Constants;
+import org.apache.axis2.jaxws.injection.ResourceInjectionException;
import org.apache.axis2.util.Loader;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.xml.ws.WebServiceContext;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-public class EndpointLifecycleManagerImpl implements EndpointLifecycleManager {
+public class EndpointLifecycleManagerImpl extends BaseLifecycleManager implements EndpointLifecycleManager {
public static final String WEBSERVICE_MESSAGE_CONTEXT = "javax.xml.ws.WebServiceContext";
private static final Log log = LogFactory.getLog(EndpointLifecycleManagerImpl.class);
- private Object endpointInstance = null;
- private Class endpointClazz = null;
- public EndpointLifecycleManagerImpl(Object endpointInstance) {
- super();
- this.endpointInstance = endpointInstance;
- if (endpointInstance != null) {
- endpointClazz = endpointInstance.getClass();
- }
+ public EndpointLifecycleManagerImpl(Object endpointInstance) {
+ this.instance = endpointInstance;
}
public EndpointLifecycleManagerImpl() {
- super();
}
/* (non-Javadoc)
* @see org.apache.axis2.jaxws.server.endpoint.lifecycle.EndpointLifecycleManager#createServiceInstance(org.apache.axis2.jaxws.core.MessageContext, java.lang.Class)
*/
public Object createServiceInstance(MessageContext mc, Class serviceImplClass)
- throws EndpointLifecycleException, ResourceInjectionException {
+ throws LifecycleException, ResourceInjectionException {
org.apache.axis2.context.MessageContext msgContext = mc.getAxisMessageContext();
// Get the ServiceDescription and injectionDesc which contain
@@ -88,8 +79,7 @@
ServiceContext serviceContext = msgContext.getServiceContext();
Object serviceimpl = serviceContext.getProperty(ServiceContext.SERVICE_OBJECT);
if (serviceimpl != null) {
- this.endpointInstance = serviceimpl;
- this.endpointClazz = serviceImplClass;
+ this.instance = serviceimpl;
if (log.isDebugEnabled()) {
log.debug("Service Instance found in the service context, reusing the instance");
@@ -114,8 +104,8 @@
} else {
// create a new service impl class for that service
serviceimpl = createServiceInstance(msgContext.getAxisService(), serviceImplClass);
- this.endpointInstance = serviceimpl;
- this.endpointClazz = serviceImplClass;
+ this.instance = serviceimpl;
+
if (log.isDebugEnabled()) {
log.debug("New Service Instance created");
}
@@ -132,7 +122,6 @@
// Inject WebServiceContext
injectWebServiceContext(mc, wsContext, serviceimpl);
serviceContext.setProperty(WEBSERVICE_MESSAGE_CONTEXT, wsContext);
-
}
//Invoke PostConstruct
@@ -142,115 +131,6 @@
serviceContext.setProperty(ServiceContext.SERVICE_OBJECT, serviceimpl);
return serviceimpl;
}
- }
-
- /* (non-Javadoc)
- * @see org.apache.axis2.jaxws.server.endpoint.lifecycle.EndpointLifecycleManager#invokePostConstruct()
- */
- public void invokePostConstruct() throws EndpointLifecycleException {
- if (endpointInstance == null) {
- throw new EndpointLifecycleException(
- Messages.getMessage("EndpointLifecycleManagerImplErr1"));
- }
- Method method = getPostConstructMethod();
- if (method != null) {
- invokePostConstruct(method);
- }
- }
-
- private void invokePostConstruct(Method method) throws EndpointLifecycleException {
- if (log.isDebugEnabled()) {
- log.debug("Invoking Method with @PostConstruct annotation");
- }
- invokeMethod(method, null);
- if (log.isDebugEnabled()) {
- log.debug("Completed invoke on Method with @PostConstruct annotation");
- }
- }
-
- /* (non-Javadoc)
- * @see org.apache.axis2.jaxws.server.endpoint.lifecycle.EndpointLifecycleManager#invokePreDestroy()
- */
- public void invokePreDestroy() throws EndpointLifecycleException {
- if (endpointInstance == null) {
- throw new EndpointLifecycleException(
- Messages.getMessage("EndpointLifecycleManagerImplErr1"));
- }
- Method method = getPreDestroyMethod();
- if (method != null) {
- invokePreDestroy(method);
- }
- }
-
- private void invokePreDestroy(Method method) throws EndpointLifecycleException {
- if (log.isDebugEnabled()) {
- log.debug("Invoking Method with @PreDestroy annotation");
- }
- invokeMethod(method, null);
- if (log.isDebugEnabled()) {
- log.debug("Completed invoke on Method with @PreDestroy annotation");
- }
- }
-
- private void invokeMethod(Method m, Object[] params) throws EndpointLifecycleException {
- try {
- m.invoke(endpointInstance, params);
- } catch (InvocationTargetException e) {
- throw new EndpointLifecycleException(e);
- } catch (IllegalAccessException e) {
- throw new EndpointLifecycleException(e);
- }
- }
-
- private Method getPostConstructMethod() {
- // REVIEW: This method should not be called in performant situations.
- // Plus the super class methods are not being considered
-
- //return Method with @PostConstruct Annotation.
- if (endpointInstance != null) {
- Class endpointClazz = endpointInstance.getClass();
- Method[] methods = endpointClazz.getMethods();
-
- for (Method method : methods) {
- if (isPostConstruct(method)) {
- return method;
- }
- }
- }
- return null;
- }
-
- private Method getPreDestroyMethod() {
- // REVIEW: This method should not be called in performant situations.
- // Plus the super class methods are not being considered
- //return Method with @PreDestroy Annotation
- if (endpointInstance != null) {
- Class endpointClazz = endpointInstance.getClass();
- Method[] methods = endpointClazz.getMethods();
-
- for (Method method : methods) {
- if (isPreDestroy(method)) {
- return method;
- }
- }
- }
- return null;
- }
-
- private boolean isPostConstruct(Method method) {
- Annotation[] annotations = method.getDeclaredAnnotations();
- for (Annotation annotation : annotations) {
- return PostConstruct.class.isAssignableFrom(annotation.annotationType());
- }
- return false;
- }
-
- private boolean isPreDestroy(Method method) {
- Annotation[] annotations = method.getDeclaredAnnotations();
- for (Annotation annotation : annotations) {
- return PreDestroy.class.isAssignableFrom(annotation.annotationType());
- }
- return false;
}
private Object createServiceInstance(AxisService service, Class serviceImplClass) {
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org