felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject svn commit: r1052018 - in /felix/trunk/framework.security: ./ src/main/java/org/apache/felix/framework/security/condpermadmin/ src/main/java/org/apache/felix/framework/security/util/
Date Wed, 22 Dec 2010 18:29:23 GMT
Author: pauls
Date: Wed Dec 22 18:29:22 2010
New Revision: 1052018

URL: http://svn.apache.org/viewvc?rev=1052018&view=rev
Log:
Update to latest framework snapshot (FELIX-2739).

Modified:
    felix/trunk/framework.security/pom.xml
    felix/trunk/framework.security/src/main/java/org/apache/felix/framework/security/condpermadmin/ConditionalPermissionAdminImpl.java
    felix/trunk/framework.security/src/main/java/org/apache/felix/framework/security/util/BundleInputStream.java
    felix/trunk/framework.security/src/main/java/org/apache/felix/framework/security/util/Permissions.java

Modified: felix/trunk/framework.security/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/framework.security/pom.xml?rev=1052018&r1=1052017&r2=1052018&view=diff
==============================================================================
--- felix/trunk/framework.security/pom.xml (original)
+++ felix/trunk/framework.security/pom.xml Wed Dec 22 18:29:22 2010
@@ -40,7 +40,7 @@
     <dependency>
       <groupId>${pom.groupId}</groupId>
       <artifactId>org.apache.felix.framework</artifactId>
-      <version>3.0.2</version>
+      <version>3.1.0-SNAPSHOT</version>
       <scope>provided</scope>
     </dependency>
   </dependencies>

Modified: felix/trunk/framework.security/src/main/java/org/apache/felix/framework/security/condpermadmin/ConditionalPermissionAdminImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework.security/src/main/java/org/apache/felix/framework/security/condpermadmin/ConditionalPermissionAdminImpl.java?rev=1052018&r1=1052017&r2=1052018&view=diff
==============================================================================
--- felix/trunk/framework.security/src/main/java/org/apache/felix/framework/security/condpermadmin/ConditionalPermissionAdminImpl.java
(original)
+++ felix/trunk/framework.security/src/main/java/org/apache/felix/framework/security/condpermadmin/ConditionalPermissionAdminImpl.java
Wed Dec 22 18:29:22 2010
@@ -54,7 +54,6 @@ import org.apache.felix.framework.securi
 import org.apache.felix.framework.security.util.LocalPermissions;
 import org.apache.felix.framework.security.util.Permissions;
 import org.apache.felix.framework.security.util.PropertiesCache;
