Author: supun
Date: Mon Sep 20 07:57:27 2010
New Revision: 998821

URL: http://svn.apache.org/viewvc?rev=998821&view=rev
Log:
making SynapseArtifactDeploymentStore part of synapse configuration

Modified:
    
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java
    
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MultiXMLConfigurationBuilder.java
    
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MultiXMLConfigurationSerializer.java
    
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/ExtensionDeployer.java
    
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/SynapseArtifactDeploymentStore.java

Modified: 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java
URL: 
http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java?rev=998821&r1=998820&r2=998821&view=diff
==============================================================================
--- 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java
 (original)
+++ 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java
 Mon Sep 20 07:57:27 2010
@@ -24,6 +24,7 @@ import org.apache.axis2.engine.AxisConfi
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.synapse.*;
+import org.apache.synapse.deployers.SynapseArtifactDeploymentStore;
 import org.apache.synapse.commons.datasource.DataSourceRepositoryHolder;
 import org.apache.synapse.eventing.SynapseEventSource;
 import org.apache.synapse.commons.executors.PriorityExecutor;
@@ -128,6 +129,11 @@ public class SynapseConfiguration implem
     private String description = null;
 
     /**
+     * The artifact deployment store to keep track of the items deployed
+     */
+    SynapseArtifactDeploymentStore artifactDeploymentStore = new 
SynapseArtifactDeploymentStore();
+
+    /**
      * Add a named sequence into the local registry. If a sequence already 
exists by the specified
      * key a runtime exception is thrown.
      *
@@ -1192,6 +1198,16 @@ public class SynapseConfiguration implem
         return description;
     }
 
+    /**
+     * Get the SynapseArtifactDeploymentStore which is used to store the 
information about
+     * the deployed artifacts
+     *
+     * @return the SynapseArtifactDeploymentStore for this configuration
+     */
+    public SynapseArtifactDeploymentStore getArtifactDeploymentStore() {
+        return artifactDeploymentStore;
+    }
+
     private void assertAlreadyExists(String key, String type) {
 
         if (key == null || "".equals(key)) {

Modified: 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MultiXMLConfigurationBuilder.java
URL: 
http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MultiXMLConfigurationBuilder.java?rev=998821&r1=998820&r2=998821&view=diff
==============================================================================
--- 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MultiXMLConfigurationBuilder.java
 (original)
+++ 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MultiXMLConfigurationBuilder.java
 Mon Sep 20 07:57:27 2010
@@ -31,7 +31,6 @@ import org.apache.synapse.config.Entry;
 import org.apache.synapse.config.SynapseConfigUtils;
 import org.apache.synapse.config.SynapseConfiguration;
 import org.apache.synapse.core.axis2.ProxyService;
-import org.apache.synapse.deployers.SynapseArtifactDeploymentStore;
 import org.apache.synapse.endpoints.Endpoint;
 import org.apache.synapse.eventing.SynapseEventSource;
 import org.apache.synapse.mediators.base.SequenceMediator;
@@ -169,7 +168,7 @@ public class MultiXMLConfigurationBuilde
                     Entry entry = SynapseXMLConfigurationFactory.defineEntry(
                             synapseConfig, document);
                     entry.setFileName(file.getName());
-                    SynapseArtifactDeploymentStore.getInstance().addArtifact(
+                    synapseConfig.getArtifactDeploymentStore().addArtifact(
                             file.getAbsolutePath(), entry.getKey());
                 } catch (FileNotFoundException ignored) {}
             }
@@ -191,7 +190,7 @@ public class MultiXMLConfigurationBuilde
                     ProxyService proxy = 
SynapseXMLConfigurationFactory.defineProxy(
                             synapseConfig, document);
                     proxy.setFileName(file.getName());
-                    SynapseArtifactDeploymentStore.getInstance().addArtifact(
+                    synapseConfig.getArtifactDeploymentStore().addArtifact(
                             file.getAbsolutePath(), proxy.getName());
                 } catch (FileNotFoundException ignored) {}
             }
