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 2014/01/08 06:51:45 UTC
[34/46] renaming package adc.mgt to manager
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/connector/CartridgeSubscriptionConnectorFactory.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/connector/CartridgeSubscriptionConnectorFactory.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/connector/CartridgeSubscriptionConnectorFactory.java
new file mode 100644
index 0000000..b0719e7
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/connector/CartridgeSubscriptionConnectorFactory.java
@@ -0,0 +1,41 @@
+/*
+ * 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.manager.connector;
+
+import org.apache.stratos.manager.connector.data.DataCartridgeSubscriptionConnector;
+import org.apache.stratos.manager.exception.ADCException;
+
+public class CartridgeSubscriptionConnectorFactory {
+
+ public static CartridgeSubscriptionConnector getCartridgeInstanceConnector (String type) throws ADCException {
+
+ CartridgeSubscriptionConnector cartridgeSubscriptionConnector = null;
+
+ if(type.equals("mysql")) {
+ cartridgeSubscriptionConnector = new DataCartridgeSubscriptionConnector();
+ }
+
+ if(cartridgeSubscriptionConnector == null) {
+ throw new ADCException("Unable to find matching CartridgeSubscriptionConnector for " + type);
+ }
+
+ return cartridgeSubscriptionConnector;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/connector/data/DataCartridgeSubscriptionConnector.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/connector/data/DataCartridgeSubscriptionConnector.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/connector/data/DataCartridgeSubscriptionConnector.java
new file mode 100644
index 0000000..6fcf654
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/connector/data/DataCartridgeSubscriptionConnector.java
@@ -0,0 +1,92 @@
+/*
+ * 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.manager.connector.data;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.manager.connector.CartridgeSubscriptionConnector;
+import org.apache.stratos.manager.dto.Cartridge;
+import org.apache.stratos.manager.exception.ADCException;
+import org.apache.stratos.manager.exception.NotSubscribedException;
+import org.apache.stratos.manager.subscription.CartridgeSubscription;
+import org.apache.stratos.manager.utils.ApplicationManagementUtil;
+import org.apache.stratos.manager.utils.CartridgeConstants;
+
+import java.util.Properties;
+
+public class DataCartridgeSubscriptionConnector extends CartridgeSubscriptionConnector {
+
+ private static Log log = LogFactory.getLog(DataCartridgeSubscriptionConnector.class);
+
+ @Override
+ public Properties createConnection(CartridgeSubscription cartridgeSubscription,
+ CartridgeSubscription connectingCartridgeSubscription) throws ADCException {
+
+ //TODO: change the logic to do with topology information
+ log.info("Retrieving cartridge information for connecting ... alias : " +
+ connectingCartridgeSubscription.getAlias() + ", Type: " + connectingCartridgeSubscription.getType());
+
+ Properties connectionProperties = new Properties();
+
+ int maxAttempts = Integer.parseInt(System.getProperty(CartridgeConstants.MAX_ATTEMPTS, "50"));
+ int attempts = 0;
+ while (attempts < maxAttempts) {
+ attempts++;
+ Cartridge cartridge = null;
+ try {
+ cartridge = ApplicationManagementUtil.getCartridgeInfo(
+ connectingCartridgeSubscription.getAlias(),
+ connectingCartridgeSubscription.getSubscriber().getTenantDomain());
+
+ } catch (NotSubscribedException e) {
+ // This cannot happen here.
+ }
+ if (cartridge != null) {
+ /*if (!cartridge.getStatus().equals("ACTIVE")) {
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException ignore) {
+ }
+ } else {
+ connectionProperties.setProperty("MYSQL_HOST", cartridge.getIp());
+ connectionProperties.setProperty("MYSQL_USER", cartridge.getDbUserName());
+ connectionProperties.setProperty("MYSQL_PASSWORD", cartridge.getPassword());
+ log.info("Connection information retrieved for " + cartridgeSubscription + " and " +
+ connectingCartridgeSubscription);
+ break;
+ }*/
+ }
+
+ if(attempts == maxAttempts) {
+ String errorMsg = "Failed to connect " + cartridgeSubscription + " and " + connectingCartridgeSubscription;
+ log.error(errorMsg);
+ throw new ADCException(errorMsg);
+ }
+ }
+
+ return connectionProperties;
+ }
+
+ @Override
+ public Properties teminateConnection(CartridgeSubscription cartridgeSubscription,
+ CartridgeSubscription connectedCartridgeSubscription) throws ADCException {
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dao/CartridgeSubscriptionInfo.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dao/CartridgeSubscriptionInfo.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dao/CartridgeSubscriptionInfo.java
new file mode 100644
index 0000000..eb48d0e
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dao/CartridgeSubscriptionInfo.java
@@ -0,0 +1,200 @@
+/*
+ * 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.manager.dao;
+
+import org.apache.stratos.manager.repository.Repository;
+
+import java.util.List;
+
+public class CartridgeSubscriptionInfo {
+
+ 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;
+ private String subscriptionKey;
+
+ 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;
+ }
+
+ public String getSubscriptionKey() {
+ return subscriptionKey;
+ }
+
+ public void setSubscriptionKey(String subscriptionKey) {
+ this.subscriptionKey = subscriptionKey;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dao/Cluster.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dao/Cluster.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dao/Cluster.java
new file mode 100644
index 0000000..cd54868
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dao/Cluster.java
@@ -0,0 +1,77 @@
+package org.apache.stratos.manager.dao;
+
+import java.io.Serializable;
+
+public class Cluster implements Serializable {
+
+ private int id;
+ private String clusterDomain;
+ private String clusterSubDomain;
+ private String mgtClusterDomain;
+ private String mgtClusterSubDomain;
+ private String hostName;
+ private String serviceStatus;
+
+ public Cluster() {
+ }
+
+ public String getHostName() {
+ return hostName;
+ }
+
+ 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 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;
+ }
+
+ public void setHostName(String hostName) {
+ this.hostName = hostName;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getServiceStatus() {
+ return serviceStatus;
+ }
+
+ public void setServiceStatus(String serviceStatus) {
+ this.serviceStatus = serviceStatus;
+ }
+
+ public String toString () {
+ return clusterDomain;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dao/DataCartridge.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dao/DataCartridge.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dao/DataCartridge.java
new file mode 100644
index 0000000..d6fd2d8
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dao/DataCartridge.java
@@ -0,0 +1,62 @@
+/*
+ * 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.manager.dao;
+
+public class DataCartridge {
+
+ private int id;
+ private String dataCartridgeType;
+ private String host;
+ 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;
+ }
+
+ public String getHost() {
+ return host;
+ }
+
+ public void setHost(String host) {
+ this.host = host;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dao/PortMapping.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dao/PortMapping.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dao/PortMapping.java
new file mode 100644
index 0000000..d59913d
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dao/PortMapping.java
@@ -0,0 +1,59 @@
+/*
+ * 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.manager.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/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dao/RepositoryCredentials.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dao/RepositoryCredentials.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dao/RepositoryCredentials.java
new file mode 100644
index 0000000..5952f82
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dao/RepositoryCredentials.java
@@ -0,0 +1,48 @@
+package org.apache.stratos.manager.dao;
+/*
+ *
+ * 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.
+ *
+*/
+
+
+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/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/Service.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/Service.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/Service.java
new file mode 100644
index 0000000..6121931
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/Service.java
@@ -0,0 +1,138 @@
+/*
+ * 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.manager.deploy.service;
+
+import org.apache.stratos.manager.exception.ADCException;
+import org.apache.stratos.manager.exception.UnregisteredCartridgeException;
+import org.apache.stratos.manager.payload.PayloadData;
+import org.apache.stratos.manager.subscription.utils.CartridgeSubscriptionUtils;
+import org.apache.stratos.cloud.controller.pojo.CartridgeInfo;
+
+import java.io.Serializable;
+
+public abstract class Service implements Serializable {
+
+ private String type;
+ private String autoscalingPolicyName;
+ private String deploymentPolicyName;
+ private String tenantRange;
+ private String clusterId;
+ private String hostName;
+ private int tenantId;
+ private String subscriptionKey;
+ private CartridgeInfo cartridgeInfo;
+ private PayloadData payloadData;
+
+ public Service (String type, String autoscalingPolicyName, String deploymentPolicyName, int tenantId, CartridgeInfo cartridgeInfo,
+ String tenantRange) {
+
+ this.type = type;
+ this.autoscalingPolicyName = autoscalingPolicyName;
+ this.deploymentPolicyName = deploymentPolicyName;
+ this.tenantId = tenantId;
+ this.cartridgeInfo = cartridgeInfo;
+ this.tenantRange = tenantRange;
+ this.subscriptionKey = CartridgeSubscriptionUtils.generateSubscriptionKey();
+ }
+
+ public abstract void deploy () throws ADCException, UnregisteredCartridgeException;
+
+ public abstract void undeploy (String clusterId) throws ADCException;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getAutoscalingPolicyName() {
+ return autoscalingPolicyName;
+ }
+
+ public void setAutoscalingPolicyName(String autoscalingPolicyName) {
+ this.autoscalingPolicyName = autoscalingPolicyName;
+ }
+
+ public String getDeploymentPolicyName() {
+ return deploymentPolicyName;
+ }
+
+ public void setDeploymentPolicyName(String deploymentPolicyName) {
+ this.deploymentPolicyName = deploymentPolicyName;
+ }
+
+ public String getTenantRange() {
+ return tenantRange;
+ }
+
+ public void setTenantRange(String tenantRange) {
+ this.tenantRange = tenantRange;
+ }
+
+ public String getClusterId() {
+ return clusterId;
+ }
+
+ public void setClusterId(String clusterId) {
+ this.clusterId = clusterId;
+ }
+
+ public String getHostName() {
+ return hostName;
+ }
+
+ public void setHostName(String hostName) {
+ this.hostName = hostName;
+ }
+
+ public int getTenantId() {
+ return tenantId;
+ }
+
+ public void setTenantId(int tenantId) {
+ this.tenantId = tenantId;
+ }
+
+ public CartridgeInfo getCartridgeInfo() {
+ return cartridgeInfo;
+ }
+
+ public void setCartridgeInfo(CartridgeInfo cartridgeInfo) {
+ this.cartridgeInfo = cartridgeInfo;
+ }
+
+ public String getSubscriptionKey() {
+ return subscriptionKey;
+ }
+
+ public void setSubscriptionKey(String subscriptionKey) {
+ this.subscriptionKey = subscriptionKey;
+ }
+
+ public PayloadData getPayloadData() {
+ return payloadData;
+ }
+
+ public void setPayloadData(PayloadData payloadData) {
+ this.payloadData = payloadData;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/ServiceDeploymentManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/ServiceDeploymentManager.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/ServiceDeploymentManager.java
new file mode 100644
index 0000000..4610615
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/ServiceDeploymentManager.java
@@ -0,0 +1,330 @@
+/*
+ * 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.manager.deploy.service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.manager.client.AutoscalerServiceClient;
+import org.apache.stratos.manager.client.CloudControllerServiceClient;
+import org.apache.stratos.manager.deploy.service.multitenant.MultiTenantService;
+import org.apache.stratos.manager.exception.ADCException;
+import org.apache.stratos.manager.exception.UnregisteredCartridgeException;
+import org.apache.stratos.manager.manager.CartridgeSubscriptionManager;
+import org.apache.stratos.manager.payload.BasicPayloadData;
+import org.apache.stratos.manager.payload.PayloadData;
+import org.apache.stratos.manager.payload.PayloadFactory;
+import org.apache.stratos.manager.subscription.CartridgeSubscription;
+import org.apache.stratos.manager.subscription.utils.CartridgeSubscriptionUtils;
+import org.apache.stratos.manager.utils.CartridgeConstants;
+import org.apache.stratos.manager.utils.PersistenceManager;
+import org.apache.stratos.autoscaler.deployment.policy.DeploymentPolicy;
+import org.apache.stratos.cloud.controller.pojo.CartridgeInfo;
+import org.apache.stratos.cloud.controller.pojo.LoadbalancerConfig;
+import org.apache.stratos.cloud.controller.pojo.Properties;
+import org.apache.stratos.cloud.controller.pojo.Property;
+import org.apache.stratos.messaging.util.Constants;
+
+public class ServiceDeploymentManager {
+
+ private static Log log = LogFactory.getLog(ServiceDeploymentManager.class);
+ private CartridgeSubscriptionManager cartridgeSubsciptionManager = new CartridgeSubscriptionManager();
+
+ public Service deployService (String type, String autoscalingPolicyName, String deploymentPolicyName, int tenantId, String tenantRange,
+ String tenantDomain, String userName)
+ throws ADCException, UnregisteredCartridgeException {
+
+ //get deployed Cartridge Definition information
+ CartridgeInfo cartridgeInfo;
+ try {
+ cartridgeInfo = CloudControllerServiceClient.getServiceClient().getCartridgeInfo(type);
+
+ } catch (UnregisteredCartridgeException e) {
+ String message = type + " is not a valid cartridgeSubscription type. Please try again with a valid cartridgeSubscription type.";
+ log.error(message);
+ throw e;
+
+ } catch (Exception e) {
+ String message = "Error getting info for " + type;
+ log.error(message, e);
+ throw new ADCException(message, e);
+ }
+
+ if (!cartridgeInfo.getMultiTenant()) {
+ String errorMsg = "Cartridge definition with type " + type + " is not multitenant";
+ log.error(errorMsg);
+ throw new ADCException(errorMsg);
+ }
+
+
+ // TODO - LB cartridge.... ??
+
+ List<Property> lbRefProp = new ArrayList<Property>();
+
+ // get lb config reference
+ LoadbalancerConfig lbConfig = cartridgeInfo.getLbConfig();
+
+ if (lbConfig == null || lbConfig.getProperties() == null) {
+ if (log.isDebugEnabled()) {
+ log.debug("This Service does not require a load balancer. " + "[Service Name] " +
+ type);
+ }
+ } else {
+
+ CartridgeInfo lbCartridgeInfo;
+ String lbCartridgeType = lbConfig.getType();
+ try {
+ // retrieve lb Cartridge info
+ lbCartridgeInfo = CloudControllerServiceClient.getServiceClient().getCartridgeInfo(lbCartridgeType);
+ } catch (Exception e) {
+ String msg = "Cannot get cartridge info: " + type;
+ log.error(msg, e);
+ throw new ADCException(msg, e);
+ }
+
+ Properties lbReferenceProperties = lbConfig.getProperties();
+
+ Property property = new Property();
+ property.setName(org.apache.stratos.messaging.util.Constants.LOAD_BALANCER_REF);
+
+ for (org.apache.stratos.cloud.controller.pojo.Property prop : lbReferenceProperties.getProperties()) {
+
+ String name = prop.getName();
+ String value = prop.getValue();
+
+ // TODO make following a chain of responsibility pattern
+ if (Constants.NO_LOAD_BALANCER.equals(name)) {
+ if ("true".equals(value)) {
+ if (log.isDebugEnabled()) {
+ log.debug("This cartridge does not require a load balancer. " +
+ "[Type] " + type);
+ }
+ property.setValue(name);
+ lbRefProp.add(property);
+ break;
+ }
+ } else if (Constants.EXISTING_LOAD_BALANCERS.equals(name)) {
+ String clusterIdsVal = value;
+ if (log.isDebugEnabled()) {
+ log.debug("This cartridge refers to existing load balancers. " + "[Type] " +
+ type + "[Referenced Cluster Ids] " + clusterIdsVal);
+ }
+
+ String[] clusterIds = clusterIdsVal.split(",");
+
+ for (String clusterId : clusterIds) {
+
+ try {
+ AutoscalerServiceClient.getServiceClient().checkLBExistenceAgainstPolicy(clusterId,
+ deploymentPolicyName);
+ } catch (Exception ex) {
+ // we don't need to throw the error here.
+ log.error(ex.getMessage(), ex);
+ }
+
+ }
+
+ property.setValue(name);
+ lbRefProp.add(property);
+ break;
+
+ } else if (Constants.DEFAULT_LOAD_BALANCER.equals(name)) {
+ if ("true".equals(value)) {
+ property.setValue(name);
+ if (log.isDebugEnabled()) {
+ log.debug("This cartridge uses default load balancer. " + "[Type] " +
+ type);
+ }
+
+ try {
+ // get the valid policies for lb cartridge
+ DeploymentPolicy[] lbCartridgeDepPolicies =
+ AutoscalerServiceClient.getServiceClient().getDeploymentPolicies(lbCartridgeType);
+ // traverse deployment policies of lb cartridge
+ for (DeploymentPolicy policy : lbCartridgeDepPolicies) {
+ // check existence of the subscribed policy
+ if (deploymentPolicyName.equals(policy.getId())) {
+
+ if (!AutoscalerServiceClient.getServiceClient().checkDefaultLBExistenceAgainstPolicy(deploymentPolicyName)) {
+
+ // if lb cluster doesn't exist
+ String lbAlias = "lb" + new Random().nextInt();
+ lbCartridgeInfo.addProperties(property);
+ subscribeToLb(lbCartridgeType,
+ lbAlias,
+ lbCartridgeInfo.getDefaultAutoscalingPolicy(),
+ deploymentPolicyName, tenantId,
+ userName,
+ tenantDomain,
+ lbCartridgeInfo.getProperties());
+ }
+ }
+ }
+
+ } catch (Exception ex) {
+ // we don't need to throw the error here.
+ log.error(ex.getMessage(), ex);
+ }
+
+
+ lbRefProp.add(property);
+ break;
+ } else if (Constants.SERVICE_AWARE_LOAD_BALANCER.equals(name)) {
+ if ("true".equals(value)) {
+ property.setValue(name);
+ if (log.isDebugEnabled()) {
+ log.debug("This cartridge uses a service aware load balancer. " +
+ "[Type] " + type);
+ }
+
+ try {
+
+ // get the valid policies for lb cartridge
+ DeploymentPolicy[] lbCartridgeDepPolicies =
+ AutoscalerServiceClient.getServiceClient().getDeploymentPolicies(lbCartridgeType);
+ // traverse deployment policies of lb cartridge
+ for (DeploymentPolicy policy : lbCartridgeDepPolicies) {
+ // check existence of the subscribed policy
+ if (deploymentPolicyName.equals(policy.getId())) {
+
+ if (!AutoscalerServiceClient.getServiceClient().checkServiceLBExistenceAgainstPolicy(type,
+ deploymentPolicyName)) {
+
+ // if lb cluster doesn't exist
+ String lbAlias =
+ "lb" + type +
+ new Random().nextInt();
+ lbCartridgeInfo.addProperties(property);
+ subscribeToLb(lbCartridgeType,
+ lbAlias,
+ lbCartridgeInfo.getDefaultAutoscalingPolicy(),
+ deploymentPolicyName,
+ tenantId,
+ userName,
+ tenantDomain,
+ lbCartridgeInfo.getProperties());
+ }
+ }
+ }
+
+ } catch (Exception ex) {
+ // we don't need to throw the error here.
+ log.error(ex.getMessage(), ex);
+ }
+
+
+ lbRefProp.add(property);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+
+
+
+ Service service = new MultiTenantService(type, autoscalingPolicyName, deploymentPolicyName, tenantId, cartridgeInfo, tenantRange);
+
+ //generate the cluster ID (domain)for the service
+ service.setClusterId(type + "." + cartridgeInfo.getHostName() + ".domain");
+ //host name is the hostname defined in cartridge definition
+ service.setHostName(cartridgeInfo.getHostName());
+
+ //Create payload
+ BasicPayloadData basicPayloadData = CartridgeSubscriptionUtils.createBasicPayload(service);
+ //populate
+ basicPayloadData.populatePayload();
+ PayloadData payloadData = PayloadFactory.getPayloadDataInstance(cartridgeInfo.getProvider(),
+ cartridgeInfo.getType(), basicPayloadData);
+
+ // get the payload parameters defined in the cartridge definition file for this cartridge type
+ if (cartridgeInfo.getProperties() != null && cartridgeInfo.getProperties().length != 0) {
+
+ for (Property property : cartridgeInfo.getProperties()) {
+ // check if a property is related to the payload. Currently this is done by checking if the
+ // property name starts with 'payload_parameter.' suffix. If so the payload param name will
+ // be taken as the substring from the index of '.' to the end of the property name.
+ if (property.getName()
+ .startsWith(CartridgeConstants.CUSTOM_PAYLOAD_PARAM_NAME_PREFIX)) {
+ String payloadParamName = property.getName();
+ payloadData.add(payloadParamName.substring(payloadParamName.indexOf(".") + 1), property.getValue());
+ }
+ }
+ }
+
+ //set PayloadData instance
+ service.setPayloadData(payloadData);
+
+ //deploy the service
+ service.deploy();
+
+ //persist Service
+ try {
+ PersistenceManager.persistService(service);
+ } catch (Exception e) {
+ String message = "Error getting info for " + type;
+ log.error(message, e);
+ throw new ADCException(message, e);
+ }
+ return service;
+ }
+
+ public void undeployService (String clusterId) {
+
+ //TODO:
+ }
+
+ private void configureLBDeployment() {
+
+
+
+ }
+
+ private void subscribeToLb(String cartridgeType, String lbAlias,
+ String defaultAutoscalingPolicy, String deploymentPolicy,
+ int tenantId, String userName, String tenantDomain, Property[] props) throws ADCException {
+
+ try {
+ if(log.isDebugEnabled()) {
+ log.debug("Subscribing to a load balancer [cartridge] "+cartridgeType+" [alias] "+lbAlias);
+ }
+ CartridgeSubscription cartridgeSubscription =
+ cartridgeSubsciptionManager.subscribeToCartridgeWithProperties(cartridgeType, lbAlias.trim(), defaultAutoscalingPolicy,
+ deploymentPolicy,
+ tenantDomain,
+ tenantId,
+ userName, "git", null, false, null, null, props);
+
+ cartridgeSubsciptionManager.registerCartridgeSubscription(cartridgeSubscription);
+
+ if(log.isDebugEnabled()) {
+ log.debug("Successfully subscribed to a load balancer [cartridge] "+cartridgeType+" [alias] "+lbAlias);
+ }
+ } catch (Exception e) {
+ String msg = "Error while subscribing to load balancer cartridge [type] "+cartridgeType;
+ log.error(msg, e);
+ throw new ADCException(msg, e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/multitenant/MultiTenantService.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/multitenant/MultiTenantService.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/multitenant/MultiTenantService.java
new file mode 100644
index 0000000..629f34a
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/deploy/service/multitenant/MultiTenantService.java
@@ -0,0 +1,53 @@
+/*
+ * 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.manager.deploy.service.multitenant;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.manager.deploy.service.Service;
+import org.apache.stratos.manager.exception.ADCException;
+import org.apache.stratos.manager.exception.UnregisteredCartridgeException;
+import org.apache.stratos.manager.utils.ApplicationManagementUtil;
+import org.apache.stratos.manager.utils.CartridgeConstants;
+import org.apache.stratos.cloud.controller.pojo.CartridgeInfo;
+
+public class MultiTenantService extends Service {
+
+ private static Log log = LogFactory.getLog(MultiTenantService.class);
+
+ public MultiTenantService (String type, String autoscalingPolicyName, String deploymentPolicyName, int tenantId, CartridgeInfo cartridgeInfo,
+ String tenantRange) {
+ super(type, autoscalingPolicyName, deploymentPolicyName, tenantId, cartridgeInfo, tenantRange);
+ }
+
+ @Override
+ public void deploy() throws ADCException, UnregisteredCartridgeException {
+
+ //register the service
+ ApplicationManagementUtil.registerService(getType(), getClusterId(), CartridgeConstants.DEFAULT_SUBDOMAIN,
+ getPayloadData().getCompletePayloadData(), getTenantRange(), getHostName(), getAutoscalingPolicyName(),
+ getDeploymentPolicyName(), null);
+ }
+
+ @Override
+ public void undeploy(String clusterId) throws ADCException {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dns/DNSManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dns/DNSManager.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dns/DNSManager.java
new file mode 100644
index 0000000..d97d4f8
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dns/DNSManager.java
@@ -0,0 +1,89 @@
+// /*
+// * 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.manager.dns;
+//
+//import org.apache.commons.logging.Log;
+//import org.apache.commons.logging.LogFactory;
+//import org.apache.stratos.manager.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/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/domain/RegistryManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/domain/RegistryManager.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/domain/RegistryManager.java
new file mode 100644
index 0000000..f7842bb
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/domain/RegistryManager.java
@@ -0,0 +1,109 @@
+///*
+// * 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.manager.domain;
+//
+//import org.apache.commons.logging.Log;
+//import org.apache.commons.logging.LogFactory;
+//import org.apache.stratos.manager.exception.ADCException;
+//import org.apache.stratos.manager.exception.DomainMappingExistsException;
+//import org.apache.stratos.manager.internal.DataHolder;
+//import org.apache.stratos.manager.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.getRegistryService();
+//
+// 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/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/AppRepo.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/AppRepo.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/AppRepo.java
new file mode 100644
index 0000000..13df2cc
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/AppRepo.java
@@ -0,0 +1,88 @@
+///*
+// * 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.manager.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/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/Cartridge.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/Cartridge.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/Cartridge.java
new file mode 100644
index 0000000..08736ec
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/Cartridge.java
@@ -0,0 +1,202 @@
+/*
+ * 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.manager.dto;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+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/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/CartridgeDetail.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/CartridgeDetail.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/CartridgeDetail.java
new file mode 100644
index 0000000..6e2b601
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/CartridgeDetail.java
@@ -0,0 +1,22 @@
+package org.apache.stratos.manager.dto;
+/*
+ *
+ * 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.
+ *
+*/
+
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/CartridgeInformation.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/CartridgeInformation.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/CartridgeInformation.java
new file mode 100644
index 0000000..6e2b601
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/CartridgeInformation.java
@@ -0,0 +1,22 @@
+package org.apache.stratos.manager.dto;
+/*
+ *
+ * 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.
+ *
+*/
+
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/CartridgeWrapper.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/CartridgeWrapper.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/CartridgeWrapper.java
new file mode 100644
index 0000000..fd73312
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/CartridgeWrapper.java
@@ -0,0 +1,52 @@
+/*
+ * 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.manager.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/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/Policy.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/Policy.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/Policy.java
new file mode 100644
index 0000000..19493a5
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/Policy.java
@@ -0,0 +1,148 @@
+/*
+ * 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.manager.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/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/PolicyDefinition.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/PolicyDefinition.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/PolicyDefinition.java
new file mode 100644
index 0000000..fccc62e
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/PolicyDefinition.java
@@ -0,0 +1,83 @@
+/*
+ * 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.manager.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/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/RepositoryInformation.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/RepositoryInformation.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/RepositoryInformation.java
new file mode 100644
index 0000000..b3d029d
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/RepositoryInformation.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.stratos.manager.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/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/SubscriptionInfo.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/SubscriptionInfo.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/SubscriptionInfo.java
new file mode 100644
index 0000000..cb83ee2
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/dto/SubscriptionInfo.java
@@ -0,0 +1,48 @@
+/*
+ * 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.manager.dto;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+
+@XmlRootElement
+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/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/ADCException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/ADCException.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/ADCException.java
new file mode 100644
index 0000000..5fb1e75
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/ADCException.java
@@ -0,0 +1,49 @@
+/*
+ * 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.manager.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/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/AlreadySubscribedException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/AlreadySubscribedException.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/AlreadySubscribedException.java
new file mode 100644
index 0000000..32786b9
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/AlreadySubscribedException.java
@@ -0,0 +1,48 @@
+/*
+ * 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.manager.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/9d280533/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/DomainMappingExistsException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/DomainMappingExistsException.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/DomainMappingExistsException.java
new file mode 100644
index 0000000..544f6b7
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/exception/DomainMappingExistsException.java
@@ -0,0 +1,48 @@
+/*
+ * 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.manager.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;
+ }
+}