Seam SVN: r11949 - branches/enterprise/JBPAPP_5_0/build.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-01-13 03:54:19 -0500 (Wed, 13 Jan 2010)
New Revision: 11949
Modified:
branches/enterprise/JBPAPP_5_0/build/default.build.properties
Log:
update version string for EAP 5.0.1 release
Modified: branches/enterprise/JBPAPP_5_0/build/default.build.properties
===================================================================
--- branches/enterprise/JBPAPP_5_0/build/default.build.properties 2010-01-13 08:21:20 UTC (rev 11948)
+++ branches/enterprise/JBPAPP_5_0/build/default.build.properties 2010-01-13 08:54:19 UTC (rev 11949)
@@ -7,7 +7,7 @@
# ------------
major.version 2
minor.version .2
-patchlevel .0
+patchlevel .1
qualifier .EAP5
#
# Other program locations
14 years, 11 months
Seam SVN: r11948 - branches/community/Seam_2_2/src/test/ftest/examples.
by seam-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2010-01-13 03:21:20 -0500 (Wed, 13 Jan 2010)
New Revision: 11948
Modified:
branches/community/Seam_2_2/src/test/ftest/examples/build.xml
Log:
JBSEAM-4518 the test now only needs jboss5.home to be set
Modified: branches/community/Seam_2_2/src/test/ftest/examples/build.xml
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/examples/build.xml 2010-01-13 08:19:34 UTC (rev 11947)
+++ branches/community/Seam_2_2/src/test/ftest/examples/build.xml 2010-01-13 08:21:20 UTC (rev 11948)
@@ -136,7 +136,7 @@
<sysproperty key="openid.account" value="${openid.account}" />
<sysproperty key="openid.password" value="${openid.password}" />
<sysproperty key="seam.dir" value="${seam.dir}" />
- <sysproperty key="jboss.home" value="${jboss.home}" />
+ <sysproperty key="jboss.home" value="${container.home}" />
</testng>
</target>
14 years, 11 months
Seam SVN: r11947 - branches/enterprise/JBPAPP_5_0/src/test/ftest/examples.
by seam-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2010-01-13 03:19:34 -0500 (Wed, 13 Jan 2010)
New Revision: 11947
Modified:
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/build.xml
Log:
JBPAPP-3348 the test now needs only jboss5.home to be set
Modified: branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/build.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/build.xml 2010-01-12 21:53:08 UTC (rev 11946)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/build.xml 2010-01-13 08:19:34 UTC (rev 11947)
@@ -121,7 +121,7 @@
<sysproperty key="openid.account" value="${openid.account}" />
<sysproperty key="openid.password" value="${openid.password}" />
<sysproperty key="seam.dir" value="${seam.dir}" />
- <sysproperty key="jboss.home" value="${jboss.home}" />
+ <sysproperty key="jboss.home" value="${container.home}" />
</testng>
</target>
14 years, 11 months
Seam SVN: r11946 - modules/drools/trunk/src/main/java/org/jboss/seam/drools.
by seam-commits@lists.jboss.org
Author: tsurdilovic
Date: 2010-01-12 16:53:08 -0500 (Tue, 12 Jan 2010)
New Revision: 11946
Modified:
modules/drools/trunk/src/main/java/org/jboss/seam/drools/KnowledgeSessionManager.java
modules/drools/trunk/src/main/java/org/jboss/seam/drools/KnowledgeSessionManagerConfig.java
Log:
Drools 5 Integration.
Modified: modules/drools/trunk/src/main/java/org/jboss/seam/drools/KnowledgeSessionManager.java
===================================================================
--- modules/drools/trunk/src/main/java/org/jboss/seam/drools/KnowledgeSessionManager.java 2010-01-12 01:12:46 UTC (rev 11945)
+++ modules/drools/trunk/src/main/java/org/jboss/seam/drools/KnowledgeSessionManager.java 2010-01-12 21:53:08 UTC (rev 11946)
@@ -7,18 +7,24 @@
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.inject.Inject;
import javax.inject.Named;
+import javax.security.auth.login.Configuration;
import org.drools.KnowledgeBase;
import org.drools.KnowledgeBaseFactory;
+import org.drools.event.process.ProcessEventListener;
+import org.drools.event.rule.AgendaEventListener;
+import org.drools.event.rule.WorkingMemoryEventListener;
import org.drools.logger.KnowledgeRuntimeLogger;
import org.drools.logger.KnowledgeRuntimeLoggerFactory;
import org.drools.runtime.KnowledgeSessionConfiguration;
import org.drools.runtime.StatefulKnowledgeSession;
import org.drools.runtime.StatelessKnowledgeSession;
+import org.drools.runtime.process.WorkItemHandler;
import org.jboss.seam.drools.events.KnowledgeSessionCreatedEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -52,8 +58,8 @@
public StatefulKnowledgeSession getStatefulSession(InjectionPoint injectionPoint) throws Exception
{
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(getKSessionConfig(), null);
- //addEventListeners(ksession);
- //addWorkItemHandlers(ksession);
+ addEventListeners(ksession);
+ addWorkItemHandlers(ksession);
addAuditLog(ksession);
manager.fireEvent(new KnowledgeSessionCreatedEvent(ksession.getId()));
return ksession;
@@ -73,7 +79,7 @@
public StatelessKnowledgeSession getStatelessSession(InjectionPoint injectionPoint) throws Exception
{
StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession(getKSessionConfig());
- //addEventListeners(ksession);
+ addEventListeners(ksession);
manager.fireEvent(new KnowledgeSessionCreatedEvent(-1));
return ksession;
}
@@ -103,7 +109,7 @@
}
- private void addAuditLog(StatefulKnowledgeSession ksession) {
+ private void addAuditLog(StatefulKnowledgeSession ksession) throws Exception {
if(ksessionManagerConfig.getAuditLog() != null) {
if(KnowledgeSessionManagerConfig.isFileLogger(ksessionManagerConfig.getAuditLog())) {
String logName = KnowledgeSessionManagerConfig.getFileLoggerPath(ksessionManagerConfig.getAuditLog()) + System.currentTimeMillis();
@@ -122,5 +128,58 @@
}
}
}
+
+ public void addEventListeners(StatefulKnowledgeSession ksession) throws Exception {
+ if(ksessionManagerConfig.getEventListeners() != null) {
+ for(String eventListener : ksessionManagerConfig.getEventListeners()) {
+ Class eventListenerClass = Class.forName(eventListener);
+ Object eventListenerObject = eventListenerClass.newInstance();
+
+ if(eventListenerObject instanceof WorkingMemoryEventListener) {
+ ksession.addEventListener((WorkingMemoryEventListener) eventListenerObject);
+ } else if(eventListenerObject instanceof AgendaEventListener) {
+ ksession.addEventListener((AgendaEventListener) eventListenerObject);
+ } else if(eventListenerObject instanceof ProcessEventListener) {
+ ksession.addEventListener((ProcessEventListener) eventListenerObject);
+ } else {
+ log.debug("Invalid Event Listener: " + eventListener);
+ }
+ }
+ }
+ }
+
+ public void addEventListeners(StatelessKnowledgeSession ksession) throws Exception{
+ if(ksessionManagerConfig.getEventListeners() != null) {
+ for(String eventListener : ksessionManagerConfig.getEventListeners()) {
+ Class eventListenerClass = Class.forName(eventListener);
+ Object eventListenerObject = eventListenerClass.newInstance();
+
+ if(eventListenerObject instanceof WorkingMemoryEventListener) {
+ ksession.addEventListener((WorkingMemoryEventListener) eventListenerObject);
+ } else if(eventListenerObject instanceof AgendaEventListener) {
+ ksession.addEventListener((AgendaEventListener) eventListenerObject);
+ } else if(eventListenerObject instanceof ProcessEventListener) {
+ ksession.addEventListener((ProcessEventListener) eventListenerObject);
+ } else {
+ log.debug("Invalid Event Listener: " + eventListener);
+ }
+ }
+ }
+ }
+
+ public void addWorkItemHandlers(StatefulKnowledgeSession ksession) {
+ if(ksessionManagerConfig.getWorkItemHandlers() != null) {
+ for(String workItemHandlerStr : ksessionManagerConfig.getWorkItemHandlers()) {
+ if(KnowledgeSessionManagerConfig.isValidWorkItemHandler(workItemHandlerStr)) {
+ @SuppressWarnings("unchecked")
+ Bean<WorkItemHandler> workItemHandlerBean = (Bean<WorkItemHandler>) manager.getBeans(KnowledgeSessionManagerConfig.getWorkItemHandlerType(workItemHandlerStr)).iterator().next();
+ WorkItemHandler handler = (WorkItemHandler) manager.getReference(workItemHandlerBean, Configuration.class, manager.createCreationalContext(workItemHandlerBean));
+ log.debug("Registering new WorkItemHandler: " + KnowledgeSessionManagerConfig.getWorkItemHandlerName(workItemHandlerStr));
+ ksession.getWorkItemManager().registerWorkItemHandler(KnowledgeSessionManagerConfig.getWorkItemHandlerName(workItemHandlerStr), handler);
+ }
+ }
+ }
+ }
+
}
Modified: modules/drools/trunk/src/main/java/org/jboss/seam/drools/KnowledgeSessionManagerConfig.java
===================================================================
--- modules/drools/trunk/src/main/java/org/jboss/seam/drools/KnowledgeSessionManagerConfig.java 2010-01-12 01:12:46 UTC (rev 11945)
+++ modules/drools/trunk/src/main/java/org/jboss/seam/drools/KnowledgeSessionManagerConfig.java 2010-01-12 21:53:08 UTC (rev 11946)
@@ -26,6 +26,18 @@
private Properties knowledgeSessionConfigProp;
private String auditLog;
+ public static String getWorkItemHandlerName(String workItemHandlerStr) {
+ return DIVIDER.split(workItemHandlerStr.trim())[WORKITEMHANDLER_NAME];
+ }
+
+ public static String getWorkItemHandlerType(String workItemHandlerStr) {
+ return DIVIDER.split(workItemHandlerStr.trim())[WORKITEMHANDLER_TYPE];
+ }
+
+ public static boolean isValidWorkItemHandler(String workItemHandlerStr) {
+ return DIVIDER.split(workItemHandlerStr.trim()).length == 2;
+ }
+
public static boolean isFileLogger(String auditLog) {
return DIVIDER.split(auditLog.trim())[AUDIT_LOG_TYPE] == AUDIT_LOG_TYPE_FILE;
}
14 years, 11 months
Seam SVN: r11945 - in modules/security/trunk/src/main/java/org/jboss/seam/security: jaas and 2 other directories.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2010-01-11 20:12:46 -0500 (Mon, 11 Jan 2010)
New Revision: 11945
Modified:
modules/security/trunk/src/main/java/org/jboss/seam/security/Identity.java
modules/security/trunk/src/main/java/org/jboss/seam/security/JpaTokenStore.java
modules/security/trunk/src/main/java/org/jboss/seam/security/RememberMe.java
modules/security/trunk/src/main/java/org/jboss/seam/security/SecurityInterceptor.java
modules/security/trunk/src/main/java/org/jboss/seam/security/jaas/SeamLoginModule.java
modules/security/trunk/src/main/java/org/jboss/seam/security/management/IdentityManager.java
modules/security/trunk/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java
modules/security/trunk/src/main/java/org/jboss/seam/security/management/LdapIdentityStore.java
modules/security/trunk/src/main/java/org/jboss/seam/security/permission/EntityIdentifierStrategy.java
modules/security/trunk/src/main/java/org/jboss/seam/security/permission/JpaPermissionStore.java
Log:
start fixing compiler errors
Modified: modules/security/trunk/src/main/java/org/jboss/seam/security/Identity.java
===================================================================
--- modules/security/trunk/src/main/java/org/jboss/seam/security/Identity.java 2010-01-11 09:17:43 UTC (rev 11944)
+++ modules/security/trunk/src/main/java/org/jboss/seam/security/Identity.java 2010-01-12 01:12:46 UTC (rev 11945)
@@ -14,6 +14,7 @@
import javax.enterprise.context.SessionScoped;
import javax.inject.Inject;
import javax.inject.Named;
+import javax.enterprise.inject.Instance;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
import javax.security.auth.Subject;
@@ -26,7 +27,6 @@
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
-import org.jboss.seam.beans.BeanManagerHelper;
import org.jboss.seam.el.Expressions;
import org.jboss.seam.security.callbacks.AuthenticatorCallback;
import org.jboss.seam.security.callbacks.IdentityCallback;
@@ -42,9 +42,10 @@
import org.jboss.seam.security.events.QuietLoginEvent;
import org.jboss.seam.security.management.IdentityManager;
import org.jboss.seam.security.permission.PermissionMapper;
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* API for authorization and authentication via Seam security.
*
@@ -60,13 +61,17 @@
public static final String ROLES_GROUP = "Roles";
- @Logger Log log;
+ Logger log = LoggerFactory.getLogger(Identity.class);
@Inject private BeanManager manager;
@Inject private Credentials credentials;
@Inject private PermissionMapper permissionMapper;
@Inject private Expressions expressions;
+ @Inject private IdentityManager identityManager;
+
+ @Inject Instance<RequestSecurityState> requestSecurityState;
+
private Principal principal;
private Subject subject;
private String jaasConfigName = null;
@@ -114,12 +119,11 @@
* @return true if the user is logged in, false otherwise
*/
public boolean tryLogin()
- {
- RequestSecurityState state = BeanManagerHelper.getInstanceByType(manager, RequestSecurityState.class);
-
- if (!authenticating && getPrincipal() == null && credentials.isSet() && !state.isLoginTried())
+ {
+ if (!authenticating && getPrincipal() == null && credentials.isSet() &&
+ !requestSecurityState.get().isLoginTried())
{
- state.setLoginTried(true);
+ requestSecurityState.get().setLoginTried(true);
quietLogin();
}
@@ -212,8 +216,7 @@
// If authentication has already occurred during this request via a silent login,
// and login() is explicitly called then we still want to raise the LOGIN_SUCCESSFUL event,
// and then return.
- RequestSecurityState state = BeanManagerHelper.getInstanceByType(manager, RequestSecurityState.class);
- if (state.isSilentLogin())
+ if (requestSecurityState.get().isSilentLogin())
{
manager.fireEvent(new LoggedInEvent(principal));
return "loggedIn";
@@ -271,10 +274,9 @@
{
authenticate();
- RequestSecurityState state = BeanManagerHelper.getInstanceByType(manager, RequestSecurityState.class);
if (isLoggedIn())
{
- state.setSilentLogin(true);
+ requestSecurityState.get().setSilentLogin(true);
}
}
}
@@ -401,7 +403,6 @@
{
final Identity identity = this;
final Authenticator authenticator;
- final IdentityManager identityManager = BeanManagerHelper.getInstanceByType(manager, IdentityManager.class);
Set<Bean<?>> authenticators = manager.getBeans(Authenticator.class);
if (authenticators.size() == 1)
Modified: modules/security/trunk/src/main/java/org/jboss/seam/security/JpaTokenStore.java
===================================================================
--- modules/security/trunk/src/main/java/org/jboss/seam/security/JpaTokenStore.java 2010-01-11 09:17:43 UTC (rev 11944)
+++ modules/security/trunk/src/main/java/org/jboss/seam/security/JpaTokenStore.java 2010-01-12 01:12:46 UTC (rev 11945)
@@ -4,12 +4,12 @@
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
+import javax.enterprise.inject.Instance;
import javax.enterprise.inject.spi.BeanManager;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.Query;
-import org.jboss.seam.beans.BeanManagerHelper;
import org.jboss.seam.security.annotations.TokenUsername;
import org.jboss.seam.security.annotations.TokenValue;
import org.jboss.seam.security.management.IdentityManagementException;
@@ -32,6 +32,8 @@
@Inject BeanManager manager;
+ @Inject Instance<EntityManager> entityManagerInstance;
+
@Inject
public void create()
{
@@ -138,6 +140,6 @@
private EntityManager lookupEntityManager()
{
- return BeanManagerHelper.getInstanceByType(manager, EntityManager.class);
+ return entityManagerInstance.get();
}
}
Modified: modules/security/trunk/src/main/java/org/jboss/seam/security/RememberMe.java
===================================================================
--- modules/security/trunk/src/main/java/org/jboss/seam/security/RememberMe.java 2010-01-11 09:17:43 UTC (rev 11944)
+++ modules/security/trunk/src/main/java/org/jboss/seam/security/RememberMe.java 2010-01-12 01:12:46 UTC (rev 11945)
@@ -12,7 +12,6 @@
import javax.enterprise.inject.spi.BeanManager;
import javax.inject.Named;
-import org.jboss.seam.beans.BeanManagerHelper;
import org.jboss.seam.security.events.CredentialsInitializedEvent;
import org.jboss.seam.security.events.LoggedOutEvent;
import org.jboss.seam.security.events.PostAuthenticateEvent;
@@ -31,7 +30,7 @@
*
* @author Shane Bryzak
*/
-@Named//("org.jboss.seam.security.rememberMe")
+@Named
@SessionScoped
public class RememberMe implements Serializable
{
Modified: modules/security/trunk/src/main/java/org/jboss/seam/security/SecurityInterceptor.java
===================================================================
--- modules/security/trunk/src/main/java/org/jboss/seam/security/SecurityInterceptor.java 2010-01-11 09:17:43 UTC (rev 11944)
+++ modules/security/trunk/src/main/java/org/jboss/seam/security/SecurityInterceptor.java 2010-01-12 01:12:46 UTC (rev 11945)
@@ -15,7 +15,6 @@
import javax.interceptor.Interceptor;
import javax.interceptor.InvocationContext;
-import org.jboss.seam.beans.BeanManagerHelper;
import org.jboss.seam.security.annotations.PermissionCheck;
import org.jboss.seam.security.annotations.Restrict;
import org.jboss.seam.security.annotations.RoleCheck;
@@ -38,6 +37,7 @@
private transient volatile Map<Method,Restriction> restrictions = new HashMap<Method,Restriction>();
@Inject BeanManager manager;
+ @Inject Identity identity;
private class Restriction
{
@@ -162,7 +162,7 @@
Restriction restriction = getRestriction(interfaceMethod);
if ( restriction != null )
{
- Identity identity = BeanManagerHelper.getInstanceByType(manager, Identity.class);
+
restriction.check(identity, invocation.getParameters());
}
}
Modified: modules/security/trunk/src/main/java/org/jboss/seam/security/jaas/SeamLoginModule.java
===================================================================
--- modules/security/trunk/src/main/java/org/jboss/seam/security/jaas/SeamLoginModule.java 2010-01-11 09:17:43 UTC (rev 11944)
+++ modules/security/trunk/src/main/java/org/jboss/seam/security/jaas/SeamLoginModule.java 2010-01-12 01:12:46 UTC (rev 11945)
@@ -21,9 +21,10 @@
import org.jboss.seam.security.callbacks.IdentityCallback;
import org.jboss.seam.security.callbacks.IdentityManagerCallback;
import org.jboss.seam.security.management.IdentityManager;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* Performs authentication using a Seam component or Identity Management
*
@@ -31,7 +32,7 @@
*/
public class SeamLoginModule implements LoginModule
{
- private static final LogProvider log = Logging.getLogProvider(SeamLoginModule.class);
+ private Logger log = LoggerFactory.getLogger(SeamLoginModule.class);
protected Set<String> roles = new HashSet<String>();
Modified: modules/security/trunk/src/main/java/org/jboss/seam/security/management/IdentityManager.java
===================================================================
--- modules/security/trunk/src/main/java/org/jboss/seam/security/management/IdentityManager.java 2010-01-11 09:17:43 UTC (rev 11944)
+++ modules/security/trunk/src/main/java/org/jboss/seam/security/management/IdentityManager.java 2010-01-12 01:12:46 UTC (rev 11945)
@@ -7,16 +7,14 @@
import java.util.List;
import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.spi.BeanManager;
import javax.inject.Inject;
import javax.inject.Named;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-import org.jboss.seam.beans.BeanManagerHelper;
import org.jboss.seam.security.Identity;
import org.jboss.seam.security.util.Strings;
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Identity Management API, deals with user name/password-based identity management.
@@ -37,28 +35,17 @@
public static final String PERMISSION_UPDATE = "update";
public static final String PERMISSION_DELETE = "delete";
- @Logger Log log;
+ private Logger log = LoggerFactory.getLogger(IdentityManager.class);
@Inject BeanManager manager;
@Inject Identity identity;
- private IdentityStore identityStore;
+ @Inject private IdentityStore identityStore;
private IdentityStore roleIdentityStore;
@Inject
public void create()
{
- initIdentityStore();
- }
-
- protected void initIdentityStore()
- {
- // Default to JpaIdentityStore
- if (identityStore == null)
- {
- identityStore = BeanManagerHelper.getInstanceByType(manager,JpaIdentityStore.class);
- }
-
if (roleIdentityStore == null && identityStore != null)
{
roleIdentityStore = identityStore;
Modified: modules/security/trunk/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java
===================================================================
--- modules/security/trunk/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java 2010-01-11 09:17:43 UTC (rev 11944)
+++ modules/security/trunk/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java 2010-01-12 01:12:46 UTC (rev 11945)
@@ -13,12 +13,12 @@
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
+import javax.enterprise.inject.Instance;
import javax.enterprise.inject.spi.BeanManager;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;
-import org.jboss.seam.beans.BeanManagerHelper;
import org.jboss.seam.security.Role;
import org.jboss.seam.security.SimplePrincipal;
import org.jboss.seam.security.crypto.BinTools;
@@ -26,9 +26,10 @@
import org.jboss.seam.security.events.PrePersistUserRoleEvent;
import org.jboss.seam.security.events.UserAuthenticatedEvent;
import org.jboss.seam.security.events.UserCreatedEvent;
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* The default identity store implementation, uses JPA as its persistence mechanism.
*
@@ -41,9 +42,11 @@
protected FeatureSet featureSet;
- @Logger Log log;
+ private Logger log = LoggerFactory.getLogger(JpaIdentityStore.class);
@PersistenceContext EntityManager entityManager;
+
+ @Inject Instance<PasswordHash> passwordHashInstance;
private JpaIdentityStoreConfig config;
private BeanManager manager;
@@ -904,6 +907,6 @@
protected PasswordHash getPasswordHash()
{
- return BeanManagerHelper.getInstanceByType(manager, PasswordHash.class);
+ return passwordHashInstance.get();
}
}
Modified: modules/security/trunk/src/main/java/org/jboss/seam/security/management/LdapIdentityStore.java
===================================================================
--- modules/security/trunk/src/main/java/org/jboss/seam/security/management/LdapIdentityStore.java 2010-01-11 09:17:43 UTC (rev 11944)
+++ modules/security/trunk/src/main/java/org/jboss/seam/security/management/LdapIdentityStore.java 2010-01-12 01:12:46 UTC (rev 11945)
@@ -22,8 +22,8 @@
import javax.naming.directory.SearchResult;
import javax.naming.ldap.InitialLdapContext;
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* An IdentityStore implementation that integrates with a directory service.
@@ -39,7 +39,7 @@
private static final String LDAP_BOOLEAN_TRUE = "TRUE";
private static final String LDAP_BOOLEAN_FALSE = "FALSE";
- @Logger Log log;
+ private Logger log = LoggerFactory.getLogger(LdapIdentityStore.class);
protected FeatureSet featureSet = new FeatureSet();
Modified: modules/security/trunk/src/main/java/org/jboss/seam/security/permission/EntityIdentifierStrategy.java
===================================================================
--- modules/security/trunk/src/main/java/org/jboss/seam/security/permission/EntityIdentifierStrategy.java 2010-01-11 09:17:43 UTC (rev 11944)
+++ modules/security/trunk/src/main/java/org/jboss/seam/security/permission/EntityIdentifierStrategy.java 2010-01-12 01:12:46 UTC (rev 11945)
@@ -4,11 +4,11 @@
import java.util.concurrent.ConcurrentHashMap;
import javax.inject.Inject;
+import javax.enterprise.inject.Instance;
import javax.enterprise.inject.spi.BeanManager;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
-import org.jboss.seam.beans.BeanManagerHelper;
import org.jboss.seam.el.Expressions;
import org.jboss.seam.security.annotations.permission.Identifier;
import org.jboss.seam.security.util.Strings;
@@ -23,8 +23,10 @@
private Map<Class,String> identifierNames = new ConcurrentHashMap<Class,String>();
//@Inject PersistenceProvider persistenceProvider;
- @Inject Expressions expressions;
+ //@Inject Expressions expressions;
+
@Inject BeanManager manager;
+ @Inject Instance<EntityManager> entityManagerInstance;
public boolean canIdentify(Class targetClass)
{
@@ -71,6 +73,7 @@
private EntityManager lookupEntityManager()
{
//return entityManager.getValue();
- return BeanManagerHelper.getInstanceByType(manager, EntityManager.class);
+ //return BeanManagerHelper.getInstanceByType(manager, EntityManager.class);
+ return entityManagerInstance.get();
}
}
Modified: modules/security/trunk/src/main/java/org/jboss/seam/security/permission/JpaPermissionStore.java
===================================================================
--- modules/security/trunk/src/main/java/org/jboss/seam/security/permission/JpaPermissionStore.java 2010-01-11 09:17:43 UTC (rev 11944)
+++ modules/security/trunk/src/main/java/org/jboss/seam/security/permission/JpaPermissionStore.java 2010-01-12 01:12:46 UTC (rev 11945)
@@ -15,7 +15,6 @@
import javax.persistence.EntityManager;
import javax.persistence.Query;
-import org.jboss.seam.beans.BeanManagerHelper;
import org.jboss.seam.security.Role;
import org.jboss.seam.security.SimplePrincipal;
import org.jboss.seam.security.annotations.permission.PermissionAction;
@@ -26,10 +25,11 @@
import org.jboss.seam.security.management.IdentityManager;
import org.jboss.seam.security.management.JpaIdentityStore;
import org.jboss.seam.security.management.JpaIdentityStoreConfig;
+import org.jboss.seam.security.management.LdapIdentityStore;
import org.jboss.seam.security.permission.PermissionMetadata.ActionSet;
import org.jboss.seam.security.util.AnnotatedBeanProperty;
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* A permission store implementation that uses JPA as its persistence mechanism.
@@ -41,7 +41,7 @@
{
private static final long serialVersionUID = 4764590939669047915L;
- @Logger Log log;
+ private Logger log = LoggerFactory.getLogger(LdapIdentityStore.class);
private enum Discrimination { user, role, either }
14 years, 11 months
Seam SVN: r11944 - in modules/remoting/trunk/docs: src and 2 other directories.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2010-01-11 04:17:43 -0500 (Mon, 11 Jan 2010)
New Revision: 11944
Added:
modules/remoting/trunk/docs/pom.xml
modules/remoting/trunk/docs/src/
modules/remoting/trunk/docs/src/main/
modules/remoting/trunk/docs/src/main/docbook/
modules/remoting/trunk/docs/src/main/en-US/
modules/remoting/trunk/docs/src/main/en-US/master.xml
modules/remoting/trunk/docs/src/main/en-US/remoting-general.xml
modules/remoting/trunk/docs/src/main/en-US/remoting-model.xml
Log:
add some documentation stuff
Added: modules/remoting/trunk/docs/pom.xml
===================================================================
--- modules/remoting/trunk/docs/pom.xml (rev 0)
+++ modules/remoting/trunk/docs/pom.xml 2010-01-11 09:17:43 UTC (rev 11944)
@@ -0,0 +1,54 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>remoting-reference-guide</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>jdocbook</packaging>
+
+ <name>Seam Remoting Reference Guide</name>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <url>http://repository.jboss.org/maven2</url>
+ </pluginRepository>
+ </pluginRepositories>
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <url>http://repository.jboss.org/maven2</url>
+ </repository>
+ </repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+
+ <configuration>
+ <sourceDocumentName>master.xml</sourceDocumentName>
+ <masterTranslation>en-US</masterTranslation>
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <finalName>remoting-reference.pdf</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <xincludeSupported>false</xincludeSupported>
+ </options>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
Added: modules/remoting/trunk/docs/src/main/en-US/master.xml
===================================================================
--- modules/remoting/trunk/docs/src/main/en-US/master.xml (rev 0)
+++ modules/remoting/trunk/docs/src/main/en-US/master.xml 2010-01-11 09:17:43 UTC (rev 11944)
@@ -0,0 +1,12 @@
+<?xml version='1.0' encoding="utf-8"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<book lang="en">
+
+ <toc/>
+
+ <title>Seam Remoting</title>
+ <xi:include href="remoting-general.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="remoting-model.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+</book>
\ No newline at end of file
Added: modules/remoting/trunk/docs/src/main/en-US/remoting-general.xml
===================================================================
--- modules/remoting/trunk/docs/src/main/en-US/remoting-general.xml (rev 0)
+++ modules/remoting/trunk/docs/src/main/en-US/remoting-general.xml 2010-01-11 09:17:43 UTC (rev 11944)
@@ -0,0 +1,509 @@
+c<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
+
+<chapter id="remoting">
+ <title>Seam Remoting</title>
+
+ <para>Seam provides a convenient method of remotely accessing CDI beans from a web page, using AJAX (Asynchronous
+ Javascript and XML). The framework for this functionality is provided with almost no up-front development effort -
+ your beans only require simple annotating to become accessible via AJAX. This chapter describes the steps
+ required to build an AJAX-enabled web page, then goes on to explain the features of the Seam Remoting framework in
+ more detail. </para>
+
+ <section>
+ <title>Configuration</title>
+ <para>To use remoting, the Seam Remoting servlet must first be configured in your <literal>web.xml</literal> file: </para>
+
+ <programlisting role="XML"><![CDATA[<servlet>
+ <servlet-name>Remoting Servlet</servlet-name>
+ <servlet-class>org.jboss.seam.remoting.Remoting</servlet-class>
+ <load-on-startup>1</load-on-startup>
+</servlet>
+
+<servlet-mapping>
+ <servlet-name>Remoting Servlet</servlet-name>
+ <url-pattern>/seam/resource/remoting/*</url-pattern>
+</servlet-mapping>]]></programlisting>
+
+ <para>The next step is to import the necessary Javascript into your web page. There are a minimum of two scripts
+ that must be imported. The first one contains all the client-side framework code that enables remoting
+ functionality:</para>
+
+ <programlisting role="XHTML"><![CDATA[<script type="text/javascript" src="seam/resource/remoting/resource/remote.js"></script>]]></programlisting>
+
+ <para>For a production environment, you may wish to use a compressed version of <literal>remote.js</literal>.
+ To do this, simply add the <literal>compress=true</literal> parameter to the end of the url:</para>
+
+ <programlisting role="XHTML"><![CDATA[<script type="text/javascript" src="seam/resource/remoting/resource/remote.js?compress=true"></script>]]></programlisting>
+
+ <para>The compressed version has its white space compacted and JavaScript comments removed. For development and
+ debugging purposes it is recommended that you use the non-compacted version.</para>
+
+ <para>The second script that you need contains the stubs and type definitions for the beans you wish to call. It is
+ generated dynamically based on the method signatures of your beans, and includes type definitions for all of
+ the classes that can be used to call its remotable methods. The name of the script reflects the
+ name of your bean. For example, if you have a named bean annotated with <literal>@Named</literal>, then your script
+ tag should look like this (for a bean class called <literal>CustomerAction</literal>): </para>
+
+ <programlisting role="XHTML"><![CDATA[<script type="text/javascript"
+ src="seam/resource/remoting/interface.js?customerAction"></script>]]></programlisting>
+
+ <para>Otherwise, you can simply specify the fully qualified class name of the bean:</para>
+
+ <programlisting role="XHTML"><![CDATA[<script type="text/javascript"
+ src="seam/resource/remoting/interface.js?com.acme.myapp.CustomerAction"></script>]]></programlisting>
+
+ <para>If you wish to access more than one bean from the same page, then include them all as parameters of your
+ script tag: </para>
+
+ <programlisting role="XHTML"><![CDATA[<script type="text/javascript"
+ src="seam/resource/remoting/interface.js?customerAction&accountAction"></script>]]></programlisting>
+
+ <section>
+ <title>Dynamic type loading</title>
+
+ <para>If you forget to import a bean or other class that is required by your bean, don't worry. Seam Remoting has
+ a dynamic type loading feature that automatically loads any JavaScript stubs for bean types that it doesn't
+ recognize.</para>
+ </section>
+
+ </section>
+
+ <section>
+ <title>The "Seam" object</title>
+
+ <para>Client-side interaction with your beans is all performed via the <literal>Seam</literal> Javascript
+ object. This object is defined in <literal>remote.js</literal>, and you'll be using it to make asynchronous calls
+ against your bean. It contains methods for creating client-side bean objects and also methods for executing remote
+ requests. The easiest way to become familiar with this object is to start with a simple example.</para>
+
+ <section>
+ <title>A Hello World example</title>
+
+ <para>Let's step through a simple example to see how the <literal>Seam</literal> object works. First of all,
+ let's create a new bean called <literal>helloAction</literal>:</para>
+
+ <programlisting role="JAVA"><![CDATA[@Named
+public class HelloAction implements HelloLocal {
+ @WebRemote public String sayHello(String name) {
+ return "Hello, " + name;
+ }
+}]]></programlisting>
+
+ <para>Take note of the <literal>@WebRemote</literal> annotation on the <literal>sayHello()</literal> method in the
+ above listing. This annotation makes the method accessible via the Remoting API. Besides this annotation, there's
+ nothing else required on your bean to enable it for remoting.</para>
+
+ <!--note>
+ <para>If you are performing a persistence operation in the method marked <literal>@WebRemote</literal> you will
+ also need to add a <literal>@Transactional</literal> annotation to the method. Otherwise, your method would
+ execute outside of a transaction without this extra hint.That's because unlike a JSF request, Seam does not
+ wrap the remoting request in a transaction automatically.</para>
+ </note-->
+
+ <para>Now for our web page - create a new JSF page and import the <literal>helloAction</literal> bean:</para>
+
+ <programlisting role="XHTML"><![CDATA[<script type="text/javascript"
+ src="seam/resource/remoting/interface.js?helloAction]]></programlisting>
+
+ <para>To make this a fully interactive user experience, let's add a button to our page:</para>
+
+ <programlisting role="XHTML"><![CDATA[<button onclick="javascript:sayHello()">Say Hello</button>]]></programlisting>
+
+ <para>We'll also need to add some more script to make our button actually do something when it's clicked: </para>
+
+ <programlisting role="XHTML"><![CDATA[<script type="text/javascript">
+ //<![CDATA[
+
+ function sayHello() {
+ var name = prompt("What is your name?");
+ Seam.createBean("helloAction").sayHello(name, sayHelloCallback);
+ }
+
+ function sayHelloCallback(result) {
+ alert(result);
+ }
+
+ // ]]>]]><![CDATA[
+</script>]]></programlisting>
+
+ <para>We're done! Deploy your application and open the page in a web browser. Click the button, and enter a name when
+ prompted. A message box will display the hello message confirming that the call was successful. If you want to
+ save some time, you'll find the full source code for this Hello World example in the
+ <literal>/examples/helloworld</literal> directory.</para>
+
+ <para>So what does the code of our script actually do? Let's break it down into smaller pieces. To start with,
+ you can see from the Javascript code listing that we have implemented two methods - the first method is
+ responsible for prompting the user for their name and then making a remote request. Take a look at the following
+ line:</para>
+
+ <programlisting role="XHTML">Seam.createBean("helloAction").sayHello(name, sayHelloCallback);</programlisting>
+
+ <para>The first section of this line, <literal>Seam.createBean("helloAction")</literal> returns a
+ proxy, or "stub" for our <literal>helloAction</literal> bean. We can invoke the methods of our bean
+ against this stub, which is exactly what happens with the remainder of the line:
+ <literal>sayHello(name, sayHelloCallback);</literal>. </para>
+
+ <para>What this line of code in its completeness does, is invoke the <literal>sayHello</literal> method of our
+ bean, passing in <literal>name</literal> as a parameter. The second parameter,
+ <literal>sayHelloCallback</literal> isn't a parameter of our bean's <literal>sayHello</literal> method,
+ instead it tells the Seam Remoting framework that once it receives the response to our request, it should pass
+ it to the <literal>sayHelloCallback</literal> Javascript method. This callback parameter is entirely optional,
+ so feel free to leave it out if you're calling a method with a <literal>void</literal> return type or if you
+ don't care about the result. </para>
+
+ <para>The <literal>sayHelloCallback</literal> method, once receiving the response to our remote request then pops
+ up an alert message displaying the result of our method call. </para>
+ </section>
+
+ <section>
+ <title>Seam.createBean</title>
+
+ <para> The <literal>Seam.createBean</literal> JavaScript method is used to create client-side instances of both
+ action and "state" beans. For action beans (which are those that contain one or more methods annotated with
+ <literal>@WebRemote</literal>), the stub object provides all of the remotable methods exposed by the bean.
+ For "state" beans (i.e. beans that simply carry state, for example Entity beans) the stub object provides all
+ the same accessible properties as its server-side equivalent. Each property also has a corresponding
+ getter/setter method so you can work with the object in JavaScript in much the same way as you would in Java.</para>
+ </section>
+
+ </section>
+
+ <section>
+ <title>The Context</title>
+
+ <para>The Seam Remoting Context contains additional information which is sent and received as part of a remoting
+ request/response cycle. It currently contains the conversation ID and Call ID, and may be expanded to include other
+ properties in the future. </para>
+
+ <section>
+ <title>Setting and reading the Conversation ID</title>
+
+ <para> If you intend on using remote calls within the scope of a conversation then you need to be able to read or
+ set the conversation ID in the Seam Remoting Context. To read the conversation ID after making a remote request
+ call <literal>Seam.context.getConversationId()</literal>. To set the conversation ID before making a
+ request, call <literal>Seam.context.setConversationId()</literal>. </para>
+
+ <para>If the conversation ID hasn't been explicitly set with
+ <literal>Seam.context.setConversationId()</literal>, then it will be automatically assigned the
+ first valid conversation ID that is returned by any remoting call. If you are working with multiple conversations
+ within your page, then you may need to explicitly set the conversation ID before each call. If you are working
+ with just a single conversation, then you don't need to do anything special. </para>
+ </section>
+
+ <section>
+ <title>Remote calls within the current conversation scope</title>
+
+ <para>In some circumstances it may be required to make a remote call within the scope of the
+ current view's conversation. To do this, you must explicitly set the conversation ID to that
+ of the view before making the remote call. This small snippet of JavaScript will set the
+ conversation ID that is used for remoting calls to the current view's conversation ID: </para>
+
+ <programlisting role="XHTML"><![CDATA[Seam.context.setConversationId( #{conversation.id} );]]></programlisting>
+ </section>
+ </section>
+
+ <section>
+ <title>Working with Data types</title>
+
+ <section>
+ <title>Primitives / Basic Types</title>
+
+ <para>This section describes the support for basic data types. On the server side these values as a rule are
+ compatible with either their primitive type or their corresponding wrapper class. </para>
+
+ <section>
+ <title>String</title>
+
+ <para>Simply use Javascript String objects when setting String parameter values. </para>
+ </section>
+
+ <section>
+ <title>Number</title>
+
+ <para>There is support for all number types supported by Java. On the client side, number values are always
+ serialized as their String representation and then on the server side they are converted to the correct
+ destination type. Conversion into either a primitive or wrapper type is supported for <literal>Byte</literal>,
+ <literal>Double</literal>, <literal>Float</literal>, <literal>Integer</literal>, <literal>Long</literal> and
+ <literal>Short</literal> types. </para>
+ </section>
+
+ <section>
+ <title>Boolean</title>
+
+ <para>Booleans are represented client side by Javascript Boolean values, and server side by a Java boolean.
+ </para>
+ </section>
+ </section>
+
+ <section>
+ <title>JavaBeans</title>
+
+ <para> In general these will be either entity beans or JavaBean classes, or some other non-bean class. Use
+ <literal>Seam.createBean()</literal> to create a new instance of the object. </para>
+ </section>
+
+ <section>
+ <title>Dates and Times</title>
+
+ <para>Date values are serialized into a String representation that is accurate to the millisecond. On the client
+ side, use a JavaScript <literal>Date</literal> object to work with date values. On the server side, use any
+ <literal>java.util.Date</literal> (or descendent, such as <literal>java.sql.Date</literal> or
+ <literal>java.sql.Timestamp</literal> class. </para>
+ </section>
+
+ <section>
+ <title>Enums</title>
+
+ <para> On the client side, enums are treated the same as <literal>String</literal>s. When setting the value for an enum parameter,
+ simply use the <literal>String</literal> representation of the enum. Take the following bean as an example: </para>
+
+ <programlisting role="JAVA">@Named
+public class paintAction {
+ public enum Color {red, green, blue, yellow, orange, purple};
+
+ public void paint(Color color) {
+ // code
+ }
+} </programlisting>
+
+ <para> To call the <literal>paint()</literal> method with the color <literal>red</literal>, pass the parameter
+ value as a <literal>String</literal> literal: </para>
+
+ <programlisting role="XHTML">Seam.createBean("paintAction").paint("red");</programlisting>
+
+ <para> The inverse is also true - that is, if a bean method returns an enum parameter (or contains an enum
+ field anywhere in the returned object graph) then on the client-side it will be converted to a <literal>String</literal>. </para>
+ </section>
+
+ <section>
+ <title>Collections</title>
+
+ <section>
+ <title>Bags</title>
+
+ <para>Bags cover all collection types including arrays, collections, lists, sets, (but excluding Maps - see the
+ next section for those), and are implemented client-side as a JavaScript array. When calling a bean
+ method that accepts one of these types as a parameter, your parameter should be a JavaScript array. If a
+ bean method returns one of these types, then the return value will also be a JavaScript array. The
+ remoting framework is clever enough on the server side to convert the bag to an appropriate type (including
+ sophisticated support for generics) for the bean method call.</para>
+ </section>
+
+ <section>
+ <title>Maps</title>
+
+ <para> As there is no native support for Maps within JavaScript, a simple Map implementation is provided with
+ the Seam Remoting framework. To create a Map which can be used as a parameter to a remote call, create a new
+ <literal>Seam.Map</literal> object: </para>
+
+ <programlisting role="XHTML">var map = new Seam.Map();</programlisting>
+
+ <para> This JavaScript implementation provides basic methods for working with Maps: <literal>size()</literal>,
+ <literal>isEmpty()</literal>, <literal>keySet()</literal>, <literal>values()</literal>,
+ <literal>get(key)</literal>, <literal>put(key, value)</literal>, <literal>remove(key)</literal> and
+ <literal>contains(key)</literal>. Each of these methods are equivalent to their Java counterpart. Where the
+ method returns a collection, such as <literal>keySet()</literal> and <literal>values()</literal>, a JavaScript
+ Array object will be returned that contains the key or value objects (respectively). </para>
+ </section>
+ </section>
+ </section>
+
+ <section>
+ <title>Debugging</title>
+
+ <para> To aid in tracking down bugs, it is possible to enable a debug mode which will display the contents of all
+ the packets send back and forth between the client and server in a popup window. To enable debug mode, set the
+ <literal>Seam.debug</literal> property to <literal>true</literal> in Javascript: </para>
+
+ <programlisting role="XHTML">Seam.debug = true;</programlisting>
+
+ <para>If you want to write your own messages to the debug log, call
+ <literal>Seam.log(message)</literal>. </para>
+ </section>
+
+ <section>
+ <title>Handling Exceptions</title>
+
+ <para>
+ When invoking a remote bean method, it is possible to specify an exception handler which will process
+ the response in the event of an exception during bean invocation. To specify an exception handler function,
+ include a reference to it after the callback parameter in your JavaScript:
+ </para>
+
+ <programlisting><![CDATA[var callback = function(result) { alert(result); };
+var exceptionHandler = function(ex) { alert("An exception occurred: " + ex.getMessage()); };
+Seam.createBean("helloAction").sayHello(name, callback, exceptionHandler);]]></programlisting>
+
+ <para>
+ If you do not have a callback handler defined, you must specify <literal>null</literal> in its place:
+ </para>
+
+ <programlisting><![CDATA[var exceptionHandler = function(ex) { alert("An exception occurred: " + ex.getMessage()); };
+Seam.createBean("helloAction").sayHello(name, null, exceptionHandler);]]></programlisting>
+
+ <para>
+ The exception object that is passed to the exception handler exposes one method, <literal>getMessage()</literal>
+ that returns the exception message which is produced by the exception thrown by the <literal>@WebRemote</literal>
+ method.
+ </para>
+
+ </section>
+
+ <section>
+ <title>The Loading Message</title>
+
+ <para> The default loading message that appears in the top right corner of the screen can be modified, its rendering
+ customised or even turned off completely. </para>
+
+ <section>
+ <title>Changing the message</title>
+
+ <para> To change the message from the default "Please Wait..." to something different, set the value of
+ <literal>Seam.loadingMessage</literal>: </para>
+
+ <programlisting role="XHTML">Seam.loadingMessage = "Loading..."; </programlisting>
+ </section>
+
+ <section>
+ <title>Hiding the loading message</title>
+
+ <para> To completely suppress the display of the loading message, override the implementation of
+ <literal>displayLoadingMessage()</literal> and <literal>hideLoadingMessage()</literal> with functions that
+ instead do nothing: </para>
+
+ <programlisting role="XHTML">// don't display the loading indicator
+Seam.displayLoadingMessage = function() {};
+Seam.hideLoadingMessage = function() {};</programlisting>
+ </section>
+
+ <section>
+ <title>A Custom Loading Indicator</title>
+
+ <para> It is also possible to override the loading indicator to display an animated icon, or anything else that
+ you want. To do this override the <literal>displayLoadingMessage()</literal> and
+ <literal>hideLoadingMessage()</literal> messages with your own implementation: </para>
+
+ <programlisting role="XHTML"> Seam.displayLoadingMessage = function() {
+ // Write code here to display the indicator
+ };
+
+ Seam.hideLoadingMessage = function() {
+ // Write code here to hide the indicator
+ };</programlisting>
+ </section>
+ </section>
+
+ <section>
+ <title>Controlling what data is returned</title>
+
+ <para> When a remote method is executed, the result is serialized into an XML response that is returned to the
+ client. This response is then unmarshaled by the client into a JavaScript object. For complex types (i.e.
+ Javabeans) that include references to other objects, all of these referenced objects are also serialized as part
+ of the response. These objects may reference other objects, which may reference other objects, and so forth. If
+ left unchecked, this object "graph" could potentially be enormous, depending on what relationships exist between
+ your objects. And as a side issue (besides the potential verbosity of the response), you might also wish to
+ prevent sensitive information from being exposed to the client. </para>
+
+ <para> Seam Remoting provides a simple means to "constrain" the object graph, by specifying the
+ <literal>exclude</literal> field of the remote method's <literal>@WebRemote</literal> annotation. This field
+ accepts a String array containing one or more paths specified using dot notation. When invoking a remote method,
+ the objects in the result's object graph that match these paths are excluded from the serialized result packet. </para>
+
+ <para> For all our examples, we'll use the following <literal>Widget</literal> class: </para>
+
+ <programlisting role="JAVA">public class Widget
+{
+ private String value;
+ private String secret;
+ private Widget child;
+ private Map<String,Widget> widgetMap;
+ private List<Widget> widgetList;
+
+ // getters and setters for all fields
+}</programlisting>
+
+ <section>
+ <title>Constraining normal fields</title>
+
+ <para> If your remote method returns an instance of <literal>Widget</literal>, but you don't want to expose the
+ <literal>secret</literal> field because it contains sensitive information, you would constrain it like this: </para>
+
+ <programlisting role="JAVA">@WebRemote(exclude = {"secret"})
+public Widget getWidget(); </programlisting>
+
+ <para> The value "secret" refers to the <literal>secret</literal> field of the returned object. Now, suppose that
+ we don't care about exposing this particular field to the client. Instead, notice that the
+ <literal>Widget</literal> value that is returned has a field <literal>child</literal> that is also a
+ <literal>Widget</literal>. What if we want to hide the <literal>child</literal>'s <literal>secret</literal>
+ value instead? We can do this by using dot notation to specify this field's path within the result's object
+ graph: </para>
+
+ <programlisting role="JAVA">@WebRemote(exclude = {"child.secret"})
+public Widget getWidget();</programlisting>
+
+ </section>
+
+ <section>
+ <title>Constraining Maps and Collections</title>
+
+ <para> The other place that objects can exist within an object graph are within a <literal>Map</literal> or some
+ kind of collection (<literal>List</literal>, <literal>Set</literal>, <literal>Array</literal>, etc). Collections
+ are easy, and are treated like any other field. For example, if our <literal>Widget</literal> contained a list
+ of other <literal>Widget</literal>s in its <literal>widgetList</literal> field, to constrain the
+ <literal>secret</literal> field of the <literal>Widget</literal>s in this list the annotation would look like
+ this: </para>
+
+ <programlisting role="JAVA">@WebRemote(exclude = {"widgetList.secret"})
+public Widget getWidget();</programlisting>
+
+ <para> To constrain a <literal>Map</literal>'s key or value, the notation is slightly different. Appending
+ <literal>[key]</literal> after the <literal>Map</literal>'s field name will constrain the
+ <literal>Map</literal>'s key object values, while <literal>[value]</literal> will constrain the value object
+ values. The following example demonstrates how the values of the <literal>widgetMap</literal> field have their
+ <literal>secret</literal> field constrained: </para>
+
+ <programlisting role="JAVA">@WebRemote(exclude = {"widgetMap[value].secret"})
+public Widget getWidget(); </programlisting>
+ </section>
+
+ <section>
+ <title>Constraining objects of a specific type</title>
+
+ <para> There is one last notation that can be used to constrain the fields of a type of object no matter where in
+ the result's object graph it appears. This notation uses either the name of the bean (if the object is a
+ named bean) or the fully qualified class name (only if the object is not a named bean) and is expressed
+ using square brackets: </para>
+
+ <programlisting role="JAVA">@WebRemote(exclude = {"[widget].secret"})
+public Widget getWidget(); </programlisting>
+
+ </section>
+
+ <section>
+ <title>Combining Constraints</title>
+
+ <para> Constraints can also be combined, to filter objects from multiple paths within the object graph: </para>
+
+ <programlisting role="JAVA">@WebRemote(exclude = {"widgetList.secret", "widgetMap[value].secret"})
+public Widget getWidget();</programlisting>
+ </section>
+
+ </section>
+
+ <!--section>
+ <title>Transactional Requests</title>
+
+ <para>
+ By default there is no active transaction during a remoting request, so if you wish to perform database updates
+ during a remoting request, you need to annotate the <literal>@WebRemote</literal> method with
+ <literal>@Transactional</literal>, like so:
+ </para>
+
+ <programlisting><![CDATA[ @WebRemote @Transactional(TransactionPropagationType.REQUIRED)
+ public void updateOrder(Order order) {
+ entityManager.merge(order);
+ }]]></programlisting>
+ </section-->
+
+</chapter>
Property changes on: modules/remoting/trunk/docs/src/main/en-US/remoting-general.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: modules/remoting/trunk/docs/src/main/en-US/remoting-model.xml
===================================================================
--- modules/remoting/trunk/docs/src/main/en-US/remoting-model.xml (rev 0)
+++ modules/remoting/trunk/docs/src/main/en-US/remoting-model.xml 2010-01-11 09:17:43 UTC (rev 11944)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
+
+<chapter id="remoting">
+ <title>Seam Remoting - Model API</title>
+
+</chapter>
Property changes on: modules/remoting/trunk/docs/src/main/en-US/remoting-model.xml
___________________________________________________________________
Name: svn:executable
+ *
14 years, 11 months
Seam SVN: r11943 - branches/community/Seam_2_2/examples/mail/view.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2010-01-08 12:38:02 -0500 (Fri, 08 Jan 2010)
New Revision: 11943
Modified:
branches/community/Seam_2_2/examples/mail/view/attachment.xhtml
Log:
JBSEAM-4441
Modified: branches/community/Seam_2_2/examples/mail/view/attachment.xhtml
===================================================================
--- branches/community/Seam_2_2/examples/mail/view/attachment.xhtml 2010-01-08 17:35:17 UTC (rev 11942)
+++ branches/community/Seam_2_2/examples/mail/view/attachment.xhtml 2010-01-08 17:38:02 UTC (rev 11943)
@@ -12,7 +12,7 @@
<m:attachment fileName="whyseam.pdf">
<ui:include src="/whyseam.xhtml" />
</m:attachment>
- <m:attachment fileName="excel.pdf">
+ <m:attachment fileName="excel.xls">
<ui:include src="/excel.xhtml" />
</m:attachment>
<ui:repeat value="#{people}" var="p">
14 years, 11 months
Seam SVN: r11942 - branches/community/Seam_2_2/src/pdf/org/jboss/seam/pdf/ui.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2010-01-08 12:35:17 -0500 (Fri, 08 Jan 2010)
New Revision: 11942
Modified:
branches/community/Seam_2_2/src/pdf/org/jboss/seam/pdf/ui/UIChapter.java
branches/community/Seam_2_2/src/pdf/org/jboss/seam/pdf/ui/UISection.java
Log:
JBSEAM-4517
Modified: branches/community/Seam_2_2/src/pdf/org/jboss/seam/pdf/ui/UIChapter.java
===================================================================
--- branches/community/Seam_2_2/src/pdf/org/jboss/seam/pdf/ui/UIChapter.java 2010-01-08 17:32:48 UTC (rev 11941)
+++ branches/community/Seam_2_2/src/pdf/org/jboss/seam/pdf/ui/UIChapter.java 2010-01-08 17:35:17 UTC (rev 11942)
@@ -41,5 +41,7 @@
if (chapterTitle != null) {
section.setBookmarkTitle(chapterTitle);
}
+
+ section.setTriggerNewPage(getNewPage());
}
}
Modified: branches/community/Seam_2_2/src/pdf/org/jboss/seam/pdf/ui/UISection.java
===================================================================
--- branches/community/Seam_2_2/src/pdf/org/jboss/seam/pdf/ui/UISection.java 2010-01-08 17:32:48 UTC (rev 11941)
+++ branches/community/Seam_2_2/src/pdf/org/jboss/seam/pdf/ui/UISection.java 2010-01-08 17:35:17 UTC (rev 11942)
@@ -10,6 +10,7 @@
Section section;
Integer numberDepth;
String sectionTitle;
+ boolean newPage = false;
public void setNumberDepth(Integer numberDepth)
{
@@ -20,7 +21,18 @@
{
this.sectionTitle = sectionTitle;
}
+
+ public boolean getNewPage()
+ {
+ return (Boolean) valueBinding("newPage", newPage);
+ }
+
+ public void setNewPage(boolean newPage)
+ {
+ this.newPage = newPage;
+ }
+
public Section getSection()
{
return section;
@@ -66,8 +78,10 @@
sectionTitle = (String) valueBinding(context, "sectionTitle", sectionTitle);
if (sectionTitle != null)
{
- section.setBookmarkTitle(sectionTitle);
+ section.setBookmarkTitle(sectionTitle);
}
+
+ section.setTriggerNewPage(getNewPage());
}
private int countSectionParents(UISection component, int level)
14 years, 11 months
Seam SVN: r11941 - modules/drools/trunk/src/main/java/org/jboss/seam/drools.
by seam-commits@lists.jboss.org
Author: tsurdilovic
Date: 2010-01-08 12:32:48 -0500 (Fri, 08 Jan 2010)
New Revision: 11941
Modified:
modules/drools/trunk/src/main/java/org/jboss/seam/drools/KnowledgeSessionManager.java
modules/drools/trunk/src/main/java/org/jboss/seam/drools/KnowledgeSessionManagerConfig.java
Log:
Drools 5 integration.
Modified: modules/drools/trunk/src/main/java/org/jboss/seam/drools/KnowledgeSessionManager.java
===================================================================
--- modules/drools/trunk/src/main/java/org/jboss/seam/drools/KnowledgeSessionManager.java 2010-01-08 17:29:57 UTC (rev 11940)
+++ modules/drools/trunk/src/main/java/org/jboss/seam/drools/KnowledgeSessionManager.java 2010-01-08 17:32:48 UTC (rev 11941)
@@ -1,14 +1,10 @@
package org.jboss.seam.drools;
import java.io.InputStream;
-import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import java.util.Properties;
-import javax.annotation.PreDestroy;
-import javax.enterprise.context.Dependent;
-import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.BeanManager;
@@ -18,8 +14,8 @@
import org.drools.KnowledgeBase;
import org.drools.KnowledgeBaseFactory;
-import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.logger.KnowledgeRuntimeLogger;
+import org.drools.logger.KnowledgeRuntimeLoggerFactory;
import org.drools.runtime.KnowledgeSessionConfiguration;
import org.drools.runtime.StatefulKnowledgeSession;
import org.drools.runtime.StatelessKnowledgeSession;
@@ -37,7 +33,6 @@
private static final Logger log = LoggerFactory.getLogger(KnowledgeSessionManager.class);
private KnowledgeSessionManagerConfig ksessionManagerConfig;
- private KnowledgeRuntimeLogger statelessKLogger;
private Map<Integer, KnowledgeRuntimeLogger> statefulKnowledgeLoggers = new Hashtable<Integer, KnowledgeRuntimeLogger>();
@Inject
@@ -59,7 +54,7 @@
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(getKSessionConfig(), null);
//addEventListeners(ksession);
//addWorkItemHandlers(ksession);
- //addAuditLog(ksession);
+ addAuditLog(ksession);
manager.fireEvent(new KnowledgeSessionCreatedEvent(ksession.getId()));
return ksession;
}
@@ -79,19 +74,10 @@
{
StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession(getKSessionConfig());
//addEventListeners(ksession);
- //addAuditLog(ksession);
manager.fireEvent(new KnowledgeSessionCreatedEvent(-1));
return ksession;
}
- public void disposeStatelessSession(@Disposes StatelessKnowledgeSession statelessSession)
- {
- if (statelessKLogger != null)
- {
- statelessKLogger.close();
- }
- }
-
private KnowledgeSessionConfiguration getKSessionConfig() throws Exception
{
KnowledgeSessionConfiguration ksessionConfig = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
@@ -115,5 +101,26 @@
}
return ksessionConfig;
}
+
+
+ private void addAuditLog(StatefulKnowledgeSession ksession) {
+ if(ksessionManagerConfig.getAuditLog() != null) {
+ if(KnowledgeSessionManagerConfig.isFileLogger(ksessionManagerConfig.getAuditLog())) {
+ String logName = KnowledgeSessionManagerConfig.getFileLoggerPath(ksessionManagerConfig.getAuditLog()) + System.currentTimeMillis();
+ KnowledgeRuntimeLogger krLogger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, logName);
+ statefulKnowledgeLoggers.put(ksession.getId(), krLogger);
+ } else if(KnowledgeSessionManagerConfig.isConsoleLogger(ksessionManagerConfig.getAuditLog())) {
+ KnowledgeRuntimeLogger krLogger = KnowledgeRuntimeLoggerFactory.newConsoleLogger(ksession);
+ statefulKnowledgeLoggers.put(ksession.getId(), krLogger);
+ } else if(KnowledgeSessionManagerConfig.isThreadedLogger(ksessionManagerConfig.getAuditLog())) {
+ String logName = KnowledgeSessionManagerConfig.getThreadedLoggerPath(ksessionManagerConfig.getAuditLog()) + System.currentTimeMillis();
+ int interval = KnowledgeSessionManagerConfig.getThreadedLoggerInterval(ksessionManagerConfig.getAuditLog());
+ KnowledgeRuntimeLogger krLogger = KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(ksession, logName, interval);
+ statefulKnowledgeLoggers.put(ksession.getId(), krLogger);
+ } else {
+ log.warn("Invalid logger specified: " + ksessionManagerConfig.getAuditLog());
+ }
+ }
+ }
}
Modified: modules/drools/trunk/src/main/java/org/jboss/seam/drools/KnowledgeSessionManagerConfig.java
===================================================================
--- modules/drools/trunk/src/main/java/org/jboss/seam/drools/KnowledgeSessionManagerConfig.java 2010-01-08 17:29:57 UTC (rev 11940)
+++ modules/drools/trunk/src/main/java/org/jboss/seam/drools/KnowledgeSessionManagerConfig.java 2010-01-08 17:32:48 UTC (rev 11941)
@@ -13,12 +13,43 @@
private static final Pattern DIVIDER = Pattern.compile(";");
private static final int WORKITEMHANDLER_NAME = 0;
private static final int WORKITEMHANDLER_TYPE = 1;
+ private static final int AUDIT_LOG_TYPE = 0;
+ private static final int AUDIT_LOG_INFO = 1;
+ private static final int AUDIT_LOG_INTERVAL = 2;
+ private static final String AUDIT_LOG_TYPE_FILE = "file";
+ private static final String AUDIT_LOG_TYPE_CONSOLE = "console";
+ private static final String AUDIT_LOG_TYPE_THREADED = "threaded";
private String[] eventListeners;
private String[] workItemHandlers;
private String knowledgeSessionConfig;
private Properties knowledgeSessionConfigProp;
private String auditLog;
+
+ public static boolean isFileLogger(String auditLog) {
+ return DIVIDER.split(auditLog.trim())[AUDIT_LOG_TYPE] == AUDIT_LOG_TYPE_FILE;
+ }
+
+ public static boolean isConsoleLogger(String auditLog) {
+ return DIVIDER.split(auditLog.trim())[AUDIT_LOG_TYPE] == AUDIT_LOG_TYPE_CONSOLE;
+ }
+
+ public static boolean isThreadedLogger(String auditLog) {
+ return DIVIDER.split(auditLog.trim())[AUDIT_LOG_TYPE] == AUDIT_LOG_TYPE_THREADED;
+ }
+
+ public static String getFileLoggerPath(String auditLog) {
+ return DIVIDER.split(auditLog.trim())[AUDIT_LOG_INFO];
+ }
+
+ public static String getThreadedLoggerPath(String auditLog) {
+ return DIVIDER.split(auditLog.trim())[AUDIT_LOG_INFO];
+ }
+
+ public static int getThreadedLoggerInterval(String auditLog) {
+ return Integer.parseInt(DIVIDER.split(auditLog.trim())[AUDIT_LOG_INTERVAL]);
+ }
+
public String[] getEventListeners()
{
return eventListeners;
14 years, 11 months
Seam SVN: r11940 - branches/community/Seam_2_2/src/pdf/org/jboss/seam/pdf/ui.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2010-01-08 12:29:57 -0500 (Fri, 08 Jan 2010)
New Revision: 11940
Modified:
branches/community/Seam_2_2/src/pdf/org/jboss/seam/pdf/ui/UIChapter.java
branches/community/Seam_2_2/src/pdf/org/jboss/seam/pdf/ui/UISection.java
Log:
JBSEAM-2578
Modified: branches/community/Seam_2_2/src/pdf/org/jboss/seam/pdf/ui/UIChapter.java
===================================================================
--- branches/community/Seam_2_2/src/pdf/org/jboss/seam/pdf/ui/UIChapter.java 2010-01-08 13:10:23 UTC (rev 11939)
+++ branches/community/Seam_2_2/src/pdf/org/jboss/seam/pdf/ui/UIChapter.java 2010-01-08 17:29:57 UTC (rev 11940)
@@ -8,7 +8,7 @@
public static final String COMPONENT_TYPE = "org.jboss.seam.pdf.ui.UIChapter";
Integer number = 1;
- Integer numberDepth = 1;
+ String chapterTitle;
public Chapter getChapter()
{
@@ -19,11 +19,6 @@
{
this.number = number;
}
-
- public void setNumberDepth(Integer numberDepth)
- {
- this.numberDepth = numberDepth;
- }
@Override
public Object getITextObject()
@@ -38,7 +33,13 @@
{
number = (Integer) valueBinding(context, "number", number);
numberDepth = (Integer) valueBinding(context, "numberDepth", numberDepth);
+ chapterTitle = (String) valueBinding(context, "chapterTitle", chapterTitle);
+
section = new Chapter("", number);
section.setNumberDepth(numberDepth);
+
+ if (chapterTitle != null) {
+ section.setBookmarkTitle(chapterTitle);
+ }
}
}
Modified: branches/community/Seam_2_2/src/pdf/org/jboss/seam/pdf/ui/UISection.java
===================================================================
--- branches/community/Seam_2_2/src/pdf/org/jboss/seam/pdf/ui/UISection.java 2010-01-08 13:10:23 UTC (rev 11939)
+++ branches/community/Seam_2_2/src/pdf/org/jboss/seam/pdf/ui/UISection.java 2010-01-08 17:29:57 UTC (rev 11940)
@@ -9,12 +9,18 @@
Section section;
Integer numberDepth;
+ String sectionTitle;
public void setNumberDepth(Integer numberDepth)
{
this.numberDepth = numberDepth;
}
-
+
+ public void setSectionTitle(String sectionTitle)
+ {
+ this.sectionTitle = sectionTitle;
+ }
+
public Section getSection()
{
return section;
@@ -56,6 +62,12 @@
}
section = sectionParent.addSection(new Paragraph(""), numberDepth);
+
+ sectionTitle = (String) valueBinding(context, "sectionTitle", sectionTitle);
+ if (sectionTitle != null)
+ {
+ section.setBookmarkTitle(sectionTitle);
+ }
}
private int countSectionParents(UISection component, int level)
14 years, 11 months