geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1040252 - in /geronimo/server/trunk/framework/modules: geronimo-deployment/src/main/java/org/apache/geronimo/deployment/ geronimo-kernel/src/main/java/org/apache/geronimo/gbean/ geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repo...
Date Mon, 29 Nov 2010 19:50:19 GMT
Author: gawor
Date: Mon Nov 29 19:50:18 2010
New Revision: 1040252

URL: http://svn.apache.org/viewvc?rev=1040252&view=rev
Log:
refactor code a bit: inject dynamic-import-header in DeploymentContext instead of Environment
and generate slightly better import-package headers

Modified:
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GOperationInfo.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Environment.java

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java?rev=1040252&r1=1040251&r2=1040252&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java
Mon Nov 29 19:50:18 2010
@@ -48,6 +48,7 @@ import org.apache.geronimo.gbean.Abstrac
 import org.apache.geronimo.gbean.GAttributeInfo;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GOperationInfo;
 import org.apache.geronimo.gbean.GReferenceInfo;
 import org.apache.geronimo.gbean.ReferencePatterns;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
@@ -235,7 +236,8 @@ public class DeploymentContext {
         env.setConfigId(new Artifact(id.getGroupId(), id.getArtifactId() + "-DEPLOYMENT",
id.getVersion(), id.getType()));
         env.addToBundleClassPath(bundleClassPath);
         env.setBundleActivator(null);
-
+        env.addDynamicImportPackage("*");
+        
         Manifest manifest;
         try {
             manifest = env.getManifest();
@@ -534,16 +536,20 @@ public class DeploymentContext {
             throw new DeploymentException(message.toString());
         }
 
-        List<GBeanData> gbeans = new ArrayList<GBeanData>(configuration.getGBeans().values());
-        Collections.sort(gbeans, new GBeanData.PriorityComparator());
         // TODO OSGI figure out exports
-        environment.addImportPackages(getImports(gbeans));
         environment.addToBundleClassPath(bundleClassPath);
-        //TODO OSGI leave out if we use a extender mechanism
+        // TODO OSGI leave out if we use a extender mechanism
         if (environment.getBundleActivator() == null) {
             environment.setBundleActivator(ConfigurationActivator.class.getName());
         }
+        List<GBeanData> gbeans = new ArrayList<GBeanData>(configuration.getGBeans().values());
+        Collections.sort(gbeans, new GBeanData.PriorityComparator());        
+        LinkedHashSet<String> imports = getImports(gbeans);
+        addImport(imports, environment.getBundleActivator());
+        environment.addImportPackages(imports);
 
+        environment.addDynamicImportPackage("*");
+        
         if (tempBundle != null) {
             try {
                 createPluginMetadata();
@@ -579,6 +585,12 @@ public class DeploymentContext {
             for (GReferenceInfo refInfo: info.getReferences()) {
                 addImport(imports, refInfo.getReferenceType());
             }
+            for (GOperationInfo opInfo: info.getOperations()) {
+                addImport(imports, opInfo.getReturnType());
+                for (String paramType : opInfo.getParameterList()) {
+                    addImport(imports, paramType);
+                }
+            }
         }
         return imports;
     }

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GOperationInfo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GOperationInfo.java?rev=1040252&r1=1040251&r2=1040252&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GOperationInfo.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GOperationInfo.java
Mon Nov 29 19:50:18 2010
@@ -44,7 +44,7 @@ public class GOperationInfo implements S
     /**
      * Parameters of this method.
      */
-    private final List parameters;
+    private final List<String> parameters;
 
     /**
      * Target method name.
@@ -52,7 +52,7 @@ public class GOperationInfo implements S
     private final String methodName;
 
     public GOperationInfo(String name, String type) {
-        this(name, name, Collections.EMPTY_LIST, type);
+        this(name, name, Collections.<String>emptyList(), type);
     }
 
     public GOperationInfo(String name, Class[] paramTypes, String returnType) {
@@ -69,15 +69,15 @@ public class GOperationInfo implements S
         this(name, name, Arrays.asList(paramTypes), returnType);
     }
     
-    public GOperationInfo(String name, List parameters, String returnType) {
+    public GOperationInfo(String name, List<String> parameters, String returnType)
{
         this(name, name, parameters, returnType);
     }
     
-    public GOperationInfo(String name, String methodName, List parameters, String returnType)
{
+    public GOperationInfo(String name, String methodName, List<String> parameters,
String returnType) {
         this.name = name;
         this.returnType = returnType;
         this.methodName = methodName;
-        this.parameters = Collections.unmodifiableList(new ArrayList(parameters));
+        this.parameters = Collections.unmodifiableList(new ArrayList<String>(parameters));
     }
 
     public String getName() {
@@ -92,7 +92,7 @@ public class GOperationInfo implements S
         return methodName;
     }
 
-    public List getParameterList() {
+    public List<String> getParameterList() {
         return parameters;
     }
 
@@ -110,8 +110,8 @@ public class GOperationInfo implements S
 
         xml.append("<parameters>");
 
-        for (Iterator loop = parameters.iterator(); loop.hasNext(); ) {
-            xml.append("<parameterType>" + loop.next().toString() + "</parameterType>");
+        for (Iterator<String> loop = parameters.iterator(); loop.hasNext(); ) {
+            xml.append("<parameterType>" + loop.next() + "</parameterType>");
         }
 
         xml.append("</parameters>");

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Environment.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Environment.java?rev=1040252&r1=1040251&r2=1040252&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Environment.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Environment.java
Mon Nov 29 19:50:18 2010
@@ -209,9 +209,7 @@ public class Environment implements Seri
             manifest.addConfiguredAttribute(new Manifest.Attribute(Manifest.Attribute.Separator.COMMA,
Constants.EXPORT_PACKAGE, exports));
         }
         
-        if (dynamicImports.isEmpty()) {
-            manifest.addConfiguredAttribute(new Manifest.Attribute(Manifest.Attribute.Separator.COMMA,
Constants.DYNAMICIMPORT_PACKAGE, "*"));
-        } else {
+        if (!dynamicImports.isEmpty()) {
             manifest.addConfiguredAttribute(new Manifest.Attribute(Manifest.Attribute.Separator.COMMA,
Constants.DYNAMICIMPORT_PACKAGE, dynamicImports));
         }
 



Mime
View raw message