373549 Ensuring that fragments and hosts are returned the right way round on the BundleStateMBean
diff --git a/org.eclipse.gemini.mgmt/src/main/java/org/eclipse/gemini/mgmt/framework/BundleState.java b/org.eclipse.gemini.mgmt/src/main/java/org/eclipse/gemini/mgmt/framework/BundleState.java
index 36da3a8..4651346 100644
--- a/org.eclipse.gemini.mgmt/src/main/java/org/eclipse/gemini/mgmt/framework/BundleState.java
+++ b/org.eclipse.gemini.mgmt/src/main/java/org/eclipse/gemini/mgmt/framework/BundleState.java
@@ -103,8 +103,8 @@
 	 */

 	public long[] getFragments(long bundleId) throws IOException {

 		BundleWiring wiring = retrieveBundle(bundleId).adapt(BundleWiring.class);

-		List<BundleWire> requiredWires = wiring.getRequiredWires(BundleRevision.HOST_NAMESPACE);

-        return bundleWiresToIds(requiredWires);

+		List<BundleWire> requiredWires = wiring.getProvidedWires(BundleRevision.HOST_NAMESPACE);

+        return bundleWiresToRequirerIds(requiredWires);

 	}

 

 	/**

@@ -119,8 +119,8 @@
 	 */

 	public long[] getHosts(long fragment) throws IOException {

 		BundleWiring wiring = retrieveBundle(fragment).adapt(BundleWiring.class);

-		List<BundleWire> providedWires = wiring.getProvidedWires(BundleRevision.HOST_NAMESPACE);

-        return bundleWiresToIds(providedWires);

+		List<BundleWire> providedWires = wiring.getRequiredWires(BundleRevision.HOST_NAMESPACE);

+        return bundleWiresToProviderIds(providedWires);

 	}

 	

 	/**

@@ -150,7 +150,7 @@
 	public long[] getRequiringBundles(long bundleId) throws IOException {

         BundleWiring wiring = retrieveBundle(bundleId).adapt(BundleWiring.class);

         List<BundleWire> providedWires = wiring.getProvidedWires(BundleRevision.BUNDLE_NAMESPACE);

-        return bundleWiresToIds(providedWires);

+        return bundleWiresToRequirerIds(providedWires);

     }

 	/**

 	 * {@inheritDoc}

@@ -193,7 +193,7 @@
 	public long[] getRequiredBundles(long bundleIdentifier) throws IOException {

         BundleWiring wiring = retrieveBundle(bundleIdentifier).adapt(BundleWiring.class);

         List<BundleWire> requiredWires = wiring.getRequiredWires(BundleRevision.BUNDLE_NAMESPACE);

-        return bundleWiresToIds(requiredWires);

+        return bundleWiresToProviderIds(requiredWires);

     }

 

 	/**

@@ -298,7 +298,7 @@
 		return b;

 	}

 

-	private long[] bundleWiresToIds(List<BundleWire> wires){

+	private long[] bundleWiresToRequirerIds(List<BundleWire> wires){

         long[] consumerWirings = new long[wires.size()];

         int i = 0;

         for (BundleWire bundleWire : wires) {

@@ -308,6 +308,16 @@
         return consumerWirings;

 	}

 

+	private long[] bundleWiresToProviderIds(List<BundleWire> wires){

+        long[] consumerWirings = new long[wires.size()];

+        int i = 0;

+        for (BundleWire bundleWire : wires) {

+            consumerWirings[i] = bundleWire.getProviderWiring().getBundle().getBundleId();

+            i++;

+        }

+        return consumerWirings;

+	}

+

 	private long[] serviceIds(ServiceReference<?>[] refs) {

 		if (refs == null) {

 			return new long[0];