User FrameworkUtil.getBundle vs. PackageAdmin.
diff --git a/core/src/main/java/org/eclipse/gemini/blueprint/context/support/OsgiBundleXmlApplicationContext.java b/core/src/main/java/org/eclipse/gemini/blueprint/context/support/OsgiBundleXmlApplicationContext.java
index 9a1767c..2316352 100644
--- a/core/src/main/java/org/eclipse/gemini/blueprint/context/support/OsgiBundleXmlApplicationContext.java
+++ b/core/src/main/java/org/eclipse/gemini/blueprint/context/support/OsgiBundleXmlApplicationContext.java
@@ -1,37 +1,37 @@
-/******************************************************************************

- * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

- * All rights reserved. This program and the accompanying materials

- * are made available under the terms of the Eclipse Public License v1.0

- * and Apache License v2.0 which accompanies this distribution. 

- * The Eclipse Public License is available at 

- * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

- * is available at http://www.opensource.org/licenses/apache2.0.php.

- * You may elect to redistribute this code under either of these licenses. 

- * 

- * Contributors:

- *   VMware Inc.

- *   Oracle Inc.

- *****************************************************************************/

-

+/******************************************************************************
+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Apache License v2.0 which accompanies this distribution. 
+ * The Eclipse Public License is available at 
+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0
+ * is available at http://www.opensource.org/licenses/apache2.0.php.
+ * You may elect to redistribute this code under either of these licenses. 
+ * 
+ * Contributors:
+ *   VMware Inc.
+ *   Oracle Inc.
+ *****************************************************************************/
+
 package org.eclipse.gemini.blueprint.context.support;
 
-import java.io.IOException;

-import java.security.AccessController;

-import java.security.PrivilegedAction;

-

-import org.eclipse.gemini.blueprint.io.OsgiBundleResource;

-import org.eclipse.gemini.blueprint.util.OsgiStringUtils;

-import org.eclipse.gemini.blueprint.util.internal.BundleUtils;

-import org.osgi.framework.BundleContext;

-import org.springframework.beans.BeansException;

-import org.springframework.beans.factory.support.DefaultListableBeanFactory;

-import org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver;

-import org.springframework.beans.factory.xml.DelegatingEntityResolver;

-import org.springframework.beans.factory.xml.NamespaceHandlerResolver;

-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;

-import org.springframework.context.ApplicationContext;

-import org.springframework.util.Assert;

-import org.xml.sax.EntityResolver;

+import java.io.IOException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import org.eclipse.gemini.blueprint.io.OsgiBundleResource;
+import org.eclipse.gemini.blueprint.util.OsgiStringUtils;
+import org.eclipse.gemini.blueprint.util.internal.BundleUtils;
+import org.osgi.framework.BundleContext;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver;
+import org.springframework.beans.factory.xml.DelegatingEntityResolver;
+import org.springframework.beans.factory.xml.NamespaceHandlerResolver;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
+import org.springframework.context.ApplicationContext;
+import org.springframework.util.Assert;
+import org.xml.sax.EntityResolver;
 
 /**
  * Stand-alone XML application context, backed by an OSGi bundle.
@@ -237,7 +237,7 @@
 	}
 
 	/**
-	 * Similar to {@link #createNamespaceHandlerResolver(BundleContext, ClassLoader, ClassLoader)} , this method creates
+	 * Similar to {@link #createNamespaceHandlerResolver(BundleContext, String, ClassLoader)} , this method creates
 	 * a special OSGi entity resolver that considers the bundle class path first, falling back to the entity resolver
 	 * service provided by the Spring DM extender.
 	 * 
diff --git a/core/src/main/java/org/eclipse/gemini/blueprint/util/internal/BundleUtils.java b/core/src/main/java/org/eclipse/gemini/blueprint/util/internal/BundleUtils.java
index 7c29ec1..5b18816 100644
--- a/core/src/main/java/org/eclipse/gemini/blueprint/util/internal/BundleUtils.java
+++ b/core/src/main/java/org/eclipse/gemini/blueprint/util/internal/BundleUtils.java
@@ -16,8 +16,7 @@
 

 import org.osgi.framework.Bundle;

 import org.osgi.framework.BundleContext;

-import org.osgi.framework.ServiceReference;

-import org.osgi.service.packageadmin.PackageAdmin;

+import org.osgi.framework.FrameworkUtil;

 

 /**

  * Internal utility used for internal purposes.

@@ -28,19 +27,9 @@
 	public static final String DM_CORE_ID = "spring.osgi.core.bundle.id";

 	public static final String DM_CORE_TS = "spring.osgi.core.bundle.timestamp";

 

-	public static Bundle getDMCoreBundle(BundleContext ctx) {

-		ServiceReference ref = ctx.getServiceReference(PackageAdmin.class.getName());

-		if (ref != null) {

-			Object service = ctx.getService(ref);

-			if (service instanceof PackageAdmin) {

-				PackageAdmin pa = (PackageAdmin) service;

-				if (pa != null) {

-					return pa.getBundle(BundleUtils.class);

-				}

-			}

-		}

-		return null;

-	}

+    public static Bundle getDMCoreBundle(BundleContext ctx) {

+        return FrameworkUtil.getBundle(BundleUtils.class);

+    }

 

 	public static String createNamespaceFilter(BundleContext ctx) {

 		Bundle bnd = getDMCoreBundle(ctx);

diff --git a/core/template.mf b/core/template.mf
index ceaa19c..50d1675 100644
--- a/core/template.mf
+++ b/core/template.mf
@@ -13,7 +13,6 @@
  org.osgi.service.blueprint;version="1.0.0",

  org.aopalliance.*;version="0.0.0",

  org.osgi.service.cm;version=1.2;resolution:=optional,

- org.osgi.service.packageadmin;version=1.2,

  org.osgi.service.startlevel;version=1.0;resolution:=optional,

  org.apache.commons.logging.*;version=${logging.version.range},

  org.eclipse.gemini.blueprint.*;version=${gemini.blueprint.version.range},

diff --git a/extender/src/main/java/org/eclipse/gemini/blueprint/extender/internal/util/BundleUtils.java b/extender/src/main/java/org/eclipse/gemini/blueprint/extender/internal/util/BundleUtils.java
index 9b3cbb1..bb8d9d2 100644
--- a/extender/src/main/java/org/eclipse/gemini/blueprint/extender/internal/util/BundleUtils.java
+++ b/extender/src/main/java/org/eclipse/gemini/blueprint/extender/internal/util/BundleUtils.java
@@ -7,7 +7,7 @@
  * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

  * is available at http://www.opensource.org/licenses/apache2.0.php.

  * You may elect to redistribute this code under either of these licenses. 

- * 

+ *

  * Contributors:

  *   VMware Inc.

  *****************************************************************************/

