Author: sohil.shah(a)jboss.com
Date: 2009-08-04 05:57:12 -0400 (Tue, 04 Aug 2009)
New Revision: 13658
Modified:
modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/provisioning/LocalPolicyProvisioner.java
modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/provisioning/PolicyProvisioner.java
modules/authorization/trunk/agent/src/main/resources/META-INF/authz-config.xml
Log:
baseline before implementing agent side caching
Modified:
modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/provisioning/LocalPolicyProvisioner.java
===================================================================
---
modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/provisioning/LocalPolicyProvisioner.java 2009-08-04
08:34:28 UTC (rev 13657)
+++
modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/provisioning/LocalPolicyProvisioner.java 2009-08-04
09:57:12 UTC (rev 13658)
@@ -1,107 +1,146 @@
/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
package org.jboss.security.authz.agent.provisioning;
import org.apache.log4j.Logger;
+import org.jboss.security.authz.agent.services.CompositionContext;
+import org.jboss.security.authz.agent.services.PolicyComposer;
import org.jboss.security.authz.model.Policy;
import org.jboss.security.authz.model.PolicyMetaData;
import org.jboss.security.authz.policy.server.PolicyServer;
import org.jboss.security.authz.policy.server.PolicyServerException;
/**
- * This Policy Provisioner integrates with the Policy Server in the same VM. This
provides fastest provisioning option
+ * This Policy Provisioner integrates with the Policy Server in the same VM.
+ * This provides fastest provisioning option
*
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*/
-public class LocalPolicyProvisioner implements PolicyProvisioner
+public class LocalPolicyProvisioner implements PolicyProvisioner
{
private static Logger log = Logger.getLogger(LocalPolicyProvisioner.class);
-
+
private PolicyServer policyServer;
-
+ private PolicyComposer policyComposer;
+
public LocalPolicyProvisioner()
{
}
-
- public PolicyServer getPolicyServer()
+
+ public PolicyServer getPolicyServer()
{
return policyServer;
}
- public void setPolicyServer(PolicyServer policyServer)
+ public void setPolicyServer(PolicyServer policyServer)
{
this.policyServer = policyServer;
}
- //--------PolicyProvisioner
implementation-----------------------------------------------------------------------------------------------------------------------------------------------------------
- public void newPolicy(PolicyMetaData policyMetaData) throws ProvisioningException
+
+
+ public PolicyComposer getPolicyComposer()
{
+ return policyComposer;
+ }
+
+ public void setPolicyComposer(PolicyComposer policyComposer)
+ {
+ this.policyComposer = policyComposer;
+ }
+ // --------PolicyProvisioner
+ //
implementation-----------------------------------------------------------------------------------------------------------------------------------------------------------
+ public void newPolicy(PolicyMetaData policyMetaData)
+ throws ProvisioningException
+ {
try
{
this.policyServer.newPolicy(policyMetaData);
}
- catch(PolicyServerException pe)
+ catch (PolicyServerException pe)
{
log.error(this, pe);
throw new ProvisioningException(pe);
}
}
- public Policy[] readAllPolicies() throws ProvisioningException
- {
+ public Policy[] readAllPolicies() throws ProvisioningException
+ {
try
{
return this.policyServer.readAllPolicies();
}
- catch(PolicyServerException pe)
+ catch (PolicyServerException pe)
{
log.error(this, pe);
throw new ProvisioningException(pe);
}
}
- public Policy readPolicy(String policyUri) throws ProvisioningException
- {
+ public Policy readPolicy(String policyUri) throws ProvisioningException
+ {
try
{
return this.policyServer.readPolicy(policyUri);
}
- catch(PolicyServerException pe)
+ catch (PolicyServerException pe)
{
log.error(this, pe);
throw new ProvisioningException(pe);
}
}
-
- public void deletePolicy(String policyUri) throws ProvisioningException
- {
+
+ public void deletePolicy(String policyUri) throws ProvisioningException
+ {
try
{
this.policyServer.deletePolicy(policyUri);
}
- catch(PolicyServerException pe)
+ catch (PolicyServerException pe)
{
log.error(this, pe);
throw new ProvisioningException(pe);
}
}
+
+ /**
+ * Composes a Policy based on the "Security Components" inside the
composition
+ * context and deploys it to the Policy Server
+ *
+ * @param compositionContext
+ * @throws ProvisioningException
+ */
+ public void composeAndDeploy(CompositionContext compositionContext)
+ throws ProvisioningException
+ {
+ try
+ {
+ PolicyMetaData policyMetaData = this.policyComposer.compose(compositionContext);
+ this.policyServer.newPolicy(policyMetaData);
+ }
+ catch (PolicyServerException pe)
+ {
+ log.error(this, pe);
+ throw new ProvisioningException(pe);
+ }
+ }
}
Modified:
modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/provisioning/PolicyProvisioner.java
===================================================================
---
modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/provisioning/PolicyProvisioner.java 2009-08-04
08:34:28 UTC (rev 13657)
+++
modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/provisioning/PolicyProvisioner.java 2009-08-04
09:57:12 UTC (rev 13658)
@@ -1,60 +1,76 @@
/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
+ * JBoss, a division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
package org.jboss.security.authz.agent.provisioning;
import org.jboss.security.authz.model.Policy;
import org.jboss.security.authz.model.PolicyMetaData;
+import org.jboss.security.authz.agent.services.CompositionContext;
+
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*/
-public interface PolicyProvisioner
+public interface PolicyProvisioner
{
- /**
- * Generates a new Policy instance based on the supplied MetaData and stores it into the
Policy Store
- *
- * @param policyMetaData meta data for the policy to be created
- */
- public void newPolicy(PolicyMetaData policyMetaData) throws ProvisioningException;
-
- /**
- * Read a stored Policy identified by the unique policyUri
- *
- * @param policyUri
- * @return a stored Policy
- */
+ /**
+ * Generates a new Policy instance based on the supplied MetaData and stores
+ * it into the Policy Store
+ *
+ * @param policyMetaData
+ * meta data for the policy to be created
+ */
+ public void newPolicy(PolicyMetaData policyMetaData)
+ throws ProvisioningException;
+
+ /**
+ * Read a stored Policy identified by the unique policyUri
+ *
+ * @param policyUri
+ * @return a stored Policy
+ */
public Policy readPolicy(String policyUri) throws ProvisioningException;
-
+
/**
* Returns all the stored Policies for the system
*
* @return all the stored Policies
*/
public Policy[] readAllPolicies() throws ProvisioningException;
-
+
/**
* Deletes the specified Policy from storage
*
- * @param policyUri unique identifier for the Policy
+ * @param policyUri
+ * unique identifier for the Policy
*/
public void deletePolicy(String policyUri) throws ProvisioningException;
+
+ /**
+ * Composes a Policy based on the "Security Components" inside the
composition
+ * context and deploys it to the Policy Server
+ *
+ * @param compositionContext
+ * @throws ProvisioningException
+ */
+ public void composeAndDeploy(CompositionContext compositionContext)
+ throws ProvisioningException;
}
Modified: modules/authorization/trunk/agent/src/main/resources/META-INF/authz-config.xml
===================================================================
---
modules/authorization/trunk/agent/src/main/resources/META-INF/authz-config.xml 2009-08-04
08:34:28 UTC (rev 13657)
+++
modules/authorization/trunk/agent/src/main/resources/META-INF/authz-config.xml 2009-08-04
09:57:12 UTC (rev 13658)
@@ -23,5 +23,8 @@
<property name="policyServer">
<inject bean="/policy-server/PolicyServer"/>
</property>
+ <property name="policyComposer">
+ <inject bean="/agent/PolicyComposer"/>
+ </property>
</bean>
</deployment>
\ No newline at end of file