Repository: stratos
Updated Branches:
  refs/heads/master 8640bfae4 -> 790437ee7


Moving load balancer classes to proper packages


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/790437ee
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/790437ee
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/790437ee

Branch: refs/heads/master
Commit: 790437ee74f8bfd99aeefe80bdf921947462e3a6
Parents: 8640bfa
Author: Imesh Gunaratne <[email protected]>
Authored: Thu Nov 27 14:38:08 2014 +0530
Committer: Imesh Gunaratne <[email protected]>
Committed: Thu Nov 27 14:38:08 2014 +0530

----------------------------------------------------------------------
 .../stratos/load/balancer/ClusterContext.java   | 63 ----------------
 .../stratos/load/balancer/EndpointDeployer.java | 79 --------------------
 .../stratos/load/balancer/RequestDelegator.java |  1 +
 .../stratos/load/balancer/ServiceContext.java   | 56 --------------
 ...TenantAwareLoadBalanceEndpointException.java | 39 ----------
 .../load/balancer/context/ClusterContext.java   | 63 ++++++++++++++++
 .../balancer/context/LoadBalancerContext.java   |  2 +-
 .../load/balancer/context/ServiceContext.java   | 58 ++++++++++++++
 .../context/map/ClusterIdClusterContextMap.java |  2 +-
 .../map/ServiceNameServiceContextMap.java       |  2 +-
 .../balancer/endpoint/EndpointDeployer.java     | 79 ++++++++++++++++++++
 ...TenantAwareLoadBalanceEndpointException.java | 39 ++++++++++
 .../internal/LoadBalancerServiceComponent.java  |  4 +-
 13 files changed, 245 insertions(+), 242 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/790437ee/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/ClusterContext.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/ClusterContext.java
 
