[seam-commits] Seam SVN: r13293 - in modules/security/trunk/impl: src/main/java/org/jboss/seam/security/management and 1 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Wed Jun 23 21:28:26 EDT 2010
Author: shane.bryzak at jboss.com
Date: 2010-06-23 21:28:26 -0400 (Wed, 23 Jun 2010)
New Revision: 13293
Modified:
modules/security/trunk/impl/pom.xml
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStoreSessionImpl.java
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/picketlink/IdentitySessionProducer.java
Log:
dependency exclusions, fix config issues
Modified: modules/security/trunk/impl/pom.xml
===================================================================
--- modules/security/trunk/impl/pom.xml 2010-06-23 23:51:37 UTC (rev 13292)
+++ modules/security/trunk/impl/pom.xml 2010-06-24 01:28:26 UTC (rev 13293)
@@ -52,22 +52,26 @@
<scope>provided</scope>
</dependency>
- <!--dependency>
+ <dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<scope>provided</scope>
- </dependency-->
-
- <dependency>
- <groupId>javax.persistence</groupId>
- <artifactId>persistence-api</artifactId>
- <version>1.0</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.seam.drools</groupId>
<artifactId>seam-drools-api</artifactId>
+
+ <exclusions>
+ <exclusion>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-xjc</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
@@ -79,6 +83,12 @@
<dependency>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-core</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
Modified: modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java
===================================================================
--- modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java 2010-06-23 23:51:37 UTC (rev 13292)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java 2010-06-24 01:28:26 UTC (rev 13293)
@@ -149,7 +149,17 @@
{
this.configurationContext = configurationContext;
- //configurationContext.getStoreConfigurationMetaData().getOptionSingleValue(optionName)
+ String clsName = configurationContext.getStoreConfigurationMetaData()
+ .getOptionSingleValue(OPTION_IDENTITY_CLASS_NAME);
+
+ try
+ {
+ identityClass = Class.forName(clsName);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new IdentityException("Error bootstrapping JpaIdentityStore - no identity entity class found: " + clsName);
+ }
if (identityClass == null)
{
@@ -203,7 +213,7 @@
Property<Object> p = findNamedProperty(identityClass, "username", "userName", "name");
if (p != null)
{
- modelProperties.put(PROPERTY_IDENTITY_NAME, props.get(0));
+ modelProperties.put(PROPERTY_IDENTITY_NAME, p);
}
else
{
@@ -826,18 +836,18 @@
return createIdentityObject(invocationCtx, name, identityObjectType, null);
}
- protected Object lookupIdentityType(String identityType) throws IdentityException
+ protected Object lookupIdentityType(String identityType, EntityManager em) throws IdentityException
{
try
{
Property<Object> typeNameProp = modelProperties.get(PROPERTY_IDENTITY_TYPE_NAME);
- Object val = null; /*entityManagerInstance.get().createQuery(
+ Object val = em.createQuery(
"select t from " + typeNameProp.getDeclaringClass().getName() +
" t where t." + typeNameProp.getName() +
" = :identityType")
.setParameter("identityType", identityType)
- .getSingleResult();*/
+ .getSingleResult();
return val;
}
catch (NoResultException ex)
@@ -864,7 +874,8 @@
}
else
{
- typeProp.setValue(identityInstance, lookupIdentityType(identityObjectType.getName()));
+ typeProp.setValue(identityInstance, lookupIdentityType(identityObjectType.getName(),
+ getEntityManager(invocationCtx)));
}
//beanManager.fireEvent(new PrePersistUserEvent(identityInstance));
@@ -945,19 +956,23 @@
// TODO Auto-generated method stub
return null;
}
+
+ public EntityManager getEntityManager(IdentityStoreInvocationContext invocationContext)
+ {
+ return ((JpaIdentityStoreSessionImpl) invocationContext.getIdentityStoreSession()).getEntityManager();
+ }
- public IdentityObject findIdentityObject(
- IdentityStoreInvocationContext invocationContext, String id)
+ public IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationContext, String id)
throws IdentityException
{
try
{
- Object identity = null; /*entityManagerInstance.get().createQuery("select i from " +
+ Object identity = getEntityManager(invocationContext).createQuery("select i from " +
identityClass.getName() + " i where i." +
modelProperties.get(PROPERTY_IDENTITY_ID).getName() +
" = :id")
.setParameter("id", id)
- .getSingleResult();*/
+ .getSingleResult();
IdentityObjectType type = modelProperties.containsKey(PROPERTY_IDENTITY_TYPE_NAME) ?
new IdentityObjectTypeImpl(
@@ -990,17 +1005,17 @@
try
{
Object identityType = modelProperties.containsKey(PROPERTY_IDENTITY_TYPE_NAME) ?
- lookupIdentityType(identityObjectType.getName()) :
+ lookupIdentityType(identityObjectType.getName(), getEntityManager(invocationContext)) :
identityObjectType.getName();
- Object identity = null; //entityManagerInstance.get().createQuery("select i from " +
- /*identityClass.getName() + " i where i." +
+ Object identity = getEntityManager(invocationContext).createQuery("select i from " +
+ identityClass.getName() + " i where i." +
modelProperties.get(PROPERTY_IDENTITY_NAME).getName() +
" = :name and i." + modelProperties.get(PROPERTY_IDENTITY_TYPE).getName() +
" = :type")
.setParameter("name", name)
.setParameter("type", identityType)
- .getSingleResult();*/
+ .getSingleResult();
return new IdentityObjectImpl(
modelProperties.get(PROPERTY_IDENTITY_ID).getValue(identity).toString(),
Modified: modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStoreSessionImpl.java
===================================================================
--- modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStoreSessionImpl.java 2010-06-23 23:51:37 UTC (rev 13292)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStoreSessionImpl.java 2010-06-24 01:28:26 UTC (rev 13293)
@@ -20,6 +20,11 @@
this.em = em;
}
+ public EntityManager getEntityManager()
+ {
+ return em;
+ }
+
public void clear() throws IdentityException
{
em.clear();
Modified: modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/picketlink/IdentitySessionProducer.java
===================================================================
--- modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/picketlink/IdentitySessionProducer.java 2010-06-23 23:51:37 UTC (rev 13292)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/picketlink/IdentitySessionProducer.java 2010-06-24 01:28:26 UTC (rev 13293)
@@ -50,9 +50,13 @@
IdentityStoreConfigurationMetaDataImpl store = new IdentityStoreConfigurationMetaDataImpl();
store.setId("jpa");
store.setClassName("org.jboss.seam.security.management.JpaIdentityStore");
+
+ // temporary hack
Map<String,List<String>> options = new HashMap<String,List<String>>();
options.put(JpaIdentityStore.OPTION_IDENTITY_CLASS_NAME,
createOptionList("org.jboss.seam.security.examples.idmconsole.model.IdentityObject"));
+
+
store.setOptions(options);
stores.add(store);
metadata.setIdentityStores(stores);
More information about the seam-commits
mailing list