JBoss Rich Faces SVN: r16936 - root/framework/trunk/api.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-05-07 17:29:53 -0400 (Fri, 07 May 2010)
New Revision: 16936
Modified:
root/framework/trunk/api/pom.xml
Log:
https://jira.jboss.org/jira/browse/RF-8472
https://jira.jboss.org/jira/browse/RF-8473
Modified: root/framework/trunk/api/pom.xml
===================================================================
--- root/framework/trunk/api/pom.xml 2010-05-07 21:29:05 UTC (rev 16935)
+++ root/framework/trunk/api/pom.xml 2010-05-07 21:29:53 UTC (rev 16936)
@@ -35,8 +35,8 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymockclassextension</artifactId>
+ <groupId>org.jboss.test-jsf</groupId>
+ <artifactId>jsf-mock</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
14 years, 6 months
JBoss Rich Faces SVN: r16935 - in root/framework/trunk: api/src/test/java/org and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-05-07 17:29:05 -0400 (Fri, 07 May 2010)
New Revision: 16935
Added:
root/framework/trunk/api/src/main/java/org/richfaces/application/ServiceReference.java
root/framework/trunk/api/src/test/java/org/richfaces/
root/framework/trunk/api/src/test/java/org/richfaces/application/
root/framework/trunk/api/src/test/java/org/richfaces/application/ServiceTrackerTest.java
root/framework/trunk/impl/src/main/java/org/richfaces/application/ServiceTrackerLockPhaseListener.java
Modified:
root/framework/trunk/api/src/main/java/org/richfaces/application/ServiceTracker.java
root/framework/trunk/impl/src/main/java/org/richfaces/application/InitializationListener.java
root/framework/trunk/impl/src/main/resources/META-INF/initialization-listener.faces-config.xml
Log:
https://jira.jboss.org/jira/browse/RF-8472
https://jira.jboss.org/jira/browse/RF-8473
Added: root/framework/trunk/api/src/main/java/org/richfaces/application/ServiceReference.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/richfaces/application/ServiceReference.java (rev 0)
+++ root/framework/trunk/api/src/main/java/org/richfaces/application/ServiceReference.java 2010-05-07 21:29:05 UTC (rev 16935)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.application;
+
+/**
+ * <p>
+ * This interface is coupled with {@link ServiceTracker} class and provides reference to service implementation,
+ * allowing delayed service initialization.
+ * </p>
+ *
+ * <p>Methods provided by this interface are expected to be called from multiple concurrent threads
+ * without any synchronization aids.</p>
+ *
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+public interface ServiceReference<T> {
+
+ /**
+ * <p>Returns instance of service referenced by <code>this</code> object.</p>
+ *
+ * <p>Calling this method can cause delayed initialization of service.
+ * Clients of this class are not expected to store returned service implementation object,
+ * so storing reference to the created service object to avoid repeated initialization is the
+ * sole responsibility of this class.</p>
+ *
+ * @return referenced service implementation object
+ */
+ public T getService();
+
+}
Modified: root/framework/trunk/api/src/main/java/org/richfaces/application/ServiceTracker.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/richfaces/application/ServiceTracker.java 2010-05-07 19:02:35 UTC (rev 16934)
+++ root/framework/trunk/api/src/main/java/org/richfaces/application/ServiceTracker.java 2010-05-07 21:29:05 UTC (rev 16935)
@@ -30,92 +30,225 @@
/**
* <p>Tracker class to provide access to various framework implementation services.
- * Examples of such services are: {@link org.richfaces.skin.SkinFactory}, TBD</p>
- * <p/>
- * <p><b>Note:</b> this class is not synchronized and presumes that all modification operations
- * should be done in a single-thread (e.g. in initialization listener)</p>
+ * Examples of such services are: {@link org.richfaces.skin.SkinFactory}, TBD.</p>
+ *
+ * <p>Supports either direct placement of service implementation instances or lazy
+ * initialization via {@link ServiceReference} interface.</p>
+ *
+ * <p>This class represents application-scoped object that is replicated into attributes
+ * of {@link FacesContext} during runtime for better performance.</p>
+ *
+ * <p>No modifications operations are allowed after {@link ServiceTracker} is locked,
+ * and {@link IllegalStateException} is throws in this case.</p>
+ *
+ * <p><b>Note:</b> in initial state this class is not synchronized and presumes that all
+ * modification operations are done in a context of single-thread (in JSF initialization listener).
+ * In locked state read operations can be called from multiple threads concurrently without no need
+ * to synchronize explicitly.</p>
*
* @author Nick Belaevski
* @since 4.0
*/
public final class ServiceTracker {
- private static final String SERVICES_MAP_ATTRIBUTE = ServiceTracker.class.getName();
+ private static final String SERVICE_TRACKER_ATTRIBUTE = ServiceTracker.class.getName();
+ private volatile Map<Class<?>, Object> servicesMap = new HashMap<Class<?>, Object>();
+
private ServiceTracker() {
//utility class private constructor
}
- public static Collection<Class<?>> getRegisteredServiceClasses(FacesContext context) {
- Map<Class<?>, Object> servicesMap = getServicesMap(context, false);
- if (servicesMap != null) {
- return Collections.unmodifiableCollection(servicesMap.keySet());
+ private <T> T get(Class<T> serviceClass) {
+ Object serviceImplementation = null;
+ Object serviceObject = servicesMap.get(serviceClass);
+
+ if (serviceObject instanceof ServiceReference<?>) {
+ serviceImplementation = ((ServiceReference<?>) serviceObject).getService();
} else {
- return Collections.emptySet();
+ serviceImplementation = serviceObject;
}
+
+ //TODO - null?
+ return serviceClass.cast(serviceImplementation);
+ }
+
+ private void put(Class<?> key, Object value) {
+ try {
+ servicesMap.put(key, value);
+ } catch (UnsupportedOperationException e) {
+ throw new IllegalStateException("Service tracker is locked, no modification operation is allowed!");
+ }
}
- @SuppressWarnings("unchecked")
- public static <T> T getService(FacesContext context, Class<T> serviceInterfaceClass) {
+ private Collection<Class<?>> getRegisteredServiceClasses() {
+ return Collections.unmodifiableCollection(servicesMap.keySet());
+ }
+
+ private synchronized void lockModification() {
+ servicesMap = Collections.unmodifiableMap(servicesMap);
+ }
+
+ /**
+ * Returns unmodifiable collection of registered service classes.
+ *
+ * @param context current instance of {@link FacesContext}
+ * @return collection of registered service classes
+ *
+ * @throws NullPointerException if <code>context</code> is <code>null</code>
+ */
+ public static Collection<Class<?>> getRegisteredServiceClasses(FacesContext context) {
if (context == null) {
throw new NullPointerException("context");
}
- if (serviceInterfaceClass == null) {
- throw new NullPointerException("serviceInterfaceClass");
+ ServiceTracker serviceTracker = getServiceTracker(context);
+ return serviceTracker.getRegisteredServiceClasses();
+ }
+
+ /**
+ * Lookup registered service implementation by service class.
+ *
+ * @param context current instance of {@link FacesContext}
+ * @param serviceClass class for which implementation has been registered.
+ * @return registered implementation or <code>null</code>
+ *
+ * @throws NullPointerException if <code>context</code> or <code>serviceClass</code> is <code>null</code>
+ */
+ public static <T> T getService(FacesContext context, Class<T> serviceClass) {
+ if (context == null) {
+ throw new NullPointerException("context");
}
- T serviceImplementation = null;
-
- Map<Class<?>, Object> servicesMap = getServicesMap(context, false);
- if (servicesMap != null) {
- serviceImplementation = (T) servicesMap.get(serviceInterfaceClass);
+ if (serviceClass == null) {
+ throw new NullPointerException("serviceClass");
}
- //TODO - factories support
- //TODO - null?
- return serviceImplementation;
+ ServiceTracker serviceTracker = getServiceTracker(context);
+ return serviceTracker.get(serviceClass);
}
+ /**
+ * Registers service implementation for the given service class.
+ *
+ * @param context current instance of {@link FacesContext}
+ * @param serviceClass class for which implementation is to be registered
+ * @param serviceImplementation service implementation
+ *
+ * @throws NullPointerException if <code>context</code>, <code>serviceClass</code> or
+ * <code>serviceImplementation</code> is <code>null</code>
+ * @throws IllegalStateException if current {@link ServiceTracker} is in locked state.
+ */
public static <T> void setService(FacesContext context,
- Class<T> serviceInterfaceClass,
- T serviceImplementation) {
+ Class<T> serviceClass,
+ T serviceImplementation) {
if (context == null) {
throw new NullPointerException("context");
}
- if (serviceInterfaceClass == null) {
- throw new NullPointerException("serviceInterfaceClass");
+ if (serviceClass == null) {
+ throw new NullPointerException("serviceClass");
}
if (serviceImplementation == null) {
throw new NullPointerException("serviceImplementation");
}
- Map<Class<?>, Object> servicesMap = getServicesMap(context, true);
- servicesMap.put(serviceInterfaceClass, serviceImplementation);
+ ServiceTracker serviceTracker = getServiceTracker(context);
+ serviceTracker.put(serviceClass, serviceImplementation);
}
+ /**
+ * Registers {@link ServiceReference} for the given service class.
+ *
+ * @param context current instance of {@link FacesContext}
+ * @param serviceClass class for which reference is to be registered
+ * @param serviceReference instance of service reference
+ *
+ * @throws NullPointerException if <code>context</code>, <code>serviceClass</code> or
+ * <code>serviceReference</code> is <code>null</code>
+ * @throws IllegalStateException if current {@link ServiceTracker} is in locked state.
+ */
+ public static <T> void setServiceReference(FacesContext context,
+ Class<T> serviceClass,
+ ServiceReference<T> serviceReference) {
+
+ if (context == null) {
+ throw new NullPointerException("context");
+ }
+
+ if (serviceClass == null) {
+ throw new NullPointerException("serviceClass");
+ }
+
+ if (serviceReference == null) {
+ throw new NullPointerException("serviceReference");
+ }
+
+ ServiceTracker serviceTracker = getServiceTracker(context);
+ serviceTracker.put(serviceClass, serviceReference);
+ }
+
+ /**
+ * <p>Releases application-scoped {@link ServiceTracker}.</p>
+ * <p>Called during application shutdown; shouldn't be called explicitly by user.</p>
+ *
+ * @param context current instance of {@link FacesContext}
+ */
public static void release(FacesContext context) {
- clearServicesMap(context);
+ removeServiceTracker(context);
}
- private static Map<Class<?>, Object> getServicesMap(FacesContext facesContext, boolean createIfNull) {
- //TODO replicate in FacesContext map for better performance
- Map<String, Object> applicationMap = facesContext.getExternalContext().getApplicationMap();
- @SuppressWarnings("unchecked")
- Map<Class<?>, Object> servicesMap = (Map<Class<?>, Object>) applicationMap.get(SERVICES_MAP_ATTRIBUTE);
- if (servicesMap == null && createIfNull) {
- servicesMap = new HashMap<Class<?>, Object>();
- applicationMap.put(SERVICES_MAP_ATTRIBUTE, servicesMap);
+ /**
+ * <p>Switches application-scoped {@link ServiceTracker} to locked state, preventing further modifications
+ * of registered services via {@link #setService(FacesContext, Class, Object)} or
+ * {@link #setServiceReference(FacesContext, Class, ServiceReference)} methods.</p>
+ *
+ * <p>Called at the beginning of the very first application request life cycle; shouldn't be called explicitly
+ * by user.</p>
+ *
+ * @param context current instance of {@link FacesContext}
+ */
+ public static void lockModification(FacesContext context) {
+ ServiceTracker serviceTracker = getServiceTracker(context);
+ serviceTracker.lockModification();
+ }
+
+ private static ServiceTracker getServiceTrackerFromApplicationMap(FacesContext facesContext) {
+ Object appContext = facesContext.getExternalContext().getContext();
+
+ synchronized (appContext) {
+ ServiceTracker serviceTracker;
+ Map<String, Object> applicationMap = facesContext.getExternalContext().getApplicationMap();
+ serviceTracker = (ServiceTracker) applicationMap.get(SERVICE_TRACKER_ATTRIBUTE);
+ if (serviceTracker == null) {
+ serviceTracker = new ServiceTracker();
+ applicationMap.put(SERVICE_TRACKER_ATTRIBUTE, serviceTracker);
+ }
+
+ return serviceTracker;
}
+
+ }
+
+ private static ServiceTracker getServiceTracker(FacesContext facesContext) {
+ ServiceTracker serviceTracker = (ServiceTracker) facesContext.getAttributes().get(SERVICE_TRACKER_ATTRIBUTE);
- return servicesMap;
+ if (serviceTracker == null) {
+ serviceTracker = getServiceTrackerFromApplicationMap(facesContext);
+
+ //replicate in FacesContext map for better performance
+ facesContext.getAttributes().put(SERVICE_TRACKER_ATTRIBUTE, serviceTracker);
+ }
+
+ return serviceTracker;
}
- private static void clearServicesMap(FacesContext facesContext) {
+ private static void removeServiceTracker(FacesContext facesContext) {
Map<String, Object> applicationMap = facesContext.getExternalContext().getApplicationMap();
- applicationMap.remove(SERVICES_MAP_ATTRIBUTE);
+ applicationMap.remove(SERVICE_TRACKER_ATTRIBUTE);
+
+ facesContext.getAttributes().remove(SERVICE_TRACKER_ATTRIBUTE);
}
}
Added: root/framework/trunk/api/src/test/java/org/richfaces/application/ServiceTrackerTest.java
===================================================================
--- root/framework/trunk/api/src/test/java/org/richfaces/application/ServiceTrackerTest.java (rev 0)
+++ root/framework/trunk/api/src/test/java/org/richfaces/application/ServiceTrackerTest.java 2010-05-07 21:29:05 UTC (rev 16935)
@@ -0,0 +1,173 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.application;
+
+import static org.easymock.EasyMock.expect;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+import javax.servlet.ServletContext;
+
+import org.jboss.test.faces.mock.MockFacesEnvironment;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class ServiceTrackerTest {
+
+ private MockFacesEnvironment environment;
+
+ private FacesContext context;
+
+ private ServletContext servletContext;
+
+ private Map<String, Object> applicationMap;
+
+ private Map<Object, Object> contextMap;
+
+ private SkinServiceImpl skinServiceImpl;
+
+ private ConfigServiceImpl configServiceImpl;
+
+ private ConfigServiceReferenceImpl configServiceReference;
+
+ private static interface SkinService {};
+
+ private static class SkinServiceImpl implements SkinService {}
+
+ private static interface ConfigService {};
+
+ private static class ConfigServiceReferenceImpl implements ServiceReference<ConfigService> {
+
+ private ConfigService service;
+
+ public ConfigServiceReferenceImpl(ConfigService service) {
+ super();
+ this.service = service;
+ }
+
+ public ConfigService getService() {
+ return service;
+ }
+ }
+
+ private static class ConfigServiceImpl implements ConfigService {}
+
+ private void setupRequestObjects() {
+ expect(environment.getExternalContext().getApplicationMap()).andStubReturn(applicationMap);
+ expect(environment.getExternalContext().getContext()).andStubReturn(servletContext);
+
+ contextMap = new HashMap<Object, Object>();
+ expect(environment.getFacesContext().getAttributes()).andStubReturn(contextMap);
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ skinServiceImpl = new SkinServiceImpl();
+ configServiceImpl = new ConfigServiceImpl();
+ configServiceReference = new ConfigServiceReferenceImpl(configServiceImpl);
+
+ environment = MockFacesEnvironment.createEnvironment().withExternalContext();
+ context = environment.getFacesContext();
+
+ applicationMap = new HashMap<String, Object>();
+ servletContext = environment.createMock(ServletContext.class);
+
+ setupRequestObjects();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ skinServiceImpl = null;
+ configServiceImpl = null;
+ configServiceReference = null;
+
+ context = null;
+ applicationMap = null;
+ contextMap = null;
+
+ environment.verify();
+ environment.release();
+ environment = null;
+ }
+
+ @Test
+ public void testBasic() throws Exception {
+ environment.replay();
+
+ ServiceTracker.setService(context, SkinService.class, skinServiceImpl);
+ ServiceTracker.setServiceReference(context, ConfigService.class, configServiceReference);
+
+ ServiceTracker.lockModification(context);
+
+ Collection<Class<?>> serviceClasses = ServiceTracker.getRegisteredServiceClasses(context);
+ assertFalse(serviceClasses.isEmpty());
+
+ assertTrue(serviceClasses.contains(SkinService.class));
+ assertTrue(serviceClasses.contains(ConfigService.class));
+
+ assertSame(skinServiceImpl, ServiceTracker.getService(context, SkinService.class));
+ assertSame(configServiceImpl, ServiceTracker.getService(context, ConfigService.class));
+
+ environment.reset();
+ setupRequestObjects();
+ environment.replay();
+
+ serviceClasses = ServiceTracker.getRegisteredServiceClasses(context);
+ assertFalse(serviceClasses.isEmpty());
+
+ assertTrue(serviceClasses.contains(SkinService.class));
+ assertTrue(serviceClasses.contains(ConfigService.class));
+
+ assertSame(skinServiceImpl, ServiceTracker.getService(context, SkinService.class));
+ assertSame(configServiceImpl, ServiceTracker.getService(context, ConfigService.class));
+
+ ServiceTracker.release(context);
+ }
+
+ @Test
+ public void testLockModifications() throws Exception {
+ environment.replay();
+
+ ServiceTracker.lockModification(context);
+
+ try {
+ ServiceTracker.setService(context, SkinService.class, skinServiceImpl);
+
+ fail();
+ } catch (IllegalStateException e) {
+ }
+
+ ServiceTracker.release(context);
+ }
+}
\ No newline at end of file
Modified: root/framework/trunk/impl/src/main/java/org/richfaces/application/InitializationListener.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/application/InitializationListener.java 2010-05-07 19:02:35 UTC (rev 16934)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/application/InitializationListener.java 2010-05-07 21:29:05 UTC (rev 16935)
@@ -21,13 +21,13 @@
*/
package org.richfaces.application;
-import org.ajax4jsf.cache.CacheManager;
-import org.ajax4jsf.renderkit.AJAXDataSerializer;
-import org.ajax4jsf.resource.util.URLToStreamHelper;
-import org.richfaces.log.RichfacesLogger;
-import org.richfaces.skin.SkinFactory;
-import org.richfaces.skin.SkinFactoryImpl;
-import org.slf4j.Logger;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.text.MessageFormat;
import javax.faces.FacesException;
import javax.faces.context.FacesContext;
@@ -36,14 +36,15 @@
import javax.faces.event.PreDestroyApplicationEvent;
import javax.faces.event.SystemEvent;
import javax.faces.event.SystemEventListener;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.text.MessageFormat;
+import org.ajax4jsf.cache.CacheManager;
+import org.ajax4jsf.renderkit.AJAXDataSerializer;
+import org.ajax4jsf.resource.util.URLToStreamHelper;
+import org.richfaces.log.RichfacesLogger;
+import org.richfaces.skin.SkinFactory;
+import org.richfaces.skin.SkinFactoryImpl;
+import org.slf4j.Logger;
+
/**
* @author Nick Belaevski
* @since 4.0
Added: root/framework/trunk/impl/src/main/java/org/richfaces/application/ServiceTrackerLockPhaseListener.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/application/ServiceTrackerLockPhaseListener.java (rev 0)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/application/ServiceTrackerLockPhaseListener.java 2010-05-07 21:29:05 UTC (rev 16935)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.application;
+
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+import javax.faces.lifecycle.Lifecycle;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class ServiceTrackerLockPhaseListener implements PhaseListener {
+
+ private static final long serialVersionUID = 3206929642757284003L;
+
+ public void afterPhase(PhaseEvent event) {
+ }
+
+ public void beforePhase(PhaseEvent event) {
+ ServiceTracker.lockModification(event.getFacesContext());
+ ((Lifecycle) event.getSource()).removePhaseListener(this);
+ }
+
+ public PhaseId getPhaseId() {
+ return PhaseId.ANY_PHASE;
+ }
+
+}
Modified: root/framework/trunk/impl/src/main/resources/META-INF/initialization-listener.faces-config.xml
===================================================================
--- root/framework/trunk/impl/src/main/resources/META-INF/initialization-listener.faces-config.xml 2010-05-07 19:02:35 UTC (rev 16934)
+++ root/framework/trunk/impl/src/main/resources/META-INF/initialization-listener.faces-config.xml 2010-05-07 21:29:05 UTC (rev 16935)
@@ -11,5 +11,9 @@
<system-event-class>javax.faces.event.PostConstructApplicationEvent</system-event-class>
</system-event-listener>
</application>
+
+ <lifecycle>
+ <phase-listener>org.richfaces.application.ServiceTrackerLockPhaseListener</phase-listener>
+ </lifecycle>
</faces-config>
\ No newline at end of file
14 years, 6 months
JBoss Rich Faces SVN: r16934 - root.
by richfaces-svn-commits@lists.jboss.org
Author: jbalunas(a)redhat.com
Date: 2010-05-07 15:02:35 -0400 (Fri, 07 May 2010)
New Revision: 16934
Modified:
root/pom.xml
Log:
Temp update to add project wide parent and bom
Modified: root/pom.xml
===================================================================
--- root/pom.xml 2010-05-07 19:01:53 UTC (rev 16933)
+++ root/pom.xml 2010-05-07 19:02:35 UTC (rev 16934)
@@ -31,10 +31,15 @@
</distributionManagement>
<modules>
+ <!-- These trunk settings, and this pom.xml will be removed -->
+ <!-- Added bom, parent, for temp integration -->
+ <module>build/bom/trunk</module>
+ <module>build/parent/trunk</module>
<module>build/resources/trunk/checkstyle</module>
<module>framework/${framework.svn.dir}</module>
- <module>cdk/${cdk.svn.dir}</module>
+ <module>cdk/${cdk.svn.dir}</module>
<module>ui/${ui.svn.dir}</module>
+ -->
<!--<module>ui-sandbox/${ui-sandbox.svn.dir}</module>-->
<!--<module>examples/${examples.svn.dir}</module>-->
<!--<module>examples-sandbox/${examples-sandbox.svn.dir}</module>-->
14 years, 6 months
JBoss Rich Faces SVN: r16933 - root/build/resources/trunk/checkstyle.
by richfaces-svn-commits@lists.jboss.org
Author: jbalunas(a)redhat.com
Date: 2010-05-07 15:01:53 -0400 (Fri, 07 May 2010)
New Revision: 16933
Modified:
root/build/resources/trunk/checkstyle/pom.xml
Log:
Updated to use new project parent, and bom
Modified: root/build/resources/trunk/checkstyle/pom.xml
===================================================================
--- root/build/resources/trunk/checkstyle/pom.xml 2010-05-07 19:01:25 UTC (rev 16932)
+++ root/build/resources/trunk/checkstyle/pom.xml 2010-05-07 19:01:53 UTC (rev 16933)
@@ -3,31 +3,17 @@
<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.richfaces</groupId>
<artifactId>checkstyle</artifactId>
<version>4.0.0-SNAPSHOT</version>
<name>Richfaces checkstyle</name>
+
+ <parent>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-parent</artifactId>
+ <version>1-SNAPSHOT</version>
+ </parent>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- </properties>
-
- <distributionManagement>
- <downloadUrl>http://labs.jboss.com/portal/jbossrichfaces/downloads</downloadUrl>
- <repository>
- <id>jboss-releases-repository</id>
- <uniqueVersion>false</uniqueVersion>
- <url>${releaseRepository}</url>
- </repository>
- <snapshotRepository>
- <id>jboss-snapshots-repository</id>
- <uniqueVersion>true</uniqueVersion>
- <url>${snapshotRepository}</url>
- </snapshotRepository>
- </distributionManagement>
-
</project>
\ No newline at end of file
14 years, 6 months
JBoss Rich Faces SVN: r16932 - in root/build: parent/trunk and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: jbalunas(a)redhat.com
Date: 2010-05-07 15:01:25 -0400 (Fri, 07 May 2010)
New Revision: 16932
Added:
root/build/bom/trunk/pom.xml
root/build/parent/trunk/pom.xml
Log:
Initial draft versions of project parent, and bom modules based on - http://community.jboss.org/wiki/RichFaces40BuildDirectoryStructure
Added: root/build/bom/trunk/pom.xml
===================================================================
--- root/build/bom/trunk/pom.xml (rev 0)
+++ root/build/bom/trunk/pom.xml 2010-05-07 19:01:25 UTC (rev 16932)
@@ -0,0 +1,112 @@
+
+ <!--
+ JBoss, Home of Professional Open Source Copyright 2010, Red Hat,
+ Inc. and individual contributors by the @authors tag. See the
+ copyright.txt in the distribution for a full listing of
+ individual contributors. This is free software; you can
+ redistribute it and/or modify it under the terms of the GNU
+ Lesser General Public License as published by the Free Software
+ Foundation; either version 2.1 of the License, or (at your
+ option) any later version. This software is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without
+ even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details. You should have received a copy of the GNU
+ Lesser General Public License along with this software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St,
+ Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site:
+ http://www.fsf.org.
+ -->
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-bom</artifactId>
+ <packaging>pom</packaging>
+ <version>4.0.0-SNAPSHOT</version>
+ <name>RichFaces BOM</name>
+
+ <parent>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-parent</artifactId>
+ <version>5</version>
+ </parent>
+
+ <description>
+ The RichFaces "Bill of Materials". This defines all runtime dependency versions for RichFaces.
+ </description>
+
+ <url>http://www.jboss.org/richfaces</url>
+
+ <properties>
+ <!-- RichFaces Modules Versions -->
+ <richfaces.core.version>4.0.0-SNAPSHOT</richfaces.core.version>
+ <richfaces.commons.version>4.0.0-SNAPSHOT</richfaces.commons.version>
+ <richfaces.ui.core.version>4.0.0-SNAPSHOT</richfaces.ui.core.version>
+ <richfaces.ui.input.version>4.0.0-SNAPSHOT</richfaces.ui.input.version>
+ <richfaces.ui.output.version>4.0.0-SNAPSHOT</richfaces.ui.output.version>
+ <richfaces.ui.iteration.version>4.0.0-SNAPSHOT</richfaces.ui.iteration.version>
+ <!-- cdk is not really a runtime dependency for RichFaces
+ <richfaces.cdk.version>4.0.0-SNAPSHOT</richfaces.cdk.version>
+ -->
+ </properties>
+
+ <!-- Runtime dependency management -->
+ <dependencyManagement>
+ <dependencies>
+ <!-- RichFaces -->
+ <dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>core</artifactId>
+ <version>${richfaces.core.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.richfaces.commons</groupId>
+ <artifactId>commons</artifactId>
+ <version>${richfaces.commons.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>core</artifactId>
+ <version>${richfaces.ui.core.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>input</artifactId>
+ <version>${richfaces.ui.input.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>output</artifactId>
+ <version>${richfaces.ui.output.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>iteration</artifactId>
+ <version>${richfaces.ui.iteration.version}</version>
+ </dependency>
+
+ <!-- cdk is not really a runtime dependency for RichFaces
+ <dependency>
+ <groupId>org.richfaces</groupId>
+ <artifactId>cdk</artifactId>
+ <version>${richfaces.cdk.version}</version>
+ </dependency>
+ -->
+
+ </dependencies>
+ </dependencyManagement>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/root/build/bom/trunk</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/root/build/bom/trunk</developerConnection>
+ <url>http://fisheye.jboss.org/browse/richfaces</url>
+ </scm>
+
+</project>
Added: root/build/parent/trunk/pom.xml
===================================================================
--- root/build/parent/trunk/pom.xml (rev 0)
+++ root/build/parent/trunk/pom.xml 2010-05-07 19:01:25 UTC (rev 16932)
@@ -0,0 +1,130 @@
+
+ <!--
+ JBoss, Home of Professional Open Source Copyright 2010, Red Hat,
+ Inc. and individual contributors by the @authors tag. See the
+ copyright.txt in the distribution for a full listing of
+ individual contributors. This is free software; you can
+ redistribute it and/or modify it under the terms of the GNU
+ Lesser General Public License as published by the Free Software
+ Foundation; either version 2.1 of the License, or (at your
+ option) any later version. This software is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without
+ even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details. You should have received a copy of the GNU
+ Lesser General Public License along with this software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St,
+ Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site:
+ http://www.fsf.org.
+ -->
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-parent</artifactId>
+ <packaging>pom</packaging>
+ <version>1-SNAPSHOT</version>
+ <name>RichFaces Parent</name>
+
+ <parent>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-parent</artifactId>
+ <version>5</version>
+ </parent>
+
+ <description>
+ The Parent for all RichFaces sub-projects. This specifies build and project meta-data. Runtime dependencies are imported via the richfaces-bom.
+ </description>
+
+ <url>http://www.jboss.org/richfaces</url>
+
+ <licenses>
+ <license>
+ <name>GNU Lesser General Public License, Version 2.1</name>
+ <distribution>repo</distribution>
+ <url>http://www.gnu.org/licenses/lgpl-2.1.txt</url>
+ </license>
+ </licenses>
+
+ <developers>
+ <developer>
+ <name>RichFaces committers</name>
+ </developer>
+ </developers>
+
+ <issueManagement>
+ <system>jira</system>
+ <url>https://jira.jboss.org/jira/browse/RF</url>
+ </issueManagement>
+
+ <properties>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <richfaces.version>4.0.0-SNAPSHOT</richfaces.version>
+ </properties>
+
+ <!-- Repository management, including extra repositories if needed -->
+ <repositories>
+ <repository>
+ <id>jboss-public-repository-group</id>
+ <name>JBoss Public Maven Repository Group</name>
+ <url>https://repository.jboss.org/nexus/content/groups/public/</url>
+ <layout>default</layout>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>jboss-public-repository-group</id>
+ <name>JBoss Public Maven Repository Group</name>
+ <url>https://repository.jboss.org/nexus/content/groups/public/</url>
+ <layout>default</layout>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <!-- Dependency management - import bom, and define any test, or other dependencies -->
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-bom</artifactId>
+ <version>${richfaces.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+
+ <!-- Test Dependencies -->
+ </dependencyManagement>
+
+ <!-- Build -->
+
+ <!-- Plugin config, including versions to use in the build -->
+
+ <!-- Profiles -->
+
+ <!-- SCM and distribution management -->
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/root/build/parent/trunk</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/root/build/parent/trunk</developerConnection>
+ <url>http://fisheye.jboss.org/browse/richfaces</url>
+ </scm>
+
+</project>
14 years, 6 months
JBoss Rich Faces SVN: r16931 - root/examples-sandbox/trunk/components/tables/src/main/webapp.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-05-07 10:25:35 -0400 (Fri, 07 May 2010)
New Revision: 16931
Modified:
root/examples-sandbox/trunk/components/tables/src/main/webapp/home.xhtml
Log:
Modified: root/examples-sandbox/trunk/components/tables/src/main/webapp/home.xhtml
===================================================================
--- root/examples-sandbox/trunk/components/tables/src/main/webapp/home.xhtml 2010-05-07 14:24:26 UTC (rev 16930)
+++ root/examples-sandbox/trunk/components/tables/src/main/webapp/home.xhtml 2010-05-07 14:25:35 UTC (rev 16931)
@@ -16,7 +16,7 @@
<h:body>
<h:form id="form1">
- <ds:dataScroller id="scroller1" for="richTable" page="#{dataBean.page}" maxPages="7"></ds:dataScroller >
+ <ds:dataScroller id="scroller1" for="richTable" page="#{dataBean.page}" maxPages="7"></ds:dataScroller >
<rich:dataTable id="richTable" var="record" rowKeyVar="rowKey" value="#{dataBean.employeeList}" rows="20" sortMode="single">
<f:facet name="caption">
@@ -83,14 +83,14 @@
<!-- cc:componentControl event="click" target="#{dataBean.target}" operation="#{dataBean.operation}">
<f:param name="event" value="event"/>
- <cc:hashParameter>
+ <cc:hashParam>
<f:param name="key1" value="value1"/>
<f:param name="key2" value="value2"/>
<f:param name="key3" value="value3"/>
- <cc:hashParameter name="nested1">
+ <cc:hashParam name="nested1">
<f:param name="key11" value="value11"/>
- </cc:hashParameter>
- </cc:hashParameter>
+ </cc:hashParam>
+ </cc:hashParam>
<cc:hashParameter name="hashkey1">
<f:param name="keyhash1" value="value1"/>
<f:param name="keyhash2" value="value2"/>
@@ -110,6 +110,17 @@
<cc:componentControl event="click" target="form1:scroller1" operation="previous"/>
</h:commandButton>
+ <h:commandButton value="sort">
+ <cc:componentControl event="click" target="form1:richTable" operation="sort">
+ <f:param value="column_title"/>
+ </cc:componentControl>
+ </h:commandButton>
+
+ <h:commandButton value="unsort">
+ <cc:componentControl event="click" target="form1:richTable" operation="sort">
+ </cc:componentControl>
+ </h:commandButton>
+
</h:form>
</h:body>
</html>
14 years, 6 months
JBoss Rich Faces SVN: r16930 - root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-05-07 10:24:26 -0400 (Fri, 07 May 2010)
New Revision: 16930
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/datatable.js
Log:
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/datatable.js
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/datatable.js 2010-05-07 14:11:24 UTC (rev 16929)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/datatable.js 2010-05-07 14:24:26 UTC (rev 16930)
@@ -48,6 +48,18 @@
filter: function(columnId, filterValue, isClear) {
invoke.call(this,createParameters.call(this,richfaces.ui.DataTable.FILTERING, columnId, filterValue, isClear));
+ },
+
+ switchSubTable: function(id) {
+
+ },
+
+ expandAllSubTables: function() {
+
+ },
+
+ collapseAllSubTables: function {
+
}
}
})());
14 years, 6 months
JBoss Rich Faces SVN: r16928 - in root: examples and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-05-07 10:09:21 -0400 (Fri, 07 May 2010)
New Revision: 16928
Removed:
root/examples/trunk/
Modified:
root/pom.xml
Log:
change richfaces build structure
https://community.jboss.org/wiki/RichFaces40BuildDirectoryStructure
examples
Modified: root/pom.xml
===================================================================
--- root/pom.xml 2010-05-07 14:08:04 UTC (rev 16927)
+++ root/pom.xml 2010-05-07 14:09:21 UTC (rev 16928)
@@ -36,7 +36,7 @@
<module>cdk/${cdk.svn.dir}</module>
<module>ui/${ui.svn.dir}</module>
<!--<module>ui-sandbox/${ui-sandbox.svn.dir}</module>-->
- <module>examples/${examples.svn.dir}</module>
+ <!--<module>examples/${examples.svn.dir}</module>-->
<!--<module>examples-sandbox/${examples-sandbox.svn.dir}</module>-->
<!--<module>doc/${doc.svn.dir}</module>-->
</modules>
14 years, 6 months
JBoss Rich Faces SVN: r16927 - root/framework/trunk/impl/src/main/resources/META-INF/resources.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-05-07 10:08:04 -0400 (Fri, 07 May 2010)
New Revision: 16927
Modified:
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-queue.js
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js
Log:
https://jira.jboss.org/jira/browse/RF-7893
Modified: root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-queue.js
===================================================================
--- root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-queue.js 2010-05-07 14:07:13 UTC (rev 16926)
+++ root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-queue.js 2010-05-07 14:08:04 UTC (rev 16927)
@@ -61,10 +61,11 @@
var id;
// find default options for QueueEntry
- if (options.hasOwnProperty("queueId")) {
+ if (options.queueId) {
if (defaultQueueOptions[options.queueId]) {
id = options.queueId;
}
+ delete options.queueId;
} else {
var element = richfaces.getDomElement(source);
var form;
@@ -87,17 +88,18 @@
}
}
+
this.event = event;
//similarityGroupingId is mutable, thus we need special field for it
- this.similarityGroupingId = (typeof this.options.similarityGroupingId != "undefined") ? this.options.similarityGroupingId : this.queueOptions.similarityGroupingId;
+ this.similarityGroupingId = this.queueOptions.similarityGroupingId;
this.eventsCount = 1;
};
$.extend(QueueEntry.prototype, {
// now unused functions: isIgnoreDupResponses, ondrop, clearEntry
isIgnoreDupResponses: function() {
- return (typeof this.options.ignoreDupResponses != "undefined") ? this.options.ignoreDupResponses : this.queueOptions.ignoreDupResponses;
+ return this.queueOptions.ignoreDupResponses;
},
getSimilarityGroupingId: function() {
@@ -121,7 +123,7 @@
},
ondrop: function() {
- var callback = this.options.onqueuerequestdrop;
+ var callback = this.queueOptions.onqueuerequestdrop;
if (callback) {
callback.call(this.queue, this.source, this.options, this.event);
}
@@ -133,7 +135,7 @@
},
startTimer: function() {
- var delay = this.options.requestDelay;
+ var delay = this.queueOptions.requestDelay;
if (typeof delay!="number") {
delay = this.queueOptions.requestDelay || 0;
}
@@ -253,16 +255,11 @@
};
var callEventHandler = function (handlerName, entry) {
- var handler = entry.options[handlerName];
+ handler = entry.queueOptions[handlerName];
if (handler) {
// what is a context should be??
handler.call(null, entry);
}
- handler = entry.queueOptions[handlerName];
- if (handler) {
- // the same about context
- handler.call(null, entry);
- }
var opts, handler2;
if (entry.queueOptions.queueId &&
(opts=defaultQueueOptions[entry.queueOptions.queueId]) &&
Modified: root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js
===================================================================
--- root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js 2010-05-07 14:07:13 UTC (rev 16926)
+++ root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js 2010-05-07 14:08:04 UTC (rev 16927)
@@ -484,12 +484,6 @@
var sourceId = (typeof source == 'object' && source.id) ? source.id : source;
options = options || {};
- if (richfaces.queue) {
- var queueOptions = richfaces.queue.getQueueOptions(options.queueId || sourceId);
- var saveQueueId = queueOptions.queueId;
- options = jQuery.extend({}, queueOptions, options);
- options.queueId = saveQueueId;
- }
parameters = options.parameters || {}; // TODO: change "parameters" to "richfaces.ajax.params"
parameters.execute = "@component";
@@ -534,6 +528,10 @@
parameters['onevent'] = eventsAdapter;
parameters['onerror'] = eventsAdapter;
}
+
+ if (richfaces.queue) {
+ parameters.queueId = options.queueId;
+ }
jsf.ajax.request(source, event, parameters);
};
14 years, 6 months