@@ -213,7 +212,7 @@ public class MultiXMLConfigurationBuilde
                     Startup startup = 
SynapseXMLConfigurationFactory.defineStartup(
                             synapseConfig, document);
                     startup.setFileName(file.getName());
-                    SynapseArtifactDeploymentStore.getInstance().addArtifact(
+                    synapseConfig.getArtifactDeploymentStore().addArtifact(
                             file.getAbsolutePath(), startup.getName());
                 } catch (FileNotFoundException ignored) {}
             }
@@ -237,7 +236,7 @@ public class MultiXMLConfigurationBuilde
                     if (seq instanceof SequenceMediator) {
                         SequenceMediator sequence = (SequenceMediator) seq;
                         sequence.setFileName(file.getName());
-                        
SynapseArtifactDeploymentStore.getInstance().addArtifact(
+                        synapseConfig.getArtifactDeploymentStore().addArtifact(
                                 file.getAbsolutePath(), sequence.getName());
                     }
                 } catch (FileNotFoundException ignored) {}
@@ -260,7 +259,7 @@ public class MultiXMLConfigurationBuilde
                     Endpoint endpoint = 
SynapseXMLConfigurationFactory.defineEndpoint(
                             synapseConfig, document);
                     endpoint.setFileName(file.getName());
-                    SynapseArtifactDeploymentStore.getInstance().addArtifact(
+                    synapseConfig.getArtifactDeploymentStore().addArtifact(
                             file.getAbsolutePath(), endpoint.getName());
                 } catch (FileNotFoundException ignored) {}
             }
@@ -282,7 +281,7 @@ public class MultiXMLConfigurationBuilde
                     SynapseEventSource eventSource = 
SynapseXMLConfigurationFactory.
                             defineEventSource(synapseConfig, document);
                     eventSource.setFileName(file.getName());
-                    SynapseArtifactDeploymentStore.getInstance().addArtifact(
+                    synapseConfig.getArtifactDeploymentStore().addArtifact(
                             file.getAbsolutePath(), eventSource.getName());
                 } catch (FileNotFoundException ignored) {}
            }
@@ -304,7 +303,7 @@ public class MultiXMLConfigurationBuilde
                     PriorityExecutor executor = SynapseXMLConfigurationFactory.
                             defineExecutor(synapseConfig, document);
                     executor.setFileName(file.getName());
-                    SynapseArtifactDeploymentStore.getInstance().addArtifact(
+                    synapseConfig.getArtifactDeploymentStore().addArtifact(
                             file.getAbsolutePath(), executor.getName());
                 } catch (FileNotFoundException ignored) {}
            }

Modified: 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MultiXMLConfigurationSerializer.java
URL: 
http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MultiXMLConfigurationSerializer.java?rev=998821&r1=998820&r2=998821&view=diff
==============================================================================
--- 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MultiXMLConfigurationSerializer.java
 (original)
+++ 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MultiXMLConfigurationSerializer.java
 Mon Sep 20 07:57:27 2010
@@ -59,12 +59,12 @@ public class MultiXMLConfigurationSerial
     private File rootDirectory;
     private File currentDirectory;
 
