Seam SVN: r8008 - branches/Seam_2_0/seam-gen/icefaces/src.
by seam-commits@lists.jboss.org
Author: jguglielmin
Date: 2008-04-23 10:39:35 -0400 (Wed, 23 Apr 2008)
New Revision: 8008
Removed:
branches/Seam_2_0/seam-gen/icefaces/src/TimerBean.java
Modified:
branches/Seam_2_0/seam-gen/icefaces/src/TimerBeanImpl.java
Log:
fixes as per http://jira.icefaces.org/browse/ICE-2684
Also added resizable columns to dataTables in <entity>list view
Deleted: branches/Seam_2_0/seam-gen/icefaces/src/TimerBean.java
===================================================================
--- branches/Seam_2_0/seam-gen/icefaces/src/TimerBean.java 2008-04-23 14:36:31 UTC (rev 8007)
+++ branches/Seam_2_0/seam-gen/icefaces/src/TimerBean.java 2008-04-23 14:39:35 UTC (rev 8008)
@@ -1,56 +0,0 @@
-/*
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * "The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
- * License for the specific language governing rights and limitations under
- * the License.
- *
- * The Original Code is ICEfaces 1.5 open source software code, released
- * November 5, 2006. The Initial Developer of the Original Code is ICEsoft
- * Technologies Canada, Corp. Portions created by ICEsoft are Copyright (C)
- * 2004-2006 ICEsoft Technologies Canada, Corp. All Rights Reserved.
- *
- * Contributor(s): _____________________.
- *
- * Alternatively, the contents of this file may be used under the terms of
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"
- * License), in which case the provisions of the LGPL License are
- * applicable instead of those above. If you wish to allow use of your
- * version of this file only under the terms of the LGPL License and not to
- * allow others to use your version of this file under the MPL, indicate
- * your decision by deleting the provisions above and replace them with
- * the notice and other provisions required by the LGPL License. If you do
- * not delete the provisions above, a recipient may use your version of
- * this file under either the MPL or the LGPL License."
- *
- */
-package @actionPackage@;
-
-
-import javax.ejb.Local;
-import com.icesoft.faces.context.effects.Effect;
-/**
- * @author ICEsoft Technologies, Inc.
- */
-@Local
-public interface TimerBean {
-
- public String getCurrentTime();
- public String getRenderMode();
- public void remove();
- public String getCurrentConversation();
-
- public String getLongRunning();
- public boolean getExpanded();
- public void setExpanded(boolean expanded);
- public boolean isVisibility() ;
- public void setVisibility(boolean visibility);
- public String toggleExpanded();
- public Effect getExpandEffect();
-}
Modified: branches/Seam_2_0/seam-gen/icefaces/src/TimerBeanImpl.java
===================================================================
--- branches/Seam_2_0/seam-gen/icefaces/src/TimerBeanImpl.java 2008-04-23 14:36:31 UTC (rev 8007)
+++ branches/Seam_2_0/seam-gen/icefaces/src/TimerBeanImpl.java 2008-04-23 14:39:35 UTC (rev 8008)
@@ -53,7 +53,6 @@
import com.icesoft.faces.async.render.RenderManager;
import com.icesoft.faces.async.render.IntervalRenderer;
import com.icesoft.faces.async.render.Renderable;
-import com.icesoft.faces.context.ViewListener;
import com.icesoft.faces.context.effects.Effect;
import com.icesoft.faces.context.effects.BlindDown;
@@ -69,7 +68,7 @@
@Name("timer")
@Scope(ScopeType.PAGE)
-public class TimerBeanImpl implements Renderable, ViewListener, Serializable {
+public class TimerBeanImpl implements Renderable, Serializable {
// expand/contract effects to take place of panelCollapsible
private Effect currentEffect=new BlindUp();
@@ -175,7 +174,6 @@
log.trace("*** new TimerBean renderable... " + myId );
}
- state.addViewListener(this );
FacesContext fc = FacesContext.getCurrentInstance();
synchronous = (String) fc.getExternalContext().getInitParameterMap().
get( "com.icesoft.faces.synchronousUpdate" );
@@ -222,16 +220,7 @@
cleanup();
}
- public void viewCreated() {
- }
-
- public void viewDisposed() {
- if(log.isTraceEnabled() ) {
- log.trace("*** View disposed: " + myId );
- }
- cleanup();
- }
-
+
private void cleanup() {
if (ir != null) {
ir.remove(this);
16 years, 9 months
Seam SVN: r8007 - branches/Seam_2_0/seam-gen/icefaces/view.
by seam-commits@lists.jboss.org
Author: jguglielmin
Date: 2008-04-23 10:36:31 -0400 (Wed, 23 Apr 2008)
New Revision: 8007
Modified:
branches/Seam_2_0/seam-gen/icefaces/view/editproperty.xhtml.ftl
Log:
fixes as per http://jira.icefaces.org/browse/ICE-2684
Also added resizable columns to dataTables in <entity>list view
Modified: branches/Seam_2_0/seam-gen/icefaces/view/editproperty.xhtml.ftl
===================================================================
--- branches/Seam_2_0/seam-gen/icefaces/view/editproperty.xhtml.ftl 2008-04-23 01:53:12 UTC (rev 8006)
+++ branches/Seam_2_0/seam-gen/icefaces/view/editproperty.xhtml.ftl 2008-04-23 14:36:31 UTC (rev 8007)
@@ -101,8 +101,8 @@
</#if>
size="${size}"
maxlength="${column.length}"
+ partialSubmit="true"
value="${'#'}{${homeName}.instance.${property.name}.${componentProperty.name}}">
- partialSubmit="true"
</ice:inputText>
</#if>
<#else>
@@ -113,8 +113,8 @@
<#if propertyIsId>
disabled="${'#'}{${homeName}.managed}"
</#if>
+ partialSubmit="true"
value="${'#'}{${homeName}.instance.${property.name}.${componentProperty.name}}">
- partialSubmit="true"
</ice:inputText>
</#if>
</s:decorate>
16 years, 9 months
Seam SVN: r8006 - trunk/src/main/org/jboss/seam.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-04-22 21:53:12 -0400 (Tue, 22 Apr 2008)
New Revision: 8006
Modified:
trunk/src/main/org/jboss/seam/Seam.java
Log:
JBSEAM-2917 optimized cache initialization
Modified: trunk/src/main/org/jboss/seam/Seam.java
===================================================================
--- trunk/src/main/org/jboss/seam/Seam.java 2008-04-23 01:51:30 UTC (rev 8005)
+++ trunk/src/main/org/jboss/seam/Seam.java 2008-04-23 01:53:12 UTC (rev 8006)
@@ -11,7 +11,9 @@
import static org.jboss.seam.util.EJB.STATELESS;
import static org.jboss.seam.util.EJB.name;
+import java.util.HashSet;
import java.util.Map;
+import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import javax.persistence.Entity;
@@ -40,6 +42,7 @@
private static final Map<Class, String> COMPONENT_NAME_CACHE = new ConcurrentHashMap<Class, String>();
private static final Map<Class, EjbDescriptor> EJB_DESCRIPTOR_CACHE = new ConcurrentHashMap<Class, EjbDescriptor>();
+ private static final Set<ClassLoader> CLASSLOADERS_LOADED = new HashSet<ClassLoader>();
private static EjbDescriptor getEjbDescriptor(Class clazz)
{
@@ -48,12 +51,16 @@
{
return info;
}
- else
+ else if (clazz.getClassLoader() == null ||
+ (clazz.getClassLoader() != null && !CLASSLOADERS_LOADED.contains(clazz.getClassLoader())))
{
Map<Class, EjbDescriptor> ejbDescriptors = new DeploymentDescriptor(clazz).getEjbDescriptors();
EJB_DESCRIPTOR_CACHE.putAll(ejbDescriptors);
+ CLASSLOADERS_LOADED.add(clazz.getClassLoader());
return ejbDescriptors.get(clazz);
}
+
+ return null;
}
/**
@@ -313,6 +320,7 @@
{
COMPONENT_NAME_CACHE.clear();
EJB_DESCRIPTOR_CACHE.clear();
+ CLASSLOADERS_LOADED.clear();
}
}
16 years, 9 months
Seam SVN: r8005 - trunk/src/test/unit/org/jboss/seam/test/unit.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-04-22 21:51:30 -0400 (Tue, 22 Apr 2008)
New Revision: 8005
Modified:
trunk/src/test/unit/org/jboss/seam/test/unit/PasswordHashTest.java
Log:
fix PasswordHashTest
Modified: trunk/src/test/unit/org/jboss/seam/test/unit/PasswordHashTest.java
===================================================================
--- trunk/src/test/unit/org/jboss/seam/test/unit/PasswordHashTest.java 2008-04-22 09:09:05 UTC (rev 8004)
+++ trunk/src/test/unit/org/jboss/seam/test/unit/PasswordHashTest.java 2008-04-23 01:51:30 UTC (rev 8005)
@@ -8,14 +8,16 @@
@Test
public void testMd5Hash()
{
- String hash = PasswordHash.instance().generateHash("secret", "MD5");
+ PasswordHash passwordHash = new PasswordHash();
+ String hash = passwordHash.generateHash("secret", "MD5");
assert hash.equals("Xr4ilOzQ4PCOq3aQ0qbuaQ==");
}
@Test
public void testShaHash()
{
- String hash = PasswordHash.instance().generateHash("secret", "SHA");
+ PasswordHash passwordHash = new PasswordHash();
+ String hash = passwordHash.generateHash("secret", "SHA");
assert hash.equals("5en6G6MezRroT3XKqkdPOmY/BfQ=");
}
}
16 years, 9 months
Seam SVN: r8004 - branches/Seam_2_0/examples/jpa and 2 other directories.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-04-22 05:09:05 -0400 (Tue, 22 Apr 2008)
New Revision: 8004
Modified:
branches/Seam_2_0/examples/hibernate/build.xml
branches/Seam_2_0/examples/jpa/build.xml
trunk/examples/hibernate/build.xml
trunk/examples/jpa/build.xml
Log:
Add emedded jboss to clean target
Modified: branches/Seam_2_0/examples/hibernate/build.xml
===================================================================
--- branches/Seam_2_0/examples/hibernate/build.xml 2008-04-22 04:53:54 UTC (rev 8003)
+++ branches/Seam_2_0/examples/hibernate/build.xml 2008-04-22 09:09:05 UTC (rev 8004)
@@ -46,6 +46,7 @@
<ant antfile="build-websphere61.xml" target="clean" />
<ant antfile="build-tomcat55.xml" target="clean" />
<ant antfile="build-tomcat6.xml" target="clean" />
+ <ant antfile="build-jboss-embedded.xml" target="clean" />
</target>
<target name="all" depends="jboss, jboss405, glassfish, weblogic92, websphere61, tomcat55, tomcat6" description="Build Hibernate Booking example, for deployment to all supported application servers"/>
Modified: branches/Seam_2_0/examples/jpa/build.xml
===================================================================
--- branches/Seam_2_0/examples/jpa/build.xml 2008-04-22 04:53:54 UTC (rev 8003)
+++ branches/Seam_2_0/examples/jpa/build.xml 2008-04-22 09:09:05 UTC (rev 8004)
@@ -46,6 +46,7 @@
<ant antfile="build-websphere61.xml" target="clean" />
<ant antfile="build-tomcat55.xml" target="clean" />
<ant antfile="build-tomcat6.xml" target="clean" />
+ <ant antfile="build-jboss-embedded.xml" target="clean" />
</target>
<target name="all" depends="jboss, jboss405, glassfish, weblogic92, websphere61, tomcat55, tomcat6"/>
Modified: trunk/examples/hibernate/build.xml
===================================================================
--- trunk/examples/hibernate/build.xml 2008-04-22 04:53:54 UTC (rev 8003)
+++ trunk/examples/hibernate/build.xml 2008-04-22 09:09:05 UTC (rev 8004)
@@ -46,6 +46,7 @@
<ant antfile="build-websphere61.xml" target="clean" />
<ant antfile="build-tomcat55.xml" target="clean" />
<ant antfile="build-tomcat6.xml" target="clean" />
+ <ant antfile="build-jboss-embedded.xml" target="clean" />
</target>
<target name="all" depends="jboss, jboss405, glassfish, weblogic92, websphere61, tomcat55, tomcat6" description="Build Hibernate Booking example, for deployment to all supported application servers"/>
Modified: trunk/examples/jpa/build.xml
===================================================================
--- trunk/examples/jpa/build.xml 2008-04-22 04:53:54 UTC (rev 8003)
+++ trunk/examples/jpa/build.xml 2008-04-22 09:09:05 UTC (rev 8004)
@@ -46,6 +46,7 @@
<ant antfile="build-websphere61.xml" target="clean" />
<ant antfile="build-tomcat55.xml" target="clean" />
<ant antfile="build-tomcat6.xml" target="clean" />
+ <ant antfile="build-jboss-embedded.xml" target="clean" />
</target>
<target name="all" depends="jboss, jboss405, glassfish, weblogic92, websphere61, tomcat55, tomcat6"/>
16 years, 9 months
Seam SVN: r8003 - trunk/src/main/org/jboss/seam/security/permission.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-04-22 00:53:54 -0400 (Tue, 22 Apr 2008)
New Revision: 8003
Modified:
trunk/src/main/org/jboss/seam/security/permission/PersistentPermissionResolver.java
Log:
fix log message
Modified: trunk/src/main/org/jboss/seam/security/permission/PersistentPermissionResolver.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/permission/PersistentPermissionResolver.java 2008-04-22 04:52:31 UTC (rev 8002)
+++ trunk/src/main/org/jboss/seam/security/permission/PersistentPermissionResolver.java 2008-04-22 04:53:54 UTC (rev 8003)
@@ -51,7 +51,7 @@
if (permissionStore == null)
{
log.warn("no permission store available - please install a PermissionStore with the name '" +
- DEFAULT_PERMISSION_STORE_NAME + "' if dynamic permissions are required.");
+ Seam.getComponentName(JpaPermissionStore.class) + "' if dynamic permissions are required.");
}
}
16 years, 9 months
Seam SVN: r8002 - trunk/src/main/org/jboss/seam/security/permission.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-04-22 00:52:31 -0400 (Tue, 22 Apr 2008)
New Revision: 8002
Added:
trunk/src/main/org/jboss/seam/security/permission/JpaPermissionStore.java
Removed:
trunk/src/main/org/jboss/seam/security/permission/JpaDynamicPermissionStore.java
Modified:
trunk/src/main/org/jboss/seam/security/permission/PersistentPermissionResolver.java
Log:
rename
Deleted: trunk/src/main/org/jboss/seam/security/permission/JpaDynamicPermissionStore.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/permission/JpaDynamicPermissionStore.java 2008-04-22 04:49:09 UTC (rev 8001)
+++ trunk/src/main/org/jboss/seam/security/permission/JpaDynamicPermissionStore.java 2008-04-22 04:52:31 UTC (rev 8002)
@@ -1,440 +0,0 @@
-package org.jboss.seam.security.permission;
-
-import static org.jboss.seam.ScopeType.APPLICATION;
-import static org.jboss.seam.annotations.Install.BUILT_IN;
-
-import java.io.Serializable;
-import java.security.Principal;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.persistence.EntityManager;
-import javax.persistence.NoResultException;
-import javax.persistence.Query;
-
-import org.jboss.seam.Component;
-import org.jboss.seam.annotations.Create;
-import org.jboss.seam.annotations.Install;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.intercept.BypassInterceptors;
-import org.jboss.seam.annotations.security.permission.PermissionAction;
-import org.jboss.seam.annotations.security.permission.PermissionDiscriminator;
-import org.jboss.seam.annotations.security.permission.PermissionRole;
-import org.jboss.seam.annotations.security.permission.PermissionTarget;
-import org.jboss.seam.annotations.security.permission.PermissionUser;
-import org.jboss.seam.core.Expressions;
-import org.jboss.seam.core.Expressions.ValueExpression;
-import org.jboss.seam.log.LogProvider;
-import org.jboss.seam.log.Logging;
-import org.jboss.seam.security.Role;
-import org.jboss.seam.security.SimplePrincipal;
-import org.jboss.seam.security.management.JpaIdentityStore;
-import org.jboss.seam.util.AnnotatedBeanProperty;
-
-/**
- * A permission store implementation that uses JPA as its persistence mechanism.
- *
- * @author Shane Bryzak
- */
-@Name("org.jboss.seam.security.permission.jpaDynamicPermissionStore")
-@Install(precedence = BUILT_IN, value=false)
-@Scope(APPLICATION)
-@BypassInterceptors
-public class JpaDynamicPermissionStore implements PermissionStore, Serializable
-{
- private static final LogProvider log = Logging.getLogProvider(JpaDynamicPermissionStore.class);
-
- private ValueExpression<EntityManager> entityManager;
-
- private Class userPermissionClass;
- private Class rolePermissionClass;
-
- private AnnotatedBeanProperty<PermissionUser> userProperty;
- private AnnotatedBeanProperty<PermissionRole> roleProperty;
-
- private AnnotatedBeanProperty<PermissionTarget> targetProperty;
- private AnnotatedBeanProperty<PermissionAction> actionProperty;
- private AnnotatedBeanProperty<PermissionDiscriminator> discriminatorProperty;
-
- private AnnotatedBeanProperty<PermissionTarget> roleTargetProperty;
- private AnnotatedBeanProperty<PermissionAction> roleActionProperty;
-
- private String selectUserPermissionQuery;
- private String selectRolePermissionQuery;
-
- @Create
- public void init()
- {
- if (userPermissionClass == null)
- {
- log.debug("No permissionClass set, JpaDynamicPermissionStore will be unavailable.");
- return;
- }
-
- if (entityManager == null)
- {
- entityManager = Expressions.instance().createValueExpression("#{entityManager}", EntityManager.class);
- }
-
- initProperties();
- buildQueries();
- }
-
- protected void initProperties()
- {
- userProperty = AnnotatedBeanProperty.scanForProperty(userPermissionClass, PermissionUser.class);
- targetProperty = AnnotatedBeanProperty.scanForProperty(userPermissionClass, PermissionTarget.class);
- actionProperty = AnnotatedBeanProperty.scanForProperty(userPermissionClass, PermissionAction.class);
-
- if (rolePermissionClass != null)
- {
- roleProperty = AnnotatedBeanProperty.scanForProperty(rolePermissionClass, PermissionRole.class);
- if (roleProperty != null)
- {
- roleTargetProperty = AnnotatedBeanProperty.scanForProperty(rolePermissionClass, PermissionTarget.class);
- roleActionProperty = AnnotatedBeanProperty.scanForProperty(rolePermissionClass, PermissionAction.class);
- }
- }
- else
- {
- roleProperty = AnnotatedBeanProperty.scanForProperty(userPermissionClass, PermissionRole.class);
- if (roleProperty != null)
- {
- discriminatorProperty = AnnotatedBeanProperty.scanForProperty(userPermissionClass, PermissionDiscriminator.class);
- }
- }
-
- if (userProperty == null)
- {
- throw new RuntimeException("Invalid userPermissionClass " + userPermissionClass.getName() +
- " - required annotation @PermissionUser not found on any Field or Method.");
- }
-
- if (rolePermissionClass != null)
- {
- if (roleProperty == null)
- {
- throw new RuntimeException("Invalid rolePermissionClass " + rolePermissionClass.getName() +
- " - required annotation @PermissionRole not found on any Field or Method.");
- }
-
- if (roleTargetProperty == null)
- {
- throw new RuntimeException("Invalid rolePermissionClass " + rolePermissionClass.getName() +
- " - required annotation @PermissionTarget not found on any Field or Method.");
- }
-
- if (roleActionProperty == null)
- {
- throw new RuntimeException("Invalid rolePermissionClass " + rolePermissionClass.getName() +
- " - required annotation @PermissionAction not found on any Field or Method.");
- }
- }
- else if (discriminatorProperty == null)
- {
- throw new RuntimeException("Invalid userPermissionClass " + rolePermissionClass.getName() +
- " - no rolePermissionClass set and @PermissionDiscriminator annotation not found on " +
- "any Field or Method");
- }
- }
-
- protected void buildQueries()
- {
- StringBuffer query = new StringBuffer();
- query.append("select p from ");
- query.append(userPermissionClass.getName());
- query.append(" p where ");
- query.append(targetProperty.getName());
- query.append(" = :target and ");
- query.append(actionProperty.getName());
- query.append(" = :action");
-
- selectUserPermissionQuery = query.toString();
-
- if (rolePermissionClass != null)
- {
- query.setLength(0);
- query.append("select p from ");
- query.append(rolePermissionClass.getName());
- query.append(" p where ");
- query.append(roleTargetProperty.getName());
- query.append(" = :target and ");
- query.append(roleActionProperty.getName());
- query.append(" = :action");
-
- selectRolePermissionQuery = query.toString();
- }
- else
- {
- selectRolePermissionQuery = selectUserPermissionQuery;
- }
- }
-
- public boolean grantPermission(Permission permission)
- {
- boolean recipientIsRole = permission.getRecipient() instanceof Role;
-
- try
- {
- if (recipientIsRole)
- {
- if (rolePermissionClass != null)
- {
- Object instance = rolePermissionClass.newInstance();
- roleTargetProperty.setValue(instance, permission.getTarget().toString());
- roleActionProperty.setValue(instance, permission.getAction());
- roleProperty.setValue(instance, permission.getRecipient().getName());
- lookupEntityManager().persist(instance);
- return true;
- }
-
- if (discriminatorProperty == null)
- {
- throw new RuntimeException("Could not grant permission, rolePermissionClass not set");
- }
- }
-
- if (userPermissionClass == null)
- {
- throw new RuntimeException("Could not grant permission, userPermissionClass not set");
- }
-
- Object instance = userPermissionClass.newInstance();
- targetProperty.setValue(instance, permission.getTarget().toString());
- actionProperty.setValue(instance, permission.getAction());
- userProperty.setValue(instance, resolvePrincipal(permission.getRecipient()));
-
- if (discriminatorProperty != null)
- {
- discriminatorProperty.setValue(instance, getDiscriminatorValue(recipientIsRole));
- }
-
- lookupEntityManager().persist(instance);
-
- return true;
- }
- catch (Exception ex)
- {
- throw new RuntimeException("Could not grant permission", ex);
- }
- }
-
- private String getDiscriminatorValue(boolean isRole)
- {
- PermissionDiscriminator discriminator = (PermissionDiscriminator) discriminatorProperty.getAnnotation();
- return isRole ? discriminator.roleValue() : discriminator.userValue();
- }
-
- public boolean revokePermission(Permission permission)
- {
- boolean recipientIsRole = permission.getRecipient() instanceof Role;
-
- EntityManager em = lookupEntityManager();
-
- Query qry = em.createQuery(recipientIsRole ? selectRolePermissionQuery :
- selectUserPermissionQuery)
- .setParameter("target", permission.getTarget())
- .setParameter("action", permission.getAction())
- .setParameter("recipient", resolvePrincipal(permission.getRecipient()));
-
- if (discriminatorProperty != null)
- {
- qry.setParameter("discriminator", getDiscriminatorValue(recipientIsRole));
- }
-
- try
- {
- Object instance = qry.getSingleResult();
- em.remove(instance);
- return true;
- }
- catch (NoResultException ex)
- {
- return false;
- }
- }
-
- /**
- * If the user or role properties in the entity class refer to other entities, then this method
- * uses the JpaIdentityStore (if available) to lookup that user or role entity. Otherwise it
- * simply returns the name of the recipient.
- *
- * @param recipient
- * @return
- */
- protected Object resolvePrincipal(Principal recipient)
- {
- boolean recipientIsRole = recipient instanceof Role;
-
- JpaIdentityStore identityStore = (JpaIdentityStore) Component.getInstance(JpaIdentityStore.class, true);
-
- if (identityStore != null)
- {
- if (recipientIsRole && roleProperty != null && roleProperty.getPropertyClass().equals(identityStore.getRoleClass()))
- {
- return identityStore.lookupRole(recipient.getName());
- }
- else if (userProperty.getPropertyClass().equals(identityStore.getUserClass()))
- {
- return identityStore.lookupUser(recipient.getName());
- }
- }
-
- return recipient.getName();
- }
-
- protected String resolvePrincipalName(Object principal, boolean isUser
- )
- {
- if (principal instanceof String)
- {
- return (String) principal;
- }
-
- JpaIdentityStore identityStore = (JpaIdentityStore) Component.getInstance(JpaIdentityStore.class, true);
-
- if (identityStore != null)
- {
- if (isUser && identityStore.getUserClass().equals(principal.getClass()))
- {
- return identityStore.getUserName(principal);
- }
-
- if (!isUser && identityStore.getRoleClass().equals(principal.getClass()))
- {
- return identityStore.getRoleName(principal);
- }
- }
-
- throw new IllegalArgumentException("Cannot resolve principal name for principal " + principal);
- }
-
- public List<Permission> listPermissions(Object target, String action)
- {
- List<Permission> permissions = new ArrayList<Permission>();
-
- Query permissionQuery = lookupEntityManager().createQuery(selectUserPermissionQuery)
- .setParameter("target", target);
-
- if (action != null)
- {
- permissionQuery.setParameter("action", action);
- }
-
- List userPermissions = permissionQuery.getResultList();
-
- Map<String,Principal> principalCache = new HashMap<String,Principal>();
-
- boolean useDiscriminator = rolePermissionClass == null && discriminatorProperty != null;
-
- for (Object permission : userPermissions)
- {
- Principal principal;
- boolean isUser = true;
-
- if (useDiscriminator &&
- discriminatorProperty.getAnnotation().roleValue().equals(discriminatorProperty.getValue(permission)))
- {
- isUser = false;
- }
-
- String name = resolvePrincipalName(isUser ? userProperty.getValue(permission) :
- roleProperty.getValue(permission), isUser);
-
- String key = (isUser ? "user:" : "role:") + name;
-
- if (!principalCache.containsKey(key))
- {
- principal = isUser ? new SimplePrincipal(name) : new Role(name);
- principalCache.put(key, principal);
- }
- else
- {
- principal = principalCache.get(key);
- }
-
- permissions.add(new Permission(target, (String) (action != null ? action : actionProperty.getValue(permission)),
- principal));
- }
-
- if (rolePermissionClass == null)
- {
- permissionQuery = lookupEntityManager().createQuery(selectRolePermissionQuery)
- .setParameter("target", target);
-
- if (action != null)
- {
- permissionQuery.setParameter("action", action);
- }
-
- List rolePermissions = permissionQuery.getResultList();
-
- for (Object permission : rolePermissions)
- {
- Principal principal;
-
- String name = resolvePrincipalName(roleProperty.getValue(permission), false);
- String key = "role:" + name;
-
- if (!principalCache.containsKey(key))
- {
- principal = new Role(name);
- principalCache.put(key, principal);
- }
- else
- {
- principal = principalCache.get(key);
- }
-
- permissions.add(new Permission(target, (String) (action != null ? action :
- roleActionProperty.getValue(permission)), principal));
- }
- }
-
- return permissions;
- }
-
- public List<Permission> listPermissions(Object target)
- {
- return listPermissions(target, null);
- }
-
- private EntityManager lookupEntityManager()
- {
- return entityManager.getValue();
- }
-
- public ValueExpression getEntityManager()
- {
- return entityManager;
- }
-
- public void setEntityManager(ValueExpression expression)
- {
- this.entityManager = expression;
- }
-
- public Class getUserPermissionClass()
- {
- return userPermissionClass;
- }
-
- public void setUserPermissionClass(Class userPermissionClass)
- {
- this.userPermissionClass = userPermissionClass;
- }
-
- public Class getRolePermissionClass()
- {
- return rolePermissionClass;
- }
-
- public void setRolePermissionClass(Class rolePermissionClass)
- {
- this.rolePermissionClass = rolePermissionClass;
- }
-}
Added: trunk/src/main/org/jboss/seam/security/permission/JpaPermissionStore.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/permission/JpaPermissionStore.java (rev 0)
+++ trunk/src/main/org/jboss/seam/security/permission/JpaPermissionStore.java 2008-04-22 04:52:31 UTC (rev 8002)
@@ -0,0 +1,439 @@
+package org.jboss.seam.security.permission;
+
+import static org.jboss.seam.ScopeType.APPLICATION;
+import static org.jboss.seam.annotations.Install.BUILT_IN;
+
+import java.io.Serializable;
+import java.security.Principal;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.NoResultException;
+import javax.persistence.Query;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.annotations.security.permission.PermissionAction;
+import org.jboss.seam.annotations.security.permission.PermissionDiscriminator;
+import org.jboss.seam.annotations.security.permission.PermissionRole;
+import org.jboss.seam.annotations.security.permission.PermissionTarget;
+import org.jboss.seam.annotations.security.permission.PermissionUser;
+import org.jboss.seam.core.Expressions;
+import org.jboss.seam.core.Expressions.ValueExpression;
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
+import org.jboss.seam.security.Role;
+import org.jboss.seam.security.SimplePrincipal;
+import org.jboss.seam.security.management.JpaIdentityStore;
+import org.jboss.seam.util.AnnotatedBeanProperty;
+
+/**
+ * A permission store implementation that uses JPA as its persistence mechanism.
+ *
+ * @author Shane Bryzak
+ */
+@Name("org.jboss.seam.security.permission.jpaPermissionStore")
+@Install(precedence = BUILT_IN, value=false)
+@Scope(APPLICATION)
+@BypassInterceptors
+public class JpaPermissionStore implements PermissionStore, Serializable
+{
+ private static final LogProvider log = Logging.getLogProvider(JpaPermissionStore.class);
+
+ private ValueExpression<EntityManager> entityManager;
+
+ private Class userPermissionClass;
+ private Class rolePermissionClass;
+
+ private AnnotatedBeanProperty<PermissionUser> userProperty;
+ private AnnotatedBeanProperty<PermissionRole> roleProperty;
+
+ private AnnotatedBeanProperty<PermissionTarget> targetProperty;
+ private AnnotatedBeanProperty<PermissionAction> actionProperty;
+ private AnnotatedBeanProperty<PermissionDiscriminator> discriminatorProperty;
+
+ private AnnotatedBeanProperty<PermissionTarget> roleTargetProperty;
+ private AnnotatedBeanProperty<PermissionAction> roleActionProperty;
+
+ private String selectUserPermissionQuery;
+ private String selectRolePermissionQuery;
+
+ @Create
+ public void init()
+ {
+ if (userPermissionClass == null)
+ {
+ log.debug("No permissionClass set, JpaDynamicPermissionStore will be unavailable.");
+ return;
+ }
+
+ if (entityManager == null)
+ {
+ entityManager = Expressions.instance().createValueExpression("#{entityManager}", EntityManager.class);
+ }
+
+ initProperties();
+ buildQueries();
+ }
+
+ protected void initProperties()
+ {
+ userProperty = AnnotatedBeanProperty.scanForProperty(userPermissionClass, PermissionUser.class);
+ targetProperty = AnnotatedBeanProperty.scanForProperty(userPermissionClass, PermissionTarget.class);
+ actionProperty = AnnotatedBeanProperty.scanForProperty(userPermissionClass, PermissionAction.class);
+
+ if (rolePermissionClass != null)
+ {
+ roleProperty = AnnotatedBeanProperty.scanForProperty(rolePermissionClass, PermissionRole.class);
+ if (roleProperty != null)
+ {
+ roleTargetProperty = AnnotatedBeanProperty.scanForProperty(rolePermissionClass, PermissionTarget.class);
+ roleActionProperty = AnnotatedBeanProperty.scanForProperty(rolePermissionClass, PermissionAction.class);
+ }
+ }
+ else
+ {
+ roleProperty = AnnotatedBeanProperty.scanForProperty(userPermissionClass, PermissionRole.class);
+ if (roleProperty != null)
+ {
+ discriminatorProperty = AnnotatedBeanProperty.scanForProperty(userPermissionClass, PermissionDiscriminator.class);
+ }
+ }
+
+ if (userProperty == null)
+ {
+ throw new RuntimeException("Invalid userPermissionClass " + userPermissionClass.getName() +
+ " - required annotation @PermissionUser not found on any Field or Method.");
+ }
+
+ if (rolePermissionClass != null)
+ {
+ if (roleProperty == null)
+ {
+ throw new RuntimeException("Invalid rolePermissionClass " + rolePermissionClass.getName() +
+ " - required annotation @PermissionRole not found on any Field or Method.");
+ }
+
+ if (roleTargetProperty == null)
+ {
+ throw new RuntimeException("Invalid rolePermissionClass " + rolePermissionClass.getName() +
+ " - required annotation @PermissionTarget not found on any Field or Method.");
+ }
+
+ if (roleActionProperty == null)
+ {
+ throw new RuntimeException("Invalid rolePermissionClass " + rolePermissionClass.getName() +
+ " - required annotation @PermissionAction not found on any Field or Method.");
+ }
+ }
+ else if (discriminatorProperty == null)
+ {
+ throw new RuntimeException("Invalid userPermissionClass " + rolePermissionClass.getName() +
+ " - no rolePermissionClass set and @PermissionDiscriminator annotation not found on " +
+ "any Field or Method");
+ }
+ }
+
+ protected void buildQueries()
+ {
+ StringBuffer query = new StringBuffer();
+ query.append("select p from ");
+ query.append(userPermissionClass.getName());
+ query.append(" p where ");
+ query.append(targetProperty.getName());
+ query.append(" = :target and ");
+ query.append(actionProperty.getName());
+ query.append(" = :action");
+
+ selectUserPermissionQuery = query.toString();
+
+ if (rolePermissionClass != null)
+ {
+ query.setLength(0);
+ query.append("select p from ");
+ query.append(rolePermissionClass.getName());
+ query.append(" p where ");
+ query.append(roleTargetProperty.getName());
+ query.append(" = :target and ");
+ query.append(roleActionProperty.getName());
+ query.append(" = :action");
+
+ selectRolePermissionQuery = query.toString();
+ }
+ else
+ {
+ selectRolePermissionQuery = selectUserPermissionQuery;
+ }
+ }
+
+ public boolean grantPermission(Permission permission)
+ {
+ boolean recipientIsRole = permission.getRecipient() instanceof Role;
+
+ try
+ {
+ if (recipientIsRole)
+ {
+ if (rolePermissionClass != null)
+ {
+ Object instance = rolePermissionClass.newInstance();
+ roleTargetProperty.setValue(instance, permission.getTarget().toString());
+ roleActionProperty.setValue(instance, permission.getAction());
+ roleProperty.setValue(instance, permission.getRecipient().getName());
+ lookupEntityManager().persist(instance);
+ return true;
+ }
+
+ if (discriminatorProperty == null)
+ {
+ throw new RuntimeException("Could not grant permission, rolePermissionClass not set");
+ }
+ }
+
+ if (userPermissionClass == null)
+ {
+ throw new RuntimeException("Could not grant permission, userPermissionClass not set");
+ }
+
+ Object instance = userPermissionClass.newInstance();
+ targetProperty.setValue(instance, permission.getTarget().toString());
+ actionProperty.setValue(instance, permission.getAction());
+ userProperty.setValue(instance, resolvePrincipal(permission.getRecipient()));
+
+ if (discriminatorProperty != null)
+ {
+ discriminatorProperty.setValue(instance, getDiscriminatorValue(recipientIsRole));
+ }
+
+ lookupEntityManager().persist(instance);
+
+ return true;
+ }
+ catch (Exception ex)
+ {
+ throw new RuntimeException("Could not grant permission", ex);
+ }
+ }
+
+ private String getDiscriminatorValue(boolean isRole)
+ {
+ PermissionDiscriminator discriminator = (PermissionDiscriminator) discriminatorProperty.getAnnotation();
+ return isRole ? discriminator.roleValue() : discriminator.userValue();
+ }
+
+ public boolean revokePermission(Permission permission)
+ {
+ boolean recipientIsRole = permission.getRecipient() instanceof Role;
+
+ EntityManager em = lookupEntityManager();
+
+ Query qry = em.createQuery(recipientIsRole ? selectRolePermissionQuery :
+ selectUserPermissionQuery)
+ .setParameter("target", permission.getTarget())
+ .setParameter("action", permission.getAction())
+ .setParameter("recipient", resolvePrincipal(permission.getRecipient()));
+
+ if (discriminatorProperty != null)
+ {
+ qry.setParameter("discriminator", getDiscriminatorValue(recipientIsRole));
+ }
+
+ try
+ {
+ Object instance = qry.getSingleResult();
+ em.remove(instance);
+ return true;
+ }
+ catch (NoResultException ex)
+ {
+ return false;
+ }
+ }
+
+ /**
+ * If the user or role properties in the entity class refer to other entities, then this method
+ * uses the JpaIdentityStore (if available) to lookup that user or role entity. Otherwise it
+ * simply returns the name of the recipient.
+ *
+ * @param recipient
+ * @return
+ */
+ protected Object resolvePrincipal(Principal recipient)
+ {
+ boolean recipientIsRole = recipient instanceof Role;
+
+ JpaIdentityStore identityStore = (JpaIdentityStore) Component.getInstance(JpaIdentityStore.class, true);
+
+ if (identityStore != null)
+ {
+ if (recipientIsRole && roleProperty != null && roleProperty.getPropertyClass().equals(identityStore.getRoleClass()))
+ {
+ return identityStore.lookupRole(recipient.getName());
+ }
+ else if (userProperty.getPropertyClass().equals(identityStore.getUserClass()))
+ {
+ return identityStore.lookupUser(recipient.getName());
+ }
+ }
+
+ return recipient.getName();
+ }
+
+ protected String resolvePrincipalName(Object principal, boolean isUser
+ )
+ {
+ if (principal instanceof String)
+ {
+ return (String) principal;
+ }
+
+ JpaIdentityStore identityStore = (JpaIdentityStore) Component.getInstance(JpaIdentityStore.class, true);
+
+ if (identityStore != null)
+ {
+ if (isUser && identityStore.getUserClass().equals(principal.getClass()))
+ {
+ return identityStore.getUserName(principal);
+ }
+
+ if (!isUser && identityStore.getRoleClass().equals(principal.getClass()))
+ {
+ return identityStore.getRoleName(principal);
+ }
+ }
+
+ throw new IllegalArgumentException("Cannot resolve principal name for principal " + principal);
+ }
+
+ public List<Permission> listPermissions(Object target, String action)
+ {
+ List<Permission> permissions = new ArrayList<Permission>();
+
+ Query permissionQuery = lookupEntityManager().createQuery(selectUserPermissionQuery)
+ .setParameter("target", target);
+
+ if (action != null)
+ {
+ permissionQuery.setParameter("action", action);
+ }
+
+ List userPermissions = permissionQuery.getResultList();
+
+ Map<String,Principal> principalCache = new HashMap<String,Principal>();
+
+ boolean useDiscriminator = rolePermissionClass == null && discriminatorProperty != null;
+
+ for (Object permission : userPermissions)
+ {
+ Principal principal;
+ boolean isUser = true;
+
+ if (useDiscriminator &&
+ discriminatorProperty.getAnnotation().roleValue().equals(discriminatorProperty.getValue(permission)))
+ {
+ isUser = false;
+ }
+
+ String name = resolvePrincipalName(isUser ? userProperty.getValue(permission) :
+ roleProperty.getValue(permission), isUser);
+
+ String key = (isUser ? "user:" : "role:") + name;
+
+ if (!principalCache.containsKey(key))
+ {
+ principal = isUser ? new SimplePrincipal(name) : new Role(name);
+ principalCache.put(key, principal);
+ }
+ else
+ {
+ principal = principalCache.get(key);
+ }
+
+ permissions.add(new Permission(target, (String) (action != null ? action : actionProperty.getValue(permission)),
+ principal));
+ }
+
+ if (rolePermissionClass == null)
+ {
+ permissionQuery = lookupEntityManager().createQuery(selectRolePermissionQuery)
+ .setParameter("target", target);
+
+ if (action != null)
+ {
+ permissionQuery.setParameter("action", action);
+ }
+
+ List rolePermissions = permissionQuery.getResultList();
+
+ for (Object permission : rolePermissions)
+ {
+ Principal principal;
+
+ String name = resolvePrincipalName(roleProperty.getValue(permission), false);
+ String key = "role:" + name;
+
+ if (!principalCache.containsKey(key))
+ {
+ principal = new Role(name);
+ principalCache.put(key, principal);
+ }
+ else
+ {
+ principal = principalCache.get(key);
+ }
+
+ permissions.add(new Permission(target, (String) (action != null ? action :
+ roleActionProperty.getValue(permission)), principal));
+ }
+ }
+
+ return permissions;
+ }
+
+ public List<Permission> listPermissions(Object target)
+ {
+ return listPermissions(target, null);
+ }
+
+ private EntityManager lookupEntityManager()
+ {
+ return entityManager.getValue();
+ }
+
+ public ValueExpression getEntityManager()
+ {
+ return entityManager;
+ }
+
+ public void setEntityManager(ValueExpression expression)
+ {
+ this.entityManager = expression;
+ }
+
+ public Class getUserPermissionClass()
+ {
+ return userPermissionClass;
+ }
+
+ public void setUserPermissionClass(Class userPermissionClass)
+ {
+ this.userPermissionClass = userPermissionClass;
+ }
+
+ public Class getRolePermissionClass()
+ {
+ return rolePermissionClass;
+ }
+
+ public void setRolePermissionClass(Class rolePermissionClass)
+ {
+ this.rolePermissionClass = rolePermissionClass;
+ }
+}
Modified: trunk/src/main/org/jboss/seam/security/permission/PersistentPermissionResolver.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/permission/PersistentPermissionResolver.java 2008-04-22 04:49:09 UTC (rev 8001)
+++ trunk/src/main/org/jboss/seam/security/permission/PersistentPermissionResolver.java 2008-04-22 04:52:31 UTC (rev 8002)
@@ -30,9 +30,7 @@
@Install(precedence=FRAMEWORK)
@Startup
public class PersistentPermissionResolver implements PermissionResolver, Serializable
-{
- private static final String DEFAULT_PERMISSION_STORE_NAME = "jpaDynamicPermissionStore";
-
+{
private PermissionStore permissionStore;
private static final LogProvider log = Logging.getLogProvider(PersistentPermissionResolver.class);
@@ -47,7 +45,7 @@
{
if (permissionStore == null)
{
- permissionStore = (PermissionStore) Component.getInstance(DEFAULT_PERMISSION_STORE_NAME, true);
+ permissionStore = (PermissionStore) Component.getInstance(JpaPermissionStore.class, true);
}
if (permissionStore == null)
16 years, 9 months
Seam SVN: r8001 - trunk/src/main/org/jboss/seam/security/permission.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-04-22 00:49:09 -0400 (Tue, 22 Apr 2008)
New Revision: 8001
Added:
trunk/src/main/org/jboss/seam/security/permission/JpaDynamicPermissionStore.java
trunk/src/main/org/jboss/seam/security/permission/PersistentPermissionResolver.java
Removed:
trunk/src/main/org/jboss/seam/security/permission/acl/
trunk/src/main/org/jboss/seam/security/permission/dynamic/
Modified:
trunk/src/main/org/jboss/seam/security/permission/PermissionManager.java
trunk/src/main/org/jboss/seam/security/permission/PermissionStore.java
Log:
consolidate dynamic and acl permission resolvers into PersistentPermissionResolver
Added: trunk/src/main/org/jboss/seam/security/permission/JpaDynamicPermissionStore.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/permission/JpaDynamicPermissionStore.java (rev 0)
+++ trunk/src/main/org/jboss/seam/security/permission/JpaDynamicPermissionStore.java 2008-04-22 04:49:09 UTC (rev 8001)
@@ -0,0 +1,440 @@
+package org.jboss.seam.security.permission;
+
+import static org.jboss.seam.ScopeType.APPLICATION;
+import static org.jboss.seam.annotations.Install.BUILT_IN;
+
+import java.io.Serializable;
+import java.security.Principal;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.persistence.EntityManager;
+import javax.persistence.NoResultException;
+import javax.persistence.Query;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.annotations.security.permission.PermissionAction;
+import org.jboss.seam.annotations.security.permission.PermissionDiscriminator;
+import org.jboss.seam.annotations.security.permission.PermissionRole;
+import org.jboss.seam.annotations.security.permission.PermissionTarget;
+import org.jboss.seam.annotations.security.permission.PermissionUser;
+import org.jboss.seam.core.Expressions;
+import org.jboss.seam.core.Expressions.ValueExpression;
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
+import org.jboss.seam.security.Role;
+import org.jboss.seam.security.SimplePrincipal;
+import org.jboss.seam.security.management.JpaIdentityStore;
+import org.jboss.seam.util.AnnotatedBeanProperty;
+
+/**
+ * A permission store implementation that uses JPA as its persistence mechanism.
+ *
+ * @author Shane Bryzak
+ */
+@Name("org.jboss.seam.security.permission.jpaDynamicPermissionStore")
+@Install(precedence = BUILT_IN, value=false)
+@Scope(APPLICATION)
+@BypassInterceptors
+public class JpaDynamicPermissionStore implements PermissionStore, Serializable
+{
+ private static final LogProvider log = Logging.getLogProvider(JpaDynamicPermissionStore.class);
+
+ private ValueExpression<EntityManager> entityManager;
+
+ private Class userPermissionClass;
+ private Class rolePermissionClass;
+
+ private AnnotatedBeanProperty<PermissionUser> userProperty;
+ private AnnotatedBeanProperty<PermissionRole> roleProperty;
+
+ private AnnotatedBeanProperty<PermissionTarget> targetProperty;
+ private AnnotatedBeanProperty<PermissionAction> actionProperty;
+ private AnnotatedBeanProperty<PermissionDiscriminator> discriminatorProperty;
+
+ private AnnotatedBeanProperty<PermissionTarget> roleTargetProperty;
+ private AnnotatedBeanProperty<PermissionAction> roleActionProperty;
+
+ private String selectUserPermissionQuery;
+ private String selectRolePermissionQuery;
+
+ @Create
+ public void init()
+ {
+ if (userPermissionClass == null)
+ {
+ log.debug("No permissionClass set, JpaDynamicPermissionStore will be unavailable.");
+ return;
+ }
+
+ if (entityManager == null)
+ {
+ entityManager = Expressions.instance().createValueExpression("#{entityManager}", EntityManager.class);
+ }
+
+ initProperties();
+ buildQueries();
+ }
+
+ protected void initProperties()
+ {
+ userProperty = AnnotatedBeanProperty.scanForProperty(userPermissionClass, PermissionUser.class);
+ targetProperty = AnnotatedBeanProperty.scanForProperty(userPermissionClass, PermissionTarget.class);
+ actionProperty = AnnotatedBeanProperty.scanForProperty(userPermissionClass, PermissionAction.class);
+
+ if (rolePermissionClass != null)
+ {
+ roleProperty = AnnotatedBeanProperty.scanForProperty(rolePermissionClass, PermissionRole.class);
+ if (roleProperty != null)
+ {
+ roleTargetProperty = AnnotatedBeanProperty.scanForProperty(rolePermissionClass, PermissionTarget.class);
+ roleActionProperty = AnnotatedBeanProperty.scanForProperty(rolePermissionClass, PermissionAction.class);
+ }
+ }
+ else
+ {
+ roleProperty = AnnotatedBeanProperty.scanForProperty(userPermissionClass, PermissionRole.class);
+ if (roleProperty != null)
+ {
+ discriminatorProperty = AnnotatedBeanProperty.scanForProperty(userPermissionClass, PermissionDiscriminator.class);
+ }
+ }
+
+ if (userProperty == null)
+ {
+ throw new RuntimeException("Invalid userPermissionClass " + userPermissionClass.getName() +
+ " - required annotation @PermissionUser not found on any Field or Method.");
+ }
+
+ if (rolePermissionClass != null)
+ {
+ if (roleProperty == null)
+ {
+ throw new RuntimeException("Invalid rolePermissionClass " + rolePermissionClass.getName() +
+ " - required annotation @PermissionRole not found on any Field or Method.");
+ }
+
+ if (roleTargetProperty == null)
+ {
+ throw new RuntimeException("Invalid rolePermissionClass " + rolePermissionClass.getName() +
+ " - required annotation @PermissionTarget not found on any Field or Method.");
+ }
+
+ if (roleActionProperty == null)
+ {
+ throw new RuntimeException("Invalid rolePermissionClass " + rolePermissionClass.getName() +
+ " - required annotation @PermissionAction not found on any Field or Method.");
+ }
+ }
+ else if (discriminatorProperty == null)
+ {
+ throw new RuntimeException("Invalid userPermissionClass " + rolePermissionClass.getName() +
+ " - no rolePermissionClass set and @PermissionDiscriminator annotation not found on " +
+ "any Field or Method");
+ }
+ }
+
+ protected void buildQueries()
+ {
+ StringBuffer query = new StringBuffer();
+ query.append("select p from ");
+ query.append(userPermissionClass.getName());
+ query.append(" p where ");
+ query.append(targetProperty.getName());
+ query.append(" = :target and ");
+ query.append(actionProperty.getName());
+ query.append(" = :action");
+
+ selectUserPermissionQuery = query.toString();
+
+ if (rolePermissionClass != null)
+ {
+ query.setLength(0);
+ query.append("select p from ");
+ query.append(rolePermissionClass.getName());
+ query.append(" p where ");
+ query.append(roleTargetProperty.getName());
+ query.append(" = :target and ");
+ query.append(roleActionProperty.getName());
+ query.append(" = :action");
+
+ selectRolePermissionQuery = query.toString();
+ }
+ else
+ {
+ selectRolePermissionQuery = selectUserPermissionQuery;
+ }
+ }
+
+ public boolean grantPermission(Permission permission)
+ {
+ boolean recipientIsRole = permission.getRecipient() instanceof Role;
+
+ try
+ {
+ if (recipientIsRole)
+ {
+ if (rolePermissionClass != null)
+ {
+ Object instance = rolePermissionClass.newInstance();
+ roleTargetProperty.setValue(instance, permission.getTarget().toString());
+ roleActionProperty.setValue(instance, permission.getAction());
+ roleProperty.setValue(instance, permission.getRecipient().getName());
+ lookupEntityManager().persist(instance);
+ return true;
+ }
+
+ if (discriminatorProperty == null)
+ {
+ throw new RuntimeException("Could not grant permission, rolePermissionClass not set");
+ }
+ }
+
+ if (userPermissionClass == null)
+ {
+ throw new RuntimeException("Could not grant permission, userPermissionClass not set");
+ }
+
+ Object instance = userPermissionClass.newInstance();
+ targetProperty.setValue(instance, permission.getTarget().toString());
+ actionProperty.setValue(instance, permission.getAction());
+ userProperty.setValue(instance, resolvePrincipal(permission.getRecipient()));
+
+ if (discriminatorProperty != null)
+ {
+ discriminatorProperty.setValue(instance, getDiscriminatorValue(recipientIsRole));
+ }
+
+ lookupEntityManager().persist(instance);
+
+ return true;
+ }
+ catch (Exception ex)
+ {
+ throw new RuntimeException("Could not grant permission", ex);
+ }
+ }
+
+ private String getDiscriminatorValue(boolean isRole)
+ {
+ PermissionDiscriminator discriminator = (PermissionDiscriminator) discriminatorProperty.getAnnotation();
+ return isRole ? discriminator.roleValue() : discriminator.userValue();
+ }
+
+ public boolean revokePermission(Permission permission)
+ {
+ boolean recipientIsRole = permission.getRecipient() instanceof Role;
+
+ EntityManager em = lookupEntityManager();
+
+ Query qry = em.createQuery(recipientIsRole ? selectRolePermissionQuery :
+ selectUserPermissionQuery)
+ .setParameter("target", permission.getTarget())
+ .setParameter("action", permission.getAction())
+ .setParameter("recipient", resolvePrincipal(permission.getRecipient()));
+
+ if (discriminatorProperty != null)
+ {
+ qry.setParameter("discriminator", getDiscriminatorValue(recipientIsRole));
+ }
+
+ try
+ {
+ Object instance = qry.getSingleResult();
+ em.remove(instance);
+ return true;
+ }
+ catch (NoResultException ex)
+ {
+ return false;
+ }
+ }
+
+ /**
+ * If the user or role properties in the entity class refer to other entities, then this method
+ * uses the JpaIdentityStore (if available) to lookup that user or role entity. Otherwise it
+ * simply returns the name of the recipient.
+ *
+ * @param recipient
+ * @return
+ */
+ protected Object resolvePrincipal(Principal recipient)
+ {
+ boolean recipientIsRole = recipient instanceof Role;
+
+ JpaIdentityStore identityStore = (JpaIdentityStore) Component.getInstance(JpaIdentityStore.class, true);
+
+ if (identityStore != null)
+ {
+ if (recipientIsRole && roleProperty != null && roleProperty.getPropertyClass().equals(identityStore.getRoleClass()))
+ {
+ return identityStore.lookupRole(recipient.getName());
+ }
+ else if (userProperty.getPropertyClass().equals(identityStore.getUserClass()))
+ {
+ return identityStore.lookupUser(recipient.getName());
+ }
+ }
+
+ return recipient.getName();
+ }
+
+ protected String resolvePrincipalName(Object principal, boolean isUser
+ )
+ {
+ if (principal instanceof String)
+ {
+ return (String) principal;
+ }
+
+ JpaIdentityStore identityStore = (JpaIdentityStore) Component.getInstance(JpaIdentityStore.class, true);
+
+ if (identityStore != null)
+ {
+ if (isUser && identityStore.getUserClass().equals(principal.getClass()))
+ {
+ return identityStore.getUserName(principal);
+ }
+
+ if (!isUser && identityStore.getRoleClass().equals(principal.getClass()))
+ {
+ return identityStore.getRoleName(principal);
+ }
+ }
+
+ throw new IllegalArgumentException("Cannot resolve principal name for principal " + principal);
+ }
+
+ public List<Permission> listPermissions(Object target, String action)
+ {
+ List<Permission> permissions = new ArrayList<Permission>();
+
+ Query permissionQuery = lookupEntityManager().createQuery(selectUserPermissionQuery)
+ .setParameter("target", target);
+
+ if (action != null)
+ {
+ permissionQuery.setParameter("action", action);
+ }
+
+ List userPermissions = permissionQuery.getResultList();
+
+ Map<String,Principal> principalCache = new HashMap<String,Principal>();
+
+ boolean useDiscriminator = rolePermissionClass == null && discriminatorProperty != null;
+
+ for (Object permission : userPermissions)
+ {
+ Principal principal;
+ boolean isUser = true;
+
+ if (useDiscriminator &&
+ discriminatorProperty.getAnnotation().roleValue().equals(discriminatorProperty.getValue(permission)))
+ {
+ isUser = false;
+ }
+
+ String name = resolvePrincipalName(isUser ? userProperty.getValue(permission) :
+ roleProperty.getValue(permission), isUser);
+
+ String key = (isUser ? "user:" : "role:") + name;
+
+ if (!principalCache.containsKey(key))
+ {
+ principal = isUser ? new SimplePrincipal(name) : new Role(name);
+ principalCache.put(key, principal);
+ }
+ else
+ {
+ principal = principalCache.get(key);
+ }
+
+ permissions.add(new Permission(target, (String) (action != null ? action : actionProperty.getValue(permission)),
+ principal));
+ }
+
+ if (rolePermissionClass == null)
+ {
+ permissionQuery = lookupEntityManager().createQuery(selectRolePermissionQuery)
+ .setParameter("target", target);
+
+ if (action != null)
+ {
+ permissionQuery.setParameter("action", action);
+ }
+
+ List rolePermissions = permissionQuery.getResultList();
+
+ for (Object permission : rolePermissions)
+ {
+ Principal principal;
+
+ String name = resolvePrincipalName(roleProperty.getValue(permission), false);
+ String key = "role:" + name;
+
+ if (!principalCache.containsKey(key))
+ {
+ principal = new Role(name);
+ principalCache.put(key, principal);
+ }
+ else
+ {
+ principal = principalCache.get(key);
+ }
+
+ permissions.add(new Permission(target, (String) (action != null ? action :
+ roleActionProperty.getValue(permission)), principal));
+ }
+ }
+
+ return permissions;
+ }
+
+ public List<Permission> listPermissions(Object target)
+ {
+ return listPermissions(target, null);
+ }
+
+ private EntityManager lookupEntityManager()
+ {
+ return entityManager.getValue();
+ }
+
+ public ValueExpression getEntityManager()
+ {
+ return entityManager;
+ }
+
+ public void setEntityManager(ValueExpression expression)
+ {
+ this.entityManager = expression;
+ }
+
+ public Class getUserPermissionClass()
+ {
+ return userPermissionClass;
+ }
+
+ public void setUserPermissionClass(Class userPermissionClass)
+ {
+ this.userPermissionClass = userPermissionClass;
+ }
+
+ public Class getRolePermissionClass()
+ {
+ return rolePermissionClass;
+ }
+
+ public void setRolePermissionClass(Class rolePermissionClass)
+ {
+ this.rolePermissionClass = rolePermissionClass;
+ }
+}
Modified: trunk/src/main/org/jboss/seam/security/permission/PermissionManager.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/permission/PermissionManager.java 2008-04-21 22:30:08 UTC (rev 8000)
+++ trunk/src/main/org/jboss/seam/security/permission/PermissionManager.java 2008-04-22 04:49:09 UTC (rev 8001)
@@ -16,7 +16,6 @@
import org.jboss.seam.log.LogProvider;
import org.jboss.seam.log.Logging;
import org.jboss.seam.security.Identity;
-import org.jboss.seam.security.permission.PermissionStore;
/**
* Permission management component, used to grant or revoke permissions on specific objects or of
@@ -29,8 +28,7 @@
@Install(precedence = BUILT_IN)
public class PermissionManager implements Serializable
{
- public static final String ACCOUNT_PERMISSION_STORE_COMPONENT_NAME = "accountPermissionStore";
- public static final String ACL_PERMISSION_STORE_COMPONENT_NAME = "aclPermissionStore";
+ public static final String PERMISSION_STORE_COMPONENT_NAME = "permissionStore";
public static final String PERMISSION_PERMISSION_NAME = "seam.permission";
@@ -40,34 +38,21 @@
private static final LogProvider log = Logging.getLogProvider(PermissionManager.class);
- private PermissionStore dynamicPermissionStore;
+ private PermissionStore permissionStore;
- private PermissionStore aclPermissionStore;
-
@Create
public void create()
{
- if (dynamicPermissionStore == null)
+ if (permissionStore == null)
{
- dynamicPermissionStore = (PermissionStore) Component.getInstance(ACCOUNT_PERMISSION_STORE_COMPONENT_NAME, true);
+ permissionStore = (PermissionStore) Component.getInstance(PERMISSION_STORE_COMPONENT_NAME, true);
}
- if (dynamicPermissionStore == null)
+ if (permissionStore == null)
{
- log.warn("no account permission store available - please install an AccountPermissionStore with the name '" +
- ACCOUNT_PERMISSION_STORE_COMPONENT_NAME + "' if account-based permission management is required.");
+ log.warn("no permission store available - please install a PermissionStore with the name '" +
+ PERMISSION_STORE_COMPONENT_NAME + "' if permission management is required.");
}
-
- if (aclPermissionStore == null)
- {
- aclPermissionStore = (PermissionStore) Component.getInstance(ACL_PERMISSION_STORE_COMPONENT_NAME);
- }
-
- if (aclPermissionStore == null)
- {
- log.warn("no ACL permission store available - please install an AclPermissionStore with the name '" +
- ACL_PERMISSION_STORE_COMPONENT_NAME + "' if ACL-based permission management is required.");
- }
}
public static PermissionManager instance()
@@ -88,59 +73,37 @@
return instance;
}
- public PermissionStore getDynamicPermissionStore()
+ public PermissionStore getPermissionStore()
{
- return dynamicPermissionStore;
+ return permissionStore;
}
- public void setDynamicPermissionStore(PermissionStore dynamicPermissionStore)
+ public void setPermissionStore(PermissionStore permissionStore)
{
- this.dynamicPermissionStore = dynamicPermissionStore;
+ this.permissionStore = permissionStore;
}
public List<Permission> listPermissions(String target, String action)
{
Identity.instance().checkPermission(PERMISSION_PERMISSION_NAME, PERMISSION_READ);
- return dynamicPermissionStore.listPermissions(target, action);
+ return permissionStore.listPermissions(target, action);
}
- public List<Permission> listPermissions(String target)
- {
- Identity.instance().checkPermission(PERMISSION_PERMISSION_NAME, PERMISSION_READ);
- return dynamicPermissionStore.listPermissions(target);
- }
-
public List<Permission> listPermissions(Object target)
{
Identity.instance().checkPermission(PERMISSION_PERMISSION_NAME, PERMISSION_READ);
- return aclPermissionStore.listPermissions(target);
+ return permissionStore.listPermissions(target);
}
public boolean grantPermission(Permission permission)
{
Identity.instance().checkPermission(permission, PERMISSION_GRANT);
-
- if (permission.getTarget() instanceof String)
- {
- return dynamicPermissionStore.grantPermission(permission);
- }
- else
- {
- return aclPermissionStore.grantPermission(permission);
- }
+ return permissionStore.grantPermission(permission);
}
public boolean revokePermission(Permission permission)
{
Identity.instance().checkPermission(permission, PERMISSION_REVOKE);
-
- if (permission.getTarget() instanceof String)
- {
- return dynamicPermissionStore.revokePermission(permission);
- }
- else
- {
- return aclPermissionStore.revokePermission(permission);
- }
+ return permissionStore.revokePermission(permission);
}
}
Modified: trunk/src/main/org/jboss/seam/security/permission/PermissionStore.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/permission/PermissionStore.java 2008-04-21 22:30:08 UTC (rev 8000)
+++ trunk/src/main/org/jboss/seam/security/permission/PermissionStore.java 2008-04-22 04:49:09 UTC (rev 8001)
@@ -1,7 +1,6 @@
package org.jboss.seam.security.permission;
import java.util.List;
-import java.util.Set;
/**
* Permission store interface.
@@ -12,7 +11,6 @@
{
List<Permission> listPermissions(Object target);
List<Permission> listPermissions(Object target, String action);
- List<Permission> listPermissions(Set<Object> targets);
boolean grantPermission(Permission permission);
boolean revokePermission(Permission permission);
}
Added: trunk/src/main/org/jboss/seam/security/permission/PersistentPermissionResolver.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/permission/PersistentPermissionResolver.java (rev 0)
+++ trunk/src/main/org/jboss/seam/security/permission/PersistentPermissionResolver.java 2008-04-22 04:49:09 UTC (rev 8001)
@@ -0,0 +1,103 @@
+package org.jboss.seam.security.permission;
+
+import static org.jboss.seam.ScopeType.APPLICATION;
+import static org.jboss.seam.annotations.Install.FRAMEWORK;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.Seam;
+import org.jboss.seam.annotations.Create;
+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.log.LogProvider;
+import org.jboss.seam.log.Logging;
+import org.jboss.seam.security.Identity;
+
+/**
+ * Resolves dynamically-assigned permissions, mapped to a user or a role, and kept in persistent
+ * storage, such as a relational database.
+ *
+ * @author Shane Bryzak
+ */
+@Name("org.jboss.seam.security.dynamicPermissionResolver")
+@Scope(APPLICATION)
+@BypassInterceptors
+@Install(precedence=FRAMEWORK)
+@Startup
+public class PersistentPermissionResolver implements PermissionResolver, Serializable
+{
+ private static final String DEFAULT_PERMISSION_STORE_NAME = "jpaDynamicPermissionStore";
+
+ private PermissionStore permissionStore;
+
+ private static final LogProvider log = Logging.getLogProvider(PersistentPermissionResolver.class);
+
+ @Create
+ public void create()
+ {
+ initPermissionStore();
+ }
+
+ protected void initPermissionStore()
+ {
+ if (permissionStore == null)
+ {
+ permissionStore = (PermissionStore) Component.getInstance(DEFAULT_PERMISSION_STORE_NAME, true);
+ }
+
+ if (permissionStore == null)
+ {
+ log.warn("no permission store available - please install a PermissionStore with the name '" +
+ DEFAULT_PERMISSION_STORE_NAME + "' if dynamic permissions are required.");
+ }
+ }
+
+ public PermissionStore getPermissionStore()
+ {
+ return permissionStore;
+ }
+
+ public void setPermissionStore(PermissionStore permissionStore)
+ {
+ this.permissionStore = permissionStore;
+ }
+
+ public boolean hasPermission(Object target, String action)
+ {
+ if (permissionStore == null) return false;
+
+ Identity identity = Identity.instance();
+
+ if (!identity.isLoggedIn()) return false;
+
+ String targetName = Seam.getComponentName(target.getClass());
+ if (targetName == null)
+ {
+ targetName = target.getClass().getName();
+ }
+
+ List<Permission> permissions = permissionStore.listPermissions(targetName, action);
+
+ String username = identity.getPrincipal().getName();
+
+ for (Permission permission : permissions)
+ {
+ if (username.equals(permission.getRecipient().getName()))
+ {
+ return true;
+ }
+
+ if (identity.hasRole(permission.getRecipient().getName()))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+}
16 years, 9 months
Seam SVN: r8000 - trunk/src/main/org/jboss/seam.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2008-04-21 18:30:08 -0400 (Mon, 21 Apr 2008)
New Revision: 8000
Modified:
trunk/src/main/org/jboss/seam/async-2.1.xsd
trunk/src/main/org/jboss/seam/core-2.1.xsd
trunk/src/main/org/jboss/seam/pdf-2.1.xsd
trunk/src/main/org/jboss/seam/theme-2.1.xsd
trunk/src/main/org/jboss/seam/transaction-2.1.xsd
trunk/src/main/org/jboss/seam/web-2.1.xsd
Log:
JBSEAM-1531
Modified: trunk/src/main/org/jboss/seam/async-2.1.xsd
===================================================================
--- trunk/src/main/org/jboss/seam/async-2.1.xsd 2008-04-21 20:06:44 UTC (rev 7999)
+++ trunk/src/main/org/jboss/seam/async-2.1.xsd 2008-04-21 22:30:08 UTC (rev 8000)
@@ -5,15 +5,21 @@
<xs:import namespace="http://jboss.com/products/seam/components" schemaLocation="components-2.1.xsd"/>
<xs:element name="timer-service-dispatcher">
+ <xs:annotation>
+ <xs:documentation></xs:documentation>
+ </xs:annotation>
<xs:complexType mixed="true">
<xs:attributeGroup ref="components:attlist.component"/>
<xs:attributeGroup ref="components:attlist.ejbcomponent"/>
<xs:attributeGroup ref="async:attlist.timerServiceDispatcher"/>
</xs:complexType>
</xs:element>
- <xs:attributeGroup name="attlist.timerServiceDispatcher"> </xs:attributeGroup>
+ <xs:attributeGroup name="attlist.timerServiceDispatcher" />
<xs:element name="quartz-dispatcher">
+ <xs:annotation>
+ <xs:documentation></xs:documentation>
+ </xs:annotation>
<xs:complexType mixed="true">
<xs:attributeGroup ref="components:attlist.component"/>
<xs:attributeGroup ref="async:attlist.quartzDispatcher"/>
@@ -22,13 +28,16 @@
<xs:attributeGroup name="attlist.quartzDispatcher"> </xs:attributeGroup>
<xs:element name="thread-pool-dispatcher">
+ <xs:annotation>
+ <xs:documentation></xs:documentation>
+ </xs:annotation>
<xs:complexType mixed="true">
<xs:attributeGroup ref="components:attlist.component"/>
<xs:attributeGroup ref="async:attlist.threadPoolDispatcher"/>
</xs:complexType>
</xs:element>
<xs:attributeGroup name="attlist.threadPoolDispatcher">
- <xs:attribute name="thread-pool-size" type="xs:integer"/>
+ <xs:attribute name="thread-pool-size" type="components:int"/>
</xs:attributeGroup>
</xs:schema>
Modified: trunk/src/main/org/jboss/seam/core-2.1.xsd
===================================================================
--- trunk/src/main/org/jboss/seam/core-2.1.xsd 2008-04-21 20:06:44 UTC (rev 7999)
+++ trunk/src/main/org/jboss/seam/core-2.1.xsd 2008-04-21 22:30:08 UTC (rev 8000)
@@ -2,71 +2,78 @@
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
targetNamespace="http://jboss.com/products/seam/core" xmlns:core="http://jboss.com/products/seam/core"
xmlns:components="http://jboss.com/products/seam/components" attributeFormDefault="unqualified">
+
<xs:import namespace="http://jboss.com/products/seam/components" schemaLocation="components-2.1.xsd"/>
+ <xs:annotation>
+ <xs:documentation>The core Seam components</xs:documentation>
+ </xs:annotation>
+
<xs:element name="init">
+ <xs:annotation>
+ <xs:documentation>A Seam component that holds Seam configuration settings</xs:documentation>
+ </xs:annotation>
<xs:complexType mixed="true">
<xs:attributeGroup ref="components:attlist.component"/>
<xs:attributeGroup ref="core:attlist.init"/>
</xs:complexType>
</xs:element>
+
<xs:attributeGroup name="attlist.init">
- <xs:attribute name="debug">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="true"/>
- <xs:enumeration value="false"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="jndi-pattern"/>
- <xs:attribute name="transaction-management-enabled">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="true"/>
- <xs:enumeration value="false"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="user-transaction-name"/>
+ <xs:attribute name="debug" type="components:boolean" />
+ <xs:attribute name="jndi-pattern" type="components:string" />
+ <xs:attribute name="transaction-management-enabled" type="components:boolean"/>
+ <xs:attribute name="user-transaction-name" type="components:string"/>
</xs:attributeGroup>
<xs:element name="manager">
+ <xs:annotation>
+ <xs:documentation>The Seam conversation manager</xs:documentation>
+ </xs:annotation>
<xs:complexType mixed="true">
<xs:attributeGroup ref="components:attlist.component"/>
<xs:attributeGroup ref="core:attlist.manager"/>
</xs:complexType>
</xs:element>
+
<xs:attributeGroup name="attlist.manager">
- <xs:attribute name="concurrent-request-timeout" type="xs:integer"/>
- <xs:attribute name="conversation-timeout" type="xs:integer"/>
- <xs:attribute name="conversation-id-parameter"/>
- <xs:attribute name="parent-conversation-id-parameter"/>
- <xs:attribute name="uri-encoding"/>
+ <xs:attribute name="concurrent-request-timeout" type="components:int"/>
+ <xs:attribute name="conversation-timeout" type="components:int"/>
+ <xs:attribute name="conversation-id-parameter" type="components:string"/>
+ <xs:attribute name="parent-conversation-id-parameter" type="components:string"/>
+ <xs:attribute name="uri-encoding" type="components:string" />
</xs:attributeGroup>
<xs:element name="resource-loader">
+ <xs:annotation>
+ <xs:documentation>Access to application resources and resource bundles</xs:documentation>
+ </xs:annotation>
<xs:complexType mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="core:bundle-names"/>
+ <xs:element name="bundle-names" type="components:multiValuedProperty">
+ <xs:annotation>
+ <xs:documentation>A list of resource bundle names</xs:documentation>
+ </xs:annotation>
+ </xs:element>
</xs:choice>
<xs:attributeGroup ref="components:attlist.component"/>
<xs:attributeGroup ref="core:attlist.resourceLoader"/>
</xs:complexType>
</xs:element>
- <xs:element name="bundle-names" type="components:multiValuedProperty"/>
<xs:attributeGroup name="attlist.resourceLoader">
- <xs:attribute name="bundle-names"> </xs:attribute>
+ <xs:attribute name="bundle-names" type="components:string" />
</xs:attributeGroup>
<xs:element name="pojo-cache">
+ <xs:annotation>
+ <xs:documentation>Integration with JBoss Cache</xs:documentation>
+ </xs:annotation>
<xs:complexType mixed="true">
<xs:attributeGroup ref="components:attlist.component"/>
<xs:attributeGroup ref="core:attlist.pojoCache"/>
</xs:complexType>
</xs:element>
<xs:attributeGroup name="attlist.pojoCache">
- <xs:attribute name="cfg-resource-name"/>
+ <xs:attribute name="cfg-resource-name" type="components:string" />
</xs:attributeGroup>
-
</xs:schema>
Modified: trunk/src/main/org/jboss/seam/pdf-2.1.xsd
===================================================================
--- trunk/src/main/org/jboss/seam/pdf-2.1.xsd 2008-04-21 20:06:44 UTC (rev 7999)
+++ trunk/src/main/org/jboss/seam/pdf-2.1.xsd 2008-04-21 22:30:08 UTC (rev 8000)
@@ -8,26 +8,49 @@
<xs:import namespace="http://jboss.com/products/seam/components" schemaLocation="components-2.1.xsd"/>
<xs:element name="document-store">
+ <xs:annotation>
+ <xs:documentation>
+ The PDF document store is used to store rendered documents for download on a later request.
+ </xs:documentation>
+ </xs:annotation>
<xs:complexType mixed="true">
<xs:attributeGroup ref="components:attlist.component"/>
<xs:attributeGroup ref="pdf:attlist.docstore"/>
</xs:complexType>
</xs:element>
<xs:attributeGroup name="attlist.docstore">
- <xs:attribute name="error-page" type="xs:string"/>
- <xs:attribute name="use-extensions" type="xs:string"/>
+ <xs:attribute name="error-page" type="components:string">
+ <xs:annotation>
+ <xs:documentation>
+ When a document had expired or otherwise cannot be loaded, this page is displayed.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="use-extensions" type="components:boolean">
+ <xs:annotation>
+ <xs:documentation>
+ Controls whether or not the URLs for documents should contain their correct file name extensions.
+ Using file name extensions requires additional configuration in web.xml.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:attributeGroup>
<xs:element name="key-store-config">
+ <xs:annotation>
+ <xs:documentation>
+ The key stores holds the encryption keys for creating signed PDF documents
+ </xs:documentation>
+ </xs:annotation>
<xs:complexType mixed="true">
<xs:attributeGroup ref="components:attlist.component"/>
- <xs:attributeGroup ref="pdf:attlist.UseExtensions"/>
+ <xs:attributeGroup ref="pdf:attlist.keystore"/>
</xs:complexType>
</xs:element>
- <xs:attributeGroup name="attlist.UseExtensions">
- <xs:attribute name="key-store" type="xs:string"/>
- <xs:attribute name="key-store-password" type="xs:string"/>
- <xs:attribute name="key-password" type="xs:string"/>
- <xs:attribute name="key-alias" type="xs:string"/>
+ <xs:attributeGroup name="attlist.keystore">
+ <xs:attribute name="key-store" type="components:string"/>
+ <xs:attribute name="key-store-password" type="components:string"/>
+ <xs:attribute name="key-password" type="components:string"/>
+ <xs:attribute name="key-alias" type="components:string"/>
</xs:attributeGroup>
</xs:schema>
Modified: trunk/src/main/org/jboss/seam/theme-2.1.xsd
===================================================================
--- trunk/src/main/org/jboss/seam/theme-2.1.xsd 2008-04-21 20:06:44 UTC (rev 7999)
+++ trunk/src/main/org/jboss/seam/theme-2.1.xsd 2008-04-21 22:30:08 UTC (rev 8000)
@@ -5,27 +5,22 @@
<xs:import namespace="http://jboss.com/products/seam/components" schemaLocation="components-2.1.xsd"/>
<xs:element name="theme-selector">
+ <xs:annotation>
+ <xs:documentation>Theme selector component</xs:documentation>
+ </xs:annotation>
<xs:complexType mixed="true">
<xs:choice minOccurs="0" maxOccurs="1">
- <xs:element ref="theme:available-themes"/>
+ <xs:element name="available-themes" type="components:multiValuedProperty"/>
</xs:choice>
<xs:attributeGroup ref="components:attlist.component"/>
<xs:attributeGroup ref="theme:attlist.themeSelector"/>
</xs:complexType>
</xs:element>
- <xs:element name="available-themes" type="components:multiValuedProperty"/>
+
<xs:attributeGroup name="attlist.themeSelector">
- <xs:attribute name="theme" type="xs:string"/>
- <xs:attribute name="available-themes" type="xs:string"/>
- <xs:attribute name="cookie-max-age"/>
- <xs:attribute name="cookie-enabled">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="true"/>
- <xs:enumeration value="false"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
+ <xs:attribute name="theme" type="components:string"/>
+ <xs:attribute name="available-themes" type="components:string"/>
+ <xs:attribute name="cookie-max-age" type="components:int"/>
+ <xs:attribute name="cookie-enabled" type="components:boolean" />
</xs:attributeGroup>
-
</xs:schema>
Modified: trunk/src/main/org/jboss/seam/transaction-2.1.xsd
===================================================================
--- trunk/src/main/org/jboss/seam/transaction-2.1.xsd 2008-04-21 20:06:44 UTC (rev 7999)
+++ trunk/src/main/org/jboss/seam/transaction-2.1.xsd 2008-04-21 22:30:08 UTC (rev 8000)
@@ -5,6 +5,9 @@
<xs:import namespace="http://jboss.com/products/seam/components" schemaLocation="components-2.1.xsd"/>
<xs:element name="ejb-transaction">
+ <xs:annotation>
+ <xs:documentation></xs:documentation>
+ </xs:annotation>
<xs:complexType mixed="true">
<xs:attributeGroup ref="components:attlist.component"/>
<xs:attributeGroup ref="components:attlist.ejbcomponent"/>
@@ -14,29 +17,38 @@
<xs:attributeGroup name="attlist.transaction"> </xs:attributeGroup>
<xs:element name="hibernate-transaction">
+ <xs:annotation>
+ <xs:documentation></xs:documentation>
+ </xs:annotation>
<xs:complexType mixed="true">
<xs:attributeGroup ref="components:attlist.component"/>
<xs:attributeGroup ref="transaction:attlist.HibernateTransaction"/>
</xs:complexType>
</xs:element>
<xs:attributeGroup name="attlist.HibernateTransaction">
- <xs:attribute name="session" type="xs:string" use="required"/>
+ <xs:attribute name="session" type="components:string" use="required"/>
</xs:attributeGroup>
<xs:element name="entity-transaction">
+ <xs:annotation>
+ <xs:documentation></xs:documentation>
+ </xs:annotation>
<xs:complexType mixed="true">
<xs:attributeGroup ref="components:attlist.component"/>
<xs:attributeGroup ref="transaction:attlist.EntityTransaction"/>
</xs:complexType>
</xs:element>
<xs:attributeGroup name="attlist.EntityTransaction">
- <xs:attribute name="entity-manager" type="xs:string" use="required"/>
+ <xs:attribute name="entity-manager" type="components:string" use="required"/>
</xs:attributeGroup>
- <xs:element name="no-transaction">
+ <xs:element name="no-transaction">
+ <xs:annotation>
+ <xs:documentation></xs:documentation>
+ </xs:annotation>
<xs:complexType mixed="true">
<xs:attributeGroup ref="components:attlist.component"/>
</xs:complexType>
</xs:element>
-
+
</xs:schema>
Modified: trunk/src/main/org/jboss/seam/web-2.1.xsd
===================================================================
--- trunk/src/main/org/jboss/seam/web-2.1.xsd 2008-04-21 20:06:44 UTC (rev 7999)
+++ trunk/src/main/org/jboss/seam/web-2.1.xsd 2008-04-21 22:30:08 UTC (rev 8000)
@@ -5,6 +5,12 @@
<xs:import namespace="http://jboss.com/products/seam/components" schemaLocation="components-2.1.xsd"/>
<xs:element name="multipart-filter">
+ <xs:annotation>
+ <xs:documentation>
+ Detects multipart form requests and processes them according to the
+ multipart/form-data specification (RFC-2388).
+ </xs:documentation>
+ </xs:annotation>
<xs:complexType mixed="true">
<xs:attributeGroup ref="components:attlist.component"/>
<xs:attributeGroup ref="web:attlist.filter"/>
@@ -13,6 +19,10 @@
</xs:element>
<xs:element name="redirect-filter">
+ <xs:annotation>
+ <xs:documentation>This filter allows Seam to propagate the conversation context across browser redirects. It intercepts any
+browser redirects and adds a request parameter that specifies the Seam conversation identifier.</xs:documentation>
+ </xs:annotation>
<xs:complexType mixed="true">
<xs:attributeGroup ref="components:attlist.component"/>
<xs:attributeGroup ref="web:attlist.filter"/>
@@ -20,6 +30,9 @@
</xs:element>
<xs:element name="exception-filter">
+ <xs:annotation>
+ <xs:documentation>This filter provides the exception mapping functionality in pages.xml.</xs:documentation>
+ </xs:annotation>
<xs:complexType mixed="true">
<xs:attributeGroup ref="components:attlist.component"/>
<xs:attributeGroup ref="web:attlist.filter"/>
@@ -27,6 +40,10 @@
</xs:element>
<xs:element name="context-filter">
+ <xs:annotation>
+ <xs:documentation>This filter allows custom servlets to interact with the Seam contexts. It sets up the Seam contexts at the begin-
+ning of each request, and tears them down at the end of the request.</xs:documentation>
+ </xs:annotation>
<xs:complexType mixed="true">
<xs:attributeGroup ref="components:attlist.component"/>
<xs:attributeGroup ref="web:attlist.filter"/>
@@ -34,6 +51,9 @@
</xs:element>
<xs:element name="wicket-filter">
+ <xs:annotation>
+ <xs:documentation></xs:documentation>
+ </xs:annotation>
<xs:complexType mixed="true">
<xs:attributeGroup ref="components:attlist.component"/>
<xs:attributeGroup ref="web:attlist.filter"/>
@@ -42,26 +62,37 @@
</xs:element>
<xs:element name="character-encoding-filter">
+ <xs:annotation>
+ <xs:documentation>Sets the character encoding of submitted form data.</xs:documentation>
+ </xs:annotation>
<xs:complexType mixed="true">
<xs:attributeGroup ref="components:attlist.component"/>
<xs:attributeGroup ref="web:attlist.filter"/>
- <xs:attribute name="encoding" type="xs:string"/>
- <xs:attribute name="override-client" type="xs:boolean"/>
+ <xs:attribute name="encoding" type="components:string"/>
+ <xs:attribute name="override-client" type="components:boolean"/>
</xs:complexType>
</xs:element>
<xs:element name="authentication-filter">
+ <xs:annotation>
+ <xs:documentation>Although not recommended for use unless absolutely necessary, Seam provides means for authenticating using
+either HTTP Basic or HTTP Digest (RFC 2617) methods.</xs:documentation>
+ </xs:annotation>
<xs:complexType mixed="true">
<xs:attributeGroup ref="components:attlist.component"/>
<xs:attributeGroup ref="web:attlist.filter"/>
- <xs:attribute name="realm" type="xs:string"/>
- <xs:attribute name="key" type="xs:string"/>
- <xs:attribute name="nonce-validity-seconds" type="xs:int"/>
- <xs:attribute name="auth-type" type="xs:string"/>
+ <xs:attribute name="realm" type="components:string"/>
+ <xs:attribute name="key" type="components:string"/>
+ <xs:attribute name="nonce-validity-seconds" type="components:int"/>
+ <xs:attribute name="auth-type" type="components:string"/>
</xs:complexType>
</xs:element>
<xs:element name="logging-filter">
+ <xs:annotation>
+ <xs:documentation>This filter adds the authenticated user name to the log4j mapped diagnostic context so that it can be included in
+formatted log output if desired, by adding %X{username} to the pattern.</xs:documentation>
+ </xs:annotation>
<xs:complexType mixed="true">
<xs:attributeGroup ref="components:attlist.component"/>
<xs:attributeGroup ref="web:attlist.filter"/>
@@ -69,6 +100,9 @@
</xs:element>
<xs:element name="ajax4jsf-filter">
+ <xs:annotation>
+ <xs:documentation>The ajax4jsf filter for RichFaces</xs:documentation>
+ </xs:annotation>
<xs:complexType mixed="true">
<xs:attributeGroup ref="components:attlist.component"/>
<xs:attributeGroup ref="web:attlist.filter"/>
@@ -77,47 +111,26 @@
</xs:element>
<xs:attributeGroup name="attlist.filter">
- <xs:attribute name="url-pattern" type="xs:string"/>
- <xs:attribute name="regex-url-pattern" type="xs:string"/>
- <xs:attribute name="disabled" type="xs:boolean" default="false" />
+ <xs:attribute name="url-pattern" type="components:string"/>
+ <xs:attribute name="regex-url-pattern" type="components:string"/>
+ <xs:attribute name="disabled" type="components:boolean" default="false" />
</xs:attributeGroup>
<xs:attributeGroup name="attlist.wicketFilter">
- <xs:attribute name="application-class" type="xs:string"/>
- <xs:attribute name="application-factory-class" type="xs:string"/>
- <xs:attribute name="detect-portlet-context" type="xs:boolean" default="false" />
+ <xs:attribute name="application-class" type="components:string"/>
+ <xs:attribute name="application-factory-class" type="components:string"/>
+ <xs:attribute name="detect-portlet-context" type="components:boolean" default="false" />
</xs:attributeGroup>
<xs:attributeGroup name="attlist.multipartFilter">
- <xs:attribute name="create-temp-files">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="true"/>
- <xs:enumeration value="false"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="max-request-size" type="xs:integer"/>
+ <xs:attribute name="create-temp-files" type="components:boolean" />
+ <xs:attribute name="max-request-size" type="components:int"/>
</xs:attributeGroup>
<xs:attributeGroup name="attlist.ajax4jsfFilter">
- <xs:attribute name="enable-cache">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="true"/>
- <xs:enumeration value="false"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="force-parser">
- <xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="true"/>
- <xs:enumeration value="false"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="log4j-init-file" type="xs:string"/>
+ <xs:attribute name="enable-cache" type="components:boolean" />
+ <xs:attribute name="force-parser" type="components:boolean" />
+ <xs:attribute name="log4j-init-file" type="components:string"/>
</xs:attributeGroup>
<xs:element name="servlet-session">
@@ -126,8 +139,9 @@
<xs:attributeGroup ref="web:attlist.servlet-session"/>
</xs:complexType>
</xs:element>
+
<xs:attributeGroup name="attlist.servlet-session">
- <xs:attribute name="invalidate-on-scheme-change" type="xs:boolean"/>
+ <xs:attribute name="invalidate-on-scheme-change" type="components:boolean"/>
</xs:attributeGroup>
</xs:schema>
16 years, 9 months
Seam SVN: r7999 - trunk/src/main/org/jboss/seam.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2008-04-21 16:06:44 -0400 (Mon, 21 Apr 2008)
New Revision: 7999
Modified:
trunk/src/main/org/jboss/seam/components-2.1.xsd
Log:
JBSEAM-1531
Modified: trunk/src/main/org/jboss/seam/components-2.1.xsd
===================================================================
--- trunk/src/main/org/jboss/seam/components-2.1.xsd 2008-04-21 18:54:20 UTC (rev 7998)
+++ trunk/src/main/org/jboss/seam/components-2.1.xsd 2008-04-21 20:06:44 UTC (rev 7999)
@@ -1,8 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
- targetNamespace="http://jboss.com/products/seam/components"
- xmlns:components="http://jboss.com/products/seam/components">
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ targetNamespace="http://jboss.com/products/seam/components"
+ xmlns:components="http://jboss.com/products/seam/components">
+ <xs:annotation>
+ <xs:documentation>
+ The top-level schema for a Seam components.xml. For more information on Seam, see
+ http://www.seamframework.org.
+ </xs:documentation>
+ </xs:annotation>
+
<xs:element name="components">
+ <xs:annotation>
+ <xs:documentation> The components tag is a the root element for a components.xml containing multiples
+ component definitions. </xs:documentation>
+ </xs:annotation>
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="components:component"/>
@@ -13,7 +25,12 @@
</xs:choice>
</xs:complexType>
</xs:element>
+
<xs:element name="component">
+ <xs:annotation>
+ <xs:documentation> The component tag defines a single Seam component. It may serve as to the root element of
+ a fine-grained *.component.xml file. </xs:documentation>
+ </xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="components:property"/>
@@ -22,88 +39,204 @@
<xs:attributeGroup ref="components:attlist.ejbcomponent"/>
</xs:complexType>
</xs:element>
-
- <xs:element name="import" type="xs:string"/>
+ <xs:element name="import" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>
+ The import tag declares additional global component namespaces that will be in effect for
+ all components.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+
<xs:attributeGroup name="attlist.ejbcomponent">
- <xs:attribute name="jndi-name"/>
+ <xs:attribute name="jndi-name" type="components:string">
+ <xs:annotation>
+ <xs:documentation>
+ The JNDI name used to lookup the component. This value is only used with EJB
+ components that don't follow the global JNDI pattern.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:attributeGroup>
-
+
<xs:attributeGroup name="attlist.component">
- <xs:attribute name="name"/>
- <xs:attribute name="class"/>
+ <xs:attribute name="name" type="components:componentName">
+ <xs:annotation>
+ <xs:documentation>The name of component</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+
+ <xs:attribute name="class" type="components:componentName">
+ <xs:annotation>
+ <xs:documentation>The Java class of the component implementation</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+
<xs:attribute name="scope">
+ <xs:annotation>
+ <xs:documentation>The scope of the component</xs:documentation>
+ </xs:annotation>
+
<xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="stateless"/>
- <xs:enumeration value="event"/>
- <xs:enumeration value="page"/>
- <xs:enumeration value="conversation"/>
- <xs:enumeration value="session"/>
- <xs:enumeration value="business_process"/>
- <xs:enumeration value="application"/>
- <xs:enumeration value="STATELESS"/>
- <xs:enumeration value="EVENT"/>
- <xs:enumeration value="PAGE"/>
- <xs:enumeration value="CONVERSATION"/>
- <xs:enumeration value="SESSION"/>
- <xs:enumeration value="BUSINESS_PROCESS"/>
- <xs:enumeration value="APPLICATION"/>
- </xs:restriction>
+ <xs:union memberTypes="components:scopeType components:expressionType"></xs:union>
</xs:simpleType>
</xs:attribute>
- <xs:attribute name="precedence" type="xs:int"/>
- <xs:attribute name="installed" default="true" type="xs:boolean"/>
- <xs:attribute name="auto-create" default="false" type="xs:boolean"/>
- <xs:attribute name="startup" default="false" type="xs:boolean"/>
- <xs:attribute name="startupDepends" type="xs:string"/>
+
+ <xs:attribute name="precedence" default="20">
+ <xs:annotation>
+ <xs:documentation>
+ The precedence of the component, expressed as a positive integer. Higher
+ precedence components override lower precedence components. The pre-definied precedence
+ values are:
+
+ BUILT_IN = 0,
+ FRAMEWORK = 10,
+ APPLICATION = 20,
+ DEPLOYMENT = 30,
+ MOCK = 40
+ </xs:documentation>
+ </xs:annotation>
+ <xs:simpleType>
+ <xs:union memberTypes="xs:nonNegativeInteger components:precedenceType components:expressionType"></xs:union>
+ </xs:simpleType>
+ </xs:attribute>
+
+ <xs:attribute name="installed" default="true" type="components:boolean">
+ <xs:annotation>
+ <xs:documentation>
+ The installed value indicates whether or not the component definition should be installed.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+
+ <xs:attribute name="auto-create" default="false" type="components:boolean">
+ <xs:annotation>
+ <xs:documentation>
+ Indicates whether or not a components instance should be created when
+ one doesn't exist and when the component is requested using a method that
+ would not normally instantiate a new instance. (such as basic injection)
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+
+ <xs:attribute name="startup" default="false" type="components:boolean">
+ <xs:annotation>
+ <xs:documentation>
+ Indicates that an instance of the component should be created when the
+ the component's controlling scope starts. This is only used for application and
+ session scope.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+
+ <xs:attribute name="startupDepends" type="components:string">
+ <xs:annotation>
+ <xs:documentation>
+ A list of component names that this component depends on and that should be created before
+ this component is started.
+ </xs:documentation>
+ </xs:annotation></xs:attribute>
</xs:attributeGroup>
+
<xs:element name="factory">
+ <xs:annotation>
+ <xs:documentation>
+ Factories are like a component instances except their values are
+ determined by computing a value or calling a method on another
+ component.
+ </xs:documentation>
+ </xs:annotation>
<xs:complexType>
<xs:attributeGroup ref="components:attlist.factory"/>
</xs:complexType>
</xs:element>
+
<xs:attributeGroup name="attlist.factory">
- <xs:attribute name="name" use="required"/>
- <xs:attribute name="method"/>
- <xs:attribute name="value"/>
+ <xs:attribute name="name" use="required">
+ <xs:annotation>
+ <xs:documentation>The name of the factory component</xs:documentation>
+ </xs:annotation></xs:attribute>
+
+ <xs:attribute name="method">
+ <xs:annotation>
+ <xs:documentation>
+ The method binding used to evauluate the factory value. A factory should have either
+ a method binding or a value binding, but not both.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+
+ <xs:attribute name="value">
+ <xs:annotation>
+ <xs:documentation>
+ The value binding used to evauluate the factory value. A factory should have either
+ a method binding or a value binding, but not both.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+
<xs:attribute name="scope">
+ <xs:annotation>
+ <xs:documentation>The scope of the factory value</xs:documentation>
+ </xs:annotation>
+
<xs:simpleType>
- <xs:restriction base="xs:token">
- <xs:enumeration value="stateless"/>
- <xs:enumeration value="event"/>
- <xs:enumeration value="page"/>
- <xs:enumeration value="conversation"/>
- <xs:enumeration value="session"/>
- <xs:enumeration value="business_process"/>
- <xs:enumeration value="application"/>
- <xs:enumeration value="STATELESS"/>
- <xs:enumeration value="EVENT"/>
- <xs:enumeration value="PAGE"/>
- <xs:enumeration value="CONVERSATION"/>
- <xs:enumeration value="SESSION"/>
- <xs:enumeration value="BUSINESS_PROCESS"/>
- <xs:enumeration value="APPLICATION"/>
- </xs:restriction>
+ <xs:union memberTypes="components:scopeType components:expressionType"></xs:union>
</xs:simpleType>
</xs:attribute>
- <xs:attribute name="auto-create" type="xs:boolean"/>
+
+ <xs:attribute name="auto-create" default="false" type="components:boolean">
+ <xs:annotation>
+ <xs:documentation>
+ Indicates whether or not the factory value should be created when
+ one doesn't exist and when the component is requested using a method that
+ would not normally instantiate a new instance. (such as basic injection)
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:attributeGroup>
+
+
<xs:element name="property">
+ <xs:annotation>
+ <xs:documentation>
+ A generic property. The body contains the value or values.
+ </xs:documentation>
+ </xs:annotation>
<xs:complexType mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="components:key"/>
- <xs:element ref="components:value"/>
+ <xs:element ref="components:key" />
+ <xs:element ref="components:value" />
</xs:choice>
<xs:attributeGroup ref="components:attlist.property"/>
</xs:complexType>
</xs:element>
+
<xs:attributeGroup name="attlist.property">
- <xs:attribute name="name" use="required"/>
+ <xs:attribute name="name" use="required" type="components:string">
+ <xs:annotation>
+ <xs:documentation>The property name</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:attributeGroup>
- <xs:element name="key" type="xs:string"/>
- <xs:element name="value" type="xs:string"/>
+
+ <xs:element name="key" type="components:string">
+ <xs:annotation>
+ <xs:documentation>For map values, the key for the following value</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="value" type="components:string">
+ <xs:annotation>
+ <xs:documentation>
+ For list values, the value to be added.
+ For map values, the value for the preceding key
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+
<xs:complexType name="multiValuedProperty">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element ref="components:value"/>
@@ -118,6 +251,9 @@
</xs:complexType>
<xs:element name="event">
+ <xs:annotation>
+ <xs:documentation>An event handler definition</xs:documentation>
+ </xs:annotation>
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="components:action"/>
@@ -125,17 +261,97 @@
<xs:attributeGroup ref="components:attlist.event"/>
</xs:complexType>
</xs:element>
+
<xs:attributeGroup name="attlist.event">
- <xs:attribute name="type" use="required"/>
+ <xs:attribute name="type" use="required" type="components:componentNameType" >
+ <xs:annotation>
+ <xs:documentation>The event type to handle</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:attributeGroup>
<xs:element name="action">
+ <xs:annotation>
+ <xs:documentation>The action to be taken when the event occurs</xs:documentation>
+ </xs:annotation>
<xs:complexType>
<xs:attributeGroup ref="components:attlist.action"/>
</xs:complexType>
</xs:element>
+
<xs:attributeGroup name="attlist.action">
- <xs:attribute name="execute" use="required"/>
+ <xs:attribute name="execute" use="required" type="components:elType">
+ <xs:annotation>
+ <xs:documentation>An EL expression to be invoked when the event is invoked</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:attributeGroup>
+ <xs:simpleType name="propertyType">
+ <xs:restriction base="xs:string">
+ <xs:pattern value="@.+@"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="elType">
+ <xs:restriction base="xs:string">
+ <xs:pattern value="\#\{.+\}"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <!-- place holder - need something more expressive -->
+ <xs:simpleType name="componentNameType">
+ <xs:restriction base="xs:string">
+ <xs:minLength value="1" />
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="expressionType">
+ <xs:union memberTypes="components:elType components:propertyType"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="boolean">
+ <xs:union memberTypes="xs:boolean components:expressionType"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="string">
+ <xs:union memberTypes="xs:string components:expressionType"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="int">
+ <xs:union memberTypes="xs:int components:expressionType"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="componentName">
+ <xs:union memberTypes="components:componentNameType components:expressionType" />
+ </xs:simpleType>
+
+ <xs:simpleType name="scopeType">
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="stateless"/>
+ <xs:enumeration value="event"/>
+ <xs:enumeration value="page"/>
+ <xs:enumeration value="conversation"/>
+ <xs:enumeration value="session"/>
+ <xs:enumeration value="business_process"/>
+ <xs:enumeration value="application"/>
+ <xs:enumeration value="STATELESS"/>
+ <xs:enumeration value="EVENT"/>
+ <xs:enumeration value="PAGE"/>
+ <xs:enumeration value="CONVERSATION"/>
+ <xs:enumeration value="SESSION"/>
+ <xs:enumeration value="BUSINESS_PROCESS"/>
+ <xs:enumeration value="APPLICATION"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="precedenceType">
+ <xs:restriction base="xs:int">
+ <xs:enumeration value="0"/>
+ <xs:enumeration value="10"/>
+ <xs:enumeration value="20"/>
+ <xs:enumeration value="30"/>
+ <xs:enumeration value="40"/>
+ </xs:restriction>
+ </xs:simpleType>
</xs:schema>
16 years, 9 months