@@ -16,39 +16,28 @@
 

 import org.osgi.framework.Bundle;

 import org.osgi.framework.BundleContext;

-import org.osgi.framework.ServiceReference;

-import org.osgi.service.packageadmin.PackageAdmin;

+import org.osgi.framework.FrameworkUtil;

 import org.eclipse.gemini.blueprint.context.support.OsgiBundleXmlApplicationContext;

 

 /**

  * Internal utility used for internal purposes.

- * 

+ *

  * @author Costin Leau

  */

 public abstract class BundleUtils {

-	public static final String DM_CORE_ID = "spring.osgi.core.bundle.id";

-	public static final String DM_CORE_TS = "spring.osgi.core.bundle.timestamp";

+    public static final String DM_CORE_ID = "spring.osgi.core.bundle.id";

+    public static final String DM_CORE_TS = "spring.osgi.core.bundle.timestamp";

 

-	public static Bundle getDMCoreBundle(BundleContext ctx) {

-		ServiceReference ref = ctx.getServiceReference(PackageAdmin.class.getName());

-		if (ref != null) {

-			Object service = ctx.getService(ref);

-			if (service instanceof PackageAdmin) {

-				PackageAdmin pa = (PackageAdmin) service;

-				if (pa != null) {

-					return pa.getBundle(OsgiBundleXmlApplicationContext.class);

-				}

-			}

-		}

-		return null;

-	}

+    public static Bundle getDMCoreBundle(BundleContext ctx) {

+        return FrameworkUtil.getBundle(OsgiBundleXmlApplicationContext.class);

+    }

 

-	public static String createNamespaceFilter(BundleContext ctx) {

-		Bundle bnd = getDMCoreBundle(ctx);

-		if (bnd != null) {

-			return "(|(" + DM_CORE_ID + "=" + bnd.getBundleId() + ")(" + DM_CORE_TS + "=" + bnd.getLastModified()

-					+ "))";

-		}

-		return "";

-	}

+    public static String createNamespaceFilter(BundleContext ctx) {

+        Bundle bnd = getDMCoreBundle(ctx);

+        if (bnd != null) {

+            return "(|(" + DM_CORE_ID + "=" + bnd.getBundleId() + ")(" + DM_CORE_TS + "=" + bnd.getLastModified()

+                    + "))";

+        }

+        return "";

+    }

 }

diff --git a/extender/template.mf b/extender/template.mf
index 5b1eb78..24aa388 100644
--- a/extender/template.mf
+++ b/extender/template.mf
@@ -2,7 +2,6 @@
  *.internal*

 Import-Package: 

  org.eclipse.gemini.blueprint.extensions.annotation;resolution:=optional;version="${gemini.blueprint.version.range.nq}",