-    private SynapseArtifactDeploymentStore deploymentStore;
+    //private SynapseArtifactDeploymentStore deploymentStore;
 
     public MultiXMLConfigurationSerializer(String directoryPath) {
         rootDirectory = new File(directoryPath);
         currentDirectory = rootDirectory;
-        deploymentStore = SynapseArtifactDeploymentStore.getInstance();
+        //deploymentStore = SynapseArtifactDeploymentStore.getInstance();
     }
 
     /**
@@ -93,14 +93,15 @@ public class MultiXMLConfigurationSerial
                 serializeSynapseRegistry(synapseConfig.getRegistry(), 
synapseConfig, definitions);
             }
 
-            serializeProxyServices(synapseConfig.getProxyServices(), 
definitions);
-            serializeEventSources(synapseConfig.getEventSources(), 
definitions);
-            serializeTasks(synapseConfig.getStartups(), definitions);
-            
serializeLocalRegistryValues(synapseConfig.getLocalRegistry().values(), 
definitions);
+            serializeProxyServices(synapseConfig.getProxyServices(), 
synapseConfig, definitions);
+            serializeEventSources(synapseConfig.getEventSources(), 
synapseConfig, definitions);
+            serializeTasks(synapseConfig.getStartups(), synapseConfig, 
definitions);
+            
serializeLocalRegistryValues(synapseConfig.getLocalRegistry().values(),
+                    synapseConfig, definitions);
             serializeExecutors(synapseConfig.getPriorityExecutors().values(), 
definitions);
             serializeSynapseXML(definitions);
 
-            markConfigurationForSerialization();
+            
markConfigurationForSerialization(synapseConfig.getArtifactDeploymentStore());
             if (rootDirectory.exists()) {
                 if (log.isDebugEnabled()) {
                     log.debug("Deleting existing files at : " + 
rootDirectory.getAbsolutePath());
@@ -220,7 +221,8 @@ public class MultiXMLConfigurationSerial
         return registryElem;
     }
 
-    public OMElement serializeProxy(ProxyService service, OMElement parent) 
throws Exception {
+    public OMElement serializeProxy(ProxyService service, SynapseConfiguration 
synapseConfig,
+                                    OMElement parent) throws Exception {
 
         File proxyDir = createDirectory(currentDirectory,
                 MultiXMLConfigurationBuilder.PROXY_SERVICES_DIR);
@@ -228,7 +230,8 @@ public class MultiXMLConfigurationSerial
 
         String fileName = service.getFileName();
         if (fileName != null) {
-            handleDeployment(proxyDir, fileName, service.getName());
+            handleDeployment(proxyDir, fileName, service.getName(),
+                    synapseConfig.getArtifactDeploymentStore());
             File proxyFile = new File(proxyDir, fileName);
             writeToFile(proxyElem, proxyFile);
         } else if (parent != null) {
@@ -239,6 +242,7 @@ public class MultiXMLConfigurationSerial
     }
 
     public OMElement serializeEventSource(SynapseEventSource source,
+                                          SynapseConfiguration synapseConfig,
                                           OMElement parent) throws Exception {
 
         File eventsDir = createDirectory(currentDirectory, 
MultiXMLConfigurationBuilder.EVENTS_DIR);
@@ -246,7 +250,8 @@ public class MultiXMLConfigurationSerial
 
         String fileName = source.getFileName();
         if (fileName != null) {
-            handleDeployment(eventsDir, fileName, source.getName());
+            handleDeployment(eventsDir, fileName, source.getName(),
+                    synapseConfig.getArtifactDeploymentStore());
             File eventSrcFile = new File(eventsDir, source.getFileName());
             writeToFile(eventSrcElem, eventSrcFile);
         } else if (parent != null) {
@@ -256,14 +261,16 @@ public class MultiXMLConfigurationSerial
         return eventSrcElem;
     }
 
-    public OMElement serializeTask(Startup task, OMElement parent) throws 
Exception {
+    public OMElement serializeTask(Startup task, SynapseConfiguration 
synapseConfig,
+                                   OMElement parent) throws Exception {
 
         File tasksDir = createDirectory(currentDirectory, 
MultiXMLConfigurationBuilder.TASKS_DIR);
         OMElement taskElem = 
StartupFinder.getInstance().serializeStartup(null, task);
 
         if (task.getFileName() != null) {
             String fileName = task.getFileName();
-            handleDeployment(tasksDir, fileName, task.getName());
+            handleDeployment(tasksDir, fileName, task.getName(),
+                    synapseConfig.getArtifactDeploymentStore());
             File taskFile = new File(tasksDir, fileName);
             writeToFile(taskElem, taskFile);
         } else if (parent != null) {
@@ -273,7 +280,8 @@ public class MultiXMLConfigurationSerial
         return taskElem;
     }
 
-    public OMElement serializeSequence(SequenceMediator seq, OMElement parent) 
throws Exception {
+    public OMElement serializeSequence(SequenceMediator seq, 
SynapseConfiguration synapseConfig,
+                                       OMElement parent) throws Exception {
 
         File seqDir = createDirectory(currentDirectory, 
MultiXMLConfigurationBuilder.SEQUENCES_DIR);
 
@@ -281,7 +289,8 @@ public class MultiXMLConfigurationSerial
                 serializeMediator(null, seq);
         String fileName = seq.getFileName();
         if (fileName != null) {
-            handleDeployment(seqDir, fileName, seq.getName());
+            handleDeployment(seqDir, fileName, seq.getName(),
+                    synapseConfig.getArtifactDeploymentStore());
             File seqFile = new File(seqDir, fileName);
             writeToFile(seqElem, seqFile);
         } else if (parent != null) {
@@ -291,14 +300,16 @@ public class MultiXMLConfigurationSerial
         return seqElem;
     }
 
-    public OMElement serializeEndpoint(Endpoint epr, OMElement parent) throws 
Exception {
+    public OMElement serializeEndpoint(Endpoint epr, SynapseConfiguration 
synapseConfig,
+                                       OMElement parent) throws Exception {
 
         File eprDir = createDirectory(currentDirectory, 
MultiXMLConfigurationBuilder.ENDPOINTS_DIR);
         OMElement eprElem = EndpointSerializer.getElementFromEndpoint(epr);
 
         String fileName = epr.getFileName();
         if (fileName != null) {
-            handleDeployment(eprDir, fileName, epr.getName());
+            handleDeployment(eprDir, fileName, epr.getName(),
+                    synapseConfig.getArtifactDeploymentStore());
             File eprFile = new File(eprDir, fileName);
             writeToFile(eprElem, eprFile);
         } else if (parent != null) {
@@ -308,11 +319,12 @@ public class MultiXMLConfigurationSerial
         return eprElem;
     }
 
-    public OMElement serializeLocalEntry(Object o, OMElement parent) throws 
Exception {
+    public OMElement serializeLocalEntry(Object o, SynapseConfiguration 
synapseConfig,
+                                         OMElement parent) throws Exception {
         if (o instanceof SequenceMediator) {
-            return serializeSequence((SequenceMediator) o, parent);
+            return serializeSequence((SequenceMediator) o, synapseConfig, 
parent);
         } else if (o instanceof Endpoint) {
-            return serializeEndpoint((Endpoint) o, parent);
+            return serializeEndpoint((Endpoint) o, synapseConfig, parent);
         } else if (o instanceof Entry) {
             Entry entry = (Entry) o;
             if ((SynapseConstants.SERVER_HOST.equals(entry.getKey())
@@ -327,7 +339,8 @@ public class MultiXMLConfigurationSerial
 
             String fileName = entry.getFileName();
             if (fileName != null) {
-                handleDeployment(entriesDir, fileName, entry.getKey());
+                handleDeployment(entriesDir, fileName, entry.getKey(),
+                        synapseConfig.getArtifactDeploymentStore());
                 File entryFile  = new File(entriesDir, fileName);
                 writeToFile(entryElem, entryFile);
             } else if (parent != null) {
@@ -367,7 +380,8 @@ public class MultiXMLConfigurationSerial
         FileUtils.deleteQuietly(tempFile);
     }
 
-    private void handleDeployment(File parent, String child, String 
artifactName) {
+    private void handleDeployment(File parent, String child, String 
artifactName,
+                                  SynapseArtifactDeploymentStore 
deploymentStore) {
         String fileName = parent.getAbsolutePath() + File.separator + child;
         if (!deploymentStore.containsFileName(fileName)) {
             deploymentStore.addArtifact(fileName, artifactName);
@@ -375,30 +389,36 @@ public class MultiXMLConfigurationSerial
         deploymentStore.addRestoredArtifact(fileName);
     }
 
-    private void serializeProxyServices(Collection<ProxyService> 
proxyServices, OMElement parent)
+    private void serializeProxyServices(Collection<ProxyService> proxyServices,
+                                        SynapseConfiguration synapseConfig, 
OMElement parent)
             throws Exception {
         for (ProxyService service : proxyServices) {
-            serializeProxy(service, parent);
+            serializeProxy(service, synapseConfig, parent);
         }
     }
 
-    private void serializeLocalRegistryValues(Collection localValues, 
OMElement parent)
+    private void serializeLocalRegistryValues(Collection localValues,
+                                              SynapseConfiguration 
synapseConfig,
+                                              OMElement parent)
             throws Exception {
         for (Object o : localValues) {
-            serializeLocalEntry(o, parent);
+            serializeLocalEntry(o, synapseConfig, parent);
         }
     }
 
-    private void serializeTasks(Collection<Startup> tasks, OMElement parent) 
throws Exception {
+    private void serializeTasks(Collection<Startup> tasks,
+                                SynapseConfiguration synapseConfig,
+                                OMElement parent) throws Exception {
         for (Startup task : tasks) {
-            serializeTask(task, parent);
+            serializeTask(task, synapseConfig, parent);
         }
     }
 
     private void serializeEventSources(Collection<SynapseEventSource> 
eventSources,
+                                       SynapseConfiguration synapseConfig,
                                        OMElement parent) throws Exception {
         for (SynapseEventSource source : eventSources) {
-            serializeEventSource(source, parent);
+            serializeEventSource(source, synapseConfig, parent);
         }
     }
 
@@ -460,8 +480,9 @@ public class MultiXMLConfigurationSerial
     /**
      * Get the existing configuration and mark those files not effect on 
deployers for
      * deletion
+     * @param deploymentStore store to store the artifacts deployed
      */
