[jboss-osgi-commits] JBoss-OSGI SVN: r90877 - in projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi: service and 1 other directories.

jboss-osgi-commits at lists.jboss.org jboss-osgi-commits at lists.jboss.org
Tue Jul 7 03:09:57 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-07-07 03:09:57 -0400 (Tue, 07 Jul 2009)
New Revision: 90877

Added:
   projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/
   projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleClassLoader.java
   projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleInfo.java
Removed:
   projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/BundleClassLoader.java
   projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/BundleInfo.java
Modified:
   projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/service/DeployerService.java
   projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/service/DeploymentScannerService.java
Log:
Move util classes to package util

Deleted: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/BundleClassLoader.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/BundleClassLoader.java	2009-07-07 06:58:20 UTC (rev 90876)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/BundleClassLoader.java	2009-07-07 07:09:57 UTC (rev 90877)
@@ -1,115 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.spi;
-
-// $Id: $
-
-import java.io.IOException;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.Dictionary;
-import java.util.Enumeration;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
-
-/**
- * A BundleClassLoader delegates all classloading concerns to the underlying Bundle.
- * 
- * @author Ales.Justin at jboss.org
- * @author thomas.Diesler at jboss.org
- * @since 03-Feb-2009
- */
-public class BundleClassLoader extends ClassLoader
-{
-   private final Bundle bundle;
-
-   public static BundleClassLoader createClassLoader(final Bundle bundle)
-   {
-      if (bundle == null)
-         throw new IllegalArgumentException("Null bundle");
-
-      return AccessController.doPrivileged(new PrivilegedAction<BundleClassLoader>()
-      {
-         public BundleClassLoader run()
-         {
-            return new BundleClassLoader(bundle);
-         }
-      });
-   }
-
-   private BundleClassLoader(Bundle bundle)
-   {
-      this.bundle = bundle;
-   }
-
-   protected Class<?> findClass(String name) throws ClassNotFoundException
-   {
-      return bundle.loadClass(name);
-   }
-
-   protected URL findResource(String name)
-   {
-      return bundle.getResource(name);
-   }
-
-   @SuppressWarnings("unchecked")
-   protected Enumeration<URL> findResources(String name) throws IOException
-   {
-      return bundle.getResources(name);
-   }
-
-   public URL getResource(String name)
-   {
-      return findResource(name);
-   }
-
-   public Class<?> loadClass(String name) throws ClassNotFoundException
-   {
-      return findClass(name);
-   }
-
-   public boolean equals(Object obj)
-   {
-      if (this == obj)
-         return true;
-
-      if (obj instanceof BundleClassLoader == false)
-         return false;
-
-      final BundleClassLoader bundleClassLoader = (BundleClassLoader)obj;
-      return bundle.equals(bundleClassLoader.bundle);
-   }
-
-   public int hashCode()
-   {
-      return bundle.hashCode();
-   }
-
-   public String toString()
-   {
-      Dictionary<?, ?> headers = bundle.getHeaders();
-      String bundleId = bundle.getSymbolicName() + ":" + headers.get(Constants.BUNDLE_VERSION);
-      return "BundleClassLoader for [" + bundleId + "]";
-   }
-}

Deleted: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/BundleInfo.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/BundleInfo.java	2009-07-07 06:58:20 UTC (rev 90876)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/BundleInfo.java	2009-07-07 07:09:57 UTC (rev 90877)
@@ -1,97 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.spi;
-
-//$Id$
-
-import java.net.URL;
-
-/**
- * An abstraction of a bundle
- * 
- * @author thomas.diesler at jboss.com
- * @since 27-May-2009
- */
-public class BundleInfo
-{
-   private URL location;
-   private String symbolicName;
-   private String version;
-
-   public BundleInfo(URL location, String symbolicName, String version)
-   {
-      this.symbolicName = symbolicName;
-      this.location = location;
-      this.version = (version != null ? version : "0.0.0");
-      
-      if (symbolicName == null)
-         throw new IllegalArgumentException("Symbolic name cannot be null");
-      if (location == null)
-         throw new IllegalArgumentException("Location cannot be null");
-   }
-
-   /**
-    * Get the bundle location
-    */
-   public URL getLocation()
-   {
-      return location;
-   }
-
-   /**
-    * Get the bundle symbolic name
-    */
-   public String getSymbolicName()
-   {
-      return symbolicName;
-   }
-
-   /**
-    * Get the bundle version
-    */
-   public String getVersion()
-   {
-      return version;
-   }
-
-   @Override
-   public boolean equals(Object obj)
-   {
-      if (!(obj instanceof BundleInfo))
-         return false;
-      
-      BundleInfo other = (BundleInfo)obj;
-      return symbolicName.equals(other.symbolicName) && version.equals(other.version);
-   }
-
-   @Override
-   public int hashCode()
-   {
-      return toString().hashCode();
-   }
-
-   @Override
-   public String toString()
-   {
-      return "[" + symbolicName + ":" + version + "]";
-   }
-}
\ No newline at end of file

Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/service/DeployerService.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/service/DeployerService.java	2009-07-07 06:58:20 UTC (rev 90876)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/service/DeployerService.java	2009-07-07 07:09:57 UTC (rev 90877)
@@ -25,8 +25,8 @@
 
 import javax.management.ObjectName;
 
