Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Frost2011-02-21 08:46:37 -0500
committerChristopher Frost2011-02-21 08:46:37 -0500
commit3476c94265a724253df05e6108ee37cb5380acd7 (patch)
tree9cde09bbb8ac51c904a4ebe85350486bd6fb6c37 /org.eclipse.virgo.kernel.shell
parentcd2970dd97c9f57047a8d2c94ebc210d52901b15 (diff)
downloadorg.eclipse.virgo.kernel-3476c94265a724253df05e6108ee37cb5380acd7.tar.gz
org.eclipse.virgo.kernel-3476c94265a724253df05e6108ee37cb5380acd7.tar.xz
org.eclipse.virgo.kernel-3476c94265a724253df05e6108ee37cb5380acd7.zip
Adding some extra special case code for the faux kernel region bundle
Diffstat (limited to 'org.eclipse.virgo.kernel.shell')
-rw-r--r--org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/model/helper/StandardRamAccessorHelper.java27
1 files changed, 25 insertions, 2 deletions
diff --git a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/model/helper/StandardRamAccessorHelper.java b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/model/helper/StandardRamAccessorHelper.java
index 8a40f78c..827d3cda 100644
--- a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/model/helper/StandardRamAccessorHelper.java
+++ b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/model/helper/StandardRamAccessorHelper.java
@@ -13,6 +13,7 @@ package org.eclipse.virgo.kernel.shell.model.helper;
import java.lang.management.ManagementFactory;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -174,6 +175,19 @@ final public class StandardRamAccessorHelper implements RamAccessorHelper {
* {@inheritDoc}
*/
public ArtifactAccessor getArtifact(String type, String name, String version) {
+
+ //TODO work around until 337211 is done
+ if("org.eclipse.virgo.kernel".equals(name)){
+ Map<String, Object> attributes = new TreeMap<String, Object>();
+ attributes.put(TYPE_ATTRIBUTE, "Region");
+ attributes.put(NAME_ATTRIBUTE, name);
+ attributes.put(VERSION_ATTRIBUTE, version);
+ attributes.put(STATE_ATTRIBUTE, "-");
+ attributes.put("atomic", false);
+ attributes.put("scoped", false);
+ return new StandardArtifactAccessor(attributes, new HashMap<String, String>(), new HashSet<ArtifactAccessorPointer>());
+ }
+
MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
try {
ObjectName objectName = new ObjectName(String.format(ARTIFACT_MBEAN_QUERY, type, name, version));
@@ -230,8 +244,17 @@ final public class StandardRamAccessorHelper implements RamAccessorHelper {
String dependentVersion = objectName.getKeyProperty("version");
ManageableArtifact dependantArtifact = JMX.newMXBeanProxy(mBeanServer, objectName, ManageableArtifact.class);
- String state = dependantArtifact.getState();
-
+ String state;
+ if(dependantArtifact != null){
+ //TODO work around until 337211 is done
+ try {
+ state = dependantArtifact.getState();
+ } catch (Exception e) {
+ state = "-";
+ }
+ } else {
+ state = "-";
+ }
if (dependentType != null && dependentName != null && dependentVersion != null) {
result = new StandardArtifactAccessorPointer(dependentType, dependentName, dependentVersion, state);
}

Back to the top