felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r548377 - in /felix/trunk/framework/src/main/java/org/apache/felix/framework: BundleContextImpl.java Felix.java ext/FelixBundleContext.java searchpolicy/ModuleDefinition.java
Date Mon, 18 Jun 2007 15:14:46 GMT
Author: rickhall
Date: Mon Jun 18 08:14:44 2007
New Revision: 548377

URL: http://svn.apache.org/viewvc?view=rev&rev=548377
Log:
Implementing an experimental feature to help with dynamic code generation.

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/ext/FelixBundleContext.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/ModuleDefinition.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java?view=diff&rev=548377&r1=548376&r2=548377
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java
Mon Jun 18 08:14:44 2007
@@ -20,9 +20,7 @@
 
 import java.io.File;
 import java.io.InputStream;
-import java.util.ArrayList;
 import java.util.Dictionary;
-import java.util.List;
 
 import org.apache.felix.framework.ext.FelixBundleContext;
 import org.osgi.framework.*;
@@ -44,22 +42,24 @@
         m_valid = false;
     }
 
-    public void addImportPackage() throws BundleException
+    public void addRequirement(String s) throws BundleException
     {
-        throw new BundleException("Not implemented yet.");
+        // TODO: EXPERIMENTAL - Experimental implicit wire concept to try
+        //       to deal with code generation.
+        m_felix.addRequirement(m_bundle, s);
     }
 
-    public void removeImportPackage() throws BundleException
+    public void removeRequirement() throws BundleException
     {
         throw new BundleException("Not implemented yet.");
     }
 
-    public void addExportPackage() throws BundleException
+    public void addCapability() throws BundleException
     {
         throw new BundleException("Not implemented yet.");
     }
 
-    public void removeExportPackage() throws BundleException
+    public void removeCapability() throws BundleException
     {
         throw new BundleException("Not implemented yet.");
     }

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java?view=diff&rev=548377&r1=548376&r2=548377
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java Mon Jun 18 08:14:44
2007
@@ -1865,6 +1865,31 @@
     // Implementation of BundleContext interface methods.
     //
 
+    protected void addRequirement(BundleImpl bundle, String s) throws BundleException
+    {
+        // TODO: EXPERIMENTAL - Experimental implicit wire concept to try
+        //       to deal with code generation.
+        synchronized (m_factory)
+        {
+            IRequirement[] reqs = ManifestParser.parseImportHeader(s);
+            IRequirement[] dynamics = bundle.getInfo().getCurrentModule()
+                .getDefinition().getDynamicRequirements();
+            if (dynamics == null)
+            {
+                dynamics = reqs;
+            }
+            else
+            {
+                IRequirement[] tmp = new IRequirement[dynamics.length + reqs.length];
+                System.arraycopy(dynamics, 0, tmp, 0, dynamics.length);
+                System.arraycopy(reqs, 0, tmp, dynamics.length, reqs.length);
+                dynamics = tmp;
+            }
+            ((ModuleDefinition) bundle.getInfo().getCurrentModule().getDefinition())
+                .setDynamicRequirements(dynamics);
+        }
+    }
+
     /**
      * Implementation for BundleContext.getProperty(). Returns
      * environment property associated with the framework.

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/ext/FelixBundleContext.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/ext/FelixBundleContext.java?view=diff&rev=548377&r1=548376&r2=548377
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/ext/FelixBundleContext.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/ext/FelixBundleContext.java
Mon Jun 18 08:14:44 2007
@@ -23,8 +23,8 @@
 
 public interface FelixBundleContext extends BundleContext
 {
-    public void addImportPackage() throws BundleException;
-    public void removeImportPackage() throws BundleException;
-    public void addExportPackage() throws BundleException;
-    public void removeExportPackage() throws BundleException;
+    public void addRequirement(String s) throws BundleException;
+    public void removeRequirement() throws BundleException;
+    public void addCapability() throws BundleException;
+    public void removeCapability() throws BundleException;
 }

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/ModuleDefinition.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/ModuleDefinition.java?view=diff&rev=548377&r1=548376&r2=548377
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/ModuleDefinition.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/ModuleDefinition.java
Mon Jun 18 08:14:44 2007
@@ -54,6 +54,13 @@
         return m_dynamicRequirements;
     }
 
+    // TODO: EXPERIMENTAL - Experimental implicit wire concept to try
+    //       to deal with code generation.
+    public void setDynamicRequirements(IRequirement[] reqs)
+    {
+        m_dynamicRequirements = reqs;
+    }
+
     public R4Library[] getLibraries()
     {
         return m_libraries;



Mime
View raw message