You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by ru...@apache.org on 2010/02/12 05:59:01 UTC

svn commit: r909234 - in /synapse/trunk/java/modules: core/ core/src/main/java/org/apache/synapse/deployers/ core/src/main/java/org/apache/synapse/endpoints/ transports/core/nhttp/

Author: ruwan
Date: Fri Feb 12 04:59:01 2010
New Revision: 909234

URL: http://svn.apache.org/viewvc?rev=909234&view=rev
Log:
Initial version of the synapse artifact hot deployment

Added:
    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/
    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/AbstractSynapseArtifactDeployer.java
    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/EndpointDeployer.java
    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/EventSourceDeployer.java
    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/LocalEntryDeployer.java
    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/ProxyServiceDeployer.java
    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/SequenceDeployer.java
Modified:
    synapse/trunk/java/modules/core/pom.xml
    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/Endpoint.java
    synapse/trunk/java/modules/transports/core/nhttp/pom.xml

Modified: synapse/trunk/java/modules/core/pom.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/pom.xml?rev=909234&r1=909233&r2=909234&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/pom.xml (original)
+++ synapse/trunk/java/modules/core/pom.xml Fri Feb 12 04:59:01 2010
@@ -138,6 +138,7 @@
                         <Export-Package>
                             org.apache.synapse,
                             org.apache.synapse.aspects.*,
+                            org.apache.synapse.deployers.*,
                             org.apache.synapse.config.*,
                             org.apache.synapse.core.*,
                             org.apache.synapse.endpoints.*,