-    private void markConfigurationForSerialization() {
+    private void 
markConfigurationForSerialization(SynapseArtifactDeploymentStore 
deploymentStore) {
         SynapseConfiguration synCfg;
         ServerManager serverManager = ServerManager.getInstance();
 
@@ -477,49 +498,50 @@ public class MultiXMLConfigurationSerial
         for (SequenceMediator seq : synCfg.getDefinedSequences().values()) {
             if (seq.getFileName() != null) {
                 handleDeployment(new File(rootDirectory, 
MultiXMLConfigurationBuilder.
-                        SEQUENCES_DIR), seq.getFileName(), seq.getName());
+                        SEQUENCES_DIR), seq.getFileName(), seq.getName(), 
deploymentStore);
             }
         }
 
         for (Endpoint ep : synCfg.getDefinedEndpoints().values()) {
             if (ep.getFileName() != null) {
                 handleDeployment(new File(rootDirectory, 
MultiXMLConfigurationBuilder.
-                        ENDPOINTS_DIR), ep.getFileName(), ep.getName());
+                        ENDPOINTS_DIR), ep.getFileName(), ep.getName(), 
deploymentStore);
             }
         }
 
         for (ProxyService proxy : synCfg.getProxyServices()) {
             if (proxy.getFileName() != null) {
                 handleDeployment(new File(rootDirectory, 
MultiXMLConfigurationBuilder.
-                        PROXY_SERVICES_DIR), proxy.getFileName(), 
proxy.getName());
+                        PROXY_SERVICES_DIR), proxy.getFileName(), 
proxy.getName(), deploymentStore);
             }
         }
 
         for (Entry e : synCfg.getDefinedEntries().values()) {
             if (e.getFileName() != null) {
                 handleDeployment(new File(rootDirectory, 
MultiXMLConfigurationBuilder.
-                        LOCAL_ENTRY_DIR), File.separator +e.getFileName(), 
e.getKey());
+                        LOCAL_ENTRY_DIR), File.separator +e.getFileName(), 
e.getKey(),
+                        deploymentStore);
             }
         }
 
         for (SynapseEventSource es : synCfg.getEventSources()) {
             if (es.getFileName() != null) {
                 handleDeployment(new File(rootDirectory, 
MultiXMLConfigurationBuilder.
-                        EVENTS_DIR), es.getFileName(), es.getName());
+                        EVENTS_DIR), es.getFileName(), es.getName(), 
deploymentStore);
             }
         }
 
         for (Startup s : synCfg.getStartups()) {
             if (s.getFileName() != null) {
                 handleDeployment(new File(rootDirectory, 
MultiXMLConfigurationBuilder.
-                        TASKS_DIR), s.getFileName(), s.getName());
+                        TASKS_DIR), s.getFileName(), s.getName(), 
deploymentStore);
             }
         }
 
         for (PriorityExecutor exec : synCfg.getPriorityExecutors().values()) {
             if (exec.getFileName() != null) {
                 handleDeployment(new File(rootDirectory, 
MultiXMLConfigurationBuilder.
-                        EXECUTORS_DIR), exec.getFileName(), exec.getName());
+                        EXECUTORS_DIR), exec.getFileName(), exec.getName(), 
deploymentStore);
             }
         }
     }

