geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r1070797 - /geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/osgi/OSGiMetaDataBuilder.java
Date Tue, 15 Feb 2011 07:50:21 GMT
Author: xuhaihong
Date: Tue Feb 15 07:50:21 2011
New Revision: 1070797

URL: http://svn.apache.org/viewvc?rev=1070797&view=rev
Log:
Add logic to handle the scenario when org.test and !org.test are configured at the same time.
Currently, the ! takes the higher precedence.

Modified:
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/osgi/OSGiMetaDataBuilder.java

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/osgi/OSGiMetaDataBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/osgi/OSGiMetaDataBuilder.java?rev=1070797&r1=1070796&r2=1070797&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/osgi/OSGiMetaDataBuilder.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/osgi/OSGiMetaDataBuilder.java
Tue Feb 15 07:50:21 2011
@@ -118,15 +118,36 @@ public class OSGiMetaDataBuilder {
                 if (importPackageName.endsWith("*")) {
                     throw new IllegalConfigurationException("wildchar * could not be used
in the import-package " + importPackageName + " without ! prefix");
                 }
-                //If the users configured import packages, those will take the highest precedence.
-                List<HeaderElement> elements = HeaderParser.parseHeader(importPackageName);
-                for (HeaderElement headerElement : elements) {
-                    hiddenImportPackageNames.add(headerElement.getName());
+            }
+        }
+        environment.removeImportPackages(removedImportPackages);
+
+        //Use current filter configurations to re-validate existing import packages
+        //This is used to handle the scenario that org.test and !org.test are configured
at the same time
+        removedImportPackages.clear();
+        for (String importPackageName : environment.getImportPackages()) {
+            if (hiddenImportPackageNames.contains(importPackageName)) {
+                removedImportPackages.add(importPackageName);
+                continue;
+            }
+            for (String hiddenImportPackageNamePrefix : hiddenImportPackageNamePrefixes)
{
+                if (importPackageName.startsWith(hiddenImportPackageNamePrefix)) {
+                    removedImportPackages.add(importPackageName);
+                    break;
                 }
             }
         }
         environment.removeImportPackages(removedImportPackages);
 
+        //If the users configured import packages, those will take the highest precedence.
+        //It has the same effect as !org.test is configured.
+        for (String importPackageName : environment.getImportPackages()) {
+            List<HeaderElement> elements = HeaderParser.parseHeader(importPackageName);
+            for (HeaderElement headerElement : elements) {
+                hiddenImportPackageNames.add(headerElement.getName());
+            }
+        }
+
         Set<String> removedDynamicImportPackages = new HashSet<String>();
         for (String initialDynamicImportPackageName : environment.getDynamicImportPackages())
{
             String dynamicImportPackageName = initialDynamicImportPackageName.trim();



Mime
View raw message