b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/ClusterContext.java
deleted file mode 100644
index 2cb6d6e..0000000
--- 
a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/ClusterContext.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.stratos.load.balancer;
-
-import org.apache.stratos.load.balancer.context.AlgorithmContext;
-
-import java.util.Properties;
-
-/**
- * Defines cluster context properties.
- */
-public class ClusterContext {
-    private String serviceName;
-    private String clusterId;
-    private AlgorithmContext algorithmContext;
-    private Properties properties;
-
-    public ClusterContext(String serviceName, String clusterId) {
-        this.serviceName = serviceName;
-        this.clusterId = clusterId;
-    }
-
-    public String getServiceName() {
-        return serviceName;
-    }
-
-    public String getClusterId() {
-        return clusterId;
-    }
-
-    public AlgorithmContext getAlgorithmContext() {
-        return algorithmContext;
-    }
-
-    public void setAlgorithmContext(AlgorithmContext algorithmContext) {
-        this.algorithmContext = algorithmContext;
-    }
-
-    public Properties getProperties() {
-        return properties;
-    }
-
-    public void setProperties(Properties properties) {
-        this.properties = properties;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/790437ee/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/EndpointDeployer.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/EndpointDeployer.java
 
b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/EndpointDeployer.java
deleted file mode 100644
index ba19311..0000000
--- 
a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/EndpointDeployer.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.stratos.load.balancer;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.context.ConfigurationContext;
-import org.wso2.carbon.mediation.initializer.ServiceBusConstants;
-import org.wso2.carbon.mediation.initializer.ServiceBusUtils;
-import 
org.wso2.carbon.mediation.initializer.persistence.MediationPersistenceManager;
-
-import java.util.Properties;
-
-/**
- * Responsible for deploying Synapse artifacts.
- */
-public class EndpointDeployer extends 
org.apache.synapse.deployers.EndpointDeployer {
-
-    MediationPersistenceManager mpm;
-
-    @Override
-    public void init(ConfigurationContext configCtx) {
-        super.init(configCtx);
-        this.mpm = 
ServiceBusUtils.getMediationPersistenceManager(configCtx.getAxisConfiguration());
-    }
-
-    @Override
-    public String deploySynapseArtifact(OMElement artifactConfig, String 
fileName,
-                                        Properties properties) {
-        String epName = super.deploySynapseArtifact(artifactConfig, fileName, 
properties);
-        if (mpm != null) {
-            mpm.saveItemToRegistry(epName, 
ServiceBusConstants.ITEM_TYPE_ENDPOINT);
-        }
-        return epName;
-    }
-
-    @Override
-    public String updateSynapseArtifact(OMElement artifactConfig, String 
fileName,
-                                        String existingArtifactName, 
Properties properties) {
-        String epName = super.updateSynapseArtifact(
-                artifactConfig, fileName, existingArtifactName, properties);
-        if (mpm != null) {
-            mpm.saveItemToRegistry(epName, 
ServiceBusConstants.ITEM_TYPE_ENDPOINT);
-        }
-        return epName;
-    }
-
-    @Override
-    public void undeploySynapseArtifact(String artifactName) {
-        super.undeploySynapseArtifact(artifactName);
-        if (mpm != null) {
-            mpm.deleteItemFromRegistry(artifactName, 
ServiceBusConstants.ITEM_TYPE_ENDPOINT);
-        }
-    }
-
-    @Override
-    public void restoreSynapseArtifact(String artifactName) {
-        super.restoreSynapseArtifact(artifactName);
-        if (mpm != null) {
-            mpm.saveItemToRegistry(artifactName, 
ServiceBusConstants.ITEM_TYPE_ENDPOINT);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/790437ee/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/RequestDelegator.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/RequestDelegator.java
 
b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/RequestDelegator.java
index d8cb197..46de2cc 100644
--- 
a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/RequestDelegator.java
+++ 
b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/RequestDelegator.java
@@ -24,6 +24,7 @@ import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.load.balancer.context.AlgorithmContext;
 import org.apache.stratos.load.balancer.algorithm.LoadBalanceAlgorithm;
 import org.apache.stratos.load.balancer.conf.LoadBalancerConfiguration;
+import org.apache.stratos.load.balancer.context.ClusterContext;
 import org.apache.stratos.load.balancer.context.LoadBalancerContext;
 import org.apache.stratos.messaging.domain.topology.Cluster;
 import org.apache.stratos.messaging.domain.topology.Member;

http://git-wip-us.apache.org/repos/asf/stratos/blob/790437ee/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/ServiceContext.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/ServiceContext.java
 
b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/ServiceContext.java
deleted file mode 100644
index 58d461a..0000000
--- 
a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/ServiceContext.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.stratos.load.balancer;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Defines service context properties.
- */
-public class ServiceContext {
-    private String serviceName;
-    private Map<String, ClusterContext> clusterContextMap;
-
-    public ServiceContext() {
-        clusterContextMap = new HashMap<String, ClusterContext>();
-    }
-
-    public String getServiceName() {
-        return serviceName;
-    }
-
-    public void setServiceName(String serviceName) {
-        this.serviceName = serviceName;
-    }
-
-    public Collection<ClusterContext> getClusterContexts() {
-        return clusterContextMap.values();
-    }
-
-    public ClusterContext getClusterContext(String clusterId) {
-        return clusterContextMap.get(clusterId);
-    }
-
-    public void addClusterContext(ClusterContext clusterContext) {
-        clusterContextMap.put(clusterContext.getClusterId(), clusterContext);
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/790437ee/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/TenantAwareLoadBalanceEndpointException.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/TenantAwareLoadBalanceEndpointException.java
 
b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/TenantAwareLoadBalanceEndpointException.java
deleted file mode 100644
index de08988..0000000
--- 
a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/TenantAwareLoadBalanceEndpointException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.stratos.load.balancer;
-
-/**
- * Exception to be thrown from this component.
- */
-public class TenantAwareLoadBalanceEndpointException extends RuntimeException {
-
-    private static final long serialVersionUID = -663839410798538370L;
-
-    public TenantAwareLoadBalanceEndpointException(String msg) {
-        super(msg);
-    }
-
-    public TenantAwareLoadBalanceEndpointException(String msg, Throwable 
cause) {
-        super(msg, cause);
-    }
-
-    public TenantAwareLoadBalanceEndpointException(Throwable cause) {
-        super(cause);
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/790437ee/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/context/ClusterContext.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/context/ClusterContext.java
 
b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/context/ClusterContext.java
new file mode 100644
index 0000000..367258d
--- /dev/null
+++ 
b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/context/ClusterContext.java
@@ -0,0 +1,63 @@
+/*
+ * 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.stratos.load.balancer.context;
+
+import org.apache.stratos.load.balancer.context.AlgorithmContext;
+
+import java.util.Properties;
+
+/**
+ * Defines cluster context properties.
+ */
+public class ClusterContext {
+    private String serviceName;
+    private String clusterId;
+    private AlgorithmContext algorithmContext;
+    private Properties properties;
+
+    public ClusterContext(String serviceName, String clusterId) {
+        this.serviceName = serviceName;
+        this.clusterId = clusterId;
+    }
+
+    public String getServiceName() {
+        return serviceName;
+    }
+
+    public String getClusterId() {
+        return clusterId;
+    }
+
+    public AlgorithmContext getAlgorithmContext() {
+        return algorithmContext;
+    }
+
+    public void setAlgorithmContext(AlgorithmContext algorithmContext) {
+        this.algorithmContext = algorithmContext;
+    }
+
+    public Properties getProperties() {
+        return properties;
+    }
+
+    public void setProperties(Properties properties) {
+        this.properties = properties;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/790437ee/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/context/LoadBalancerContext.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/context/LoadBalancerContext.java
 
b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/context/LoadBalancerContext.java
index af886cc..6ebae04 100644
--- 
a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/context/LoadBalancerContext.java
+++ 
b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/context/LoadBalancerContext.java
@@ -23,7 +23,7 @@ import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import 
org.apache.stratos.load.balancer.TenantAwareLoadBalanceEndpointException;
+import 
org.apache.stratos.load.balancer.exception.TenantAwareLoadBalanceEndpointException;
 import org.apache.stratos.load.balancer.context.map.*;
 import org.apache.synapse.config.SynapseConfiguration;
 import org.wso2.carbon.caching.impl.DistributedMapProvider;

http://git-wip-us.apache.org/repos/asf/stratos/blob/790437ee/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/context/ServiceContext.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/context/ServiceContext.java
 
b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/context/ServiceContext.java
new file mode 100644
index 0000000..f00b3bc
--- /dev/null
+++ 
b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/context/ServiceContext.java
@@ -0,0 +1,58 @@
+/*
+ * 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.stratos.load.balancer.context;
+
+import org.apache.stratos.load.balancer.context.ClusterContext;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Defines service context properties.
+ */
+public class ServiceContext {
+    private String serviceName;
+    private Map<String, ClusterContext> clusterContextMap;
+
+    public ServiceContext() {
+        clusterContextMap = new HashMap<String, ClusterContext>();
+    }
+
+    public String getServiceName() {
+        return serviceName;
+    }
+
+    public void setServiceName(String serviceName) {
+        this.serviceName = serviceName;
+    }
+
+    public Collection<ClusterContext> getClusterContexts() {
+        return clusterContextMap.values();
+    }
+
+    public ClusterContext getClusterContext(String clusterId) {
+        return clusterContextMap.get(clusterId);
+    }
+
+    public void addClusterContext(ClusterContext clusterContext) {
+        clusterContextMap.put(clusterContext.getClusterId(), clusterContext);
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/790437ee/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/context/map/ClusterIdClusterContextMap.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/context/map/ClusterIdClusterContextMap.java
 
b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/context/map/ClusterIdClusterContextMap.java
index fe2bf47..c36a56d 100644
--- 
a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/context/map/ClusterIdClusterContextMap.java
+++ 
b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/context/map/ClusterIdClusterContextMap.java
@@ -19,7 +19,7 @@
 
 package org.apache.stratos.load.balancer.context.map;
 
-import org.apache.stratos.load.balancer.ClusterContext;
+import org.apache.stratos.load.balancer.context.ClusterContext;
 
 import java.util.Collection;
 import java.util.concurrent.ConcurrentHashMap;

http://git-wip-us.apache.org/repos/asf/stratos/blob/790437ee/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/context/map/ServiceNameServiceContextMap.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/context/map/ServiceNameServiceContextMap.java
 
b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/context/map/ServiceNameServiceContextMap.java
index afcafc3..99d563b 100644
--- 
a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/context/map/ServiceNameServiceContextMap.java
+++ 
b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/context/map/ServiceNameServiceContextMap.java
@@ -19,7 +19,7 @@
 
 package org.apache.stratos.load.balancer.context.map;
 
-import org.apache.stratos.load.balancer.ServiceContext;
+import org.apache.stratos.load.balancer.context.ServiceContext;
 
 import java.util.Collection;
 import java.util.concurrent.ConcurrentHashMap;

http://git-wip-us.apache.org/repos/asf/stratos/blob/790437ee/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/endpoint/EndpointDeployer.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/endpoint/EndpointDeployer.java
 
b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/endpoint/EndpointDeployer.java
new file mode 100644
index 0000000..0b59490
--- /dev/null
+++ 
b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/endpoint/EndpointDeployer.java
@@ -0,0 +1,79 @@
+/*
+ * 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.stratos.load.balancer.endpoint;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.context.ConfigurationContext;
+import org.wso2.carbon.mediation.initializer.ServiceBusConstants;
+import org.wso2.carbon.mediation.initializer.ServiceBusUtils;
+import 
org.wso2.carbon.mediation.initializer.persistence.MediationPersistenceManager;
+
+import java.util.Properties;
+
+/**
+ * Responsible for deploying Synapse artifacts.
+ */
+public class EndpointDeployer extends 
org.apache.synapse.deployers.EndpointDeployer {
+
+    MediationPersistenceManager mpm;
+
+    @Override
+    public void init(ConfigurationContext configCtx) {
+        super.init(configCtx);
+        this.mpm = 
ServiceBusUtils.getMediationPersistenceManager(configCtx.getAxisConfiguration());
+    }
+
+    @Override
+    public String deploySynapseArtifact(OMElement artifactConfig, String 
fileName,
+                                        Properties properties) {
+        String epName = super.deploySynapseArtifact(artifactConfig, fileName, 
properties);
+        if (mpm != null) {
+            mpm.saveItemToRegistry(epName, 
ServiceBusConstants.ITEM_TYPE_ENDPOINT);
+        }
+        return epName;
+    }
+
+    @Override
+    public String updateSynapseArtifact(OMElement artifactConfig, String 
fileName,
+                                        String existingArtifactName, 
Properties properties) {
+        String epName = super.updateSynapseArtifact(
+                artifactConfig, fileName, existingArtifactName, properties);
+        if (mpm != null) {
+            mpm.saveItemToRegistry(epName, 
ServiceBusConstants.ITEM_TYPE_ENDPOINT);
+        }
+        return epName;
+    }
+
+    @Override
+    public void undeploySynapseArtifact(String artifactName) {
+        super.undeploySynapseArtifact(artifactName);
+        if (mpm != null) {
+            mpm.deleteItemFromRegistry(artifactName, 
ServiceBusConstants.ITEM_TYPE_ENDPOINT);
+        }
+    }
+
+    @Override
+    public void restoreSynapseArtifact(String artifactName) {
+        super.restoreSynapseArtifact(artifactName);
+        if (mpm != null) {
+            mpm.saveItemToRegistry(artifactName, 
ServiceBusConstants.ITEM_TYPE_ENDPOINT);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/790437ee/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/exception/TenantAwareLoadBalanceEndpointException.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/exception/TenantAwareLoadBalanceEndpointException.java
 
b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/exception/TenantAwareLoadBalanceEndpointException.java
new file mode 100644
index 0000000..e86404c
--- /dev/null
+++ 
b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/exception/TenantAwareLoadBalanceEndpointException.java
@@ -0,0 +1,39 @@
+/*
+ * 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.stratos.load.balancer.exception;
+
+/**
+ * Exception to be thrown from this component.
+ */
+public class TenantAwareLoadBalanceEndpointException extends RuntimeException {
+
+    private static final long serialVersionUID = -663839410798538370L;
+
+    public TenantAwareLoadBalanceEndpointException(String msg) {
+        super(msg);
+    }
+
+    public TenantAwareLoadBalanceEndpointException(String msg, Throwable 
cause) {
+        super(msg, cause);
+    }
+
+    public TenantAwareLoadBalanceEndpointException(Throwable cause) {
+        super(cause);
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/790437ee/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/internal/LoadBalancerServiceComponent.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/internal/LoadBalancerServiceComponent.java
 
b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/internal/LoadBalancerServiceComponent.java
index 95c2941..9e68773 100644
--- 
a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/internal/LoadBalancerServiceComponent.java
+++ 
b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/internal/LoadBalancerServiceComponent.java
@@ -23,10 +23,10 @@ import org.apache.axis2.deployment.DeploymentEngine;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.load.balancer.EndpointDeployer;
+import org.apache.stratos.load.balancer.endpoint.EndpointDeployer;
 import org.apache.stratos.load.balancer.LoadBalancerTenantEventReceiver;
 import org.apache.stratos.load.balancer.LoadBalancerTopologyEventReceiver;
-import 
org.apache.stratos.load.balancer.TenantAwareLoadBalanceEndpointException;
+import 
org.apache.stratos.load.balancer.exception.TenantAwareLoadBalanceEndpointException;
 import 
org.apache.stratos.load.balancer.common.statistics.LoadBalancerStatisticsReader;
 import 
org.apache.stratos.load.balancer.common.statistics.notifier.LoadBalancerStatisticsNotifier;
 import org.apache.stratos.load.balancer.conf.LoadBalancerConfiguration;

Reply via email to