Author: sagara Date: Tue Jul 8 16:34:56 2014 New Revision: 1608843 URL: http://svn.apache.org/r1608843 Log: Fixed AXIS2-5658
Added: axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/deployment/Service.java Modified: axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/deployment/LifecycleTest.java axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/engine/DependencyManager.java Modified: axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/deployment/LifecycleTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/deployment/LifecycleTest.java?rev=1608843&r1=1608842&r2=1608843&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/deployment/LifecycleTest.java (original) +++ axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/deployment/LifecycleTest.java Tue Jul 8 16:34:56 2014 @@ -19,24 +19,10 @@ package org.apache.axis2.deployment; -import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; import org.apache.axis2.integration.LocalTestCase; -import org.apache.axis2.context.ServiceContext; -import org.apache.axis2.service.Lifecycle; public class LifecycleTest extends LocalTestCase { - static public class Service implements Lifecycle { - static boolean initCalled, destroyCalled; - - public void init(ServiceContext context) throws AxisFault { - initCalled = true; - } - - public void destroy(ServiceContext context) { - destroyCalled = true; - } - } public void testServiceObjectLifecycle() throws Exception { deployClassAsService("lifecycle", Service.class, Constants.SCOPE_APPLICATION); Added: axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/deployment/Service.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/deployment/Service.java?rev=1608843&view=auto ============================================================================== --- axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/deployment/Service.java (added) +++ axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/deployment/Service.java Tue Jul 8 16:34:56 2014 @@ -0,0 +1,38 @@ +/* + * 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.deployment; + +import org.apache.axis2.AxisFault; +import org.apache.axis2.context.ServiceContext; +import org.apache.axis2.service.Lifecycle; + +public class Service implements Lifecycle { + + static boolean initCalled, destroyCalled; + + public void init(ServiceContext context) throws AxisFault { + initCalled = true; + } + + public void destroy(ServiceContext context) { + destroyCalled = true; + } + +} Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/engine/DependencyManager.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/engine/DependencyManager.java?rev=1608843&r1=1608842&r2=1608843&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/engine/DependencyManager.java (original) +++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/engine/DependencyManager.java Tue Jul 8 16:34:56 2014 @@ -29,8 +29,10 @@ import org.apache.axis2.context.ServiceG import org.apache.axis2.description.AxisService; import org.apache.axis2.description.AxisServiceGroup; import org.apache.axis2.description.Parameter; +import org.apache.axis2.i18n.Messages; import org.apache.axis2.service.Lifecycle; import org.apache.axis2.util.Loader; +import org.apache.axis2.util.Utils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -116,7 +118,7 @@ public class DependencyManager { Class<?> implClass = Loader.loadClass( classLoader, ((String) implInfoParam.getValue()).trim()); - Object serviceImpl = implClass.newInstance(); + Object serviceImpl = makeNewServiceObject(service); serviceContext.setProperty(ServiceContext.SERVICE_OBJECT, serviceImpl); initServiceObject(serviceImpl, serviceContext); restoreThreadContext(tc); @@ -126,6 +128,17 @@ public class DependencyManager { } } } + + protected static Object makeNewServiceObject(AxisService service) throws AxisFault { + Object serviceObject = Utils.createServiceObject(service); + if (serviceObject == null) { + throw new AxisFault( + Messages.getMessage("paramIsNotSpecified", "SERVICE_OBJECT_SUPPLIER")); + } else { + return serviceObject; + } + } + /** * Notify a service object that it's on death row.