You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2012/01/19 08:04:06 UTC
svn commit: r1233211 - in /karaf/cellar/trunk:
bundle/src/main/java/org/apache/karaf/cellar/bundle/
config/src/main/java/org/apache/karaf/cellar/config/
core/src/main/java/org/apache/karaf/cellar/core/event/
dosgi/src/main/java/org/apache/karaf/cellar/...
Author: jbonofre
Date: Thu Jan 19 07:04:05 2012
New Revision: 1233211
URL: http://svn.apache.org/viewvc?rev=1233211&view=rev
Log:
Various checkstyle fixes
Modified:
karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleEventHandler.java
karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleState.java
karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSupport.java
karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/Constants.java
karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java
karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/RemoteBundleEvent.java
karaf/cellar/trunk/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationEventHandler.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventTransportFactory.java
karaf/cellar/trunk/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/ExportServiceListener.java
karaf/cellar/trunk/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/shell/ListDistributedServicesCommand.java
karaf/cellar/trunk/dosgi/src/test/java/org/apache/karaf/cellar/dosgi/EndpointDescriptionTest.java
karaf/cellar/trunk/dosgi/src/test/java/org/apache/karaf/cellar/dosgi/ExportServiceListenerTest.java
karaf/cellar/trunk/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastEventTransportFactory.java
karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarChildNodesTest.java
karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarConfigurationTest.java
karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarFeaturesTest.java
karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarGroupsTest.java
karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarSampleCamelHazelcastTest.java
karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarSampleDosgiGreeterTest.java
karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarTestSupport.java
karaf/cellar/trunk/samples/camel-hazelcast-app/consumer/src/main/resources/OSGI-INF/blueprint/blueprint.xml
karaf/cellar/trunk/samples/camel-hazelcast-app/producer/src/main/resources/OSGI-INF/blueprint/blueprint.xml
karaf/cellar/trunk/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupPickCommand.java
Modified: karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleEventHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleEventHandler.java?rev=1233211&r1=1233210&r2=1233211&view=diff
==============================================================================
--- karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleEventHandler.java (original)
+++ karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleEventHandler.java Thu Jan 19 07:04:05 2012
@@ -11,7 +11,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.karaf.cellar.bundle;
import org.apache.karaf.cellar.core.Configurations;
@@ -30,18 +29,19 @@ import java.util.Map;
public class BundleEventHandler extends BundleSupport implements EventHandler<RemoteBundleEvent> {
- private static final transient Logger LOGGER = LoggerFactory.getLogger(BundleEventHandler.class);
+ private static final transient Logger LOGGER = LoggerFactory.getLogger(BundleEventHandler.class);
- public static final String SWITCH_ID = "org.apache.karaf.cellar.bundle.handler";
+ public static final String SWITCH_ID = "org.apache.karaf.cellar.bundle.handler";
- private final Switch eventSwitch = new BasicSwitch(SWITCH_ID);
+ private final Switch eventSwitch = new BasicSwitch(SWITCH_ID);
private Node node;
- /**
- * Handles remote bundle events.
- * @param event
- */
- public void handle(RemoteBundleEvent event) {
+ /**
+ * Handles remote bundle events.
+ *
+ * @param event
+ */
+ public void handle(RemoteBundleEvent event) {
if (event == null || event.getSourceGroup() == null || node == null || node.equals(event.getSourceNode()))
return;
@@ -52,39 +52,39 @@ public class BundleEventHandler extends
Map<String, BundleState> bundleTable = clusterManager.getMap(Constants.BUNDLE_MAP + Configurations.SEPARATOR + groupName);
- try {
- //Check if the pid is marked as local.
+ try {
+ //Check if the pid is marked as local.
if (isAllowed(event.getSourceGroup(), Constants.CATEGORY, bundleLocation, EventType.INBOUND)) {
- BundleState state = new BundleState();
- state.setLocation(event.getLocation());
- state.setStatus(event.getType());
-
- if(event.getType() == BundleEvent.INSTALLED) {
- installBundleFromLocation(event.getLocation());
- bundleTable.put(event.getId(),state);
+ BundleState state = new BundleState();
+ state.setLocation(event.getLocation());
+ state.setStatus(event.getType());
+
+ if (event.getType() == BundleEvent.INSTALLED) {
+ installBundleFromLocation(event.getLocation());
+ bundleTable.put(event.getId(), state);
LOGGER.debug("CELLAR BUNDLE: installing {}/{}", event.getSymbolicName(), event.getVersion());
- } else if(event.getType() == BundleEvent.UNINSTALLED) {
- uninstallBundle(event.getSymbolicName(), event.getVersion());
- bundleTable.remove(event.getId());
+ } else if (event.getType() == BundleEvent.UNINSTALLED) {
+ uninstallBundle(event.getSymbolicName(), event.getVersion());
+ bundleTable.remove(event.getId());
LOGGER.debug("CELLAR BUNDLE: uninstalling {}/{}", event.getSymbolicName(), event.getVersion());
- } else if(event.getType() == BundleEvent.STARTED) {
- startBundle(event.getSymbolicName(),event.getVersion());
- bundleTable.put(event.getId(),state);
+ } else if (event.getType() == BundleEvent.STARTED) {
+ startBundle(event.getSymbolicName(), event.getVersion());
+ bundleTable.put(event.getId(), state);
LOGGER.debug("CELLAR BUNDLE: starting {}/{}", event.getSymbolicName(), event.getVersion());
- } else if(event.getType() == BundleEvent.STOPPED) {
- stopBundle(event.getSymbolicName(), event.getVersion());
- state.setStatus(BundleEvent.INSTALLED);
- bundleTable.put(event.getId(),state);
+ } else if (event.getType() == BundleEvent.STOPPED) {
+ stopBundle(event.getSymbolicName(), event.getVersion());
+ state.setStatus(BundleEvent.INSTALLED);
+ bundleTable.put(event.getId(), state);
LOGGER.debug("CELLAR BUNDLE: stopping {}/{}", event.getSymbolicName(), event.getVersion());
- } else if(event.getType() == BundleEvent.UPDATED) {
- updateBundle(event.getSymbolicName(), event.getVersion());
+ } else if (event.getType() == BundleEvent.UPDATED) {
+ updateBundle(event.getSymbolicName(), event.getVersion());
LOGGER.debug("CELLAR BUNDLE: updating {}/{}", event.getSymbolicName(), event.getVersion());
- }
- } else LOGGER.warn("CELLAR BUNDLE: bundle {} is marked as BLOCKED INBOUND", event.getSymbolicName());
- } catch (BundleException e) {
- LOGGER.error("CELLAR BUNDLE: failed to install bundle {}/{}.", new Object[]{ event.getSymbolicName(), event.getVersion() }, e);
- }
- }
+ }
+ } else LOGGER.warn("CELLAR BUNDLE: bundle {} is marked as BLOCKED INBOUND", event.getSymbolicName());
+ } catch (BundleException e) {
+ LOGGER.error("CELLAR BUNDLE: failed to install bundle {}/{}.", new Object[]{event.getSymbolicName(), event.getVersion()}, e);
+ }
+ }
/**
* Initialization Method.
Modified: karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleState.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleState.java?rev=1233211&r1=1233210&r2=1233211&view=diff
==============================================================================
--- karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleState.java (original)
+++ karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleState.java Thu Jan 19 07:04:05 2012
@@ -11,7 +11,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.karaf.cellar.bundle;
import java.io.Serializable;
@@ -21,31 +20,31 @@ public class BundleState implements Seri
private static final long serialVersionUID = 5933673686648413918L;
private String location;
- private int status;
- private byte[] data;
+ private int status;
+ private byte[] data;
- public String getLocation() {
- return location;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
- public int getStatus() {
- return status;
- }
-
- public void setStatus(int status) {
- this.status = status;
- }
-
- public byte[] getData() {
- return data;
- }
-
- public void setData(byte[] data) {
- this.data = data.clone();
- }
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public int getStatus() {
+ return status;
+ }
+
+ public void setStatus(int status) {
+ this.status = status;
+ }
+
+ public byte[] getData() {
+ return data;
+ }
+
+ public void setData(byte[] data) {
+ this.data = data.clone();
+ }
}
Modified: karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSupport.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSupport.java?rev=1233211&r1=1233210&r2=1233211&view=diff
==============================================================================
--- karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSupport.java (original)
+++ karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSupport.java Thu Jan 19 07:04:05 2012
@@ -11,7 +11,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.karaf.cellar.bundle;
import org.apache.karaf.cellar.core.CellarSupport;
@@ -26,127 +25,133 @@ import java.util.Properties;
public class BundleSupport extends CellarSupport {
- protected BundleContext bundleContext;
+ protected BundleContext bundleContext;
+
+ /**
+ * Reads a {@code Dictionary} object and creates a property object out of it.
+ *
+ * @param dictionary
+ * @return
+ */
+ public Properties dictionaryToProperties(Dictionary dictionary) {
+ Properties properties = new Properties();
+ if (dictionary != null && dictionary.keys() != null) {
+
+ Enumeration keys = dictionary.keys();
+ while (keys.hasMoreElements()) {
+ String key = (String) keys.nextElement();
+ if (key != null && dictionary.get(key) != null) {
+ properties.put(key, dictionary.get(key));
+ }
+ }
+ }
+ return properties;
+ }
- /**
- * Reads a {@code Dictionary} object and creates a property object out of it.
- *
- * @param dictionary
- * @return
- */
- public Properties dictionaryToProperties(Dictionary dictionary) {
- Properties properties = new Properties();
- if (dictionary != null && dictionary.keys() != null) {
-
- Enumeration keys = dictionary.keys();
- while (keys.hasMoreElements()) {
- String key = (String) keys.nextElement();
- if (key != null && dictionary.get(key) != null) {
- properties.put(key, dictionary.get(key));
- }
- }
- }
- return properties;
- }
-
-
- /**
- * Installs a bundle using its location.
- */
- public void installBundleFromLocation(String location) throws BundleException {
- getBundleContext().installBundle(location);
- }
-
- /**
- * Uninstalls a bundle using its Symbolic name and version.
- * @param symbolicName
- * @param version
- * @throws BundleException
- */
- public void uninstallBundle(String symbolicName, String version) throws BundleException {
- Bundle[] bundles = getBundleContext().getBundles();
- if(bundles != null) {
- for(Bundle bundle:bundles) {
- if(bundle.getSymbolicName().equals(symbolicName) && bundle.getVersion().toString().equals(version)) {
- bundle.uninstall();
- }
- }
- }
- }
-
- /**
- * Starts a bundle using its Symbolic name and version.
- * @param symbolicName
- * @param version
- * @throws BundleException
- */
- public void startBundle(String symbolicName, String version) throws BundleException {
- Bundle[] bundles = getBundleContext().getBundles();
- if(bundles != null) {
- for(Bundle bundle:bundles) {
- if(bundle.getSymbolicName().equals(symbolicName) && bundle.getVersion().toString().equals(version)) {
- bundle.start();
- }
- }
- }
- }
-
- /**
- * Stops a bundle using its Symbolic name and version.
- * @param symbolicName
- * @param version
- * @throws BundleException
- */
- public void stopBundle(String symbolicName, String version) throws BundleException {
- Bundle[] bundles = getBundleContext().getBundles();
- if(bundles != null) {
- for(Bundle bundle:bundles) {
- if(bundle.getSymbolicName().equals(symbolicName) && bundle.getVersion().toString().equals(version)) {
- bundle.stop();
- }
- }
- }
- }
-
- /**
- * Updates a bundle using its Symbolic name and version.
- * @param symbolicName
- * @param version
- * @throws BundleException
- */
- public void updateBundle(String symbolicName, String version) throws BundleException {
- Bundle[] bundles = getBundleContext().getBundles();
- if(bundles != null) {
- for(Bundle bundle:bundles) {
- if(bundle.getSymbolicName().equals(symbolicName) && bundle.getVersion().toString().equals(version)) {
- bundle.update();
- }
- }
- }
- }
-
- /**
- * Returns the {@link BundleContext}.
- * @return
- */
- public BundleContext getBundleContext() {
- return this.bundleContext;
- }
-
- /**
- * Sets the {@link BundleContext}.
- * @param bundleContext
- */
- public void setBundleContext(BundleContext bundleContext) {
- this.bundleContext = bundleContext;
- }
-
- public ConfigurationAdmin getConfigurationAdmin() {
- return configurationAdmin;
- }
-
- public void setConfigurationAdmin(ConfigurationAdmin configurationAdmin) {
- this.configurationAdmin = configurationAdmin;
- }
+
+ /**
+ * Installs a bundle using its location.
+ */
+ public void installBundleFromLocation(String location) throws BundleException {
+ getBundleContext().installBundle(location);
+ }
+
+ /**
+ * Uninstalls a bundle using its Symbolic name and version.
+ *
+ * @param symbolicName
+ * @param version
+ * @throws BundleException
+ */
+ public void uninstallBundle(String symbolicName, String version) throws BundleException {
+ Bundle[] bundles = getBundleContext().getBundles();
+ if (bundles != null) {
+ for (Bundle bundle : bundles) {
+ if (bundle.getSymbolicName().equals(symbolicName) && bundle.getVersion().toString().equals(version)) {
+ bundle.uninstall();
+ }
+ }
+ }
+ }
+
+ /**
+ * Starts a bundle using its Symbolic name and version.
+ *
+ * @param symbolicName
+ * @param version
+ * @throws BundleException
+ */
+ public void startBundle(String symbolicName, String version) throws BundleException {
+ Bundle[] bundles = getBundleContext().getBundles();
+ if (bundles != null) {
+ for (Bundle bundle : bundles) {
+ if (bundle.getSymbolicName().equals(symbolicName) && bundle.getVersion().toString().equals(version)) {
+ bundle.start();
+ }
+ }
+ }
+ }
+
+ /**
+ * Stops a bundle using its Symbolic name and version.
+ *
+ * @param symbolicName
+ * @param version
+ * @throws BundleException
+ */
+ public void stopBundle(String symbolicName, String version) throws BundleException {
+ Bundle[] bundles = getBundleContext().getBundles();
+ if (bundles != null) {
+ for (Bundle bundle : bundles) {
+ if (bundle.getSymbolicName().equals(symbolicName) && bundle.getVersion().toString().equals(version)) {
+ bundle.stop();
+ }
+ }
+ }
+ }
+
+ /**
+ * Updates a bundle using its Symbolic name and version.
+ *
+ * @param symbolicName
+ * @param version
+ * @throws BundleException
+ */
+ public void updateBundle(String symbolicName, String version) throws BundleException {
+ Bundle[] bundles = getBundleContext().getBundles();
+ if (bundles != null) {
+ for (Bundle bundle : bundles) {
+ if (bundle.getSymbolicName().equals(symbolicName) && bundle.getVersion().toString().equals(version)) {
+ bundle.update();
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns the {@link BundleContext}.
+ *
+ * @return
+ */
+ public BundleContext getBundleContext() {
+ return this.bundleContext;
+ }
+
+ /**
+ * Sets the {@link BundleContext}.
+ *
+ * @param bundleContext
+ */
+ public void setBundleContext(BundleContext bundleContext) {
+ this.bundleContext = bundleContext;
+ }
+
+ public ConfigurationAdmin getConfigurationAdmin() {
+ return configurationAdmin;
+ }
+
+ public void setConfigurationAdmin(ConfigurationAdmin configurationAdmin) {
+ this.configurationAdmin = configurationAdmin;
+ }
}
Modified: karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/Constants.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/Constants.java?rev=1233211&r1=1233210&r2=1233211&view=diff
==============================================================================
--- karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/Constants.java (original)
+++ karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/Constants.java Thu Jan 19 07:04:05 2012
@@ -11,14 +11,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.karaf.cellar.bundle;
public class Constants {
public static final String CATEGORY = "bundle";
- public static final String BUNDLE_MAP = "org.apache.karaf.cellar.bundle.map";
+ public static final String BUNDLE_MAP = "org.apache.karaf.cellar.bundle.map";
- private Constants(){}
+ private Constants() {
+ }
}
Modified: karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java?rev=1233211&r1=1233210&r2=1233211&view=diff
==============================================================================
--- karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java (original)
+++ karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java Thu Jan 19 07:04:05 2012
@@ -43,8 +43,8 @@ public class LocalBundleListener extends
if (event != null && event.getBundle() != null) {
Set<Group> groups = null;
try {
- groups = groupManager.listLocalGroups();
- }catch (Exception ex) {
+ groups = groupManager.listLocalGroups();
+ } catch (Exception ex) {
LOGGER.warn("Failed to list local groups. Is Cellar uninstalling?");
}
Modified: karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/RemoteBundleEvent.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/RemoteBundleEvent.java?rev=1233211&r1=1233210&r2=1233211&view=diff
==============================================================================
--- karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/RemoteBundleEvent.java (original)
+++ karaf/cellar/trunk/bundle/src/main/java/org/apache/karaf/cellar/bundle/RemoteBundleEvent.java Thu Jan 19 07:04:05 2012
@@ -17,55 +17,49 @@ import org.apache.karaf.cellar.core.even
public class RemoteBundleEvent extends Event {
- private String symbolicName;
- private String version;
- private String location;
- private int type;
-
- /**
- * Constructor
- * @param symbolicName
- * @param version
- * @param location
- */
- public RemoteBundleEvent(String symbolicName,String version, String location, int type) {
- super(symbolicName+"/"+version);
- this.symbolicName=symbolicName;
- this.version=version;
- this.location=location;
- this.type=type;
- }
-
- public String getSymbolicName() {
- return symbolicName;
- }
-
- public void setSymbolicName(String symbolicName) {
- this.symbolicName = symbolicName;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public String getLocation() {
- return location;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
- public int getType() {
- return type;
- }
-
- public void setType(int type) {
- this.type = type;
- }
+ private String symbolicName;
+ private String version;
+ private String location;
+ private int type;
+
+ public RemoteBundleEvent(String symbolicName, String version, String location, int type) {
+ super(symbolicName + "/" + version);
+ this.symbolicName = symbolicName;
+ this.version = version;
+ this.location = location;
+ this.type = type;
+ }
+
+ public String getSymbolicName() {
+ return symbolicName;
+ }
+
+ public void setSymbolicName(String symbolicName) {
+ this.symbolicName = symbolicName;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public void setType(int type) {
+ this.type = type;
+ }
}
Modified: karaf/cellar/trunk/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationEventHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationEventHandler.java?rev=1233211&r1=1233210&r2=1233211&view=diff
==============================================================================
--- karaf/cellar/trunk/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationEventHandler.java (original)
+++ karaf/cellar/trunk/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationEventHandler.java Thu Jan 19 07:04:05 2012
@@ -13,7 +13,6 @@
*/
package org.apache.karaf.cellar.config;
-
import org.apache.karaf.cellar.core.Configurations;
import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.Node;
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventTransportFactory.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventTransportFactory.java?rev=1233211&r1=1233210&r2=1233211&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventTransportFactory.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventTransportFactory.java Thu Jan 19 07:04:05 2012
@@ -11,19 +11,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.karaf.cellar.core.event;
-import org.apache.karaf.cellar.core.event.EventConsumer;
-import org.apache.karaf.cellar.core.event.EventProducer;
-
-/**
- * @author: iocanel
- */
public interface EventTransportFactory {
/**
* Returns an Event Producer that produces {@link Event}s for a specific {@link org.apache.karaf.cellar.core.Group}.
+ *
* @param name
* @param pubsub
* @return
@@ -32,6 +26,7 @@ public interface EventTransportFactory {
/**
* Returns an Event Consumer that consumes {@link Event}s for a specific {@link org.apache.karaf.cellar.core.Group}.
+ *
* @param name
* @param pubsub
* @return
Modified: karaf/cellar/trunk/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/ExportServiceListener.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/ExportServiceListener.java?rev=1233211&r1=1233210&r2=1233211&view=diff
==============================================================================
--- karaf/cellar/trunk/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/ExportServiceListener.java (original)
+++ karaf/cellar/trunk/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/ExportServiceListener.java Thu Jan 19 07:04:05 2012
@@ -247,4 +247,5 @@ public class ExportServiceListener imple
public void setBundleContext(BundleContext bundleContext) {
this.bundleContext = bundleContext;
}
+
}
Modified: karaf/cellar/trunk/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/shell/ListDistributedServicesCommand.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/shell/ListDistributedServicesCommand.java?rev=1233211&r1=1233210&r2=1233211&view=diff
==============================================================================
--- karaf/cellar/trunk/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/shell/ListDistributedServicesCommand.java (original)
+++ karaf/cellar/trunk/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/shell/ListDistributedServicesCommand.java Thu Jan 19 07:04:05 2012
@@ -53,4 +53,5 @@ public class ListDistributedServicesComm
}
return null;
}
+
}
Modified: karaf/cellar/trunk/dosgi/src/test/java/org/apache/karaf/cellar/dosgi/EndpointDescriptionTest.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/dosgi/src/test/java/org/apache/karaf/cellar/dosgi/EndpointDescriptionTest.java?rev=1233211&r1=1233210&r2=1233211&view=diff
==============================================================================
--- karaf/cellar/trunk/dosgi/src/test/java/org/apache/karaf/cellar/dosgi/EndpointDescriptionTest.java (original)
+++ karaf/cellar/trunk/dosgi/src/test/java/org/apache/karaf/cellar/dosgi/EndpointDescriptionTest.java Thu Jan 19 07:04:05 2012
@@ -11,15 +11,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.karaf.cellar.dosgi;
import org.junit.Assert;
import org.junit.Test;
-/**
- * @author: iocanel
- */
public class EndpointDescriptionTest {
String objectClass = "org.apache.karaf.cellar.dosgi.Test";
@@ -30,13 +26,13 @@ public class EndpointDescriptionTest {
@Test
public void testMatches() throws Exception {
//This is a dummy test for testing the behaviour of matches method.
- String testEndpointFilter = String.format(filterPattern,objectClass);
- String endpointId = objectClass+Constants.SEPARATOR+"1.0.0";
+ String testEndpointFilter = String.format(filterPattern, objectClass);
+ String endpointId = objectClass + Constants.SEPARATOR + "1.0.0";
- EndpointDescription endpointDescription1 = new EndpointDescription(endpointId,null);
- EndpointDescription endpointDescription2 = new EndpointDescription(endpointId,null);
+ EndpointDescription endpointDescription1 = new EndpointDescription(endpointId, null);
+ EndpointDescription endpointDescription2 = new EndpointDescription(endpointId, null);
Assert.assertTrue(endpointDescription1.matches(testEndpointFilter));
Assert.assertTrue(endpointDescription2.matches(testEndpointFilter));
-
}
+
}
Modified: karaf/cellar/trunk/dosgi/src/test/java/org/apache/karaf/cellar/dosgi/ExportServiceListenerTest.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/dosgi/src/test/java/org/apache/karaf/cellar/dosgi/ExportServiceListenerTest.java?rev=1233211&r1=1233210&r2=1233211&view=diff
==============================================================================
--- karaf/cellar/trunk/dosgi/src/test/java/org/apache/karaf/cellar/dosgi/ExportServiceListenerTest.java (original)
+++ karaf/cellar/trunk/dosgi/src/test/java/org/apache/karaf/cellar/dosgi/ExportServiceListenerTest.java Thu Jan 19 07:04:05 2012
@@ -11,7 +11,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.karaf.cellar.dosgi;
import org.junit.After;
@@ -23,14 +22,10 @@ import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.Set;
-/**
- * @author: iocanel
- */
public class ExportServiceListenerTest {
private ExportServiceListener listener = new ExportServiceListener();
-
@Before
public void setUp() throws Exception {
@@ -60,4 +55,5 @@ public class ExportServiceListenerTest {
Assert.assertTrue(result.contains("java.util.List"));
Assert.assertTrue(result.contains("java.io.Serializable"));
}
+
}
Modified: karaf/cellar/trunk/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastEventTransportFactory.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastEventTransportFactory.java?rev=1233211&r1=1233210&r2=1233211&view=diff
==============================================================================
--- karaf/cellar/trunk/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastEventTransportFactory.java (original)
+++ karaf/cellar/trunk/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastEventTransportFactory.java Thu Jan 19 07:04:05 2012
@@ -11,7 +11,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.karaf.cellar.hazelcast;
import com.hazelcast.core.IQueue;
@@ -25,55 +24,51 @@ import org.apache.karaf.cellar.core.util
import java.util.HashMap;
import java.util.Map;
-/**
- * @author: iocanel
- */
public class HazelcastEventTransportFactory extends HazelcastInstanceAware implements EventTransportFactory {
private Dispatcher dispatcher;
private CombinedClassLoader combinedClassLoader;
-
@Override
public EventProducer getEventProducer(String name, Boolean pubsub) {
if (pubsub) {
- ITopic topic = instance.getTopic(Constants.TOPIC + Constants.SEPARATOR + name);
- TopicProducer producer = new TopicProducer();
- producer.setInstance(instance);
- producer.setTopic(topic);
- producer.setNode(getNode());
- producer.init();
- return producer;
+ ITopic topic = instance.getTopic(Constants.TOPIC + Constants.SEPARATOR + name);
+ TopicProducer producer = new TopicProducer();
+ producer.setInstance(instance);
+ producer.setTopic(topic);
+ producer.setNode(getNode());
+ producer.init();
+ return producer;
} else {
- IQueue queue = instance.getQueue(Constants.QUEUE + Constants.SEPARATOR + name);
- QueueProducer producer = new QueueProducer();
- producer.setQueue(queue);
- producer.setNode(getNode());
- producer.init();
- return producer;
+ IQueue queue = instance.getQueue(Constants.QUEUE + Constants.SEPARATOR + name);
+ QueueProducer producer = new QueueProducer();
+ producer.setQueue(queue);
+ producer.setNode(getNode());
+ producer.init();
+ return producer;
}
}
@Override
public EventConsumer getEventConsumer(String name, Boolean pubsub) {
if (pubsub) {
- ITopic topic = instance.getTopic(Constants.TOPIC + Constants.SEPARATOR + name);
- TopicConsumer consumer = new TopicConsumer();
- consumer.setTopic(topic);
- consumer.setInstance(instance);
- consumer.setNode(getNode());
- consumer.setDispatcher(dispatcher);
- consumer.init();
- return consumer;
+ ITopic topic = instance.getTopic(Constants.TOPIC + Constants.SEPARATOR + name);
+ TopicConsumer consumer = new TopicConsumer();
+ consumer.setTopic(topic);
+ consumer.setInstance(instance);
+ consumer.setNode(getNode());
+ consumer.setDispatcher(dispatcher);
+ consumer.init();
+ return consumer;
} else {
- IQueue queue = instance.getQueue(Constants.QUEUE + Constants.SEPARATOR + name);
- QueueConsumer consumer = new QueueConsumer(combinedClassLoader);
- consumer.setQueue(queue);
- consumer.setNode(getNode());
- consumer.setDispatcher(dispatcher);
- consumer.init();
- return consumer;
+ IQueue queue = instance.getQueue(Constants.QUEUE + Constants.SEPARATOR + name);
+ QueueConsumer consumer = new QueueConsumer(combinedClassLoader);
+ consumer.setQueue(queue);
+ consumer.setNode(getNode());
+ consumer.setDispatcher(dispatcher);
+ consumer.init();
+ return consumer;
}
}
@@ -92,4 +87,5 @@ public class HazelcastEventTransportFact
public void setCombinedClassLoader(CombinedClassLoader combinedClassLoader) {
this.combinedClassLoader = combinedClassLoader;
}
+
}
Modified: karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarChildNodesTest.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarChildNodesTest.java?rev=1233211&r1=1233210&r2=1233211&view=diff
==============================================================================
--- karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarChildNodesTest.java (original)
+++ karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarChildNodesTest.java Thu Jan 19 07:04:05 2012
@@ -14,6 +14,7 @@
package org.apache.karaf.cellar.itests;
import java.util.Set;
+
import org.apache.karaf.cellar.core.ClusterManager;
import org.apache.karaf.cellar.core.Node;
import org.junit.After;
@@ -43,7 +44,7 @@ public class CellarChildNodesTest extend
assertNotNull(clusterManager);
Node localNode = clusterManager.getNode();
- Set<Node> nodes =clusterManager.listNodes();
+ Set<Node> nodes = clusterManager.listNodes();
System.err.println(executeCommand("cluster:nodes-list"));
assertTrue("There should be at least 2 cellar nodes running", 2 <= nodes.size());
}
@@ -61,7 +62,7 @@ public class CellarChildNodesTest extend
@Configuration
public Option[] config() {
return new Option[]{
- cellarDistributionConfiguration(), keepRuntimeFolder(),logLevel(LogLevelOption.LogLevel.ERROR)};
+ cellarDistributionConfiguration(), keepRuntimeFolder(), logLevel(LogLevelOption.LogLevel.ERROR)};
}
}
Modified: karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarConfigurationTest.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarConfigurationTest.java?rev=1233211&r1=1233210&r2=1233211&view=diff
==============================================================================
--- karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarConfigurationTest.java (original)
+++ karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarConfigurationTest.java Thu Jan 19 07:04:05 2012
@@ -92,7 +92,7 @@ public class CellarConfigurationTest ext
@Configuration
public Option[] config() {
return new Option[]{
- cellarDistributionConfiguration(), keepRuntimeFolder(),logLevel(LogLevelOption.LogLevel.ERROR)};
+ cellarDistributionConfiguration(), keepRuntimeFolder(), logLevel(LogLevelOption.LogLevel.ERROR)};
}
}
Modified: karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarFeaturesTest.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarFeaturesTest.java?rev=1233211&r1=1233210&r2=1233211&view=diff
==============================================================================
--- karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarFeaturesTest.java (original)
+++ karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarFeaturesTest.java Thu Jan 19 07:04:05 2012
@@ -49,48 +49,48 @@ public class CellarFeaturesTest extends
System.err.println(executeCommand("admin:list"));
- String httpFeatureStatus = executeCommand("admin:connect child1 features:list | grep eventadmin");
- System.err.println(httpFeatureStatus);
- assertTrue(httpFeatureStatus.startsWith(UNINSTALLED));
+ String eventadminFeatureStatus = executeCommand("admin:connect child1 features:list | grep eventadmin");
+ System.err.println(eventadminFeatureStatus);
+ assertTrue(eventadminFeatureStatus.startsWith(UNINSTALLED));
//Test feature sync - install
System.err.println(executeCommand("features:install eventadmin"));
Thread.sleep(5000);
- httpFeatureStatus = executeCommand("admin:connect child1 features:list | grep eventadmin");
- System.err.println(httpFeatureStatus);
- assertTrue(httpFeatureStatus.startsWith(INSTALLED));
+ eventadminFeatureStatus = executeCommand("admin:connect child1 features:list | grep eventadmin");
+ System.err.println(eventadminFeatureStatus);
+ assertTrue(eventadminFeatureStatus.startsWith(INSTALLED));
//Test feature sync - uninstall
System.err.println(executeCommand("features:uninstall eventadmin"));
Thread.sleep(5000);
- httpFeatureStatus = executeCommand("admin:connect child1 features:list | grep eventadmin");
- System.err.println(httpFeatureStatus);
- assertTrue(httpFeatureStatus.startsWith(UNINSTALLED));
+ eventadminFeatureStatus = executeCommand("admin:connect child1 features:list | grep eventadmin");
+ System.err.println(eventadminFeatureStatus);
+ assertTrue(eventadminFeatureStatus.startsWith(UNINSTALLED));
//Test feature command - install
System.err.println(executeCommand("cluster:features-install default eventadmin"));
Thread.sleep(5000);
- httpFeatureStatus = executeCommand("admin:connect child1 features:list | grep eventadmin");
- System.err.println(httpFeatureStatus);
- assertTrue(httpFeatureStatus.startsWith(INSTALLED));
+ eventadminFeatureStatus = executeCommand("admin:connect child1 features:list | grep eventadmin");
+ System.err.println(eventadminFeatureStatus);
+ assertTrue(eventadminFeatureStatus.startsWith(INSTALLED));
//Test feature command - uninstall
System.err.println(executeCommand("cluster:features-uninstall default eventadmin"));
Thread.sleep(5000);
- httpFeatureStatus = executeCommand("admin:connect child1 features:list | grep eventadmin");
- System.err.println(httpFeatureStatus);
- assertTrue(httpFeatureStatus.startsWith(UNINSTALLED));
+ eventadminFeatureStatus = executeCommand("admin:connect child1 features:list | grep eventadmin");
+ System.err.println(eventadminFeatureStatus);
+ assertTrue(eventadminFeatureStatus.startsWith(UNINSTALLED));
//Test feature command - install - before a node joins
System.err.println(executeCommand("cluster:features-install testgroup eventadmin"));
System.err.println(executeCommand("cluster:group-set testgroup " + getNodeIdOfChild("child1")));
Thread.sleep(5000);
- httpFeatureStatus = executeCommand("admin:connect child1 features:list | grep eventadmin");
- System.err.println(httpFeatureStatus);
- assertTrue(httpFeatureStatus.startsWith(INSTALLED));
+ eventadminFeatureStatus = executeCommand("admin:connect child1 features:list | grep eventadmin");
+ System.err.println(eventadminFeatureStatus);
+ assertTrue(eventadminFeatureStatus.startsWith(INSTALLED));
Node localNode = clusterManager.getNode();
- Set<Node> nodes =clusterManager.listNodes();
+ Set<Node> nodes = clusterManager.listNodes();
System.err.println(executeCommand("cluster:nodes-list"));
assertTrue("There should be at least 2 cellar nodes running", 2 <= nodes.size());
}
@@ -108,7 +108,7 @@ public class CellarFeaturesTest extends
@Configuration
public Option[] config() {
return new Option[]{
- cellarDistributionConfiguration(), keepRuntimeFolder(),logLevel(LogLevelOption.LogLevel.ERROR)};
+ cellarDistributionConfiguration(), keepRuntimeFolder(), logLevel(LogLevelOption.LogLevel.ERROR)};
}
}
Modified: karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarGroupsTest.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarGroupsTest.java?rev=1233211&r1=1233210&r2=1233211&view=diff
==============================================================================
--- karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarGroupsTest.java (original)
+++ karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarGroupsTest.java Thu Jan 19 07:04:05 2012
@@ -14,6 +14,7 @@
package org.apache.karaf.cellar.itests;
import java.util.Set;
+
import org.apache.karaf.cellar.core.ClusterManager;
import org.apache.karaf.cellar.core.Group;
import org.apache.karaf.cellar.core.GroupManager;
@@ -60,12 +61,12 @@ public class CellarGroupsTest extends Ce
assertNotNull(groupManager);
Set<Group> groups = groupManager.listAllGroups();
- assertEquals("There should be 2 cellar groups", 2 , groups.size());
+ assertEquals("There should be 2 cellar groups", 2, groups.size());
System.err.println(executeCommand("cluster:group-delete testgroup "));
System.err.println(executeCommand("cluster:group-list"));
groups = groupManager.listAllGroups();
- assertEquals("There should be a single cellar group", 1 , groups.size());
+ assertEquals("There should be a single cellar group", 1, groups.size());
}
@After
@@ -81,7 +82,7 @@ public class CellarGroupsTest extends Ce
@Configuration
public Option[] config() {
return new Option[]{
- cellarDistributionConfiguration(), keepRuntimeFolder(),logLevel(LogLevelOption.LogLevel.ERROR)};
+ cellarDistributionConfiguration(), keepRuntimeFolder(), logLevel(LogLevelOption.LogLevel.ERROR)};
}
}
Modified: karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarSampleCamelHazelcastTest.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarSampleCamelHazelcastTest.java?rev=1233211&r1=1233210&r2=1233211&view=diff
==============================================================================
--- karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarSampleCamelHazelcastTest.java (original)
+++ karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarSampleCamelHazelcastTest.java Thu Jan 19 07:04:05 2012
@@ -14,6 +14,7 @@
package org.apache.karaf.cellar.itests;
import java.util.Set;
+
import org.apache.karaf.cellar.core.ClusterManager;
import org.apache.karaf.cellar.core.Node;
import org.junit.After;
@@ -60,8 +61,8 @@ public class CellarSampleCamelHazelcastT
String node1 = getNodeIdOfChild("child1");
String node2 = getNodeIdOfChild("child2");
- System.err.println("Child1:"+node1);
- System.err.println("Child2:"+node2);
+ System.err.println("Child1:" + node1);
+ System.err.println("Child2:" + node2);
System.err.println(executeCommand("cluster:group-set producer-grp " + localNode.getId()));
System.err.println(executeCommand("cluster:group-set consumer-grp " + node1));
@@ -87,8 +88,8 @@ public class CellarSampleCamelHazelcastT
}
public int countOutputEntires(String output) {
- String[] lines = output.split("\n");
- return lines.length;
+ String[] lines = output.split("\n");
+ return lines.length;
}
@After
@@ -105,7 +106,7 @@ public class CellarSampleCamelHazelcastT
@Configuration
public Option[] config() {
return new Option[]{
- cellarDistributionConfiguration(), keepRuntimeFolder(),logLevel(LogLevelOption.LogLevel.ERROR)};
+ cellarDistributionConfiguration(), keepRuntimeFolder(), logLevel(LogLevelOption.LogLevel.ERROR)};
}
}
Modified: karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarSampleDosgiGreeterTest.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarSampleDosgiGreeterTest.java?rev=1233211&r1=1233210&r2=1233211&view=diff
==============================================================================
--- karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarSampleDosgiGreeterTest.java (original)
+++ karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarSampleDosgiGreeterTest.java Thu Jan 19 07:04:05 2012
@@ -14,6 +14,7 @@
package org.apache.karaf.cellar.itests;
import java.util.Set;
+
import org.apache.karaf.cellar.core.ClusterManager;
import org.apache.karaf.cellar.core.Node;
import org.junit.After;
@@ -86,15 +87,15 @@ public class CellarSampleDosgiGreeterTes
System.err.println(executeCommand("cluster:list-services"));
greetOutput = executeCommand("dosgi-greeter:greet Hi 10");
System.err.println(greetOutput);
- assertEquals("Expected 5 greets",5, countGreetsFromNode(greetOutput, node1));
- assertEquals("Expected 5 greets",5, countGreetsFromNode(greetOutput, node2));
+ assertEquals("Expected 5 greets", 5, countGreetsFromNode(greetOutput, node1));
+ assertEquals("Expected 5 greets", 5, countGreetsFromNode(greetOutput, node2));
}
public int countGreetsFromNode(String output, String nodeId) {
- int count = 0;
- String[] greets = output.split("\n");
- for(String greet:greets) {
- if(greet.contains(nodeId)) {
+ int count = 0;
+ String[] greets = output.split("\n");
+ for (String greet : greets) {
+ if (greet.contains(nodeId)) {
count++;
}
}
@@ -115,7 +116,7 @@ public class CellarSampleDosgiGreeterTes
@Configuration
public Option[] config() {
return new Option[]{
- cellarDistributionConfiguration(), keepRuntimeFolder(),logLevel(LogLevelOption.LogLevel.ERROR)};
+ cellarDistributionConfiguration(), keepRuntimeFolder(), logLevel(LogLevelOption.LogLevel.ERROR)};
}
}
Modified: karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarTestSupport.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarTestSupport.java?rev=1233211&r1=1233210&r2=1233211&view=diff
==============================================================================
--- karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarTestSupport.java (original)
+++ karaf/cellar/trunk/itests/src/test/java/org/apache/karaf/cellar/itests/CellarTestSupport.java Thu Jan 19 07:04:05 2012
@@ -32,6 +32,7 @@ import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import javax.inject.Inject;
+
import EDU.oswego.cs.dl.util.concurrent.Sync;
import org.apache.felix.service.command.CommandProcessor;
import org.apache.felix.service.command.CommandSession;
@@ -64,7 +65,7 @@ public class CellarTestSupport {
static final String INSTANCE_STARTED = "Started";
static final String INSTANCE_STARTING = "Starting";
- static final String CELLAR_FEATURE_URL = String.format("mvn:org.apache.karaf.cellar/apache-karaf-cellar/%s/xml/features","3.0.0-SNAPSHOT");
+ static final String CELLAR_FEATURE_URL = String.format("mvn:org.apache.karaf.cellar/apache-karaf-cellar/%s/xml/features", "3.0.0-SNAPSHOT");
static final String DEBUG_OPTS = " --java-opts \"-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=%s\"";
@@ -86,9 +87,10 @@ public class CellarTestSupport {
/**
* This method configures Hazelcast TcpIp discovery for a given number of memebers.
* This configuration is required, when working with karaf instances.
+ *
* @param members
*/
- protected void configureLocalDiscovery (int members) {
+ protected void configureLocalDiscovery(int members) {
StringBuilder membersBuilder = new StringBuilder();
membersBuilder.append("config:propset tcpIpMembers ");
membersBuilder.append("localhost:5701");
@@ -100,7 +102,7 @@ public class CellarTestSupport {
String propsetCmd = membersBuilder.toString();
String updateCmd = "config:update";
- executeCommands(editCmd,propsetCmd,updateCmd);
+ executeCommands(editCmd, propsetCmd, updateCmd);
}
/**
@@ -127,10 +129,10 @@ public class CellarTestSupport {
protected void createCellarChild(String name, boolean debug, int port) {
int instances = 0;
String createCommad = "admin:create --featureURL " + CELLAR_FEATURE_URL + " --feature cellar ";
- if(debug && port > 0) {
- createCommad = createCommad + String.format(DEBUG_OPTS,port);
+ if (debug && port > 0) {
+ createCommad = createCommad + String.format(DEBUG_OPTS, port);
}
- System.err.println(executeCommand(createCommad+" "+name));
+ System.err.println(executeCommand(createCommad + " " + name));
System.err.println(executeCommand("admin:start " + name));
//Wait till the node is listed as Starting
@@ -146,7 +148,7 @@ public class CellarTestSupport {
}
}
- if(instances > 0) {
+ if (instances > 0) {
System.err.println(".Started!");
} else {
System.err.println(".Timed Out!");
@@ -160,7 +162,6 @@ public class CellarTestSupport {
protected void destroyCellarChild(String name) {
System.err.println(executeCommand("admin:connect " + name + " features:uninstall cellar"));
System.err.println(executeCommand("admin:stop " + name));
- //System.err.println(executeCommand("admin:destroy " + name));
}
/**
@@ -170,11 +171,11 @@ public class CellarTestSupport {
String nodeId = null;
String nodesList = executeCommand("admin:connect " + name + " cluster:nodes-list | grep \\\\*", COMMAND_TIMEOUT, true);
String[] tokens = nodesList.split(" ");
- if(tokens != null && tokens.length > 0) {
- nodeId = tokens[tokens.length - 1].trim().replaceAll("\n","");
+ if (tokens != null && tokens.length > 0) {
+ nodeId = tokens[tokens.length - 1].trim().replaceAll("\n", "");
}
//As of Karaf 2.2.5 grep will add the reset character at the end of the match.
- nodeId = nodeId.replaceAll("\\u001B\\[m","");
+ nodeId = nodeId.replaceAll("\\u001B\\[m", "");
return nodeId;
}
@@ -187,16 +188,18 @@ public class CellarTestSupport {
/**
* Executes a shell command and returns output as a String.
* Commands have a default timeout of 10 seconds.
+ *
* @param command
* @return
*/
protected String executeCommand(final String command) {
- return executeCommand(command, COMMAND_TIMEOUT, false);
+ return executeCommand(command, COMMAND_TIMEOUT, false);
}
- /**
+ /**
* Executes a shell command and returns output as a String.
* Commands have a default timeout of 10 seconds.
+ *
* @param command The command to execute.
* @param timeout The amount of time in millis to wait for the command to execute.
* @param silent Specifies if the command should be displayed in the screen.
@@ -226,7 +229,7 @@ public class CellarTestSupport {
try {
executor.submit(commandFuture);
- response = commandFuture.get(timeout, TimeUnit.MILLISECONDS);
+ response = commandFuture.get(timeout, TimeUnit.MILLISECONDS);
} catch (Exception e) {
e.printStackTrace(System.err);
response = "SHELL COMMAND TIMED OUT: ";
@@ -238,10 +241,11 @@ public class CellarTestSupport {
/**
* Executes multiple commands inside a Single Session.
* Commands have a default timeout of 10 seconds.
+ *
* @param commands
* @return
*/
- protected String executeCommands(final String ...commands) {
+ protected String executeCommands(final String... commands) {
String response;
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
final PrintStream printStream = new PrintStream(byteArrayOutputStream);
@@ -251,9 +255,9 @@ public class CellarTestSupport {
new Callable<String>() {
public String call() {
try {
- for(String command:commands) {
- System.err.println(command);
- commandSession.execute(command);
+ for (String command : commands) {
+ System.err.println(command);
+ commandSession.execute(command);
}
} catch (Exception e) {
e.printStackTrace(System.err);
@@ -264,7 +268,7 @@ public class CellarTestSupport {
try {
executor.submit(commandFuture);
- response = commandFuture.get(COMMAND_TIMEOUT, TimeUnit.MILLISECONDS);
+ response = commandFuture.get(COMMAND_TIMEOUT, TimeUnit.MILLISECONDS);
} catch (Exception e) {
e.printStackTrace(System.err);
response = "SHELL COMMAND TIMED OUT: ";
@@ -286,8 +290,8 @@ public class CellarTestSupport {
}
/**
- * Explodes the dictionary into a ,-delimited list of key=value pairs
- */
+ * Explodes the dictionary into a ,-delimited list of key=value pairs
+ */
private static String explode(Dictionary dictionary) {
Enumeration keys = dictionary.keys();
StringBuffer result = new StringBuffer();
@@ -352,6 +356,7 @@ public class CellarTestSupport {
/**
* Finds a free port starting from the give port numner.
+ *
* @return
*/
protected int getFreePort(int port) {
@@ -363,6 +368,7 @@ public class CellarTestSupport {
/**
* Returns true if port is available for use.
+ *
* @param port
* @return
*/
Modified: karaf/cellar/trunk/samples/camel-hazelcast-app/consumer/src/main/resources/OSGI-INF/blueprint/blueprint.xml
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/samples/camel-hazelcast-app/consumer/src/main/resources/OSGI-INF/blueprint/blueprint.xml?rev=1233211&r1=1233210&r2=1233211&view=diff
==============================================================================
--- karaf/cellar/trunk/samples/camel-hazelcast-app/consumer/src/main/resources/OSGI-INF/blueprint/blueprint.xml (original)
+++ karaf/cellar/trunk/samples/camel-hazelcast-app/consumer/src/main/resources/OSGI-INF/blueprint/blueprint.xml Thu Jan 19 07:04:05 2012
@@ -17,23 +17,23 @@
-->
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:camel="http://camel.apache.org/schema/blueprint"
- xsi:schemaLocation="
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:camel="http://camel.apache.org/schema/blueprint"
+ xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
- <camelContext id="blueprintContext" trace="false" xmlns="http://camel.apache.org/schema/blueprint">
- <route>
- <from uri="hazelcast:seda:yet.another.queue"/>
- <to uri="log:org.apache.karaf.cellar.samples.camel.hazelcast.out?level=INFO"/>
- </route>
- </camelContext>
+ <camelContext id="blueprintContext" trace="false" xmlns="http://camel.apache.org/schema/blueprint">
+ <route>
+ <from uri="hazelcast:seda:yet.another.queue"/>
+ <to uri="log:org.apache.karaf.cellar.samples.camel.hazelcast.out?level=INFO"/>
+ </route>
+ </camelContext>
- <bean id="hazelcast" class="org.apache.camel.component.hazelcast.HazelcastComponent">
- <property name="hazelcastInstance" ref="hazelcastInstance"/>
- </bean>
+ <bean id="hazelcast" class="org.apache.camel.component.hazelcast.HazelcastComponent">
+ <property name="hazelcastInstance" ref="hazelcastInstance"/>
+ </bean>
- <reference id="hazelcastInstance" availability="optional" interface="com.hazelcast.core.HazelcastInstance"/>
+ <reference id="hazelcastInstance" availability="optional" interface="com.hazelcast.core.HazelcastInstance"/>
</blueprint>
Modified: karaf/cellar/trunk/samples/camel-hazelcast-app/producer/src/main/resources/OSGI-INF/blueprint/blueprint.xml
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/samples/camel-hazelcast-app/producer/src/main/resources/OSGI-INF/blueprint/blueprint.xml?rev=1233211&r1=1233210&r2=1233211&view=diff
==============================================================================
--- karaf/cellar/trunk/samples/camel-hazelcast-app/producer/src/main/resources/OSGI-INF/blueprint/blueprint.xml (original)
+++ karaf/cellar/trunk/samples/camel-hazelcast-app/producer/src/main/resources/OSGI-INF/blueprint/blueprint.xml Thu Jan 19 07:04:05 2012
@@ -17,26 +17,26 @@
-->
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:camel="http://camel.apache.org/schema/blueprint"
- xsi:schemaLocation="
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:camel="http://camel.apache.org/schema/blueprint"
+ xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
- <camelContext id="blueprintContext" trace="false" xmlns="http://camel.apache.org/schema/blueprint">
- <route id="timerToLog">
- <from uri="timer:foo?period=5000"/>
- <setBody>
- <constant>Hallo Cellar</constant>
- </setBody>
- <to uri="hazelcast:seda:yet.another.queue"/>
- </route>
- </camelContext>
+ <camelContext id="blueprintContext" trace="false" xmlns="http://camel.apache.org/schema/blueprint">
+ <route id="timerToLog">
+ <from uri="timer:foo?period=5000"/>
+ <setBody>
+ <constant>Hallo Cellar</constant>
+ </setBody>
+ <to uri="hazelcast:seda:yet.another.queue"/>
+ </route>
+ </camelContext>
- <bean id="hazelcast" class="org.apache.camel.component.hazelcast.HazelcastComponent">
- <property name="hazelcastInstance" ref="hazelcastInstance"/>
- </bean>
+ <bean id="hazelcast" class="org.apache.camel.component.hazelcast.HazelcastComponent">
+ <property name="hazelcastInstance" ref="hazelcastInstance"/>
+ </bean>
- <reference id="hazelcastInstance" availability="optional" interface="com.hazelcast.core.HazelcastInstance"/>
+ <reference id="hazelcastInstance" availability="optional" interface="com.hazelcast.core.HazelcastInstance"/>
</blueprint>
Modified: karaf/cellar/trunk/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupPickCommand.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupPickCommand.java?rev=1233211&r1=1233210&r2=1233211&view=diff
==============================================================================
--- karaf/cellar/trunk/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupPickCommand.java (original)
+++ karaf/cellar/trunk/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupPickCommand.java Thu Jan 19 07:04:05 2012
@@ -11,7 +11,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.karaf.cellar.shell.group;
import org.apache.felix.gogo.commands.Argument;
@@ -25,11 +24,8 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Set;
-/**
- * @author: iocanel
- */
@Command(scope = "cluster", name = "group-pick", description = "Picks a number of nodes from one group and moves them into an other")
-public class GroupPickCommand extends GroupSupport {
+public class GroupPickCommand extends GroupSupport {
@Argument(index = 0, name = "sourceGroupName", description = "The name of the source group that will act as a selection pool", required = true, multiValued = false)
String sourceGroupName;
@@ -38,39 +34,40 @@ public class GroupPickCommand extends Gr
String targetGroupName;
@Argument(index = 2, name = "count", description = "The number of nodes to transfer", required = false, multiValued = false)
- int count=1;
+ int count = 1;
@Override
protected Object doExecute() throws Exception {
Group sourceGroup = groupManager.findGroupByName(sourceGroupName);
- if(sourceGroup != null) {
+ if (sourceGroup != null) {
List<String> eligibleMembers = new LinkedList<String>();
Set<Node> groupMembers = sourceGroup.getNodes();
- for(Node node:groupMembers) {
+ for (Node node : groupMembers) {
Set<Group> nodeGroups = groupManager.listGroups(node);
//If the node only belongs to the source group then it is eligible.
- if(nodeGroups != null && nodeGroups.size() == 1) {
+ if (nodeGroups != null && nodeGroups.size() == 1) {
eligibleMembers.add(node.getId());
}
}
- if(eligibleMembers.size() == 0) {
- System.out.println("Could not find eligible members from transfer in group:"+sourceGroupName);
- } else if(eligibleMembers.size() < count) {
- System.out.println("There are fewer("+eligibleMembers.size()+") eligible members for transfer in group:"+sourceGroupName);
+ if (eligibleMembers.size() == 0) {
+ System.out.println("Could not find eligible members from transfer in group:" + sourceGroupName);
+ } else if (eligibleMembers.size() < count) {
+ System.out.println("There are fewer(" + eligibleMembers.size() + ") eligible members for transfer in group:" + sourceGroupName);
}
//TODO: The loop should not be necessary since the method already accepts a list. However this is breaks for some reason.
- for(String eligible:eligibleMembers) {
+ for (String eligible : eligibleMembers) {
List<String> recipient = new LinkedList<String>();
recipient.add(eligible);
doExecute(ManageGroupAction.SET, targetGroupName, recipient);
}
- doExecute(ManageGroupAction.LIST, null, new ArrayList(),false);
+ doExecute(ManageGroupAction.LIST, null, new ArrayList(), false);
- } else System.err.println("Cannot find source group with name:"+sourceGroupName);
+ } else System.err.println("Cannot find source group with name:" + sourceGroupName);
return null;
}
+
}