incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lin...@apache.org
Subject svn commit: r1040684 - in /incubator/aries/trunk/subsystem/subsystem-example/subsystem-helloIsolation/src/main/java/org/apache/aries/subsystem/example/helloIsolation: Activator.java HelloIsolation.java HelloIsolationImpl.java
Date Tue, 30 Nov 2010 18:35:31 GMT
Author: linsun
Date: Tue Nov 30 18:35:31 2010
New Revision: 1040684

URL: http://svn.apache.org/viewvc?rev=1040684&view=rev
Log:
ARIES-497 Subsystem-scope: update sample for testing - some prototype work for java security

Modified:
    incubator/aries/trunk/subsystem/subsystem-example/subsystem-helloIsolation/src/main/java/org/apache/aries/subsystem/example/helloIsolation/Activator.java
    incubator/aries/trunk/subsystem/subsystem-example/subsystem-helloIsolation/src/main/java/org/apache/aries/subsystem/example/helloIsolation/HelloIsolation.java
    incubator/aries/trunk/subsystem/subsystem-example/subsystem-helloIsolation/src/main/java/org/apache/aries/subsystem/example/helloIsolation/HelloIsolationImpl.java

Modified: incubator/aries/trunk/subsystem/subsystem-example/subsystem-helloIsolation/src/main/java/org/apache/aries/subsystem/example/helloIsolation/Activator.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/subsystem/subsystem-example/subsystem-helloIsolation/src/main/java/org/apache/aries/subsystem/example/helloIsolation/Activator.java?rev=1040684&r1=1040683&r2=1040684&view=diff
==============================================================================
--- incubator/aries/trunk/subsystem/subsystem-example/subsystem-helloIsolation/src/main/java/org/apache/aries/subsystem/example/helloIsolation/Activator.java
(original)
+++ incubator/aries/trunk/subsystem/subsystem-example/subsystem-helloIsolation/src/main/java/org/apache/aries/subsystem/example/helloIsolation/Activator.java
Tue Nov 30 18:35:31 2010
@@ -39,6 +39,15 @@ public class Activator implements Bundle
      */
     public void start(BundleContext context) throws Exception {
         System.out.println("bundle helloIsolation start");
+        
+        SecurityManager security = System.getSecurityManager();
+        if (security != null) {
+            System.out.println("HelloIsolationImpl: system manager is not null");
+        } else {
+            System.out.println("HelloIsolationImpl: system manager is still null");
+        }
+
+        
         sr = context.registerService(HelloIsolation.class.getName(),
                 new HelloIsolationImpl(), null);
         

Modified: incubator/aries/trunk/subsystem/subsystem-example/subsystem-helloIsolation/src/main/java/org/apache/aries/subsystem/example/helloIsolation/HelloIsolation.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/subsystem/subsystem-example/subsystem-helloIsolation/src/main/java/org/apache/aries/subsystem/example/helloIsolation/HelloIsolation.java?rev=1040684&r1=1040683&r2=1040684&view=diff
==============================================================================
--- incubator/aries/trunk/subsystem/subsystem-example/subsystem-helloIsolation/src/main/java/org/apache/aries/subsystem/example/helloIsolation/HelloIsolation.java
(original)
+++ incubator/aries/trunk/subsystem/subsystem-example/subsystem-helloIsolation/src/main/java/org/apache/aries/subsystem/example/helloIsolation/HelloIsolation.java
Tue Nov 30 18:35:31 2010
@@ -14,7 +14,10 @@
 
 package org.apache.aries.subsystem.example.helloIsolation;
 
+import java.security.Permission;
+
 public interface HelloIsolation
 {
   public void hello();
+  public void checkPermission(final Permission permission) throws SecurityException;
 }

Modified: incubator/aries/trunk/subsystem/subsystem-example/subsystem-helloIsolation/src/main/java/org/apache/aries/subsystem/example/helloIsolation/HelloIsolationImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/subsystem/subsystem-example/subsystem-helloIsolation/src/main/java/org/apache/aries/subsystem/example/helloIsolation/HelloIsolationImpl.java?rev=1040684&r1=1040683&r2=1040684&view=diff
==============================================================================
--- incubator/aries/trunk/subsystem/subsystem-example/subsystem-helloIsolation/src/main/java/org/apache/aries/subsystem/example/helloIsolation/HelloIsolationImpl.java
(original)
+++ incubator/aries/trunk/subsystem/subsystem-example/subsystem-helloIsolation/src/main/java/org/apache/aries/subsystem/example/helloIsolation/HelloIsolationImpl.java
Tue Nov 30 18:35:31 2010
@@ -14,6 +14,11 @@
 
 package org.apache.aries.subsystem.example.helloIsolation;
 
+import java.security.AccessController;
+import java.security.Permission;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
 public class HelloIsolationImpl implements HelloIsolation
 {
 
@@ -22,4 +27,28 @@ public class HelloIsolationImpl implemen
     System.out.println("hello from HelloIsolationImpl");
   }
 
+  // test java2 security
+
+  public void checkPermission(final Permission permission) throws SecurityException {
+      System.out.println("HelloIsolationImpl: enter checkpermission");
+
+    try {
+      AccessController.doPrivileged(new PrivilegedExceptionAction() {
+        public Object run() throws SecurityException {
+          SecurityManager security = System.getSecurityManager();
+          if (security != null) {
+              System.out.println("HelloIsolationImpl: system manager is not null");
+
+              security.checkPermission(permission);
+              return null; 
+          }
+          System.out.println("HelloIsolationImpl: system manager is still null");
+
+          return null;
+        }
+      });
+    } catch (PrivilegedActionException e) {
+      throw (SecurityException) e.getException();
+    }
+  }
 }



Mime
View raw message