You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ni...@apache.org on 2013/08/08 05:42:16 UTC
[1/2] git commit: work related to
https://issues.apache.org/jira/browse/STRATOS-36
Updated Branches:
refs/heads/master a5f16f5ab -> 5c97f5a88
work related to https://issues.apache.org/jira/browse/STRATOS-36
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/86bc7b69
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/86bc7b69
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/86bc7b69
Branch: refs/heads/master
Commit: 86bc7b69e98c349dfae9a8b91d64ff1eba5bf89f
Parents: 81b0ffe
Author: Nirmal Fernando <ni...@apache.org>
Authored: Thu Aug 8 09:10:59 2013 +0530
Committer: Nirmal Fernando <ni...@apache.org>
Committed: Thu Aug 8 09:10:59 2013 +0530
----------------------------------------------------------------------
.../org.apache.stratos.cloud.controller/pom.xml | 1 -
.../controller/axiom/AxiomXpathParser.java | 30 ++----
.../impl/CloudControllerServiceImpl.java | 2 +-
.../interfaces/TopologyPublisher.java | 44 ++++++++
.../internal/CloudControllerDSComponent.java | 15 ++-
.../runtime/FasterLookUpDataHolder.java | 30 ++----
.../topic/ConfigurationPublisher.java | 65 -----------
.../topic/WSO2MBTopologyPublisher.java | 108 +++++++++++++++++++
.../stratos/cloud/controller/util/AppType.java | 18 ++++
.../controller/util/CloudControllerUtil.java | 18 ++++
.../util/DeclarativeServiceReferenceHolder.java | 8 +-
.../cloud/controller/util/IaasContext.java | 18 ++++
.../cloud/controller/util/PortMapping.java | 18 ++++
.../stratos/cloud/controller/util/Property.java | 18 ++++
.../cloud/controller/util/TopologyConfig.java | 72 +++++++++++++
.../service/axiom/AxiomXpathParserTest.java | 7 ++
.../src/test/resources/cloud-controller.xml | 7 +-
17 files changed, 361 insertions(+), 118 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/86bc7b69/components/org.apache.stratos.cloud.controller/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/pom.xml b/components/org.apache.stratos.cloud.controller/pom.xml
index e33d13b..7e660aa 100644
--- a/components/org.apache.stratos.cloud.controller/pom.xml
+++ b/components/org.apache.stratos.cloud.controller/pom.xml
@@ -93,7 +93,6 @@
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Export-Package>
org.apache.stratos.cloud.controller.interfaces.*,
-
org.apache.stratos.cloud.controller.publisher.*,
org.apache.stratos.cloud.controller.topic.*,
org.apache.stratos.cloud.controller.iaases.*,
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/86bc7b69/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/axiom/AxiomXpathParser.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/axiom/AxiomXpathParser.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/axiom/AxiomXpathParser.java
index 9f82791..30bf0d6 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/axiom/AxiomXpathParser.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/axiom/AxiomXpathParser.java
@@ -42,16 +42,17 @@ import org.apache.axiom.om.impl.dom.DOOMAbstractFactory;
import org.apache.axiom.om.impl.dom.ElementImpl;
import org.apache.axiom.om.xpath.AXIOMXPath;
import org.apache.stratos.cloud.controller.exception.CloudControllerException;
+import org.apache.stratos.cloud.controller.exception.MalformedConfigurationFileException;
import org.apache.stratos.cloud.controller.runtime.FasterLookUpDataHolder;
import org.apache.stratos.cloud.controller.util.AppType;
import org.apache.stratos.cloud.controller.util.Cartridge;
import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
import org.apache.stratos.cloud.controller.util.PortMapping;
+import org.apache.stratos.cloud.controller.util.TopologyConfig;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jaxen.JaxenException;
import org.w3c.dom.Element;
-import org.apache.stratos.cloud.controller.exception.MalformedConfigurationFileException;
import org.apache.stratos.cloud.controller.util.CloudControllerUtil;
import org.apache.stratos.cloud.controller.util.IaasProvider;
import org.apache.stratos.cloud.controller.util.ServiceContext;
@@ -329,7 +330,7 @@ public class AxiomXpathParser {
return null;
}
-
+
/**
*
* @param xpath
@@ -857,10 +858,10 @@ public class AxiomXpathParser {
}
- private void loadProperties(final OMElement iaasElt, final Map<String, String> propertyMap) {
+ private void loadProperties(final OMElement elt, final Map<String, String> propertyMap) {
Iterator<?> it =
- iaasElt.getChildrenWithName(new QName(CloudControllerConstants.PROPERTY_ELEMENT));
+ elt.getChildrenWithName(new QName(CloudControllerConstants.PROPERTY_ELEMENT));
while (it.hasNext()) {
OMElement prop = (OMElement) it.next();
@@ -1207,26 +1208,17 @@ public class AxiomXpathParser {
CloudControllerConstants.ENABLE_ATTR)));
FasterLookUpDataHolder dataHolder = FasterLookUpDataHolder.getInstance();
+
dataHolder.setEnableTopologySync(isEnable);
if (isEnable) {
- // get MB server info
- OMElement childElement =
- getFirstChildElement(element,
- CloudControllerConstants.MB_SERVER_ELEMENT);
-
- if (childElement != null) {
- // set MB server IP
- dataHolder.setMBServerUrl(childElement.getText());
- }
-
- // set cron
- childElement = getFirstChildElement(element, CloudControllerConstants.CRON_ELEMENT);
- if (childElement != null) {
- dataHolder.setTopologySynchronizerCron(childElement.getText());
- }
+ TopologyConfig topologyConfig = new TopologyConfig();
+ // load properties
+ loadProperties(element, topologyConfig.getProperties());
+ dataHolder.setTopologyConfig(topologyConfig);
}
+
}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/86bc7b69/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/impl/CloudControllerServiceImpl.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/impl/CloudControllerServiceImpl.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/impl/CloudControllerServiceImpl.java
index a69f383..87e2533 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/impl/CloudControllerServiceImpl.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/impl/CloudControllerServiceImpl.java
@@ -123,7 +123,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
.getTaskManager(CloudControllerConstants.TOPOLOGY_SYNC_TASK_TYPE);
TriggerInfo triggerInfo = new TriggerInfo(
- dataHolder.getTopologySynchronizerCron());
+ DeclarativeServiceReferenceHolder.getInstance().getConfigPub().getCron());
taskInfo = new TaskInfo(
CloudControllerConstants.TOPOLOGY_SYNC_TASK_NAME,
TopologySynchronizerTask.class.getName(),
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/86bc7b69/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/interfaces/TopologyPublisher.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/interfaces/TopologyPublisher.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/interfaces/TopologyPublisher.java
new file mode 100644
index 0000000..9a971bd
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/interfaces/TopologyPublisher.java
@@ -0,0 +1,44 @@
+/*
+ * 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.cloud.controller.interfaces;
+
+/**
+ * All custom implementations of Topology Publisher should extend this abstract class.
+ */
+public abstract class TopologyPublisher {
+
+ /**
+ * This operation will be called once in order to initialize this publisher.
+ */
+ public abstract void init();
+
+ /**
+ * When a message is ready to be published to a certain topic, this operation will be called.
+ * @param topicName name of the topic to be published.
+ * @param message message to be published.
+ */
+ public abstract void publish(String topicName, String message);
+
+ /**
+ * Cron expression which explains the frequency that the topology publishing happens.
+ * @return cron expression
+ */
+ public abstract String getCron();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/86bc7b69/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/internal/CloudControllerDSComponent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/internal/CloudControllerDSComponent.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/internal/CloudControllerDSComponent.java
index 0152a75..b5ebd01 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/internal/CloudControllerDSComponent.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/internal/CloudControllerDSComponent.java
@@ -3,6 +3,7 @@ package org.apache.stratos.cloud.controller.internal;
import org.apache.stratos.cloud.controller.exception.CloudControllerException;
import org.apache.stratos.cloud.controller.impl.CloudControllerServiceImpl;
import org.apache.stratos.cloud.controller.interfaces.CloudControllerService;
+import org.apache.stratos.cloud.controller.interfaces.TopologyPublisher;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.osgi.framework.BundleContext;
@@ -10,7 +11,7 @@ import org.osgi.service.component.ComponentContext;
import org.wso2.carbon.ntask.core.service.TaskService;
import org.wso2.carbon.registry.core.exceptions.RegistryException;
import org.wso2.carbon.registry.core.service.RegistryService;
-import org.apache.stratos.cloud.controller.topic.ConfigurationPublisher;
+import org.apache.stratos.cloud.controller.runtime.FasterLookUpDataHolder;
import org.apache.stratos.cloud.controller.util.DeclarativeServiceReferenceHolder;
/**
@@ -32,10 +33,14 @@ public class CloudControllerDSComponent {
protected void activate(ComponentContext context) {
try {
- if (DeclarativeServiceReferenceHolder.getInstance().getConfigPub() == null) {
- DeclarativeServiceReferenceHolder.getInstance()
- .setConfigPub(new ConfigurationPublisher());
- }
+ if (DeclarativeServiceReferenceHolder.getInstance().getConfigPub() == null) {
+ DeclarativeServiceReferenceHolder.getInstance().setConfigPub(
+ (TopologyPublisher) Class.forName(
+ FasterLookUpDataHolder.getInstance()
+ .getTopologyConfig().getClassName())
+ .newInstance());
+ DeclarativeServiceReferenceHolder.getInstance().getConfigPub().init();
+ }
BundleContext bundleContext = context.getBundleContext();
bundleContext.registerService(CloudControllerService.class.getName(),
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/86bc7b69/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/runtime/FasterLookUpDataHolder.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/runtime/FasterLookUpDataHolder.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/runtime/FasterLookUpDataHolder.java
index fcc1554..9836207 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/runtime/FasterLookUpDataHolder.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/runtime/FasterLookUpDataHolder.java
@@ -35,6 +35,7 @@ import org.apache.stratos.cloud.controller.util.Cartridge;
import org.apache.stratos.cloud.controller.util.CloudControllerUtil;
import org.apache.stratos.cloud.controller.util.IaasProvider;
import org.apache.stratos.cloud.controller.util.ServiceContext;
+import org.apache.stratos.cloud.controller.util.TopologyConfig;
/**
* This object holds all runtime data and provides faster access. This is a Singleton class.
@@ -86,6 +87,7 @@ public class FasterLookUpDataHolder implements Serializable{
private String serializationDir;
private boolean enableBAMDataPublisher;
private boolean enableTopologySync;
+ private TopologyConfig topologyConfig;
private String bamUsername = CloudControllerConstants.DEFAULT_BAM_SERVER_USER_NAME;
private String bamPassword = CloudControllerConstants.DEFAULT_BAM_SERVER_PASSWORD;
private String dataPublisherCron = CloudControllerConstants.PUB_CRON_EXPRESSION;
@@ -102,13 +104,9 @@ public class FasterLookUpDataHolder implements Serializable{
private String streamId;
private boolean isPublisherRunning;
private boolean isTopologySyncRunning;
- private String topologySynchronizerCron = CloudControllerConstants.TOPOLOGY_SYNC_CRON;
private BlockingQueue<List<ServiceContext>> sharedTopologyDiffQueue = new LinkedBlockingQueue<List<ServiceContext>>();
-
- private String mbServerUrl = CloudControllerConstants.MB_SERVER_URL;
-
public static FasterLookUpDataHolder getInstance() {
if (ctxt == null) {
@@ -391,22 +389,6 @@ public class FasterLookUpDataHolder implements Serializable{
this.sharedTopologyDiffQueue = sharedTopologyDiffQueue;
}
- public String getTopologySynchronizerCron() {
- return topologySynchronizerCron;
- }
-
- public void setTopologySynchronizerCron(String topologySynchronizerCron) {
- this.topologySynchronizerCron = topologySynchronizerCron;
- }
-
- public void setMBServerUrl(String ip) {
- this.mbServerUrl = ip;
- }
-
- public String getMBServerUrl() {
- return mbServerUrl;
- }
-
public boolean getEnableTopologySync() {
return enableTopologySync;
}
@@ -423,4 +405,12 @@ public class FasterLookUpDataHolder implements Serializable{
this.isTopologySyncRunning = isTopologySyncRunning;
}
+ public TopologyConfig getTopologyConfig() {
+ return topologyConfig;
+ }
+
+ public void setTopologyConfig(TopologyConfig topologyConfig) {
+ this.topologyConfig = topologyConfig;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/86bc7b69/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topic/ConfigurationPublisher.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topic/ConfigurationPublisher.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topic/ConfigurationPublisher.java
deleted file mode 100644
index 0339fd7..0000000
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topic/ConfigurationPublisher.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.apache.stratos.cloud.controller.topic;
-
-import java.util.Properties;
-
-import javax.jms.*;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.apache.stratos.cloud.controller.runtime.FasterLookUpDataHolder;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-public class ConfigurationPublisher {
- private TopicPublisher topicPublisher;
- private TopicSession topicSession;
- private TopicConnection topicConnection;
- private TopicConnectionFactory topicConnectionFactory;
- private static final Log log = LogFactory.getLog(ConfigurationPublisher.class);
-
-
- public ConfigurationPublisher() {
-
- Properties initialContextProperties = new Properties();
- initialContextProperties.put("java.naming.factory.initial",
- "org.wso2.andes.jndi.PropertiesFileInitialContextFactory");
- String connectionString = "amqp://admin:admin@clientID/carbon?brokerlist='tcp://"+ FasterLookUpDataHolder.getInstance().getMBServerUrl()+"'";
- initialContextProperties.put("connectionfactory.qpidConnectionfactory", connectionString);
-
- try {
- InitialContext initialContext = new InitialContext(initialContextProperties);
- topicConnectionFactory =
- (TopicConnectionFactory) initialContext.lookup("qpidConnectionfactory");
-
-// topicConnection.stop();
-// topicConnection.close();
-
- } catch (NamingException e) {
- log.error(e.getMessage(), e);
- }
- }
-
-
- public void publish(String topicName, String message) {
- try {
- topicConnection = topicConnectionFactory.createTopicConnection();
- topicConnection.start();
- topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-
- Topic topic = topicSession.createTopic(topicName);
- topicPublisher = topicSession.createPublisher(topic);
- TextMessage textMessage = topicSession.createTextMessage(message);
-
- topicPublisher.publish(textMessage);
-
- topicPublisher.close();
- topicSession.close();
- topicConnection.stop();
- topicConnection.close();
-
- } catch (JMSException e) {
- log.error(e.getMessage(), e);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/86bc7b69/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topic/WSO2MBTopologyPublisher.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topic/WSO2MBTopologyPublisher.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topic/WSO2MBTopologyPublisher.java
new file mode 100644
index 0000000..36871aa
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topic/WSO2MBTopologyPublisher.java
@@ -0,0 +1,108 @@
+/*
+ * 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.cloud.controller.topic;
+
+import java.util.Properties;
+
+import javax.jms.*;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.stratos.cloud.controller.interfaces.TopologyPublisher;
+import org.apache.stratos.cloud.controller.runtime.FasterLookUpDataHolder;
+import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
+import org.apache.stratos.cloud.controller.util.TopologyConfig;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class WSO2MBTopologyPublisher extends TopologyPublisher {
+ private TopicPublisher topicPublisher;
+ private TopicSession topicSession;
+ private TopicConnection topicConnection;
+ private TopicConnectionFactory topicConnectionFactory;
+ private String topologySynchronizerCron = CloudControllerConstants.TOPOLOGY_SYNC_CRON;
+ private String mbServerUrl = CloudControllerConstants.MB_SERVER_URL;
+ private static final Log log = LogFactory
+ .getLog(WSO2MBTopologyPublisher.class);
+
+ public void publish(String topicName, String message) {
+ try {
+ topicConnection = topicConnectionFactory.createTopicConnection();
+ topicConnection.start();
+ topicSession = topicConnection.createTopicSession(false,
+ Session.AUTO_ACKNOWLEDGE);
+
+ Topic topic = topicSession.createTopic(topicName);
+ topicPublisher = topicSession.createPublisher(topic);
+ TextMessage textMessage = topicSession.createTextMessage(message);
+
+ topicPublisher.publish(textMessage);
+
+ topicPublisher.close();
+ topicSession.close();
+ topicConnection.stop();
+ topicConnection.close();
+
+ } catch (JMSException e) {
+ log.error(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public void init() {
+ TopologyConfig config = FasterLookUpDataHolder.getInstance()
+ .getTopologyConfig();
+ String cron = config.getProperty(CloudControllerConstants.CRON_ELEMENT);
+ topologySynchronizerCron = cron == null ? topologySynchronizerCron
+ : cron;
+
+ String url = config
+ .getProperty(CloudControllerConstants.MB_SERVER_ELEMENT);
+ mbServerUrl = url == null ? mbServerUrl : url;
+
+ Properties initialContextProperties = new Properties();
+ initialContextProperties.put("java.naming.factory.initial",
+ "org.wso2.andes.jndi.PropertiesFileInitialContextFactory");
+
+ String connectionString = "amqp://admin:admin@clientID/carbon?brokerlist='tcp://"
+ + mbServerUrl + "'";
+ initialContextProperties.put("connectionfactory.qpidConnectionfactory",
+ connectionString);
+
+ try {
+ InitialContext initialContext = new InitialContext(
+ initialContextProperties);
+ topicConnectionFactory = (TopicConnectionFactory) initialContext
+ .lookup("qpidConnectionfactory");
+
+ // topicConnection.stop();
+ // topicConnection.close();
+
+ } catch (NamingException e) {
+ log.error(e.getMessage(), e);
+ }
+
+ }
+
+ @Override
+ public String getCron() {
+ return topologySynchronizerCron;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/86bc7b69/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/AppType.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/AppType.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/AppType.java
index 3ca9bfc..2ddbe7a 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/AppType.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/AppType.java
@@ -1,3 +1,21 @@
+/*
+ * 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.cloud.controller.util;
import java.io.Serializable;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/86bc7b69/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
index a1f5551..9ba7051 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
@@ -1,3 +1,21 @@
+/*
+ * 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.cloud.controller.util;
import java.io.File;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/86bc7b69/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/DeclarativeServiceReferenceHolder.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/DeclarativeServiceReferenceHolder.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/DeclarativeServiceReferenceHolder.java
index a3a07fc..70494e7 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/DeclarativeServiceReferenceHolder.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/DeclarativeServiceReferenceHolder.java
@@ -21,7 +21,7 @@ package org.apache.stratos.cloud.controller.util;
import org.wso2.carbon.ntask.core.service.TaskService;
import org.wso2.carbon.registry.core.Registry;
import org.wso2.carbon.registry.core.session.UserRegistry;
-import org.apache.stratos.cloud.controller.topic.ConfigurationPublisher;
+import org.apache.stratos.cloud.controller.interfaces.TopologyPublisher;
/**
* Singleton class to hold all the service references.
@@ -30,7 +30,7 @@ public class DeclarativeServiceReferenceHolder {
private static DeclarativeServiceReferenceHolder instance;
private TaskService taskService;
- private ConfigurationPublisher configPub;
+ private TopologyPublisher configPub;
private Registry registry;
private DeclarativeServiceReferenceHolder() {
@@ -43,7 +43,7 @@ public class DeclarativeServiceReferenceHolder {
return instance;
}
- public ConfigurationPublisher getConfigPub(){
+ public TopologyPublisher getConfigPub(){
return configPub;
}
@@ -55,7 +55,7 @@ public class DeclarativeServiceReferenceHolder {
this.taskService = taskService;
}
- public void setConfigPub(ConfigurationPublisher configPub) {
+ public void setConfigPub(TopologyPublisher configPub) {
this.configPub = configPub;
}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/86bc7b69/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/IaasContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/IaasContext.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/IaasContext.java
index 5ab68a1..ddbc5e5 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/IaasContext.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/IaasContext.java
@@ -1,3 +1,21 @@
+/*
+ * 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.cloud.controller.util;
import java.io.Serializable;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/86bc7b69/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/PortMapping.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/PortMapping.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/PortMapping.java
index df099f9..9f9a0e4 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/PortMapping.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/PortMapping.java
@@ -1,3 +1,21 @@
+/*
+ * 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.cloud.controller.util;
import java.io.Serializable;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/86bc7b69/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/Property.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/Property.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/Property.java
index 5ca5b13..a17d30b 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/Property.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/Property.java
@@ -1,3 +1,21 @@
+/*
+ * 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.cloud.controller.util;
/**
* Holds a property
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/86bc7b69/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/TopologyConfig.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/TopologyConfig.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/TopologyConfig.java
new file mode 100644
index 0000000..899062f
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/TopologyConfig.java
@@ -0,0 +1,72 @@
+/*
+ * 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.cloud.controller.util;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Configuration related to Topology synchronization
+ *
+ */
+public class TopologyConfig implements Serializable{
+
+ private static final long serialVersionUID = 4435173744617096911L;
+
+ // default implementation is WSO2MBTopologyPublisher
+ private String className = "org.apache.stratos.cloud.controller.topic.WSO2MBTopologyPublisher";
+
+ /**
+ * Key - Value pair.
+ */
+ private Map<String, String> properties = new HashMap<String, String>();
+
+ public void setProperty(String key, String value) {
+ properties.put(key, value);
+ }
+
+ public String getProperty(String key) {
+
+ if(properties.containsKey(key)){
+ return properties.get(key);
+ }
+
+ return null;
+ }
+
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Map<String, String> properties) {
+ this.properties = properties;
+ }
+
+ public String getClassName() {
+ // try to get the class name from a property
+ String temp = getProperty(CloudControllerConstants.CLASS_NAME_ELEMENT);
+ return temp == null ? className : temp;
+ }
+
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/86bc7b69/components/org.apache.stratos.cloud.controller/src/test/java/org/apache/cartridge/autoscaler/service/axiom/AxiomXpathParserTest.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/test/java/org/apache/cartridge/autoscaler/service/axiom/AxiomXpathParserTest.java b/components/org.apache.stratos.cloud.controller/src/test/java/org/apache/cartridge/autoscaler/service/axiom/AxiomXpathParserTest.java
index 5c9a5be..7e632ca 100644
--- a/components/org.apache.stratos.cloud.controller/src/test/java/org/apache/cartridge/autoscaler/service/axiom/AxiomXpathParserTest.java
+++ b/components/org.apache.stratos.cloud.controller/src/test/java/org/apache/cartridge/autoscaler/service/axiom/AxiomXpathParserTest.java
@@ -55,5 +55,12 @@ public class AxiomXpathParserTest extends TestCase {
assertEquals("nirmal", FasterLookUpDataHolder.getInstance().getBamUsername());
assertEquals("nirmal", FasterLookUpDataHolder.getInstance().getBamPassword());
}
+
+ public void testTopologySynchParser() {
+ parser.setTopologySyncRelatedData();
+ assertNotNull(FasterLookUpDataHolder.getInstance().getTopologyConfig());
+ assertEquals("org.apache.stratos.cloud.controller.ABC", FasterLookUpDataHolder.getInstance().getTopologyConfig().getClassName());
+ assertEquals("1 * * * * ? *", FasterLookUpDataHolder.getInstance().getTopologyConfig().getProperty("cron"));
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/86bc7b69/components/org.apache.stratos.cloud.controller/src/test/resources/cloud-controller.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/test/resources/cloud-controller.xml b/components/org.apache.stratos.cloud.controller/src/test/resources/cloud-controller.xml
index 054e3c5..fd8e656 100644
--- a/components/org.apache.stratos.cloud.controller/src/test/resources/cloud-controller.xml
+++ b/components/org.apache.stratos.cloud.controller/src/test/resources/cloud-controller.xml
@@ -41,9 +41,10 @@
</dataPublisher>
<topologySync enable="true">
- <!-- MB server info -->
- <mbServerUrl>localhost:5672</mbServerUrl>
- <cron>1 * * * * ? *</cron>
+ <!-- properties related to topology syncher -->
+ <property name="className" value="org.apache.stratos.cloud.controller.ABC"/>
+ <property name="mbServerUrl" value="localhost:5674"/>
+ <property name="cron" value="1 * * * * ? *"/>
</topologySync>
<!-- Specify the properties that are common to an IaaS here. This element
[2/2] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-stratos
Posted by ni...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/5c97f5a8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/5c97f5a8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/5c97f5a8
Branch: refs/heads/master
Commit: 5c97f5a888578d3220572dd795aa33dca3d2a023
Parents: 86bc7b6 a5f16f5
Author: Nirmal Fernando <ni...@apache.org>
Authored: Thu Aug 8 09:11:34 2013 +0530
Committer: Nirmal Fernando <ni...@apache.org>
Committed: Thu Aug 8 09:11:34 2013 +0530
----------------------------------------------------------------------
.../account/mgt/ui/clients/UsagePlanClient.java | 15 +-
.../resources/web/account-mgt/account_mgt.jsp | 7 +-
.../docs/resources/css/mb-docs.css | 173 -------
.../resources/images/Deployment_Diagram.jpg | Bin 40421 -> 0 bytes
.../docs/resources/images/Login.png | Bin 112406 -> 0 bytes
.../resources/images/MessageFlowDiagram.jpg | Bin 43164 -> 0 bytes
.../docs/resources/images/MessageQueue.jpg | Bin 41880 -> 0 bytes
.../docs/resources/images/addMessage.png | Bin 83311 -> 0 bytes
.../docs/resources/images/addPermission.png | Bin 93870 -> 0 bytes
.../resources/images/cluster_scenario_01.png | Bin 64444 -> 0 bytes
.../resources/images/cluster_scenario_02.png | Bin 105140 -> 0 bytes
.../resources/images/cluster_scenario_03.png | Bin 105277 -> 0 bytes
.../resources/images/cluster_scenario_04.png | Bin 103247 -> 0 bytes
.../resources/images/cluster_scenario_05.png | Bin 88343 -> 0 bytes
.../docs/resources/images/createMB.png | Bin 68180 -> 0 bytes
.../docs/resources/images/listMessageBoxes.png | Bin 69959 -> 0 bytes
.../docs/resources/images/logs.PNG | Bin 63610 -> 0 bytes
.../docs/resources/images/mb-docs-bg.gif | Bin 520 -> 0 bytes
.../docs/resources/images/mb-docs-header.gif | Bin 5716 -> 0 bytes
.../docs/resources/images/retrieveMessage.png | Bin 84034 -> 0 bytes
.../docs/resources/images/set-java-home.jpg | Bin 84364 -> 0 bytes
.../docs/resources/images/state1_esper.png | Bin 85366 -> 0 bytes
.../docs/resources/images/storeConfig.png | Bin 25128 -> 0 bytes
.../docs/resources/images/table-header.gif | Bin 873 -> 0 bytes
.../docs/resources/images/topicBrowser.png | Bin 41142 -> 0 bytes
.../images/topic_AddTopicFromDetails.png | Bin 25193 -> 0 bytes
.../docs/resources/images/topic_add.png | Bin 57217 -> 0 bytes
.../resources/images/topic_addSubscription.png | Bin 76820 -> 0 bytes
.../docs/resources/images/topic_browser.png | Bin 50827 -> 0 bytes
.../resources/images/topic_browser_clicked.png | Bin 55746 -> 0 bytes
.../docs/resources/images/topic_details.png | Bin 70525 -> 0 bytes
.../images/topic_subscriptionDetails.png | Bin 47014 -> 0 bytes
.../images/topic_updatePermissions.png | Bin 85779 -> 0 bytes
.../docs/resources/images/user-mgt.PNG | Bin 8985 -> 0 bytes
.../docs/resources/images/userguide_state_1.png | Bin 73672 -> 0 bytes
.../docs/resources/images/zookeeperConfig.png | Bin 19377 -> 0 bytes
products/cloud-controller/docs/site.xml | 71 ---
.../cloud-controller/docs/xdoc/admin_guide.xml | 485 -------------------
.../docs/xdoc/cluster_scenario_01.xml | 184 -------
.../docs/xdoc/cluster_scenario_02.xml | 160 ------
.../docs/xdoc/cluster_scenario_03.xml | 200 --------
.../docs/xdoc/cluster_scenario_04.xml | 169 -------
.../docs/xdoc/cluster_scenario_05.xml | 216 ---------
.../docs/xdoc/deployment_guide.xml | 91 ----
.../cloud-controller/docs/xdoc/docs_index.xml | 77 ---
products/cloud-controller/docs/xdoc/faq.xml | 80 ---
products/cloud-controller/docs/xdoc/index.xml | 71 ---
.../docs/xdoc/installation_guide.xml | 414 ----------------
.../docs/xdoc/release-notes.xml | 239 ---------
.../docs/xdoc/samples/jms_queue_sample.xml | 267 ----------
.../docs/xdoc/samples/jms_topic_sample.xml | 260 ----------
.../docs/xdoc/samples/jms_transport_sample.xml | 374 --------------
.../xdoc/samples/web_service_client_sample.xml | 235 ---------
.../docs/xdoc/samples_index.xml | 80 ---
.../docs/xdoc/setting_java_home.xml | 54 ---
.../docs/xdoc/source-repository.xml | 137 ------
.../cloud-controller/docs/xdoc/user_guide.xml | 417 ----------------
.../modules/distribution/pom.xml | 2 -
.../distribution/src/main/assembly/bin.xml | 6 -
products/elb/docs/xdoc/release-notes.xml | 170 -------
products/elb/modules/distribution/pom.xml | 42 --
.../distribution/src/main/assembly/bin.xml | 6 -
.../distribution/src/main/assembly/docs.xml | 33 --
.../stratos-agent/docs/xdoc/release-notes.xml | 169 -------
.../stratos-agent/modules/distribution/pom.xml | 42 --
.../distribution/src/main/assembly/bin.xml | 8 +-
.../distribution/src/main/assembly/docs.xml | 33 --
.../billing-script/stratos_mysql.sql | 36 +-
.../modules/distribution/pom.xml | 89 +---
.../modules/distribution/src/assembly/bin.xml | 33 +-
.../modules/distribution/src/assembly/dist.xml | 45 --
.../init_scripts/mysql/ec2/get-launch-params.rb | 16 +
.../init_scripts/mysql/ec2/healthcheck.sh | 32 ++
.../init_scripts/mysql/ec2/stratos-init.sh | 152 ++++++
.../mysql/ec2/wso2-cartridge-init.sh | 152 ------
.../init_scripts/php/ec2/get-launch-params.rb | 20 +
.../init_scripts/php/ec2/healthcheck.sh | 32 ++
.../init_scripts/php/ec2/stratos-init.sh | 304 ++++++++++++
.../init_scripts/php/ec2/wso2-cartridge-init.sh | 258 ----------
.../init_scripts/tomcat/get-launch-params.rb | 51 ++
.../init_scripts/tomcat/payload/README | 21 +
.../init_scripts/tomcat/payload/launch-params | 1 +
.../init_scripts/tomcat/stratos-init.sh | 168 +++++++
.../init_scripts/tomcat/stratos.pem | 16 +
.../init_scripts/tomcat7/get-launch-params.rb | 35 --
.../init_scripts/tomcat7/payload/README | 21 -
.../init_scripts/tomcat7/payload/launch-params | 1 -
.../init_scripts/tomcat7/wso2-openstack-init.sh | 168 -------
.../init_scripts/tomcat7/wso2.pem | 16 -
tools/ec2-demo-setup/clean.sh | 7 +-
tools/ec2-demo-setup/config.sh | 109 -----
91 files changed, 863 insertions(+), 5907 deletions(-)
----------------------------------------------------------------------