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/05 12:32:43 UTC
[06/34] adding changes to adc components
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4f217859/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/dto/PolicyDefinition.java
----------------------------------------------------------------------
diff --git a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/dto/PolicyDefinition.java b/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/dto/PolicyDefinition.java
deleted file mode 100644
index b21df4f..0000000
--- a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/dto/PolicyDefinition.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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/4f217859/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/dto/RepositoryInformation.java
----------------------------------------------------------------------
diff --git a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/dto/RepositoryInformation.java b/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/dto/RepositoryInformation.java
deleted file mode 100644
index 3a88700..0000000
--- a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/dto/RepositoryInformation.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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/4f217859/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/dto/SubscriptionInfo.java
----------------------------------------------------------------------
diff --git a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/dto/SubscriptionInfo.java b/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/dto/SubscriptionInfo.java
deleted file mode 100644
index 39e3ae2..0000000
--- a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/dto/SubscriptionInfo.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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/4f217859/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/ADCException.java
----------------------------------------------------------------------
diff --git a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/ADCException.java b/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/ADCException.java
deleted file mode 100644
index d9dbfdf..0000000
--- a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/ADCException.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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/4f217859/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/AlreadySubscribedException.java
----------------------------------------------------------------------
diff --git a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/AlreadySubscribedException.java b/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/AlreadySubscribedException.java
deleted file mode 100644
index 954a71b..0000000
--- a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/AlreadySubscribedException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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/4f217859/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/DomainMappingExistsException.java
----------------------------------------------------------------------
diff --git a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/DomainMappingExistsException.java b/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/DomainMappingExistsException.java
deleted file mode 100644
index 9287a86..0000000
--- a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/DomainMappingExistsException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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/4f217859/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/DuplicateCartridgeAliasException.java
----------------------------------------------------------------------
diff --git a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/DuplicateCartridgeAliasException.java b/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/DuplicateCartridgeAliasException.java
deleted file mode 100644
index 94aa14c..0000000
--- a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/DuplicateCartridgeAliasException.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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/4f217859/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/InvalidCartridgeAliasException.java
----------------------------------------------------------------------
diff --git a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/InvalidCartridgeAliasException.java b/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/InvalidCartridgeAliasException.java
deleted file mode 100644
index 0fed41b..0000000
--- a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/InvalidCartridgeAliasException.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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/4f217859/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/InvalidRepositoryException.java
----------------------------------------------------------------------
diff --git a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/InvalidRepositoryException.java b/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/InvalidRepositoryException.java
deleted file mode 100644
index c545b9e..0000000
--- a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/InvalidRepositoryException.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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/4f217859/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/NotSubscribedException.java
----------------------------------------------------------------------
diff --git a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/NotSubscribedException.java b/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/NotSubscribedException.java
deleted file mode 100644
index 74aef20..0000000
--- a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/NotSubscribedException.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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/4f217859/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/PolicyException.java
----------------------------------------------------------------------
diff --git a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/PolicyException.java b/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/PolicyException.java
deleted file mode 100644
index 2ad3117..0000000
--- a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/PolicyException.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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/4f217859/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/RepositoryCredentialsRequiredException.java
----------------------------------------------------------------------
diff --git a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/RepositoryCredentialsRequiredException.java b/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/RepositoryCredentialsRequiredException.java
deleted file mode 100644
index 2de1899..0000000
--- a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/RepositoryCredentialsRequiredException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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/4f217859/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/RepositoryRequiredException.java
----------------------------------------------------------------------
diff --git a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/RepositoryRequiredException.java b/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/RepositoryRequiredException.java
deleted file mode 100644
index 553dfc2..0000000
--- a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/RepositoryRequiredException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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/4f217859/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/RepositoryTransportException.java
----------------------------------------------------------------------
diff --git a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/RepositoryTransportException.java b/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/RepositoryTransportException.java
deleted file mode 100644
index 5b5036a..0000000
--- a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/RepositoryTransportException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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/4f217859/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/UnregisteredCartridgeException.java
----------------------------------------------------------------------
diff --git a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/UnregisteredCartridgeException.java b/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/UnregisteredCartridgeException.java
deleted file mode 100644
index fb1f656..0000000
--- a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/exception/UnregisteredCartridgeException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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/4f217859/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/internal/ADCManagementServerComponent.java
----------------------------------------------------------------------
diff --git a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/internal/ADCManagementServerComponent.java b/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/internal/ADCManagementServerComponent.java
deleted file mode 100644
index e70f9d4..0000000
--- a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/internal/ADCManagementServerComponent.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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.wso2.carbon.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.wso2.carbon.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/4f217859/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/internal/DataHolder.java
----------------------------------------------------------------------
diff --git a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/internal/DataHolder.java b/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/internal/DataHolder.java
deleted file mode 100644
index 2d810cf..0000000
--- a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/internal/DataHolder.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.wso2.carbon.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;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4f217859/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/internal/HostingConstants.java
----------------------------------------------------------------------
diff --git a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/internal/HostingConstants.java b/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/internal/HostingConstants.java
deleted file mode 100644
index 9259ea6..0000000
--- a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/internal/HostingConstants.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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;
-
-/**
- * Web Application Constants
- */
-public final class HostingConstants {
- public static final String WEBAPP_PREFIX = "webapps";
- public static final String WEBAPP_DEPLOYMENT_FOLDER = "webapps";
- public static final String WEBAPP_EXTENSION = "war";
-
- public static final class WebappState {
- public static final String STARTED = "started";
- public static final String STOPPED = "stopped";
-
- private WebappState() {
- }
- }
-
- private HostingConstants() {
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4f217859/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/internal/HostingManagementActivator.java
----------------------------------------------------------------------
diff --git a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/internal/HostingManagementActivator.java b/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/internal/HostingManagementActivator.java
deleted file mode 100644
index 2e61894..0000000
--- a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/internal/HostingManagementActivator.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.wso2.carbon.utils.CarbonUtils;
-
-/**
- * Activator for the Webapp Management Bundle
- */
-public class HostingManagementActivator implements BundleActivator {
- private static final Log log = LogFactory.getLog(HostingManagementActivator.class);
-
- @Override
- public void start(final BundleContext bundleContext) {
-
- // If Carbon is running as a webapp within some other servlet container,
- // then we should
- // uninstall this component
- if (!CarbonUtils.isRunningInStandaloneMode()) {
- Thread th = new Thread() {
- @Override
- public void run() {
- try {
- bundleContext.getBundle().uninstall();
- } catch (Throwable e) {
- log.warn("Error occurred while uninstalling hosting.mgt UI bundle", e);
- }
- }
- };
- try {
- th.join();
- } catch (InterruptedException ignored) {
- }
- th.start();
- }
- }
-
- @Override
- public void stop(BundleContext bundleContext) {
- // No implementation required for this method
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4f217859/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/service/ApplicationManagementService.java
----------------------------------------------------------------------
diff --git a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/service/ApplicationManagementService.java b/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/service/ApplicationManagementService.java
deleted file mode 100644
index 1ae1a87..0000000
--- a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/service/ApplicationManagementService.java
+++ /dev/null
@@ -1,620 +0,0 @@
-/*
- * 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.service;
-
-import org.apache.axis2.AxisFault;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.adc.mgt.custom.domain.RegistryManager;
-import org.apache.stratos.adc.mgt.dao.CartridgeSubscription;
-import org.apache.stratos.adc.mgt.dns.DNSManager;
-import org.apache.stratos.adc.mgt.dto.Cartridge;
-import org.apache.stratos.adc.mgt.dto.CartridgeWrapper;
-import org.apache.stratos.adc.mgt.dto.PolicyDefinition;
-import org.apache.stratos.adc.mgt.dto.RepositoryInformation;
-import org.apache.stratos.adc.mgt.dto.SubscriptionInfo;
-import org.apache.stratos.adc.mgt.exception.*;
-import org.apache.stratos.adc.mgt.internal.DataHolder;
-import org.apache.stratos.adc.mgt.utils.*;
-import org.wso2.carbon.adc.topology.mgt.service.TopologyManagementService;
-import org.wso2.carbon.context.PrivilegedCarbonContext;
-import org.wso2.carbon.core.AbstractAdmin;
-import org.wso2.carbon.registry.core.exceptions.RegistryException;
-import org.wso2.carbon.stratos.cloud.controller.util.xsd.CartridgeInfo;
-import org.wso2.carbon.utils.DataPaginator;
-import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.regex.Pattern;
-
-/**
- *
- *
- *
- */
-public class ApplicationManagementService extends AbstractAdmin {
-
-
- private static final Log log = LogFactory.getLog(ApplicationManagementService.class);
- RegistryManager registryManager = new RegistryManager();
-
- PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext();
- String tenantDomain = carbonContext.getTenantDomain();
-
- /*
- * Instantiate RepoNotificationService. Since this service is in the same
- * component (org.apache.stratos.adc.mgt), a new object is created.
- * TODO: Is there a better way to get this service?
- */
- private RepoNotificationService repoNotificationService = new RepoNotificationService();
-
- /**
- * Get Available Cartridges
- *
- * @return Available Cartridges
- */
- public Cartridge[] getAvailableCartridges(boolean multiTenant) throws ADCException {
- List<Cartridge> cartridges = getAvailableCartridges(null, multiTenant);
- // Following is very important when working with axis2
- return cartridges.isEmpty() ? new Cartridge[0] : cartridges.toArray(new Cartridge[cartridges.size()]);
- }
-
- /**
- * Get Subscribed Cartridges
- *
- * @return Subscribed Cartridges
- */
- public Cartridge[] getSubscribedCartridges() throws ADCException {
- checkSuperTenant();
- List<Cartridge> cartridgeList = getSubscribedCartridges(null);
- // Following is very important when working with axis2
- return cartridgeList.isEmpty() ? new Cartridge[0] : cartridgeList.toArray(new Cartridge[cartridgeList.size()]);
- }
-
- /**
- * Get available cartridges
- */
- public CartridgeWrapper getPagedAvailableCartridges(String cartridgeSearchString, int pageNumber, boolean multiTenant)
- throws ADCException {
- checkSuperTenant();
- CartridgeWrapper cartridgeWrapper = new CartridgeWrapper();
- List<Cartridge> cartridges = getAvailableCartridges(cartridgeSearchString, multiTenant);
-
- // TODO Improve pagination
- if (!cartridges.isEmpty()) {
- // Paginate only if cartridges are there.
- DataPaginator.doPaging(pageNumber, cartridges, cartridgeWrapper);
- } else {
- // Must set this value as axis2 stub client will return an array
- // with length = 1 and null element if cartridges[] is null
- cartridgeWrapper.set(cartridges);
- }
- return cartridgeWrapper;
- }
-
- private List<Cartridge> getAvailableCartridges(String cartridgeSearchString, Boolean multiTenant) throws ADCException {
- List<Cartridge> cartridges = new ArrayList<Cartridge>();
-
- if (log.isDebugEnabled()) {
- log.debug("Getting available cartridges. Search String: " + cartridgeSearchString + ", Multi-Tenant: " + multiTenant);
- }
-
- boolean allowMultipleSubscription = new Boolean(
- System.getProperty(CartridgeConstants.FEATURE_MULTI_TENANT_MULTIPLE_SUBSCRIPTION_ENABLED));
-
- try {
- Pattern searchPattern = getSearchStringPattern(cartridgeSearchString);
-
- String[] availableCartridges = ApplicationManagementUtil.getServiceClient().getRegisteredCartridges();
-
- if (availableCartridges != null) {
- for (String cartridgeType : availableCartridges) {
- CartridgeInfo cartridgeInfo = null;
- try {
- cartridgeInfo = ApplicationManagementUtil.getServiceClient().getCartridgeInfo(cartridgeType);
- } catch (Exception e) {
- if (log.isWarnEnabled()) {
- log.warn("Error when calling getCartridgeInfo for " + cartridgeType + ", Error: "
- + e.getMessage());
- }
- }
- if (cartridgeInfo == null) {
- // This cannot happen. But continue
- if (log.isDebugEnabled()) {
- log.debug("Cartridge Info not found: " + cartridgeType);
- }
- continue;
- }
-
- if (multiTenant != null && !multiTenant && cartridgeInfo.getMultiTenant()) {
- // Need only Single-Tenant cartridges
- continue;
- } else if (multiTenant != null && multiTenant && !cartridgeInfo.getMultiTenant()) {
- // Need only Multi-Tenant cartridges
- continue;
- }
-
- if (!cartridgeMatches(cartridgeInfo, searchPattern)) {
- continue;
- }
-
- Cartridge cartridge = new Cartridge();
- cartridge.setCartridgeType(cartridgeType);
- cartridge.setProvider(cartridgeInfo.getProvider());
- cartridge.setDisplayName(cartridgeInfo.getDisplayName());
- cartridge.setDescription(cartridgeInfo.getDescription());
- cartridge.setVersion(cartridgeInfo.getVersion());
- cartridge.setMultiTenant(cartridgeInfo.getMultiTenant());
- cartridge.setStatus(CartridgeConstants.NOT_SUBSCRIBED);
- cartridge.setCartridgeAlias("-");
- cartridge.setActiveInstances(0);
- cartridges.add(cartridge);
-
- if (cartridgeInfo.getMultiTenant() && !allowMultipleSubscription) {
- // If the cartridge is multi-tenant. We should not let users
- // subscribe twice.
- if (PersistenceManager.isAlreadySubscribed(cartridgeType,
- ApplicationManagementUtil.getTenantId(getConfigContext()))) {
- if (log.isDebugEnabled()) {
- log.debug("Already subscribed to " + cartridgeType
- + ". This multi-tenant cartridge will not be available to subscribe");
- }
- cartridge.setStatus(CartridgeConstants.SUBSCRIBED);
- }
- }
- }
- } else {
- if (log.isDebugEnabled()) {
- log.debug("There are no available cartridges");
- }
- }
- } catch (Exception e) {
- String msg = "Error when getting available cartridges. " + e.getMessage();
- log.error(msg, e);
- throw new ADCException("An error occurred getting available cartridges ", e);
- }
-
- Collections.sort(cartridges);
-
- if (log.isDebugEnabled()) {
- log.debug("Returning available cartridges " + cartridges.size());
- }
-
- return cartridges;
- }
-
- /**
- * Get subscribed cartridges
- */
- public CartridgeWrapper getPagedSubscribedCartridges(String cartridgeSearchString, int pageNumber)
- throws ADCException {
- checkSuperTenant();
- CartridgeWrapper cartridgeWrapper = new CartridgeWrapper();
- List<Cartridge> cartridges = getSubscribedCartridges(cartridgeSearchString);
-
- // TODO Improve pagination
- if (!cartridges.isEmpty()) {
- // Paginate only if cartridges are there.
- DataPaginator.doPaging(pageNumber, cartridges, cartridgeWrapper);
- } else {
- cartridgeWrapper.set(cartridges);
- }
- return cartridgeWrapper;
- }
-
- private List<Cartridge> getSubscribedCartridges(String cartridgeSearchString) throws ADCException {
- List<Cartridge> cartridges = new ArrayList<Cartridge>();
-
- if (log.isDebugEnabled()) {
- log.debug("Getting subscribed cartridges. Search String: " + cartridgeSearchString);
- }
-
- try {
- Pattern searchPattern = getSearchStringPattern(cartridgeSearchString);
-
- List<CartridgeSubscription> subscriptionList = PersistenceManager
- .retrieveSubscribedCartridges(ApplicationManagementUtil.getTenantId(getConfigContext()));
-
- if (subscriptionList != null && !subscriptionList.isEmpty()) {
- for (CartridgeSubscription subscription : subscriptionList) {
- CartridgeInfo cartridgeInfo = null;
- try {
- cartridgeInfo = ApplicationManagementUtil.getServiceClient().getCartridgeInfo(
- subscription.getCartridge());
- } catch (Exception e) {
- if (log.isWarnEnabled()) {
- log.warn("Error when calling getCartridgeInfo for " + subscription.getCartridge()
- + ", Error: " + e.getMessage());
- }
- }
- if (cartridgeInfo == null) {
- // This cannot happen. But continue
- if (log.isDebugEnabled()) {
- log.debug("Cartridge Info not found: " + subscription.getCartridge());
- }
- continue;
- }
- if (!cartridgeMatches(cartridgeInfo, subscription, searchPattern)) {
- continue;
- }
- TopologyManagementService topologyMgtService = DataHolder.getTopologyMgtService();
- String[] ips = topologyMgtService.getActiveIPs(subscription.getCartridge(),
- subscription.getClusterDomain(), subscription.getClusterSubdomain());
- Cartridge cartridge = ApplicationManagementUtil.populateCartridgeInfo(cartridgeInfo, subscription, ips, tenantDomain);
- cartridges.add(cartridge);
- }
- } else {
- if (log.isDebugEnabled()) {
- log.debug("There are no subscribed cartridges");
- }
- }
- } catch (Exception e) {
- String msg = "Error when getting subscribed cartridges. " + e.getMessage();
- log.error(msg, e);
- throw new ADCException("An Error occurred when getting subscribed cartridges.", e);
- }
-
- Collections.sort(cartridges);
-
- if (log.isDebugEnabled()) {
- log.debug("Returning subscribed cartridges " + cartridges.size());
- }
-
- return cartridges;
- }
-
- private Pattern getSearchStringPattern(String searchString) {
- if (log.isDebugEnabled()) {
- log.debug("Creating search pattern for " + searchString);
- }
- if (searchString != null) {
- // Copied from org.wso2.carbon.webapp.mgt.WebappAdmin.doesWebappSatisfySearchString(WebApplication, String)
- String regex = searchString.toLowerCase().replace("..?", ".?").replace("..*", ".*").replaceAll("\\?", ".?")
- .replaceAll("\\*", ".*?");
- if (log.isDebugEnabled()) {
- log.debug("Created regex: " + regex + " for search string " + searchString);
- }
-
- Pattern pattern = Pattern.compile(regex);
- return pattern;
- }
- return null;
- }
-
- // TODO: Improve search method
- private boolean cartridgeMatches(CartridgeInfo cartridgeInfo, Pattern pattern) {
- if (pattern != null) {
- boolean matches = false;
- if (cartridgeInfo.getDisplayName() != null) {
- matches = pattern.matcher(cartridgeInfo.getDisplayName().toLowerCase()).find();
- }
- if (!matches && cartridgeInfo.getDescription() != null) {
- matches = pattern.matcher(cartridgeInfo.getDescription().toLowerCase()).find();
- }
- return matches;
- }
- return true;
- }
-
- private boolean cartridgeMatches(CartridgeInfo cartridgeInfo, CartridgeSubscription cartridgeSubscription, Pattern pattern) {
- if (pattern != null) {
- boolean matches = false;
- if (cartridgeInfo.getDisplayName() != null) {
- matches = pattern.matcher(cartridgeInfo.getDisplayName().toLowerCase()).find();
- }
- if (!matches && cartridgeInfo.getDescription() != null) {
- matches = pattern.matcher(cartridgeInfo.getDescription().toLowerCase()).find();
- }
- if (!matches && cartridgeSubscription.getCartridge() != null) {
- matches = pattern.matcher(cartridgeSubscription.getCartridge().toLowerCase()).find();
- }
- if (!matches && cartridgeSubscription.getAlias() != null) {
- matches = pattern.matcher(cartridgeSubscription.getAlias().toLowerCase()).find();
- }
- return matches;
- }
- return true;
- }
-
- public Cartridge getCartridgeInfo(String alias) throws ADCException, NotSubscribedException {
- checkSuperTenant();
- return ApplicationManagementUtil.getCartridgeInfo(alias, getTenantDomain());
- }
-
- public String[] getSubscribedCartridgeAliases() throws AxisFault {
- try {
- List<CartridgeSubscription> subscriptionList = PersistenceManager
- .retrieveSubscribedCartridges(ApplicationManagementUtil.getTenantId(getConfigContext()));
- List<String> subscribedAliases = new ArrayList<String>();
- for (CartridgeSubscription cartridgeSubscription : subscriptionList) {
-
- if(cartridgeSubscription.getProvider().equalsIgnoreCase(CartridgeConstants.PROVIDER_NAME_WSO2) &&
- getCartridgeInfo(cartridgeSubscription.getAlias()).isMultiTenant()) {
-
- subscribedAliases.add(cartridgeSubscription.getCartridge());
- } else {
- subscribedAliases.add(cartridgeSubscription.getAlias());
- }
- }
- if(subscribedAliases.size() == 0) {
- return new String[]{""};
- } else {
- return subscribedAliases.toArray(new String[subscribedAliases.size()]);
- }
-
- } catch (Exception e) {
- String msg = "Exception in getting subscribed cartridge aliases :" + e.getMessage();
- log.error(msg, e);
- throw new AxisFault("An error occurred while getting subscribed cartridge aliases", e);
- }
- }
-
- public PolicyDefinition[] getPolicyDefinitions() {
- List<PolicyDefinition> policyDefinitions = PolicyHolder.getInstance().getPolicyDefinitions();
- return policyDefinitions == null || policyDefinitions.isEmpty() ? new PolicyDefinition[0] : policyDefinitions
- .toArray(new PolicyDefinition[policyDefinitions.size()]);
- }
-
- /**
- * Subscribe to a cartridge
- */
- public SubscriptionInfo subscribe(String cartridgeType, String alias, String policy, String repoURL,
- boolean privateRepo, String repoUsername, String repoPassword, String dataCartridgeType,
- String dataCartridgeAlias) throws ADCException, PolicyException, UnregisteredCartridgeException,
- InvalidCartridgeAliasException, DuplicateCartridgeAliasException, RepositoryRequiredException,
- AlreadySubscribedException, RepositoryCredentialsRequiredException, InvalidRepositoryException,
- RepositoryTransportException {
-
- checkSuperTenant();
-
- return ApplicationManagementUtil.doSubscribe(cartridgeType, alias, policy, repoURL, privateRepo, repoUsername,
- repoPassword, dataCartridgeType, dataCartridgeAlias, getUsername(),
- ApplicationManagementUtil.getTenantId(getConfigContext()), getTenantDomain());
-
- }
-
-
- /**
- * Unsubscribing the cartridge
- *
- * @param alias name of the cartridge to be unsubscribed
- */
- public void unsubscribe(String alias) throws ADCException, NotSubscribedException {
- checkSuperTenant();
- CartridgeSubscription subscription = null;
-
- try {
- subscription = PersistenceManager.getSubscription(tenantDomain, alias);
- } catch (Exception e) {
- String msg = "Failed to get subscription for " + tenantDomain + " and alias " + alias;
- log.error(msg, e);
- throw new ADCException(msg, e);
- }
-
- if (subscription == null) {
- String msg = "Tenant " + tenantDomain + " is not subscribed for " + alias;
- log.error(msg);
- throw new NotSubscribedException("You have not subscribed for " + alias, alias);
- }
-
- try {
- String clusterDomain = subscription.getClusterDomain();
- String clusterSubDomain = subscription.getClusterSubdomain();
-
- if (log.isDebugEnabled()) {
- log.debug("Finding cartridge information for " + subscription.getCartridge());
- }
- CartridgeInfo cartridgeInfo = ApplicationManagementUtil.getServiceClient().getCartridgeInfo(subscription.getCartridge());
- if (log.isDebugEnabled()) {
- log.debug("Found " + cartridgeInfo.getDisplayName() + " for " + subscription.getCartridge());
- }
- if (!cartridgeInfo.getMultiTenant()) {
- log.info("Terminating all instances of " + clusterDomain + " " + clusterSubDomain);
- ApplicationManagementUtil.getServiceClient().terminateAllInstances(clusterDomain, clusterSubDomain);
- log.info("All instances terminated.");
- log.info("Unregistering services...");
- ApplicationManagementUtil.getServiceClient().unregisterService(clusterDomain, clusterSubDomain);
- log.info("Successfully terminated instances ..");
- } else {
- if (log.isInfoEnabled()) {
- log.info("Cartridge "
- + subscription.getCartridge()
- + " is a multi-tenant cartridge and therefore will not terminate all instances and unregister services");
- }
- }
-
- new RepositoryFactory().destroyRepository(alias, tenantDomain, getUsername());
- log.info("Repo is destroyed successfully.. ");
-
- PersistenceManager.updateSubscriptionState(subscription.getSubscriptionId(), "UNSUBSCRIBED");
- new DNSManager().removeSubDomain(subscription.getHostName());
- registryManager.removeDomainMappingFromRegistry(subscription.getHostName());
- TopologyManagementService topologyMgtService = DataHolder.getTopologyMgtService();
-
- String[] ips = topologyMgtService.getActiveIPs(subscription.getCartridge(),
- subscription.getClusterDomain(), subscription.getClusterSubdomain());
- PersistenceManager.updateInstanceState("INACTIVE", ips, subscription.getClusterDomain(), subscription.getClusterSubdomain(), subscription.getCartridge());
-
- } catch (ADCException e) {
- log.error(e.getMessage(), e);
- throw e;
- } catch (Exception e1) {
- String msg1 = "Exception occurred :" + e1.getMessage();
- log.error(msg1);
- throw new ADCException("Unsubscribe failed for cartridge " + alias, e1);
- }
- }
-
-
- public String addDomainMapping(String mappedDomain, String cartridgeAlias) throws ADCException, DomainMappingExistsException, NotSubscribedException {
- checkSuperTenant();
- // TODO Following was in CLI. Fix this
- // if (domain.indexOf('.') == -1) {
- // System.out.println("\nOwn domain should include a '.' ");
- // }
-
- CartridgeSubscription subscription = null;
- String actualHost = null;
-
- try {
- subscription = PersistenceManager.getSubscription(tenantDomain, cartridgeAlias);
- } catch (Exception e) {
- String msg = "Failed to get subscription for " + tenantDomain + " and alias " + cartridgeAlias;
- log.error(msg, e);
- throw new ADCException(msg, e);
- }
- if (subscription == null) {
- String msg = "Tenant " + tenantDomain + " is not subscribed for " + cartridgeAlias;
- log.error(msg);
- throw new NotSubscribedException("You have not subscribed for " + cartridgeAlias, cartridgeAlias);
- }
-
- try {
- actualHost = getActualHost(cartridgeAlias);
- registryManager.addDomainMappingToRegistry(mappedDomain, actualHost);
- log.info("Domain mapping is added for " + mappedDomain + " tenant: " + tenantDomain);
- PersistenceManager.updateDomainMapping(
- ApplicationManagementUtil.getTenantId(getConfigContext()), cartridgeAlias, mappedDomain);
- } catch (RegistryException e) {
- String msg = "Unable to add the mapping due to registry transaction error";
- log.error(msg, e);
- throw new ADCException("Unable to add the mapping due to internal error!", e);
- } catch (DomainMappingExistsException e) {
- String msg = "Domain mapping already exists.";
- log.error(msg, e);
- throw e;
- } catch (Exception e) {
- String msg = "Error occurred. Reason : " + e.getMessage();
- log.error(msg, e);
- throw new ADCException(msg, e);
- }
- return actualHost;
- }
-
- private String getActualHost(String cartridgeName) throws Exception {
- return PersistenceManager.getHostNameForCartridgeName(
- ApplicationManagementUtil.getTenantId(getConfigContext()), cartridgeName);
- }
-
- public void removeDomainMapping(String cartridgeAlias) throws ADCException, NotSubscribedException {
- checkSuperTenant();
- CartridgeSubscription subscription = null;
- String actualHost = null;
-
- try {
- subscription = PersistenceManager.getSubscription(tenantDomain, cartridgeAlias);
- } catch (Exception e) {
- String msg = "Failed to get subscription for " + tenantDomain + " and alias " + cartridgeAlias;
- log.error(msg, e);
- throw new ADCException(msg, e);
- }
- if (subscription == null) {
- String msg = "Tenant " + tenantDomain + " is not subscribed for " + cartridgeAlias;
- log.error(msg);
- throw new NotSubscribedException("You have not subscribed for " + cartridgeAlias, cartridgeAlias);
- }
-
- try {
- actualHost = getActualHost(cartridgeAlias);
- registryManager.removeDomainMappingFromRegistry(actualHost);
- log.info("Domain mapping is removed for " + actualHost + " tenant: " + tenantDomain);
- PersistenceManager.updateDomainMapping(ApplicationManagementUtil.getTenantId(getConfigContext()),
- cartridgeAlias, null);
- } catch (RegistryException e) {
- String msg = "Unable to remove the mapping due to registry transaction error";
- log.error(msg, e);
- throw new ADCException("Unable to remove the mapping due to internal error!", e);
- } catch (Exception e) {
- String msg = "Error occurred. Reason : " + e.getMessage();
- log.error(msg, e);
- throw new ADCException(msg, e);
- }
- }
-
- public void synchronizeRepository(String cartridgeAlias) throws ADCException, NotSubscribedException {
- checkSuperTenant();
- CartridgeSubscription subscription = null;
-
- // Validating subscription
- try {
- subscription = PersistenceManager.getSubscription(tenantDomain, cartridgeAlias);
- } catch (Exception e) {
- String msg = "Failed to get subscription for " + tenantDomain + " and alias " + cartridgeAlias;
- log.error(msg, e);
- throw new ADCException(msg, e);
- }
- if (subscription == null) {
- String msg = "Tenant " + tenantDomain + " is not subscribed for " + cartridgeAlias;
- log.error(msg);
- throw new NotSubscribedException("You have not subscribed for " + cartridgeAlias, cartridgeAlias);
- }
-
- try {
- repoNotificationService.notifyRepoUpdate(tenantDomain, cartridgeAlias);
- } catch (Exception e) {
- throw new ADCException(e.getMessage() != null ? e.getMessage() : "Failed to synchronize repository", e);
- }
- }
-
- /**
- * Validate authentication.
- * First call of cli tool in the prompt mode after log in.
- *
- * @return The tenant domain
- */
- public String getTenantDomain() {
- if (tenantDomain != null) {
- // This means, authentication is successful
- log.info("Tenant " + tenantDomain + " is authorized to access Application Management Service!");
- }
- return tenantDomain;
- }
-
- /**
- * Allow to check whether features are enabled in the back-end
- *
- * @param key
- * The propery key
- * @return {@code true} if feature is enabled
- */
- public boolean isFeatureEnabled(String key) {
- if (key != null && key.startsWith("feature.")) {
- return new Boolean(System.getProperty(key));
- }
- return false;
- }
-
-
- public RepositoryInformation testRepositoryConnection(String repoURL, String repoUsername, String repoPassword, boolean privateRepo)
- throws RepositoryRequiredException, ADCException, RepositoryCredentialsRequiredException,
- InvalidRepositoryException, RepositoryTransportException {
- return ApplicationManagementUtil.validateRepository(repoURL, repoUsername, repoPassword, privateRepo, true);
- }
-
- // TODO Remove following when we support cartridge subscription for Super-tenant
- private void checkSuperTenant() throws ADCException {
- if (log.isDebugEnabled()) {
- log.debug("Checking whether super tenant accesses the service methods. Tenant ID: "
- + ApplicationManagementUtil.getTenantId(getConfigContext()) + ", Tenant Domain: " + carbonContext.getTenantDomain());
- }
- if (MultitenantConstants.SUPER_TENANT_ID == ApplicationManagementUtil.getTenantId(getConfigContext())) {
- throw new ADCException("Super Tenant is not allowed to complete requested operation");
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4f217859/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/service/InstanceInformationManagementService.java
----------------------------------------------------------------------
diff --git a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/service/InstanceInformationManagementService.java b/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/service/InstanceInformationManagementService.java
deleted file mode 100644
index 692dafa..0000000
--- a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/service/InstanceInformationManagementService.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.service;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.adc.mgt.utils.PersistenceManager;
-
-public class InstanceInformationManagementService {
-
-
- private static final Log log = LogFactory.getLog(InstanceInformationManagementService.class);
-
- /**
- * Everytime an instance is started up, this operation is invoked
- * (by the AgentService)
- * @param instanceIp
- * @param tenantId
- * @param clusterDomain
- * @param clusterSubDomain
- * @param cartridge
- * @param state
- *
- */
- public void updateInstanceState(String instanceIp,
- int tenantId,
- String clusterDomain,
- String clusterSubDomain,
- String cartridge,
- String state) {
-
- log.info("Message receieved in Instance Info Service.." + instanceIp + tenantId + clusterDomain + clusterSubDomain
- + cartridge + state);
-
- try {
- PersistenceManager.persistCartridgeInstanceInfo(instanceIp, clusterDomain, clusterSubDomain, cartridge, state);
- } catch (Exception e) {
- log.error("Exception is occurred in updating instance state. Reason, " + e.getMessage());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4f217859/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/service/RepoNotificationService.java
----------------------------------------------------------------------
diff --git a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/service/RepoNotificationService.java b/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/service/RepoNotificationService.java
deleted file mode 100644
index 85a9111..0000000
--- a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/service/RepoNotificationService.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * 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.service;
-
-import java.io.File;
-import java.util.List;
-import java.util.UUID;
-
-import org.apache.axis2.clustering.ClusteringAgent;
-import org.apache.axis2.clustering.ClusteringFault;
-import org.apache.axis2.clustering.management.GroupManagementAgent;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.adc.mgt.dao.CartridgeSubscription;
-import org.apache.stratos.adc.mgt.internal.DataHolder;
-import org.apache.stratos.adc.mgt.utils.CartridgeConstants;
-import org.apache.stratos.adc.mgt.utils.PersistenceManager;
-import org.wso2.carbon.adc.topology.mgt.service.TopologyManagementService;
-import org.wso2.carbon.core.deployment.SynchronizeGitRepositoryRequest;
-import org.wso2.carbon.utils.CarbonUtils;
-
-
-public class RepoNotificationService {
-
- private static final Log log = LogFactory.getLog(RepoNotificationService.class);
-
-
- public void notifyRepoUpdate(String tenantDomain, String cartridgeAlias) throws Exception {
- // FIXME Throwing generic Exception is wrong
- log.info("Updating repository of tenant : " + tenantDomain + " , cartridge: " +
- cartridgeAlias);
-
- CartridgeSubscription subscription = null;
- try {
- subscription = PersistenceManager.getSubscription(tenantDomain, cartridgeAlias);
- } catch (Exception e) {
- String msg = "Failed to find subscription for " + cartridgeAlias + ". "
- + (e.getMessage() != null ? e.getMessage() : "");
- log.error(msg, e);
- throw new Exception(msg, e);
- }
-
- if (subscription == null) {
- String msg = "Tenant " + tenantDomain + " is not subscribed for " + cartridgeAlias;
- log.error(msg);
- throw new Exception("You have not subscribed for " + cartridgeAlias);
- }
-
- try {
- handleRepoSynch(subscription);
- } catch (Exception e) {
- String msg = "Failed to synchronize the repository for " + cartridgeAlias + ". "
- + (e.getMessage() != null ? e.getMessage() : "");
- log.error(msg, e);
- throw new Exception(msg, e);
- }
-
- }
-
- public void synchronize(String repositoryURL) throws Exception {
-
- log.info(" repository URL received : " + repositoryURL);
- List<CartridgeSubscription> subscription = PersistenceManager.getSubscription(repositoryURL);
- for (CartridgeSubscription cartridgeSubscription : subscription) {
- handleRepoSynch(cartridgeSubscription);
- }
- }
-
- private void handleRepoSynch(CartridgeSubscription subscription) throws Exception {
- if (subscription == null) {
- throw new Exception("Cannot synchronize repository. subscription is null");
- }
-
- if (CartridgeConstants.PROVIDER_NAME_WSO2.equals(subscription.getProvider())) {
- log.info(" wso2 cartridge.. ");
- createAndSendClusterMessage(subscription.getTenantId(), subscription.getTenantDomain(),
- UUID.randomUUID(), subscription.getClusterDomain(),
- subscription.getClusterSubdomain());
- //for manager node
- /* if (subscription.getMgtClusterSubDomain() != null && !subscription.getMgtClusterSubDomain().isEmpty()) {
- createAndSendClusterMessage(subscription.getTenantId(), subscription.getTenantDomain(),
- UUID.randomUUID(), subscription.getMgtClusterDomain(),
- subscription.getMgtClusterSubDomain());
- }
- else {
- if(log.isDebugEnabled())
- log.debug("Manager node cluster information not found, not sending the SynchronizeGitRepositoryRequest");
- }*/
-
- } else {
-
- // Query DB and get all the IP s for this tenant
- // Invoke update-instance script
-
- String appPath = subscription.getBaseDirectory();
- String cartridgePrivateKey = System.getProperty(CartridgeConstants.CARTRIDGE_KEY);
-
- File keyFile = new File(cartridgePrivateKey);
- if (!keyFile.exists()) {
- log.error("The key file does not exist! " + cartridgePrivateKey);
- }
-
- if (subscription != null) {
- TopologyManagementService topologyMgtService = DataHolder.getTopologyMgtService();
-
-
- if (topologyMgtService == null) {
- String msg = " Topology Management Service is null ";
- log.error(msg);
- throw new Exception(msg);
- }
-
- String[] activeIpArray =
- topologyMgtService.getActiveIPs(subscription.getCartridge(),
- subscription.getClusterDomain(),
- subscription.getClusterSubdomain());
- try {
-
- for (String instanceIp : activeIpArray) {
- String command =
- CarbonUtils.getCarbonHome() + File.separator + "bin" +
- File.separator + "update-instance.sh " +
- instanceIp + " " + appPath + " " +
- cartridgePrivateKey + " /";
- log.info("Update instance command.... " + command);
- Process proc = Runtime.getRuntime().exec(command);
- proc.waitFor();
- }
-
- } catch (Exception e) {
- log.error("Exception is occurred in notify update operation. Reason : " +
- e.getMessage());
- throw e;
- }
- }
- }
- }
-
- private void createAndSendClusterMessage(int tenantId, String tenantDomain, UUID uuid,
- String clusterDomain, String clusterSubdomain) {
-
- SynchronizeGitRepositoryRequest request =
- new SynchronizeGitRepositoryRequest(tenantId,
- tenantDomain,
- uuid);
-
- ClusteringAgent clusteringAgent =
- DataHolder.getServerConfigContext()
- .getAxisConfiguration().getClusteringAgent();
- GroupManagementAgent groupMgtAgent =
- clusteringAgent.getGroupManagementAgent(clusterDomain,
- clusterSubdomain);
-
- try {
- log.info("Sending Request to.. " + clusterDomain + " : " + clusterSubdomain);
- groupMgtAgent.send(request);
-
- } catch (ClusteringFault e) {
- e.printStackTrace();
- }
-
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4f217859/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/service/RepositoryInfoBean.java
----------------------------------------------------------------------
diff --git a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/service/RepositoryInfoBean.java b/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/service/RepositoryInfoBean.java
deleted file mode 100644
index 1842040..0000000
--- a/components/stratos/artifact-deployment-coordinator/org.apache.stratos.adc.mgt/2.1.3/src/main/java/org/apache/stratos/adc/mgt/service/RepositoryInfoBean.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- *
- */
-package org.apache.stratos.adc.mgt.service;
-
-import org.wso2.carbon.stratos.cloud.controller.util.xsd.CartridgeInfo;
-
-/**
- * @author wso2
- *
- */
-public class RepositoryInfoBean {
-
- private String repoURL;
- private String cartridgeAlias;
- private String tenantDomain;
- private String userName;
- private String password;
- private String[] dirArray;
- private CartridgeInfo cartridgeInfo;
-
-
- public RepositoryInfoBean(String repoURL, String cartridgeAlias, String tenantDomain,
- String userName, String password, String[] dirArray, CartridgeInfo cartridgeInfo) {
- this.repoURL = repoURL;
- this.cartridgeAlias = cartridgeAlias;
- this.tenantDomain = tenantDomain;
- this.userName = userName;
- this.setPassword(password);
- this.dirArray = dirArray;
- this.cartridgeInfo = cartridgeInfo;
- }
- public String getRepoURL() {
- return repoURL;
- }
- public void setRepoURL(String repoURL) {
- this.repoURL = repoURL;
- }
- public String getCartridgeAlias() {
- return cartridgeAlias;
- }
- public void setCartridgeAlias(String cartridgeAlias) {
- this.cartridgeAlias = cartridgeAlias;
- }
- public String getTenantDomain() {
- return tenantDomain;
- }
- public void setTenantDomain(String tenantDomain) {
- this.tenantDomain = tenantDomain;
- }
- public String getUserName() {
- return userName;
- }
- public void setUserName(String userName) {
- this.userName = userName;
- }
- public String[] getDirArray() {
- return dirArray;
- }
- public void setDirArray(String[] dirArray) {
- this.dirArray = dirArray;
- }
- public CartridgeInfo getCartridgeInfo() {
- return cartridgeInfo;
- }
- public void setCartridgeInfo(CartridgeInfo cartridgeInfo) {
- this.cartridgeInfo = cartridgeInfo;
- }
- public String getPassword() {
- return password;
- }
- public void setPassword(String password) {
- this.password = password;
- }
-
-
-
-}