Added:
whirr/branches/branch-0.8/services/hbase/src/main/java/org/apache/whirr/service/hbase/osgi/Activator.java
URL:
http://svn.apache.org/viewvc/whirr/branches/branch-0.8/services/hbase/src/main/java/org/apache/whirr/service/hbase/osgi/Activator.java?rev=1374653&view=auto
==============================================================================
---
whirr/branches/branch-0.8/services/hbase/src/main/java/org/apache/whirr/service/hbase/osgi/Activator.java
(added)
+++
whirr/branches/branch-0.8/services/hbase/src/main/java/org/apache/whirr/service/hbase/osgi/Activator.java
Sat Aug 18 20:54:39 2012
@@ -0,0 +1,137 @@
+/*
+ * 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.whirr.service.hbase.osgi;
+
+import org.apache.whirr.service.ClusterActionHandler;
+import org.apache.whirr.service.hbase.HBaseAvroServerClusterActionHandler;
+import org.apache.whirr.service.hbase.HBaseMasterClusterActionHandler;
+import org.apache.whirr.service.hbase.HBaseRegionServerClusterActionHandler;
+import org.apache.whirr.service.hbase.HBaseRestServerClusterActionHandler;
+import org.apache.whirr.service.hbase.HBaseThriftServerClusterActionHandler;
+import org.jclouds.scriptbuilder.functionloader.osgi.BundleFunctionLoader;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+import java.util.Properties;
+
+public class Activator implements BundleActivator {
+
+ private BundleFunctionLoader functionLoader;
+
+ private final ClusterActionHandler masterClusterActionHandler = new
HBaseMasterClusterActionHandler();
+ private ServiceRegistration masterRegistration;
+
+ private final ClusterActionHandler regionServerClusterActionHandler = new
HBaseRegionServerClusterActionHandler();
+ private ServiceRegistration regionServerRegistration;
+
+ private final ClusterActionHandler restServerClusterActionHandler = new
HBaseRestServerClusterActionHandler();
+ private ServiceRegistration restServerRegistration;
+
+ private final ClusterActionHandler avroServerClusterActionHandler = new
HBaseAvroServerClusterActionHandler();
+ private ServiceRegistration avroServerRegistration;
+
+ private final ClusterActionHandler thriftServerClusterActionHandler = new
HBaseThriftServerClusterActionHandler();
+ private ServiceRegistration thriftServerRegistration;
+
+ /**
+ * Called when this bundle is started so the Framework can perform the
+ * bundle-specific activities necessary to start this bundle. This method
+ * can be used to register services or to allocate any resources that this
+ * bundle needs.
+ * <p/>
+ * <p/>
+ * This method must complete and return to its caller in a timely manner.
+ *
+ * @param context The execution context of the bundle being started.
+ * @throws Exception If this method throws an exception, this
+ * bundle is marked as stopped and the Framework will
remove this
+ * bundle's listeners, unregister all services registered
by this
+ * bundle, and release all services used by this bundle.
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ //Initialize OSGi based FunctionLoader
+ functionLoader = new BundleFunctionLoader(context);
+ functionLoader.start();
+
+ Properties masterProps = new Properties();
+ masterProps.put("name", "hbase-master");
+ masterRegistration =
context.registerService(ClusterActionHandler.class.getName(),
masterClusterActionHandler, masterProps);
+
+ Properties regionServerProps = new Properties();
+ regionServerProps.put("name", "hbase-regionserver");
+ regionServerRegistration =
context.registerService(ClusterActionHandler.class.getName(),
regionServerClusterActionHandler, regionServerProps);
+
+ Properties restServerProps = new Properties();
+ restServerProps.put("name", "hbase-restserver");
+ restServerRegistration =
context.registerService(ClusterActionHandler.class.getName(),
restServerClusterActionHandler, restServerProps);
+
+ Properties avroServerProps = new Properties();
+ avroServerProps.put("name", "hbase-avroserver");
+ avroServerRegistration =
context.registerService(ClusterActionHandler.class.getName(),
avroServerClusterActionHandler, avroServerProps);
+
+ Properties thriftServerProps = new Properties();
+ thriftServerProps.put("name", "hbase-thriftserver");
+ thriftServerRegistration =
context.registerService(ClusterActionHandler.class.getName(),
thriftServerClusterActionHandler, thriftServerProps);
+ }
+
+ /**
+ * Called when this bundle is stopped so the Framework can perform the
+ * bundle-specific activities necessary to stop the bundle. In general, this
+ * method should undo the work that the <code>BundleActivator.start</code>
+ * method started. There should be no active threads that were started by
+ * this bundle when this bundle returns. A stopped bundle must not call any
+ * Framework objects.
+ * <p/>
+ * <p/>
+ * This method must complete and return to its caller in a timely manner.
+ *
+ * @param context The execution context of the bundle being stopped.
+ * @throws Exception If this method throws an exception, the
+ * bundle is still marked as stopped, and the Framework
will remove
+ * the bundle's listeners, unregister all services
registered by the
+ * bundle, and release all services used by the bundle.
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ if (masterRegistration != null) {
+ masterRegistration.unregister();
+ }
+
+ if (regionServerRegistration != null) {
+ regionServerRegistration.unregister();
+ }
+
+ if (restServerRegistration != null) {
+ restServerRegistration.unregister();
+ }
+ if (avroServerRegistration != null) {
+ avroServerRegistration.unregister();
+ }
+ if (thriftServerRegistration != null) {
+ thriftServerRegistration.unregister();
+ }
+ if (masterRegistration != null) {
+ masterRegistration.unregister();
+ }
+ if (functionLoader != null) {
+ functionLoader.stop();
+ }
+ }
+}
Propchange:
whirr/branches/branch-0.8/services/hbase/src/main/java/org/apache/whirr/service/hbase/osgi/Activator.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: whirr/branches/branch-0.8/services/mahout/pom.xml
URL:
http://svn.apache.org/viewvc/whirr/branches/branch-0.8/services/mahout/pom.xml?rev=1374653&r1=1374652&r2=1374653&view=diff
==============================================================================
--- whirr/branches/branch-0.8/services/mahout/pom.xml (original)
+++ whirr/branches/branch-0.8/services/mahout/pom.xml Sat Aug 18 20:54:39 2012
@@ -36,7 +36,7 @@
<osgi.export>
org.apache.whirr.service.mahout*;version="${project.version}"
</osgi.export>
-
<osgi.fragment.host>jclouds-scriptbuilder;bundle-version="${jclouds.osgi.version.clean}"</osgi.fragment.host>
+
<osgi.bundle.activator>org.apache.whirr.service.mahout.osgi.Activator</osgi.bundle.activator>
</properties>
<dependencies>
<dependency>
@@ -74,6 +74,12 @@
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
Added:
whirr/branches/branch-0.8/services/mahout/src/main/java/org/apache/whirr/service/mahout/osgi/Activator.java
URL:
http://svn.apache.org/viewvc/whirr/branches/branch-0.8/services/mahout/src/main/java/org/apache/whirr/service/mahout/osgi/Activator.java?rev=1374653&view=auto
==============================================================================
---
whirr/branches/branch-0.8/services/mahout/src/main/java/org/apache/whirr/service/mahout/osgi/Activator.java
(added)
+++
whirr/branches/branch-0.8/services/mahout/src/main/java/org/apache/whirr/service/mahout/osgi/Activator.java
Sat Aug 18 20:54:39 2012
@@ -0,0 +1,87 @@
+/*
+ * 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.whirr.service.mahout.osgi;
+
+import org.apache.whirr.service.ClusterActionHandler;
+import org.apache.whirr.service.mahout.MahoutClientClusterActionHandler;
+import org.jclouds.scriptbuilder.functionloader.osgi.BundleFunctionLoader;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+import java.util.Properties;
+
+public class Activator implements BundleActivator {
+
+ private BundleFunctionLoader functionLoader;
+ private final ClusterActionHandler clusterActionHandler = new
MahoutClientClusterActionHandler();
+ private ServiceRegistration registration;
+
+ /**
+ * Called when this bundle is started so the Framework can perform the
+ * bundle-specific activities necessary to start this bundle. This method
+ * can be used to register services or to allocate any resources that this
+ * bundle needs.
+ * <p/>
+ * <p/>
+ * This method must complete and return to its caller in a timely manner.
+ *
+ * @param context The execution context of the bundle being started.
+ * @throws Exception If this method throws an exception, this
+ * bundle is marked as stopped and the Framework will
remove this
+ * bundle's listeners, unregister all services registered
by this
+ * bundle, and release all services used by this bundle.
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ //Initialize OSGi based FunctionLoader
+ functionLoader = new BundleFunctionLoader(context);
+ functionLoader.start();
+
+ Properties props = new Properties();
+ props.put("name", "mahout-client");
+ registration =
context.registerService(ClusterActionHandler.class.getName(),
clusterActionHandler, props);
+ }
+
+ /**
+ * Called when this bundle is stopped so the Framework can perform the
+ * bundle-specific activities necessary to stop the bundle. In general, this
+ * method should undo the work that the <code>BundleActivator.start</code>
+ * method started. There should be no active threads that were started by
+ * this bundle when this bundle returns. A stopped bundle must not call any
+ * Framework objects.
+ * <p/>
+ * <p/>
+ * This method must complete and return to its caller in a timely manner.
+ *
+ * @param context The execution context of the bundle being stopped.
+ * @throws Exception If this method throws an exception, the
+ * bundle is still marked as stopped, and the Framework
will remove
+ * the bundle's listeners, unregister all services
registered by the
+ * bundle, and release all services used by the bundle.
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ if (registration != null) {
+ registration.unregister();
+ }
+ if (functionLoader != null) {
+ functionLoader.stop();
+ }
+ }
+}
Propchange:
whirr/branches/branch-0.8/services/mahout/src/main/java/org/apache/whirr/service/mahout/osgi/Activator.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: whirr/branches/branch-0.8/services/pig/pom.xml
URL:
http://svn.apache.org/viewvc/whirr/branches/branch-0.8/services/pig/pom.xml?rev=1374653&r1=1374652&r2=1374653&view=diff
==============================================================================
--- whirr/branches/branch-0.8/services/pig/pom.xml (original)
+++ whirr/branches/branch-0.8/services/pig/pom.xml Sat Aug 18 20:54:39 2012
@@ -36,7 +36,7 @@
<osgi.export>
org.apache.whirr.service.pig*;version="${project.version}"
</osgi.export>
-
<osgi.fragment.host>jclouds-scriptbuilder;bundle-version="${jclouds.osgi.version.clean}"</osgi.fragment.host>
+
<osgi.bundle.activator>org.apache.whirr.service.pig.osgi.Activator</osgi.bundle.activator>
</properties>
<dependencies>
<dependency>
@@ -74,6 +74,11 @@
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
Added:
whirr/branches/branch-0.8/services/pig/src/main/java/org/apache/whirr/service/pig/osgi/Activator.java
URL:
http://svn.apache.org/viewvc/whirr/branches/branch-0.8/services/pig/src/main/java/org/apache/whirr/service/pig/osgi/Activator.java?rev=1374653&view=auto
==============================================================================
---
whirr/branches/branch-0.8/services/pig/src/main/java/org/apache/whirr/service/pig/osgi/Activator.java
(added)
+++
whirr/branches/branch-0.8/services/pig/src/main/java/org/apache/whirr/service/pig/osgi/Activator.java
Sat Aug 18 20:54:39 2012
@@ -0,0 +1,87 @@
+/*
+ * 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.whirr.service.pig.osgi;
+
+import org.apache.whirr.service.ClusterActionHandler;
+import org.apache.whirr.service.pig.PigClientClusterActionHandler;
+import org.jclouds.scriptbuilder.functionloader.osgi.BundleFunctionLoader;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+import java.util.Properties;
+
+public class Activator implements BundleActivator {
+
+ private BundleFunctionLoader functionLoader;
+ private final ClusterActionHandler clusterActionHandler = new
PigClientClusterActionHandler();
+ private ServiceRegistration registration;
+
+ /**
+ * Called when this bundle is started so the Framework can perform the
+ * bundle-specific activities necessary to start this bundle. This method
+ * can be used to register services or to allocate any resources that this
+ * bundle needs.
+ * <p/>
+ * <p/>
+ * This method must complete and return to its caller in a timely manner.
+ *
+ * @param context The execution context of the bundle being started.
+ * @throws Exception If this method throws an exception, this
+ * bundle is marked as stopped and the Framework will
remove this
+ * bundle's listeners, unregister all services registered
by this
+ * bundle, and release all services used by this bundle.
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ //Initialize OSGi based FunctionLoader
+ functionLoader = new BundleFunctionLoader(context);
+ functionLoader.start();
+
+ Properties props = new Properties();
+ props.put("name", "pig-client");
+ registration =
context.registerService(ClusterActionHandler.class.getName(),
clusterActionHandler, props);
+ }
+
+ /**
+ * Called when this bundle is stopped so the Framework can perform the
+ * bundle-specific activities necessary to stop the bundle. In general, this
+ * method should undo the work that the <code>BundleActivator.start</code>
+ * method started. There should be no active threads that were started by
+ * this bundle when this bundle returns. A stopped bundle must not call any
+ * Framework objects.
+ * <p/>
+ * <p/>
+ * This method must complete and return to its caller in a timely manner.
+ *
+ * @param context The execution context of the bundle being stopped.
+ * @throws Exception If this method throws an exception, the
+ * bundle is still marked as stopped, and the Framework
will remove
+ * the bundle's listeners, unregister all services
registered by the
+ * bundle, and release all services used by the bundle.
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ if (registration != null) {
+ registration.unregister();
+ }
+ if (functionLoader != null) {
+ functionLoader.stop();
+ }
+ }
+}
Propchange:
whirr/branches/branch-0.8/services/pig/src/main/java/org/apache/whirr/service/pig/osgi/Activator.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: whirr/branches/branch-0.8/services/puppet/pom.xml
URL:
http://svn.apache.org/viewvc/whirr/branches/branch-0.8/services/puppet/pom.xml?rev=1374653&r1=1374652&r2=1374653&view=diff
==============================================================================
--- whirr/branches/branch-0.8/services/puppet/pom.xml (original)
+++ whirr/branches/branch-0.8/services/puppet/pom.xml Sat Aug 18 20:54:39 2012
@@ -35,7 +35,7 @@
<osgi.export>
org.apache.whirr.service.puppet*;version="${project.version}"
</osgi.export>
-
<osgi.fragment.host>jclouds-scriptbuilder;bundle-version="${jclouds.osgi.version.clean}"</osgi.fragment.host>
+
<osgi.bundle.activator>org.apache.whirr.service.puppet.osgi.Activator</osgi.bundle.activator>
</properties>
<dependencies>
<dependency>
@@ -85,6 +85,11 @@
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
Added:
whirr/branches/branch-0.8/services/puppet/src/main/java/org/apache/whirr/service/puppet/osgi/Activator.java
URL:
http://svn.apache.org/viewvc/whirr/branches/branch-0.8/services/puppet/src/main/java/org/apache/whirr/service/puppet/osgi/Activator.java?rev=1374653&view=auto
==============================================================================
---
whirr/branches/branch-0.8/services/puppet/src/main/java/org/apache/whirr/service/puppet/osgi/Activator.java
(added)
+++
whirr/branches/branch-0.8/services/puppet/src/main/java/org/apache/whirr/service/puppet/osgi/Activator.java
Sat Aug 18 20:54:39 2012
@@ -0,0 +1,96 @@
+/*
+ * 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.whirr.service.puppet.osgi;
+
+import org.apache.whirr.service.ClusterActionHandler;
+import org.apache.whirr.service.ClusterActionHandlerFactory;
+import org.apache.whirr.service.puppet.PuppetClusterActionHandlerFactory;
+import org.jclouds.scriptbuilder.functionloader.osgi.BundleFunctionLoader;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+import java.util.Properties;
+
+public class Activator implements BundleActivator {
+
+ private BundleFunctionLoader functionLoader;
+
+ private final PuppetClusterActionHandlerFactory actionHandlerFactory = new
PuppetClusterActionHandlerFactory();
+ private final ClusterActionHandler clusterActionHandler =
actionHandlerFactory.create("puppet");
+ private ServiceRegistration handlerRegistration;
+ private ServiceRegistration factoryRegistration;
+
+ /**
+ * Called when this bundle is started so the Framework can perform the
+ * bundle-specific activities necessary to start this bundle. This method
+ * can be used to register services or to allocate any resources that this
+ * bundle needs.
+ * <p/>
+ * <p/>
+ * This method must complete and return to its caller in a timely manner.
+ *
+ * @param context The execution context of the bundle being started.
+ * @throws Exception If this method throws an exception, this
+ * bundle is marked as stopped and the Framework will
remove this
+ * bundle's listeners, unregister all services registered
by this
+ * bundle, and release all services used by this bundle.
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ //Initialize OSGi based FunctionLoader
+ functionLoader = new BundleFunctionLoader(context);
+ functionLoader.start();
+
+ factoryRegistration =
context.registerService(ClusterActionHandlerFactory.class.getName(),
actionHandlerFactory, null);
+
+ Properties props = new Properties();
+ props.put("name", "puppet-install");
+ handlerRegistration =
context.registerService(ClusterActionHandler.class.getName(),
clusterActionHandler, props);
+ }
+
+ /**
+ * Called when this bundle is stopped so the Framework can perform the
+ * bundle-specific activities necessary to stop the bundle. In general, this
+ * method should undo the work that the <code>BundleActivator.start</code>
+ * method started. There should be no active threads that were started by
+ * this bundle when this bundle returns. A stopped bundle must not call any
+ * Framework objects.
+ * <p/>
+ * <p/>
+ * This method must complete and return to its caller in a timely manner.
+ *
+ * @param context The execution context of the bundle being stopped.
+ * @throws Exception If this method throws an exception, the
+ * bundle is still marked as stopped, and the Framework
will remove
+ * the bundle's listeners, unregister all services
registered by the
+ * bundle, and release all services used by the bundle.
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ if (handlerRegistration != null) {
+ handlerRegistration.unregister();
+ }
+ if (factoryRegistration != null) {
+ factoryRegistration.unregister();
+ }
+ if (functionLoader != null) {
+ functionLoader.stop();
+ }
+ }
+}
Propchange:
whirr/branches/branch-0.8/services/puppet/src/main/java/org/apache/whirr/service/puppet/osgi/Activator.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: whirr/branches/branch-0.8/services/solr/pom.xml
URL:
http://svn.apache.org/viewvc/whirr/branches/branch-0.8/services/solr/pom.xml?rev=1374653&r1=1374652&r2=1374653&view=diff
==============================================================================
--- whirr/branches/branch-0.8/services/solr/pom.xml (original)
+++ whirr/branches/branch-0.8/services/solr/pom.xml Sat Aug 18 20:54:39 2012
@@ -38,7 +38,7 @@
<osgi.export>
org.apache.whirr.service.solr*;version="${project.version}"
</osgi.export>
-
<osgi.fragment.host>jclouds-scriptbuilder;bundle-version="${jclouds.version}"</osgi.fragment.host>
+
<osgi.bundle.activator>org.apache.whirr.service.solr.osgi.Activator</osgi.bundle.activator>
</properties>
<dependencies>
<dependency>
@@ -74,6 +74,11 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
Added:
whirr/branches/branch-0.8/services/solr/src/main/java/org/apache/whirr/service/solr/osgi/Activator.java
URL:
http://svn.apache.org/viewvc/whirr/branches/branch-0.8/services/solr/src/main/java/org/apache/whirr/service/solr/osgi/Activator.java?rev=1374653&view=auto
==============================================================================
---
whirr/branches/branch-0.8/services/solr/src/main/java/org/apache/whirr/service/solr/osgi/Activator.java
(added)
+++
whirr/branches/branch-0.8/services/solr/src/main/java/org/apache/whirr/service/solr/osgi/Activator.java
Sat Aug 18 20:54:39 2012
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.whirr.service.solr.osgi;
+
+import org.apache.whirr.service.ClusterActionHandler;
+import org.apache.whirr.service.solr.SolrClusterActionHandler;
+import org.jclouds.scriptbuilder.functionloader.osgi.BundleFunctionLoader;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+import java.util.Properties;
+
+public class Activator implements BundleActivator {
+
+ private BundleFunctionLoader functionLoader;
+
+ private final ClusterActionHandler clusterActionHandler = new
SolrClusterActionHandler();
+ private ServiceRegistration registration;
+
+ /**
+ * Called when this bundle is started so the Framework can perform the
+ * bundle-specific activities necessary to start this bundle. This method
+ * can be used to register services or to allocate any resources that this
+ * bundle needs.
+ * <p/>
+ * <p/>
+ * This method must complete and return to its caller in a timely manner.
+ *
+ * @param context The execution context of the bundle being started.
+ * @throws Exception If this method throws an exception, this
+ * bundle is marked as stopped and the Framework will
remove this
+ * bundle's listeners, unregister all services registered
by this
+ * bundle, and release all services used by this bundle.
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ //Initialize OSGi based FunctionLoader
+ functionLoader = new BundleFunctionLoader(context);
+ functionLoader.start();
+
+ Properties props = new Properties();
+ props.put("name", "solr");
+ registration =
context.registerService(ClusterActionHandler.class.getName(),
clusterActionHandler, props);
+ }
+
+ /**
+ * Called when this bundle is stopped so the Framework can perform the
+ * bundle-specific activities necessary to stop the bundle. In general, this
+ * method should undo the work that the <code>BundleActivator.start</code>
+ * method started. There should be no active threads that were started by
+ * this bundle when this bundle returns. A stopped bundle must not call any
+ * Framework objects.
+ * <p/>
+ * <p/>
+ * This method must complete and return to its caller in a timely manner.
+ *
+ * @param context The execution context of the bundle being stopped.
+ * @throws Exception If this method throws an exception, the
+ * bundle is still marked as stopped, and the Framework
will remove
+ * the bundle's listeners, unregister all services
registered by the
+ * bundle, and release all services used by the bundle.
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ if (registration != null) {
+ registration.unregister();
+ }
+ if (functionLoader != null) {
+ functionLoader.stop();
+ }
+ }
+}
Propchange:
whirr/branches/branch-0.8/services/solr/src/main/java/org/apache/whirr/service/solr/osgi/Activator.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: whirr/branches/branch-0.8/services/voldemort/pom.xml
URL:
http://svn.apache.org/viewvc/whirr/branches/branch-0.8/services/voldemort/pom.xml?rev=1374653&r1=1374652&r2=1374653&view=diff
==============================================================================
--- whirr/branches/branch-0.8/services/voldemort/pom.xml (original)
+++ whirr/branches/branch-0.8/services/voldemort/pom.xml Sat Aug 18 20:54:39
2012
@@ -37,7 +37,7 @@
<osgi.export>
org.apache.whirr.service.voldemort*;version="${project.version}"
</osgi.export>
-
<osgi.fragment.host>jclouds-scriptbuilder;bundle-version="${jclouds.osgi.version.clean}"</osgi.fragment.host>
+
<osgi.bundle.activator>org.apache.whirr.service.voldemort.osgi.Activator</osgi.bundle.activator>
</properties>
<dependencies>
<dependency>
@@ -100,6 +100,11 @@
<artifactId>jdom</artifactId>
<version>${jdom.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
Added:
whirr/branches/branch-0.8/services/voldemort/src/main/java/org/apache/whirr/service/voldemort/osgi/Activator.java
URL:
http://svn.apache.org/viewvc/whirr/branches/branch-0.8/services/voldemort/src/main/java/org/apache/whirr/service/voldemort/osgi/Activator.java?rev=1374653&view=auto
==============================================================================
---
whirr/branches/branch-0.8/services/voldemort/src/main/java/org/apache/whirr/service/voldemort/osgi/Activator.java
(added)
+++
whirr/branches/branch-0.8/services/voldemort/src/main/java/org/apache/whirr/service/voldemort/osgi/Activator.java
Sat Aug 18 20:54:39 2012
@@ -0,0 +1,86 @@
+/*
+ * 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.whirr.service.voldemort.osgi;
+
+import org.apache.whirr.service.ClusterActionHandler;
+import org.apache.whirr.service.cassandra.CassandraClusterActionHandler;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+import java.util.Properties;
+
+public class Activator implements BundleActivator {
+
+ private BundleFunctionLoader functionLoader;
+ private final ClusterActionHandler clusterActionHandler = new
CassandraClusterActionHandler();
+ private ServiceRegistration registration;
+
+ /**
+ * Called when this bundle is started so the Framework can perform the
+ * bundle-specific activities necessary to start this bundle. This method
+ * can be used to register services or to allocate any resources that this
+ * bundle needs.
+ * <p/>
+ * <p/>
+ * This method must complete and return to its caller in a timely manner.
+ *
+ * @param context The execution context of the bundle being started.
+ * @throws Exception If this method throws an exception, this
+ * bundle is marked as stopped and the Framework will
remove this
+ * bundle's listeners, unregister all services registered
by this
+ * bundle, and release all services used by this bundle.
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ //Initialize OSGi based FunctionLoader
+ functionLoader = new BundleFunctionLoader(context);
+ functionLoader.start();
+
+ Properties props = new Properties();
+ props.put("name", "cassandra");
+ registration =
context.registerService(ClusterActionHandler.class.getName(),
clusterActionHandler, props);
+ }
+
+ /**
+ * Called when this bundle is stopped so the Framework can perform the
+ * bundle-specific activities necessary to stop the bundle. In general, this
+ * method should undo the work that the <code>BundleActivator.start</code>
+ * method started. There should be no active threads that were started by
+ * this bundle when this bundle returns. A stopped bundle must not call any
+ * Framework objects.
+ * <p/>
+ * <p/>
+ * This method must complete and return to its caller in a timely manner.
+ *
+ * @param context The execution context of the bundle being stopped.
+ * @throws Exception If this method throws an exception, the
+ * bundle is still marked as stopped, and the Framework
will remove
+ * the bundle's listeners, unregister all services
registered by the
+ * bundle, and release all services used by the bundle.
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ if (registration != null) {
+ registration.unregister();
+ }
+ if (functionLoader != null) {
+ functionLoader.stop();
+ }
+ }
+}
Propchange:
whirr/branches/branch-0.8/services/voldemort/src/main/java/org/apache/whirr/service/voldemort/osgi/Activator.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: whirr/branches/branch-0.8/services/yarn/pom.xml
URL:
http://svn.apache.org/viewvc/whirr/branches/branch-0.8/services/yarn/pom.xml?rev=1374653&r1=1374652&r2=1374653&view=diff
==============================================================================
--- whirr/branches/branch-0.8/services/yarn/pom.xml (original)
+++ whirr/branches/branch-0.8/services/yarn/pom.xml Sat Aug 18 20:54:39 2012
@@ -25,12 +25,22 @@
</parent>
<groupId>org.apache.whirr</groupId>
<artifactId>whirr-yarn</artifactId>
- <packaging>jar</packaging>
+ <packaging>bundle</packaging>
<version>0.8.0</version>
<name>Apache Whirr YARN</name>
<properties>
<hadoop.version>0.20.2</hadoop.version>
+ <osgi.import>
+ !org.apache.whirr.service.yarn*,
+ org.apache.commons.configuration*;version="[1.6,2)",
+ *
+ </osgi.import>
+ <osgi.export>
+ org.apache.whirr.service.yarn*;version="${project.version}"
+ </osgi.export>
+
<osgi.bundle.activator>org.apache.whirr.service.yarn.osgi.Activator</osgi.bundle.activator>
</properties>
+
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
@@ -117,6 +127,11 @@
<version>0.23.1</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
Added:
whirr/branches/branch-0.8/services/yarn/src/main/java/org/apache/whirr/service/yarn/osgi/Activator.java
URL:
http://svn.apache.org/viewvc/whirr/branches/branch-0.8/services/yarn/src/main/java/org/apache/whirr/service/yarn/osgi/Activator.java?rev=1374653&view=auto
==============================================================================
---
whirr/branches/branch-0.8/services/yarn/src/main/java/org/apache/whirr/service/yarn/osgi/Activator.java
(added)
+++
whirr/branches/branch-0.8/services/yarn/src/main/java/org/apache/whirr/service/yarn/osgi/Activator.java
Sat Aug 18 20:54:39 2012
@@ -0,0 +1,99 @@
+/*
+ * 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.whirr.service.yarn.osgi;
+
+import org.apache.whirr.service.ClusterActionHandler;
+import org.apache.whirr.service.yarn.YarnNodeManagerHandler;
+import org.apache.whirr.service.yarn.YarnResourceManagerHandler;
+import org.jclouds.scriptbuilder.functionloader.osgi.BundleFunctionLoader;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+import java.util.Properties;
+
+public class Activator implements BundleActivator {
+
+ private BundleFunctionLoader functionLoader;
+
+ private final ClusterActionHandler nodeManagerClusterActionHandler = new
YarnNodeManagerHandler();
+ private ServiceRegistration nodeManagerRegistration;
+
+ private final ClusterActionHandler resourceManagerClusterActionHandler = new
YarnResourceManagerHandler();
+ private ServiceRegistration resourceManagerRegistration;
+
+ /**
+ * Called when this bundle is started so the Framework can perform the
+ * bundle-specific activities necessary to start this bundle. This method
+ * can be used to register services or to allocate any resources that this
+ * bundle needs.
+ * <p/>
+ * <p/>
+ * This method must complete and return to its caller in a timely manner.
+ *
+ * @param context The execution context of the bundle being started.
+ * @throws Exception If this method throws an exception, this
+ * bundle is marked as stopped and the Framework will
remove this
+ * bundle's listeners, unregister all services registered
by this
+ * bundle, and release all services used by this bundle.
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ //Initialize OSGi based FunctionLoader
+ functionLoader = new BundleFunctionLoader(context);
+ functionLoader.start();
+
+ Properties nodeManagerProps = new Properties();
+ nodeManagerProps.put("name", "yarn-nodemanager");
+ nodeManagerRegistration =
context.registerService(ClusterActionHandler.class.getName(),
nodeManagerClusterActionHandler, nodeManagerProps);
+
+ Properties resourceManagerProps = new Properties();
+ resourceManagerProps.put("name", "yarn-resourcemanager");
+ resourceManagerRegistration =
context.registerService(ClusterActionHandler.class.getName(),
resourceManagerClusterActionHandler, resourceManagerProps);
+ }
+
+ /**
+ * Called when this bundle is stopped so the Framework can perform the
+ * bundle-specific activities necessary to stop the bundle. In general, this
+ * method should undo the work that the <code>BundleActivator.start</code>
+ * method started. There should be no active threads that were started by
+ * this bundle when this bundle returns. A stopped bundle must not call any
+ * Framework objects.
+ * <p/>
+ * <p/>
+ * This method must complete and return to its caller in a timely manner.
+ *
+ * @param context The execution context of the bundle being stopped.
+ * @throws Exception If this method throws an exception, the
+ * bundle is still marked as stopped, and the Framework
will remove
+ * the bundle's listeners, unregister all services
registered by the
+ * bundle, and release all services used by the bundle.
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ if (nodeManagerRegistration != null) {
+ nodeManagerRegistration.unregister();
+ }
+ if (resourceManagerRegistration != null) {
+ resourceManagerRegistration.unregister();
+ }
+ if (functionLoader != null) {
+ functionLoader.stop();
+ }
+ }
+}
Propchange:
whirr/branches/branch-0.8/services/yarn/src/main/java/org/apache/whirr/service/yarn/osgi/Activator.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: whirr/branches/branch-0.8/services/zookeeper/pom.xml
URL:
http://svn.apache.org/viewvc/whirr/branches/branch-0.8/services/zookeeper/pom.xml?rev=1374653&r1=1374652&r2=1374653&view=diff
==============================================================================
--- whirr/branches/branch-0.8/services/zookeeper/pom.xml (original)
+++ whirr/branches/branch-0.8/services/zookeeper/pom.xml Sat Aug 18 20:54:39
2012
@@ -37,7 +37,7 @@
<osgi.export>
org.apache.whirr.service.zookeeper*;version="${project.version}"
</osgi.export>
-
<osgi.fragment.host>jclouds-scriptbuilder;bundle-version="${jclouds.osgi.version.clean}"</osgi.fragment.host>
+
<osgi.bundle.activator>org.apache.whirr.service.zookeeper.osgi.Activator</osgi.bundle.activator>
</properties>
<dependencies>
<dependency>
@@ -88,6 +88,11 @@
<version>${zookeeper.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
Added:
whirr/branches/branch-0.8/services/zookeeper/src/main/java/org/apache/whirr/service/zookeeper/osgi/Activator.java
URL:
http://svn.apache.org/viewvc/whirr/branches/branch-0.8/services/zookeeper/src/main/java/org/apache/whirr/service/zookeeper/osgi/Activator.java?rev=1374653&view=auto
==============================================================================
---
whirr/branches/branch-0.8/services/zookeeper/src/main/java/org/apache/whirr/service/zookeeper/osgi/Activator.java
(added)
+++
whirr/branches/branch-0.8/services/zookeeper/src/main/java/org/apache/whirr/service/zookeeper/osgi/Activator.java
Sat Aug 18 20:54:39 2012
@@ -0,0 +1,87 @@
+/*
+ * 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.whirr.service.zookeeper.osgi;
+
+import org.apache.whirr.service.ClusterActionHandler;
+import org.apache.whirr.service.zookeeper.ZooKeeperClusterActionHandler;
+import org.jclouds.scriptbuilder.functionloader.osgi.BundleFunctionLoader;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+import java.util.Properties;
+
+public class Activator implements BundleActivator {
+
+ private BundleFunctionLoader functionLoader;
+ private final ClusterActionHandler clusterActionHandler = new
ZooKeeperClusterActionHandler();
+ private ServiceRegistration registration;
+
+ /**
+ * Called when this bundle is started so the Framework can perform the
+ * bundle-specific activities necessary to start this bundle. This method
+ * can be used to register services or to allocate any resources that this
+ * bundle needs.
+ * <p/>
+ * <p/>
+ * This method must complete and return to its caller in a timely manner.
+ *
+ * @param context The execution context of the bundle being started.
+ * @throws Exception If this method throws an exception, this
+ * bundle is marked as stopped and the Framework will
remove this
+ * bundle's listeners, unregister all services registered
by this
+ * bundle, and release all services used by this bundle.
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ //Initialize OSGi based FunctionLoader
+ functionLoader = new BundleFunctionLoader(context);
+ functionLoader.start();
+
+ Properties props = new Properties();
+ props.put("name", "zookeeper");
+ registration =
context.registerService(ClusterActionHandler.class.getName(),
clusterActionHandler, props);
+ }
+
+ /**
+ * Called when this bundle is stopped so the Framework can perform the
+ * bundle-specific activities necessary to stop the bundle. In general, this
+ * method should undo the work that the <code>BundleActivator.start</code>
+ * method started. There should be no active threads that were started by
+ * this bundle when this bundle returns. A stopped bundle must not call any
+ * Framework objects.
+ * <p/>
+ * <p/>
+ * This method must complete and return to its caller in a timely manner.
+ *
+ * @param context The execution context of the bundle being stopped.
+ * @throws Exception If this method throws an exception, the
+ * bundle is still marked as stopped, and the Framework
will remove
+ * the bundle's listeners, unregister all services
registered by the
+ * bundle, and release all services used by the bundle.
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ if (registration != null) {
+ registration.unregister();
+ }
+ if (functionLoader != null) {
+ functionLoader.stop();
+ }
+ }
+}
Propchange:
whirr/branches/branch-0.8/services/zookeeper/src/main/java/org/apache/whirr/service/zookeeper/osgi/Activator.java
------------------------------------------------------------------------------
svn:eol-style = native