Added: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/AbstractSynapseArtifactDeployer.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/AbstractSynapseArtifactDeployer.java?rev=909234&view=auto
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/AbstractSynapseArtifactDeployer.java (added)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/AbstractSynapseArtifactDeployer.java Fri Feb 12 04:59:01 2010
@@ -0,0 +1,170 @@
+/*
+ *  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.synapse.deployers;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.deployment.Deployer;
+import org.apache.axis2.deployment.DeploymentException;
+import org.apache.axis2.deployment.repository.util.DeploymentFileData;
+import org.apache.axis2.description.Parameter;
+import org.apache.synapse.SynapseConstants;
+import org.apache.synapse.config.SynapseConfiguration;
+import org.apache.synapse.core.SynapseEnvironment;
+
+import javax.xml.stream.XMLStreamException;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Implements the generic logic for the synapse artifact deployment and provide a deployment framework
+ * for the synapse.</p>
+ *
+ * <p>Any  synapse artifact which requires the hot deployment or hot update features should extend this and
+ * just needs to concentrate on the deployment logic. By default setting the file extension and directory dynamically
+ * is not supported.
+ *
+ * @see org.apache.axis2.deployment.Deployer
+ */
+public abstract class AbstractSynapseArtifactDeployer implements Deployer {
+
+    protected ConfigurationContext cfgCtx;
+
+    /**
+     * Keeps track of the deployed artifacts in the synapse environment 
+     */
+    private Map<String, String> fileName2ArtifactName = new HashMap<String, String>();
+
+    /**
+     * Initializes the Synapse artifact deployment
+     * 
+     * @param configCtx Axis2 ConfigurationContext
+     */
+    public void init(ConfigurationContext configCtx) {
+        this.cfgCtx = configCtx;
+    }
+
+    /**
+     *  This method is called by the axis2 deployment framework and it performs a synapse artifact specific
+     * yet common across all the artifacts, set of tasks and delegate the actual deployment to the respective
+     * artifact deployers.
+     *
+     * @param deploymentFileData file to be used for the deployment
+     * @throws DeploymentException incase of an error in deploying the file
+     * 
+     * @see org.apache.synapse.deployers.AbstractSynapseArtifactDeployer#deploySynapseArtifact(
+     * org.apache.axiom.om.OMElement, String)
+     */
+    public void deploy(DeploymentFileData deploymentFileData) throws DeploymentException {
+        String filename = deploymentFileData.getAbsolutePath();
+        try {
+            InputStream in = new FileInputStream(filename);
+            try {
+                // construct the xml element from the file, it has to be XML,
+                // since all synapse artifacts are XML based
+                OMElement element = new StAXOMBuilder(
+                        StAXUtils.createXMLStreamReader(in)).getDocumentElement();
+                String artifatcName = deploySynapseArtifact(element, filename);
+                if (artifatcName != null) {
+                    fileName2ArtifactName.put(filename, artifatcName);
+                }
+            } finally {
+                in.close();
+            }
+        } catch (IOException ex) {
+            throw new DeploymentException("Error reading "
+                    + filename + " : " + ex.getMessage(), ex);
+        } catch (XMLStreamException ex) {
+            throw new DeploymentException("Error parsing "
+                    + filename + " : " + ex.getMessage(), ex);
+        } catch (OMException ex) {
+            throw new DeploymentException("Error parsing "
+                    + filename + " : " + ex.getMessage(), ex);
+        }
+    }
+
+    /**
+     * This is the method called by the axis2 framework for undeployment of the artifacts. As in the deploy
+     * case this performs some common tasks across all the synapse artifacts and fall back to the artifact
+     * specific logic of undeployment.
+     *
+     * @param fileName file describing the artifact to be undeployed
+     * @throws DeploymentException in case of an error in undeployment
+     *
+     * @see org.apache.synapse.deployers.AbstractSynapseArtifactDeployer#undeploySynapseArtifact(String) 
+     */
+    public void unDeploy(String fileName) throws DeploymentException {
+        undeploySynapseArtifact(fileName2ArtifactName.get(fileName));
+        fileName2ArtifactName.remove(fileName);
+    }
+
+    // We do not support dynamically setting the directory nor the extension
+    public void setDirectory(String directory) {}
+    public void setExtension(String extension) {}
+
+    /**
+     * All synapse artifact deployers MUST implement this method and it handles artifact specific deployment
+     * tasks of those artifacts.
+     *
+     * @param artifactConfig built element representing the artifact to be deployed loaded from the file
+     * @param fileName file name from which this artifact is being loaded
+     * @return String artifact name created by the deployment task
+     * 
+     * @see org.apache.synapse.deployers.AbstractSynapseArtifactDeployer#deploy(
+     * org.apache.axis2.deployment.repository.util.DeploymentFileData)
+     */
+    public abstract String deploySynapseArtifact(OMElement artifactConfig, String fileName);
+
+    /**
+     * All synapse artifact deployers MUST implement this method and it handles artifact specific undeployment
+     * tasks of those artifacts.
+     *
+     * @param artifactName name of the artifact to be undeployed
+     *
+     * @see org.apache.synapse.deployers.AbstractSynapseArtifactDeployer#unDeploy(String) 
+     */
+    public abstract void undeploySynapseArtifact(String artifactName);
+
+    protected SynapseConfiguration getSynapseConfiguration() throws DeploymentException {
+        Parameter synCfgParam =
+                cfgCtx.getAxisConfiguration().getParameter(SynapseConstants.SYNAPSE_CONFIG);
+        if (synCfgParam == null) {
+            throw new DeploymentException("SynapseConfiguration not found. " +
+                    "Are you sure that you are running Synapse?");
+        }
+        return (SynapseConfiguration) synCfgParam.getValue();
+    }
+
+    protected SynapseEnvironment getSynapseEnvironment() throws DeploymentException {
+        Parameter synCfgParam =
+                cfgCtx.getAxisConfiguration().getParameter(SynapseConstants.SYNAPSE_ENV);
+        if (synCfgParam == null) {
+            throw new DeploymentException("SynapseEnvironment not found. " +
+                    "Are you sure that you are running Synapse?");
+        }
+        return (SynapseEnvironment) synCfgParam.getValue();
+    }
+}