-import org.apache.felix.framework.util.IteratorToEnumeration;
 import org.apache.felix.framework.util.manifestparser.R4Library;
 
 /*
@@ -777,6 +776,12 @@ public final class ConditionalPermission
                     public void setSecurityContext(Object arg0)
                     {
                     }
+
+                    public URL getLocalURL(int arg0, String arg1)
+                    {
+                        // TODO Auto-generated method stub
+                        return null;
+                    }
                 }, permission, m_pai))
                 {
                     if (!posts.isEmpty())
@@ -818,8 +823,8 @@ public final class ConditionalPermission
     {
         synchronized (m_condPermInfos)
         {
-            return new IteratorToEnumeration((new ArrayList(m_condPermInfos
-                .values())).iterator());
+            return Collections.enumeration(new ArrayList(m_condPermInfos
+                .values()));
         }
     }
 

Modified: felix/trunk/framework.security/src/main/java/org/apache/felix/framework/security/util/BundleInputStream.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework.security/src/main/java/org/apache/felix/framework/security/util/BundleInputStream.java?rev=1052018&r1=1052017&r2=1052018&view=diff
==============================================================================
--- felix/trunk/framework.security/src/main/java/org/apache/felix/framework/security/util/BundleInputStream.java
(original)
+++ felix/trunk/framework.security/src/main/java/org/apache/felix/framework/security/util/BundleInputStream.java
Wed Dec 22 18:29:22 2010
@@ -24,12 +24,12 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Enumeration;
 import java.util.List;
 import java.util.jar.JarEntry;
 import java.util.jar.JarOutputStream;
 
-import org.apache.felix.framework.util.IteratorToEnumeration;
 //import org.apache.felix.moduleloader.IContent;
 import org.apache.felix.framework.resolver.Content;
 
@@ -77,7 +77,7 @@ public final class BundleInputStream ext
         {
             manifest = "META-INF/MANIFEST.MF";
         }
-        m_content = new IteratorToEnumeration(entries.iterator());
+        m_content = Collections.enumeration(entries);
 
         try
         {

Modified: felix/trunk/framework.security/src/main/java/org/apache/felix/framework/security/util/Permissions.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework.security/src/main/java/org/apache/felix/framework/security/util/Permissions.java?rev=1052018&r1=1052017&r2=1052018&view=diff
==============================================================================
--- felix/trunk/framework.security/src/main/java/org/apache/felix/framework/security/util/Permissions.java
(original)
+++ felix/trunk/framework.security/src/main/java/org/apache/felix/framework/security/util/Permissions.java
Wed Dec 22 18:29:22 2010
@@ -34,6 +34,8 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Collections;
+import java.util.WeakHashMap;
 
 import org.apache.felix.framework.util.SecureAction;
 import org.osgi.framework.AdminPermission;
@@ -72,6 +74,8 @@ public final class Permissions
 
     private static final PermissionInfo[] IMPLICIT = new PermissionInfo[] { new PermissionInfo(
         FilePermission.class.getName(), "-", "read,write,delete") };
+		
+	private static volatile Map m_implicit = new WeakHashMap();
 
     Permissions(PermissionInfo[] permissionInfos, BundleContext context,
         SecureAction action)
@@ -105,14 +109,22 @@ public final class Permissions
 
     public PermissionInfo[] getImplicit(Bundle bundle)
     {
-        return new PermissionInfo[] {
-            IMPLICIT[0],
-            new PermissionInfo(AdminPermission.class.getName(), "(id="
-                + bundle.getBundleId() + ")", AdminPermission.METADATA),
-            new PermissionInfo(AdminPermission.class.getName(), "(id="
-                + bundle.getBundleId() + ")", AdminPermission.RESOURCE),
-            new PermissionInfo(AdminPermission.class.getName(), "(id="
-                + bundle.getBundleId() + ")", AdminPermission.CONTEXT) };
+	    PermissionInfo[] result = (PermissionInfo[]) m_implicit.get(bundle);
+		if (result == null)
+		{
+		    result = new PermissionInfo[] {
+                IMPLICIT[0],
+                new PermissionInfo(AdminPermission.class.getName(), "(id="
+                    + bundle.getBundleId() + ")", AdminPermission.METADATA),
+                new PermissionInfo(AdminPermission.class.getName(), "(id="
+                    + bundle.getBundleId() + ")", AdminPermission.RESOURCE),
+                new PermissionInfo(AdminPermission.class.getName(), "(id="
+                    + bundle.getBundleId() + ")", AdminPermission.CONTEXT) };
+			Map implicit = new WeakHashMap(m_implicit);
+		    implicit.put(bundle, result);
+			m_implicit = implicit;
+		}
+        return result;
     }
 
     public Permissions getPermissions(PermissionInfo[] permissionInfos)
@@ -230,31 +242,32 @@ public final class Permissions
 
         public boolean implies(Permission perm)
         {
-            Map perms = null;
+            Permission permission = null;
 
             synchronized (m_perms)
             {
-                perms = m_perms;
+                permission = (Permission) m_perms.get(perm);
             }
 
-            Permission permission = (Permission) perms.get(perm);
-
             if ((permission != null) && permission.implies(perm))
             {
                 return true;
             }
-
-            for (Iterator iter = perms.values().iterator(); iter.hasNext();)
-            {
-                Permission current = (Permission) iter.next();
-                if ((current != null) && (current != permission)
-                    && current.implies(perm))
-                {
-                    return true;
+			
+			synchronized (m_perms) 
+			{
+                for (Iterator iter = m_perms.values().iterator(); iter.hasNext();)
+                {
+                    Permission current = (Permission) iter.next();
+                    if ((current != null) && (current != permission)
+                        && current.implies(perm))
+                    {
+                        return true;
+                    }
                 }
+                return false;
             }
-            return false;
-        }
+		}
     }
 
     private void cleanUp(ReferenceQueue queue, Map cache)



Mime
View raw message