river-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter_firmst...@apache.org
Subject svn commit: r1159003 - /river/jtsk/skunk/peterConcurrentPolicy/src/net/jini/loader/pref/PCodeSource.java
Date Thu, 18 Aug 2011 03:01:27 GMT
Author: peter_firmstone
Date: Thu Aug 18 03:01:27 2011
New Revision: 1159003

URL: http://svn.apache.org/viewvc?rev=1159003&view=rev
Log:
Minor refactoring to make compile, this code is to provide a new CodeSource that contains
permissions required to execute, these permissions are not granted, but are instead included
for debugging information and to allow the client to check which permissions a proxy requires.

Added:
    river/jtsk/skunk/peterConcurrentPolicy/src/net/jini/loader/pref/PCodeSource.java   (with
props)

Added: river/jtsk/skunk/peterConcurrentPolicy/src/net/jini/loader/pref/PCodeSource.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/peterConcurrentPolicy/src/net/jini/loader/pref/PCodeSource.java?rev=1159003&view=auto
==============================================================================
--- river/jtsk/skunk/peterConcurrentPolicy/src/net/jini/loader/pref/PCodeSource.java (added)
+++ river/jtsk/skunk/peterConcurrentPolicy/src/net/jini/loader/pref/PCodeSource.java Thu Aug
18 03:01:27 2011
@@ -0,0 +1,51 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package net.jini.loader.pref;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.net.URL;
+import java.security.CodeSource;
+import java.security.Permission;
+import java.security.cert.Certificate;
+
+/**
+ *
+ * @author peter
+ */
+public class PCodeSource extends CodeSource {
+    private static final long serialVersionUID = 1L;
+    private Permission[] permissions;
+    
+    public PCodeSource(URL codebase, Certificate[] certs, Permission[] perms){
+        super(codebase, certs );
+        permissions = perms.clone();
+    }
+    
+    public String toString(){
+        StringBuilder sb = new StringBuilder(120);
+        sb.append(super.toString())
+                .append("\n")
+                .append("Information only, minimum Permissions required for execution:\n");
+        int l = permissions.length;
+        for (int i = 0; i < l ; i++){
+            sb.append(permissions[i].toString());
+        }
+        return sb.toString();
+    }
+    
+    public Permission [] getRequiredPerms(){
+        return permissions.clone();
+    }
+    
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException{
+        in.defaultReadObject();
+    }
+    
+    private void writeObject(ObjectOutputStream out) throws IOException{
+        out.defaultWriteObject();
+    }
+}

Propchange: river/jtsk/skunk/peterConcurrentPolicy/src/net/jini/loader/pref/PCodeSource.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message