- org.osgi.service.packageadmin;version=1.2,

  org.osgi.service.blueprint.container;version="1.0.0";resolution:=optional,

  org.osgi.service.blueprint.reflect;version="1.0.0";resolution:=optional

 Import-Template: 

diff --git a/io/src/main/java/org/eclipse/gemini/blueprint/io/OsgiBundleResourcePatternResolver.java b/io/src/main/java/org/eclipse/gemini/blueprint/io/OsgiBundleResourcePatternResolver.java
index 6c1acc1..2cca736 100644
--- a/io/src/main/java/org/eclipse/gemini/blueprint/io/OsgiBundleResourcePatternResolver.java
+++ b/io/src/main/java/org/eclipse/gemini/blueprint/io/OsgiBundleResourcePatternResolver.java
@@ -84,7 +84,8 @@
  * @see PathMatchingResourcePatternResolver

  * 

  * @author Costin Leau

- * 

+ *

+ * TODO: Rework to use WIRE Admin

  */

 public class OsgiBundleResourcePatternResolver extends PathMatchingResourcePatternResolver {

 

diff --git a/io/src/main/java/org/eclipse/gemini/blueprint/io/internal/resolver/DependencyResolver.java b/io/src/main/java/org/eclipse/gemini/blueprint/io/internal/resolver/DependencyResolver.java
index 0b76294..61f8988 100644
--- a/io/src/main/java/org/eclipse/gemini/blueprint/io/internal/resolver/DependencyResolver.java
+++ b/io/src/main/java/org/eclipse/gemini/blueprint/io/internal/resolver/DependencyResolver.java
@@ -19,11 +19,12 @@
 

 /**

  * Simple interface offering utility methods for OSGi dependencies, mainly

- * 

  * bundles. This class suplements the {@link PackageAdmin} service by offering

  * information on importing, not just exporting.

  * 

  * @author Costin Leau

+ *

+ * TODO: Rework to remove reference to PackageAdmin

  */

 public interface DependencyResolver {

 

diff --git a/io/src/main/java/org/eclipse/gemini/blueprint/io/internal/resolver/PackageAdminResolver.java b/io/src/main/java/org/eclipse/gemini/blueprint/io/internal/resolver/PackageAdminResolver.java
index 5c7b2d8..267c9ad 100644
--- a/io/src/main/java/org/eclipse/gemini/blueprint/io/internal/resolver/PackageAdminResolver.java
+++ b/io/src/main/java/org/eclipse/gemini/blueprint/io/internal/resolver/PackageAdminResolver.java
@@ -47,6 +47,7 @@
  * @author Costin Leau

  * 

  */

+//TODO: rework to use WIRE Admin

 public class PackageAdminResolver implements DependencyResolver {

 

 	/** logger */

diff --git a/mock/template.mf b/mock/template.mf
index 88a4912..20a99e3 100644
--- a/mock/template.mf
+++ b/mock/template.mf
@@ -2,7 +2,6 @@
  org.springframework.osgi.*.internal.*

 Import-Template: 

  org.osgi.framework;version=1.3,

- org.osgi.service.packageadmin;version=1.2,

  org.springframework.*;version=${spring.version.range},

  org.apache.commons.logging.*;version=${logging.version.range},

  *;resolution:=optional

diff --git a/pom.xml b/pom.xml
index 083b87f..9820e2a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -577,8 +577,8 @@
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
                 <configuration>
-                    <source>1.6</source>
-                    <target>1.6</target>
+                    <source>1.7</source>
+                    <target>1.7</target>
                     <debug>true</debug>
                     <fork>true</fork>
                 </configuration>
@@ -715,7 +715,7 @@
                                 <quiet>true</quiet>
                                 <verbose>false</verbose>
                                 <show>protected</show>
-                                <source>1.6</source>
+                                <source>1.7</source>
                                 <links>
                                     <link>http://download.oracle.com/javase/6/docs/api/</link>
                                     <link>http://static.springsource.org/spring/docs/3.0.x/javadoc-api/</link>
diff --git a/test-support/template.mf b/test-support/template.mf
index b247af8..391d025 100644
--- a/test-support/template.mf
+++ b/test-support/template.mf
@@ -3,7 +3,6 @@
 Import-Template: 

  org.osgi.framework;version=1.3,

  org.osgi.service.cm;version=1.2;resolution:=optional,

- org.osgi.service.packageadmin;version=1.2,

  org.apache.commons.logging.*;version=${logging.version.range},

  org.eclipse.gemini.blueprint.*;version=${gemini.blueprint.version.range},

  org.springframework.*;version=${spring.version.range},