Remove use of equinox internals.
diff --git a/console/org.eclipse.equinox.console.supportability/META-INF/MANIFEST.MF b/console/org.eclipse.equinox.console.supportability/META-INF/MANIFEST.MF
index 057d465..7d499a0 100644
--- a/console/org.eclipse.equinox.console.supportability/META-INF/MANIFEST.MF
+++ b/console/org.eclipse.equinox.console.supportability/META-INF/MANIFEST.MF
@@ -19,9 +19,6 @@
  org.apache.sshd.server.session;version="0.5.0";resolution:=optional,
  org.apache.sshd.server.shell;version="0.5.0";resolution:=optional,
  org.eclipse.osgi.framework.console,
- org.eclipse.osgi.framework.internal.core,
- org.eclipse.osgi.internal.permadmin,
- org.eclipse.osgi.internal.profile,
  org.eclipse.osgi.service.environment,
  org.eclipse.osgi.service.resolver,
  org.eclipse.osgi.util,
diff --git a/console/org.eclipse.equinox.console.supportability/src/org/eclipse/equinox/console/commands/EquinoxCommandProvider.java b/console/org.eclipse.equinox.console.supportability/src/org/eclipse/equinox/console/commands/EquinoxCommandProvider.java
index b549f5d..b6d4527 100644
--- a/console/org.eclipse.equinox.console.supportability/src/org/eclipse/equinox/console/commands/EquinoxCommandProvider.java
+++ b/console/org.eclipse.equinox.console.supportability/src/org/eclipse/equinox/console/commands/EquinoxCommandProvider.java
@@ -14,8 +14,8 @@
 
 import java.io.File;
 import java.lang.reflect.Field;
+import java.lang.reflect.Method;
 import java.net.URL;
-import java.security.ProtectionDomain;
 import java.util.ArrayList;
 import java.util.Dictionary;
 import java.util.Enumeration;
@@ -31,9 +31,6 @@
 import org.apache.felix.service.command.Descriptor;
 import org.apache.felix.service.command.Parameter;
 import org.eclipse.equinox.console.command.adapter.Activator;
-import org.eclipse.osgi.framework.internal.core.AbstractBundle;
-import org.eclipse.osgi.framework.internal.core.Util;
-import org.eclipse.osgi.internal.profile.Profile;
 import org.eclipse.osgi.service.environment.EnvironmentInfo;
 import org.eclipse.osgi.service.resolver.BundleDescription;
 import org.eclipse.osgi.service.resolver.DisabledInfo;
@@ -768,7 +765,7 @@
 	 *
 	 *  @param bundles bundle(s) to display details for
 	 */
-	@SuppressWarnings({ "deprecation", "restriction" })
+	@SuppressWarnings({ "deprecation" })
 	@Descriptor(ConsoleMsg.CONSOLE_HELP_BUNDLE_COMMAND_DESCRIPTION)
 	public void bundle(@Descriptor(ConsoleMsg.CONSOLE_HELP_IDLOCATION_ARGUMENT_DESCRIPTION)Bundle[] bundles) throws Exception {
 		if (bundles.length == 0) {
@@ -1027,13 +1024,7 @@
 				} else {
 					System.out.print("  "); //$NON-NLS-1$
 					System.out.println(ConsoleMsg.CONSOLE_NO_EXPORTED_PACKAGES_NO_PLATFORM_ADMIN_MESSAGE);
-				}
-				
-				SecurityManager sm = System.getSecurityManager();
-				if (sm != null) {
-					ProtectionDomain domain = ((AbstractBundle)bundle).getProtectionDomain();
-					System.out.println(domain);
-				}
+				}		
 		}
 	}
 
@@ -1251,7 +1242,6 @@
 	 *
 	 * @param bundles bundle(s) whose headers to display
 	 */
-	@SuppressWarnings("restriction")
 	@Descriptor(ConsoleMsg.CONSOLE_HELP_HEADERS_COMMAND_DESCRIPTION)
 	public List<Dictionary<String, String>> headers(@Descriptor(ConsoleMsg.CONSOLE_HELP_HEADERS_COMMAND_ARGUMENT_DESCRIPTION) Bundle... bundles) throws Exception {
 		ArrayList<Dictionary<String, String>> headers = new ArrayList<Dictionary<String,String>>();
@@ -1263,7 +1253,7 @@
 		
 		
 		for (Bundle bundle : bundles) {
-			headers.add(((AbstractBundle)bundle).getHeaders());
+			headers.add(bundle.getHeaders());
 		}
 		return headers;
 	}
@@ -1438,7 +1428,6 @@
 	 * in the embedded system.
 	 *
 	 */