Modified: 
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=998821&r1=998820&r2=998821&view=diff
==============================================================================
--- 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/AbstractSynapseArtifactDeployer.java
 (original)
+++ 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/AbstractSynapseArtifactDeployer.java
 Mon Sep 20 07:57:27 2010
@@ -61,11 +61,9 @@ public abstract class AbstractSynapseArt
     private static final Log log = 
LogFactory.getLog(AbstractSynapseArtifactDeployer.class);
     protected  Log deployerLog;
     protected ConfigurationContext cfgCtx;
-    private SynapseArtifactDeploymentStore deploymentStore;
 
     protected AbstractSynapseArtifactDeployer() {
         deployerLog = LogFactory.getLog(this.getClass());
-        deploymentStore = SynapseArtifactDeploymentStore.getInstance();
     }
 
     /**
@@ -105,6 +103,9 @@ public abstract class AbstractSynapseArt
             return;
         }
 
+        SynapseArtifactDeploymentStore deploymentStore =
+                getSynapseConfiguration().getArtifactDeploymentStore();
+
         // check whether this is triggered by a restore, if it is a restore we 
do not want to deploy it again
         if (deploymentStore.isRestoredFile(filename)) {
             if (log.isDebugEnabled()) {
@@ -195,6 +196,9 @@ public abstract class AbstractSynapseArt
             log.debug("UnDeployment of the synapse artifact from file : " + 
fileName + " : STARTED");
         }
 
+        SynapseArtifactDeploymentStore deploymentStore =
+                getSynapseConfiguration().getArtifactDeploymentStore();
+
         // We want to eliminate the undeployment when we are backing up these 
files
         if (deploymentStore.isBackedUpArtifact(fileName)) {
 
@@ -280,7 +284,7 @@ public abstract class AbstractSynapseArt
      *
      * @param artifactName name of the artifact to be undeployed
      *
-     * @see 
org.apache.synapse.deployers.AbstractSynapseArtifactDeployer#unDeploy(String) 
+     * @see 
org.apache.synapse.deployers.AbstractSynapseArtifactDeployer#undeploy(String)  
      */
     public abstract void undeploySynapseArtifact(String artifactName);
 