Added: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/EndpointDeployer.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/EndpointDeployer.java?rev=909234&view=auto
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/EndpointDeployer.java (added)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/EndpointDeployer.java Fri Feb 12 04:59:01 2010
@@ -0,0 +1,99 @@
+/*
+ *  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.synapse.deployers;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.config.xml.endpoints.EndpointFactory;
+import org.apache.synapse.endpoints.Endpoint;
+
+/**
+ *  Handles the <code>Endpoint</code> deployment and undeployment tasks
+ *
+ * @see org.apache.synapse.deployers.AbstractSynapseArtifactDeployer
+ */
+public class EndpointDeployer extends AbstractSynapseArtifactDeployer {
+
+    private static Log log = LogFactory.getLog(EndpointDeployer.class);
+
+    @Override
+    public String deploySynapseArtifact(OMElement artifactConfig, String fileName) {
+
+        if (log.isDebugEnabled()) {
+            log.debug("Endpoint Deployment from file : " + fileName + " : Started");
+        }
+
+        try {
+            Endpoint ep = EndpointFactory.getEndpointFromElement(artifactConfig, false);
+            if (ep != null) {
+                ep.setFileName(fileName);
+                if (log.isDebugEnabled()) {
+                    log.debug("Endpoint named '" + ep.getName()
+                            + "' has been built from the file " + fileName);
+                }
+                ep.init(getSynapseEnvironment());
+                if (log.isDebugEnabled()) {
+                    log.debug("Initialized the endpoint : " + ep.getName());
+                }
+                getSynapseConfiguration().addEndpoint(ep.getName(), ep);
+                if (log.isDebugEnabled()) {
+                    log.debug("Endpoint Deployment from file : " + fileName + " : Completed");
+                }
+                return ep.getName();
+            } else {
+                log.error("Endpoint Deployment Failed. The artifact described in the file "
+                        + fileName + " is not an Endpoint");
+            }
+        } catch (Exception e) {
+            log.error("Endpoint Deployment from the file : " + fileName + " : Failed.", e);
+        }
+
+        return null;
+    }
+
+    @Override
+    public void undeploySynapseArtifact(String artifactName) {
+
+        if (log.isDebugEnabled()) {
+            log.debug("Endpoint Undeployment of the endpoint named : "
+                    + artifactName + " : Started");
+        }
+        
+        try {
+            Endpoint ep = getSynapseConfiguration().getDefinedEndpoints().get(artifactName);
+            if (ep != null) {
+                getSynapseConfiguration().removeEndpoint(artifactName);
+                if (log.isDebugEnabled()) {
+                    log.debug("Destroying the endpoint named : " + artifactName);
+                }
+                ep.destroy();
+                if (log.isDebugEnabled()) {
+                    log.debug("Endpoint Undeployment of the endpoint named : "
+                            + artifactName + " : Completed");
+                }
+            } else {
+                log.error("Couldn't find the endpoint named : " + artifactName);
+            }
+        } catch (Exception e) {
+            log.error("Endpoint Undeployement of endpoint named : " + artifactName + " : Failed");
+        }
+    }
+}

Added: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/EventSourceDeployer.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/EventSourceDeployer.java?rev=909234&view=auto
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/EventSourceDeployer.java (added)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/EventSourceDeployer.java Fri Feb 12 04:59:01 2010
@@ -0,0 +1,96 @@
+/*
+ *  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.synapse.deployers;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.config.xml.eventing.EventSourceFactory;
+import org.apache.synapse.eventing.SynapseEventSource;
+
+/**
+ *  Handles the <code>EventSource</code> deployment and undeployment tasks
+ *
+ * @see org.apache.synapse.deployers.AbstractSynapseArtifactDeployer
+ */
+public class EventSourceDeployer extends AbstractSynapseArtifactDeployer {
+
+    private static Log log = LogFactory.getLog(SequenceDeployer.class);
+
+    @Override
+    public String deploySynapseArtifact(OMElement artifactConfig, String fileName) {
+
+        if (log.isDebugEnabled()) {
+            log.debug("EventSource Deployment from file : " + fileName + " : Started");
+        }
+
+        try {
+            SynapseEventSource es = EventSourceFactory.createEventSource(artifactConfig);
+            if (es != null) {
+                es.setFileName(fileName);
+                if (log.isDebugEnabled()) {
+                    log.debug("EventSource named '" + es.getName()
+                            + "' has been built from the file " + fileName);
+                }
+                es.buildService(getSynapseConfiguration().getAxisConfiguration());
+                if (log.isDebugEnabled()) {
+                    log.debug("Initialized the EventSource : " + es.getName());
+                }
+                getSynapseConfiguration().addEventSource(es.getName(), es);
+                if (log.isDebugEnabled()) {
+                    log.debug("EventSource Deployment from file : " + fileName + " : Completed");
+                }
+                return es.getName();
+            } else {
+                log.error("EventSource Deployment Failed. The artifact described in the file "
+                        + fileName + " is not an EventSource");
+            }
+        } catch (Exception e) {
+            log.error("EventSource Deployment from the file : " + fileName + " : Failed.", e);
+        }
+
+        return null;
+    }
+
+    @Override
+    public void undeploySynapseArtifact(String artifactName) {
+
+        if (log.isDebugEnabled()) {
+            log.debug("EventSource Undeployment of the sequence named : "
+                    + artifactName + " : Started");
+        }
+        
+        try {
+            SynapseEventSource es = getSynapseConfiguration().getEventSource(artifactName);
+            if (es != null) {
+                getSynapseConfiguration().removeEventSource(artifactName);
+                if (log.isDebugEnabled()) {
+                    log.debug("EventSource Undeployment of the EventSource named : "
+                            + artifactName + " : Completed");
+                }
+            } else {
+                log.error("Couldn't find the EventSource named : " + artifactName);
+            }
+        } catch (Exception e) {
+            log.error("EventSource Undeployement of EventSource named : "
+                    + artifactName + " : Failed");
+        }
+    }
+}

