Author: jbonofre
Date: Thu Jan 19 07:14:00 2012
New Revision: 1233215
URL: http://svn.apache.org/viewvc?rev=1233215&view=rev
Log:
Various checkstyle fixes
Modified:
karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleEventHandler.java
karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleState.java
karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSupport.java
karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/Constants.java
karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java
karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/RemoteBundleEvent.java
karaf/cellar/branches/cellar-2.2.x/cloud/src/main/java/org/apache/karaf/cellar/cloud/BlobStoreDiscoveryServiceFactory.java
karaf/cellar/branches/cellar-2.2.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventTransportFactory.java
karaf/cellar/branches/cellar-2.2.x/core/src/main/java/org/apache/karaf/cellar/core/exception/ProducerNotFoundException.java
karaf/cellar/branches/cellar-2.2.x/core/src/main/java/org/apache/karaf/cellar/core/exception/StoreNotFoundException.java
karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarChildNodesTest.java
karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarFeaturesTest.java
karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarGroupsTest.java
karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarSampleCamelHazelcastTest.java
karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarSampleDosgiGreeterTest.java
karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarTestSupport.java
karaf/cellar/branches/cellar-2.2.x/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupPickCommand.java
Modified:
karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleEventHandler.java
URL:
http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleEventHandler.java?rev=1233215&r1=1233214&r2=1233215&view=diff
==============================================================================
---
karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleEventHandler.java
(original)
+++
karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleEventHandler.java
Thu Jan 19 07:14:00 2012
@@ -29,18 +29,19 @@ import java.util.Map;
public class BundleEventHandler extends BundleSupport implements
EventHandler<RemoteBundleEvent> {
- private static final Logger LOGGER =
LoggerFactory.getLogger(BundleEventHandler.class);
+ private static final 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;
@@ -51,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());
+ BundleState state = new BundleState();
+ state.setLocation(event.getLocation());
+ state.setStatus(event.getType());
- if (event.getType() == BundleEvent.INSTALLED) {
+ if (event.getType() == BundleEvent.INSTALLED) {
LOGGER.debug("CELLAR BUNDLE: installing bundle {} from
{}", event.getId(), event.getLocation());
-
installBundleFromLocation(event.getLocation());
- bundleTable.put(event.getId(), state);
- } else if(event.getType() ==
BundleEvent.UNINSTALLED) {
+ installBundleFromLocation(event.getLocation());
+ bundleTable.put(event.getId(), state);
+ } else if (event.getType() == BundleEvent.UNINSTALLED) {
LOGGER.debug("CELLAR BUNDLE: un-installing bundle {}/{}",
event.getSymbolicName(), event.getVersion());
-
uninstallBundle(event.getSymbolicName(), event.getVersion());
- bundleTable.remove(event.getId());
- } else if(event.getType() ==
BundleEvent.STARTED) {
+ uninstallBundle(event.getSymbolicName(),
event.getVersion());
+ bundleTable.remove(event.getId());
+ } else if (event.getType() == BundleEvent.STARTED) {
LOGGER.debug("CELLAR BUNDLE: starting bundle {}/{}",
event.getSymbolicName(), event.getVersion());
- startBundle(event.getSymbolicName(),
event.getVersion());
- bundleTable.put(event.getId(), state);
- } else if(event.getType() ==
BundleEvent.STOPPED) {
+ startBundle(event.getSymbolicName(), event.getVersion());
+ bundleTable.put(event.getId(), state);
+ } else if (event.getType() == BundleEvent.STOPPED) {
LOGGER.debug("CELLAR BUNDLE: stopping bundle {}/{}",
event.getSymbolicName(), event.getVersion());
- stopBundle(event.getSymbolicName(),
event.getVersion());
- state.setStatus(BundleEvent.INSTALLED);
- bundleTable.put(event.getId(), state);
- } else if(event.getType() ==
BundleEvent.UPDATED) {
+ stopBundle(event.getSymbolicName(), event.getVersion());
+ state.setStatus(BundleEvent.INSTALLED);
+ bundleTable.put(event.getId(), state);
+ } else if (event.getType() == BundleEvent.UPDATED) {
LOGGER.debug("CELLAR BUNDLE: updating bundle {}/{}",
event.getSymbolicName(), event.getVersion());
- updateBundle(event.getSymbolicName(),
event.getVersion());
- }
- } else LOGGER.warn("CELLAR BUNDLE: bundle {} is marked
as BLOCKED INBOUND", bundleLocation);
- } catch (BundleException e) {
- LOGGER.error("CELLAR BUNDLE: failed to handle bundle
event", e);
- }
- }
+ updateBundle(event.getSymbolicName(), event.getVersion());
+ }
+ } else LOGGER.warn("CELLAR BUNDLE: bundle {} is marked as BLOCKED
INBOUND", bundleLocation);
+ } catch (BundleException e) {
+ LOGGER.error("CELLAR BUNDLE: failed to handle bundle event", e);
+ }
+ }
/**
* Initialization Method.
Modified:
karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleState.java
URL:
http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleState.java?rev=1233215&r1=1233214&r2=1233215&view=diff
==============================================================================
---
karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleState.java
(original)
+++
karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleState.java
Thu Jan 19 07:14:00 2012
@@ -20,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/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSupport.java
URL:
http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSupport.java?rev=1233215&r1=1233214&r2=1233215&view=diff
==============================================================================
---
karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSupport.java
(original)
+++
karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSupport.java
Thu Jan 19 07:14:00 2012
@@ -25,126 +25,132 @@ 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;
- }
-
- /**
- * 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;
- }
+ /**
+ * 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;
+ }
}
Modified:
karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/Constants.java
URL:
http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/Constants.java?rev=1233215&r1=1233214&r2=1233215&view=diff
==============================================================================
---
karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/Constants.java
(original)
+++
karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/Constants.java
Thu Jan 19 07:14:00 2012
@@ -16,8 +16,9 @@ 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/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java
URL:
http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java?rev=1233215&r1=1233214&r2=1233215&view=diff
==============================================================================
---
karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java
(original)
+++
karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java
Thu Jan 19 07:14:00 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/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/RemoteBundleEvent.java
URL:
http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/RemoteBundleEvent.java?rev=1233215&r1=1233214&r2=1233215&view=diff
==============================================================================
---
karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/RemoteBundleEvent.java
(original)
+++
karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/RemoteBundleEvent.java
Thu Jan 19 07:14:00 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/branches/cellar-2.2.x/cloud/src/main/java/org/apache/karaf/cellar/cloud/BlobStoreDiscoveryServiceFactory.java
URL:
http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/cloud/src/main/java/org/apache/karaf/cellar/cloud/BlobStoreDiscoveryServiceFactory.java?rev=1233215&r1=1233214&r2=1233215&view=diff
==============================================================================
---
karaf/cellar/branches/cellar-2.2.x/cloud/src/main/java/org/apache/karaf/cellar/cloud/BlobStoreDiscoveryServiceFactory.java
(original)
+++
karaf/cellar/branches/cellar-2.2.x/cloud/src/main/java/org/apache/karaf/cellar/cloud/BlobStoreDiscoveryServiceFactory.java
Thu Jan 19 07:14:00 2012
@@ -40,11 +40,6 @@ public class BlobStoreDiscoveryServiceFa
private final BundleContext bundleContext;
- /**
- * Constructor
- *
- * @param bundleContext
- */
public BlobStoreDiscoveryServiceFactory(BundleContext bundleContext) {
this.bundleContext = bundleContext;
}
Modified:
karaf/cellar/branches/cellar-2.2.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventTransportFactory.java
URL:
http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventTransportFactory.java?rev=1233215&r1=1233214&r2=1233215&view=diff
==============================================================================
---
karaf/cellar/branches/cellar-2.2.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventTransportFactory.java
(original)
+++
karaf/cellar/branches/cellar-2.2.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventTransportFactory.java
Thu Jan 19 07:14:00 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/branches/cellar-2.2.x/core/src/main/java/org/apache/karaf/cellar/core/exception/ProducerNotFoundException.java
URL:
http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/core/src/main/java/org/apache/karaf/cellar/core/exception/ProducerNotFoundException.java?rev=1233215&r1=1233214&r2=1233215&view=diff
==============================================================================
---
karaf/cellar/branches/cellar-2.2.x/core/src/main/java/org/apache/karaf/cellar/core/exception/ProducerNotFoundException.java
(original)
+++
karaf/cellar/branches/cellar-2.2.x/core/src/main/java/org/apache/karaf/cellar/core/exception/ProducerNotFoundException.java
Thu Jan 19 07:14:00 2012
@@ -1,8 +1,18 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.karaf.cellar.core.exception;
-/**
- * @author: iocanel
- */
public class ProducerNotFoundException extends Exception {
public ProducerNotFoundException() {
@@ -19,4 +29,5 @@ public class ProducerNotFoundException e
public ProducerNotFoundException(Throwable cause) {
super(cause);
}
+
}
Modified:
karaf/cellar/branches/cellar-2.2.x/core/src/main/java/org/apache/karaf/cellar/core/exception/StoreNotFoundException.java
URL:
http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/core/src/main/java/org/apache/karaf/cellar/core/exception/StoreNotFoundException.java?rev=1233215&r1=1233214&r2=1233215&view=diff
==============================================================================
---
karaf/cellar/branches/cellar-2.2.x/core/src/main/java/org/apache/karaf/cellar/core/exception/StoreNotFoundException.java
(original)
+++
karaf/cellar/branches/cellar-2.2.x/core/src/main/java/org/apache/karaf/cellar/core/exception/StoreNotFoundException.java
Thu Jan 19 07:14:00 2012
@@ -1,8 +1,18 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.karaf.cellar.core.exception;
-/**
- * @author: iocanel
- */
public class StoreNotFoundException extends Exception {
public StoreNotFoundException() {
@@ -19,4 +29,5 @@ public class StoreNotFoundException exte
public StoreNotFoundException(Throwable cause) {
super(cause);
}
+
}
Modified:
karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarChildNodesTest.java
URL:
http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarChildNodesTest.java?rev=1233215&r1=1233214&r2=1233215&view=diff
==============================================================================
---
karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarChildNodesTest.java
(original)
+++
karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarChildNodesTest.java
Thu Jan 19 07:14:00 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;
@@ -44,7 +45,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());
}
@@ -62,7 +63,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/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarFeaturesTest.java
URL:
http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarFeaturesTest.java?rev=1233215&r1=1233214&r2=1233215&view=diff
==============================================================================
---
karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarFeaturesTest.java
(original)
+++
karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarFeaturesTest.java
Thu Jan 19 07:14:00 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;
@@ -83,7 +84,7 @@ public class CellarFeaturesTest extends
//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")));
+ System.err.println(executeCommand("cluster:group-set testgroup " +
getNodeIdOfChild("child1")));
Thread.sleep(5000);
eventadminFeaturesStatus = executeCommand("admin:connect child1
features:list | grep eventadmin");
System.err.println(eventadminFeaturesStatus);
@@ -91,7 +92,7 @@ public class CellarFeaturesTest extends
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());
}
@@ -109,7 +110,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/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarGroupsTest.java
URL:
http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarGroupsTest.java?rev=1233215&r1=1233214&r2=1233215&view=diff
==============================================================================
---
karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarGroupsTest.java
(original)
+++
karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarGroupsTest.java
Thu Jan 19 07:14:00 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;
@@ -53,19 +54,19 @@ public class CellarGroupsTest extends Ce
assertTrue("There should be at least 2 cellar nodes running", 2 <=
nodes.size());
System.err.println(executeCommand("cluster:group-list"));
- System.err.println(executeCommand("cluster:group-set testgroup
"+localNode.getId()));
+ System.err.println(executeCommand("cluster:group-set testgroup " +
localNode.getId()));
System.err.println(executeCommand("cluster:group-list"));
GroupManager groupManager = getOsgiService(GroupManager.class);
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/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarSampleCamelHazelcastTest.java
URL:
http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarSampleCamelHazelcastTest.java?rev=1233215&r1=1233214&r2=1233215&view=diff
==============================================================================
---
karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarSampleCamelHazelcastTest.java
(original)
+++
karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarSampleCamelHazelcastTest.java
Thu Jan 19 07:14:00 2012
@@ -61,7 +61,7 @@ public class CellarSampleCamelHazelcastT
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));
System.err.println(executeCommand("cluster:group-set consumer-grp " +
node2));
Modified:
karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarSampleDosgiGreeterTest.java
URL:
http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarSampleDosgiGreeterTest.java?rev=1233215&r1=1233214&r2=1233215&view=diff
==============================================================================
---
karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarSampleDosgiGreeterTest.java
(original)
+++
karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarSampleDosgiGreeterTest.java
Thu Jan 19 07:14:00 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;
@@ -38,8 +39,8 @@ import static org.openengsb.labs.paxexam
@ExamReactorStrategy(AllConfinedStagedReactorFactory.class)
public class CellarSampleDosgiGreeterTest extends CellarTestSupport {
- private static final String UNINSTALLED="[uninstalled]";
- private static final String INSTALLED="[installed ]";
+ private static final String UNINSTALLED = "[uninstalled]";
+ private static final String INSTALLED = "[installed ]";
@Test
public void testDosgiGreeter() throws InterruptedException {
@@ -64,14 +65,14 @@ public class CellarSampleDosgiGreeterTes
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-list"));
- System.err.println(executeCommand("cluster:group-set client-grp
"+localNode.getId()));
- System.err.println(executeCommand("cluster:group-set service-grp
"+node1));
+ System.err.println(executeCommand("cluster:group-set client-grp " +
localNode.getId()));
+ System.err.println(executeCommand("cluster:group-set service-grp " +
node1));
System.err.println(executeCommand("cluster:group-list"));
-
+
System.err.println(executeCommand("cluster:features-install client-grp
greeter-client"));
Thread.sleep(10000);
System.err.println(executeCommand("cluster:features-install
service-grp greeter-service"));
@@ -80,7 +81,7 @@ public class CellarSampleDosgiGreeterTes
String greetOutput = executeCommand("dosgi-greeter:greet Hi 10");
System.err.println(greetOutput);
assertEquals("Expected 10 greets", 10,
countGreetsFromNode(greetOutput, node1));
- System.err.println(executeCommand("cluster:group-set service-grp
"+node2));
+ System.err.println(executeCommand("cluster:group-set service-grp " +
node2));
Thread.sleep(10000);
Thread.sleep(10000);
System.err.println(executeCommand("cluster:group-list"));
@@ -88,15 +89,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++;
}
}
Modified:
karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarTestSupport.java
URL:
http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarTestSupport.java?rev=1233215&r1=1233214&r2=1233215&view=diff
==============================================================================
---
karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarTestSupport.java
(original)
+++
karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarTestSupport.java
Thu Jan 19 07:14:00 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;
@@ -63,7 +64,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","2.2.3-SNAPSHOT");
+ static final String CELLAR_FEATURE_URL =
String.format("mvn:org.apache.karaf.cellar/apache-karaf-cellar/%s/xml/features",
"2.2.3-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!");
@@ -164,15 +166,16 @@ public class CellarTestSupport {
/**
* Returns the node id of a specific child instance.
+ *
* @param name
* @return
*/
protected String getNodeIdOfChild(String name) {
String nodeId = null;
- String nodesList = executeCommand("admin:connect " + name+"
cluster:nodes-list | grep \\\\*",COMMAND_TIMEOUT,true);
+ 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", "");
}
return nodeId;
}
@@ -191,16 +194,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.
@@ -230,7 +235,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: ";
@@ -242,10 +247,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);
@@ -255,9 +261,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);
@@ -268,7 +274,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: ";
@@ -356,6 +362,7 @@ public class CellarTestSupport {
/**
* Finds a free port starting from the give port numner.
+ *
* @return
*/
protected int getFreePort(int port) {
@@ -367,6 +374,7 @@ public class CellarTestSupport {
/**
* Returns true if port is available for use.
+ *
* @param port
* @return
*/
Modified:
karaf/cellar/branches/cellar-2.2.x/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupPickCommand.java
URL:
http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupPickCommand.java?rev=1233215&r1=1233214&r2=1233215&view=diff
==============================================================================
---
karaf/cellar/branches/cellar-2.2.x/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupPickCommand.java
(original)
+++
karaf/cellar/branches/cellar-2.2.x/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupPickCommand.java
Thu Jan 19 07:14:00 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 = "Pick 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;
}
+
}