[jboss-cvs] JBossAS SVN: r62080 - in projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi: plugins/facade and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Apr 4 12:24:17 EDT 2007


Author: alesj
Date: 2007-04-04 12:24:17 -0400 (Wed, 04 Apr 2007)
New Revision: 62080

Added:
   projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/registry/
   projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/registry/BasicServiceRegistry.java
   projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/registry/ServiceRegistry.java
   projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/dependency/
   projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/dependency/ServiceControllerContext.java
Modified:
   projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/dependency/OSGiServiceReferenceContext.java
   projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/ServiceMetaDataVisitor.java
Log:
ServiceRegistry intro, spi/plugin cleanup.

Modified: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/dependency/OSGiServiceReferenceContext.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/dependency/OSGiServiceReferenceContext.java	2007-04-04 15:18:38 UTC (rev 62079)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/dependency/OSGiServiceReferenceContext.java	2007-04-04 16:24:17 UTC (rev 62080)
@@ -29,7 +29,7 @@
 import org.jboss.dependency.spi.Controller;
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.dependency.spi.DependencyItem;
-import org.jboss.dependency.spi.dispatch.InvokeDispatchContext;
+import org.jboss.osgi.spi.dependency.ServiceControllerContext;
 import org.jboss.osgi.spi.metadata.ServiceMetaData;
 import org.jboss.osgi.spi.metadata.ServiceMetaDataVisitor;
 import org.jboss.osgi.spi.metadata.ServiceMetaDataVisitorNode;
@@ -40,7 +40,7 @@
  *
  * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
  */
-public class OSGiServiceReferenceContext extends AbstractControllerContext implements InvokeDispatchContext
+public class OSGiServiceReferenceContext extends AbstractControllerContext implements ServiceControllerContext
 {
    /** The meta data */
    private ServiceMetaData serviceMetaData;
@@ -73,11 +73,6 @@
       return null; // todo get Bundle CL
    }
 
-   /**
-    * Get the serviceMetaData.
-    *
-    * @return the serviceMetaData.
-    */
    public ServiceMetaData getServiceMetaData()
    {
       return serviceMetaData;
@@ -93,11 +88,6 @@
       this.serviceMetaData = serviceMetaData;
    }
 
-   /**
-    * Get Bundle Context
-    *
-    * @return the bundle context
-    */
    public BundleContext getBundleContext()
    {
       return bundleContext;
@@ -182,7 +172,7 @@
          }
       }
 
-      public OSGiServiceReferenceContext getControllerContext()
+      public ServiceControllerContext getControllerContext()
       {
          return OSGiServiceReferenceContext.this;
       }

Added: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/registry/BasicServiceRegistry.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/registry/BasicServiceRegistry.java	                        (rev 0)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/registry/BasicServiceRegistry.java	2007-04-04 16:24:17 UTC (rev 62080)
@@ -0,0 +1,68 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.plugins.facade.registry;
+
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+/**
+ * Basic Service registry
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class BasicServiceRegistry implements ServiceRegistry
+{
+   /** The lock */
+   private ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
+
+   /**
+    * Lock for read
+    */
+   protected void lockRead()
+   {
+      lock.readLock().lock();
+   }
+
+   /**
+    * Unlock for read
+    */
+   protected void unlockRead()
+   {
+      lock.readLock().unlock();
+   }
+
+   /**
+    * Lock for write
+    */
+   protected void lockWrite()
+   {
+      lock.writeLock().lock();
+   }
+
+   /**
+    * Unlock for write
+    */
+   protected void unlockWrite()
+   {
+      lock.writeLock().unlock();
+   }
+
+}

Added: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/registry/ServiceRegistry.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/registry/ServiceRegistry.java	                        (rev 0)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/registry/ServiceRegistry.java	2007-04-04 16:24:17 UTC (rev 62080)
@@ -0,0 +1,31 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.plugins.facade.registry;
+
+/**
+ * Central place for handling ServiceReferences + Bundles.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface ServiceRegistry
+{
+}

Added: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/dependency/ServiceControllerContext.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/dependency/ServiceControllerContext.java	                        (rev 0)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/dependency/ServiceControllerContext.java	2007-04-04 16:24:17 UTC (rev 62080)
@@ -0,0 +1,49 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.dependency;
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.dispatch.InvokeDispatchContext;
+import org.jboss.osgi.spi.metadata.ServiceMetaData;
+import org.osgi.framework.BundleContext;
+
+/**
+ * Information about Bundle[Context] and ServiceMetaData.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface ServiceControllerContext extends ControllerContext, InvokeDispatchContext
+{
+   /**
+    * Get the metadata
+    *
+    * @return the service metadata
+    */
+   ServiceMetaData getServiceMetaData();
+
+   /**
+    * Get the BundleContext
+    *
+    * @return underlying bundle context
+    */
+   BundleContext getBundleContext();
+}

Modified: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/ServiceMetaDataVisitor.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/ServiceMetaDataVisitor.java	2007-04-04 15:18:38 UTC (rev 62079)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/spi/metadata/ServiceMetaDataVisitor.java	2007-04-04 16:24:17 UTC (rev 62080)
@@ -23,7 +23,7 @@
 
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.dependency.spi.DependencyItem;
-import org.jboss.osgi.plugins.dependency.OSGiServiceReferenceContext;
+import org.jboss.osgi.spi.dependency.ServiceControllerContext;
 
 /**
  * ServiceMetaDataVisitor.
@@ -37,7 +37,7 @@
     * 
     * @return the context
     */
-   OSGiServiceReferenceContext getControllerContext();
+   ServiceControllerContext getControllerContext();
 
    /**
     * Get the context state




More information about the jboss-cvs-commits mailing list