Added: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/LocalEntryDeployer.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/LocalEntryDeployer.java?rev=909234&view=auto
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/LocalEntryDeployer.java (added)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/LocalEntryDeployer.java Fri Feb 12 04:59:01 2010
@@ -0,0 +1,91 @@
+/*
+ *  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.synapse.deployers;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.config.Entry;
+import org.apache.synapse.config.xml.EntryFactory;
+
+/**
+ *  Handles the <code>LocalEntry</code> deployment and undeployment tasks
+ *
+ * @see org.apache.synapse.deployers.AbstractSynapseArtifactDeployer
+ */
+public class LocalEntryDeployer extends AbstractSynapseArtifactDeployer {
+
+    private static Log log = LogFactory.getLog(LocalEntryDeployer.class);
+
+    @Override
+    public String deploySynapseArtifact(OMElement artifactConfig, String fileName) {
+
+        if (log.isDebugEnabled()) {
+            log.debug("LocalEntry Deployment from file : " + fileName + " : Started");
+        }
+
+        try {
+            Entry e = EntryFactory.createEntry(artifactConfig);
+            if (e != null) {
+                e.setFileName(fileName);
+                if (log.isDebugEnabled()) {
+                    log.debug("LocalEntry with key '" + e.getKey()
+                            + "' has been built from the file " + fileName);
+                }
+                getSynapseConfiguration().addEntry(e.getKey(), e);
+                if (log.isDebugEnabled()) {
+                    log.debug("LocalEntry Deployment from file : " + fileName + " : Completed");
+                }
+                return e.getKey();
+            } else {
+                log.error("LocalEntry Deployment Failed. The artifact described in the file "
+                        + fileName + " is not a LocalEntry");
+            }
+        } catch (Exception e) {
+            log.error("LocalEntry Deployment from the file : " + fileName + " : Failed.", e);
+        }
+
+        return null;
+    }
+
+    @Override
+    public void undeploySynapseArtifact(String artifactName) {
+
+        if (log.isDebugEnabled()) {
+            log.debug("LocalEntry Undeployment of the entry named : "
+                    + artifactName + " : Started");
+        }
+        
+        try {
+            Entry e = getSynapseConfiguration().getDefinedEntries().get(artifactName);
+            if (e != null && e.getType() != Entry.REMOTE_ENTRY) {
+                getSynapseConfiguration().removeEntry(artifactName);
+                if (log.isDebugEnabled()) {
+                    log.debug("LocalEntry Undeployment of the entry named : "
+                            + artifactName + " : Completed");
+                }
+            } else {
+                log.error("Couldn't find the LocalEntry named : " + artifactName);
+            }
+        } catch (Exception e) {
+            log.error("LocalEntry Undeployement of entry named : " + artifactName + " : Failed");
+        }
+    }
+}

