wip
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/BundleState.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/BundleState.java
index e8ac09a..1b2749e 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/BundleState.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/BundleState.java
@@ -20,6 +20,7 @@
 

 import javax.management.Notification;

 import javax.management.openmbean.TabularData;

+import javax.management.openmbean.TabularDataSupport;

 

 import org.osgi.framework.Bundle;

 import org.osgi.framework.BundleContext;

@@ -54,11 +55,10 @@
 	 */

 	public TabularData listBundles() throws IOException {

 		try {

-			ArrayList<OSGiBundle> bundles = new ArrayList<OSGiBundle>();

+			TabularDataSupport table = new TabularDataSupport(BundleStateMBean.BUNDLES_TYPE);

 			for (Bundle bundle : bundleContext.getBundles()) {

-				bundles.add(new OSGiBundle(bundle));

+				table.put(new OSGiBundle(bundle).asCompositeData());

 			}

-			TabularData table = OSGiBundle.tableFrom(bundles);

 			return table;

 		} catch (Throwable e) {

 			throw new IOException(e);

diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/BundleWiringState.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/BundleWiringState.java
index 81f7e76..d60e296 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/BundleWiringState.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/BundleWiringState.java
@@ -11,20 +11,18 @@
 package org.eclipse.gemini.mgmt.framework;
 
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
-import javax.management.openmbean.ArrayType;
 import javax.management.openmbean.CompositeData;
-import javax.management.openmbean.CompositeDataSupport;
 import javax.management.openmbean.TabularData;
+import javax.management.openmbean.TabularDataSupport;
 
+import org.eclipse.gemini.mgmt.framework.internal.OSGiBundleRevision;
+import org.eclipse.gemini.mgmt.framework.internal.OSGiBundleWiring;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.wiring.BundleCapability;
-import org.osgi.framework.wiring.BundleRequirement;
+import org.osgi.framework.wiring.BundleRevision;
+import org.osgi.framework.wiring.BundleRevisions;
 import org.osgi.framework.wiring.BundleWiring;
 
 /**
@@ -42,83 +40,94 @@
 		this.bundleContext = bundleContext;
 	}
 
-	/**
+	/** DONE
 	 * {@inheritDoc}
 	 */
-	public CompositeData[] getCurrentRevisionDeclaredRequirements(long bundleId, String namespace) throws IOException {
-		BundleWiring wiring = bundleContext.getBundle(bundleId).adapt(BundleWiring.class);
-		List<BundleRequirement> requirements = wiring.getRequirements(null);
-		List<CompositeData> declaredRequirements = new ArrayList<CompositeData>();
-		
-		for (BundleRequirement bundleRequirement : requirements) {
-			Map<String, ?> requirementsValues = new HashMap<String, Object>();
-			
-			
-			
-			declaredRequirements.add(new CompositeDataSupport(CustomBundleWiringStateMBean.REQUIREMENT_TYPE_ARRAY, requirementsValues));
-		}
-		
-		return declaredRequirements.toArray(new CompositeData[declaredRequirements.size()]);
+	public CompositeData getCurrentRevisionDeclaredRequirements(long bundleId, String namespace) throws IOException {
+		BundleRevision bundleRevision = getBundle(bundleId).adapt(BundleRevision.class);
+		return new OSGiBundleRevision(bundleRevision).requirementsAsCompositeData(namespace);
 	}
 
-	/**
+	/** DONE
 	 * {@inheritDoc}
 	 */
-	public CompositeData[] getCurrentRevisionDeclaredCapabilities(long bundleId, String namespace) throws IOException {
-		BundleWiring wiring = bundleContext.getBundle(bundleId).adapt(BundleWiring.class);
-		List<BundleCapability> capabilities = wiring.getCapabilities(null);
-		List<CompositeData> declaredCapabilities = new ArrayList<CompositeData>();
-		for (BundleCapability bundleCapability : capabilities) {
-			
-		}
-		return declaredCapabilities.toArray(new CompositeData[declaredCapabilities.size()]);
+	public CompositeData getCurrentRevisionDeclaredCapabilities(long bundleId, String namespace) throws IOException {
+		BundleRevision bundleRevision = getBundle(bundleId).adapt(BundleRevision.class);
+		return new OSGiBundleRevision(bundleRevision).capabilitiesAsCompositeData(namespace);
 	}
-
-	/**
+	
+	/** DONE
 	 * {@inheritDoc}
 	 */
 	public CompositeData getCurrentWiring(long bundleId, String namespace) throws IOException {
-		BundleWiring wiring = bundleContext.getBundle(bundleId).adapt(BundleWiring.class);
-		return null;
+		BundleWiring wiring = getBundle(bundleId).adapt(BundleWiring.class);
+		return new OSGiBundleWiring(wiring).asCompositeData(namespace);
 	}
 
 	/**
 	 * {@inheritDoc}
 	 */
 	public TabularData getCurrentWiringClosure(long rootBundleId, String namespace) throws IOException {
-		BundleWiring wiring = bundleContext.getBundle(rootBundleId).adapt(BundleWiring.class);
+		BundleWiring wiring = getBundle(rootBundleId).adapt(BundleWiring.class);
+		OSGiBundleWiring osgiWiring = new OSGiBundleWiring(wiring);
+		
+		//Navigate the wires and check for cycles
+		
 		return null;
 	}
 
-	/**
+	/** DONE
 	 * {@inheritDoc}
 	 */
 	public TabularData getRevisionsDeclaredRequirements(long bundleId, String namespace) throws IOException {
-		BundleWiring wiring = bundleContext.getBundle(bundleId).adapt(BundleWiring.class);
-		return null;
+		List<BundleRevision> bundleRevisions = getBundle(bundleId).adapt(BundleRevisions.class).getRevisions();
+		TabularDataSupport table = new TabularDataSupport(CustomBundleWiringStateMBean.BUNDLE_REVISIONS_REQUIREMENTS_TYPE);
+		int revisionCounter = 0;
+		for (BundleRevision bundleRevision : bundleRevisions) {
+			table.put(new OSGiBundleRevision(bundleRevision).requirementsAsCompositeData(namespace, revisionCounter));
+			revisionCounter++;
+		}
+		return table;
 	}
 
-	/**
+	/** DONE
 	 * {@inheritDoc}
 	 */
 	public TabularData getRevisionsDeclaredCapabilities(long bundleId, String namespace) throws IOException {
-		BundleWiring wiring = bundleContext.getBundle(bundleId).adapt(BundleWiring.class);
-		return null;
+		List<BundleRevision> bundleRevisions = getBundle(bundleId).adapt(BundleRevisions.class).getRevisions();
+		TabularDataSupport table = new TabularDataSupport(CustomBundleWiringStateMBean.BUNDLE_REVISIONS_CAPABILITIES_TYPE);
+		int revisionCounter = 0;
+		for (BundleRevision bundleRevision : bundleRevisions) {
+			table.put(new OSGiBundleRevision(bundleRevision).capabilitiesAsCompositeData(namespace, revisionCounter));
+			revisionCounter++;
+		}
+		return table;
+	}
+	
+	/** DONE
+	 * {@inheritDoc}
+	 */
+	public TabularData getRevisionsWiring(long bundleId, String namespace) throws IOException {
+		List<BundleRevision> bundleRevisions = getBundle(bundleId).adapt(BundleRevisions.class).getRevisions();
+		TabularDataSupport table = new TabularDataSupport(CustomBundleWiringStateMBean.BUNDLE_REVISIONS_WIRINGS_TYPE);
+		int revisionCounter = 0;
+		for (BundleRevision bundleRevision : bundleRevisions) {
+			table.put(new OSGiBundleWiring(bundleRevision.getWiring()).asCompositeData(namespace, revisionCounter));
+			revisionCounter++;
+		}
+		return table;
 	}
 
 	/**
 	 * {@inheritDoc}
 	 */
-	public ArrayType getRevisionsWiring(long bundleId, String namespace) throws IOException {
-		BundleWiring wiring = bundleContext.getBundle(bundleId).adapt(BundleWiring.class);
-		return null;
-	}
-
-	/**
-	 * {@inheritDoc}
-	 */
-	public ArrayType getRevisionsWiringClosure(long rootBundleId, String namespace) throws IOException {
-		BundleWiring wiring = bundleContext.getBundle(rootBundleId).adapt(BundleWiring.class);
+	public TabularData getRevisionsWiringClosure(long rootBundleId, String namespace) throws IOException {
+		List<BundleRevision> bundleRevisions = getBundle(rootBundleId).adapt(BundleRevisions.class).getRevisions();
+		for (BundleRevision bundleRevision : bundleRevisions) {
+			OSGiBundleWiring osgiWiring = new OSGiBundleWiring(bundleRevision.getWiring());
+			
+			//Navigate the wires and check for cycles
+		}
 		return null;
 	}
 	
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/CustomBundleWiringStateMBean.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/CustomBundleWiringStateMBean.java
index 9585477..97233ed 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/CustomBundleWiringStateMBean.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/CustomBundleWiringStateMBean.java
@@ -37,196 +37,169 @@
  */
 public interface CustomBundleWiringStateMBean {
 
-    /*
-     * The Object Name for a Bundle Revisions MBean.
-     */
     String OBJECTNAME = JmxConstants.OSGI_CORE + ":type=wiringState,version=1.0";
 
-    /*
-     * Namespaces - Duplicated from BundleRevision.class
-     * 
+    /**
+     * Types and Items for the capabilities and requirements of a bundle
      */
-//    String BUNDLE_NAMESPACE = "osgi.wiring.bundle";
-//    String HOST_NAMESPACE = "osgi.wiring.host";
-//    String PACKAGE_NAMESPACE = "osgi.wiring.package";
-
-    /*
-     * Items, CompositeData, TabularData, ArrayTypes
-     *
-     */
+    
     String KEY = "Key";
-    Item KEY_ITEM = new Item(KEY, "The directive key", SimpleType.STRING);
+    Item KEY_ITEM = new Item(KEY, "The property key", SimpleType.STRING);
 
     String VALUE = "Value";
-    
-    Item VALUE_ITEM = new Item(VALUE, "The directive value", SimpleType.STRING);
+    Item VALUE_ITEM = new Item(VALUE, "The property value", SimpleType.STRING);
 
-    CompositeType DIRECTIVE_TYPE = Item.compositeType("DIRECTIVE",
-            "Describes a directive of a capability or requirement",
-            KEY_ITEM, VALUE_ITEM);
-    
-    TabularType DIRECTIVES_TYPE = Item.tabularType("DIRECTIVES",
-            "Describes the directives of a capability or requirement",
-            DIRECTIVE_TYPE, KEY
-            );
+    CompositeType PROPERTY_TYPE = Item.compositeType("PROPERTY", "Describes a single directive or attribute of a capability or requirement", KEY_ITEM, VALUE_ITEM);
 
+    TabularType DIRECTIVES_TYPE = Item.tabularType("DIRECTIVES", "Describes the directives of a capability or requirement", PROPERTY_TYPE, KEY);
+
+    TabularType ATTRIBUTES_TYPE = Item.tabularType("ATTRIBUTES", "Describes attributes of a capability or requirement", JmxConstants.PROPERTY_TYPE, JmxConstants.KEY);
+    
     String DIRECTIVES = "Directives";
-    Item DIRECTIVES_ITEM = new Item(DIRECTIVES,
-            "The directives of a capability or requirement",
-            DIRECTIVES_TYPE);
+    Item DIRECTIVES_ITEM = new Item(DIRECTIVES, "The directives of a capability or requirement", DIRECTIVES_TYPE);
 
-    // REVIEW should we reuse from JmxConstants here or create our own? ** REUSE
-    TabularType ATTRIBUTES_TYPE = Item.tabularType("ATTRIBUTES",
-            "Describes attributes of a capability or requirement",
-            JmxConstants.PROPERTY_TYPE, JmxConstants.KEY
-            );
     String ATTRIBUTES = "Attributes";
-    Item ATTRIBUTES_ITEM = new Item(ATTRIBUTES,
-            "The attributes of a capability or requirement",
-            ATTRIBUTES_TYPE);
+    Item ATTRIBUTES_ITEM = new Item(ATTRIBUTES, "The attributes of a capability or requirement", ATTRIBUTES_TYPE);
 
     String NAMESPACE = "Namespace";
-    Item NAMESPACE_ITEM = new Item(NAMESPACE,
-            "The namespace of a capability or requirement",
-            SimpleType.STRING);
+    Item NAMESPACE_ITEM = new Item(NAMESPACE, "The namespace of a capability or requirement", SimpleType.STRING);
+    
+    
+    /**
+     * Types for Bundle requirements and capabilities
+     */
+    CompositeType BUNDLE_REQUIREMENT_TYPE = Item.compositeType("BUNDLE_REQUIREMENT", "Describes the live wired requirements of a bundle", 
+    			ATTRIBUTES_ITEM, 
+				DIRECTIVES_ITEM, 
+				NAMESPACE_ITEM);
 
-    CompositeType BUNDLE_REQUIREMENT_TYPE =
-        Item.compositeType("BUNDLE_REQUIREMENT",
-                "Describes the live wired requirements of a bundle",
-                ATTRIBUTES_ITEM, DIRECTIVES_ITEM, NAMESPACE_ITEM);
-
-    CompositeType BUNDLE_CAPABILITY_TYPE =
-        Item.compositeType("BUNDLE_CAPABILITY",
-                "Describes the live wired capabilities of a bundle",
-                ATTRIBUTES_ITEM, DIRECTIVES_ITEM, NAMESPACE_ITEM);
-
-    String PROVIDER_BUNDLE_ID = "ProviderBundleId";
-    Item PROVIDER_BUNDLE_ID_ITEM = new Item(PROVIDER_BUNDLE_ID,
-            "The identifier of the bundle that is the provider of the capability",
-            SimpleType.LONG);
-
-    String REQUIRER_BUNDLE_ID = "RequirerBundleId";
-    Item REQUIRER_BUNDLE_ID_ITEM = new Item(REQUIRER_BUNDLE_ID,
-            "The identifier of the bundle that is the requirer of the requirement",
-            SimpleType.LONG);
-
+	@SuppressWarnings("unchecked")
+	ArrayType<CompositeData> REQUIREMENT_TYPE_ARRAY = Item.arrayType(1, BUNDLE_REQUIREMENT_TYPE);
+	
+	CompositeType BUNDLE_CAPABILITY_TYPE = Item.compositeType("BUNDLE_CAPABILITY", "Describes the live wired capabilities of a bundle", 
+				ATTRIBUTES_ITEM, 
+				DIRECTIVES_ITEM, 
+				NAMESPACE_ITEM);
+	
+	@SuppressWarnings("unchecked")
+	ArrayType<CompositeData> CAPABILITY_TYPE_ARRAY = Item.arrayType(1, BUNDLE_CAPABILITY_TYPE);
+    
+    /**
+     * Items for WIRE_TYPE
+     */
     String BUNDLE_REQUIREMENT = "BundleRequirement";
-    Item BUNDLE_REQUIREMENT_ITEM = new Item(BUNDLE_REQUIREMENT,
-            "The wired requirements of a bundle",
-            BUNDLE_REQUIREMENT_TYPE);
+    Item BUNDLE_REQUIREMENT_ITEM = new Item(BUNDLE_REQUIREMENT, "The wired requirements of a bundle", BUNDLE_REQUIREMENT_TYPE);
 
     String BUNDLE_CAPABILITY = "BundleCapability";
-    Item BUNDLE_CAPABILITY_ITEM = new Item(BUNDLE_CAPABILITY,
-            "The wired capabilities of a bundle",
-            BUNDLE_CAPABILITY_TYPE);
+    Item BUNDLE_CAPABILITY_ITEM = new Item(BUNDLE_CAPABILITY, "The wired capabilities of a bundle", BUNDLE_CAPABILITY_TYPE);
 
-    String PROVIDER_BUNDLE_REVISION_ID = "ProviderBundleRevisionId";
-    Item PROVIDER_BUNDLE_REVISION_ID_ITEM = new Item(PROVIDER_BUNDLE_REVISION_ID,
-            "A local id for the bundle revision that is the provider of the capability",
-            SimpleType.INTEGER);
+    String PROVIDER_BUNDLE_ID = "ProviderBundleId";
+    Item PROVIDER_BUNDLE_ID_ITEM = new Item(PROVIDER_BUNDLE_ID, "The identifier of the bundle that is the provider of the capability", SimpleType.LONG);
+    
+    //String PROVIDER_BUNDLE_REVISION_ID = "ProviderBundleRevisionId";
+    //Item PROVIDER_BUNDLE_REVISION_ID_ITEM = new Item(PROVIDER_BUNDLE_REVISION_ID, "A local id for the bundle revision that is the provider of the capability", SimpleType.INTEGER);
 
-    String REQUIRER_BUNDLE_REVISION_ID = "RequirerBundleRevisionId";
-    Item REQUIRER_BUNDLE_REVISION_ID_ITEM =  new Item(REQUIRER_BUNDLE_REVISION_ID,
-            "A local id for the bundle revision that is the requirer of the requirement",
-            SimpleType.INTEGER);
-
+    String REQUIRER_BUNDLE_ID = "RequirerBundleId";
+    Item REQUIRER_BUNDLE_ID_ITEM = new Item(REQUIRER_BUNDLE_ID, "The identifier of the bundle that is the requirer of the requirement", SimpleType.LONG);
+    
+    //String REQUIRER_BUNDLE_REVISION_ID = "RequirerBundleRevisionId";
+    //Item REQUIRER_BUNDLE_REVISION_ID_ITEM =  new Item(REQUIRER_BUNDLE_REVISION_ID, "A local id for the bundle revision that is the requirer of the requirement", SimpleType.INTEGER);
+    
     /**
-     * Describes the live association between a provider of
-     *  a capability and a requirer of the corresponding requirement.
+     * Describes a single bundle wire between a provider of a capability and a requirer of the corresponding requirement.
      */
-    CompositeType BUNDLE_WIRE_TYPE =
-        Item.compositeType("BUNDLE_WIRE",
-                "Describes the live association between a provider and a requirer",
+    CompositeType BUNDLE_WIRE_TYPE = Item.compositeType("BUNDLE_WIRE", "Describes the live association between a provider and a requirer",
                 BUNDLE_REQUIREMENT_ITEM,
                 BUNDLE_CAPABILITY_ITEM,
                 PROVIDER_BUNDLE_ID_ITEM,
-                PROVIDER_BUNDLE_REVISION_ID_ITEM,
-                REQUIRER_BUNDLE_ID_ITEM,
-                REQUIRER_BUNDLE_REVISION_ID_ITEM
+                //PROVIDER_BUNDLE_REVISION_ID_ITEM,
+                REQUIRER_BUNDLE_ID_ITEM
+                //REQUIRER_BUNDLE_REVISION_ID_ITEM
                 );
-    ArrayType BUNDLE_WIRES_TYPE_ARRAY = Item.arrayType(1, BUNDLE_WIRE_TYPE);
 
-    String BUNDLE_REVISION_ID = "BundleRevisionId";
-    Item BUNDLE_REVISION_ID_ITEM = new Item(BUNDLE_REVISION_ID,
-            "The local identifier of the bundle revision",
-            SimpleType.INTEGER);
+	@SuppressWarnings("unchecked")
+	ArrayType<CompositeData> BUNDLE_WIRES_TYPE = Item.arrayType(1, BUNDLE_WIRE_TYPE);
+    
+	/**
+	 * Common items
+	 */
 
     String BUNDLE_ID = "BundleId";
     Item BUNDLE_ID_ITEM = new Item(BUNDLE_ID, "The bundle identifier of the bundle revision", SimpleType.LONG);
 
-    ArrayType REQUIREMENT_TYPE_ARRAY = Item.arrayType(1, BUNDLE_REQUIREMENT_TYPE);
+    String BUNDLE_REVISION_ID = "BundleRevisionId";
+    Item BUNDLE_REVISION_ID_ITEM = new Item(BUNDLE_REVISION_ID, "The local identifier of the bundle revision", SimpleType.INTEGER);
     
-    ArrayType CAPABILITY_TYPE_ARRAY = Item.arrayType(1, BUNDLE_CAPABILITY_TYPE);
+	/**
+	 * For a single bundle wiring, its requirements
+	 */
 
     String REQUIREMENTS = "Requirements";
     Item REQUIREMENTS_ITEM = new Item(REQUIREMENTS, "The bundle requirements of a bundle revision wiring", REQUIREMENT_TYPE_ARRAY);
 
-    CompositeType REVISION_REQUIREMENTS_TYPE =
-        Item.compositeType("REVISION_REQUIREMENTS",
-            "Describes the requirements for a bundle revision",
-            BUNDLE_ID_ITEM,
-            BUNDLE_REVISION_ID_ITEM,
-            REQUIREMENTS_ITEM);
+    CompositeType BUNDLE_REQUIREMENTS_TYPE = Item.compositeType("BUNDLE_REQUIREMENTS", "Describes the requirements for a bundle", 
+    			BUNDLE_ID_ITEM, 
+    			REQUIREMENTS_ITEM);
 
-    TabularType REVISIONS_REQUIREMENTS_TYPE =
-        Item.tabularType("REVISIONS_REQUIREMENTS",
-            "The bundle requirements for all bundle revisions",
-            REVISION_REQUIREMENTS_TYPE,
-            BUNDLE_ID, BUNDLE_REVISION_ID);
+    CompositeType BUNDLE_REVISION_REQUIREMENTS_TYPE = Item.compositeType("BUNDLE_REVISION_REQUIREMENTS", "Describes the requirements for a bundle revision", 
+    			BUNDLE_ID_ITEM, 
+    			BUNDLE_REVISION_ID_ITEM, 
+    			REQUIREMENTS_ITEM);
+
+    TabularType BUNDLE_REVISIONS_REQUIREMENTS_TYPE =  Item.tabularType("REVISIONS_REQUIREMENTS", "The bundle requirements for all bundle revisions", BUNDLE_REVISION_REQUIREMENTS_TYPE, BUNDLE_ID, BUNDLE_REVISION_ID);
+
+	/**
+	 * For a single bundle wiring, its capabilities
+	 */
 
     String CAPABILITIES = "Capabilities";
-    Item CAPABILITIES_ITEM = new Item(CAPABILITIES,
-            "The bundle capabilities of a bundle revision wiring",
-            CAPABILITY_TYPE_ARRAY);
+    Item CAPABILITIES_ITEM = new Item(CAPABILITIES, "The bundle capabilities of a bundle revision wiring", CAPABILITY_TYPE_ARRAY);
+    
+    CompositeType BUNDLE_CAPABILITIES_TYPE = Item.compositeType("BUNDLE_CAPABILITIES", "Describes the capabilities for a bundle", 
+    			BUNDLE_ID_ITEM, 
+    			CAPABILITIES_ITEM);
+    
+    CompositeType BUNDLE_REVISION_CAPABILITIES_TYPE = Item.compositeType("BUNDLE_REVISION_CAPABILITIES", "Describes the capabilities for a bundle revision", 
+    			BUNDLE_ID_ITEM, 
+    			BUNDLE_REVISION_ID_ITEM, 
+    			CAPABILITIES_ITEM);
 
-    CompositeType REVISION_CAPABILITIES_TYPE =
-        Item.compositeType("REVISION_CAPABILITIES",
-            "Describes the capabilities for a bundle revision",
-            BUNDLE_ID_ITEM,
-            BUNDLE_REVISION_ID_ITEM,
-            CAPABILITIES_ITEM);
-
-    TabularType REVISIONS_CAPABILITIES_TYPE =
-        Item.tabularType("REVISIONS_CAPABILITIES",
-            "The bundle capabilities for all bundle revisions",
-            REVISION_CAPABILITIES_TYPE,
-            BUNDLE_ID, BUNDLE_REVISION_ID);
-
+    TabularType BUNDLE_REVISIONS_CAPABILITIES_TYPE = Item.tabularType("REVISIONS_CAPABILITIES", "The bundle capabilities for all bundle revisions", BUNDLE_REVISION_CAPABILITIES_TYPE, BUNDLE_ID, BUNDLE_REVISION_ID);
+ 
+	/**
+	 * For a single bundle wiring
+	 */
+    
     String PROVIDED_WIRES = "ProvidedWires";
-    Item PROVIDED_WIRES_ITEM = new Item(PROVIDED_WIRES,
-            "The bundle wires to the capabilities provided by this bundle wiring.",
-            BUNDLE_WIRES_TYPE_ARRAY);
+    Item PROVIDED_WIRES_ITEM = new Item(PROVIDED_WIRES, "The bundle wires to the capabilities provided by this bundle wiring.", BUNDLE_WIRES_TYPE);
 
     String REQUIRED_WIRES = "RequiredWires";
-    Item REQUIRED_WIRES_ITEM = new Item(REQUIRED_WIRES,
-            "The bundle wires to requirements in use by this bundle wiring",
-            BUNDLE_WIRES_TYPE_ARRAY);
-
-    CompositeType BUNDLE_WIRING_TYPE =
-        Item.compositeType("BUNDLE_WIRING",
-                "Describes the runtime association between a provider and a requirer",
-                BUNDLE_ID_ITEM,               /* Long */
-                BUNDLE_REVISION_ID_ITEM,      /* Integer (local scope) */
-                REQUIREMENTS_ITEM,            /* REQUIREMENT_TYPE [] */
-                CAPABILITIES_ITEM,            /* CAPABILITIES_TYPE [] */
-                REQUIRED_WIRES_ITEM,          /* BUNDLE_WIRE_TYPE [] */
-                PROVIDED_WIRES_ITEM           /* BUNDLE_WIRE_TYPE [] */
-                );
+    Item REQUIRED_WIRES_ITEM = new Item(REQUIRED_WIRES, "The bundle wires to requirements in use by this bundle wiring", BUNDLE_WIRES_TYPE);
     
-    ArrayType BUNDLE_WIRING_TYPE_ARRAY = Item.arrayType(1, BUNDLE_WIRING_TYPE);
+    CompositeType BUNDLE_WIRING_TYPE = Item.compositeType("BUNDLE_WIRING", "Describes the runtime association between a provider and a requirer",
+            BUNDLE_ID_ITEM,               /* Long */
+            REQUIREMENTS_ITEM,            /* REQUIREMENT_TYPE [] */
+            CAPABILITIES_ITEM,            /* CAPABILITIES_TYPE [] */
+            REQUIRED_WIRES_ITEM,          /* BUNDLE_WIRE_TYPE [] */
+            PROVIDED_WIRES_ITEM);         /* BUNDLE_WIRE_TYPE [] */
 
-    ArrayType REVISIONS_REQUIREMENT_TYPE_ARRAY = Item.arrayType(2, BUNDLE_REQUIREMENT_TYPE);
+    CompositeType BUNDLE_REVISION_WIRING_TYPE = Item.compositeType("BUNDLE_REVISIONS_WIRING", "Describes the runtime association between a provider and a requirer",
+            BUNDLE_ID_ITEM,               /* Long */
+            BUNDLE_REVISION_ID_ITEM,      /* Integer (local scope) */
+            REQUIREMENTS_ITEM,            /* REQUIREMENT_TYPE [] */
+            CAPABILITIES_ITEM,            /* CAPABILITIES_TYPE [] */
+            REQUIRED_WIRES_ITEM,          /* BUNDLE_WIRE_TYPE [] */
+            PROVIDED_WIRES_ITEM);         /* BUNDLE_WIRE_TYPE [] */
+    
+    TabularType BUNDLE_REVISIONS_WIRINGS_TYPE = Item.tabularType("BUNDLE_REVISIONS_WIRINGS", "A table of bundle wirings for each revision of a bundle", BUNDLE_REVISION_WIRING_TYPE, BUNDLE_ID, BUNDLE_REVISION_ID);
 
-    ArrayType REVISIONS_CAPABILITY_TYPE_ARRAY = Item.arrayType(2, BUNDLE_CAPABILITY_TYPE);
-
-    TabularType BUNDLE_WIRING_CLOSURE_TYPE = Item.tabularType("BUNDLE_WIRING_CLOSURE",
-            "A table of bundle wirings describing a full wiring closure",
-            BUNDLE_WIRING_TYPE,
-            BUNDLE_ID, BUNDLE_REVISION_ID);
-
+    
+    
+    // ****** START METHODS ******
+    
     /**
      * Returns the requirements for the current bundle revision.
-     * The ArrayType is typed by the {@link #REQUIREMENT_TYPE_ARRAY}.
+     * The TabularData is typed by the {@link #BUNDLE_REQUIREMENTS_TYPE}.
      *
      * @param bundleId
      * @param namespace
@@ -234,34 +207,31 @@
      * and <code>namespace</code>
      *
      */
-    CompositeData[] getCurrentRevisionDeclaredRequirements(long bundleId, String namespace) throws IOException;
+    CompositeData getCurrentRevisionDeclaredRequirements(long bundleId, String namespace) throws IOException;
 
     /**
      * Returns the capabilities for the current bundle revision.
-     * The ArrayType is typed by the {@link #CAPABILITY_TYPE_ARRAY}
+     * The TabularData is typed by the {@link #BUNDLE_CAPABILITIES_TYPE}
      *
      * @param bundleId
      * @param namespace
-     * @return the declared capabilities for the current revision of <code>bundleId</code>
-     * and <code>namespace</code>
+     * @return the declared capabilities for the current revision of <code>bundleId</code> and <code>namespace</code>
      */
-    CompositeData[] getCurrentRevisionDeclaredCapabilities(long bundleId, String namespace) throws IOException;
+    CompositeData getCurrentRevisionDeclaredCapabilities(long bundleId, String namespace) throws IOException;
 
     /**
      * Returns the bundle wiring for the current bundle revision.
-     * The ArrayType is typed by the {@link #BUNDLE_WIRING_TYPE}
+     * The CompositeData is typed by the {@link #BUNDLE_WIRING_TYPE}
      *
      * @param bundleId
      * @param namespace
-     * @return the wires for the current revision of <code>bundleId</code>
-     * and <code>namespace</code>
+     * @return the wires for the current revision of <code>bundleId</code> and <code>namespace</code>
      */
     CompositeData getCurrentWiring(long bundleId, String namespace) throws IOException;
 
     /**
      * Returns the bundle wiring closure for the current revision of the specified bundle.
-     *
-     * @see #BUNDLE_WIRING_CLOSURE_TYPE for the details of the TabularType
+     * The TabularData is typed by the {@link #BUNDLE_WIRINGS_TYPE}.
      *
      * @param rootBundleId the root bundle of the closure.
      * @param namespace the namespace of the capabilities and requirements involved in this wiring.
@@ -273,9 +243,9 @@
 
     /**
      * Returns the requirements for all revisions of the bundle.
-     * The ArrayType is typed by the {@link #REVISIONS_REQUIREMENT_TYPE_ARRAY}.
+     * The TabularData is typed by the {@link #REVISIONS_REQUIREMENTS_TYPE}.
      * The requirements are in no particular order, and may change in
-     *  subsequent calls to this operation.
+     * subsequent calls to this operation.
      *
      * @param bundleId
      * @param namespace
@@ -286,9 +256,9 @@
 
     /**
      * Returns the capabilities for all revisions of the bundle.
-     * The ArrayType is typed by the {@link #REVISIONS_CAPABILITY_TYPE_ARRAY}
+     * The TabularData is typed by the {@link #REVISIONS_CAPABILITIES_TYPE}
      * The capabilities are in no particular order, and may change in
-     *  subsequent calls to this operation.
+     * subsequent calls to this operation.
      *
      * @param bundleId
      * @param namespace
@@ -298,21 +268,21 @@
 
     /**
      * Returns the bundle wirings for all revisions of the bundle.
-     * The ArrayType is typed by the {@link #BUNDLE_WIRING_TYPE_ARRAY}
+     * The TabularData is typed by the {@link #BUNDLE_WIRINGS_TYPE}
      * The bundle wirings are in no particular order, and may
-     *  change in subsequent calls to this operations.
+     * change in subsequent calls to this operations.
      *
      * @param bundleId
      * @param namespace
      * @return the wires for all revisions of <code>bundleId</code>
      */
-    ArrayType getRevisionsWiring(long bundleId, String namespace) throws IOException;
+    TabularData getRevisionsWiring(long bundleId, String namespace) throws IOException;
 
     /**
      * Returns a closure of all bundle wirings for all revisions of the 
      * bundle linked by their bundle wires, starting at <code>rootBundleId</code>.
      * 
-     * The ArrayType is typed by the {@link #BUNDLE_WIRING_TYPE_ARRAY}
+     * The TabularData is typed by the {@link #BUNDLE_WIRINGS_TYPE}
      * The bundle wirings are in no particular order, and may change 
      * in subsequent calls to this operation. Furthermore, the bundle 
      * wiring IDs are local and cannot be reused across invocations.
@@ -321,6 +291,6 @@
      * @param namespace
      * @return a closure of bundle wirings linked together by wires.
      */
-    ArrayType getRevisionsWiringClosure(long rootBundleId, String namespace) throws IOException;
+    TabularData getRevisionsWiringClosure(long rootBundleId, String namespace) throws IOException;
 
 }
\ No newline at end of file
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/PackageState.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/PackageState.java
index 3832dc6..d6e5032 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/PackageState.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/PackageState.java
@@ -38,7 +38,7 @@
 @SuppressWarnings("deprecation")

 public final class PackageState implements PackageStateMBean {

 	

-	private BundleContext bundleContext;

+	//private BundleContext bundleContext;

 	

 	private PackageAdmin admin;

 	

@@ -47,7 +47,7 @@
 	 * @param bundleContext

 	 */

 	public PackageState(BundleContext bundleContext) {

-		this.bundleContext = bundleContext;

+		//this.bundleContext = bundleContext;

 		this.admin = (PackageAdmin) bundleContext.getService(bundleContext.getServiceReference(PackageAdmin.class));

 	}

 

@@ -121,13 +121,16 @@
 	 */

 	public TabularData listPackages() {

 		Set<OSGiPackage> packages = new HashSet<OSGiPackage>();

-		for (Bundle bundle : bundleContext.getBundles()) {

-			ExportedPackage[] pkgs = admin.getExportedPackages(bundle);

-			if (pkgs != null) {

-				for (ExportedPackage pkg : pkgs) {

-					packages.add(new OSGiPackage(pkg.getName(), pkg.getVersion().toString(), pkg.isRemovalPending(), new Bundle[] { pkg.getExportingBundle() }, pkg.getImportingBundles()));

-				}

-			}

+//		for (Bundle bundle : bundleContext.getBundles()) {

+//			ExportedPackage[] pkgs = admin.getExportedPackages(bundle);

+//			if (pkgs != null) {

+//				for (ExportedPackage pkg : pkgs) {

+//					packages.add(new OSGiPackage(pkg.getName(), pkg.getVersion().toString(), pkg.isRemovalPending(), new Bundle[] { pkg.getExportingBundle() }, pkg.getImportingBundles()));

+//				}

+//			}

+//		}

+		for(ExportedPackage pkg : admin.getExportedPackages((Bundle) null)){

+			packages.add(new OSGiPackage(pkg.getName(), pkg.getVersion().toString(), pkg.isRemovalPending(), new Bundle[] { pkg.getExportingBundle() }, pkg.getImportingBundles()));

 		}

 		return OSGiPackage.tableFrom(packages);

 	}

diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/ServiceState.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/ServiceState.java
index 4e6f166..04cd7a8 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/ServiceState.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/ServiceState.java
@@ -101,7 +101,7 @@
 	 * {@inheritDoc}

 	 */

 	public long[] getUsingBundles(long serviceId) throws IOException {

-		return Util.getBundlesUsingBundles(getServiceReference(serviceId));

+		return Util.getBundlesUsing(getServiceReference(serviceId));

 	}

 

 	/**

diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/internal/OSGiBundle.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/internal/OSGiBundle.java
index ea651e2..cab1a17 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/internal/OSGiBundle.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/internal/OSGiBundle.java
@@ -147,21 +147,7 @@
 		this.bundle = b;

 	}

 

-	/**

-	 * Answer the TabularData representing the list of OSGiBundle state

-	 * 

-	 * @param bundles - the list of bundles to represent

-	 * 

-	 * @return the Tabular data which represents the list of bundles

-	 * @throws IOException 

-	 */

-	public static TabularData tableFrom(ArrayList<OSGiBundle> bundles) throws IOException {

-		TabularDataSupport table = new TabularDataSupport(BundleStateMBean.BUNDLES_TYPE);

-		for (OSGiBundle bundle : bundles) {

-			table.put(bundle.asCompositeData());

-		}

-		return table;

-	}

+

 

 	/**

 	 * Answer the TabularData representing the list of OSGiBundle state

@@ -172,7 +158,7 @@
 	 * @return the Tabular data which represents the list of bundles

 	 * @throws IOException 

 	 */

-	public static TabularData tableFrom(ArrayList<OSGiBundle> bundles, int mask) throws IOException {

+	public static TabularData tableFrom(List<OSGiBundle> bundles, int mask) throws IOException {

 		CompositeType computeBundleType = OSGiBundle.computeBundleType(mask);

 		TabularDataSupport table = new TabularDataSupport(Item.tabularType("BUNDLES", "A list of bundles", computeBundleType, new String[] { BundleStateMBean.IDENTIFIER }));

 		for (OSGiBundle bundle : bundles) {

@@ -295,7 +281,7 @@
 	 * @return the CompositeData encoding of the receiver.

 	 * @throws IOException 

 	 */

-	private CompositeData asCompositeData() throws IOException {

+	public CompositeData asCompositeData() throws IOException {

 		Map<String, Object> items = new HashMap<String, Object>();

 		items.put(BundleStateMBean.IDENTIFIER, getIdentifier());

 		items.put(BundleStateMBean.LOCATION, getLocation());

diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/internal/OSGiBundleCapability.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/internal/OSGiBundleCapability.java
new file mode 100644
index 0000000..548ccff
--- /dev/null
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/internal/OSGiBundleCapability.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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.gemini.mgmt.framework.internal;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.CompositeDataSupport;
+import javax.management.openmbean.OpenDataException;
+import javax.management.openmbean.TabularDataSupport;
+
+import org.eclipse.gemini.mgmt.framework.CustomBundleWiringStateMBean;
+import org.eclipse.gemini.mgmt.internal.OSGiProperties;
+import org.osgi.framework.wiring.BundleCapability;
+
+public class OSGiBundleCapability {
+	
+	private final BundleCapability bundleCapability;
+
+	public OSGiBundleCapability(BundleCapability bundleCapability) {
+		this.bundleCapability = bundleCapability;
+	}
+	
+	public CompositeData asCompositeData() {
+		try {
+			TabularDataSupport tabularAttributes = new TabularDataSupport(CustomBundleWiringStateMBean.ATTRIBUTES_TYPE);
+			Map<String, Object> attributes = bundleCapability.getAttributes();
+			for (Entry<String, Object> attribute : attributes.entrySet()) {
+				tabularAttributes.put(OSGiProperties.encode(attribute.getKey(), attribute.getValue()));
+			}
+	
+			TabularDataSupport tabularDirectives = new TabularDataSupport(CustomBundleWiringStateMBean.DIRECTIVES_TYPE);
+			Map<String, String> directives = bundleCapability.getDirectives();
+			for (Entry<String, String> directive : directives.entrySet()) {
+				tabularDirectives.put(new CompositeDataSupport(CustomBundleWiringStateMBean.PROPERTY_TYPE, getItem(directive.getKey(), directive.getValue())));
+			}
+			
+			Map<String, Object> items = new HashMap<String, Object>();
+			items.put(CustomBundleWiringStateMBean.ATTRIBUTES, tabularAttributes);
+			items.put(CustomBundleWiringStateMBean.DIRECTIVES, tabularDirectives);
+			items.put(CustomBundleWiringStateMBean.NAMESPACE, bundleCapability.getNamespace());
+		
+			return new CompositeDataSupport(CustomBundleWiringStateMBean.BUNDLE_CAPABILITY_TYPE, items);
+		} catch (OpenDataException e) {
+			e.printStackTrace(System.out);
+			throw new IllegalStateException("Cannot form bundle capability open data.", e);
+		}
+	}
+
+	//Move to OSGiProperties
+	private Map<String, ?> getItem(String key, Object value){
+		Map<String, Object> items = new HashMap<String, Object>();
+		items.put(CustomBundleWiringStateMBean.KEY, key);
+		items.put(CustomBundleWiringStateMBean.VALUE, value);
+		return items;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/internal/OSGiBundleRequirement.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/internal/OSGiBundleRequirement.java
new file mode 100644
index 0000000..3f10026
--- /dev/null
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/internal/OSGiBundleRequirement.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * 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.gemini.mgmt.framework.internal;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.CompositeDataSupport;
+import javax.management.openmbean.OpenDataException;
+import javax.management.openmbean.TabularDataSupport;
+
+import org.eclipse.gemini.mgmt.framework.CustomBundleWiringStateMBean;
+import org.eclipse.gemini.mgmt.internal.OSGiProperties;
+import org.osgi.framework.wiring.BundleRequirement;
+
+public class OSGiBundleRequirement {
+	
+	private final BundleRequirement bundleRequirement;
+
+	public OSGiBundleRequirement(BundleRequirement bundleRequirement) {
+		this.bundleRequirement = bundleRequirement;
+	}
+	
+	public CompositeData asCompositeData() {
+		try {
+			TabularDataSupport tabularAttributes = new TabularDataSupport(CustomBundleWiringStateMBean.ATTRIBUTES_TYPE);
+			Map<String, Object> attributes = bundleRequirement.getAttributes();
+			for (Entry<String, Object> attribute : attributes.entrySet()) {
+				tabularAttributes.put(OSGiProperties.encode(attribute.getKey(), attribute.getValue()));
+			}
+	
+			TabularDataSupport tabularDirectives = new TabularDataSupport(CustomBundleWiringStateMBean.DIRECTIVES_TYPE);
+			Map<String, String> directives = bundleRequirement.getDirectives();
+			for (Entry<String, String> directive : directives.entrySet()) {
+				tabularDirectives.put(new CompositeDataSupport(CustomBundleWiringStateMBean.PROPERTY_TYPE, getItem(directive.getKey(), directive.getValue())));
+			}
+			
+			Map<String, Object> items = new HashMap<String, Object>();
+			items.put(CustomBundleWiringStateMBean.ATTRIBUTES, tabularAttributes);
+			items.put(CustomBundleWiringStateMBean.DIRECTIVES, tabularDirectives);
+			items.put(CustomBundleWiringStateMBean.NAMESPACE, bundleRequirement.getNamespace());
+			
+			return new CompositeDataSupport(CustomBundleWiringStateMBean.BUNDLE_REQUIREMENT_TYPE, items);
+		} catch (OpenDataException e) {
+			throw new IllegalStateException("Cannot form bundle requirment open data", e);
+		}
+	}
+
+	//Move to OSGiProperties
+	private Map<String, ?> getItem(String key, Object value){
+		Map<String, Object> items = new HashMap<String, Object>();
+		items.put(CustomBundleWiringStateMBean.KEY, key);
+		items.put(CustomBundleWiringStateMBean.VALUE, value);
+		return items;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/internal/OSGiBundleRevision.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/internal/OSGiBundleRevision.java
new file mode 100644
index 0000000..8d243ce
--- /dev/null
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/internal/OSGiBundleRevision.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * 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.gemini.mgmt.framework.internal;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.CompositeDataSupport;
+import javax.management.openmbean.OpenDataException;
+
+import org.eclipse.gemini.mgmt.framework.CustomBundleWiringStateMBean;
+import org.osgi.framework.wiring.BundleCapability;
+import org.osgi.framework.wiring.BundleRequirement;
+import org.osgi.framework.wiring.BundleRevision;
+
+/**
+ * Utility methods for retrieving JMX data from a {@link BundleRevision}
+ * 
+ */
+public class OSGiBundleRevision {
+
+	private final BundleRevision bundleRevision;
+
+	/**
+	 * @param bundleRevision
+	 */
+	public OSGiBundleRevision(BundleRevision bundleRevision) {
+		this.bundleRevision = bundleRevision;
+	}
+	
+	/**
+	 * @param namespace - namespace to retrieve capabilities from
+	 * @return {@link CompositeData} representation of the capabilities
+	 */
+	public CompositeData capabilitiesAsCompositeData(String namespace){
+		Map<String, Object> items = this.getBundleCapabilityItems(namespace);
+		try {
+			return new CompositeDataSupport(CustomBundleWiringStateMBean.BUNDLE_CAPABILITIES_TYPE, items);
+		} catch (OpenDataException e) {
+			e.printStackTrace(System.out);
+			throw new IllegalStateException("Cannot form bundle capabilities open data", e);
+		}
+	}
+	
+	/**
+	 * @param namespace - namespace to retrieve requirements from
+	 * @return {@link CompositeData} representation of the requirements
+	 */
+	public CompositeData requirementsAsCompositeData(String namespace){
+		Map<String, Object> items = this.getBundleRequirementItems(namespace);
+		try {
+			return new CompositeDataSupport(CustomBundleWiringStateMBean.BUNDLE_REQUIREMENTS_TYPE, items);
+		} catch (OpenDataException e) {
+			e.printStackTrace(System.out);
+			throw new IllegalStateException("Cannot form bundle requirements open data", e);
+		}
+	}
+
+	/**
+	 * @param namespace - namespace to retrieve capabilities from
+	 * @param revisionCounter - an id number for this revision
+	 * @return {@link CompositeData} representation of the capabilities
+	 */
+	public CompositeData capabilitiesAsCompositeData(String namespace, int revisionCounter){
+		Map<String, Object> items = this.getBundleCapabilityItems(namespace);
+		items.put(CustomBundleWiringStateMBean.BUNDLE_REVISION_ID, revisionCounter);
+		try {
+			return new CompositeDataSupport(CustomBundleWiringStateMBean.BUNDLE_REVISION_CAPABILITIES_TYPE, items);
+		} catch (OpenDataException e) {
+			e.printStackTrace(System.out);
+			throw new IllegalStateException("Cannot form bundle revision capabilities open data", e);
+		}
+	}
+	
+	/**
+	 * @param namespace - namespace to retrieve requirements from
+	 * @param revisionCounter - an id number for this revision
+	 * @return {@link CompositeData} representation of the requirements
+	 */
+	public CompositeData requirementsAsCompositeData(String namespace, int revisionCounter){
+		Map<String, Object> items = this.getBundleRequirementItems(namespace);
+		items.put(CustomBundleWiringStateMBean.BUNDLE_REVISION_ID, revisionCounter);
+		try {
+			return new CompositeDataSupport(CustomBundleWiringStateMBean.BUNDLE_REVISION_REQUIREMENTS_TYPE, items);
+		} catch (OpenDataException e) {
+			e.printStackTrace(System.out);
+			throw new IllegalStateException("Cannot form bundle revision requirements open data", e);
+		}
+	}
+	
+	private Map<String, Object> getBundleCapabilityItems(String namespace){
+		Map<String, Object> items = new HashMap<String, Object>();
+		List<BundleCapability> declaredCapabilities = bundleRevision.getDeclaredCapabilities(namespace);
+		
+		CompositeData[] requirementsCompositeDatas = new CompositeData[declaredCapabilities.size()];
+		int i = 0;
+		for (BundleCapability bundleCapability : declaredCapabilities) {
+			requirementsCompositeDatas[i] = new OSGiBundleCapability(bundleCapability).asCompositeData();
+			i++;
+		}
+		items.put(CustomBundleWiringStateMBean.BUNDLE_ID, this.bundleRevision.getBundle().getBundleId());
+		items.put(CustomBundleWiringStateMBean.CAPABILITIES, requirementsCompositeDatas);
+		return items;
+	}
+	
+	private Map<String, Object> getBundleRequirementItems(String namespace){
+		Map<String, Object> items = new HashMap<String, Object>();
+		List<BundleRequirement> declaredRequirements = bundleRevision.getDeclaredRequirements(namespace);
+		
+		CompositeData[] requirementsCompositeDatas = new CompositeData[declaredRequirements.size()];
+		int i = 0;
+		for (BundleRequirement bundleRequirement : declaredRequirements) {
+			requirementsCompositeDatas[i] = new OSGiBundleRequirement(bundleRequirement).asCompositeData();
+			i++;
+		}
+		
+		items.put(CustomBundleWiringStateMBean.BUNDLE_ID, this.bundleRevision.getBundle().getBundleId());
+		items.put(CustomBundleWiringStateMBean.REQUIREMENTS, requirementsCompositeDatas);
+		return items;
+	}
+
+}
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/internal/OSGiBundleWire.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/internal/OSGiBundleWire.java
new file mode 100644
index 0000000..1ff8f60
--- /dev/null
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/internal/OSGiBundleWire.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * 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.gemini.mgmt.framework.internal;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.CompositeDataSupport;
+import javax.management.openmbean.OpenDataException;
+
+import org.eclipse.gemini.mgmt.framework.CustomBundleWiringStateMBean;
+import org.osgi.framework.wiring.BundleWire;
+
+/**
+ * Utility methods to get a single wire as JXM data
+ * 
+ */
+public class OSGiBundleWire {
+
+	private final BundleWire wire;
+
+	/**
+	 * 
+	 * @param wire {@link BundleWire}
+	 */
+	public OSGiBundleWire(BundleWire wire) {
+		this.wire = wire;
+	}
+	
+	public CompositeData asCompositeData() {
+		Map<String, Object> items = new HashMap<String, Object>();
+
+		items.put(CustomBundleWiringStateMBean.PROVIDER_BUNDLE_ID, wire.getProviderWiring().getBundle().getBundleId());
+		items.put(CustomBundleWiringStateMBean.REQUIRER_BUNDLE_ID, wire.getRequirerWiring().getBundle().getBundleId());
+		items.put(CustomBundleWiringStateMBean.BUNDLE_REQUIREMENT, new OSGiBundleRequirement(wire.getRequirement()).asCompositeData());
+		items.put(CustomBundleWiringStateMBean.BUNDLE_CAPABILITY, new OSGiBundleCapability(wire.getCapability()).asCompositeData());
+		
+		try {
+			return new CompositeDataSupport(CustomBundleWiringStateMBean.BUNDLE_WIRE_TYPE, items);
+		} catch (OpenDataException e) {
+			e.printStackTrace(System.out);
+			throw new IllegalStateException("Cannot form wire open data", e);
+		}
+	}
+	
+}
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/internal/OSGiBundleWiring.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/internal/OSGiBundleWiring.java
new file mode 100644
index 0000000..7a41364
--- /dev/null
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/internal/OSGiBundleWiring.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * 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.gemini.mgmt.framework.internal;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.CompositeDataSupport;
+import javax.management.openmbean.OpenDataException;
+
+import org.eclipse.gemini.mgmt.framework.CustomBundleWiringStateMBean;
+import org.osgi.framework.wiring.BundleCapability;
+import org.osgi.framework.wiring.BundleRequirement;
+import org.osgi.framework.wiring.BundleWire;
+import org.osgi.framework.wiring.BundleWiring;
+
+public class OSGiBundleWiring {
+
+	private final BundleWiring wiring;
+
+	public OSGiBundleWiring(BundleWiring wiring) {
+		this.wiring = wiring;
+	}
+	
+	public CompositeData asCompositeData(String namespace) {
+		Map<String, Object> items = this.getItems(namespace);
+		try {
+			return new CompositeDataSupport(CustomBundleWiringStateMBean.BUNDLE_WIRING_TYPE, items);
+		} catch (OpenDataException e) {
+			e.printStackTrace(System.out);
+			throw new IllegalStateException("Cannot form bundle wiring open data", e);
+		}
+	}
+
+	public CompositeData asCompositeData(String namespace, int revisionCounter) {
+		Map<String, Object> items = this.getItems(namespace);
+		items.put(CustomBundleWiringStateMBean.BUNDLE_REVISION_ID, revisionCounter);
+		try {
+			return new CompositeDataSupport(CustomBundleWiringStateMBean.BUNDLE_REVISION_WIRING_TYPE, items);
+		} catch (OpenDataException e) {
+			e.printStackTrace(System.out);
+			throw new IllegalStateException("Cannot form bundle revisions wirings open data", e);
+		}
+	}
+	
+	private Map<String, Object> getItems(String namespace) {
+		Map<String, Object> items = new HashMap<String, Object>();
+		items.put(CustomBundleWiringStateMBean.BUNDLE_ID, wiring.getBundle().getBundleId());
+		
+		List<BundleRequirement> requirements = wiring.getRequirements(namespace);
+		List<CompositeData> requirementsCompositeDate = new ArrayList<CompositeData>();
+		for (BundleRequirement bundleRequirement : requirements) {
+			requirementsCompositeDate.add(new OSGiBundleRequirement(bundleRequirement).asCompositeData());
+		}
+		
+		List<BundleCapability> capabilities = wiring.getCapabilities(namespace);
+		List<CompositeData> capabilitiesCompositeDate = new ArrayList<CompositeData>();
+		for (BundleCapability bundleCapability : capabilities) {
+			capabilitiesCompositeDate.add(new OSGiBundleCapability(bundleCapability).asCompositeData());
+		}
+		
+		List<BundleWire> requiredWires = wiring.getRequiredWires(namespace);
+		List<CompositeData> requiredWiresCompositeDate = new ArrayList<CompositeData>();
+		for (BundleWire bundleWire : requiredWires) {
+			requiredWiresCompositeDate.add(new OSGiBundleWire(bundleWire).asCompositeData());
+		}
+		
+		List<BundleWire> providedWires = wiring.getProvidedWires(namespace);
+		List<CompositeData> providedWiresCompositeDate = new ArrayList<CompositeData>();
+		for (BundleWire bundleWire : providedWires) {
+			providedWiresCompositeDate.add(new OSGiBundleWire(bundleWire).asCompositeData());
+		}
+		
+		items.put(CustomBundleWiringStateMBean.REQUIREMENTS, requirementsCompositeDate.toArray(new CompositeData[requirementsCompositeDate.size()]));
+		items.put(CustomBundleWiringStateMBean.CAPABILITIES, capabilitiesCompositeDate.toArray(new CompositeData[capabilitiesCompositeDate.size()]));
+		items.put(CustomBundleWiringStateMBean.REQUIRED_WIRES, requiredWiresCompositeDate.toArray(new CompositeData[requiredWiresCompositeDate.size()]));
+		items.put(CustomBundleWiringStateMBean.PROVIDED_WIRES, providedWiresCompositeDate.toArray(new CompositeData[providedWiresCompositeDate.size()]));
+		return items;
+	}
+	
+}
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/internal/OSGiService.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/internal/OSGiService.java
index 34b9619..706562c 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/internal/OSGiService.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/internal/OSGiService.java
@@ -69,8 +69,11 @@
 public final class OSGiService {

 

 	private long bundle;

+	

 	private long identifier;

+	

 	private String[] interfaces;

+	

 	private long[] usingBundles;

 

 	/**

@@ -85,7 +88,7 @@
 		this.identifier = (Long) reference.getProperty(SERVICE_ID);

 		this.interfaces = (String[]) reference.getProperty(OBJECTCLASS);

 		this.bundle = reference.getBundle().getBundleId();

-		this.usingBundles = Util.getBundlesUsingBundles(reference);

+		this.usingBundles = Util.getBundlesUsing(reference);

 	}

 

 	/**

@@ -114,7 +117,7 @@
 	 * @return the Tabular data which represents the list of bundles

 	 * @throws IOException 

 	 */

-	public static TabularData tableFrom(ArrayList<OSGiService> services, String... serviceTypeItems) throws IOException {

+	public static TabularData tableFrom(List<OSGiService> services, String... serviceTypeItems) throws IOException {

 		List<String> serviceTypes = Arrays.asList(serviceTypeItems);

 		TabularDataSupport table = new TabularDataSupport(Item.tabularType("SERVICES", "The table of all services", OSGiService.computeServiceType(serviceTypes), ServiceStateMBean.IDENTIFIER));

 		for (OSGiService service : services) {

diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/internal/OSGiProperties.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/internal/OSGiProperties.java
index 175d537..771edb5 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/internal/OSGiProperties.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/internal/OSGiProperties.java
@@ -21,23 +21,23 @@
 import java.util.Collection;

 import java.util.Dictionary;

 import java.util.Enumeration;

+import java.util.HashMap;

 import java.util.HashSet;

 import java.util.Hashtable;

+import java.util.Map;

 import java.util.Set;

 import java.util.StringTokenizer;

 import java.util.Vector;

 

 import javax.management.openmbean.CompositeData;

 import javax.management.openmbean.CompositeDataSupport;

-import javax.management.openmbean.CompositeType;

 import javax.management.openmbean.OpenDataException;

-import javax.management.openmbean.OpenType;

-import javax.management.openmbean.SimpleType;

 import javax.management.openmbean.TabularData;

 import javax.management.openmbean.TabularDataSupport;

-import javax.management.openmbean.TabularType;

 

 import org.osgi.framework.ServiceReference;

+import org.osgi.framework.Version;

+import org.osgi.jmx.JmxConstants;

 

 /**

  * <p>

@@ -88,38 +88,13 @@
 public final class OSGiProperties {

 

 	/**

-	 * The key of the entry

-	 */

-	public static final String KEY = "Key";

-	/**

-	 * The value of the entry

-	 */

-	public static final String VALUE = "Value";

-	/**

-	 * The type of the entry

-	 */

-	public static final String TYPE = "Type";

-	/**

-	 * The composite entries for the row

-	 */

-	public static final String[] PROPERTIES = new String[] { KEY, VALUE, TYPE };

-

-	/**

-	 * The property type

-	 */

-	public static final CompositeType PROPERTY = createPropertyType();

-	/**

-	 * The table type

-	 */

-	public static final TabularType PROPERTY_TABLE = createPropertyTableType();

-	/**

 	 * The scalar type

 	 */

-	protected static final Set<String> SCALAR_TYPES = new HashSet<String>();

+	private static final Set<String> SCALAR_TYPES = new HashSet<String>();

 	/**

 	 * The primitive types

 	 */

-	protected static final Set<String> PRIMITIVE_TYPES = new HashSet<String>();

+	private static final Set<String> PRIMITIVE_TYPES = new HashSet<String>();

 

 	static {

 		SCALAR_TYPES.add("String");

@@ -151,7 +126,7 @@
 	 * @return the tabular data representation of the properties

 	 */

 	public static TabularData tableFrom(Dictionary<String, Object> properties) {

-		TabularDataSupport table = new TabularDataSupport(PROPERTY_TABLE);

+		TabularDataSupport table = new TabularDataSupport(JmxConstants.PROPERTIES_TYPE);

 		if (properties != null) {

 			for (Enumeration<?> keys = properties.keys(); keys.hasMoreElements();) {

 				String key = (String) keys.nextElement();

@@ -207,7 +182,7 @@
 			return props;

 		}

 		for (CompositeData data : (Collection<CompositeData>) table.values()) {

-			props.put((String) data.get(KEY), parse((String) data.get(VALUE), (String) data.get(TYPE)));

+			props.put((String) data.get(JmxConstants.KEY), parse((String) data.get(JmxConstants.VALUE), (String) data.get(JmxConstants.TYPE)));

 		}

 

 		return props;

@@ -221,7 +196,7 @@
 	 * @param componentClazz

 	 * @return the composite data representation

 	 */

-	protected static CompositeData encodeArray(String key, Object value, Class<?> componentClazz) {

+	private static CompositeData encodeArray(String key, Object value, Class<?> componentClazz) {

 		String type = typeOf(componentClazz);

 		StringBuffer buf = new StringBuffer();

 		if (Integer.TYPE.equals(componentClazz)) {

@@ -299,7 +274,7 @@
 	 * @param value

 	 * @return the composite data representation

 	 */

-	protected static CompositeData encodeVector(String key, Vector<?> value) {

+	private static CompositeData encodeVector(String key, Vector<?> value) {

 		String type = "String";

 		if (value.size() > 0) {

 			type = typeOf(value.get(0).getClass());

@@ -320,8 +295,10 @@
 	 * @param clazz

 	 * @return the string type of the class

 	 */

-	protected static String typeOf(Class<?> clazz) {

-

+	private static String typeOf(Class<?> clazz) {

+		if (clazz.equals(Version.class)) {

+			return "Version";

+		}

 		if (clazz.equals(String.class)) {

 			return "String";

 		}

@@ -385,13 +362,12 @@
 	 * @return the composite data representation of the key/value pair

 	 */

 	private static CompositeData propertyData(String key, String value, String type) {

-		Object[] itemValues = new Object[PROPERTIES.length];

-		itemValues[0] = key;

-		itemValues[1] = value;

-		itemValues[2] = type;

-

+		Map<String, Object> items = new HashMap<String, Object>(); 

+		items.put(JmxConstants.KEY, key);

+		items.put(JmxConstants.VALUE, value);

+		items.put(JmxConstants.TYPE, type);

 		try {

-			return new CompositeDataSupport(PROPERTY, PROPERTIES, itemValues);

+			return new CompositeDataSupport(JmxConstants.PROPERTY_TYPE, items);

 		} catch (OpenDataException e) {

 			throw new IllegalStateException("Cannot form property open data", e);

 		}

@@ -404,7 +380,7 @@
 	 * @param type

 	 * @return the object represented by the String

 	 */

-	public static Object parse(String value, String type) {

+	private static Object parse(String value, String type) {

 		StringTokenizer tokens = new StringTokenizer(type);

 		if (!tokens.hasMoreElements()) {

 			throw new IllegalArgumentException("Type is empty");

@@ -429,7 +405,7 @@
 	 * @param tokens

 	 * @return the array represented by the string value

 	 */

-	protected static Object parseArray(String value, StringTokenizer tokens) {

+	private static Object parseArray(String value, StringTokenizer tokens) {

 		if (!tokens.hasMoreTokens()) {

 			throw new IllegalArgumentException("Expecting <of> token in Array type");

 		}

@@ -456,7 +432,7 @@
 	 * @param type

 	 * @return the array represented by the string value

 	 */

-	protected static Object parseScalarArray(String value, String type) {

+	private static Object parseScalarArray(String value, String type) {

 		ArrayList<Object> array = new ArrayList<Object>();

 		StringTokenizer values = new StringTokenizer(value, ",");

 		while (values.hasMoreTokens()) {

@@ -472,7 +448,7 @@
 	 * @param size

 	 * @return the scalar array from the supplied type

 	 */

-	protected static Object[] createScalarArray(String type, int size) {

+	private static Object[] createScalarArray(String type, int size) {

 		if ("String".equals(type)) {

 			return new String[size];

 		}

@@ -513,7 +489,7 @@
 	 * @param type

 	 * @return the array from the supplied values

 	 */

-	protected static Object parsePrimitiveArray(String value, String type) {

+	private static Object parsePrimitiveArray(String value, String type) {

 		StringTokenizer values = new StringTokenizer(value, ",");

 		if ("int".equals(type)) {

 			int[] array = new int[values.countTokens()];

@@ -575,13 +551,13 @@
 	}

 

 	/**

-	 * Parse the vector represented by teh supplied string value

+	 * Parse the vector represented by the supplied string value

 	 * 

 	 * @param value

 	 * @param tokens

-	 * @return the vector represented by teh supplied string value

+	 * @return the vector represented by the supplied string value

 	 */

-	protected static Object parseVector(String value, StringTokenizer tokens) {

+	private static Object parseVector(String value, StringTokenizer tokens) {

 		if (!tokens.hasMoreTokens()) {

 			throw new IllegalArgumentException("Expecting <of> token in Vector type");

 		}

@@ -610,8 +586,7 @@
 	 * @param type

 	 * @return the scalar value represented by the string

 	 */

-	@SuppressWarnings("boxing")

-	protected static Object parseScalar(String value, String type) {

+	private static Object parseScalar(String value, String type) {

 		if ("String".equals(type)) {

 			return value;

 		}

@@ -645,34 +620,4 @@
 		throw new IllegalArgumentException("Unknown scalar type: " + type);

 	}

 

-	private static TabularType createPropertyTableType() {

-		try {

-			return new TabularType("Properties", "The table of credentials", PROPERTY, new String[] { KEY });

-		} catch (OpenDataException e) {

-			throw new IllegalStateException("Cannot form services table open data", e);

-		}

-	}

-

-	@SuppressWarnings("unchecked")

-	private static CompositeType createPropertyType() {

-		String description = "This type encapsulates a key/value pair";

-		String[] itemNames = PROPERTIES;

-		OpenType<String>[] itemTypes = new OpenType[itemNames.length];

-		String[] itemDescriptions = new String[itemNames.length];

-		itemTypes[0] = SimpleType.STRING;

-		itemTypes[1] = SimpleType.STRING;

-		itemTypes[2] = SimpleType.STRING;

-

-		itemDescriptions[0] = "The key of the property";

-		itemDescriptions[1] = "The value of the property";

-		itemDescriptions[2] = "The type of the value";

-

-		try {

-			return new CompositeType("Property", description, itemNames, itemDescriptions, itemTypes);

-		} catch (OpenDataException e) {

-			throw new IllegalStateException("Cannot form property open data", e);

-		}

-

-	}

-

 }

diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/internal/Util.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/internal/Util.java
index 0c3849f..22a427a 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/internal/Util.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/internal/Util.java
@@ -46,7 +46,7 @@
 	 * @return

 	 * @throws IOException

 	 */

-	public static long[] getBundlesUsingBundles(ServiceReference<?> serviceRef) {

+	public static long[] getBundlesUsing(ServiceReference<?> serviceRef) {

 		Bundle[] bundles = serviceRef.getUsingBundles();

 		long[] ids = new long[bundles.length];

 		for (int i = 0; i < bundles.length; i++) {