geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r951083 - /geronimo/server/trunk/framework/modules/geronimo-obr/src/main/java/org/apache/geronimo/obr/ResourceBuilder.java
Date Thu, 03 Jun 2010 17:37:14 GMT
Author: gawor
Date: Thu Jun  3 17:37:14 2010
New Revision: 951083

URL: http://svn.apache.org/viewvc?rev=951083&view=rev
Log:
generate requirement for Bundle-RequiredExecutionEnvironment header

Modified:
    geronimo/server/trunk/framework/modules/geronimo-obr/src/main/java/org/apache/geronimo/obr/ResourceBuilder.java

Modified: geronimo/server/trunk/framework/modules/geronimo-obr/src/main/java/org/apache/geronimo/obr/ResourceBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-obr/src/main/java/org/apache/geronimo/obr/ResourceBuilder.java?rev=951083&r1=951082&r2=951083&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-obr/src/main/java/org/apache/geronimo/obr/ResourceBuilder.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-obr/src/main/java/org/apache/geronimo/obr/ResourceBuilder.java
Thu Jun  3 17:37:14 2010
@@ -55,6 +55,9 @@ public class ResourceBuilder {
         // Convert Require-Bundle to requirements.
         convertRequireBundleToRequirement(resource);
         
+        // Convert Bundle-RequireExecutionEnvironment into requirements
+        convertRequireExecutionEnvironmentToRequirement(resource);
+        
         // Convert Fragment-Host to requirement/extend.
         convertFragmentHostToExtends(resource);
 
@@ -63,7 +66,7 @@ public class ResourceBuilder {
         
         // Convert Export-Package declarations into capabilities.
         convertExportPackageToCapability(resource);
-        
+             
         return resource;
     }
     
@@ -121,6 +124,31 @@ public class ResourceBuilder {
         }
     }
     
+    private void convertRequireExecutionEnvironmentToRequirement(Resource resource) {
+        String requiredEnvironments = getProperty(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT);
+        if (requiredEnvironments != null) {
+            String[] envs = requiredEnvironments.split(",");
+            if (envs.length > 0) {
+                StringBuffer sb = new StringBuffer();
+                sb.append("(|");
+                for (String env : envs) {
+                    sb.append("(ee=");
+                    sb.append(env);
+                    sb.append(")");
+                }                
+                sb.append(")");
+                
+                Require require = new Require();
+                require.setName("ee");
+                require.setContent("Execution Environment " + sb);
+                require.setFilter(sb.toString());
+                
+                resource.getRequire().add(require);
+            }
+                        
+        }
+    }
+    
     private void convertFragmentHostToExtends(Resource resource) {
         BundleDescription.FragmentHost fragment = bundleDescription.getFragmentHost();
         if (fragment != null) {



Mime
View raw message