Seam SVN: r7670 - in branches/Seam_1_2_1_AP: examples/booking and 7 other directories.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2008-03-20 18:11:32 -0400 (Thu, 20 Mar 2008)
New Revision: 7670
Removed:
branches/Seam_1_2_1_AP/examples/booking/resources/WEB-INF/lib/commons-beanutils-1.7.0.jar
branches/Seam_1_2_1_AP/examples/booking/resources/WEB-INF/lib/commons-digester-1.6.jar
branches/Seam_1_2_1_AP/examples/booking/resources/WEB-INF/lib/commons-lang-2.1.jar
branches/Seam_1_2_1_AP/examples/icefaces/resources/WEB-INF/lib/commons-digester-1.6.jar
branches/Seam_1_2_1_AP/examples/spring/resources/WEB-INF/lib/commons-beanutils-1.7.0.jar
branches/Seam_1_2_1_AP/examples/spring/resources/WEB-INF/lib/commons-digester-1.6.jar
branches/Seam_1_2_1_AP/examples/spring/resources/WEB-INF/lib/commons-lang-2.1.jar
branches/Seam_1_2_1_AP/examples/ui/resources/WEB-INF/lib/commons-beanutils-1.7.0.jar
branches/Seam_1_2_1_AP/examples/ui/resources/WEB-INF/lib/commons-digester-1.6.jar
branches/Seam_1_2_1_AP/examples/ui/resources/WEB-INF/lib/commons-lang-2.1.jar
Modified:
branches/Seam_1_2_1_AP/.classpath
branches/Seam_1_2_1_AP/build.properties
branches/Seam_1_2_1_AP/build.xml
branches/Seam_1_2_1_AP/examples/booking/build.xml
branches/Seam_1_2_1_AP/examples/icefaces/build.xml
branches/Seam_1_2_1_AP/examples/spring/build.xml
branches/Seam_1_2_1_AP/examples/ui/build.xml
Log:
JBPAPP-676 removed commons-digester-1.6.jar, commons-beanutils-1.7.0.jar and commons-lang-2.1.jar from examples booking, ui, spring, icefaces. Changed the example build files to copy these files from global lib directory
Modified: branches/Seam_1_2_1_AP/.classpath
===================================================================
--- branches/Seam_1_2_1_AP/.classpath 2008-03-20 21:49:32 UTC (rev 7669)
+++ branches/Seam_1_2_1_AP/.classpath 2008-03-20 22:11:32 UTC (rev 7670)
@@ -26,16 +26,16 @@
<classpathentry kind="lib" path="lib/myfaces-impl-1.1.4.jar"/>
<classpathentry kind="lib" path="lib/ant.jar"/>
<classpathentry kind="lib" path="embedded-ejb/conf"/>
- <classpathentry kind="lib" path="drools/lib/drools-compiler-3.0.5.jar"/>
- <classpathentry kind="lib" path="drools/lib/drools-core-3.0.5.jar"/>
<classpathentry kind="lib" path="lib/jsf-facelets.jar"/>
<classpathentry kind="lib" path="lib/mail.jar"/>
- <classpathentry kind="lib" path="lib/jbpm-3.1.4.jar"/>
<classpathentry kind="lib" path="lib/activation.jar"/>
<classpathentry kind="lib" path="lib/mail-ra.jar"/>
<classpathentry kind="lib" path="lib/spring.jar"/>
<classpathentry kind="lib" path="lib/itext-2.0.1.jar"/>
<classpathentry kind="lib" path="lib/commons-codec-1.3.jar"/>
<classpathentry kind="lib" path="lib/jcaptcha-all-1.0-RC4.jar"/>
+ <classpathentry kind="lib" path="lib/jbpm-jpdl.jar"/>
+ <classpathentry kind="lib" path="drools/lib/drools-compiler-4.0.2.jar"/>
+ <classpathentry kind="lib" path="drools/lib/drools-core-4.0.2.jar"/>
<classpathentry kind="output" path="output/classes"/>
</classpath>
Modified: branches/Seam_1_2_1_AP/build.properties
===================================================================
--- branches/Seam_1_2_1_AP/build.properties 2008-03-20 21:49:32 UTC (rev 7669)
+++ branches/Seam_1_2_1_AP/build.properties 2008-03-20 22:11:32 UTC (rev 7670)
@@ -1,2 +1,2 @@
-tomcat.home= /var/lib/tomcat5
-jboss.home= /var/lib/jbossas
+tomcat.home=C:/Java/apache-tomcat-6.0.10
+jboss.home=G:/jboss-4.2.2.GA
Modified: branches/Seam_1_2_1_AP/build.xml
===================================================================
--- branches/Seam_1_2_1_AP/build.xml 2008-03-20 21:49:32 UTC (rev 7669)
+++ branches/Seam_1_2_1_AP/build.xml 2008-03-20 22:11:32 UTC (rev 7670)
@@ -204,6 +204,14 @@
dir="${example.webinf.lib.dir}">
<include name="*.jar"/>
</zipfileset>
+
+ <fileset id="example.war.webinf.lib.commons"
+ dir="${lib.dir}">
+ <include name="commons-beanutils*.jar" if="example.commons.lib"/>
+ <include name="commons-digester*.jar" if="example.commons-digester.lib"/>
+ <include name="commons-lang*.jar" if="example.commons.lib"/>
+ </fileset>
+
<fileset id="example.ejb3.resources"
dir="${example.resources.dir}">
@@ -1375,6 +1383,10 @@
<filter token="microcontainer" value="false"/>
</filterset>
</copy>
+
+ <copy todir="${build.dir}/resources/WEB-INF/lib">
+ <fileset refid="example.war.webinf.lib.commons"/>
+ </copy>
<jar destfile="${build.dir}/${example.name}.war">
<zipfileset refid="example.war.docroot"/>
Modified: branches/Seam_1_2_1_AP/examples/booking/build.xml
===================================================================
--- branches/Seam_1_2_1_AP/examples/booking/build.xml 2008-03-20 21:49:32 UTC (rev 7669)
+++ branches/Seam_1_2_1_AP/examples/booking/build.xml 2008-03-20 22:11:32 UTC (rev 7670)
@@ -17,6 +17,10 @@
<property name="src.test.dir" value="src"/>
<property name="test.classpath" value="test.eejb.classpath"/>
<property name="tomcat.conf" value="eejb.conf"/>
+
+ <property name="example.commons.lib" value="yes"/>
+ <property name="example.commons-digester.lib" value="yes"/>
+
<import file="../../build.xml"/>
Deleted: branches/Seam_1_2_1_AP/examples/booking/resources/WEB-INF/lib/commons-beanutils-1.7.0.jar
===================================================================
(Binary files differ)
Deleted: branches/Seam_1_2_1_AP/examples/booking/resources/WEB-INF/lib/commons-digester-1.6.jar
===================================================================
(Binary files differ)
Deleted: branches/Seam_1_2_1_AP/examples/booking/resources/WEB-INF/lib/commons-lang-2.1.jar
===================================================================
(Binary files differ)
Modified: branches/Seam_1_2_1_AP/examples/icefaces/build.xml
===================================================================
--- branches/Seam_1_2_1_AP/examples/icefaces/build.xml 2008-03-20 21:49:32 UTC (rev 7669)
+++ branches/Seam_1_2_1_AP/examples/icefaces/build.xml 2008-03-20 22:11:32 UTC (rev 7670)
@@ -15,6 +15,8 @@
<property name="test.classpath" value="test.eejb.classpath"/>
<property name="tomcat.conf" value="eejb.conf"/>
+ <property name="example.commons-digester.lib" value="yes"/>
+
<import file="../../build.xml"/>
</project>
Deleted: branches/Seam_1_2_1_AP/examples/icefaces/resources/WEB-INF/lib/commons-digester-1.6.jar
===================================================================
(Binary files differ)
Modified: branches/Seam_1_2_1_AP/examples/spring/build.xml
===================================================================
--- branches/Seam_1_2_1_AP/examples/spring/build.xml 2008-03-20 21:49:32 UTC (rev 7669)
+++ branches/Seam_1_2_1_AP/examples/spring/build.xml 2008-03-20 22:11:32 UTC (rev 7670)
@@ -17,6 +17,9 @@
<property name="test.classpath" value="test.eejb.classpath"/>
<property name="tomcat.conf" value="eejb.conf"/>
+ <property name="example.commons.lib" value="yes"/>
+ <property name="example.commons-digester.lib" value="yes"/>
+
<import file="../../build.xml"/>
<fileset id="example.ear.resources"
Deleted: branches/Seam_1_2_1_AP/examples/spring/resources/WEB-INF/lib/commons-beanutils-1.7.0.jar
===================================================================
(Binary files differ)
Deleted: branches/Seam_1_2_1_AP/examples/spring/resources/WEB-INF/lib/commons-digester-1.6.jar
===================================================================
(Binary files differ)
Deleted: branches/Seam_1_2_1_AP/examples/spring/resources/WEB-INF/lib/commons-lang-2.1.jar
===================================================================
(Binary files differ)
Modified: branches/Seam_1_2_1_AP/examples/ui/build.xml
===================================================================
--- branches/Seam_1_2_1_AP/examples/ui/build.xml 2008-03-20 21:49:32 UTC (rev 7669)
+++ branches/Seam_1_2_1_AP/examples/ui/build.xml 2008-03-20 22:11:32 UTC (rev 7670)
@@ -17,7 +17,10 @@
<property name="src.test.dir" value="src"/>
<property name="test.classpath" value="test.eejb.classpath"/>
<property name="tomcat.conf" value="eejb.conf"/>
-
+
+ <property name="example.commons.lib" value="yes"/>
+ <property name="example.commons-digester.lib" value="yes"/>
+
<import file="../../build.xml"/>
</project>
Deleted: branches/Seam_1_2_1_AP/examples/ui/resources/WEB-INF/lib/commons-beanutils-1.7.0.jar
===================================================================
(Binary files differ)
Deleted: branches/Seam_1_2_1_AP/examples/ui/resources/WEB-INF/lib/commons-digester-1.6.jar
===================================================================
(Binary files differ)
Deleted: branches/Seam_1_2_1_AP/examples/ui/resources/WEB-INF/lib/commons-lang-2.1.jar
===================================================================
(Binary files differ)
17 years, 9 months
Seam SVN: r7669 - trunk/src/main/org/jboss/seam/security/permission.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-03-20 17:49:32 -0400 (Thu, 20 Mar 2008)
New Revision: 7669
Modified:
trunk/src/main/org/jboss/seam/security/permission/JPAPermissionStore.java
Log:
implemented revokePermission()
Modified: trunk/src/main/org/jboss/seam/security/permission/JPAPermissionStore.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/permission/JPAPermissionStore.java 2008-03-20 20:25:57 UTC (rev 7668)
+++ trunk/src/main/org/jboss/seam/security/permission/JPAPermissionStore.java 2008-03-20 21:49:32 UTC (rev 7669)
@@ -5,6 +5,7 @@
import java.util.List;
import javax.persistence.EntityManager;
+import javax.persistence.NoResultException;
import org.jboss.seam.Component;
import org.jboss.seam.annotations.Scope;
@@ -53,7 +54,27 @@
public boolean revokePermission(String target, String action,
String account, AccountType accountType)
{
- return false;
+ try
+ {
+ EntityManager em = getEntityManager();
+
+ AccountPermission permission = (AccountPermission) em.createQuery(
+ "from " + permissionClass.getName() +
+ " where target = :target and action = :action and account = :account " +
+ " and accountType = :accountType")
+ .setParameter("target", target)
+ .setParameter("action", "action")
+ .setParameter("account", account)
+ .setParameter("accountType", accountType)
+ .getSingleResult();
+
+ em.remove(permission);
+ return true;
+ }
+ catch (NoResultException ex)
+ {
+ return false;
+ }
}
public List<AccountPermission> listPermissions(String target, String action)
17 years, 9 months
Seam SVN: r7668 - in trunk: src/main/org/jboss/seam/persistence and 1 other directory.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-03-20 16:25:57 -0400 (Thu, 20 Mar 2008)
New Revision: 7668
Modified:
trunk/build/core.pom.xml
trunk/src/main/org/jboss/seam/persistence/HibernatePersistenceProvider.java
Log:
JBSEAM-2029
Modified: trunk/build/core.pom.xml
===================================================================
--- trunk/build/core.pom.xml 2008-03-20 19:31:58 UTC (rev 7667)
+++ trunk/build/core.pom.xml 2008-03-20 20:25:57 UTC (rev 7668)
@@ -42,7 +42,6 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
- <scope>runtime</scope>
<optional>true</optional>
</dependency>
Modified: trunk/src/main/org/jboss/seam/persistence/HibernatePersistenceProvider.java
===================================================================
--- trunk/src/main/org/jboss/seam/persistence/HibernatePersistenceProvider.java 2008-03-20 19:31:58 UTC (rev 7667)
+++ trunk/src/main/org/jboss/seam/persistence/HibernatePersistenceProvider.java 2008-03-20 20:25:57 UTC (rev 7668)
@@ -4,6 +4,7 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
+import java.util.HashMap;
import java.util.Map;
import javax.persistence.EntityManager;
@@ -15,6 +16,11 @@
import org.hibernate.Session;
import org.hibernate.StaleStateException;
import org.hibernate.TransientObjectException;
+import org.hibernate.ejb.event.Callback;
+import org.hibernate.ejb.event.EJB3PostLoadEventListener;
+import org.hibernate.ejb.event.EntityCallbackHandler;
+import org.hibernate.engine.SessionImplementor;
+import org.hibernate.event.PostLoadEventListener;
import org.hibernate.metadata.ClassMetadata;
import org.hibernate.type.VersionType;
import org.jboss.seam.ScopeType;
@@ -322,29 +328,98 @@
}
}
- /*@Override
- public Method getPostLoadMethod(Class beanClass, EntityManager entityManager)
+ /**
+ * A nasty hack until we get a nicer method in Hibernate to use instead
+ *
+ * TODO fix this once Hibernate exposes an API method to return the callback method/s for a
+ * given bean class
+ *
+ * @param entityManager
+ * @return
+ */
+ private EntityCallbackHandler getCallbackHandler(EntityManager entityManager)
{
+ PostLoadEventListener[] listeners = ((SessionImplementor) getSession(entityManager))
+ .getListeners().getPostLoadEventListeners();
+
+ for (PostLoadEventListener listener : listeners)
+ {
+ if (listener instanceof EJB3PostLoadEventListener)
+ {
+ try
+ {
+ Field callbackHandlerField = EJB3PostLoadEventListener.class.getField("callbackHandler");
+ return (EntityCallbackHandler) callbackHandlerField.get(listener);
+ }
+ catch (Exception ex)
+ {
+ throw new RuntimeException(ex);
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * More nastiness
+ *
+ * @param handler
+ * @param fieldName
+ * @return
+ */
+ private Callback[] getCallbacks(EntityCallbackHandler handler, String fieldName, Class beanClass)
+ {
+ try
+ {
+ Field f = EntityCallbackHandler.class.getField(fieldName);
+ HashMap<Class,Callback[]> callbacks = (HashMap<Class,Callback[]>) f.get(handler);
+ return callbacks.get(beanClass);
+ }
+ catch (Exception ex)
+ {
+ throw new RuntimeException(ex);
+ }
+ }
+
+ private Method getCallbackMethod(EntityManager entityManager, Class beanClass, String callbackFieldName)
+ {
+ Callback[] callbacks = getCallbacks(getCallbackHandler(entityManager), callbackFieldName, beanClass);
+
+ if (callbacks != null)
+ {
+ for (Callback cb : callbacks)
+ {
+ return cb.getCallbackMethod();
+ }
+ }
+
return null;
}
@Override
+ public Method getPostLoadMethod(Class beanClass, EntityManager entityManager)
+ {
+ return getCallbackMethod(entityManager, beanClass, "postLoads");
+ }
+
+
+ @Override
public Method getPrePersistMethod(Class beanClass, EntityManager entityManager)
{
- return null;
+ return getCallbackMethod(entityManager, beanClass, "preCreates");
}
@Override
public Method getPreUpdateMethod(Class beanClass, EntityManager entityManager)
{
- return null;
+ return getCallbackMethod(entityManager, beanClass, "preUpdates");
}
@Override
public Method getPreRemoveMethod(Class beanClass, EntityManager entityManager)
{
- return null;
- }*/
+ return getCallbackMethod(entityManager, beanClass, "preRemoves");
+ }
private Session getSession(EntityManager entityManager)
{
17 years, 9 months
Seam SVN: r7667 - trunk/examples/jpa.
by seam-commits@lists.jboss.org
Author: jbalunas(a)redhat.com
Date: 2008-03-20 15:31:58 -0400 (Thu, 20 Mar 2008)
New Revision: 7667
Modified:
trunk/examples/jpa/build-tomcat55.xml
trunk/examples/jpa/build-tomcat6.xml
Log:
JBSEAM-2773
Modified: trunk/examples/jpa/build-tomcat55.xml
===================================================================
--- trunk/examples/jpa/build-tomcat55.xml 2008-03-20 19:31:25 UTC (rev 7666)
+++ trunk/examples/jpa/build-tomcat55.xml 2008-03-20 19:31:58 UTC (rev 7667)
@@ -47,6 +47,7 @@
<include name="lib/hibernate-validator.jar"/>
<include name="examples/jpa/lib/jboss-archive-browsing.jar" />
<include name="lib/persistence-api.jar" />
+ <include name="lib/asm.jar" />
<include name="lib/cglib.jar"/>
<include name="lib/antlr.jar" />
</fileset>
Modified: trunk/examples/jpa/build-tomcat6.xml
===================================================================
--- trunk/examples/jpa/build-tomcat6.xml 2008-03-20 19:31:25 UTC (rev 7666)
+++ trunk/examples/jpa/build-tomcat6.xml 2008-03-20 19:31:58 UTC (rev 7667)
@@ -39,6 +39,7 @@
<include name="lib/cglib.jar" />
<include name="lib/jta.jar" />
<include name="lib/antlr.jar" />
+ <include name="lib/asm.jar" />
<include name="examples/jpa/lib/jboss-archive-browsing.jar" />
</fileset>
17 years, 9 months
Seam SVN: r7666 - branches/Seam_2_0/examples/jpa.
by seam-commits@lists.jboss.org
Author: jbalunas(a)redhat.com
Date: 2008-03-20 15:31:25 -0400 (Thu, 20 Mar 2008)
New Revision: 7666
Modified:
branches/Seam_2_0/examples/jpa/build-tomcat55.xml
Log:
JBSEAM-2773
Modified: branches/Seam_2_0/examples/jpa/build-tomcat55.xml
===================================================================
--- branches/Seam_2_0/examples/jpa/build-tomcat55.xml 2008-03-20 19:06:36 UTC (rev 7665)
+++ branches/Seam_2_0/examples/jpa/build-tomcat55.xml 2008-03-20 19:31:25 UTC (rev 7666)
@@ -47,6 +47,7 @@
<include name="lib/hibernate-validator.jar"/>
<include name="examples/jpa/lib/jboss-archive-browsing.jar" />
<include name="lib/persistence-api.jar" />
+ <include name="lib/asm.jar" />
<include name="lib/cglib.jar"/>
<include name="lib/antlr.jar" />
</fileset>
17 years, 9 months
Seam SVN: r7665 - in trunk/src/main/org/jboss/seam: security and 1 other directory.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-03-20 15:06:36 -0400 (Thu, 20 Mar 2008)
New Revision: 7665
Modified:
trunk/src/main/org/jboss/seam/persistence/HibernatePersistenceProvider.java
trunk/src/main/org/jboss/seam/persistence/PersistenceProvider.java
trunk/src/main/org/jboss/seam/security/EntityPermissionChecker.java
Log:
pass in entity manager for getXXXMethod() methods
Modified: trunk/src/main/org/jboss/seam/persistence/HibernatePersistenceProvider.java
===================================================================
--- trunk/src/main/org/jboss/seam/persistence/HibernatePersistenceProvider.java 2008-03-20 18:59:19 UTC (rev 7664)
+++ trunk/src/main/org/jboss/seam/persistence/HibernatePersistenceProvider.java 2008-03-20 19:06:36 UTC (rev 7665)
@@ -323,25 +323,25 @@
}
/*@Override
- public Method getPostLoadMethod(Class beanClass)
+ public Method getPostLoadMethod(Class beanClass, EntityManager entityManager)
{
return null;
}
@Override
- public Method getPrePersistMethod(Class beanClass)
+ public Method getPrePersistMethod(Class beanClass, EntityManager entityManager)
{
return null;
}
@Override
- public Method getPreUpdateMethod(Class beanClass)
+ public Method getPreUpdateMethod(Class beanClass, EntityManager entityManager)
{
return null;
}
@Override
- public Method getPreRemoveMethod(Class beanClass)
+ public Method getPreRemoveMethod(Class beanClass, EntityManager entityManager)
{
return null;
}*/
Modified: trunk/src/main/org/jboss/seam/persistence/PersistenceProvider.java
===================================================================
--- trunk/src/main/org/jboss/seam/persistence/PersistenceProvider.java 2008-03-20 18:59:19 UTC (rev 7664)
+++ trunk/src/main/org/jboss/seam/persistence/PersistenceProvider.java 2008-03-20 19:06:36 UTC (rev 7665)
@@ -151,22 +151,22 @@
return Entity.forClass(bean.getClass()).getBeanClass();
}
- public Method getPostLoadMethod(Class beanClass)
+ public Method getPostLoadMethod(Class beanClass, EntityManager entityManager)
{
return Entity.forClass(beanClass).getPostLoadMethod();
}
- public Method getPrePersistMethod(Class beanClass)
+ public Method getPrePersistMethod(Class beanClass, EntityManager entityManager)
{
return Entity.forClass(beanClass).getPrePersistMethod();
}
- public Method getPreUpdateMethod(Class beanClass)
+ public Method getPreUpdateMethod(Class beanClass, EntityManager entityManager)
{
return Entity.forClass(beanClass).getPreUpdateMethod();
}
- public Method getPreRemoveMethod(Class beanClass)
+ public Method getPreRemoveMethod(Class beanClass, EntityManager entityManager)
{
return Entity.forClass(beanClass).getPreRemoveMethod();
}
Modified: trunk/src/main/org/jboss/seam/security/EntityPermissionChecker.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/EntityPermissionChecker.java 2008-03-20 18:59:19 UTC (rev 7664)
+++ trunk/src/main/org/jboss/seam/security/EntityPermissionChecker.java 2008-03-20 19:06:36 UTC (rev 7665)
@@ -83,21 +83,20 @@
String name = Seam.getComponentName(entity.getClass());
if (name == null) name = beanClass.getName();
- // TODO - replace getXXXMethod(class) with getXXXMethod(class, entityManager)
Method m = null;
switch (action)
{
case READ:
- m = provider.getPostLoadMethod(beanClass);
+ m = provider.getPostLoadMethod(beanClass, getEntityManager());
break;
case INSERT:
- m = provider.getPrePersistMethod(beanClass);
+ m = provider.getPrePersistMethod(beanClass, getEntityManager());
break;
case UPDATE:
- m = provider.getPreUpdateMethod(beanClass);
+ m = provider.getPreUpdateMethod(beanClass, getEntityManager());
break;
case DELETE:
- m = provider.getPreRemoveMethod(beanClass);
+ m = provider.getPreRemoveMethod(beanClass, getEntityManager());
}
Restrict restrict = null;
17 years, 9 months
Seam SVN: r7664 - branches/Seam_2_0/examples/jpa.
by seam-commits@lists.jboss.org
Author: jbalunas(a)redhat.com
Date: 2008-03-20 14:59:19 -0400 (Thu, 20 Mar 2008)
New Revision: 7664
Modified:
branches/Seam_2_0/examples/jpa/build-tomcat6.xml
Log:
JBSEAM-2773
Modified: branches/Seam_2_0/examples/jpa/build-tomcat6.xml
===================================================================
--- branches/Seam_2_0/examples/jpa/build-tomcat6.xml 2008-03-20 18:26:49 UTC (rev 7663)
+++ branches/Seam_2_0/examples/jpa/build-tomcat6.xml 2008-03-20 18:59:19 UTC (rev 7664)
@@ -39,6 +39,7 @@
<include name="lib/cglib.jar" />
<include name="lib/jta.jar" />
<include name="lib/antlr.jar" />
+ <include name="lib/asm.jar" />
<include name="examples/jpa/lib/jboss-archive-browsing.jar" />
</fileset>
17 years, 9 months
Seam SVN: r7663 - trunk/src/main/org/jboss/seam/security.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-03-20 14:26:49 -0400 (Thu, 20 Mar 2008)
New Revision: 7663
Added:
trunk/src/main/org/jboss/seam/security/EntityPermissionChecker.java
Modified:
trunk/src/main/org/jboss/seam/security/EntitySecurityListener.java
trunk/src/main/org/jboss/seam/security/HibernateSecurityInterceptor.java
trunk/src/main/org/jboss/seam/security/Identity.java
Log:
refactored entity permission checks
Added: trunk/src/main/org/jboss/seam/security/EntityPermissionChecker.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/EntityPermissionChecker.java (rev 0)
+++ trunk/src/main/org/jboss/seam/security/EntityPermissionChecker.java 2008-03-20 18:26:49 UTC (rev 7663)
@@ -0,0 +1,127 @@
+package org.jboss.seam.security;
+
+import static org.jboss.seam.ScopeType.APPLICATION;
+import static org.jboss.seam.annotations.Install.BUILT_IN;
+
+import java.lang.reflect.Method;
+
+import javax.persistence.EntityManager;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.Seam;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Startup;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.annotations.security.Restrict;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.persistence.PersistenceProvider;
+import org.jboss.seam.util.Strings;
+
+/**
+ * Entity permission checks
+ *
+ * @author Shane Bryzak
+ */
+@Name("org.jboss.seam.security.entityPermissionChecker")
+@Scope(APPLICATION)
+@Install(precedence = BUILT_IN)
+@BypassInterceptors
+@Startup
+public class EntityPermissionChecker
+{
+ private String entityManagerName = "entityManager";
+
+ private EntityManager getEntityManager()
+ {
+ return (EntityManager) Component.getInstance(entityManagerName);
+ }
+
+ public String getEntityManagerName()
+ {
+ return entityManagerName;
+ }
+
+ public void setEntityManagerName(String name)
+ {
+ this.entityManagerName = name;
+ }
+
+ public static EntityPermissionChecker instance()
+ {
+ if ( !Contexts.isApplicationContextActive() )
+ {
+ throw new IllegalStateException("No active application context");
+ }
+
+ EntityPermissionChecker instance = (EntityPermissionChecker) Component.getInstance(
+ EntityPermissionChecker.class, ScopeType.APPLICATION);
+
+ if (instance == null)
+ {
+ throw new IllegalStateException("No EntityPermissionChecker could be created");
+ }
+
+ return instance;
+ }
+
+ public void checkEntityPermission(Object entity, EntityAction action)
+ {
+ if (!Identity.isSecurityEnabled()) return;
+
+ Identity identity = Identity.instance();
+
+ identity.isLoggedIn(true);
+
+ PersistenceProvider provider = PersistenceProvider.instance();
+ Class beanClass = provider.getBeanClass(entity);
+
+ if (beanClass != null)
+ {
+ String name = Seam.getComponentName(entity.getClass());
+ if (name == null) name = beanClass.getName();
+
+ // TODO - replace getXXXMethod(class) with getXXXMethod(class, entityManager)
+ Method m = null;
+ switch (action)
+ {
+ case READ:
+ m = provider.getPostLoadMethod(beanClass);
+ break;
+ case INSERT:
+ m = provider.getPrePersistMethod(beanClass);
+ break;
+ case UPDATE:
+ m = provider.getPreUpdateMethod(beanClass);
+ break;
+ case DELETE:
+ m = provider.getPreRemoveMethod(beanClass);
+ }
+
+ Restrict restrict = null;
+
+ if (m != null && m.isAnnotationPresent(Restrict.class))
+ {
+ restrict = m.getAnnotation(Restrict.class);
+ }
+ else if (entity.getClass().isAnnotationPresent(Restrict.class))
+ {
+ restrict = entity.getClass().getAnnotation(Restrict.class);
+ }
+
+ if (restrict != null)
+ {
+ if (Strings.isEmpty(restrict.value()))
+ {
+ identity.checkPermission(entity, action.toString());
+ }
+ else
+ {
+ identity.checkRestriction(restrict.value());
+ }
+ }
+ }
+ }
+}
Modified: trunk/src/main/org/jboss/seam/security/EntitySecurityListener.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/EntitySecurityListener.java 2008-03-20 17:17:17 UTC (rev 7662)
+++ trunk/src/main/org/jboss/seam/security/EntitySecurityListener.java 2008-03-20 18:26:49 UTC (rev 7663)
@@ -21,36 +21,24 @@
@PostLoad
public void postLoad(Object entity)
{
- if (Identity.isSecurityEnabled())
- {
- Identity.instance().checkEntityPermission(entity, READ);
- }
+ EntityPermissionChecker.instance().checkEntityPermission(entity, READ);
}
@PrePersist
public void prePersist(Object entity)
{
- if (Identity.isSecurityEnabled())
- {
- Identity.instance().checkEntityPermission(entity, INSERT);
- }
+ EntityPermissionChecker.instance().checkEntityPermission(entity, INSERT);
}
@PreUpdate
public void preUpdate(Object entity)
{
- if (Identity.isSecurityEnabled())
- {
- Identity.instance().checkEntityPermission(entity, UPDATE);
- }
+ EntityPermissionChecker.instance().checkEntityPermission(entity, UPDATE);
}
@PreRemove
public void preRemove(Object entity)
{
- if (Identity.isSecurityEnabled())
- {
- Identity.instance().checkEntityPermission(entity, DELETE);
- }
+ EntityPermissionChecker.instance().checkEntityPermission(entity, DELETE);
}
}
Modified: trunk/src/main/org/jboss/seam/security/HibernateSecurityInterceptor.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/HibernateSecurityInterceptor.java 2008-03-20 17:17:17 UTC (rev 7662)
+++ trunk/src/main/org/jboss/seam/security/HibernateSecurityInterceptor.java 2008-03-20 18:26:49 UTC (rev 7663)
@@ -30,10 +30,8 @@
public boolean onLoad(Object entity, Serializable id, Object[] state,
String[] propertyNames, Type[] types)
{
- if (Identity.isSecurityEnabled())
- {
- Identity.instance().checkEntityPermission(entity, READ);
- }
+ EntityPermissionChecker.instance().checkEntityPermission(entity, READ);
+
return wrappedInterceptor != null ?
wrappedInterceptor.onLoad(entity, id, state, propertyNames, types) :
false;
@@ -43,10 +41,8 @@
public void onDelete(Object entity, Serializable id, Object[] state,
String[] propertyNames, Type[] types)
{
- if (Identity.isSecurityEnabled())
- {
- Identity.instance().checkEntityPermission(entity, DELETE);
- }
+ EntityPermissionChecker.instance().checkEntityPermission(entity, DELETE);
+
if (wrappedInterceptor != null)
wrappedInterceptor.onDelete(entity, id, state, propertyNames, types);
}
@@ -55,10 +51,8 @@
public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState,
Object[] previousState, String[] propertyNames, Type[] types)
{
- if (Identity.isSecurityEnabled())
- {
- Identity.instance().checkEntityPermission(entity, UPDATE);
- }
+ EntityPermissionChecker.instance().checkEntityPermission(entity, UPDATE);
+
return wrappedInterceptor != null ?
wrappedInterceptor.onFlushDirty(entity, id, currentState,
previousState, propertyNames, types) : false;
@@ -68,10 +62,8 @@
public boolean onSave(Object entity, Serializable id, Object[] state,
String[] propertyNames, Type[] types)
{
- if (Identity.isSecurityEnabled())
- {
- Identity.instance().checkEntityPermission(entity, INSERT);
- }
+ EntityPermissionChecker.instance().checkEntityPermission(entity, INSERT);
+
return wrappedInterceptor != null ?
wrappedInterceptor.onSave(entity, id, state, propertyNames, types) :
false;
Modified: trunk/src/main/org/jboss/seam/security/Identity.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/Identity.java 2008-03-20 17:17:17 UTC (rev 7662)
+++ trunk/src/main/org/jboss/seam/security/Identity.java 2008-03-20 18:26:49 UTC (rev 7663)
@@ -5,7 +5,6 @@
import java.io.IOException;
import java.io.Serializable;
-import java.lang.reflect.Method;
import java.security.Principal;
import java.security.acl.Group;
import java.util.ArrayList;
@@ -23,24 +22,19 @@
import org.jboss.seam.Component;
import org.jboss.seam.ScopeType;
-import org.jboss.seam.Seam;
import org.jboss.seam.annotations.Create;
-import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Install;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.Startup;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
-import org.jboss.seam.annotations.security.Restrict;
import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.core.Events;
import org.jboss.seam.core.Expressions;
import org.jboss.seam.core.Expressions.MethodExpression;
import org.jboss.seam.log.LogProvider;
import org.jboss.seam.log.Logging;
-import org.jboss.seam.persistence.PersistenceProvider;
import org.jboss.seam.security.permission.PermissionMapper;
-import org.jboss.seam.util.Strings;
import org.jboss.seam.web.Session;
/**
@@ -684,58 +678,5 @@
principal = savedPrincipal;
subject = savedSubject;
}
- }
-
- public void checkEntityPermission(Object entity, EntityAction action)
- {
- isLoggedIn(true);
-
- PersistenceProvider provider = PersistenceProvider.instance();
- Class beanClass = provider.getBeanClass(entity);
-
- if (beanClass != null)
- {
- String name = Seam.getComponentName(entity.getClass());
- if (name == null) name = beanClass.getName();
-
- Method m = null;
- switch (action)
- {
- case READ:
- m = provider.getPostLoadMethod(beanClass);
- break;
- case INSERT:
- m = provider.getPrePersistMethod(beanClass);
- break;
- case UPDATE:
- m = provider.getPreUpdateMethod(beanClass);
- break;
- case DELETE:
- m = provider.getPreRemoveMethod(beanClass);
- }
-
- Restrict restrict = null;
-
- if (m != null && m.isAnnotationPresent(Restrict.class))
- {
- restrict = m.getAnnotation(Restrict.class);
- }
- else if (entity.getClass().isAnnotationPresent(Restrict.class))
- {
- restrict = entity.getClass().getAnnotation(Restrict.class);
- }
-
- if (restrict != null)
- {
- if (Strings.isEmpty(restrict.value()))
- {
- checkPermission(entity, action.toString());
- }
- else
- {
- checkRestriction(restrict.value());
- }
- }
- }
- }
+ }
}
17 years, 9 months
Seam SVN: r7662 - trunk and 1 other directory.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-03-20 13:17:17 -0400 (Thu, 20 Mar 2008)
New Revision: 7662
Modified:
branches/Seam_2_0/readme.txt
trunk/readme.txt
Log:
JBSEAM-2701
Modified: branches/Seam_2_0/readme.txt
===================================================================
--- branches/Seam_2_0/readme.txt 2008-03-20 17:15:32 UTC (rev 7661)
+++ branches/Seam_2_0/readme.txt 2008-03-20 17:17:17 UTC (rev 7662)
@@ -49,4 +49,4 @@
----------
* Read the documentation in the "doc/reference/en" directory
-* Read the online FAQ http://labs.jboss.com/jbossseam/faq
+* Read the online FAQ http://www.seamframework.org
Modified: trunk/readme.txt
===================================================================
--- trunk/readme.txt 2008-03-20 17:15:32 UTC (rev 7661)
+++ trunk/readme.txt 2008-03-20 17:17:17 UTC (rev 7662)
@@ -49,4 +49,4 @@
----------
* Read the documentation in the "doc/reference/en" directory
-* Read the online FAQ http://labs.jboss.com/jbossseam/faq
+* Read the online FAQ http://www.seamframework.org
17 years, 9 months
Seam SVN: r7661 - trunk/seam-gen/build-scripts and 1 other directory.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-03-20 13:15:32 -0400 (Thu, 20 Mar 2008)
New Revision: 7661
Modified:
branches/Seam_2_0/seam-gen/build-scripts/build.xml
trunk/seam-gen/build-scripts/build.xml
Log:
JBSEAM-2770, thanks to Alexander Kosenkov
Modified: branches/Seam_2_0/seam-gen/build-scripts/build.xml
===================================================================
--- branches/Seam_2_0/seam-gen/build-scripts/build.xml 2008-03-20 16:25:25 UTC (rev 7660)
+++ branches/Seam_2_0/seam-gen/build-scripts/build.xml 2008-03-20 17:15:32 UTC (rev 7661)
@@ -148,15 +148,17 @@
<fileset dir="${lib.dir}">
<include name="jboss-seam.jar" />
</fileset>
- <fileset dir="${basedir}">
- <include name="lib/jbpm*.jar" />
- <include name="lib/jboss-el.jar" />
- <include name="lib/drools-*.jar"/>
- <include name="lib/core.jar"/>
- <include name="lib/janino*.jar"/>
- <include name="lib/antlr-*.jar"/>
- <include name="lib/mvel*.jar"/>
- <include name="lib/richfaces-api*.jar" />
+ </copy>
+ <copy todir="${ear.dir}/lib">
+ <fileset dir="${lib.dir}">
+ <include name="jbpm*.jar" />
+ <include name="jboss-el.jar" />
+ <include name="drools-*.jar"/>
+ <include name="core.jar"/>
+ <include name="janino*.jar"/>
+ <include name="antlr-*.jar"/>
+ <include name="mvel*.jar"/>
+ <include name="richfaces-api*.jar" />
</fileset>
</copy>
<copy todir="${ear.dir}/META-INF">
Modified: trunk/seam-gen/build-scripts/build.xml
===================================================================
--- trunk/seam-gen/build-scripts/build.xml 2008-03-20 16:25:25 UTC (rev 7660)
+++ trunk/seam-gen/build-scripts/build.xml 2008-03-20 17:15:32 UTC (rev 7661)
@@ -148,15 +148,17 @@
<fileset dir="${lib.dir}">
<include name="jboss-seam.jar" />
</fileset>
- <fileset dir="${basedir}">
- <include name="lib/jbpm*.jar" />
- <include name="lib/jboss-el.jar" />
- <include name="lib/drools-*.jar"/>
- <include name="lib/core.jar"/>
- <include name="lib/janino*.jar"/>
- <include name="lib/antlr-*.jar"/>
- <include name="lib/mvel*.jar"/>
- <include name="lib/richfaces-api*.jar" />
+ </copy>
+ <copy todir="${ear.dir}/lib">
+ <fileset dir="${lib.dir}">
+ <include name="jbpm*.jar" />
+ <include name="jboss-el.jar" />
+ <include name="drools-*.jar"/>
+ <include name="core.jar"/>
+ <include name="janino*.jar"/>
+ <include name="antlr-*.jar"/>
+ <include name="mvel*.jar"/>
+ <include name="richfaces-api*.jar" />
</fileset>
</copy>
<copy todir="${ear.dir}/META-INF">
17 years, 9 months