-	@SuppressWarnings("restriction")
 	@Descriptor(ConsoleMsg.CONSOLE_THREADS_COMMAND_DESCRIPTION)
 	public void threads() throws Exception {
 
@@ -1637,10 +1626,11 @@
 	/**
 	 * Handles the profilelog command. 
 	 */
-	@SuppressWarnings("restriction")
 	@Descriptor(ConsoleMsg.CONSOLE_HELP_PROFILELOG_COMMAND_DESCRIPTION)
 	public void profilelog() throws Exception {
-		System.out.println(Profile.getProfileLog());
+		Class<?> profileClass = BundleContext.class.getClassLoader().loadClass("org.eclipse.osgi.internal.profile.Profile");
+		Method getProfileLog = profileClass.getMethod("getProfileLog", (Class<?>[]) null);
+		System.out.println(getProfileLog.invoke(null, (Object[]) null));
 	}
 
 	/**
diff --git a/console/org.eclipse.equinox.console.supportability/src/org/eclipse/equinox/console/commands/EquinoxCommandsConverter.java b/console/org.eclipse.equinox.console.supportability/src/org/eclipse/equinox/console/commands/EquinoxCommandsConverter.java
index 3ec60ce..76ce911 100644
--- a/console/org.eclipse.equinox.console.supportability/src/org/eclipse/equinox/console/commands/EquinoxCommandsConverter.java
+++ b/console/org.eclipse.equinox.console.supportability/src/org/eclipse/equinox/console/commands/EquinoxCommandsConverter.java
@@ -18,7 +18,6 @@
 import java.util.List;
 
 import org.apache.felix.service.command.Converter;
-import org.eclipse.osgi.framework.internal.core.Util;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Version;
@@ -152,7 +151,6 @@
 		return true;
 	}
 	
-	@SuppressWarnings("restriction")
 	private String printDictionary(Dictionary<?, ?> dic) {
 		int count = dic.size();
 		String[] keys = new String[count];
diff --git a/console/org.eclipse.equinox.console.supportability/src/org/eclipse/equinox/console/commands/Util.java b/console/org.eclipse.equinox.console.supportability/src/org/eclipse/equinox/console/commands/Util.java
new file mode 100644
index 0000000..bb3c192
--- /dev/null
+++ b/console/org.eclipse.equinox.console.supportability/src/org/eclipse/equinox/console/commands/Util.java
@@ -0,0 +1,208 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2011 IBM Corporation and others.
+ * 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:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.console.commands;
+
+/**
+ * This class contains utility functions.
+ */
+public class Util {
+	/**
+	 * Performs a quicksort of the given objects
+	 * by their string representation in ascending order.
+	 * <p> 
+	 *
+	 * @param array	The array of objects to sort
+	 */
+	public static void sortByString(Object[] array) {
+		qSortByString(array, 0, array.length - 1);
+	}
+
+	/**
+	 * Sorts the array of objects by their string representation
+	 * in ascending order.
+	 * <p>
+	 * This is a version of C.A.R Hoare's Quick Sort algorithm.
+	 *
+	 * @param array	the	array of objects to sort
+	 * @param start	the start index to begin sorting
+	 * @param stop		the end index to stop sorting
+	 * 
+	 * @exception	ArrayIndexOutOfBoundsException when <code>start < 0</code>
+	 *				or <code>end >= array.length</code>
+	 */
+	public static void qSortByString(Object[] array, int start, int stop) {
+		if (start >= stop)
+			return;
+
+		int left = start; // left index
+		int right = stop; // right index
+		Object temp; // for swapping
+
+		// arbitrarily establish a partition element as the midpoint of the array
+		String mid = String.valueOf(array[(start + stop) / 2]);
+
+		// loop through the array until indices cross
+		while (left <= right) {
+			// find the first element that is smaller than the partition element from the left
+			while ((left < stop) && (String.valueOf(array[left]).compareTo(mid) < 0)) {
+				++left;
+			}
+			// find an element that is smaller than the partition element from the right
+			while ((right > start) && (mid.compareTo(String.valueOf(array[right])) < 0)) {
+				--right;
+			}
+			// if the indices have not crossed, swap
+			if (left <= right) {
+				temp = array[left];
+				array[left] = array[right];
+				array[right] = temp;
+				++left;
+				--right;
+			}
+		}
+		// sort the left partition, if the right index has not reached the left side of array
+		if (start < right) {
+			qSortByString(array, start, right);
+		}
+		// sort the right partition, if the left index has not reached the right side of array
+		if (left < stop) {
+			qSortByString(array, left, stop);
+		}
+	}
+
+	/**
+	 * Sorts the specified range in the array in ascending order.
+	 *
+	 * @param		array	the Object array to be sorted
+	 * @param		start	the start index to sort
+	 * @param		end		the last + 1 index to sort
+	 *
+	 * @exception	ClassCastException when an element in the array does not
+	 *				implement Comparable or elements cannot be compared to each other
+	 * @exception	IllegalArgumentException when <code>start > end</code>
+	 * @exception	ArrayIndexOutOfBoundsException when <code>start < 0</code>
+	 *				or <code>end > array.size()</code>
+	 */
+	@SuppressWarnings("unchecked")
+	public static void sort(Object[] array, int start, int end) {
+		int middle = (start + end) / 2;
+		if (start + 1 < middle)
+			sort(array, start, middle);
+		if (middle + 1 < end)
+			sort(array, middle, end);
+		if (start + 1 >= end)
+			return; // this case can only happen when this method is called by the user
+		if (((Comparable<Object>) array[middle - 1]).compareTo(array[middle]) <= 0)
+			return;
+		if (start + 2 == end) {
+			Object temp = array[start];
+			array[start] = array[middle];
+			array[middle] = temp;
+			return;
+		}
+		int i1 = start, i2 = middle, i3 = 0;
+		Object[] merge = new Object[end - start];
+		while (i1 < middle && i2 < end) {
+			merge[i3++] = ((Comparable<Object>) array[i1]).compareTo(array[i2]) <= 0 ? array[i1++] : array[i2++];
+		}
+		if (i1 < middle)
+			System.arraycopy(array, i1, merge, i3, middle - i1);
+		System.arraycopy(merge, 0, array, start, i2 - start);
+	}
+
+	/**
+	 * Sorts the specified range in the array in descending order.
+	 *
+	 * @param		array	the Object array to be sorted
+	 * @param		start	the start index to sort
+	 * @param		end		the last + 1 index to sort
+	 *
+	 * @exception	ClassCastException when an element in the array does not
+	 *				implement Comparable or elements cannot be compared to each other
+	 * @exception	IllegalArgumentException when <code>start > end</code>
+	 * @exception	ArrayIndexOutOfBoundsException when <code>start < 0</code>
+	 *				or <code>end > array.size()</code>
+	 */
+	public static void dsort(Object[] array, int start, int end) {
+		// first sort in ascending order
+		sort(array, start, end);
+		// then swap the elements in the array
+		swap(array);
+	}
+
+	/**
+	 *  Reverse the elements in the array.
+	 *  
+	 * @param		array	the Object array to be reversed
+	 */
+	public static void swap(Object[] array) {
+		int start = 0;
+		int end = array.length - 1;
+		while (start < end) {
+			Object temp = array[start];
+			array[start++] = array[end];
+			array[end--] = temp;
+		}
+	}
+
+	/**
+	 * Returns a string representation of the object
+	 * in the given length.
+	 * If the string representation of the given object
+	 * is longer then it is truncated.
+	 * If it is shorter then it is padded with the blanks
+	 * to the given total length.
+	 * If the given object is a number then the padding
+	 * is done on the left, otherwise on the right.
+	 *
+	 * @param	object	the object to convert
+	 * @param	length	the length the output string
+	 */
+	public static String toString(Object object, int length) {
+		boolean onLeft = object instanceof Number;
+		return toString(object, length, ' ', onLeft);
+	}
+
+	/**
+	 * Returns a string representation of the object
+	 * in the given length.
+	 * If the string representation of the given object
+	 * is longer then it is truncated.
+	 * If it is shorter then it is padded to the left or right
+	 * with the given character to the given total length.
+	 *
+	 * @param	object	the object to convert
+	 * @param	length	the length the output string
+	 * @param	pad		the pad character
+	 * @param	onLeft	if <code>true</code> pad on the left, otherwise an the right
+	 */
+	public static String toString(Object object, int length, char pad, boolean onLeft) {
+		String input = String.valueOf(object);
+		int size = input.length();
+		if (size >= length) {
+			int start = (onLeft) ? size - length : 0;
+			return input.substring(start, length);
+		}
+
+		StringBuffer padding = new StringBuffer(length - size);
+		for (int i = size; i < length; i++)
+			padding.append(pad);
+
+		StringBuffer stringBuffer = new StringBuffer(length);
+		if (onLeft)
+			stringBuffer.append(padding.toString());
+		stringBuffer.append(input);
+		if (!onLeft)
+			stringBuffer.append(padding.toString());
+		return stringBuffer.toString();
+	}
+}