Added: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/ProxyServiceDeployer.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/ProxyServiceDeployer.java?rev=909234&view=auto
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/ProxyServiceDeployer.java (added)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/ProxyServiceDeployer.java Fri Feb 12 04:59:01 2010
@@ -0,0 +1,119 @@
+/*
+ *  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.synapse.deployers;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.ManagedLifecycle;
+import org.apache.synapse.config.xml.ProxyServiceFactory;
+import org.apache.synapse.core.axis2.ProxyService;
+
+/**
+ *  Handles the <code>ProxyService</code> deployment and undeployment tasks
+ *
+ * @see org.apache.synapse.deployers.AbstractSynapseArtifactDeployer
+ */
+public class ProxyServiceDeployer extends AbstractSynapseArtifactDeployer {
+
+    private static Log log = LogFactory.getLog(SequenceDeployer.class);
+
+    @Override
+    public String deploySynapseArtifact(OMElement artifactConfig, String fileName) {
+
+        if (log.isDebugEnabled()) {
+            log.debug("ProxyService Deployment from file : " + fileName + " : Started");
+        }
+
+        try {
+            ProxyService proxy = ProxyServiceFactory.createProxy(artifactConfig);
+            if (proxy != null) {
+                proxy.setFileName(fileName);
+                if (log.isDebugEnabled()) {
+                    log.debug("ProxyService named '" + proxy.getName()
+                            + "' has been built from the file " + fileName);
+                }
+
+                if (proxy.getTargetInLineEndpoint() instanceof ManagedLifecycle) {
+                    proxy.getTargetInLineEndpoint().init(getSynapseEnvironment());
+                }
+                if (proxy.getTargetInLineInSequence() != null) {
+                    proxy.getTargetInLineInSequence().init(getSynapseEnvironment());
+                }
+                if (proxy.getTargetInLineOutSequence() != null) {
+                    proxy.getTargetInLineOutSequence().init(getSynapseEnvironment());
+                }
+                if (proxy.getTargetInLineFaultSequence() != null) {
+                    proxy.getTargetInLineFaultSequence().init(getSynapseEnvironment());
+                }
+                
+                if (log.isDebugEnabled()) {
+                    log.debug("Initialized the ProxyService : " + proxy.getName());
+                }
+                
+                proxy.buildAxisService(getSynapseConfiguration(),
+                        getSynapseConfiguration().getAxisConfiguration());
+                if (log.isDebugEnabled()) {
+                    log.debug("Started the ProxyService : " + proxy.getName());
+                }
+                getSynapseConfiguration().addProxyService(proxy.getName(), proxy);
+                if (log.isDebugEnabled()) {
+                    log.debug("ProxyService Deployment from file : " + fileName + " : Completed");
+                }
+                return proxy.getName();
+            } else {
+                log.error("ProxyService Deployment Failed. The artifact described in the file "
+                        + fileName + " is not a ProxyService");
+            }
+        } catch (Exception e) {
+            log.error("ProxyService Deployment from the file : " + fileName + " : Failed.", e);
+        }
+
+        return null;
+    }
+
+    @Override
+    public void undeploySynapseArtifact(String artifactName) {
+
+        if (log.isDebugEnabled()) {
+            log.debug("ProxyService Undeployment of the proxy named : "
+                    + artifactName + " : Started");
+        }
+        
+        try {
+            ProxyService proxy = getSynapseConfiguration().getProxyService(artifactName);
+            if (proxy != null) {
+                if (log.isDebugEnabled()) {
+                    log.debug("Stopping the ProxyService named : " + artifactName);
+                }
+                proxy.stop(getSynapseConfiguration());
+                getSynapseConfiguration().removeProxyService(artifactName);
+                if (log.isDebugEnabled()) {
+                    log.debug("ProxyService Undeployment of the proxy named : "
+                            + artifactName + " : Completed");
+                }
+            } else {
+                log.error("Couldn't find the ProxyService named : " + artifactName);
+            }
+        } catch (Exception e) {
+            log.error("ProxyService Undeployement of proxy named : " + artifactName + " : Failed");
+        }
+    }
+}

