[jboss-cvs] jboss-seam/src/main/org/jboss/seam/security ...
Shane Bryzak
Shane_Bryzak at symantec.com
Thu Dec 14 00:39:34 EST 2006
User: sbryzak2
Date: 06/12/14 00:39:34
Modified: src/main/org/jboss/seam/security SeamSecurityManager.java
Log:
added @Startup to security components
Revision Changes Path
1.25 +16 -5 jboss-seam/src/main/org/jboss/seam/security/SeamSecurityManager.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: SeamSecurityManager.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/security/SeamSecurityManager.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- SeamSecurityManager.java 13 Dec 2006 01:52:30 -0000 1.24
+++ SeamSecurityManager.java 14 Dec 2006 05:39:34 -0000 1.25
@@ -1,5 +1,6 @@
package org.jboss.seam.security;
+import java.io.InputStream;
import java.io.InputStreamReader;
import java.security.acl.Permission;
import java.util.ArrayList;
@@ -8,6 +9,8 @@
import java.util.Map;
import java.util.Set;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.drools.FactHandle;
import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
@@ -24,6 +27,7 @@
import org.jboss.seam.annotations.Intercept;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Startup;
import org.jboss.seam.contexts.Context;
import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.core.Expressions;
@@ -35,6 +39,7 @@
*
* @author Shane Bryzak
*/
+ at Startup(depends="org.jboss.seam.security.securityConfiguration")
@Scope(APPLICATION)
@Name("org.jboss.seam.securityManager")
@Install(value = false, precedence=BUILT_IN)
@@ -45,6 +50,8 @@
private static final String SECURITY_CONTEXT_NAME = "org.jboss.seam.security.securityContext";
+ private static final Log log = LogFactory.getLog(SeamSecurityManager.class);
+
private RuleBase securityRules;
/**
@@ -65,13 +72,17 @@
PackageBuilderConfiguration conf = new PackageBuilderConfiguration();
conf.setCompiler(PackageBuilderConfiguration.JANINO);
- PackageBuilder builder = new PackageBuilder(conf);
- builder.addPackageFromDrl(new InputStreamReader(
- Resources.getResourceAsStream(SECURITY_RULES_FILENAME)));
-
securityRules = RuleBaseFactory.newRuleBase();
+ InputStream in = Resources.getResourceAsStream(SECURITY_RULES_FILENAME);
+ if (in != null)
+ {
+ PackageBuilder builder = new PackageBuilder(conf);
+ builder.addPackageFromDrl(new InputStreamReader(in));
securityRules.addPackage(builder.getPackage());
}
+ else
+ log.warn(String.format("Security rules file %s not found", SECURITY_RULES_FILENAME));
+ }
/**
* Returns the application-scoped instance of the security manager
More information about the jboss-cvs-commits
mailing list