Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Frost2012-02-23 12:47:57 -0500
committerChristopher Frost2012-02-23 12:47:57 -0500
commit4bc0e1c36ba87e8d3f6f907fc0dafceb3beebde8 (patch)
treea0dcdcc922096741a87eac1a0c9cbd99472fc44b /org.eclipse.virgo.management.fragment/src
parentc1aac7031c065704d2cbba34aba898b072452db6 (diff)
downloadorg.eclipse.virgo.kernel-4bc0e1c36ba87e8d3f6f907fc0dafceb3beebde8.tar.gz
org.eclipse.virgo.kernel-4bc0e1c36ba87e8d3f6f907fc0dafceb3beebde8.tar.xz
org.eclipse.virgo.kernel-4bc0e1c36ba87e8d3f6f907fc0dafceb3beebde8.zip
368157 Fixes for the build to apply the fragments to both regions
Diffstat (limited to 'org.eclipse.virgo.management.fragment/src')
-rw-r--r--org.eclipse.virgo.management.fragment/src/main/java/org/eclipse/virgo/management/fragment/VirgoObjectNameTranslator.java44
-rw-r--r--org.eclipse.virgo.management.fragment/src/test/java/.gitignore0
-rw-r--r--org.eclipse.virgo.management.fragment/src/test/resources/.gitignore0
3 files changed, 44 insertions, 0 deletions
diff --git a/org.eclipse.virgo.management.fragment/src/main/java/org/eclipse/virgo/management/fragment/VirgoObjectNameTranslator.java b/org.eclipse.virgo.management.fragment/src/main/java/org/eclipse/virgo/management/fragment/VirgoObjectNameTranslator.java
new file mode 100644
index 00000000..1ddba27e
--- /dev/null
+++ b/org.eclipse.virgo.management.fragment/src/main/java/org/eclipse/virgo/management/fragment/VirgoObjectNameTranslator.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.management.fragment;
+
+import java.util.Hashtable;
+
+import javax.management.ObjectName;
+
+import org.eclipse.equinox.region.RegionDigraph;
+import org.eclipse.gemini.mgmt.ObjectNameTranslator;
+
+public class VirgoObjectNameTranslator implements ObjectNameTranslator{
+
+ private static final String REGION_KEY = "region";
+
+ private final RegionDigraph regionDigraph;
+
+ public VirgoObjectNameTranslator(RegionDigraph regionDigraph) {
+ this.regionDigraph = regionDigraph;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ObjectName translate(ObjectName originalName) {
+ Hashtable<String, String> keyPropertyList = originalName.getKeyPropertyList();
+ keyPropertyList.put(REGION_KEY, this.regionDigraph.getRegion(7l).getName());
+ try {
+ return new ObjectName(originalName.getDomain(), keyPropertyList);
+ } catch (Exception e) {
+ throw new RuntimeException("Error modifying ObjectName for '" + originalName.getCanonicalName() + "'", e);
+ }
+ }
+
+}
diff --git a/org.eclipse.virgo.management.fragment/src/test/java/.gitignore b/org.eclipse.virgo.management.fragment/src/test/java/.gitignore
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/org.eclipse.virgo.management.fragment/src/test/java/.gitignore
diff --git a/org.eclipse.virgo.management.fragment/src/test/resources/.gitignore b/org.eclipse.virgo.management.fragment/src/test/resources/.gitignore
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/org.eclipse.virgo.management.fragment/src/test/resources/.gitignore

Back to the top