@@ -314,6 +318,8 @@ public abstract class AbstractSynapseArt
 
     protected void writeToFile(OMElement content, String fileName) throws 
Exception {
         // this is not good, but I couldn't think of a better design :-(
+        SynapseArtifactDeploymentStore deploymentStore =
+                getSynapseConfiguration().getArtifactDeploymentStore();
         deploymentStore.addRestoredArtifact(fileName);
         OutputStream out = new FileOutputStream(new File(fileName));
         XMLPrettyPrinter.prettify(content, out);
@@ -331,9 +337,11 @@ public abstract class AbstractSynapseArt
         throw new SynapseArtifactDeploymentException(msg, e);
     }
 
-    private void handleDeploymentError(String msg, Exception e, String 
fileName) {
+    private void handleDeploymentError(String msg, Exception e, String 
fileName) throws DeploymentException {
         fileName = FilenameUtils.normalize(fileName);
         log.error(msg, e);
+        SynapseArtifactDeploymentStore deploymentStore =
+                getSynapseConfiguration().getArtifactDeploymentStore();
         if (deploymentStore.isUpdatingArtifact(fileName)) {
             backupFile(new File(fileName));
             log.info("Restoring the existing artifact into the file : " + 
fileName);
@@ -344,8 +352,12 @@ public abstract class AbstractSynapseArt
         }
     }
 
-    private String backupFile(File file) {
+    private String backupFile(File file) throws DeploymentException {
         String filePath = FilenameUtils.normalize(file.getAbsolutePath());
+
+        SynapseArtifactDeploymentStore deploymentStore =
+                getSynapseConfiguration().getArtifactDeploymentStore();
+
         deploymentStore.addBackedUpArtifact(filePath);
         String backupFilePath = filePath + ".back";
         int backupIndex = 0;

Modified: 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/ExtensionDeployer.java
URL: 
http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/ExtensionDeployer.java?rev=998821&r1=998820&r2=998821&view=diff
==============================================================================
--- 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/ExtensionDeployer.java
 (original)
+++ 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/ExtensionDeployer.java
 Mon Sep 20 07:57:27 2010
@@ -33,7 +33,6 @@ import javax.xml.namespace.QName;
 import org.apache.axis2.Constants;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.deployment.AbstractDeployer;
-import org.apache.axis2.deployment.Deployer;
 import org.apache.axis2.deployment.DeploymentClassLoader;
 import org.apache.axis2.deployment.DeploymentException;
 import org.apache.axis2.deployment.repository.util.DeploymentFileData;

Modified: 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/SynapseArtifactDeploymentStore.java
URL: 
http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/SynapseArtifactDeploymentStore.java?rev=998821&r1=998820&r2=998821&view=diff
==============================================================================
--- 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/SynapseArtifactDeploymentStore.java
 (original)
+++ 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/SynapseArtifactDeploymentStore.java
 Mon Sep 20 07:57:27 2010
@@ -41,6 +41,7 @@ import java.util.Map;
  * @see org.apache.synapse.config.xml.MultiXMLConfigurationBuilder
  */
 public final class SynapseArtifactDeploymentStore {
+    public static final String SYNAPSE_ARTIFACT_DEPLOYMENT_STORE = 
"SYNAPSE_ARTIFACT_DEPLOYMENT_STORE"; 
 
     /** Keeps track of the deployed artifacts in the synapse environment */
     private static Map<String, String> fileName2ArtifactName = new 
HashMap<String, String>();
@@ -53,24 +54,8 @@ public final class SynapseArtifactDeploy
 
     /** Keeps track of the backed up artifacts in the synapse environment in a 
particular instance */
     private List<String> backedUpFiles = new ArrayList<String>();
-
-    private static SynapseArtifactDeploymentStore _instance;
+   
     private static final Log log = 
LogFactory.getLog(SynapseArtifactDeploymentStore.class);
-    private SynapseArtifactDeploymentStore() {}
-
-    /**
-     * Provides the <code>singleton</code> instance of
-     * {...@link SynapseArtifactDeploymentStore}
-     *
-     * @return the singleton instance of SynapseArtifactDeploymentStore
-     */
-    public static SynapseArtifactDeploymentStore getInstance() {
-        
-        if (_instance == null) {
-            _instance = new SynapseArtifactDeploymentStore();
-        }
-        return _instance;
-    }
 
     /**
      * Adds artifacts indexed with the respective filename


Reply via email to