-import org.jboss.osgi.spi.BundleInfo;
 import org.jboss.osgi.spi.management.ObjectNameFactory;
+import org.jboss.osgi.spi.util.BundleInfo;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleException;
 

Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/service/DeploymentScannerService.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/service/DeploymentScannerService.java	2009-07-07 06:58:20 UTC (rev 90876)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/service/DeploymentScannerService.java	2009-07-07 07:09:57 UTC (rev 90877)
@@ -25,7 +25,7 @@
 
 import java.net.URL;
 
-import org.jboss.osgi.spi.BundleInfo;
+import org.jboss.osgi.spi.util.BundleInfo;
 
 /**
  * A service that scans a directory location for new/removed bundles.

Copied: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleClassLoader.java (from rev 90875, projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/BundleClassLoader.java)
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleClassLoader.java	                        (rev 0)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleClassLoader.java	2009-07-07 07:09:57 UTC (rev 90877)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.util;
+
+// $Id: $
+
+import java.io.IOException;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Dictionary;
+import java.util.Enumeration;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+
+/**
+ * A BundleClassLoader delegates all classloading concerns to the underlying Bundle.
+ * 
+ * @author Ales.Justin at jboss.org
+ * @author thomas.Diesler at jboss.org
+ * @since 03-Feb-2009
+ */
+public class BundleClassLoader extends ClassLoader
+{
+   private final Bundle bundle;
+
+   public static BundleClassLoader createClassLoader(final Bundle bundle)
+   {
+      if (bundle == null)
+         throw new IllegalArgumentException("Null bundle");
+
+      return AccessController.doPrivileged(new PrivilegedAction<BundleClassLoader>()
+      {
+         public BundleClassLoader run()
+         {
+            return new BundleClassLoader(bundle);
+         }
+      });
+   }
+
+   private BundleClassLoader(Bundle bundle)
+   {
+      this.bundle = bundle;
+   }
+
+   protected Class<?> findClass(String name) throws ClassNotFoundException
+   {
+      return bundle.loadClass(name);
+   }
+
+   protected URL findResource(String name)
+   {
+      return bundle.getResource(name);
+   }
+
+   @SuppressWarnings("unchecked")
+   protected Enumeration<URL> findResources(String name) throws IOException
+   {
+      return bundle.getResources(name);
+   }
+
+   public URL getResource(String name)
+   {
+      return findResource(name);
+   }
+
+   public Class<?> loadClass(String name) throws ClassNotFoundException
+   {
+      return findClass(name);
+   }
+
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+
+      if (obj instanceof BundleClassLoader == false)
+         return false;
+
+      final BundleClassLoader bundleClassLoader = (BundleClassLoader)obj;
+      return bundle.equals(bundleClassLoader.bundle);
+   }
+
+   public int hashCode()
+   {
+      return bundle.hashCode();
+   }
+
+   public String toString()
+   {
+      Dictionary<?, ?> headers = bundle.getHeaders();
+      String bundleId = bundle.getSymbolicName() + ":" + headers.get(Constants.BUNDLE_VERSION);
+      return "BundleClassLoader for [" + bundleId + "]";
+   }
+}

Copied: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleInfo.java (from rev 90875, projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/BundleInfo.java)
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleInfo.java	                        (rev 0)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleInfo.java	2009-07-07 07:09:57 UTC (rev 90877)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.util;
+
+//$Id$
+
+import java.net.URL;
+
+/**
+ * An abstraction of a bundle
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 27-May-2009
+ */
+public class BundleInfo
+{
+   private URL location;
+   private String symbolicName;
+   private String version;
+
+   public BundleInfo(URL location, String symbolicName, String version)
+   {
+      this.symbolicName = symbolicName;
+      this.location = location;
+      this.version = (version != null ? version : "0.0.0");
+      
+      if (symbolicName == null)
+         throw new IllegalArgumentException("Symbolic name cannot be null");
+      if (location == null)
+         throw new IllegalArgumentException("Location cannot be null");
+   }
+
+   /**
+    * Get the bundle location
+    */
+   public URL getLocation()
+   {
+      return location;
+   }
+
+   /**
+    * Get the bundle symbolic name
+    */
+   public String getSymbolicName()
+   {
+      return symbolicName;
+   }
+
+   /**
+    * Get the bundle version
+    */
+   public String getVersion()
+   {
+      return version;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (!(obj instanceof BundleInfo))
+         return false;
+      
+      BundleInfo other = (BundleInfo)obj;
+      return symbolicName.equals(other.symbolicName) && version.equals(other.version);
+   }
+
+   @Override
+   public int hashCode()
+   {
+      return toString().hashCode();
+   }
+
+   @Override
+   public String toString()
+   {
+      return "[" + symbolicName + ":" + version + "]";
+   }
+}
\ No newline at end of file




More information about the jboss-osgi-commits mailing list