You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by pa...@apache.org on 2007/09/16 21:50:45 UTC

svn commit: r576159 - in /felix/trunk/framework/src/main/java/org/apache/felix/moduleloader: IModuleFactory.java ModuleFactoryImpl.java ModuleListener.java

Author: pauls
Date: Sun Sep 16 12:50:44 2007
New Revision: 576159

URL: http://svn.apache.org/viewvc?rev=576159&view=rev
Log:
Add support to notify module listeners that the definition of a module has been modified - this is an experimental feature to make extension bundle exports work again (FELIX-30).

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IModuleFactory.java
    felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/ModuleFactoryImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/ModuleListener.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IModuleFactory.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IModuleFactory.java?rev=576159&r1=576158&r2=576159&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IModuleFactory.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IModuleFactory.java Sun Sep 16 12:50:44 2007
@@ -1,4 +1,4 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -32,4 +32,13 @@
     public void removeModuleListener(ModuleListener l);
 
     public void setSecurityContext(IModule module, Object securityContext);
+
+    /**
+     * This is an experimental method that is likely to change or go
+     * away - so don't use it for now.
+     *
+     * Note to self, we need to think about what the implications of
+     * this are and whether we are fine with them.
+     */
+    public void refreshModule(IModule currentModule);
 }

Modified: felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/ModuleFactoryImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/ModuleFactoryImpl.java?rev=576159&r1=576158&r2=576159&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/ModuleFactoryImpl.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/ModuleFactoryImpl.java Sun Sep 16 12:50:44 2007
@@ -1,4 +1,4 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -72,6 +72,28 @@
         return module;
     }
 
+    /**
+     * This is an experimental method that is likely to change or go
+     * away - so don't use it for now.
+     *
+     * Note to self, we need to think about what the implications of
+     * this are and whether we are fine with them.
+     */
+    public void refreshModule(IModule module)
+    {
+        boolean fire = false;
+
+        synchronized (this)
+        {
+            fire = (m_moduleMap.get(module.getId()) != null);
+        }
+
+        if (fire)
+        {
+            fireModuleRefreshed(module);
+        }
+    }
+
     public void removeModule(IModule module)
     {
         // Use a synchronized block instead of synchronizing the
@@ -267,6 +289,34 @@
                 event = new ModuleEvent(this, module);
             }
             listeners[i].moduleRemoved(event);
+        }
+    }
+
+    /**
+     * This is an experimental method that is likely to change or go
+     * away - so don't use it for now.
+     *
+     * Note to self, we need to think about what the implications of
+     * this are and whether we are fine with them.
+     */
+    protected void fireModuleRefreshed(IModule module)
+    {
+     // Event holder.
+        ModuleEvent event = null;
+
+        // Get a copy of the listener array, which is guaranteed
+        // to not be null.
+        ModuleListener[] listeners = m_listeners;
+
+        // Loop through listeners and fire events.
+        for (int i = 0; i < listeners.length; i++)
+        {
+            // Lazily create event.
+            if (event == null)
+            {
+                event = new ModuleEvent(this, module);
+            }
+            listeners[i].moduleRefreshed(event);
         }
     }
 }

Modified: felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/ModuleListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/ModuleListener.java?rev=576159&r1=576158&r2=576159&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/ModuleListener.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/ModuleListener.java Sun Sep 16 12:50:44 2007
@@ -1,4 +1,4 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -48,4 +48,13 @@
      * @param event the event object containing the event details.
     **/
     public void moduleRemoved(ModuleEvent event);
+
+    /**
+     * This is an experimental method that is likely to change or go
+     * away - so don't use it for now.
+     *
+     * Note to self, we need to think about what the implications of
+     * this are and whether we are fine with them.
+     */
+    public void moduleRefreshed(ModuleEvent event);
 }