Added: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/SequenceDeployer.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/SequenceDeployer.java?rev=909234&view=auto
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/SequenceDeployer.java (added)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/SequenceDeployer.java Fri Feb 12 04:59:01 2010
@@ -0,0 +1,102 @@
+/*
+ *  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.synapse.deployers;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.Mediator;
+import org.apache.synapse.config.xml.MediatorFactoryFinder;
+import org.apache.synapse.mediators.base.SequenceMediator;
+
+/**
+ *  Handles the <code>Sequence</code> deployment and undeployment tasks
+ *
+ * @see org.apache.synapse.deployers.AbstractSynapseArtifactDeployer
+ */
+public class SequenceDeployer extends AbstractSynapseArtifactDeployer {
+
+    private static Log log = LogFactory.getLog(SequenceDeployer.class);
+    
+    @Override
+    public String deploySynapseArtifact(OMElement artifactConfig, String fileName) {
+
+        if (log.isDebugEnabled()) {
+            log.debug("Sequence Deployment from file : " + fileName + " : Started");
+        }
+
+        try {    
+            Mediator m = MediatorFactoryFinder.getInstance().getMediator(artifactConfig);
+            if (m instanceof SequenceMediator) {
+                SequenceMediator seq = (SequenceMediator) m;
+                seq.setFileName(fileName);
+                if (log.isDebugEnabled()) {
+                    log.debug("Sequence named '" + seq.getName()
+                            + "' has been built from the file " + fileName);
+                }
+                seq.init(getSynapseEnvironment());
+                if (log.isDebugEnabled()) {
+                    log.debug("Initialized the sequence : " + seq.getName());
+                }
+                getSynapseConfiguration().addSequence(seq.getName(), seq);
+                if (log.isDebugEnabled()) {
+                    log.debug("Sequence Deployment from file : " + fileName + " : Completed");
+                }
+                return seq.getName();
+            } else {
+                log.error("Sequence Deployment Failed. The artifact described in the file "
+                        + fileName + " is not a Sequence");
+            }
+        } catch (Exception e) {
+            log.error("Sequence Deployment from the file : " + fileName + " : Failed.", e);
+        }
+
+        return null;
+    }
+
+    @Override
+    public void undeploySynapseArtifact(String artifactName) {
+
+        if (log.isDebugEnabled()) {
+            log.debug("Sequence Undeployment of the sequence named : "
+                    + artifactName + " : Started");
+        }
+        
+        try {
+            SequenceMediator seq
+                    = getSynapseConfiguration().getDefinedSequences().get(artifactName);
+            if (seq != null) {
+                getSynapseConfiguration().removeSequence(artifactName);
+                if (log.isDebugEnabled()) {
+                    log.debug("Destroying the sequence named : " + artifactName);
+                }
+                seq.destroy();
+                if (log.isDebugEnabled()) {
+                    log.debug("Sequence Undeployment of the sequence named : "
+                            + artifactName + " : Completed");
+                }
+            } else {
+                log.error("Couldn't find the sequence named : " + artifactName);
+            }
+        } catch (Exception e) {
+            log.error("Sequence Undeployement of sequence named : " + artifactName + " : Failed");
+        }
+    }
+}

Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/Endpoint.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/Endpoint.java?rev=909234&r1=909233&r2=909234&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/Endpoint.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/Endpoint.java Fri Feb 12 04:59:01 2010
@@ -111,4 +111,16 @@
      * @return EndpointView instance
      */
     public EndpointView getMetricsMBean();
+
+    /**
+     * Get the filename from which this endpoint is loaded, <code>null</code> if it is an anonymous endpoint
+     * @return String file name
+     */
+    public String getFileName();
+
+    /**
+     * Set the filename from which the endpoint is loaded
+     * @param fileName from which the endpoint is loaded
+     */
+    public void setFileName(String fileName);
 }

Modified: synapse/trunk/java/modules/transports/core/nhttp/pom.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/core/nhttp/pom.xml?rev=909234&r1=909233&r2=909234&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/core/nhttp/pom.xml (original)
+++ synapse/trunk/java/modules/transports/core/nhttp/pom.xml Fri Feb 12 04:59:01 2010
@@ -152,4 +152,4 @@
         <httpcore.nio.version>4.1-alpha1</httpcore.nio.version>
     </properties>
 
-</project>
\ No newline at end of file
+</project>