You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by is...@apache.org on 2013/07/10 18:52:04 UTC
[29/45] fixing component version issues and adding currently
refactored components to the parent pom
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/conf/cartridge-config.properties
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/conf/cartridge-config.properties b/components/org.apache.stratos.adc.mgt/src/conf/cartridge-config.properties
new file mode 100644
index 0000000..b495014
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/conf/cartridge-config.properties
@@ -0,0 +1,38 @@
+# Configuration properties
+
+sc.ip=s2_ip
+autoscalerService.url=https://cc.wso2.com:9444/services/CloudControllerService/
+autoscaler.time.out=190000
+cartridge.agent.epr=https://s2_ip:9447/services/CartridgeAgentService
+git.host.name=s2_hostname
+git.host.ip=s2_ip
+git.repo.notification.url=https://sc.wso2.com:9445/services/RepoNotificationService/
+identity.server.url=https://sc.wso2.com:9447/services/RepoNotificationService/
+
+adc.jdbc.url=jdbc:h2:repository/database/WSO2S2_DB
+adc.jdbc.username=wso2carbon
+adc.jdbc.password=wso2carbon
+adc.jdbc.driver=org.h2.Driver
+
+mb.server.ip=cc.wso2.com:5673
+
+feature.externalrepo.validation.enabled=true
+feature.internalrepo.enabled=false
+feature.multitenant.multiplesubscription.enabled=false
+
+internal.repo.username=admin
+internal.repo.password=admin
+
+append.script=SCRIPT_PATH/add_entry_zone_file.sh
+remove.script=SCRIPT_PATH/remove_entry_zone_file.sh
+bind.file.path=/etc/bind/db.STRATOS_DOMAIN
+elb.ip=s2_ip
+
+bam.ip=s2_ip
+bam.port=7714
+
+max.attempts=1000
+
+cartridge.key=KEYPATH
+
+repository.info.epr=https://s2_ip:9445/services/RepositoryInformationService
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/conf/tenant-resource-policy.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/conf/tenant-resource-policy.xml b/components/org.apache.stratos.adc.mgt/src/conf/tenant-resource-policy.xml
new file mode 100644
index 0000000..12bbf74
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/conf/tenant-resource-policy.xml
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/client/CartridgeAgentClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/client/CartridgeAgentClient.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/client/CartridgeAgentClient.java
new file mode 100644
index 0000000..3731107
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/client/CartridgeAgentClient.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright WSO2, Inc. (http://wso2.com)
+ *
+ * Licensed 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.adc.mgt.client;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.adc.mgt.internal.DataHolder;
+import org.wso2.carbon.cartridge.agent.stub.CartridgeAgentServiceStub;
+
+public class CartridgeAgentClient {
+
+ private static final Log log = LogFactory.getLog(CartridgeAgentClient.class);
+ CartridgeAgentServiceStub stub = null;
+ public CartridgeAgentClient(String epr) throws AxisFault {
+ ConfigurationContext clientConfigContext = DataHolder.getClientConfigContext();
+ stub = new CartridgeAgentServiceStub(clientConfigContext, epr);
+ }
+
+ public void unregister(String domain, String subDomain, String hostName) throws Exception {
+ log.info(" ** Unregistering -- ");
+ stub.unregister(domain, subDomain, hostName);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/client/CloudControllerServiceClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/client/CloudControllerServiceClient.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/client/CloudControllerServiceClient.java
new file mode 100644
index 0000000..6dbba78
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/client/CloudControllerServiceClient.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright WSO2, Inc. (http://wso2.com)
+ *
+ * Licensed 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.adc.mgt.client;
+
+import java.rmi.RemoteException;
+
+import javax.activation.DataHandler;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.adc.mgt.exception.UnregisteredCartridgeException;
+import org.apache.stratos.adc.mgt.internal.DataHolder;
+import org.apache.stratos.cloud.controller.stub.CloudControllerServiceStub;
+import org.apache.stratos.cloud.controller.stub.CloudControllerServiceUnregisteredCartridgeExceptionException;
+import org.apache.stratos.cloud.controller.util.xsd.CartridgeInfo;
+import org.apache.stratos.cloud.controller.util.xsd.Properties;
+
+public class CloudControllerServiceClient {
+
+ private CloudControllerServiceStub stub;
+
+ private static final Log log = LogFactory.getLog(CloudControllerServiceClient.class);
+
+ public CloudControllerServiceClient(String epr) throws AxisFault {
+
+ ConfigurationContext clientConfigContext = DataHolder.getClientConfigContext();
+ try {
+ stub = new CloudControllerServiceStub(clientConfigContext, epr);
+ stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(300000);
+
+ } catch (AxisFault axisFault) {
+ String msg = "Failed to initiate AutoscalerService client. " + axisFault.getMessage();
+ log.error(msg, axisFault);
+ throw new AxisFault(msg, axisFault);
+ }
+
+ }
+
+ public boolean register(String domainName, String subDomain, String cartridgeType,
+ DataHandler payload, String tenantRange, String hostName, Properties properties) throws RemoteException, CloudControllerServiceUnregisteredCartridgeExceptionException
+ {
+ return stub.registerService(domainName, subDomain, tenantRange, cartridgeType, hostName,
+ properties, payload);
+
+ }
+
+ public String startInstance(String domain, String subDomain) throws Exception {
+ return stub.startInstance(domain, subDomain);
+ }
+
+ public boolean terminateAllInstances(String domain, String subDomain) throws Exception {
+ return stub.terminateAllInstances(domain, subDomain);
+ }
+
+ public String[] getRegisteredCartridges() throws Exception {
+ return stub.getRegisteredCartridges();
+ }
+
+ public boolean createKeyPair(String cartridge, String keyPairName, String publicKey)
+ throws Exception {
+ return stub.createKeyPairFromPublicKey(cartridge, keyPairName, publicKey);
+ }
+
+ public CartridgeInfo getCartridgeInfo(String cartridgeType) throws UnregisteredCartridgeException, Exception {
+ try {
+ return stub.getCartridgeInfo(cartridgeType);
+ } catch (RemoteException e) {
+ throw e;
+ } catch (CloudControllerServiceUnregisteredCartridgeExceptionException e) {
+ throw new UnregisteredCartridgeException("Not a registered cartridge " + cartridgeType, cartridgeType, e);
+ }
+ }
+
+ public boolean unregisterService(String domain, String subDomain) throws Exception {
+ return stub.unregisterService(domain, subDomain);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/client/RegistryClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/client/RegistryClient.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/client/RegistryClient.java
new file mode 100644
index 0000000..c1d6cd3
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/client/RegistryClient.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright WSO2, Inc. (http://wso2.com)
+ *
+ * Licensed 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.adc.mgt.client;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import java.util.UUID;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.commons.io.IOUtils;
+import org.wso2.carbon.registry.core.Association;
+import org.wso2.carbon.registry.core.Collection;
+import org.wso2.carbon.registry.core.Registry;
+import org.wso2.carbon.registry.core.Resource;
+import org.wso2.carbon.registry.core.exceptions.RegistryException;
+import org.wso2.carbon.registry.ws.client.registry.WSRegistryServiceClient;
+
+public class RegistryClient {
+
+ // url where the repository is running its services interface
+ private static String backendURL = "http://localhost:9763/services/";
+ private static ConfigurationContext configContext = null;
+
+ // configuration locations used to bootstrap axis2
+ private static String axis2Repo =
+ "/home/wso2/Desktop/HP-demo-packs-with-video/cartridge/wso2stratos-cartridge-1.0.0-SNAPSHOT/repository/conf/axis2";
+ private static String axis2Conf =
+ "/home/wso2/Desktop/HP-demo-packs-with-video/cartridge/wso2stratos-cartridge-1.0.0-SNAPSHOT/repository/conf/axis2/axis2_client.xml";
+ private static String serverURL = "https://localhost:9443/services/";
+
+ public RegistryClient() {
+ // TODO Auto-generated constructor stub
+ }
+
+ private static WSRegistryServiceClient initialize() throws Exception {
+ // set these properties, this is used for authentication over https to
+ // the registry
+ // if you have a newer version, you can update the keystore by copying
+ // it from
+ // the security directory of the repository
+ System.setProperty("javax.net.ssl.trustStore", "wso2carbon.jks");
+ System.setProperty("javax.net.ssl.trustStorePassword", "wso2carbon");
+ System.setProperty("javax.net.ssl.trustStoreType", "JKS");
+
+ configContext =
+ ConfigurationContextFactory.createConfigurationContextFromFileSystem(axis2Repo,
+ axis2Conf);
+ return new WSRegistryServiceClient(serverURL, "admin", "admin", backendURL, configContext);
+ }
+
+ public static void addKey(String keyName, String content) throws Exception {
+ Registry registry = initialize();
+
+ // get the governance folder
+ Resource governanceFolder = registry.get("/_system/governance");
+ System.out.println("Folder description: " + governanceFolder.getDescription());
+ Resource r1 = registry.newResource();
+ String path = "/_system/governance/" + keyName;
+ r1.setContent(content);
+ registry.put(path, r1);
+
+ /*
+ * List<Resource> paths = getServicePath(registry,
+ * "/_system/governance/trunk/services");
+ *
+ * for (Resource service : paths) { // we've got all the services here
+ *
+ * Properties props = service.getProperties(); for (Object prop :
+ * props.keySet()) { System.out.println(prop + " - " + props.get(prop));
+ * }
+ *
+ * Association[] associations =
+ * registry.getAssociations(service.getPath(), "Documentation"); for
+ * (Association association : associations) {
+ * System.out.println(association.getAssociationType()); } }
+ */
+ }
+
+ private static List<Resource> getServicePath(Registry registry, String servicesResource)
+ throws RegistryException {
+ List<Resource> result = new ArrayList<Resource>();
+ Resource resource = registry.get(servicesResource);
+
+ if (resource instanceof Collection) {
+ Object content = resource.getContent();
+ for (Object path : (Object[]) content) {
+ result.addAll(getServicePath(registry, (String) path));
+ }
+ } else if (resource instanceof Resource) {
+ result.add(resource);
+ }
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/custom/domain/RegistryManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/custom/domain/RegistryManager.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/custom/domain/RegistryManager.java
new file mode 100644
index 0000000..d53fcc0
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/custom/domain/RegistryManager.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright WSO2, Inc. (http://wso2.com)
+ *
+ * Licensed 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.adc.mgt.custom.domain;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.adc.mgt.exception.ADCException;
+import org.apache.stratos.adc.mgt.exception.DomainMappingExistsException;
+import org.apache.stratos.adc.mgt.internal.DataHolder;
+import org.apache.stratos.adc.mgt.utils.CartridgeConstants;
+import org.wso2.carbon.registry.core.Collection;
+import org.wso2.carbon.registry.core.Registry;
+import org.wso2.carbon.registry.core.Resource;
+import org.wso2.carbon.registry.core.exceptions.RegistryException;
+
+public class RegistryManager {
+ private static Log log = LogFactory.getLog(RegistryManager.class);
+ private static Registry registry = DataHolder.getRegistry();
+
+ public RegistryManager() {
+ try {
+ if (!registry.resourceExists(CartridgeConstants.DomainMappingInfo.HOSTINFO)) {
+ registry.put(CartridgeConstants.DomainMappingInfo.HOSTINFO,
+ registry.newCollection());
+ }
+ } catch (RegistryException e) {
+ String msg =
+ "Error while accessing registry or initializing domain mapping registry path\n";
+ log.error(msg + e.getMessage());
+ }
+ }
+
+ /**
+ *
+ */
+ public void addDomainMappingToRegistry(String hostName, String actualHost)
+ throws ADCException, RegistryException, DomainMappingExistsException {
+ try {
+ registry.beginTransaction();
+ Resource hostResource = registry.newResource();
+ hostResource.addProperty(CartridgeConstants.DomainMappingInfo.ACTUAL_HOST, actualHost);
+ if (!registry.resourceExists(CartridgeConstants.DomainMappingInfo.HOSTINFO +
+ hostName)) {
+ registry.put(CartridgeConstants.DomainMappingInfo.HOSTINFO + hostName,
+ hostResource);
+ } else {
+ registry.rollbackTransaction();
+ String msg = "Requested domain is already taken!";
+ log.error(msg);
+ throw new DomainMappingExistsException(msg, hostName);
+ }
+ registry.commitTransaction();
+ } catch (RegistryException e) {
+ registry.rollbackTransaction();
+ throw e;
+ }
+ }
+
+
+ /**
+ *
+ */
+ public void removeDomainMappingFromRegistry(String actualHost) throws Exception {
+ try {
+ registry.beginTransaction();
+ String hostResourcePath = CartridgeConstants.DomainMappingInfo.HOSTINFO;
+ if (registry.resourceExists(hostResourcePath)) {
+ Resource hostResource = registry.get(hostResourcePath);
+ Collection hostInfoCollection;
+ if(hostResource instanceof Collection){
+ hostInfoCollection = (Collection) hostResource;
+ } else {
+ throw new Exception("Resource is not a collection " + hostResourcePath );
+ }
+ String[] paths = hostInfoCollection.getChildren();
+ for (String path: paths){
+ Resource domainMapping = registry.get(path);
+ String actualHostInRegistry = domainMapping.getProperty(CartridgeConstants.DomainMappingInfo.ACTUAL_HOST);
+ if(actualHostInRegistry != null && actualHost.equalsIgnoreCase(actualHostInRegistry)){
+ registry.delete(path);
+ }
+ }
+ }
+ registry.commitTransaction();
+ } catch (RegistryException e) {
+ registry.rollbackTransaction();
+ log.error("Unable to remove the mapping", e);
+ throw e;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dao/CartridgeSubscription.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dao/CartridgeSubscription.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dao/CartridgeSubscription.java
new file mode 100644
index 0000000..9d48b0f
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dao/CartridgeSubscription.java
@@ -0,0 +1,186 @@
+/*
+ * Copyright WSO2, Inc. (http://wso2.com)
+ *
+ * Licensed 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.adc.mgt.dao;
+
+import java.util.List;
+
+public class CartridgeSubscription {
+
+ private int subscriptionId;
+ private int tenantId;
+ private String cartridge;
+ private String provider;
+ private String hostName;
+ private String policy;
+ private List<PortMapping> portMappings;
+ private String clusterDomain;
+ private String clusterSubdomain;
+ private Repository repository;
+ private String state;
+ private String alias;
+ private String tenantDomain;
+ private DataCartridge dataCartridge;
+ private String baseDirectory;
+ private String mappedDomain;
+ private String mgtClusterDomain;
+ private String mgtClusterSubDomain;
+
+ public int getSubscriptionId() {
+ return subscriptionId;
+ }
+
+ public void setSubscriptionId(int subscriptionId) {
+ this.subscriptionId = subscriptionId;
+ }
+
+ public int getTenantId() {
+ return tenantId;
+ }
+
+ public void setTenantId(int tenantId) {
+ this.tenantId = tenantId;
+ }
+
+ public String getCartridge() {
+ return cartridge;
+ }
+
+ public void setCartridge(String cartridge) {
+ this.cartridge = cartridge;
+ }
+
+ public String getProvider() {
+ return provider;
+ }
+
+ public void setProvider(String provider) {
+ this.provider = provider;
+ }
+
+ public String getHostName() {
+ return hostName;
+ }
+
+ public void setHostName(String hostName) {
+ this.hostName = hostName;
+ }
+
+ public String getPolicy() {
+ return policy;
+ }
+
+ public void setPolicy(String policy) {
+ this.policy = policy;
+ }
+
+ public List<PortMapping> getPortMappings() {
+ return portMappings;
+ }
+
+ public void setPortMappings(List<PortMapping> portMappings) {
+ this.portMappings = portMappings;
+ }
+
+ public String getClusterDomain() {
+ return clusterDomain;
+ }
+
+ public void setClusterDomain(String clusterDomain) {
+ this.clusterDomain = clusterDomain;
+ }
+
+ public String getClusterSubdomain() {
+ return clusterSubdomain;
+ }
+
+ public void setClusterSubdomain(String clusterSubdomain) {
+ this.clusterSubdomain = clusterSubdomain;
+ }
+
+ public Repository getRepository() {
+ return repository;
+ }
+
+ public void setRepository(Repository repository) {
+ this.repository = repository;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public String getAlias() {
+ return alias;
+ }
+
+ public void setAlias(String alias) {
+ this.alias = alias;
+ }
+
+ public String getTenantDomain() {
+ return tenantDomain;
+ }
+
+ public void setTenantDomain(String tenantDomain) {
+ this.tenantDomain = tenantDomain;
+ }
+
+ public DataCartridge getDataCartridge() {
+ return dataCartridge;
+ }
+
+ public void setDataCartridge(DataCartridge dataCartridge) {
+ this.dataCartridge = dataCartridge;
+ }
+
+ public String getBaseDirectory() {
+ return baseDirectory;
+ }
+
+ public void setBaseDirectory(String baseDirectory) {
+ this.baseDirectory = baseDirectory;
+ }
+
+ public String getMappedDomain() {
+ return mappedDomain;
+ }
+
+ public void setMappedDomain(String mappedDomain) {
+ this.mappedDomain = mappedDomain;
+ }
+
+ public String getMgtClusterDomain() {
+ return mgtClusterDomain;
+ }
+
+ public void setMgtClusterDomain(String mgtClusterDomain) {
+ this.mgtClusterDomain = mgtClusterDomain;
+ }
+
+ public String getMgtClusterSubDomain() {
+ return mgtClusterSubDomain;
+ }
+
+ public void setMgtClusterSubDomain(String mgtClusterSubDomain) {
+ this.mgtClusterSubDomain = mgtClusterSubDomain;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dao/DataCartridge.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dao/DataCartridge.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dao/DataCartridge.java
new file mode 100644
index 0000000..8e43079
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dao/DataCartridge.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright WSO2, Inc. (http://wso2.com)
+ *
+ * Licensed 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.adc.mgt.dao;
+
+public class DataCartridge {
+
+ private int id;
+ private String dataCartridgeType;
+ private String userName;
+ private String password;
+ public int getId() {
+ return id;
+ }
+ public void setId(int id) {
+ this.id = id;
+ }
+ public String getDataCartridgeType() {
+ return dataCartridgeType;
+ }
+ public void setDataCartridgeType(String dataCartridgeType) {
+ this.dataCartridgeType = dataCartridgeType;
+ }
+ public String getUserName() {
+ return userName;
+ }
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+ public String getPassword() {
+ return password;
+ }
+ public void setPassword(String password) {
+ this.password = password;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dao/PortMapping.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dao/PortMapping.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dao/PortMapping.java
new file mode 100644
index 0000000..5916847
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dao/PortMapping.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright WSO2, Inc. (http://wso2.com)
+ *
+ * Licensed 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.adc.mgt.dao;
+
+public class PortMapping {
+ private int id;
+ private String type;
+ private String primaryPort;
+ private String proxyPort;
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getPrimaryPort() {
+ return primaryPort;
+ }
+
+ public void setPrimaryPort(String primaryPort) {
+ this.primaryPort = primaryPort;
+ }
+
+ public String getProxyPort() {
+ return proxyPort;
+ }
+
+ public void setProxyPort(String proxyPort) {
+ this.proxyPort = proxyPort;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dao/Repository.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dao/Repository.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dao/Repository.java
new file mode 100644
index 0000000..a951e78
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dao/Repository.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright WSO2, Inc. (http://wso2.com)
+ *
+ * Licensed 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.adc.mgt.dao;
+
+public class Repository {
+ private int repoId;
+ private String repoName;
+ private String repoUserName;
+ private String repoUserPassword;
+
+ public int getRepoId() {
+ return repoId;
+ }
+
+ public void setRepoId(int repoId) {
+ this.repoId = repoId;
+ }
+
+ public String getRepoName() {
+ return repoName;
+ }
+
+ public void setRepoName(String repoName) {
+ this.repoName = repoName;
+ }
+
+ public String getRepoUserName() {
+ return repoUserName;
+ }
+
+ public void setRepoUserName(String repoUserName) {
+ this.repoUserName=repoUserName;
+ }
+
+ public String getRepoUserPassword() {
+ return repoUserPassword;
+ }
+
+ public void setRepoUserPassword(String repoUserPassword) {
+ this.repoUserPassword=repoUserPassword;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dao/RepositoryCredentials.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dao/RepositoryCredentials.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dao/RepositoryCredentials.java
new file mode 100644
index 0000000..90670e7
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dao/RepositoryCredentials.java
@@ -0,0 +1,27 @@
+package org.apache.stratos.adc.mgt.dao;
+
+public class RepositoryCredentials {
+
+ private String url;
+ private String userName;
+ private String password;
+ public String getUrl() {
+ return url;
+ }
+ public void setUrl(String url) {
+ this.url = url;
+ }
+ public String getUserName() {
+ return userName;
+ }
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+ public String getPassword() {
+ return password;
+ }
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dns/DNSManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dns/DNSManager.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dns/DNSManager.java
new file mode 100644
index 0000000..ceb77fb
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dns/DNSManager.java
@@ -0,0 +1,86 @@
+ /*
+ * Copyright WSO2, Inc. (http://wso2.com)
+ *
+ * Licensed 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.adc.mgt.dns;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.adc.mgt.utils.CartridgeConstants;
+
+/**
+ * This class is for handling dns entries.
+ */
+public class DNSManager {
+ private static final Log log = LogFactory.getLog(DNSManager.class);
+
+ /**
+ * This is get called when there is a need of adding new sub domain to
+ * exciting domain.
+ * It will append required text to bind9 zone file and reload bind9 server.
+ * Note: make sure the user who run ADC has got rights to run sudo scripts
+ * without password
+ *
+ * @param subDomain
+ * will be added in front of domain
+ */
+ public void addNewSubDomain(String subDomain, String ip) {
+ try {
+ Runtime.getRuntime()
+ .exec(CartridgeConstants.SUDO_SH + " " +
+ // script script file that will be used to edit
+ // required files
+ System.getProperty(CartridgeConstants.APPEND_SCRIPT) + " " +
+ subDomain + " " +
+ // machineIp ip of the machine DNS bind service
+ // is running
+ ip + " " +
+ // bindFile the file which we edit to append
+ // the DNS entry
+ System.getProperty(CartridgeConstants.BIND_FILE_PATH));
+ log.info("New sub domain is added to zone file");
+ } catch (Exception e) {
+ log.error(e.getMessage());
+ throw new RuntimeException(e);
+ }
+ }
+ /**
+ * This is get called when there is a need of remove a sub domain.
+ * It will remove required text from bind9 zone file and reload bind9 server.
+ * Note: make sure the user who run ADC has got rights to run sudo scripts
+ * without password
+ *
+ * @param subDomain
+ * will be used to delete the entry related to this
+ */
+ public void removeSubDomain(String subDomain) {
+ try {
+ Runtime.getRuntime()
+ .exec(CartridgeConstants.SUDO_SH + " " +
+ // script script file that will be used to edit
+ // required files
+ System.getProperty(CartridgeConstants.REMOVE_SCRIPT) + " " +
+ subDomain + " " +
+ // bindFile the file which we edit to remove
+ // the DNS entry
+ System.getProperty(CartridgeConstants.BIND_FILE_PATH));
+ log.info("Sub domain is removed from zone file");
+ } catch (Exception e) {
+ log.error(e.getMessage());
+ throw new RuntimeException(e);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/AppRepo.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/AppRepo.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/AppRepo.java
new file mode 100644
index 0000000..facfbe3
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/AppRepo.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright WSO2, Inc. (http://wso2.com)
+ *
+ * Licensed 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.adc.mgt.dto;
+
+public class AppRepo {
+
+ private int tenantId;
+ private String repoName;
+ private String cartridge;
+ private String appName;
+ private boolean isWebRoot;
+ private String tenantPubKey;
+ private String tenantCartridgePubKey;
+
+ public int getTenantId() {
+ return tenantId;
+ }
+
+ public void setTenantId(int tenantId) {
+ this.tenantId = tenantId;
+ }
+
+ public String getRepoName() {
+ return repoName;
+ }
+
+ public void setRepoName(String repoName) {
+ this.repoName = repoName;
+ }
+
+ public String getCartridge() {
+ return cartridge;
+ }
+
+ public void setCartridge(String cartridge) {
+ this.cartridge = cartridge;
+ }
+
+ public String getAppName() {
+ return appName;
+ }
+
+ public void setAppName(String appName) {
+ this.appName = appName;
+ }
+
+ public boolean isWebRoot() {
+ return isWebRoot;
+ }
+
+ public void setWebRoot(boolean isWebRoot) {
+ this.isWebRoot = isWebRoot;
+ }
+
+ public String getTenantPubKey() {
+ return tenantPubKey;
+ }
+
+ public void setTenantPubKey(String tenantPubKey) {
+ this.tenantPubKey = tenantPubKey;
+ }
+
+ public String getTenantCartridgePubKey() {
+ return tenantCartridgePubKey;
+ }
+
+ public void setTenantCartridgePubKey(String tenantCartridgePubKey) {
+ this.tenantCartridgePubKey = tenantCartridgePubKey;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/Cartridge.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/Cartridge.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/Cartridge.java
new file mode 100644
index 0000000..4d990ce
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/Cartridge.java
@@ -0,0 +1,198 @@
+/*
+ * Copyright WSO2, Inc. (http://wso2.com)
+ *
+ * Licensed 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.adc.mgt.dto;
+
+public class Cartridge implements Comparable<Cartridge> {
+
+ private String displayName;
+ private String description;
+ private String cartridgeAlias;
+ private String cartridgeType;
+ private int activeInstances;
+ private String status;
+ private String ip;
+ private String password;
+ private String provider;
+ private String version;
+ private boolean multiTenant;
+ private String hostName;
+ private String policy;
+ private String policyDescription;
+ private String repoURL;
+ private String dbUserName;
+ private String mappedDomain;
+
+ private String[] accessURLs;
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getCartridgeAlias() {
+ return cartridgeAlias;
+ }
+
+ public void setCartridgeAlias(String cartridgeAlias) {
+ this.cartridgeAlias = cartridgeAlias;
+ }
+
+ public String getCartridgeType() {
+ return cartridgeType;
+ }
+
+ public void setCartridgeType(String cartridgeType) {
+ this.cartridgeType = cartridgeType;
+ }
+
+ public int getActiveInstances() {
+ return activeInstances;
+ }
+
+ public void setActiveInstances(int activeInstances) {
+ this.activeInstances = activeInstances;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getIp() {
+ return ip;
+ }
+
+ public void setIp(String ip) {
+ this.ip = ip;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getProvider() {
+ return provider;
+ }
+
+ public void setProvider(String provider) {
+ this.provider = provider;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public boolean isMultiTenant() {
+ return multiTenant;
+ }
+
+ public void setMultiTenant(boolean multiTenant) {
+ this.multiTenant = multiTenant;
+ }
+
+ public String getHostName() {
+ return hostName;
+ }
+
+ public void setHostName(String hostName) {
+ this.hostName = hostName;
+ }
+
+ public String getPolicy() {
+ return policy;
+ }
+
+ public void setPolicy(String policy) {
+ this.policy = policy;
+ }
+
+ public String getPolicyDescription() {
+ return policyDescription;
+ }
+
+ public void setPolicyDescription(String policyDescription) {
+ this.policyDescription = policyDescription;
+ }
+
+ public String getRepoURL() {
+ return repoURL;
+ }
+
+ public void setRepoURL(String repoURL) {
+ this.repoURL = repoURL;
+ }
+
+ public String getDbUserName() {
+ return dbUserName;
+ }
+
+ public String[] getAccessURLs() {
+ return accessURLs;
+ }
+
+ public void setAccessURLs(String[] accessURLs) {
+ this.accessURLs = accessURLs;
+ }
+
+ public void setDbUserName(String dbUserName) {
+ this.dbUserName = dbUserName;
+ }
+
+ public String getMappedDomain() {
+ return mappedDomain;
+ }
+
+ public void setMappedDomain(String mappedDomain) {
+ this.mappedDomain = mappedDomain;
+ }
+
+ @Override
+ public int compareTo(Cartridge o) {
+ int compare = 0;
+ if (cartridgeAlias != null && o.cartridgeAlias != null) {
+ compare = cartridgeAlias.compareTo(o.cartridgeAlias);
+ }
+ if (compare == 0 && cartridgeType != null && o.cartridgeType != null) {
+ compare = cartridgeType.compareTo(o.cartridgeType);
+ }
+ return compare;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/CartridgeDetail.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/CartridgeDetail.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/CartridgeDetail.java
new file mode 100644
index 0000000..48a0086
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/CartridgeDetail.java
@@ -0,0 +1 @@
+package org.apache.stratos.adc.mgt.dto;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/CartridgeInformation.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/CartridgeInformation.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/CartridgeInformation.java
new file mode 100644
index 0000000..48a0086
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/CartridgeInformation.java
@@ -0,0 +1 @@
+package org.apache.stratos.adc.mgt.dto;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/CartridgeWrapper.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/CartridgeWrapper.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/CartridgeWrapper.java
new file mode 100644
index 0000000..1339a16
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/CartridgeWrapper.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.adc.mgt.dto;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.wso2.carbon.utils.Pageable;
+
+/**
+ * This class holds paginated information about cartridges
+ */
+public final class CartridgeWrapper implements Pageable {
+
+ private Cartridge[] cartridges;
+ private int numberOfPages;
+
+ public CartridgeWrapper() {
+ }
+
+ public int getNumberOfPages() {
+ return numberOfPages;
+ }
+
+ public void setNumberOfPages(int numberOfPages) {
+ this.numberOfPages = numberOfPages;
+ }
+
+ public <T> void set(List<T> items) {
+ this.cartridges = items.toArray(new Cartridge[items.size()]);
+ }
+
+ public Cartridge[] getCartridges() {
+ return cartridges != null ? Arrays.copyOf(cartridges, cartridges.length) : null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/Policy.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/Policy.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/Policy.java
new file mode 100644
index 0000000..451618d
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/Policy.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright 2013, WSO2, Inc. http://wso2.org
+ *
+ * Licensed 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.adc.mgt.dto;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+public class Policy implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private String name;
+ private String description;
+ private boolean defaultPolicy;
+
+ private Integer minAppInstances;
+ private Integer maxAppInstances;
+ private Integer maxRequestsPerSecond;
+ private BigDecimal alarmingUpperRate;
+ private BigDecimal alarmingLowerRate;
+ private BigDecimal scaleDownFactor;
+ private Integer roundsToAverage;
+
+ public Policy() {
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public boolean isDefaultPolicy() {
+ return defaultPolicy;
+ }
+
+ public void setDefaultPolicy(boolean defaultPolicy) {
+ this.defaultPolicy = defaultPolicy;
+ }
+
+ public Integer getMinAppInstances() {
+ return minAppInstances;
+ }
+
+ public void setMinAppInstances(Integer minAppInstances) {
+ this.minAppInstances = minAppInstances;
+ }
+
+ public Integer getMaxAppInstances() {
+ return maxAppInstances;
+ }
+
+ public void setMaxAppInstances(Integer maxAppInstances) {
+ this.maxAppInstances = maxAppInstances;
+ }
+
+ public Integer getMaxRequestsPerSecond() {
+ return maxRequestsPerSecond;
+ }
+
+ public void setMaxRequestsPerSecond(Integer maxRequestsPerSecond) {
+ this.maxRequestsPerSecond = maxRequestsPerSecond;
+ }
+
+ public BigDecimal getAlarmingUpperRate() {
+ return alarmingUpperRate;
+ }
+
+ public void setAlarmingUpperRate(BigDecimal alarmingUpperRate) {
+ this.alarmingUpperRate = alarmingUpperRate;
+ }
+
+ public BigDecimal getAlarmingLowerRate() {
+ return alarmingLowerRate;
+ }
+
+ public void setAlarmingLowerRate(BigDecimal alarmingLowerRate) {
+ this.alarmingLowerRate = alarmingLowerRate;
+ }
+
+ public BigDecimal getScaleDownFactor() {
+ return scaleDownFactor;
+ }
+
+ public void setScaleDownFactor(BigDecimal scaleDownFactor) {
+ this.scaleDownFactor = scaleDownFactor;
+ }
+
+ public Integer getRoundsToAverage() {
+ return roundsToAverage;
+ }
+
+ public void setRoundsToAverage(Integer roundsToAverage) {
+ this.roundsToAverage = roundsToAverage;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (!(obj instanceof Policy))
+ return false;
+ Policy other = (Policy) obj;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/PolicyDefinition.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/PolicyDefinition.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/PolicyDefinition.java
new file mode 100644
index 0000000..b21df4f
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/PolicyDefinition.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2013, WSO2, Inc. http://wso2.org
+ *
+ * Licensed 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.adc.mgt.dto;
+
+import java.io.Serializable;
+
+public class PolicyDefinition implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private String name;
+ private String description;
+ private boolean defaultPolicy;
+
+ public PolicyDefinition() {
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public boolean isDefaultPolicy() {
+ return defaultPolicy;
+ }
+
+ public void setDefaultPolicy(boolean defaultPolicy) {
+ this.defaultPolicy = defaultPolicy;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (!(obj instanceof PolicyDefinition))
+ return false;
+ PolicyDefinition other = (PolicyDefinition) obj;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/RepositoryInformation.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/RepositoryInformation.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/RepositoryInformation.java
new file mode 100644
index 0000000..3a88700
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/RepositoryInformation.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2013, WSO2, Inc. http://wso2.org
+ *
+ * Licensed 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.adc.mgt.dto;
+
+import java.io.Serializable;
+
+public class RepositoryInformation implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private String repoURL;
+ private String[] refName;
+
+ public String getRepoURL() {
+ return repoURL;
+ }
+
+ public void setRepoURL(String repoURL) {
+ this.repoURL = repoURL;
+ }
+
+ public String[] getRefName() {
+ return refName;
+ }
+
+ public void setRefName(String[] refName) {
+ this.refName = refName;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/SubscriptionInfo.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/SubscriptionInfo.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/SubscriptionInfo.java
new file mode 100644
index 0000000..39e3ae2
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/dto/SubscriptionInfo.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2013, WSO2, Inc. http://wso2.org
+ *
+ * Licensed 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.adc.mgt.dto;
+
+import java.io.Serializable;
+
+public class SubscriptionInfo implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private String hostname;
+ private String repositoryURL;
+
+ public String getHostname() {
+ return hostname;
+ }
+
+ public void setHostname(String hostname) {
+ this.hostname = hostname;
+ }
+
+ public String getRepositoryURL() {
+ return repositoryURL;
+ }
+
+ public void setRepositoryURL(String repositoryURL) {
+ this.repositoryURL = repositoryURL;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/ADCException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/ADCException.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/ADCException.java
new file mode 100644
index 0000000..d9dbfdf
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/ADCException.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2013, WSO2, Inc. http://wso2.org
+ *
+ * Licensed 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.adc.mgt.exception;
+
+public class ADCException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ private String message;
+
+ public ADCException() {
+ super();
+ }
+
+ public ADCException(String message, Throwable cause) {
+ super(message, cause);
+ this.message = message;
+ }
+
+ public ADCException(String message) {
+ super(message);
+ this.message = message;
+ }
+
+ public ADCException(Throwable cause) {
+ super(cause);
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/AlreadySubscribedException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/AlreadySubscribedException.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/AlreadySubscribedException.java
new file mode 100644
index 0000000..954a71b
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/AlreadySubscribedException.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2013, WSO2, Inc. http://wso2.org
+ *
+ * Licensed 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.adc.mgt.exception;
+
+public class AlreadySubscribedException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ private final String message;
+
+ private final String cartridgeType;
+
+ public AlreadySubscribedException(String message, String cartridgeType, Throwable cause) {
+ super(message, cause);
+ this.message = message;
+ this.cartridgeType = cartridgeType;
+ }
+
+ public AlreadySubscribedException(String message, String cartridgeType) {
+ super(message);
+ this.message = message;
+ this.cartridgeType = cartridgeType;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public String getCartridgeType() {
+ return cartridgeType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/DomainMappingExistsException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/DomainMappingExistsException.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/DomainMappingExistsException.java
new file mode 100644
index 0000000..9287a86
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/DomainMappingExistsException.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2013, WSO2, Inc. http://wso2.org
+ *
+ * Licensed 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.adc.mgt.exception;
+
+public class DomainMappingExistsException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ private final String message;
+
+ private final String domain;
+
+ public DomainMappingExistsException(String message, String domain, Throwable cause) {
+ super(message, cause);
+ this.message = message;
+ this.domain = domain;
+ }
+
+ public DomainMappingExistsException(String message, String domain) {
+ super(message);
+ this.message = message;
+ this.domain = domain;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public String getDomain() {
+ return domain;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/DuplicateCartridgeAliasException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/DuplicateCartridgeAliasException.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/DuplicateCartridgeAliasException.java
new file mode 100644
index 0000000..94aa14c
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/DuplicateCartridgeAliasException.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2013, WSO2, Inc. http://wso2.org
+ *
+ * Licensed 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.adc.mgt.exception;
+
+public class DuplicateCartridgeAliasException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ private final String message;
+
+ private final String cartridgeType;
+
+ private final String cartridgeAlias;
+
+ public DuplicateCartridgeAliasException(String message, String cartridgeType, String cartridgeAlias, Throwable cause) {
+ super(message, cause);
+ this.message = message;
+ this.cartridgeType = cartridgeType;
+ this.cartridgeAlias = cartridgeAlias;
+ }
+
+ public DuplicateCartridgeAliasException(String message, String cartridgeType, String cartridgeAlias) {
+ super(message);
+ this.message = message;
+ this.cartridgeType = cartridgeType;
+ this.cartridgeAlias = cartridgeAlias;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public String getCartridgeType() {
+ return cartridgeType;
+ }
+
+ public String getCartridgeAlias() {
+ return cartridgeAlias;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/InvalidCartridgeAliasException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/InvalidCartridgeAliasException.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/InvalidCartridgeAliasException.java
new file mode 100644
index 0000000..0fed41b
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/InvalidCartridgeAliasException.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2013, WSO2, Inc. http://wso2.org
+ *
+ * Licensed 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.adc.mgt.exception;
+
+public class InvalidCartridgeAliasException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ private final String message;
+
+ private final String cartridgeType;
+
+ private final String cartridgeAlias;
+
+ public InvalidCartridgeAliasException(String message, String cartridgeType, String cartridgeAlias, Throwable cause) {
+ super(message, cause);
+ this.message = message;
+ this.cartridgeType = cartridgeType;
+ this.cartridgeAlias = cartridgeAlias;
+ }
+
+ public InvalidCartridgeAliasException(String message, String cartridgeType, String cartridgeAlias) {
+ super(message);
+ this.message = message;
+ this.cartridgeType = cartridgeType;
+ this.cartridgeAlias = cartridgeAlias;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public String getCartridgeType() {
+ return cartridgeType;
+ }
+
+ public String getCartridgeAlias() {
+ return cartridgeAlias;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/InvalidRepositoryException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/InvalidRepositoryException.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/InvalidRepositoryException.java
new file mode 100644
index 0000000..c545b9e
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/InvalidRepositoryException.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2013, WSO2, Inc. http://wso2.org
+ *
+ * Licensed 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.adc.mgt.exception;
+
+public class InvalidRepositoryException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ private String message;
+
+ public InvalidRepositoryException(String message, Throwable cause) {
+ super(message, cause);
+ this.message = message;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/NotSubscribedException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/NotSubscribedException.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/NotSubscribedException.java
new file mode 100644
index 0000000..74aef20
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/NotSubscribedException.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2013, WSO2, Inc. http://wso2.org
+ *
+ * Licensed 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.adc.mgt.exception;
+
+public class NotSubscribedException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ private final String message;
+
+ private final String cartridgeAlias;
+
+ public NotSubscribedException(String message, String cartridgeAlias, Throwable cause) {
+ super(message, cause);
+ this.message = message;
+ this.cartridgeAlias = cartridgeAlias;
+ }
+
+ public NotSubscribedException(String message, String cartridgeAlias) {
+ super(message);
+ this.message = message;
+ this.cartridgeAlias = cartridgeAlias;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public String getCartridgeAlias() {
+ return cartridgeAlias;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/PolicyException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/PolicyException.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/PolicyException.java
new file mode 100644
index 0000000..2ad3117
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/PolicyException.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2013, WSO2, Inc. http://wso2.org
+ *
+ * Licensed 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.adc.mgt.exception;
+
+public class PolicyException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ private final String message;
+
+ public PolicyException(String message, Throwable cause) {
+ super(message, cause);
+ this.message = message;
+ }
+
+ public PolicyException(String message) {
+ super(message);
+ this.message = message;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/RepositoryCredentialsRequiredException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/RepositoryCredentialsRequiredException.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/RepositoryCredentialsRequiredException.java
new file mode 100644
index 0000000..2de1899
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/RepositoryCredentialsRequiredException.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2013, WSO2, Inc. http://wso2.org
+ *
+ * Licensed 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.adc.mgt.exception;
+
+public class RepositoryCredentialsRequiredException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ private String message;
+
+ public RepositoryCredentialsRequiredException(String message, Throwable cause) {
+ super(message, cause);
+ this.message = message;
+ }
+
+ public RepositoryCredentialsRequiredException(String message) {
+ super(message);
+ this.message = message;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/RepositoryRequiredException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/RepositoryRequiredException.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/RepositoryRequiredException.java
new file mode 100644
index 0000000..553dfc2
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/RepositoryRequiredException.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2013, WSO2, Inc. http://wso2.org
+ *
+ * Licensed 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.adc.mgt.exception;
+
+public class RepositoryRequiredException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ private String message;
+
+ public RepositoryRequiredException(String message, Throwable cause) {
+ super(message, cause);
+ this.message = message;
+ }
+
+ public RepositoryRequiredException(String message) {
+ super(message);
+ this.message = message;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/RepositoryTransportException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/RepositoryTransportException.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/RepositoryTransportException.java
new file mode 100644
index 0000000..5b5036a
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/RepositoryTransportException.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2013, WSO2, Inc. http://wso2.org
+ *
+ * Licensed 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.adc.mgt.exception;
+
+public class RepositoryTransportException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ private final String message;
+
+ public RepositoryTransportException(String message, Throwable cause) {
+ super(message, cause);
+ this.message = message;
+ }
+
+ public RepositoryTransportException(String message) {
+ super(message);
+ this.message = message;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/UnregisteredCartridgeException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/UnregisteredCartridgeException.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/UnregisteredCartridgeException.java
new file mode 100644
index 0000000..fb1f656
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/exception/UnregisteredCartridgeException.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2013, WSO2, Inc. http://wso2.org
+ *
+ * Licensed 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.adc.mgt.exception;
+
+public class UnregisteredCartridgeException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ private final String message;
+
+ private final String cartridgeType;
+
+ public UnregisteredCartridgeException(String message, String cartridgeType, Throwable cause) {
+ super(message, cause);
+ this.message = message;
+ this.cartridgeType = cartridgeType;
+ }
+
+ public UnregisteredCartridgeException(String message, String cartridgeType) {
+ super(message);
+ this.message = message;
+ this.cartridgeType = cartridgeType;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public String getCartridgeType() {
+ return cartridgeType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/internal/ADCManagementServerComponent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/internal/ADCManagementServerComponent.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/internal/ADCManagementServerComponent.java
new file mode 100644
index 0000000..48cfc2a
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/internal/ADCManagementServerComponent.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright WSO2, Inc. (http://wso2.com)
+ *
+ * Licensed 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.adc.mgt.internal;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.adc.mgt.utils.CartridgeConfigFileReader;
+import org.apache.stratos.adc.mgt.utils.StratosDBUtils;
+import org.osgi.service.component.ComponentContext;
+import org.apache.stratos.adc.topology.mgt.service.TopologyManagementService;
+import org.wso2.carbon.registry.core.service.RegistryService;
+import org.wso2.carbon.user.core.service.RealmService;
+import org.wso2.carbon.utils.ConfigurationContextService;
+
+/**
+ * @scr.component name=
+ * "org.wso2.carbon.hosting.mgt.internal.ADCManagementServerComponent"
+ * immediate="true"
+ * @scr.reference name="config.context.service"
+ * interface="org.wso2.carbon.utils.ConfigurationContextService"
+ * cardinality="1..1" policy="dynamic"
+ * bind="setConfigurationContextService"
+ * unbind="unsetConfigurationContextService"
+ * @scr.reference name="user.realmservice.default"
+ * interface="org.wso2.carbon.user.core.service.RealmService"
+ * cardinality="1..1" policy="dynamic" bind="setRealmService"
+ * unbind="unsetRealmService"
+ * @scr.reference name="registry.service"
+ * interface=
+ * "org.wso2.carbon.registry.core.service.RegistryService"
+ * cardinality="1..1" policy="dynamic" bind="setRegistryService"
+ * unbind="unsetRegistryService"
+ * @scr.reference name="topology.mgt.service"
+ * interface=
+ * "org.apache.stratos.adc.topology.mgt.service.TopologyManagementService"
+ * cardinality="1..1" policy="dynamic"
+ * bind="setTopologyManagementService"
+ * unbind="unsetTopologyManagementService"
+ */
+
+public class ADCManagementServerComponent {
+ private static final Log log = LogFactory.getLog(ADCManagementServerComponent.class);
+
+ protected void activate(ComponentContext componentContext) throws Exception {
+ if (log.isInfoEnabled()) {
+ log.info("ADC Management Server Component activated");
+ }
+
+ try {
+ CartridgeConfigFileReader.readProperties();
+ StratosDBUtils.initialize();
+ } catch (Exception e) {
+ log.fatal("Error while initializing the ADC Management Server Component", e);
+ }
+ }
+
+ protected void setConfigurationContextService(ConfigurationContextService contextService) {
+ DataHolder.setClientConfigContext(contextService.getClientConfigContext());
+ DataHolder.setServerConfigContext(contextService.getServerConfigContext());
+
+ }
+
+ protected void unsetConfigurationContextService(ConfigurationContextService contextService) {
+ DataHolder.setClientConfigContext(null);
+ DataHolder.setServerConfigContext(null);
+ }
+
+ protected void setRealmService(RealmService realmService) {
+ // keeping the realm service in the DataHolder class
+ DataHolder.setRealmService(realmService);
+ }
+
+ protected void unsetRealmService(RealmService realmService) {
+ }
+
+ protected void setRegistryService(RegistryService registryService) {
+ try {
+ DataHolder.setRegistry(registryService.getGovernanceSystemRegistry());
+ } catch (Exception e) {
+ log.error("Cannot retrieve governance Registry", e);
+ }
+ }
+
+ protected void unsetRegistryService(RegistryService registryService) {
+ }
+
+ protected void setTopologyManagementService(TopologyManagementService topologyMgtService) {
+ DataHolder.setTopologyMgtService(topologyMgtService);
+ }
+
+ protected void unsetTopologyManagementService(TopologyManagementService topologyMgtService) {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/internal/DataHolder.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/internal/DataHolder.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/internal/DataHolder.java
new file mode 100644
index 0000000..392489b
--- /dev/null
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/internal/DataHolder.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright WSO2, Inc. (http://wso2.com)
+ *
+ * Licensed 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.adc.mgt.internal;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.wso2.carbon.registry.core.Registry;
+import org.apache.stratos.adc.topology.mgt.service.TopologyManagementService;
+import org.wso2.carbon.user.core.service.RealmService;
+import org.wso2.carbon.utils.CarbonUtils;
+
+/**
+ * Holds the some of the data required by the webapps component
+ */
+public class DataHolder {
+ private static ConfigurationContext clientConfigContext;
+ private static ConfigurationContext serverConfigContext;
+
+ private static RealmService realmService;
+ private static Registry registry;
+ private static TopologyManagementService topologyMgtService;
+
+ public static RealmService getRealmService() {
+ return realmService;
+ }
+
+ public static void setRealmService(RealmService realmService) {
+ DataHolder.realmService = realmService;
+ }
+
+ public static Registry getRegistry() {
+ return registry;
+ }
+
+ public static ConfigurationContext getClientConfigContext() {
+ CarbonUtils.checkSecurity();
+ return clientConfigContext;
+ }
+
+ public static void setClientConfigContext(ConfigurationContext clientConfigContext) {
+ DataHolder.clientConfigContext = clientConfigContext;
+ }
+
+ public static ConfigurationContext getServerConfigContext() {
+ CarbonUtils.checkSecurity();
+ return serverConfigContext;
+ }
+
+ public static void setServerConfigContext(ConfigurationContext serverConfigContext) {
+ DataHolder.serverConfigContext = serverConfigContext;
+ }
+
+ public static void setRegistry(Registry registry) {
+ DataHolder.registry = registry;
+ }
+
+ public static TopologyManagementService getTopologyMgtService() {
+ return topologyMgtService;
+ }
+
+ public static void setTopologyMgtService(TopologyManagementService topologyMgtService) {
+ DataHolder.topologyMgtService = topologyMgtService;
+ }
+}