Seam SVN: r7580 - trunk/doc/reference/en/modules.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-03-14 08:24:55 -0400 (Fri, 14 Mar 2008)
New Revision: 7580
Modified:
trunk/doc/reference/en/modules/configuration.xml
Log:
Document that you should use JBoss Portlet Bridge
Modified: trunk/doc/reference/en/modules/configuration.xml
===================================================================
--- trunk/doc/reference/en/modules/configuration.xml 2008-03-14 12:08:54 UTC (rev 7579)
+++ trunk/doc/reference/en/modules/configuration.xml 2008-03-14 12:24:55 UTC (rev 7580)
@@ -864,12 +864,15 @@
</sect1>
<sect1>
- <title>Configuring Seam in a Portal</title>
+ <title>Running Seam in a Portlet</title>
- <para> To run a Seam application as a portlet, you'll need to provide certain portlet metadata
- (<literal>portlet.xml</literal>, etc) in addition to the usual Java EE metadata. See the
- <literal>examples/portal</literal> directory for an example of the booking demo preconfigured to run on
- JBoss Portal. </para>
+ <para>
+ If you want to run your Seam application in a portlet, take a look at
+ the JBoss Portlet Bridge, an implementation of JSR-301 that supports
+ JSF within a portlet, with extensions for Seam and RichFaces. See
+ <ulink url="http://labs.jboss.com/portletbridge">http://labs.jboss.com/portletbridge</ulink>
+ for more.
+ </para>
</sect1>
18 years, 1 month
Seam SVN: r7579 - trunk/src/main/org/jboss/seam/jsf.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-03-14 08:08:54 -0400 (Fri, 14 Mar 2008)
New Revision: 7579
Modified:
trunk/src/main/org/jboss/seam/jsf/MapDataModel.java
Log:
minor
Modified: trunk/src/main/org/jboss/seam/jsf/MapDataModel.java
===================================================================
--- trunk/src/main/org/jboss/seam/jsf/MapDataModel.java 2008-03-14 12:07:24 UTC (rev 7578)
+++ trunk/src/main/org/jboss/seam/jsf/MapDataModel.java 2008-03-14 12:08:54 UTC (rev 7579)
@@ -150,7 +150,7 @@
{
rowIndex = ois.readInt();
data = (Map) ois.readObject();
- entries = data == null ? null : new ArrayList( ( (Map) data ).entrySet() );
+ entries = data == null ? null : new ArrayList( data.entrySet() );
}
}
18 years, 1 month
Seam SVN: r7578 - trunk/src/main/org/jboss/seam/jsf.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-03-14 08:07:24 -0400 (Fri, 14 Mar 2008)
New Revision: 7578
Modified:
trunk/src/main/org/jboss/seam/jsf/MapDataModel.java
Log:
JBSEAM-1659
Modified: trunk/src/main/org/jboss/seam/jsf/MapDataModel.java
===================================================================
--- trunk/src/main/org/jboss/seam/jsf/MapDataModel.java 2008-03-14 11:47:09 UTC (rev 7577)
+++ trunk/src/main/org/jboss/seam/jsf/MapDataModel.java 2008-03-14 12:07:24 UTC (rev 7578)
@@ -28,8 +28,10 @@
private static final long serialVersionUID = -4888962547222002402L;
private int rowIndex = -1;
- private List<Map.Entry> entries;
+ private Map data;
+ private transient List<Map.Entry> entries;
+
public MapDataModel() {}
public MapDataModel(Map map)
@@ -131,6 +133,7 @@
@Override
public void setWrappedData(Object data)
{
+ this.data = (Map) data;
entries = data == null ? null : new ArrayList( ( (Map) data ).entrySet() );
int rowIndex = data != null ? 0 : -1;
setRowIndex(rowIndex);
@@ -139,14 +142,15 @@
private void writeObject(ObjectOutputStream oos) throws IOException
{
oos.writeInt(rowIndex);
- oos.writeObject(entries);
+ oos.writeObject(data);
}
private void readObject(ObjectInputStream ois) throws IOException,
ClassNotFoundException
{
rowIndex = ois.readInt();
- entries = (List<Map.Entry>) ois.readObject();
+ data = (Map) ois.readObject();
+ entries = data == null ? null : new ArrayList( ( (Map) data ).entrySet() );
}
}
18 years, 1 month
Seam SVN: r7577 - in trunk/src: test/integration/src/org/jboss/seam/test/integration/databinding and 1 other directory.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-03-14 07:47:09 -0400 (Fri, 14 Mar 2008)
New Revision: 7577
Modified:
trunk/src/main/org/jboss/seam/jsf/MapDataModel.java
trunk/src/main/org/jboss/seam/jsf/SetDataModel.java
trunk/src/test/integration/src/org/jboss/seam/test/integration/databinding/DataModelTest.java
Log:
JBSEAM-1660
Modified: trunk/src/main/org/jboss/seam/jsf/MapDataModel.java
===================================================================
--- trunk/src/main/org/jboss/seam/jsf/MapDataModel.java 2008-03-14 06:37:23 UTC (rev 7576)
+++ trunk/src/main/org/jboss/seam/jsf/MapDataModel.java 2008-03-14 11:47:09 UTC (rev 7577)
@@ -131,7 +131,7 @@
@Override
public void setWrappedData(Object data)
{
- entries = new ArrayList( ( (Map) data ).entrySet() );
+ entries = data == null ? null : new ArrayList( ( (Map) data ).entrySet() );
int rowIndex = data != null ? 0 : -1;
setRowIndex(rowIndex);
}
Modified: trunk/src/main/org/jboss/seam/jsf/SetDataModel.java
===================================================================
--- trunk/src/main/org/jboss/seam/jsf/SetDataModel.java 2008-03-14 06:37:23 UTC (rev 7576)
+++ trunk/src/main/org/jboss/seam/jsf/SetDataModel.java 2008-03-14 11:47:09 UTC (rev 7577)
@@ -118,7 +118,7 @@
@Override
public void setWrappedData(Object data)
{
- entries = new ArrayList( (Set) data );
+ entries = data == null ? null : new ArrayList( (Set) data );
int rowIndex = data != null ? 0 : -1;
setRowIndex(rowIndex);
}
Modified: trunk/src/test/integration/src/org/jboss/seam/test/integration/databinding/DataModelTest.java
===================================================================
--- trunk/src/test/integration/src/org/jboss/seam/test/integration/databinding/DataModelTest.java 2008-03-14 06:37:23 UTC (rev 7576)
+++ trunk/src/test/integration/src/org/jboss/seam/test/integration/databinding/DataModelTest.java 2008-03-14 11:47:09 UTC (rev 7577)
@@ -182,8 +182,9 @@
}
}
- //JBSEAM-1659
-
+ /**
+ * JBSEAM-1659
+ */
@Test
public void testMapDataModelSerialization() throws Exception
{
18 years, 1 month
Seam SVN: r7576 - trunk/src/main/org/jboss/seam.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2008-03-14 02:37:23 -0400 (Fri, 14 Mar 2008)
New Revision: 7576
Modified:
trunk/src/main/org/jboss/seam/Component.java
Log:
JBSEAM-2642
Modified: trunk/src/main/org/jboss/seam/Component.java
===================================================================
--- trunk/src/main/org/jboss/seam/Component.java 2008-03-14 04:59:44 UTC (rev 7575)
+++ trunk/src/main/org/jboss/seam/Component.java 2008-03-14 06:37:23 UTC (rev 7576)
@@ -1317,21 +1317,50 @@
}
}
- protected Object instantiateSessionBean() throws Exception, NamingException
+ protected void postConstruct(Object bean) throws Exception
+ {
+ switch(type) {
+ case JAVA_BEAN:
+ postConstructJavaBean(bean);
+ break;
+ case ENTITY_BEAN:
+ postConstructEntityBean(bean);
+ break;
+ case STATELESS_SESSION_BEAN:
+ case STATEFUL_SESSION_BEAN:
+ postConstructSessionBean(bean);
+ break;
+ case MESSAGE_DRIVEN_BEAN:
+ throw new UnsupportedOperationException("Message-driven beans may not be called: " + name);
+ default:
+ throw new IllegalStateException();
+ }
+ }
+
+
+ protected Object instantiateSessionBean()
+ throws Exception,
+ NamingException
{
Component old = SeamInterceptor.COMPONENT.get();
SeamInterceptor.COMPONENT.set(this);
- try
- {
+ try {
Object bean = Naming.getInitialContext().lookup(jndiName);
- return wrap( bean, new ClientSideInterceptor(bean, this) );
- }
- finally
- {
+ return wrap(bean, new ClientSideInterceptor(bean, this));
+ } finally {
SeamInterceptor.COMPONENT.set(old);
}
}
+
+ protected void postConstructSessionBean(Object bean)
+ throws Exception,
+ NamingException
+ {
+ // ...
+ }
+
+
protected Object instantiateEntityBean() throws Exception
{
Constructor constructor = getBeanClass().getConstructor(new Class[0]);
@@ -1342,27 +1371,45 @@
}
Object bean = getBeanClass().newInstance();
constructor.setAccessible(accessible);
- initialize(bean);
return bean;
}
+
+
+ protected void postConstructEntityBean(Object bean)
+ throws Exception
+ {
+ initialize(bean);
+ }
protected Object instantiateJavaBean() throws Exception
{
Object bean = getBeanClass().newInstance();
- if ( !interceptionEnabled )
- {
- initialize(bean);
- callPostConstructMethod(bean);
- }
- else
- {
+
+ if (interceptionEnabled) {
JavaBeanInterceptor interceptor = new JavaBeanInterceptor(bean, this);
bean = wrap(bean, interceptor);
- interceptor.postConstruct();
}
+
return bean;
}
+
+ protected void postConstructJavaBean(Object bean)
+ throws Exception
+ {
+ if (!interceptionEnabled) {
+ initialize(bean);
+ callPostConstructMethod(bean);
+ } else {
+ if (bean instanceof Proxy) {
+ Proxy proxy = (Proxy) bean;
+ JavaBeanInterceptor interceptor = (JavaBeanInterceptor) proxy.writeReplace();
+
+ interceptor.postConstruct();
+ }
+ }
+ }
+
public void destroy(Object bean)
{
try
@@ -1999,25 +2046,35 @@
public Object newInstance()
{
- if ( log.isDebugEnabled() ) log.debug("instantiating Seam component: " + name);
+ if (log.isDebugEnabled()) {
+ log.debug("instantiating Seam component: " + name);
+ }
Object instance;
- try
- {
+ try{
instance = instantiate();
- }
- catch (Exception e)
- {
+
+ if (getScope()!=STATELESS) {
+ //put it in the context _before_ calling postconstuct or create
+ getScope().getContext().set(name, instance);
+ }
+
+ postConstruct(instance);
+
+ if (getScope()!=STATELESS) {
+ callCreateMethod(instance);
+
+ if (Events.exists()) {
+ Events.instance().raiseEvent("org.jboss.seam.postCreate." + name, instance);
+ }
+ }
+
+ } catch (Exception e) {
+ //getScope().getContext().remove(name);
+
throw new InstantiationException("Could not instantiate Seam component: " + name, e);
}
- if ( getScope()!=STATELESS )
- {
- getScope().getContext().set(name, instance); //put it in the context _before_ calling the create method
- callCreateMethod(instance);
- if ( Events.exists() ) Events.instance().raiseEvent("org.jboss.seam.postCreate." + name, instance);
- }
-
return instance;
}
18 years, 1 month
Seam SVN: r7575 - in trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search: metamodel and 1 other directory.
by seam-commits@lists.jboss.org
Author: christian.bauer(a)jboss.com
Date: 2008-03-14 00:59:44 -0400 (Fri, 14 Mar 2008)
New Revision: 7575
Modified:
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/WikiSearch.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/metamodel/SearchRegistry.java
Log:
JBSEAM-2731, wiki search did not restrict access level properly
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/WikiSearch.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/WikiSearch.java 2008-03-13 23:45:07 UTC (rev 7574)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/WikiSearch.java 2008-03-14 04:59:44 UTC (rev 7575)
@@ -1,9 +1,11 @@
package org.jboss.seam.wiki.core.search;
import org.apache.lucene.search.*;
+import org.apache.lucene.index.Term;
import org.hibernate.Hibernate;
import org.hibernate.search.FullTextQuery;
import org.hibernate.search.FullTextSession;
+import org.hibernate.search.engine.DocumentBuilder;
import org.hibernate.search.bridge.StringBridge;
import org.jboss.seam.Component;
import org.jboss.seam.ScopeType;
@@ -133,53 +135,63 @@
BooleanQuery mainQuery = new BooleanQuery();
// Get value holders filled out by UI forms and generate a Lucene query
- Class[] indexedEntities = new Class[searchableEntities.size()];
- int i = 0;
for (SearchableEntity searchableEntity : searchableEntities) {
log.debug("building query for entity: " + searchableEntity.getClazz());
BooleanQuery entityQuery = new BooleanQuery();
+ // Add restriction to entity clazz
+ // We use a Hibernate Search internal constant here to limit THIS particular entity query
+ // fragment to a particular indexed persistent entity type.
+ log.debug("adding restriction to entity clazz: " + searchableEntity.getClazz().getName());
+ entityQuery.add(
+ new TermQuery(
+ new Term(DocumentBuilder.CLASS_FIELDNAME, searchableEntity.getClazz().getName())
+ ),
+ BooleanClause.Occur.MUST
+ );
+
// Add sub-queries for all entity properties
+ BooleanQuery allPropertiesQuery = new BooleanQuery();
for (PropertySearch search : searches.get(searchableEntity)) {
log.debug("building query for property: " + search.getProperty());
- Query query = search.getProperty().getQuery(search);
- if (query != null) {
- log.debug("adding query for property to owning entity: " + query.toString());
- // If there is more than one searchable entity, use OR, otherwise combine properties with AND
- entityQuery.add(
- query,
- searchableEntities.size() > 1 ? BooleanClause.Occur.SHOULD : BooleanClause.Occur.MUST
+ Query propertiesQuery = search.getProperty().getQuery(search);
+ if (propertiesQuery != null) {
+ // Any property can match, except if we are searching only one entity, then all must match
+ allPropertiesQuery.add(
+ propertiesQuery,
+ searchableEntities.size() == 1 ? BooleanClause.Occur.MUST : BooleanClause.Occur.SHOULD
);
}
}
- // Add to main query with or without access control filter wrapping
- if (entityQuery.getClauses().length > 0 && searchableEntity.getHandler().isReadAccessChecked()) {
+ // But SOME of the property searches for this entity must match
+ log.debug("adding query to owning entity for properties: " + allPropertiesQuery.getClauses().length);
+ entityQuery.add(allPropertiesQuery, BooleanClause.Occur.MUST);
+ // Finally, figure out if this entity query needs to be read-restricted, we have indexed the readAccessLevel of it
+ if (searchableEntity.getHandler().isReadAccessChecked()) {
+
Integer currentAccessLevel = (Integer)Component.getInstance("currentAccessLevel");
StringBridge paddingBridge = new PaddedIntegerBridge();
Query accessLimitQuery =
new ConstantScoreRangeQuery(FIELD_READACCESSLVL, null, paddingBridge.objectToString(currentAccessLevel), true, true);
- Filter accessFilter = new QueryFilter(accessLimitQuery);
+ Filter accessFilter = new QueryWrapperFilter(accessLimitQuery);
FilteredQuery accessFilterQuery = new FilteredQuery(entityQuery, accessFilter);
+ log.debug("adding filtered entity query to main query: " + accessFilterQuery);
mainQuery.add(accessFilterQuery, BooleanClause.Occur.SHOULD);
- } else if (entityQuery.getClauses().length > 0) {
-
+ } else {
+ log.debug("adding unfiltered entity query to main query: " + entityQuery);
mainQuery.add(entityQuery, BooleanClause.Occur.SHOULD);
-
}
-
- indexedEntities[i++] = searchableEntity.getClazz();
}
+ log.debug(">>>>> search query: " + mainQuery.toString());
- log.debug("search query: " + mainQuery.toString());
-
try {
- FullTextQuery ftQuery = getFullTextSession().createFullTextQuery(mainQuery, indexedEntities);
+ FullTextQuery ftQuery = getFullTextSession().createFullTextQuery(mainQuery);
ftQuery.setFirstResult(page * pageSize).setMaxResults(pageSize);
totalCount = ftQuery.getResultSize();
log.debug("total search hits (might be paginated next): " + totalCount);
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/metamodel/SearchRegistry.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/metamodel/SearchRegistry.java 2008-03-13 23:45:07 UTC (rev 7574)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/search/metamodel/SearchRegistry.java 2008-03-14 04:59:44 UTC (rev 7575)
@@ -42,7 +42,6 @@
searchableEntitiesByName.clear();
// Fire an event and let all listeners add themself into the given collection
- // TODO: Is this smarter than PreferenceRegistry scanning approach?
Set<SearchSupport> searchSupportComponents = new HashSet<SearchSupport>();
Events.instance().raiseEvent("Search.addSearchSupport", searchSupportComponents);
18 years, 1 month
Seam SVN: r7574 - trunk/src/main/org/jboss/seam/security/permission.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-03-13 19:45:07 -0400 (Thu, 13 Mar 2008)
New Revision: 7574
Modified:
trunk/src/main/org/jboss/seam/security/permission/DynamicPermissionResolver.java
Log:
implementation
Modified: trunk/src/main/org/jboss/seam/security/permission/DynamicPermissionResolver.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/permission/DynamicPermissionResolver.java 2008-03-13 19:17:15 UTC (rev 7573)
+++ trunk/src/main/org/jboss/seam/security/permission/DynamicPermissionResolver.java 2008-03-13 23:45:07 UTC (rev 7574)
@@ -4,12 +4,16 @@
import static org.jboss.seam.annotations.Install.FRAMEWORK;
import java.io.Serializable;
+import java.util.List;
+import org.jboss.seam.Seam;
import org.jboss.seam.annotations.Install;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.Startup;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.security.Identity;
+import org.jboss.seam.security.permission.AccountPermission.AccountType;
/**
* Resolves permissions dynamically assigned in a persistent store, such as a
@@ -24,8 +28,49 @@
@Startup
public class DynamicPermissionResolver implements PermissionResolver, Serializable
{
- public boolean hasPermission(Object target, String action)
+ private PermissionStore permissionStore;
+
+ public PermissionStore getPermissionStore()
{
- return false;
+ 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<AccountPermission> permissions = permissionStore.listPermissions(targetName, action);
+
+ String username = identity.getPrincipal().getName();
+
+ for (AccountPermission permission : permissions)
+ {
+ if (username.equals(permission.getAccount()) && permission.getAccountType().equals(AccountType.user))
+ {
+ return true;
+ }
+
+ if (permission.getAccountType().equals(AccountType.role) && identity.hasRole(permission.getAccount()))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
}
18 years, 1 month
Seam SVN: r7573 - branches/Seam_2_0/seam-gen.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-03-13 15:17:15 -0400 (Thu, 13 Mar 2008)
New Revision: 7573
Modified:
branches/Seam_2_0/seam-gen/build.xml
Log:
Backport r7572
Modified: branches/Seam_2_0/seam-gen/build.xml
===================================================================
--- branches/Seam_2_0/seam-gen/build.xml 2008-03-13 19:14:38 UTC (rev 7572)
+++ branches/Seam_2_0/seam-gen/build.xml 2008-03-13 19:17:15 UTC (rev 7573)
@@ -1046,6 +1046,7 @@
<pathelement path="../lib/hibernate-commons-annotations.jar" />
<pathelement path="../lib/hibernate-annotations.jar" />
<pathelement path="../lib/hibernate-entitymanager.jar" />
+ <pathelement path="../lib/hibernate-validator.jar"/>
<pathelement path="../lib/commons-collections.jar" />
<pathelement path="../lib/commons-logging.jar" />
<pathelement path="../lib/javassist.jar" />
18 years, 1 month
Seam SVN: r7572 - trunk/seam-gen.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-03-13 15:14:38 -0400 (Thu, 13 Mar 2008)
New Revision: 7572
Modified:
trunk/seam-gen/build.xml
Log:
Fix CNFE reported by Hibernate Tools
Modified: trunk/seam-gen/build.xml
===================================================================
--- trunk/seam-gen/build.xml 2008-03-13 18:50:20 UTC (rev 7571)
+++ trunk/seam-gen/build.xml 2008-03-13 19:14:38 UTC (rev 7572)
@@ -1047,6 +1047,7 @@
<pathelement path="../lib/hibernate-commons-annotations.jar" />
<pathelement path="../lib/hibernate-annotations.jar" />
<pathelement path="../lib/hibernate-entitymanager.jar" />
+ <pathelement path="../lib/hibernate-validator.jar"/>
<pathelement path="../lib/commons-collections.jar" />
<pathelement path="../lib/commons-logging.jar" />
<pathelement path="../lib/javassist.jar" />
18 years, 1 month
Seam SVN: r7571 - branches/Seam_2_0/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-03-13 14:50:20 -0400 (Thu, 13 Mar 2008)
New Revision: 7571
Modified:
branches/Seam_2_0/doc/Seam_Reference_Guide/en-US/
Log:
ignores
Property changes on: branches/Seam_2_0/doc/Seam_Reference_Guide/en-US
___________________________________________________________________
Name: svn:ignore
+ resolved.xml
18 years, 1 month