felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r374402 - in /incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix: framework/ framework/searchpolicy/ moduleloader/
Date Thu, 02 Feb 2006 14:52:42 GMT
Author: rickhall
Date: Thu Feb  2 06:52:36 2006
New Revision: 374402

URL: http://svn.apache.org/viewcvs?rev=374402&view=rev
Log:
Added open()/close() methods to the IContentLoader interface so that we
could clean up opening/closing IContent objects in the IModuleFactory
implementation.

Modified:
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/Felix.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/SystemBundleContentLoader.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/ContentLoaderImpl.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/IContentLoader.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/ModuleFactoryImpl.java
    incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/ModuleImpl.java

Modified: incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/Felix.java
URL: http://svn.apache.org/viewcvs/incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/Felix.java?rev=374402&r1=374401&r2=374402&view=diff
==============================================================================
--- incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/Felix.java
(original)
+++ incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/Felix.java
Thu Feb  2 06:52:36 2006
@@ -3102,16 +3102,6 @@
             for (int i = 0; i < modules.length; i++)
             {
                 m_factory.removeModule(modules[i]);
-// TODO: FIX - DETERMINE IF CLOSING SHOULD BE PART OF MODULE FACTORY.
-                // Close module content for disposal.
-                modules[i].getContentLoader().getContent().close();
-                // Close module class path content for disposal.
-                IContent[] classPath =
-                    ((ContentLoaderImpl) modules[i].getContentLoader()).getClassPath();
-                for (int pathIdx = 0; pathIdx < classPath.length; pathIdx++)
-                {
-                    classPath[pathIdx].close();
-                }
             }
 
             // Purge all bundle revisions, but the current one.
@@ -3136,16 +3126,6 @@
         for (int i = 0; i < modules.length; i++)
         {
             m_factory.removeModule(modules[i]);
-// TODO: FIX - DETERMINE IF CLOSING SHOULD BE PART OF MODULE FACTORY.
-            // Close module content for disposal.
-            modules[i].getContentLoader().getContent().close();
-            // Close module class path content for disposal.
-            IContent[] classPath =
-                ((ContentLoaderImpl) modules[i].getContentLoader()).getClassPath();
-            for (int pathIdx = 0; pathIdx < classPath.length; pathIdx++)
-            {
-                classPath[pathIdx].close();
-            }
         }
 
         // Remove the bundle from the cache.

Modified: incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/SystemBundleContentLoader.java
URL: http://svn.apache.org/viewcvs/incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/SystemBundleContentLoader.java?rev=374402&r1=374401&r2=374402&view=diff
==============================================================================
--- incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/SystemBundleContentLoader.java
(original)
+++ incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/SystemBundleContentLoader.java
Thu Feb  2 06:52:36 2006
@@ -33,6 +33,16 @@
         m_logger = logger;
     }
 
+    public void open()
+    {
+        // Nothing needed here.
+    }
+
+    public void close()
+    {
+        // Nothing needed here.
+    }
+
     public IContent getContent()
     {
         return null;

Modified: incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/ContentLoaderImpl.java
URL: http://svn.apache.org/viewcvs/incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/ContentLoaderImpl.java?rev=374402&r1=374401&r2=374402&view=diff
==============================================================================
--- incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/ContentLoaderImpl.java
(original)
+++ incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/ContentLoaderImpl.java
Thu Feb  2 06:52:36 2006
@@ -36,20 +36,29 @@
     {
         m_logger = logger;
         m_content = content;
-// TODO: FIX - SINCE WE CLOSE IN FELIX.JAVA, MAYBE WE SHOULD OPEN THERE TOO.
+    }
+
+    public Logger getLogger()
+    {
+        return m_logger;
+    }
+
+    public void open()
+    {
         m_content.open();
-        m_contentPath = (contentPath == null) ? new IContent[0] : contentPath;
-        for (int i = 0; i < m_contentPath.length; i++)
+        for (int i = 0; (m_contentPath != null) && (i < m_contentPath.length);
i++)
         {
-// TODO: FIX - SINCE WE CLOSE IN FELIX.JAVA, MAYBE WE SHOULD OPEN THERE TOO.
-            // Open all class path contents.
             m_contentPath[i].open();
         }
     }
 
-    public Logger getLogger()
+    public void close()
     {
-        return m_logger;
+        m_content.close();
+        for (int i = 0; (m_contentPath != null) && (i < m_contentPath.length);
i++)
+        {
+            m_contentPath[i].close();
+        }
     }
 
     public IContent getContent()

Modified: incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/IContentLoader.java
URL: http://svn.apache.org/viewcvs/incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/IContentLoader.java?rev=374402&r1=374401&r2=374402&view=diff
==============================================================================
--- incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/IContentLoader.java
(original)
+++ incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/IContentLoader.java
Thu Feb  2 06:52:36 2006
@@ -22,6 +22,9 @@
 
 public interface IContentLoader
 {
+    public void open();
+    public void close();
+
     public IContent getContent();
 
     public void setSearchPolicy(ISearchPolicy searchPolicy);

Modified: incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/ModuleFactoryImpl.java
URL: http://svn.apache.org/viewcvs/incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/ModuleFactoryImpl.java?rev=374402&r1=374401&r2=374402&view=diff
==============================================================================
--- incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/ModuleFactoryImpl.java
(original)
+++ incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/ModuleFactoryImpl.java
Thu Feb  2 06:52:36 2006
@@ -80,6 +80,11 @@
             {
                 // Remove from data structures.
                 m_moduleMap.remove(module.getId());
+                // Close the module's content loader to deinitialize it.
+                // TODO: This is not really the best place for this, but at
+                // least it is centralized with the call to IContentLoader.open()
+                // when a module's content loader is set below.
+                ((ModuleImpl) module).getContentLoader().close();
             }
             else
             {
@@ -97,6 +102,11 @@
         synchronized (this)
         {
             ((ModuleImpl) module).setContentLoader(contentLoader);
+            // Open the module's content loader to initialize it.
+            // TODO: This is not really the best place for this, but at
+            // least it is centralized with the call to IContentLoader.close()
+            // when the module is removed above.
+            contentLoader.open();
         }
     }
 

Modified: incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/ModuleImpl.java
URL: http://svn.apache.org/viewcvs/incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/ModuleImpl.java?rev=374402&r1=374401&r2=374402&view=diff
==============================================================================
--- incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/ModuleImpl.java
(original)
+++ incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/ModuleImpl.java
Thu Feb  2 06:52:36 2006
@@ -22,17 +22,6 @@
 
 public class ModuleImpl implements IModule
 {
-    /**
-     * This is the index used to retrieve the key of an attribute;
-     * an attribute is represented as an <tt>Object[]</tt> instance.
-    **/
-    public static final int KEY_IDX = 0;
-    /**
-     * This is the index used to retrieve the value of an attribute;
-     * an attribute is represented as an <tt>Object[]</tt> instance.
-    **/
-    public static final int VALUE_IDX = 1;
-
     private Logger m_logger = null;
     private String m_id = null;
     private IContentLoader m_contentLoader = null;



Mime
View raw message