Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 33698 invoked from network); 4 Aug 2008 06:07:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Aug 2008 06:07:27 -0000 Received: (qmail 21158 invoked by uid 500); 4 Aug 2008 06:07:26 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 20953 invoked by uid 500); 4 Aug 2008 06:07:26 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 20940 invoked by uid 500); 4 Aug 2008 06:07:26 -0000 Delivered-To: apmail-ws-axis2-cvs@ws.apache.org Received: (qmail 20937 invoked by uid 99); 4 Aug 2008 06:07:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Aug 2008 23:07:26 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Aug 2008 06:06:38 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id DE2DB238889D; Sun, 3 Aug 2008 23:06:35 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r682265 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2: Constants.java context/ConfigurationContextFactory.java deployment/DeploymentLifeCycleListener.java Date: Mon, 04 Aug 2008 06:06:35 -0000 To: axis2-cvs@ws.apache.org From: amilas@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080804060635.DE2DB238889D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: amilas Date: Sun Aug 3 23:06:35 2008 New Revision: 682265 URL: http://svn.apache.org/viewvc?rev=682265&view=rev Log: Added a deployment life cycle listener to Axis2. (issue Axis2-3957) Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentLifeCycleListener.java Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContextFactory.java Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java?rev=682265&r1=682264&r2=682265&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java (original) +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java Sun Aug 3 23:06:35 2008 @@ -397,5 +397,11 @@ */ public static final String DISABLE_RESPONSE_ACK = "DisableResponseAck"; + /** + * This constant is used to add an deployment life cycle listner to Axis2 + */ + + public static final String DEPLOYMENT_LIFE_CYCLE_LISTENER = "deploymentLifeCycleListener"; + } } Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContextFactory.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContextFactory.java?rev=682265&r1=682264&r2=682265&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContextFactory.java (original) +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContextFactory.java Sun Aug 3 23:06:35 2008 @@ -21,11 +21,7 @@ import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; -import org.apache.axis2.deployment.AxisConfigBuilder; -import org.apache.axis2.deployment.DeploymentConstants; -import org.apache.axis2.deployment.DeploymentEngine; -import org.apache.axis2.deployment.FileSystemConfigurator; -import org.apache.axis2.deployment.URLBasedAxisConfigurator; +import org.apache.axis2.deployment.*; import org.apache.axis2.deployment.util.Utils; import org.apache.axis2.description.AxisModule; import org.apache.axis2.description.AxisServiceGroup; @@ -66,6 +62,27 @@ public static ConfigurationContext createConfigurationContext( AxisConfigurator axisConfigurator) throws AxisFault { AxisConfiguration axisConfig = axisConfigurator.getAxisConfiguration(); + // call to the deployment listners + Parameter param = axisConfig.getParameter(Constants.Configuration.DEPLOYMENT_LIFE_CYCLE_LISTENER); + DeploymentLifeCycleListener deploymentLifeCycleListener = null; + if (param != null){ + String className = (String) param.getValue(); + try { + deploymentLifeCycleListener = (DeploymentLifeCycleListener) Class.forName(className).newInstance(); + } catch (InstantiationException e) { + log.error("Can not instantiate deployment Listener " + className, e); + throw new AxisFault("Can not instantiate deployment Listener " + className); + } catch (IllegalAccessException e) { + log.error("Illegal Access deployment Listener " + className, e); + throw new AxisFault("Illegal Access deployment Listener " + className); + } catch (ClassNotFoundException e) { + log.error("Class not found deployment Listener " + className, e); + throw new AxisFault("Class not found deployment Listener " + className); + } + } + if (deploymentLifeCycleListener != null){ + deploymentLifeCycleListener.preDeploy(axisConfig); + } ConfigurationContext configContext = new ConfigurationContext(axisConfig); if (axisConfig.getClusterManager() != null) { @@ -86,6 +103,9 @@ initApplicationScopeServices(configContext); axisConfig.setStart(true); + if (deploymentLifeCycleListener != null){ + deploymentLifeCycleListener.postDeploy(configContext); + } return configContext; } Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentLifeCycleListener.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentLifeCycleListener.java?rev=682265&view=auto ============================================================================== --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentLifeCycleListener.java (added) +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentLifeCycleListener.java Sun Aug 3 23:06:35 2008 @@ -0,0 +1,46 @@ +/* + * 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.engine.AxisConfiguration; +import org.apache.axis2.context.ConfigurationContext; +import org.apache.axis2.AxisFault; + +/** + * this interface is used to inform deployment lifecycle realated events to + * listners + */ +public interface DeploymentLifeCycleListener { + + /** + * calls before creating the configuration context to do any initializing work. + * @param axisConfig + * @throws AxisFault + */ + public void preDeploy(AxisConfiguration axisConfig) throws AxisFault; + + /** + * calls after starting the configuration context to resume any activity. + * @param configurationContext + * @throws AxisFault + */ + public void postDeploy(ConfigurationContext configurationContext) throws AxisFault; + +}