Author: sohil.shah(a)jboss.com
Date: 2009-08-10 18:25:24 -0400 (Mon, 10 Aug 2009)
New Revision: 13731
Added:
jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/hibernate.cfg.xml
Modified:
jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/jcr/DataStorageImpl.java
jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/org/exoplatform/portal/jboss/security/components/ExoRoles.java
Log:
trying to make security framework integration completely seamless
* goal is to switch between framework vs non-framework mode with a simple true/false
status in configuration
* switch should automagically also take care of Policy Repository State Integrity
Added:
jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/hibernate.cfg.xml
===================================================================
---
jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/hibernate.cfg.xml
(rev 0)
+++
jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/hibernate.cfg.xml 2009-08-10
22:25:24 UTC (rev 13731)
@@ -0,0 +1,59 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE hibernate-configuration PUBLIC
+ "-//Hibernate/Hibernate Configuration DTD//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+ <session-factory>
+ <!-- Database connection settings -->
+ <property
name="connection.driver_class">org.hsqldb.jdbcDriver</property>
+ <property
name="connection.url">jdbc:hsqldb:file:target/testdb</property>
+ <property name="connection.username">sa</property>
+ <property name="connection.password"></property>
+
+ <!-- JDBC connection pool (use the built-in) -->
+ <property name="connection.pool_size">1</property>
+
+ <!-- SQL dialect -->
+ <property
name="dialect">org.hibernate.dialect.HSQLDialect</property>
+
+ <!-- Enable Hibernate's automatic session context management -->
+ <property
name="current_session_context_class">thread</property>
+
+ <!-- Disable the second-level cache -->
+ <property
name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
+
+ <!-- Echo all executed SQL to stdout -->
+ <property name="show_sql">false</property>
+
+ <!--
+ Drop and re-create the database schema on startup
+ -->
+ <property name="hbm2ddl.auto">create</property>
+
+ <mapping resource="policy.hbm.xml"/>
+ </session-factory>
+</hibernate-configuration>
\ No newline at end of file
Modified:
jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/jcr/DataStorageImpl.java
===================================================================
---
jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/jcr/DataStorageImpl.java 2009-08-10
22:22:41 UTC (rev 13730)
+++
jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/jcr/DataStorageImpl.java 2009-08-10
22:25:24 UTC (rev 13731)
@@ -92,7 +92,7 @@
private ExoPolicyProvisioner getPolicyProvisioner()
{
- if(this.policyProvisioner == null)
+ if(ServiceContainer.isActive() && this.policyProvisioner == null)
{
this.policyProvisioner =
(ExoPolicyProvisioner)ServiceContainer.lookup("/exo/jboss/PolicyProvisioner");
}
@@ -119,8 +119,11 @@
listenerService.broadcast(CREATE_PORTAL_EVENT,this,config);
}
finally {
- sessionProvider.close() ;
- this.getPolicyProvisioner().provision(config);
+ sessionProvider.close() ;
+ if(ServiceContainer.isActive())
+ {
+ this.getPolicyProvisioner().provision(config);
+ }
}
}
@@ -182,8 +185,11 @@
regService_.createEntry(sessionProvider, pageSetPath, pageEntry) ;
}
finally {
- sessionProvider.close() ;
- this.getPolicyProvisioner().provision(page);
+ sessionProvider.close() ;
+ if(ServiceContainer.isActive())
+ {
+ this.getPolicyProvisioner().provision(page);
+ }
}
}
@@ -248,8 +254,11 @@
regService_.createEntry(sessionProvider, appRegPath, NavigationEntry) ;
}
finally {
- sessionProvider.close() ;
- this.getPolicyProvisioner().provision(navigation);
+ sessionProvider.close() ;
+ if(ServiceContainer.isActive())
+ {
+ this.getPolicyProvisioner().provision(navigation);
+ }
}
}
Modified:
jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/org/exoplatform/portal/jboss/security/components/ExoRoles.java
===================================================================
---
jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/org/exoplatform/portal/jboss/security/components/ExoRoles.java 2009-08-10
22:22:41 UTC (rev 13730)
+++
jbossexo/branches/security-integration-sandbox/portal/trunk/component/portal/src/main/java/org/exoplatform/portal/jboss/security/components/ExoRoles.java 2009-08-10
22:25:24 UTC (rev 13731)
@@ -111,7 +111,7 @@
try
{
reader = new BufferedReader(new InputStreamReader(Thread.currentThread()
- .getContextClassLoader().getSystemResourceAsStream(
+ .getContextClassLoader().getResourceAsStream(
"META-INF/exo-roles-component.properties")));
String buffer = null;
StringBuilder builder = new StringBuilder();
@@ -148,7 +148,7 @@
try
{
reader = new BufferedReader(new InputStreamReader(Thread.currentThread()
- .getContextClassLoader().getSystemResourceAsStream(
+ .getContextClassLoader().getResourceAsStream(
"META-INF/exo-roles-component-mustmatchall.properties")));
String buffer = null;
StringBuilder builder = new StringBuilder();