JBoss Rich Faces SVN: r17632 - in root/core/branches/jsr-330/jsr330-impl: src/main/java/org/richfaces/jsr330 and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-06-16 20:23:45 -0400 (Wed, 16 Jun 2010)
New Revision: 17632
Added:
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Module.java
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Scope.java
Removed:
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/BindingModule.java
Modified:
root/core/branches/jsr-330/jsr330-impl/pom.xml
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Binder.java
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/BinderImpl.java
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/InjectorImpl.java
root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/InjectorTest.java
Log:
implement scopes
Modified: root/core/branches/jsr-330/jsr330-impl/pom.xml
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/pom.xml 2010-06-16 12:38:15 UTC (rev 17631)
+++ root/core/branches/jsr-330/jsr330-impl/pom.xml 2010-06-17 00:23:45 UTC (rev 17632)
@@ -48,5 +48,12 @@
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
+ <!-- Provided dependencies -->
+ <!-- JSF2 api version set by bom/richface-parent -->
+ <dependency>
+ <groupId>${jsf2.api.groupid}</groupId>
+ <artifactId>${jsf2.api.artifactid}</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
</project>
Modified: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Binder.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Binder.java 2010-06-16 12:38:15 UTC (rev 17631)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Binder.java 2010-06-17 00:23:45 UTC (rev 17632)
@@ -48,5 +48,8 @@
public Binder<T> toService(Class<? extends T> defaultImplementation);
public Binder<T> asSingleton();
-
+ public Binder<T> asSessionScope();
+ public Binder<T> asRequestScope();
+ public Binder<T> asApplicationScope();
+
}
Modified: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/BinderImpl.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/BinderImpl.java 2010-06-16 12:38:15 UTC (rev 17631)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/BinderImpl.java 2010-06-17 00:23:45 UTC (rev 17632)
@@ -24,7 +24,10 @@
package org.richfaces.jsr330;
import java.util.Collection;
+import java.util.Map;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import javax.faces.context.FacesContext;
import javax.inject.Provider;
/**
@@ -32,42 +35,117 @@
* </p>
*
* @author asmirnov(a)exadel.com
- *
+ *
* @param <T>
*/
public final class BinderImpl<T> implements Binder<T> {
- private final Class<T> target;
+ private final Scope<T> defaultScope = new Scope<T>() {
+ public T get() {
+ return getProvider().get();
+ }
+ };
+
+ private final Scope<T> singltonScope = new Scope<T>() {
+
+ private boolean instantiated = false;
+
+ private volatile T value;
+
+ public T get() {
+ if (!instantiated) {
+ value = getProvider().get();
+ instantiated = true;
+ }
+ return value;
+ }
+ };
+
+ private abstract class FacesScope implements Scope<T> {
+
+ private ReentrantReadWriteLock rwLock = new ReentrantReadWriteLock();
+
+ public T get() {
+ T value;
+ rwLock.readLock().lock();
+ try {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ if (null != facesContext) {
+ Map<String, Object> map = getMap(facesContext);
+ value = (T) map.get(target.toString());
+ if(null == value){
+ rwLock.readLock().unlock();
+ rwLock.writeLock().lock();
+ try {
+ value = getProvider().get();
+ map.put(target.toString(), value);
+ } finally {
+ rwLock.readLock().lock();
+ rwLock.writeLock().unlock();
+ }
+ }
+ } else {
+ value = getProvider().get();
+ }
+ } finally {
+ rwLock.readLock().unlock();
+ }
+ return value;
+ }
+
+ protected abstract Map<String, Object> getMap(FacesContext facesContext);
+ }
- private volatile T value;
+ private final Scope<T> sessionScope = new FacesScope() {
+
+ @Override
+ protected Map<String, Object> getMap(FacesContext facesContext) {
+ Map<String, Object> map = facesContext.getExternalContext().getSessionMap();
+ return map;
+ }
+ };
+ private final Scope<T> requestScope = new FacesScope() {
+ @Override
+ protected Map<String, Object> getMap(FacesContext facesContext) {
+ return facesContext.getExternalContext().getRequestMap();
+ }
+ };
+
+ private final Scope<T> applicationScope = new FacesScope() {
+ @Override
+ protected Map<String, Object> getMap(FacesContext facesContext) {
+ return facesContext.getExternalContext().getApplicationMap();
+ }
+ };
+
+ private final Target target;
+
private Provider<T> provider;
private Provider<Provider<T>> providerOfProvider;
- private boolean singleton;
+ private Scope<T> scope;
private volatile BinderImpl<Provider<T>> providerBinder;
-
+
private boolean initialized = false;
- private boolean providerSingleton;
-
/**
- * <p class="changed_added_4_0"></p>
- * @param target the target to set
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param target
+ * the target to set
*/
- public BinderImpl(Class<T> target) {
+ public BinderImpl(Target target) {
this.target = target;
+ this.scope = defaultScope;
}
public T get() {
checkInitialized();
- if (null != value) {
- return value;
- } else {
- return getProvider().get();
- }
+ return scope.get();
}
public BinderImpl<Provider<T>> asProviderBinder() {
@@ -77,7 +155,9 @@
return providerBinder;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.richfaces.jsr330.Binder#to(java.lang.Class)
*/
public Binder<T> to(Class<? extends T> implementation) {
@@ -85,22 +165,25 @@
return this;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.richfaces.jsr330.Binder#toInstance(java.lang.Object)
*/
- public Binder<T> toInstance(T value) {
+ public Binder<T> toInstance(final T value) {
checkNotInitialized();
- this.value = value;
this.provider = new Provider<T>() {
public T get() {
- return BinderImpl.this.value;
+ return value;
}
};
return this;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.richfaces.jsr330.Binder#toProvider(java.lang.Class)
*/
@SuppressWarnings("unchecked")
@@ -110,7 +193,9 @@
return this;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.richfaces.jsr330.Binder#toProviderInstance(javax.inject.Provider)
*/
public Binder<T> toProviderInstance(Provider<T> provider) {
@@ -118,112 +203,127 @@
return this;
}
- /* (non-Javadoc)
+ public Binder<T> toService() {
+ Collection<Class<? extends T>> service = loadService();
+ if (service.size() > 0) {
+ this.to(service.iterator().next());
+ } else {
+ throw new DependencyException("No implementation found for service " + target);
+ }
+ return this;
+ }
+
+ public Binder<T> toService(Class<? extends T> defaultImplementation) {
+ Collection<Class<? extends T>> service = loadService();
+ if (service.size() > 0) {
+ this.to(service.iterator().next());
+ } else {
+ this.to(defaultImplementation);
+ }
+ return this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.richfaces.jsr330.Binder#asSingleton()
*/
public Binder<T> asSingleton() {
- this.singleton = true;
+ this.scope = singltonScope;
return this;
}
- private void checkInitialized() {
- if(!initialized){
- throw new DependencyException("Dependency injection implementation has not been initialized");
- }
+ public Binder<T> asApplicationScope() {
+ this.scope = applicationScope;
+ return this;
}
- private void checkNotInitialized() {
- if(initialized){
- throw new DependencyException("Dependency injection implementation has already been initialized");
- }
+ public Binder<T> asRequestScope() {
+ this.scope = requestScope;
+ return this;
}
- Provider<T> getProvider() {
- return null == this.provider ? this.providerOfProvider.get() : this.provider;
+ public Binder<T> asSessionScope() {
+ this.scope = sessionScope;
+ return this;
}
void init(Binders injector) throws DependencyException {
checkNotInitialized();
- if (null == value && null == provider && null == providerOfProvider) {
+ if (null == provider && null == providerOfProvider) {
throw new DependencyException("binding not has not been set");
}
if (null != provider && provider instanceof Initializable) {
- this.singleton |=((Initializable) provider).init(injector);
+ if( ((Initializable) provider).init(injector)){
+ this.scope = singltonScope;
+ }
}
if (null != providerOfProvider && providerOfProvider instanceof Initializable) {
- this.providerSingleton |=((Initializable) providerOfProvider).init(injector);
+ ((Initializable) providerOfProvider).init(injector);
}
this.initialized = true;
}
void createInstances(Binders injector) throws DependencyException {
checkInitialized();
- if(providerSingleton && null == provider){
+ if (null == provider && null != providerOfProvider) {
this.provider = providerOfProvider.get();
}
- if(singleton && null == value ){
- this.value= getProvider().get();
+ if (this.scope == singltonScope ) {
+ scope.get();
}
createProviderBinding();
}
+ public void destroy(InjectorImpl injectorImpl) {
+ if (null != provider && provider instanceof Initializable) {
+ ((Initializable) provider).destroy();
+ }
+ if (null != providerOfProvider && providerOfProvider instanceof Initializable) {
+ ((Initializable) providerOfProvider).destroy();
+ }
+ provider = null;
+ providerOfProvider = null;
+ providerBinder = null;
+ this.initialized = false;
+ }
+
+ Provider<T> getProvider() {
+ return null == this.provider ? this.providerOfProvider.get() : this.provider;
+ }
+
+ private void checkInitialized() {
+ if (!initialized) {
+ throw new DependencyException("Dependency injection implementation has not been initialized");
+ }
+ }
+
+ private void checkNotInitialized() {
+ if (initialized) {
+ throw new DependencyException("Dependency injection implementation has already been initialized");
+ }
+ }
+
@SuppressWarnings("unchecked")
private void createProviderBinding() {
- BinderImpl<Provider<T>> providerBinder = new BinderImpl(Provider.class);
+ BinderImpl<Provider<T>> providerBinder = new BinderImpl(target.toProvider());
if (null != provider) {
providerBinder.toInstance(provider);
- } else if(null != providerOfProvider){
+ } else if (null != providerOfProvider) {
providerBinder.toProviderInstance(providerOfProvider);
}
- providerBinder.initialized=true;
+ providerBinder.initialized = true;
this.providerBinder = providerBinder;
}
- public Binder<T> toService() {
- Collection<Class<? extends T>> service = loadService();
- if(service.size()>0){
- this.to(service.iterator().next());
- } else {
- throw new DependencyException("No implementation found for service "+target.getName());
- }
- return this;
- }
-
private Collection<Class<? extends T>> loadService() {
- if(null == target){
+ if (null == target) {
throw new DependencyException("Binder does not configured correctly");
}
try {
- return ServiceLoader.loadServiceClasses(target);
+ return ServiceLoader.<T> loadServiceClasses((Class<T>) target.getRawType());
} catch (ServiceException e) {
- throw new DependencyException("Error loading service ",e);
+ throw new DependencyException("Error loading service ", e);
}
}
-
- public Binder<T> toService(Class<? extends T> defaultImplementation) {
- Collection<Class<? extends T>> service = loadService();
- if(service.size()>0){
- this.to(service.iterator().next());
- } else {
- this.to(defaultImplementation);
- }
- return this;
- }
-
- public void destroy(InjectorImpl injectorImpl) {
- if (null != value && value instanceof Initializable) {
- ((Initializable) value).destroy();
- }
- if (null != provider && provider instanceof Initializable) {
- ((Initializable) provider).destroy();
- }
- if (null != providerOfProvider && providerOfProvider instanceof Initializable) {
- ((Initializable) providerOfProvider).destroy();
- }
- value = null;
- provider = null;
- providerOfProvider = null;
- providerBinder = null;
- this.initialized = false;
- }
}
Deleted: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/BindingModule.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/BindingModule.java 2010-06-16 12:38:15 UTC (rev 17631)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/BindingModule.java 2010-06-17 00:23:45 UTC (rev 17632)
@@ -1,12 +0,0 @@
-package org.richfaces.jsr330;
-
-/**
- * <p class="changed_added_4_0">User-provided configuration module.</p>
- * @author asmirnov(a)exadel.com
- *
- */
-public interface BindingModule {
-
- public void configure(InjectorConfig injector);
-
-}
Modified: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/InjectorImpl.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/InjectorImpl.java 2010-06-16 12:38:15 UTC (rev 17631)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/InjectorImpl.java 2010-06-17 00:23:45 UTC (rev 17632)
@@ -32,9 +32,9 @@
return create(type, null);
}
- public void init(BindingModule... modules) {
+ public void init(Module... modules) {
register(DependencyInjector.class).toInstance(this);
- for (BindingModule bindingModule : modules) {
+ for (Module bindingModule : modules) {
bindingModule.configure(this);
}
initProviders();
@@ -74,7 +74,7 @@
return bindings.get(type);
} else if (type.isConcrete()) {
// Concrete classes can be created without configuration.
- BinderImpl binding = new BinderImpl(type.getRawType());
+ BinderImpl binding = new BinderImpl(type);
binding.to(type.getRawType());
binding.init(this);
binding.createInstances(this);
@@ -108,7 +108,7 @@
*/
@SuppressWarnings("unchecked")
public <T> Binder<T> register(Target type) {
- BinderImpl<T> binding = new BinderImpl(type.getRawType());
+ BinderImpl<T> binding = new BinderImpl(type);
registerBinding(type, binding);
return binding;
}
Copied: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Module.java (from rev 17631, root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/BindingModule.java)
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Module.java (rev 0)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Module.java 2010-06-17 00:23:45 UTC (rev 17632)
@@ -0,0 +1,12 @@
+package org.richfaces.jsr330;
+
+/**
+ * <p class="changed_added_4_0">User-provided configuration module.</p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public interface Module {
+
+ public void configure(InjectorConfig injector);
+
+}
Added: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Scope.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Scope.java (rev 0)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Scope.java 2010-06-17 00:23:45 UTC (rev 17632)
@@ -0,0 +1,35 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.jsr330;
+
+import javax.inject.Provider;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+interface Scope<T> extends Provider<T> {
+
+}
Property changes on: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Scope.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/InjectorTest.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/InjectorTest.java 2010-06-16 12:38:15 UTC (rev 17631)
+++ root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/InjectorTest.java 2010-06-17 00:23:45 UTC (rev 17632)
@@ -10,7 +10,7 @@
@Test
public void injectByConstructor() throws Exception {
InjectorImpl injector = new InjectorImpl();
- injector.init(new BindingModule(){
+ injector.init(new Module(){
public void configure(InjectorConfig injector) {
injector.register(Interface.class).to(ConstructorInjection.class);
@@ -27,7 +27,7 @@
@Test
public void injectByField() throws Exception {
InjectorImpl injector = new InjectorImpl();
- injector.init(new BindingModule(){
+ injector.init(new Module(){
public void configure(InjectorConfig injector) {
injector.register(Interface.class).to(FieldInjection.class);
@@ -44,7 +44,7 @@
@Test
public void injectByMethod() throws Exception {
InjectorImpl injector = new InjectorImpl();
- injector.init(new BindingModule(){
+ injector.init(new Module(){
public void configure(InjectorConfig injector) {
injector.register(Interface.class).to(MethodInjection.class);
@@ -61,7 +61,7 @@
@Test
public void injectByProvider() throws Exception {
InjectorImpl injector = new InjectorImpl();
- injector.init(new BindingModule(){
+ injector.init(new Module(){
public void configure(InjectorConfig injector) {
injector.register(Interface.class).to(ProviderInjection.class);
@@ -78,7 +78,7 @@
@Test
public void injectProvider() throws Exception {
InjectorImpl injector = new InjectorImpl();
- injector.init(new BindingModule(){
+ injector.init(new Module(){
public void configure(InjectorConfig injector) {
injector.register(Interface.class).to(ProviderInjection.class);
@@ -98,7 +98,7 @@
@Test
public void inject() throws Exception {
InjectorImpl injector = new InjectorImpl();
- injector.init(new BindingModule(){
+ injector.init(new Module(){
public void configure(InjectorConfig injector) {
injector.register("foo", String.class).toProviderInstance(new FooProvider());
14 years, 6 months
JBoss Rich Faces SVN: r17631 - root/ui-sandbox/panels/trunk/docs.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-06-16 08:38:15 -0400 (Wed, 16 Jun 2010)
New Revision: 17631
Added:
root/ui-sandbox/panels/trunk/docs/panels-taglib 1.2.png
Removed:
root/ui-sandbox/panels/trunk/docs/panels-taglib 1.1.png
Modified:
root/ui-sandbox/panels/trunk/docs/richfaces 4.0.eap
Log:
RFPL-602 Update component module archetypes
taglib definitions for panels
Deleted: root/ui-sandbox/panels/trunk/docs/panels-taglib 1.1.png
===================================================================
(Binary files differ)
Copied: root/ui-sandbox/panels/trunk/docs/panels-taglib 1.2.png (from rev 17626, root/ui-sandbox/panels/trunk/docs/panels-taglib 1.1.png)
===================================================================
(Binary files differ)
Modified: root/ui-sandbox/panels/trunk/docs/richfaces 4.0.eap
===================================================================
(Binary files differ)
14 years, 6 months
JBoss Rich Faces SVN: r17630 - root/build/bom/trunk.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-06-15 19:36:25 -0400 (Tue, 15 Jun 2010)
New Revision: 17630
Modified:
root/build/bom/trunk/pom.xml
Log:
add jsr-330 to dependencies
Modified: root/build/bom/trunk/pom.xml
===================================================================
--- root/build/bom/trunk/pom.xml 2010-06-15 23:30:51 UTC (rev 17629)
+++ root/build/bom/trunk/pom.xml 2010-06-15 23:36:25 UTC (rev 17630)
@@ -1,108 +1,117 @@
- <!--
- 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>
+ <!--
+ 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>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-bom</artifactId>
+ <packaging>pom</packaging>
+ <version>4.0.0-SNAPSHOT</version>
+ <name>RichFaces BOM</name>
- <parent>
- <groupId>org.richfaces</groupId>
- <artifactId>richfaces-parent</artifactId>
- <version>7</version>
- </parent>
+ <parent>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-parent</artifactId>
+ <version>7</version>
+ </parent>
- <description>
- The RichFaces "Bill of Materials". This defines all runtime dependency versions for RichFaces.
+ <description>
+ The RichFaces "Bill of Materials". This defines all runtime dependency
+ versions for RichFaces.
</description>
- <url>http://www.jboss.org/richfaces</url>
+ <url>http://www.jboss.org/richfaces</url>
- <properties>
- </properties>
+ <properties>
+ </properties>
- <!-- Runtime dependency management -->
- <dependencyManagement>
- <dependencies>
- <!-- JSF 2 -->
- <!--
- This is set by default above, but can be overwritten by profiles
- in richfaces-parent
- -->
- <dependency>
- <groupId>${jsf2.api.groupid}</groupId>
- <artifactId>${jsf2.api.artifactid}</artifactId>
- <version>${jsf2.api.version}</version>
- </dependency>
+ <!-- Runtime dependency management -->
+ <dependencyManagement>
+ <dependencies>
+ <!-- JSF 2 -->
+ <!--
+ This is set by default above, but can be overwritten by profiles in
+ richfaces-parent
+ -->
+ <dependency>
+ <groupId>${jsf2.api.groupid}</groupId>
+ <artifactId>${jsf2.api.artifactid}</artifactId>
+ <version>${jsf2.api.version}</version>
+ </dependency>
- <!-- Misc -->
- <dependency>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- <version>1.0</version>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- </dependency>
- <dependency>
- <groupId>javax.servlet.jsp</groupId>
- <artifactId>jsp-api</artifactId>
- <version>2.1</version>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>jstl</artifactId>
- <version>1.2</version>
- </dependency>
+ <!-- Misc -->
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ <version>1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <version>1</version>
+ </dependency>
- <!-- Logging -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.5.8</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.5.8</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
+ <!-- Logging -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.5.8</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.5.8</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
- <build>
- <plugins>
- <!-- For the release this bom pom -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-release-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
+ <build>
+ <plugins>
+ <!-- For the release this bom pom -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
- <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>
+ <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>
14 years, 6 months
JBoss Rich Faces SVN: r17629 - in root/core/branches/jsr-330: bom and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-06-15 19:30:51 -0400 (Tue, 15 Jun 2010)
New Revision: 17629
Modified:
root/core/branches/jsr-330/bom/pom.xml
root/core/branches/jsr-330/pom.xml
Log:
add jsr-330 to dependencies
Modified: root/core/branches/jsr-330/bom/pom.xml
===================================================================
--- root/core/branches/jsr-330/bom/pom.xml 2010-06-15 23:29:59 UTC (rev 17628)
+++ root/core/branches/jsr-330/bom/pom.xml 2010-06-15 23:30:51 UTC (rev 17629)
@@ -62,6 +62,11 @@
<artifactId>richfaces-core-impl</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>jsr330-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<!-- Required for EL-CSS func -->
<dependency>
Modified: root/core/branches/jsr-330/pom.xml
===================================================================
--- root/core/branches/jsr-330/pom.xml 2010-06-15 23:29:59 UTC (rev 17628)
+++ root/core/branches/jsr-330/pom.xml 2010-06-15 23:30:51 UTC (rev 17629)
@@ -39,6 +39,7 @@
<module>bom</module>
<module>parent</module>
<module>api</module>
+ <module>jsr330-impl</module>
<module>impl</module>
</modules>
14 years, 6 months
JBoss Rich Faces SVN: r17628 - in root/core/branches/jsr-330: api/src/test/java/org/richfaces/application and 10 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-06-15 19:29:59 -0400 (Tue, 15 Jun 2010)
New Revision: 17628
Added:
root/core/branches/jsr-330/api/src/main/java/org/richfaces/application/DependencyInjector.java
root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/context/InitParametersStorage.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/CacheProvider.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/DefaultModule.java
root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/ConstructorInjection.java
root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/FieldInjection.java
root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/Interface.java
root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/MethodInjection.java
root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/ProviderInjection.java
root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/ServiceImpl.java
Removed:
root/core/branches/jsr-330/api/src/main/java/org/richfaces/application/DependencyInjectionService.java
root/core/branches/jsr-330/api/src/main/java/org/richfaces/application/ServiceReference.java
root/core/branches/jsr-330/api/src/test/java/org/richfaces/application/ServiceTrackerTest.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/DependencyInjectionServiceImpl.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/ServiceTrackerLockPhaseListener.java
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/DependencyInjector.java
root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestConstructorInjection.java
root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestFieldInjection.java
root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestInterface.java
root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestMethodInjection.java
root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestProviderInjection.java
root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestServiceImpl.java
Modified:
root/core/branches/jsr-330/api/src/main/java/org/richfaces/application/ServiceTracker.java
root/core/branches/jsr-330/impl/pom.xml
root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/InitializationListener.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
root/core/branches/jsr-330/impl/src/main/resources/META-INF/initialization-listener.faces-config.xml
root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/AbstractBaseResourceTest.java
root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/ResourceHandlerImplTest.java
root/core/branches/jsr-330/jsr330-impl/pom.xml
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/BinderImpl.java
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/DynamicProvider.java
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Initializable.java
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/InjectorImpl.java
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/ObjectFactory.java
root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/InjectorTest.java
root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/ServiceLoaderTest.java
root/core/branches/jsr-330/jsr330-impl/src/test/resources/META-INF/services/java.util.List
Log:
change serviceTraccker to JSR-330
Deleted: root/core/branches/jsr-330/api/src/main/java/org/richfaces/application/DependencyInjectionService.java
===================================================================
--- root/core/branches/jsr-330/api/src/main/java/org/richfaces/application/DependencyInjectionService.java 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/api/src/main/java/org/richfaces/application/DependencyInjectionService.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -1,35 +0,0 @@
-/*
- * 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.context.FacesContext;
-
-
-/**
- * @author Nick Belaevski
- *
- */
-public interface DependencyInjectionService {
-
- public void inject(FacesContext context, Object bean);
-
-}
Copied: root/core/branches/jsr-330/api/src/main/java/org/richfaces/application/DependencyInjector.java (from rev 17627, root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/DependencyInjector.java)
===================================================================
--- root/core/branches/jsr-330/api/src/main/java/org/richfaces/application/DependencyInjector.java (rev 0)
+++ root/core/branches/jsr-330/api/src/main/java/org/richfaces/application/DependencyInjector.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -0,0 +1,41 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.application;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public interface DependencyInjector {
+
+ public <T> T create(Class<T> type);
+
+ public <T> T create(Class<T> type,String name);
+
+ public void inject(Object value);
+
+ public void destroy();
+
+}
Deleted: root/core/branches/jsr-330/api/src/main/java/org/richfaces/application/ServiceReference.java
===================================================================
--- root/core/branches/jsr-330/api/src/main/java/org/richfaces/application/ServiceReference.java 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/api/src/main/java/org/richfaces/application/ServiceReference.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -1,50 +0,0 @@
-/*
- * 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/core/branches/jsr-330/api/src/main/java/org/richfaces/application/ServiceTracker.java
===================================================================
--- root/core/branches/jsr-330/api/src/main/java/org/richfaces/application/ServiceTracker.java 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/api/src/main/java/org/richfaces/application/ServiceTracker.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -21,262 +21,113 @@
*/
package org.richfaces.application;
-import java.util.Collection;
-import java.util.Collections;
import java.util.Date;
-import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
+import javax.faces.FacesException;
import javax.faces.context.FacesContext;
/**
* <p>Tracker class to provide access to various framework implementation services.
* 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>Supports JSR-330 dependency injection.</p>
*
- * <p>This class represents application-scoped object that is replicated into attributes
- * of {@link FacesContext} during runtime for better performance.</p>
+ * <p>This class represents application-scoped object that is stored in the map with {@link Thread#currentThread()} Context classloader. Therefore, there is
+ * only one instance perr JEE application in the current JVM.</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>
+ * </p>
*
* @author Nick Belaevski
* @since 4.0
*/
public final class ServiceTracker {
-
- private static final String SERVICE_TRACKER_ATTRIBUTE = ServiceTracker.class.getName();
-
- private volatile Map<Class<?>, Object> servicesMap = new HashMap<Class<?>, Object>();
- private final Date startTime = new Date();
-
- private final ConcurrentMap<Object, Object> concurrentStorage = new ConcurrentHashMap<Object, Object>();
-
- private ServiceTracker() {
- //utility class private constructor
- }
-
- private <T> T get(Class<T> serviceClass) {
- Object serviceImplementation = null;
- Object serviceObject = servicesMap.get(serviceClass);
-
- if (serviceObject instanceof ServiceReference<?>) {
- serviceImplementation = ((ServiceReference<?>) serviceObject).getService();
- } else {
- serviceImplementation = serviceObject;
+ private static final class Service {
+ final DependencyInjector injector;
+ final Date startTime = new Date();
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param injector
+ */
+ public Service(DependencyInjector injector) {
+ this.injector = injector;
}
-
- //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!");
- }
}
- 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>
+ * <p class="changed_added_4_0">
+ * </p>
*/
- public static Collection<Class<?>> getRegisteredServiceClasses(FacesContext context) {
- if (context == null) {
- throw new NullPointerException("context");
- }
+ private static final Map<ClassLoader, Service> INSTANCES =
+ new ConcurrentHashMap<ClassLoader, Service>();
- ServiceTracker serviceTracker = getServiceTracker(context);
- return serviceTracker.getRegisteredServiceClasses();
+ private ServiceTracker() {
}
- /**
- * 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");
- }
+ public static <T> T getService(Class<T> target,String name) {
+ return getInjector().create(target,name);
+ }
- if (serviceClass == null) {
- throw new NullPointerException("serviceClass");
- }
+ public static <T> T getService(Class<T> target) {
+ return getInjector().create(target);
+ }
- ServiceTracker serviceTracker = getServiceTracker(context);
- return serviceTracker.get(serviceClass);
+ public static <T> T getService(FacesContext context, Class<T> target) {
+ return getInjector().create(target);
}
/**
- * 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.
+ * <p class="changed_added_4_0">Inject dependencies to the object instance.</p>
+ * @param value
*/
- public static <T> void setService(FacesContext context,
- Class<T> serviceClass,
- T serviceImplementation) {
+ public static void inject(Object value){
+ getInjector().inject(value);
+ }
+
+ private static DependencyInjector getInjector() {
+ Service service = getCurrentService();
- if (context == null) {
- throw new NullPointerException("context");
- }
+ return service.injector;
+ }
- if (serviceClass == null) {
- throw new NullPointerException("serviceClass");
+ private static Service getCurrentService() {
+ if(!INSTANCES.containsKey(getCurrentLoader())){
+ throw new FacesException("Service Traccker has not been initialized");
}
-
- if (serviceImplementation == null) {
- throw new NullPointerException("serviceImplementation");
- }
-
- ServiceTracker serviceTracker = getServiceTracker(context);
- serviceTracker.put(serviceClass, serviceImplementation);
+ Service service = INSTANCES.get(getCurrentLoader());
+ return service;
}
- /**
- * 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");
+ private static ClassLoader getCurrentLoader() {
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ if (null == contextClassLoader) {
+ contextClassLoader = ServiceTracker.class.getClassLoader();
}
-
- if (serviceClass == null) {
- throw new NullPointerException("serviceClass");
- }
-
- if (serviceReference == null) {
- throw new NullPointerException("serviceReference");
- }
-
- ServiceTracker serviceTracker = getServiceTracker(context);
- serviceTracker.put(serviceClass, serviceReference);
+ return contextClassLoader;
}
/**
- * <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}
+ * <p class="changed_added_4_0">Set dependency injection service implementation.</p>
+ * @param injector
*/
- public static void release(FacesContext context) {
- removeServiceTracker(context);
+ public static void setInjector(DependencyInjector injector) {
+ INSTANCES.put(getCurrentLoader(), new Service(injector));
}
-
- /**
- * <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();
- }
/**
- * Returns {@link ServiceTracker} instantiation time. Corresponds to application initialization time.
- *
- * @param context
- * @return instantiation time
+ * <p class="changed_added_4_0">Remove dependency injection service associated with current context.</p>
*/
- public static Date getStartTime(FacesContext context) {
- return getServiceTracker(context).startTime;
+ public static void release() {
+ INSTANCES.remove(getCurrentLoader());
}
-
- /**
- * Returns {@link ConcurrentMap} stored in {@link ServiceTracker}. This map is intended
- * to be used as fast application-scoped storage.
- *
- * @param context
- * @return
- */
- public static ConcurrentMap<Object, Object> getConcurrentStorage(FacesContext context) {
- return getServiceTracker(context).concurrentStorage;
- }
-
- 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);
- if (serviceTracker == null) {
- serviceTracker = getServiceTrackerFromApplicationMap(facesContext);
-
- //replicate in FacesContext map for better performance
- facesContext.getAttributes().put(SERVICE_TRACKER_ATTRIBUTE, serviceTracker);
- }
-
- return serviceTracker;
+ public static Date getStartTime(FacesContext context) {
+ return getCurrentService().startTime;
}
- private static void removeServiceTracker(FacesContext facesContext) {
- Map<String, Object> applicationMap = facesContext.getExternalContext().getApplicationMap();
- applicationMap.remove(SERVICE_TRACKER_ATTRIBUTE);
-
- facesContext.getAttributes().remove(SERVICE_TRACKER_ATTRIBUTE);
- }
}
Deleted: root/core/branches/jsr-330/api/src/test/java/org/richfaces/application/ServiceTrackerTest.java
===================================================================
--- root/core/branches/jsr-330/api/src/test/java/org/richfaces/application/ServiceTrackerTest.java 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/api/src/test/java/org/richfaces/application/ServiceTrackerTest.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -1,173 +0,0 @@
-/*
- * 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/core/branches/jsr-330/impl/pom.xml
===================================================================
--- root/core/branches/jsr-330/impl/pom.xml 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/impl/pom.xml 2010-06-15 23:29:59 UTC (rev 17628)
@@ -1,157 +1,160 @@
- <!--
- 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/xsd/maven-4.0.0.xsd">
+ <!--
+ 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/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.richfaces.core</groupId>
- <artifactId>richfaces-core-parent</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- <relativePath>../parent/pom.xml</relativePath>
- </parent>
+ <parent>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <relativePath>../parent/pom.xml</relativePath>
+ </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces.core</groupId>
- <artifactId>richfaces-core-impl</artifactId>
- <name>RichFaces Core Implementation</name>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-impl</artifactId>
+ <name>RichFaces Core Implementation</name>
- <description>
+ <description>
The RichFaces Core Implementation.
</description>
- <dependencies>
- <!-- Runtime Dependencies -->
- <dependency>
- <groupId>org.richfaces.core</groupId>
- <artifactId>richfaces-core-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.richfaces.commons</groupId>
- <artifactId>richfaces-commons-api</artifactId>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.cssparser</groupId>
- <artifactId>cssparser</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
+ <dependencies>
+ <!-- Runtime Dependencies -->
+ <dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.commons</groupId>
+ <artifactId>richfaces-commons-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>jsr330-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.cssparser</groupId>
+ <artifactId>cssparser</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
- <!-- Provided Dependencies -->
- <dependency>
- <groupId>${jsf2.api.groupid}</groupId>
- <artifactId>${jsf2.api.artifactid}</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet.jsp</groupId>
- <artifactId>jsp-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>jstl</artifactId>
- <scope>provided</scope>
- </dependency>
+ <!-- Provided Dependencies -->
+ <dependency>
+ <groupId>${jsf2.api.groupid}</groupId>
+ <artifactId>${jsf2.api.artifactid}</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ <scope>provided</scope>
+ </dependency>
- <!-- Cache Impls -->
- <dependency>
- <groupId>org.jboss.cache</groupId>
- <artifactId>jbosscache-core</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>net.sf.ehcache</groupId>
- <artifactId>ehcache</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>opensymphony</groupId>
- <artifactId>oscache</artifactId>
- <optional>true</optional>
- </dependency>
+ <!-- Cache Impls -->
+ <dependency>
+ <groupId>org.jboss.cache</groupId>
+ <artifactId>jbosscache-core</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.ehcache</groupId>
+ <artifactId>ehcache</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>opensymphony</groupId>
+ <artifactId>oscache</artifactId>
+ <optional>true</optional>
+ </dependency>
- <!-- Test Dependencies -->
- <dependency>
- <groupId>org.jboss.test-jsf</groupId>
- <artifactId>htmlunit-client</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.test-jsf</groupId>
- <artifactId>jsf-mock</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymockclassextension</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>${jsf2.impl.groupid}</groupId>
- <artifactId>${jsf2.impl.artifactid}</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <!-- Test Dependencies -->
+ <dependency>
+ <groupId>org.jboss.test-jsf</groupId>
+ <artifactId>htmlunit-client</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.test-jsf</groupId>
+ <artifactId>jsf-mock</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>${jsf2.impl.groupid}</groupId>
+ <artifactId>${jsf2.impl.artifactid}</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
- <build>
+ <build>
- <plugins>
- <!--
- TODO Centralize this because calendar and context menu
- use this too
- Note: This may be removed by redisgn
- -->
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>javacc-maven-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>javacc</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
+ <plugins>
+ <!--
+ TODO Centralize this because calendar and context menu use this too
+ Note: This may be removed by redisgn
+ -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
+ <artifactId>javacc-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>javacc</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<executions>
<execution>
@@ -180,81 +183,80 @@
</archive>
</configuration>
</plugin>
- </plugins>
- </build>
+ </plugins>
+ </build>
- <profiles>
- <profile>
- <id>release</id>
- <!-- TODO need to centralize - need to research first -->
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <javadocVersion>1.5</javadocVersion>
- <aggregate>true</aggregate>
- </configuration>
- <executions>
- <execution>
- <id>generate-javadoc</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <!--
- TODO - this can go to central, but should
- check settings. This is also related to docs
- so perhaps add to a doc profile Configure
- JavaScript Doc Tool
- -->
- <groupId>gr.abiss.mvn.plugins</groupId>
- <artifactId>maven-jstools-plugin</artifactId>
- <executions>
- <execution>
- <id>jsdoc</id>
- <configuration>
- <jsDir>${basedir}/src/main/resources/META-INF/resources</jsDir>
- <includes>**/*.js</includes>
- <caseSensitive>true</caseSensitive>
- </configuration>
- <goals>
- <goal>jsdoc</goal>
- </goals>
- <phase>process-sources</phase>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <!-- pack jsdoc to jar -->
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <id>pack-jsodcs</id>
- <phase>package</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- <configuration>
- <classesDirectory>${basedir}/target/site/jsdoc</classesDirectory>
- <classifier>jsdoc</classifier>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/root/core/trunk/impl</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/root/core/trunk/impl</developerConnection>
- <url>http://fisheye.jboss.org/browse/richfaces/root/core/trunk/impl</url>
- </scm>
+ <profiles>
+ <profile>
+ <id>release</id>
+ <!-- TODO need to centralize - need to research first -->
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <javadocVersion>1.5</javadocVersion>
+ <aggregate>true</aggregate>
+ </configuration>
+ <executions>
+ <execution>
+ <id>generate-javadoc</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <!--
+ TODO - this can go to central, but should check settings. This is
+ also related to docs so perhaps add to a doc profile Configure
+ JavaScript Doc Tool
+ -->
+ <groupId>gr.abiss.mvn.plugins</groupId>
+ <artifactId>maven-jstools-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>jsdoc</id>
+ <configuration>
+ <jsDir>${basedir}/src/main/resources/META-INF/resources</jsDir>
+ <includes>**/*.js</includes>
+ <caseSensitive>true</caseSensitive>
+ </configuration>
+ <goals>
+ <goal>jsdoc</goal>
+ </goals>
+ <phase>process-sources</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <!-- pack jsdoc to jar -->
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>pack-jsodcs</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <classesDirectory>${basedir}/target/site/jsdoc</classesDirectory>
+ <classifier>jsdoc</classifier>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/root/core/trunk/impl</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/root/core/trunk/impl</developerConnection>
+ <url>http://fisheye.jboss.org/browse/richfaces/root/core/trunk/impl</url>
+ </scm>
</project>
\ No newline at end of file
Modified: root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -190,13 +190,13 @@
return ("true".equalsIgnoreCase(stringValue) || "yes".equalsIgnoreCase(stringValue));
}
- private static ConcurrentMap<Object, Object> getExpressionsMap(FacesContext context) {
- ConcurrentMap<Object, Object> concurrentStorage = ServiceTracker.getConcurrentStorage(context);
+ private static InitParametersStorage getExpressionsMap(FacesContext context) {
+ InitParametersStorage concurrentStorage = ServiceTracker.getService(InitParametersStorage.class);
return concurrentStorage;
}
private static String evaluateInitParameter(FacesContext context, String parameterName) {
- ConcurrentMap<Object, Object> expressionsMap = getExpressionsMap(context);
+ InitParametersStorage expressionsMap = getExpressionsMap(context);
String parameterKey = INIT_PARAM_PREFIX + parameterName;
Object parameterValue = expressionsMap.get(parameterKey);
Added: root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/context/InitParametersStorage.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/context/InitParametersStorage.java (rev 0)
+++ root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/context/InitParametersStorage.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -0,0 +1,52 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.context;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import javax.inject.Singleton;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+@Singleton
+public class InitParametersStorage {
+
+ ConcurrentMap<String,Object> storage = new ConcurrentHashMap<String, Object>(5);
+
+ public Object get(String key){
+ return storage.get(key);
+ }
+
+ public Object put(String key,Object value) {
+ return storage.put(key, value);
+ }
+
+ public boolean containsKey(String key) {
+ return storage.containsKey(key);
+ }
+}
Property changes on: root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/context/InitParametersStorage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/CacheProvider.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/CacheProvider.java (rev 0)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/CacheProvider.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -0,0 +1,70 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.application;
+
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+import javax.inject.Provider;
+
+import org.ajax4jsf.cache.Cache;
+import org.ajax4jsf.cache.CacheManager;
+import org.richfaces.jsr330.Binders;
+import org.richfaces.jsr330.Initializable;
+import org.richfaces.resource.ResourceHandlerImpl;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+
+public class CacheProvider implements Provider<Cache>, Initializable {
+
+ private Cache instance;
+ private CacheManager cacheManager;
+
+ /* (non-Javadoc)
+ * @see org.richfaces.jsr330.Initializable#destroy()
+ */
+ public void destroy() {
+ cacheManager.destroy();
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.jsr330.Initializable#init(org.richfaces.jsr330.Binders)
+ */
+ public boolean init(Binders injectorImpl) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ cacheManager = new CacheManager();
+ Map<?, ?> envMap = facesContext.getExternalContext().getInitParameterMap();
+ instance = cacheManager.createCache(facesContext, ResourceHandlerImpl.RESOURCE_CACHE_NAME, envMap);
+ return true; // Cache is singleton.
+ }
+
+ public Cache get() {
+ return instance;
+ }
+
+}
Property changes on: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/CacheProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/DefaultModule.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/DefaultModule.java (rev 0)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/DefaultModule.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -0,0 +1,21 @@
+package org.richfaces.application;
+
+import org.ajax4jsf.cache.Cache;
+import org.ajax4jsf.renderkit.AJAXDataSerializer;
+import org.richfaces.jsr330.BindingModule;
+import org.richfaces.jsr330.InjectorConfig;
+import org.richfaces.resource.DefaultResourceCodec;
+import org.richfaces.resource.ResourceCodec;
+import org.richfaces.skin.SkinFactory;
+import org.richfaces.skin.SkinFactoryImpl;
+
+public class DefaultModule implements BindingModule {
+
+ public void configure(InjectorConfig injector) {
+ injector.register(SkinFactory.class).to(SkinFactoryImpl.class);
+ injector.register(AJAXDataSerializer.class).to(AJAXDataSerializer.class);
+ injector.register(ResourceCodec.class).toService(DefaultResourceCodec.class);
+ injector.register(Cache.class).toProviderInstance(new CacheProvider());
+ }
+
+}
Property changes on: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/DefaultModule.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/DependencyInjectionServiceImpl.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/DependencyInjectionServiceImpl.java 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/DependencyInjectionServiceImpl.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -1,373 +0,0 @@
-/*
- * 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 java.beans.BeanInfo;
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.text.MessageFormat;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-import javax.el.ExpressionFactory;
-import javax.el.ValueExpression;
-import javax.faces.FacesException;
-import javax.faces.context.FacesContext;
-
-import org.richfaces.log.RichfacesLogger;
-import org.richfaces.resource.PostConstructResource;
-import org.richfaces.resource.ResourceParameter;
-import org.richfaces.resource.ResourceParameterELResolver;
-import org.slf4j.Logger;
-
-/**
- * @author Nick Belaevski
- *
- */
-public class DependencyInjectionServiceImpl implements DependencyInjectionService {
-
- private static final Logger LOGGER = RichfacesLogger.APPLICATION.getLogger();
-
- private abstract static class Injector<T extends Annotation> {
-
- private PropertyDescriptor propertyDescriptor;
-
- private T dependency;
-
- public Injector(PropertyDescriptor propertyDescriptor, T dependency) {
- super();
- this.propertyDescriptor = propertyDescriptor;
- this.dependency = dependency;
- }
-
- protected T getDependency() {
- return dependency;
- }
-
- protected PropertyDescriptor getPropertyDescriptor() {
- return propertyDescriptor;
- }
-
- protected abstract Object evaluateProperty(FacesContext context, Class<?> propertyType);
-
- public void inject(FacesContext context, Object bean) throws IllegalArgumentException, IllegalAccessException,
- InvocationTargetException {
-
- Method writeMethod = propertyDescriptor.getWriteMethod();
-
- if (writeMethod != null) {
- writeMethod.invoke(bean, evaluateProperty(context, propertyDescriptor.getPropertyType()));
- } else {
- throw new IllegalStateException(
- MessageFormat.format("Write method for property {0} doesn't exist", propertyDescriptor.getName()));
- }
- }
-
- }
-
- private static final class PropertyDependencyInjector extends Injector<ResourceParameter> {
-
- public PropertyDependencyInjector(PropertyDescriptor propertyDescriptor, ResourceParameter dependency) {
- super(propertyDescriptor, dependency);
- }
-
- private Object getExpressionValue(FacesContext context, String expressionString, Class<?> expectedType) {
- ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory();
- ValueExpression expression = expressionFactory.createValueExpression(context.getELContext(),
- expressionString, expectedType);
- return expression.getValue(context.getELContext());
- }
-
- protected Object evaluateProperty(FacesContext context, Class<?> propertyType) {
- Class<?> expectedType;
- if (!propertyType.isPrimitive()) {
- expectedType = Object.class;
- } else {
- expectedType = propertyType;
- }
-
- ResourceParameter resourceParameter = getDependency();
-
- String expression = resourceParameter.expression();
- String name = resourceParameter.name();
-
- if (expression.length() != 0 && name.length() != 0) {
- throw new IllegalStateException(MessageFormat.format(
- "'name' and 'expression' should not be specified simultaneously: {0}",
- resourceParameter));
- }
-
- Object propertyValue = null;
- if (expression.length() != 0) {
- propertyValue = getExpressionValue(context, expression, expectedType);
- } else {
- if (name.length() == 0) {
- name = getPropertyDescriptor().getName();
- }
-
- Map<String, Object> parameters = (Map<String, Object>) context.getAttributes().get(
- ResourceParameterELResolver.CONTEXT_ATTRIBUTE_NAME);
-
- propertyValue = parameters.get(name);
- }
-
- if (propertyValue == null || "".equals(propertyValue)) {
- String defaultValue = resourceParameter.defaultValue();
- if (defaultValue != null && defaultValue.length() != 0) {
- propertyValue = getExpressionValue(context, defaultValue, expectedType);
- }
- }
-
- if (!propertyType.isPrimitive() && propertyValue != null) {
- propertyValue = context.getApplication().getExpressionFactory().coerceToType(propertyValue, propertyType);
- }
-
- return propertyValue;
- }
- }
-
- private static final class IntrospectionData {
-
- private Method postConstructMethod = null;
-
- private Map<String, Injector<?>> injectorsMap = null;
-
- public Map<String, Injector<?>> getInjectorsMap() {
- if (injectorsMap != null) {
- return injectorsMap;
- }
-
- return Collections.emptyMap();
- }
-
- public void addInjector(String propertyName, Injector<?> injector) {
- if (injectorsMap == null) {
- injectorsMap = new HashMap<String, Injector<?>>();
- }
-
- injectorsMap.put(propertyName, injector);
- }
-
- public Method getPostConstructMethod() {
- return postConstructMethod;
- }
-
- public void setPostConstructMethod(Method postConstructMethod) {
- this.postConstructMethod = postConstructMethod;
- }
- }
-
- private ConcurrentMap<Class<?>, IntrospectionData> classesCache = new ConcurrentHashMap<Class<?>, IntrospectionData>();
-
- private void invokeMethod(Object bean, Method method) throws IllegalArgumentException, IllegalAccessException,
- InvocationTargetException {
-
- if (method != null) {
- method.setAccessible(true);
- method.invoke(bean);
- }
- }
-
- private boolean isUncheckedException(Class<?> type) {
- // JLS 2nd edition - 11.2 Compile-Time Checking of Exceptions
- return RuntimeException.class.isAssignableFrom(type) || Error.class.isAssignableFrom(type);
- }
-
- private void verifyPostConstructMethod(Method method) {
- if (method.getParameterTypes().length != 0) {
- throw new IllegalStateException(
- MessageFormat.format("Post-construction method {0} has one or more parameters", method.toString()));
- }
-
- if (!Void.TYPE.equals(method.getReturnType())) {
- throw new IllegalStateException(
- MessageFormat.format("Post-construction method {0} has incorrect return type", method.toString()));
- }
-
- if ((method.getModifiers() & Modifier.STATIC) != 0) {
- throw new IllegalStateException(
- MessageFormat.format("Post-construction method {0} is static", method.toString()));
- }
-
- Class<?>[] exceptionTypes = method.getExceptionTypes();
- for (Class<?> exceptionType : exceptionTypes) {
- if (isUncheckedException(exceptionType)) {
- continue;
- }
-
- throw new IllegalStateException(
- MessageFormat.format("Post-construction method {0} throws checked exception", method.toString()));
- }
- }
-
- private void inspectMethod(Method method, Class<? extends Annotation> annotationClass,
- IntrospectionData introspectionData) {
-
- Annotation annotation = method.getAnnotation(annotationClass);
- if (annotation != null) {
- verifyPostConstructMethod(method);
-
- if (introspectionData.getPostConstructMethod() != null) {
- throw new IllegalStateException(
- MessageFormat.format("There are two conflicting post-construction methods: {0} and {1}",
- method.toString(), introspectionData.getPostConstructMethod().toString()));
- }
-
- introspectionData.setPostConstructMethod(method);
- }
- }
-
- private void locatePostConstructMethods(Class<?> clazz, IntrospectionData introspectionData) {
- Method[] methods = clazz.getDeclaredMethods();
- for (Method method : methods) {
- inspectMethod(method, PostConstructResource.class, introspectionData);
- }
-
- Class<?> superclass = clazz.getSuperclass();
- if (!Object.class.equals(superclass)) {
- locatePostConstructMethods(superclass, introspectionData);
- }
- }
-
- private void locateManagedPropertyFields(Class<?> clazz, Map<String, ResourceParameter> fieldsMap) {
- Field[] fields = clazz.getDeclaredFields();
- for (Field field : fields) {
- ResourceParameter dependency = field.getAnnotation(ResourceParameter.class);
-
- if (dependency != null) {
- String propertyName = field.getName();
-
- if (!fieldsMap.containsKey(propertyName)) {
- fieldsMap.put(propertyName, dependency);
- }
- }
- }
-
- Class<?> superclass = clazz.getSuperclass();
- if (!Object.class.equals(superclass)) {
- locateManagedPropertyFields(superclass, fieldsMap);
- }
- }
-
- private <T extends Annotation> T getAnnotation(PropertyDescriptor descriptor, Class<T> annotationClass) {
- T annotation = null;
-
- Method writeMethod = descriptor.getWriteMethod();
- if (writeMethod != null) {
- annotation = writeMethod.getAnnotation(annotationClass);
- }
-
- if (annotation == null) {
- Method readMethod = descriptor.getReadMethod();
- if (readMethod != null) {
- annotation = readMethod.getAnnotation(annotationClass);
- }
- }
-
- return annotation;
- }
-
- private void locateManagedPropertyDescriptors(Class<?> clazz, IntrospectionData introspectionData,
- Map<String, ResourceParameter> injectableFields) {
-
- try {
- BeanInfo beanInfo = Introspector.getBeanInfo(clazz);
- if (beanInfo != null) {
- PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
- if (descriptors != null) {
- for (PropertyDescriptor descriptor : descriptors) {
- String propertyName = descriptor.getName();
-
- ResourceParameter dependency = injectableFields.get(propertyName);
-
- if (dependency == null) {
- dependency = getAnnotation(descriptor, ResourceParameter.class);
- }
-
- if (dependency != null) {
- Injector<?> injector = new PropertyDependencyInjector(descriptor, dependency);
- introspectionData.addInjector(propertyName, injector);
- }
- }
- }
- }
- } catch (IntrospectionException e) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug(e.getMessage(), e);
- }
- } finally {
- Introspector.flushFromCaches(clazz);
- }
- }
-
- protected IntrospectionData createIntrospectionData(Class<?> beanClass) {
- IntrospectionData introspectionData = new IntrospectionData();
-
- Map<String, ResourceParameter> injectableFields = new HashMap<String, ResourceParameter>();
- locateManagedPropertyFields(beanClass, injectableFields);
-
- locateManagedPropertyDescriptors(beanClass, introspectionData, injectableFields);
-
- locatePostConstructMethods(beanClass, introspectionData);
-
- return introspectionData;
- }
-
- public void inject(FacesContext context, Object bean) {
- Class<?> beanClass = bean.getClass();
-
- IntrospectionData introspectionData = classesCache.get(beanClass);
- if (introspectionData == null) {
- introspectionData = createIntrospectionData(beanClass);
- classesCache.put(beanClass, introspectionData);
- }
-
- try {
- Map<String, Injector<?>> injectorsMap = introspectionData.getInjectorsMap();
- if (!injectorsMap.isEmpty()) {
- for (Injector<?> injector : injectorsMap.values()) {
- injector.inject(context, bean);
- }
- }
-
- Method postConstructMethod = introspectionData.getPostConstructMethod();
- if (postConstructMethod != null) {
- invokeMethod(bean, postConstructMethod);
- }
- } catch (IllegalArgumentException e) {
- throw new FacesException(e.getMessage(), e);
- } catch (IllegalAccessException e) {
- throw new FacesException(e.getMessage(), e);
- } catch (InvocationTargetException e) {
- throw new FacesException(e.getMessage(), e);
- }
- }
-}
Modified: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/InitializationListener.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/InitializationListener.java 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/InitializationListener.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -21,34 +21,21 @@
*/
package org.richfaces.application;
-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 java.util.Map;
+import java.util.ArrayList;
import javax.faces.FacesException;
-import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.PostConstructApplicationEvent;
import javax.faces.event.PreDestroyApplicationEvent;
import javax.faces.event.SystemEvent;
import javax.faces.event.SystemEventListener;
-import org.ajax4jsf.cache.Cache;
-import org.ajax4jsf.cache.CacheManager;
-import org.ajax4jsf.renderkit.AJAXDataSerializer;
-import org.ajax4jsf.resource.util.URLToStreamHelper;
-import org.richfaces.log.RichfacesLogger;
-import org.richfaces.resource.DefaultResourceCodec;
-import org.richfaces.resource.ResourceCodec;
-import org.richfaces.resource.ResourceHandlerImpl;
-import org.richfaces.skin.SkinFactory;
-import org.richfaces.skin.SkinFactoryImpl;
-import org.slf4j.Logger;
+import org.richfaces.jsr330.BindingModule;
+import org.richfaces.jsr330.DependencyException;
+import org.richfaces.jsr330.InjectorImpl;
+import org.richfaces.jsr330.ServiceException;
+import org.richfaces.jsr330.ServiceLoader;
/**
* @author Nick Belaevski
@@ -56,11 +43,6 @@
*/
public class InitializationListener implements SystemEventListener {
- private static final String META_INF_SERVICES = "META-INF/services/";
-
- private static final Logger LOG = RichfacesLogger.APPLICATION.getLogger();
-
- private static final String CACHE_MANAGER_ATTRIBUTE_NAME = InitializationListener.class.getName() + ":CacheManager";
/* (non-Javadoc)
* @see javax.faces.event.SystemEventListener#isListenerForSource(java.lang.Object)
@@ -69,135 +51,28 @@
return true;
}
- private static <T> T instantiate(Class<T> interfaceClass,
- Class<? extends T> implementationClass,
- Class<? extends T> defaultImplementationClass) {
+ protected void onStart() {
+ DependencyInjector injector = createInjector();
+ ServiceTracker.setInjector(injector);
+ }
- Constructor<? extends T> constructor = null;
- Object[] constructorArguments = null;
-
- if (implementationClass != null) {
- if (defaultImplementationClass != null && !defaultImplementationClass.equals(implementationClass)) {
- try {
- constructor = implementationClass.getConstructor(interfaceClass);
- T defaultImplementation = instantiate(interfaceClass, defaultImplementationClass, null);
- constructorArguments = new Object[]{defaultImplementation};
- } catch (NoSuchMethodException e) {
- /* ignore */
- }
- }
-
- if (constructor == null) {
- try {
- constructor = implementationClass.getConstructor();
- } catch (NoSuchMethodException e) {
- throw new FacesException(MessageFormat.format("Class {0} has no public no-arg constructor",
- implementationClass.getName()), e);
- }
- }
-
- } else {
- try {
- constructor = defaultImplementationClass.getConstructor();
- } catch (NoSuchMethodException e) {
- throw new FacesException(MessageFormat.format("Class {0} has no public no-arg constructor",
- defaultImplementationClass.getName()), e);
- }
- }
-
+ protected DependencyInjector createInjector() {
+ InjectorImpl injector = new InjectorImpl();
+ ArrayList<BindingModule> modules = new ArrayList<BindingModule>();
+ modules.add(new DefaultModule());
try {
- return constructor.newInstance(constructorArguments);
- } catch (IllegalArgumentException e) {
- throw new FacesException(MessageFormat.format("Cannot instantiate {0} class, error was: {1}",
- constructor.getDeclaringClass(), e.getMessage()), e);
- } catch (InstantiationException e) {
- throw new FacesException(MessageFormat.format("Cannot instantiate {0} class, error was: {1}",
- constructor.getDeclaringClass(), e.getMessage()), e);
- } catch (IllegalAccessException e) {
- throw new FacesException(MessageFormat.format("Cannot instantiate {0} class, error was: {1}",
- constructor.getDeclaringClass(), e.getMessage()), e);
- } catch (InvocationTargetException e) {
- Throwable cause = e.getCause();
- if (cause == null) {
- cause = e;
- }
- throw new FacesException(MessageFormat.format("Cannot instantiate {0} class, error was: {1}",
- constructor.getDeclaringClass(), cause.getMessage()), cause);
+ modules.addAll(ServiceLoader.loadServices(BindingModule.class));
+ injector.init(modules.toArray(new BindingModule[]{}));
+ } catch (ServiceException e) {
+ throw new FacesException(e);
+ } catch (DependencyException e) {
+ throw new FacesException(e);
}
+ return injector;
}
- private static <T> T createServiceInstance(Class<T> interfaceClass, Class<? extends T> defaultImplementationClass) {
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- InputStream input = URLToStreamHelper.urlToStreamSafe(
- loader.getResource(META_INF_SERVICES + interfaceClass.getName()));
-
- Class<? extends T> implementationClass = null;
-
- // have services file.
- if (input != null) {
- try {
- BufferedReader reader = new BufferedReader(new InputStreamReader(input));
- String factoryClassName = reader.readLine();
-
- implementationClass = Class.forName(factoryClassName, false, loader).asSubclass(interfaceClass);
- } catch (Exception e) {
- LOG.warn(MessageFormat.format("Error loading class for {0} service: {1} ",
- interfaceClass.getName(), e.getMessage()), e);
- } finally {
- try {
- input.close();
- } catch (IOException e) {
- // can be ignored
- }
- }
- }
-
- return instantiate(interfaceClass, implementationClass, defaultImplementationClass);
- }
-
- private CacheManager createAndStoreCacheManager(FacesContext context) {
- CacheManager cacheManager = new CacheManager();
- Map<String, Object> applicationMap = context.getExternalContext().getApplicationMap();
- applicationMap.put(CACHE_MANAGER_ATTRIBUTE_NAME, cacheManager);
-
- return cacheManager;
- }
-
- private CacheManager getStoredCacheManager(FacesContext context) {
- Map<String, Object> applicationMap = context.getExternalContext().getApplicationMap();
- return (CacheManager) applicationMap.get(CACHE_MANAGER_ATTRIBUTE_NAME);
- }
-
- protected void onStart() {
- FacesContext facesContext = FacesContext.getCurrentInstance();
-
- SkinFactory skinFactory = createServiceInstance(SkinFactory.class, SkinFactoryImpl.class);
- ServiceTracker.setService(facesContext, SkinFactory.class, skinFactory);
-
- AJAXDataSerializer dataSerializer = createServiceInstance(AJAXDataSerializer.class, AJAXDataSerializer.class);
- ServiceTracker.setService(facesContext, AJAXDataSerializer.class, dataSerializer);
-
- DependencyInjectionService diService = createServiceInstance(DependencyInjectionService.class,
- DependencyInjectionServiceImpl.class);
- ServiceTracker.setService(facesContext, DependencyInjectionService.class, diService);
-
- ResourceCodec resourceCodec = createServiceInstance(ResourceCodec.class, DefaultResourceCodec.class);
- ServiceTracker.setService(facesContext, ResourceCodec.class, resourceCodec);
-
- CacheManager cacheManager = createAndStoreCacheManager(facesContext);
-
- Map<?, ?> envMap = facesContext.getExternalContext().getInitParameterMap();
- Cache cache = cacheManager.createCache(facesContext, ResourceHandlerImpl.RESOURCE_CACHE_NAME, envMap);
- ServiceTracker.setService(facesContext, Cache.class, cache);
- }
-
protected void onStop() {
- FacesContext facesContext = FacesContext.getCurrentInstance();
-
- CacheManager cacheManager = getStoredCacheManager(facesContext);
- cacheManager.destroy();
-
- ServiceTracker.release(facesContext);
+ ServiceTracker.release();
}
/* (non-Javadoc)
Deleted: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/ServiceTrackerLockPhaseListener.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/ServiceTrackerLockPhaseListener.java 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/ServiceTrackerLockPhaseListener.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -1,52 +0,0 @@
-/*
- * 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;
-
-/**
- * As service tracker is filled by application startup listeners,
- * we can't rely on some "locking" system listener that's the last in chain,
- * so PhaseListener does the job.
- *
- * @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/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -42,7 +42,6 @@
import javax.servlet.http.HttpServletResponse;
import org.ajax4jsf.cache.Cache;
-import org.richfaces.application.DependencyInjectionService;
import org.richfaces.application.ServiceTracker;
import org.richfaces.log.RichfacesLogger;
import org.richfaces.util.Util;
@@ -358,12 +357,11 @@
protected void injectProperties(Object resource, Map<String, String> parameters) {
FacesContext facesContext = FacesContext.getCurrentInstance();
- DependencyInjectionService diService = ServiceTracker.getService(facesContext, DependencyInjectionService.class);
Map<Object, Object> attributes = facesContext.getAttributes();
try {
attributes.put(ResourceParameterELResolver.CONTEXT_ATTRIBUTE_NAME, parameters);
- diService.inject(facesContext, resource);
+ ServiceTracker.inject(resource);
} finally {
attributes.remove(ResourceParameterELResolver.CONTEXT_ATTRIBUTE_NAME);
}
Modified: root/core/branches/jsr-330/impl/src/main/resources/META-INF/initialization-listener.faces-config.xml
===================================================================
--- root/core/branches/jsr-330/impl/src/main/resources/META-INF/initialization-listener.faces-config.xml 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/impl/src/main/resources/META-INF/initialization-listener.faces-config.xml 2010-06-15 23:29:59 UTC (rev 17628)
@@ -12,8 +12,5 @@
</system-event-listener>
</application>
- <lifecycle>
- <phase-listener>org.richfaces.application.ServiceTrackerLockPhaseListener</phase-listener>
- </lifecycle>
</faces-config>
\ No newline at end of file
Modified: root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/AbstractBaseResourceTest.java
===================================================================
--- root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/AbstractBaseResourceTest.java 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/AbstractBaseResourceTest.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -41,6 +41,9 @@
import org.easymock.EasyMock;
import org.jboss.test.faces.AbstractFacesTest;
import org.richfaces.application.ServiceTracker;
+import org.richfaces.jsr330.BindingModule;
+import org.richfaces.jsr330.InjectorConfig;
+import org.richfaces.jsr330.InjectorImpl;
import org.richfaces.util.Util;
/**
@@ -127,7 +130,7 @@
public void testGetRequestPath() throws Exception {
String resourceState = "data";
- ResourceCodec resourceCodec = EasyMock.createMock(ResourceCodec.class);
+ final ResourceCodec resourceCodec = EasyMock.createMock(ResourceCodec.class);
EasyMock.expect(resourceCodec.encodeResource(EasyMock.same(facesContext),
EasyMock.eq("org.richfaces.resource.MockStateAwareResource"),
@@ -139,8 +142,16 @@
EasyMock.eq("org.richfaces.resource.MockResource"),
EasyMock.eq(null), EasyMock.eq("4_0_alpha"))).andReturn("/rfRes/Resource2/4_0_alpha");
EasyMock.replay(resourceCodec);
- ServiceTracker.setService(facesContext, ResourceCodec.class, resourceCodec);
+ InjectorImpl injector = new InjectorImpl();
+ injector.init(new BindingModule(){
+ public void configure(InjectorConfig injector) {
+ injector.register(ResourceCodec.class).toInstance(resourceCodec);
+ }
+
+ });
+ ServiceTracker.setInjector(injector);
+
MockStateAwareResourceImpl stateAwareResourceImpl = new MockStateAwareResourceImpl();
stateAwareResourceImpl.setVersion("4_0_alpha");
Modified: root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/ResourceHandlerImplTest.java
===================================================================
--- root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/ResourceHandlerImplTest.java 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/ResourceHandlerImplTest.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -41,6 +41,9 @@
import org.jboss.test.faces.AbstractFacesTest;
import org.jboss.test.faces.htmlunit.LocalWebClient;
import org.richfaces.application.ServiceTracker;
+import org.richfaces.jsr330.BindingModule;
+import org.richfaces.jsr330.InjectorConfig;
+import org.richfaces.jsr330.InjectorImpl;
import org.richfaces.util.Util;
import com.gargoylesoftware.htmlunit.Cache;
@@ -219,7 +222,7 @@
public void testStateHolder() throws Exception {
setupFacesRequest();
- ResourceCodec mockedCodec = EasyMock.createNiceMock(ResourceCodec.class);
+ final ResourceCodec mockedCodec = EasyMock.createNiceMock(ResourceCodec.class);
EasyMock.expect(mockedCodec.decodeResourceName(EasyMock.<FacesContext>notNull(),
EasyMock.eq("StateHolderResource"))).andReturn("org.richfaces.resource.StateHolderResourceImpl");
@@ -230,8 +233,16 @@
EasyMock.expect(mockedCodec.getResourceKey(EasyMock.<FacesContext>notNull(),
EasyMock.eq("StateHolderResource"))).andReturn("StateHolderResource.jsf?db=1");
EasyMock.replay(mockedCodec);
- ServiceTracker.setService(facesContext, ResourceCodec.class, mockedCodec);
+ InjectorImpl injector = new InjectorImpl();
+ injector.init(new BindingModule(){
+ public void configure(InjectorConfig injector) {
+ injector.register(ResourceCodec.class).toInstance(mockedCodec);
+ }
+
+ });
+ ServiceTracker.setInjector(injector);
+
WebRequestSettings settings =
new WebRequestSettings(new URL("http://localhost/rfRes/StateHolderResource.jsf?db=1"));
WebResponse resourceResponse = webClient.loadWebResponse(settings);
Modified: root/core/branches/jsr-330/jsr330-impl/pom.xml
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/pom.xml 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/jsr330-impl/pom.xml 2010-06-15 23:29:59 UTC (rev 17628)
@@ -1,8 +1,14 @@
<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>
+ <parent>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <relativePath>../parent/pom.xml</relativePath>
+ </parent>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.core</groupId>
<artifactId>jsr330-impl</artifactId>
<version>4.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
@@ -34,10 +40,13 @@
<version>4.8.1</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-api</artifactId>
+ </dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
- <version>1</version>
</dependency>
</dependencies>
</project>
Modified: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/BinderImpl.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/BinderImpl.java 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/BinderImpl.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -71,7 +71,6 @@
}
public BinderImpl<Provider<T>> asProviderBinder() {
- checkInitialized();
if (null == providerBinder) {
createProviderBinding();
}
@@ -210,4 +209,21 @@
}
return this;
}
+
+ public void destroy(InjectorImpl injectorImpl) {
+ if (null != value && value instanceof Initializable) {
+ ((Initializable) value).destroy();
+ }
+ if (null != provider && provider instanceof Initializable) {
+ ((Initializable) provider).destroy();
+ }
+ if (null != providerOfProvider && providerOfProvider instanceof Initializable) {
+ ((Initializable) providerOfProvider).destroy();
+ }
+ value = null;
+ provider = null;
+ providerOfProvider = null;
+ providerBinder = null;
+ this.initialized = false;
+ }
}
Deleted: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/DependencyInjector.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/DependencyInjector.java 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/DependencyInjector.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -1,39 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.jsr330;
-
-/**
- * <p class="changed_added_4_0"></p>
- * @author asmirnov(a)exadel.com
- *
- */
-public interface DependencyInjector {
-
- public <T> T create(Class<T> type);
-
- public <T> T create(Class<T> type,String name);
-
- public void inject(Object value);
-
-}
Modified: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/DynamicProvider.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/DynamicProvider.java 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/DynamicProvider.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -66,13 +66,13 @@
@SuppressWarnings("unchecked")
void findConstructor(Binders injectorImpl) throws Exception {
- Constructor<T>[] constructors = this.type.getConstructors();
- for (Constructor<T> constructor : constructors) {
+ Constructor<?>[] constructors = this.type.getConstructors();
+ for (Constructor<?> constructor : constructors) {
if (constructor.isAnnotationPresent(Inject.class)) {
if (null != this.constructor) {
throw new DependencyException("More then one constructor have @Inject annotation " + this.type);
}
- this.constructor = constructor;
+ this.constructor = (Constructor<T>) constructor;
Type[] parameterTypes = constructor.getGenericParameterTypes();
Annotation[][] parameterAnnotations = constructor.getParameterAnnotations();
this.constructorArguments = getParameterBindings(injectorImpl, parameterTypes, parameterAnnotations);
@@ -154,5 +154,12 @@
throw new DependencyException(e);
}
}
+
+ public void destroy() {
+ constructor = null;
+ constructorArguments = null;
+ injectedFields = null;
+ injectedMethods = null;
+ }
}
Modified: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Initializable.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Initializable.java 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Initializable.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -8,5 +8,7 @@
public interface Initializable {
public boolean init(Binders injectorImpl);
+
+ public void destroy();
}
\ No newline at end of file
Modified: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/InjectorImpl.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/InjectorImpl.java 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/InjectorImpl.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -7,6 +7,8 @@
import javax.inject.Provider;
+import org.richfaces.application.DependencyInjector;
+
/**
* <p class="changed_added_4_0">
* Lightweight implementation for JSR-330 dependency injection. Supports only {@link javax.inject.Named} annotations, no
@@ -38,6 +40,13 @@
initProviders();
initSingletons();
}
+
+ public void destroy() {
+ for (BinderImpl<?> binding : bindings.values()) {
+ binding.destroy(this);
+ }
+ bindings.clear();
+ }
private void initSingletons() {
Collection<BinderImpl<?>> values = new ArrayList<BinderImpl<?>>(bindings.values());
Modified: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/ObjectFactory.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/ObjectFactory.java 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/ObjectFactory.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -3,6 +3,8 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.richfaces.application.DependencyInjector;
+
/**
* Implementation independent factory for JSR-330 beans.
*
Copied: root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/ConstructorInjection.java (from rev 17627, root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestConstructorInjection.java)
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/ConstructorInjection.java (rev 0)
+++ root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/ConstructorInjection.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -0,0 +1,47 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.jsr330;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class ConstructorInjection implements Interface {
+
+ final String param;
+
+ @Inject
+ public ConstructorInjection( @Named("foo") String param) {
+ this.param = param;
+ }
+
+ public String hello() {
+ return param;
+ }
+
+}
Copied: root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/FieldInjection.java (from rev 17627, root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestFieldInjection.java)
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/FieldInjection.java (rev 0)
+++ root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/FieldInjection.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -0,0 +1,47 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.jsr330;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class FieldInjection implements Interface {
+
+ @Inject
+ @Named("foo")
+ String param;
+
+ public FieldInjection( ) {
+ }
+
+ public String hello() {
+ return param;
+ }
+
+}
Modified: root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/InjectorTest.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/InjectorTest.java 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/InjectorTest.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -13,14 +13,14 @@
injector.init(new BindingModule(){
public void configure(InjectorConfig injector) {
- injector.register(TestInterface.class).to(TestConstructorInjection.class);
+ injector.register(Interface.class).to(ConstructorInjection.class);
injector.register("foo", String.class).toInstance("bar");
injector.register("bar", String.class).toInstance("baz");
}
});
- TestInterface testInterface = injector.create(TestInterface.class);
- assertTrue(testInterface instanceof TestConstructorInjection);
+ Interface testInterface = injector.create(Interface.class);
+ assertTrue(testInterface instanceof ConstructorInjection);
assertEquals("bar",testInterface.hello());
}
@@ -30,14 +30,14 @@
injector.init(new BindingModule(){
public void configure(InjectorConfig injector) {
- injector.register(TestInterface.class).to(TestFieldInjection.class);
+ injector.register(Interface.class).to(FieldInjection.class);
injector.register("foo", String.class).toInstance("bar");
injector.register("bar", String.class).toInstance("baz");
}
});
- TestInterface testInterface = injector.create(TestInterface.class);
- assertTrue(testInterface instanceof TestFieldInjection);
+ Interface testInterface = injector.create(Interface.class);
+ assertTrue(testInterface instanceof FieldInjection);
assertEquals("bar",testInterface.hello());
}
@@ -47,14 +47,14 @@
injector.init(new BindingModule(){
public void configure(InjectorConfig injector) {
- injector.register(TestInterface.class).to(TestMethodInjection.class);
+ injector.register(Interface.class).to(MethodInjection.class);
injector.register("foo", String.class).toInstance("bar");
injector.register("bar", String.class).toInstance("baz");
}
});
- TestInterface testInterface = injector.create(TestInterface.class);
- assertTrue(testInterface instanceof TestMethodInjection);
+ Interface testInterface = injector.create(Interface.class);
+ assertTrue(testInterface instanceof MethodInjection);
assertEquals("bar",testInterface.hello());
}
@@ -64,14 +64,14 @@
injector.init(new BindingModule(){
public void configure(InjectorConfig injector) {
- injector.register(TestInterface.class).to(TestProviderInjection.class);
+ injector.register(Interface.class).to(ProviderInjection.class);
injector.register("foo", String.class).toInstance("bar");
injector.register("bar", String.class).toInstance("baz");
}
});
- TestInterface testInterface = injector.create(TestInterface.class);
- assertTrue(testInterface instanceof TestProviderInjection);
+ Interface testInterface = injector.create(Interface.class);
+ assertTrue(testInterface instanceof ProviderInjection);
assertEquals("bar",testInterface.hello());
}
@@ -81,17 +81,35 @@
injector.init(new BindingModule(){
public void configure(InjectorConfig injector) {
- injector.register(TestInterface.class).to(TestProviderInjection.class);
+ injector.register(Interface.class).to(ProviderInjection.class);
injector.register("foo", String.class).toProviderInstance(new FooProvider());
injector.register("bar", String.class).toProvider(BarProvider.class);
}
});
- TestInterface testInterface = injector.create(TestInterface.class);
- assertTrue(testInterface instanceof TestProviderInjection);
+ Interface testInterface = injector.create(Interface.class);
+ assertTrue(testInterface instanceof ProviderInjection);
assertEquals("foo",testInterface.hello());
- TestProviderInjection instance = (TestProviderInjection) testInterface;
+ ProviderInjection instance = (ProviderInjection) testInterface;
assertEquals("bar",instance.bar);
assertEquals("foo",instance.foo);
}
+
+ @Test
+ public void inject() throws Exception {
+ InjectorImpl injector = new InjectorImpl();
+ injector.init(new BindingModule(){
+
+ public void configure(InjectorConfig injector) {
+ injector.register("foo", String.class).toProviderInstance(new FooProvider());
+ injector.register("bar", String.class).toProvider(BarProvider.class);
+ }
+
+ });
+ ProviderInjection instance = new ProviderInjection();
+ injector.inject(instance);
+ assertEquals("foo",instance.hello());
+ assertEquals("bar",instance.bar);
+ assertEquals("foo",instance.foo);
+ }
}
Copied: root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/Interface.java (from rev 17627, root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestInterface.java)
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/Interface.java (rev 0)
+++ root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/Interface.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -0,0 +1,35 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.jsr330;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public interface Interface {
+
+ public String hello();
+
+}
Copied: root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/MethodInjection.java (from rev 17627, root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestMethodInjection.java)
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/MethodInjection.java (rev 0)
+++ root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/MethodInjection.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -0,0 +1,51 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.jsr330;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class MethodInjection implements Interface {
+
+ String param;
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param param the param to set
+ */
+ @Inject
+ public void setParam( @Named("foo") String param) {
+ this.param = param;
+ }
+
+ public String hello() {
+ return param;
+ }
+
+}
Copied: root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/ProviderInjection.java (from rev 17627, root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestProviderInjection.java)
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/ProviderInjection.java (rev 0)
+++ root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/ProviderInjection.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -0,0 +1,61 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.jsr330;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Provider;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class ProviderInjection implements Interface {
+
+ String param;
+
+ @Inject
+ @Named("bar")
+ String bar;
+
+ String foo;
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param param the param to set
+ */
+ @Inject
+ public void setParam( @Named("foo") Provider<String> param) {
+ this.param = param.get();
+ }
+
+ public String hello() {
+ return param;
+ }
+
+ @Inject
+ public void setFoo(@Named("foo")String foo) {
+ this.foo = foo;
+ }
+}
Copied: root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/ServiceImpl.java (from rev 17627, root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestServiceImpl.java)
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/ServiceImpl.java (rev 0)
+++ root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/ServiceImpl.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -0,0 +1,125 @@
+package org.richfaces.jsr330;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+public class ServiceImpl implements List<String> {
+
+ public boolean add(String o) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void add(int index, String element) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public boolean addAll(Collection<? extends String> c) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean addAll(int index, Collection<? extends String> c) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void clear() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public boolean contains(Object o) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean containsAll(Collection<?> c) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public String get(int index) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int indexOf(Object o) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public boolean isEmpty() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public Iterator<String> iterator() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int lastIndexOf(Object o) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public ListIterator<String> listIterator() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ListIterator<String> listIterator(int index) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean remove(Object o) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public String remove(int index) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean removeAll(Collection<?> c) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean retainAll(Collection<?> c) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public String set(int index, String element) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int size() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public List<String> subList(int fromIndex, int toIndex) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Object[] toArray() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public <T> T[] toArray(T[] a) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Property changes on: root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/ServiceImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/ServiceLoaderTest.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/ServiceLoaderTest.java 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/ServiceLoaderTest.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -78,7 +78,7 @@
public void testLoadServiceClasses() throws Exception {
Collection<Class<? extends List>> serviceClasses = ServiceLoader.loadServiceClasses(List.class);
assertEquals(1, serviceClasses.size());
- assertEquals(TestServiceImpl.class, serviceClasses.iterator().next());
+ assertEquals(ServiceImpl.class, serviceClasses.iterator().next());
}
/**
@@ -92,7 +92,7 @@
URL url = this.getClass().getResource("/META-INF/services/java.util.List");
Collection<String> collection = ServiceLoader.parse(url);
assertEquals(1, collection.size());
- assertEquals(TestServiceImpl.class.getName(), collection.iterator().next());
+ assertEquals(ServiceImpl.class.getName(), collection.iterator().next());
}
/**
@@ -117,12 +117,12 @@
*/
@Test
public void testParseLine1() throws Exception {
- String line = TestServiceImpl.class.getName();
+ String line = ServiceImpl.class.getName();
ArrayList<String> names = new ArrayList<String>();
ServiceLoader.parseLine(line, names);
assertEquals(1, names.size());
- assertEquals(TestServiceImpl.class.getName(), names.get(0));
+ assertEquals(ServiceImpl.class.getName(), names.get(0));
}
/**
Deleted: root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestConstructorInjection.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestConstructorInjection.java 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestConstructorInjection.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -1,47 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.jsr330;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-/**
- * <p class="changed_added_4_0"></p>
- * @author asmirnov(a)exadel.com
- *
- */
-public class TestConstructorInjection implements TestInterface {
-
- final String param;
-
- @Inject
- public TestConstructorInjection( @Named("foo") String param) {
- this.param = param;
- }
-
- public String hello() {
- return param;
- }
-
-}
Deleted: root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestFieldInjection.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestFieldInjection.java 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestFieldInjection.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -1,47 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.jsr330;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-/**
- * <p class="changed_added_4_0"></p>
- * @author asmirnov(a)exadel.com
- *
- */
-public class TestFieldInjection implements TestInterface {
-
- @Inject
- @Named("foo")
- String param;
-
- public TestFieldInjection( ) {
- }
-
- public String hello() {
- return param;
- }
-
-}
Deleted: root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestInterface.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestInterface.java 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestInterface.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -1,35 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.jsr330;
-
-/**
- * <p class="changed_added_4_0"></p>
- * @author asmirnov(a)exadel.com
- *
- */
-public interface TestInterface {
-
- public String hello();
-
-}
Deleted: root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestMethodInjection.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestMethodInjection.java 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestMethodInjection.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -1,51 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.jsr330;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-/**
- * <p class="changed_added_4_0"></p>
- * @author asmirnov(a)exadel.com
- *
- */
-public class TestMethodInjection implements TestInterface {
-
- String param;
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param param the param to set
- */
- @Inject
- public void setParam( @Named("foo") String param) {
- this.param = param;
- }
-
- public String hello() {
- return param;
- }
-
-}
Deleted: root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestProviderInjection.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestProviderInjection.java 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestProviderInjection.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -1,61 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.jsr330;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Provider;
-
-/**
- * <p class="changed_added_4_0"></p>
- * @author asmirnov(a)exadel.com
- *
- */
-public class TestProviderInjection implements TestInterface {
-
- String param;
-
- @Inject
- @Named("bar")
- String bar;
-
- String foo;
- /**
- * <p class="changed_added_4_0"></p>
- * @param param the param to set
- */
- @Inject
- public void setParam( @Named("foo") Provider<String> param) {
- this.param = param.get();
- }
-
- public String hello() {
- return param;
- }
-
- @Inject
- public void setFoo(@Named("foo")String foo) {
- this.foo = foo;
- }
-}
Deleted: root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestServiceImpl.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestServiceImpl.java 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestServiceImpl.java 2010-06-15 23:29:59 UTC (rev 17628)
@@ -1,125 +0,0 @@
-package org.richfaces.jsr330;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
-public class TestServiceImpl implements List<String> {
-
- public boolean add(String o) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public void add(int index, String element) {
- // TODO Auto-generated method stub
-
- }
-
- public boolean addAll(Collection<? extends String> c) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public boolean addAll(int index, Collection<? extends String> c) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public void clear() {
- // TODO Auto-generated method stub
-
- }
-
- public boolean contains(Object o) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public boolean containsAll(Collection<?> c) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public String get(int index) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public int indexOf(Object o) {
- // TODO Auto-generated method stub
- return 0;
- }
-
- public boolean isEmpty() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public Iterator<String> iterator() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public int lastIndexOf(Object o) {
- // TODO Auto-generated method stub
- return 0;
- }
-
- public ListIterator<String> listIterator() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public ListIterator<String> listIterator(int index) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean remove(Object o) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public String remove(int index) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean removeAll(Collection<?> c) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public boolean retainAll(Collection<?> c) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public String set(int index, String element) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public int size() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- public List<String> subList(int fromIndex, int toIndex) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Object[] toArray() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public <T> T[] toArray(T[] a) {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
Modified: root/core/branches/jsr-330/jsr330-impl/src/test/resources/META-INF/services/java.util.List
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/test/resources/META-INF/services/java.util.List 2010-06-15 20:07:22 UTC (rev 17627)
+++ root/core/branches/jsr-330/jsr330-impl/src/test/resources/META-INF/services/java.util.List 2010-06-15 23:29:59 UTC (rev 17628)
@@ -1,3 +1,3 @@
# test implementation of List
-org.richfaces.jsr330.TestServiceImpl # comment
+org.richfaces.jsr330.ServiceImpl # comment
14 years, 6 months
JBoss Rich Faces SVN: r17627 - in root/core/branches/jsr-330/jsr330-impl/src: test and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-06-15 16:07:22 -0400 (Tue, 15 Jun 2010)
New Revision: 17627
Added:
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Binder.java
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/BinderImpl.java
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Binders.java
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/DynamicProvider.java
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Initializable.java
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/InjectorConfig.java
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/ServiceException.java
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/ServiceLoader.java
root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/ServiceLoaderTest.java
root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestServiceImpl.java
root/core/branches/jsr-330/jsr330-impl/src/test/resources/
root/core/branches/jsr-330/jsr330-impl/src/test/resources/META-INF/
root/core/branches/jsr-330/jsr330-impl/src/test/resources/META-INF/services/
root/core/branches/jsr-330/jsr330-impl/src/test/resources/META-INF/services/java.util.List
Removed:
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Binding.java
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/DynamicBinding.java
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/ProviderWrapper.java
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/StaticBinding.java
Modified:
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/BindingModule.java
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/DependencyException.java
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/DependencyInjector.java
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/InjectorImpl.java
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/ObjectFactory.java
root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Target.java
root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/InjectorTest.java
Log:
Finish implementation and services loader.
Added: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Binder.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Binder.java (rev 0)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Binder.java 2010-06-15 20:07:22 UTC (rev 17627)
@@ -0,0 +1,52 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.jsr330;
+
+import javax.inject.Provider;
+
+/**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public interface Binder<T> {
+
+
+ public Binder<T> to(Class<? extends T> implementation);
+
+ public Binder<T> toInstance(T value);
+
+ public Binder<T> toProvider(Class<? extends Provider<T>> provaderImplementation);
+
+ public Binder<T> toProviderInstance(Provider<T> provider);
+
+ public Binder<T> toService();
+
+ public Binder<T> toService(Class<? extends T> defaultImplementation);
+
+ public Binder<T> asSingleton();
+
+}
Property changes on: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Binder.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/BinderImpl.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/BinderImpl.java (rev 0)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/BinderImpl.java 2010-06-15 20:07:22 UTC (rev 17627)
@@ -0,0 +1,213 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.jsr330;
+
+import java.util.Collection;
+
+import javax.inject.Provider;
+
+/**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ * @param <T>
+ */
+public final class BinderImpl<T> implements Binder<T> {
+
+ private final Class<T> target;
+
+ private volatile T value;
+
+ private Provider<T> provider;
+
+ private Provider<Provider<T>> providerOfProvider;
+
+ private boolean singleton;
+
+ private volatile BinderImpl<Provider<T>> providerBinder;
+
+ private boolean initialized = false;
+
+ private boolean providerSingleton;
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param target the target to set
+ */
+ public BinderImpl(Class<T> target) {
+ this.target = target;
+ }
+
+ public T get() {
+ checkInitialized();
+ if (null != value) {
+ return value;
+ } else {
+ return getProvider().get();
+ }
+ }
+
+ public BinderImpl<Provider<T>> asProviderBinder() {
+ checkInitialized();
+ if (null == providerBinder) {
+ createProviderBinding();
+ }
+ return providerBinder;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.jsr330.Binder#to(java.lang.Class)
+ */
+ public Binder<T> to(Class<? extends T> implementation) {
+ this.provider = new DynamicProvider<T>(implementation);
+ return this;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.jsr330.Binder#toInstance(java.lang.Object)
+ */
+ public Binder<T> toInstance(T value) {
+ checkNotInitialized();
+ this.value = value;
+ this.provider = new Provider<T>() {
+
+ public T get() {
+ return BinderImpl.this.value;
+ }
+ };
+ return this;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.jsr330.Binder#toProvider(java.lang.Class)
+ */
+ @SuppressWarnings("unchecked")
+ public Binder<T> toProvider(Class<? extends Provider<T>> providerImplementation) {
+ checkNotInitialized();
+ this.providerOfProvider = new DynamicProvider(providerImplementation);
+ return this;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.jsr330.Binder#toProviderInstance(javax.inject.Provider)
+ */
+ public Binder<T> toProviderInstance(Provider<T> provider) {
+ this.provider = provider;
+ return this;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.jsr330.Binder#asSingleton()
+ */
+ public Binder<T> asSingleton() {
+ this.singleton = true;
+ return this;
+ }
+
+ private void checkInitialized() {
+ if(!initialized){
+ throw new DependencyException("Dependency injection implementation has not been initialized");
+ }
+ }
+
+ private void checkNotInitialized() {
+ if(initialized){
+ throw new DependencyException("Dependency injection implementation has already been initialized");
+ }
+ }
+
+ Provider<T> getProvider() {
+ return null == this.provider ? this.providerOfProvider.get() : this.provider;
+ }
+
+ void init(Binders injector) throws DependencyException {
+ checkNotInitialized();
+ if (null == value && null == provider && null == providerOfProvider) {
+ throw new DependencyException("binding not has not been set");
+ }
+ if (null != provider && provider instanceof Initializable) {
+ this.singleton |=((Initializable) provider).init(injector);
+ }
+ if (null != providerOfProvider && providerOfProvider instanceof Initializable) {
+ this.providerSingleton |=((Initializable) providerOfProvider).init(injector);
+ }
+ this.initialized = true;
+ }
+
+ void createInstances(Binders injector) throws DependencyException {
+ checkInitialized();
+ if(providerSingleton && null == provider){
+ this.provider = providerOfProvider.get();
+ }
+ if(singleton && null == value ){
+ this.value= getProvider().get();
+ }
+ createProviderBinding();
+ }
+
+ @SuppressWarnings("unchecked")
+ private void createProviderBinding() {
+ BinderImpl<Provider<T>> providerBinder = new BinderImpl(Provider.class);
+ if (null != provider) {
+ providerBinder.toInstance(provider);
+ } else if(null != providerOfProvider){
+ providerBinder.toProviderInstance(providerOfProvider);
+ }
+ providerBinder.initialized=true;
+ this.providerBinder = providerBinder;
+ }
+
+ public Binder<T> toService() {
+ Collection<Class<? extends T>> service = loadService();
+ if(service.size()>0){
+ this.to(service.iterator().next());
+ } else {
+ throw new DependencyException("No implementation found for service "+target.getName());
+ }
+ return this;
+ }
+
+ private Collection<Class<? extends T>> loadService() {
+ if(null == target){
+ throw new DependencyException("Binder does not configured correctly");
+ }
+ try {
+ return ServiceLoader.loadServiceClasses(target);
+ } catch (ServiceException e) {
+ throw new DependencyException("Error loading service ",e);
+ }
+ }
+
+ public Binder<T> toService(Class<? extends T> defaultImplementation) {
+ Collection<Class<? extends T>> service = loadService();
+ if(service.size()>0){
+ this.to(service.iterator().next());
+ } else {
+ this.to(defaultImplementation);
+ }
+ return this;
+ }
+}
Property changes on: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/BinderImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Binders.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Binders.java (rev 0)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Binders.java 2010-06-15 20:07:22 UTC (rev 17627)
@@ -0,0 +1,12 @@
+package org.richfaces.jsr330;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public interface Binders {
+
+ public BinderImpl<?> getBinding(Target type);
+
+}
\ No newline at end of file
Property changes on: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Binders.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Binding.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Binding.java 2010-06-15 15:50:35 UTC (rev 17626)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Binding.java 2010-06-15 20:07:22 UTC (rev 17627)
@@ -1,13 +0,0 @@
-package org.richfaces.jsr330;
-
-import javax.inject.Provider;
-
-public interface Binding extends Provider {
-
- public Object get();
-
- void init(InjectorImpl injectorImpl);
-
- public abstract Binding getProvider();
-
-}
Modified: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/BindingModule.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/BindingModule.java 2010-06-15 15:50:35 UTC (rev 17626)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/BindingModule.java 2010-06-15 20:07:22 UTC (rev 17627)
@@ -1,7 +1,12 @@
package org.richfaces.jsr330;
+/**
+ * <p class="changed_added_4_0">User-provided configuration module.</p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
public interface BindingModule {
- public void configure(InjectorImpl injector);
+ public void configure(InjectorConfig injector);
}
Modified: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/DependencyException.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/DependencyException.java 2010-06-15 15:50:35 UTC (rev 17626)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/DependencyException.java 2010-06-15 20:07:22 UTC (rev 17627)
@@ -24,17 +24,18 @@
package org.richfaces.jsr330;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">Dependency injection errors.</p>
* @author asmirnov(a)exadel.com
*
*/
+@SuppressWarnings("serial")
public class DependencyException extends RuntimeException {
/**
* <p class="changed_added_4_0"></p>
*/
public DependencyException() {
- // TODO Auto-generated constructor stub
+
}
/**
@@ -43,7 +44,6 @@
*/
public DependencyException(String message) {
super(message);
- // TODO Auto-generated constructor stub
}
/**
@@ -52,7 +52,6 @@
*/
public DependencyException(Throwable cause) {
super(cause);
- // TODO Auto-generated constructor stub
}
/**
@@ -62,7 +61,6 @@
*/
public DependencyException(String message, Throwable cause) {
super(message, cause);
- // TODO Auto-generated constructor stub
}
}
Modified: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/DependencyInjector.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/DependencyInjector.java 2010-06-15 15:50:35 UTC (rev 17626)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/DependencyInjector.java 2010-06-15 20:07:22 UTC (rev 17627)
@@ -34,4 +34,6 @@
public <T> T create(Class<T> type,String name);
+ public void inject(Object value);
+
}
Deleted: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/DynamicBinding.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/DynamicBinding.java 2010-06-15 15:50:35 UTC (rev 17626)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/DynamicBinding.java 2010-06-15 20:07:22 UTC (rev 17627)
@@ -1,190 +0,0 @@
-package org.richfaces.jsr330;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.inject.Inject;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-public class DynamicBinding implements Binding, Provider {
-
- private final Class<?> type;
-
- private Constructor<?> constructor;
-
- private List<Binding> constructorArguments;
-
- private Map<Field, Binding> injectedFields;
-
- private Map<Method, List<Binding>> injectedMethods;
-
- private boolean singleton;
-
- private volatile Object value;
-
- public DynamicBinding(Class<?> type) {
- this.type = type;
- }
-
- void findInjectorMethods(InjectorImpl injectorImpl) throws Exception {
- injectedMethods = new HashMap<Method, List<Binding>>();
- Method[] methods = this.type.getMethods();
- for (Method method : methods) {
- if (method.isAnnotationPresent(Inject.class)) {
- Type[] parameterTypes = method.getGenericParameterTypes();
- Annotation[][] parameterAnnotations = method.getParameterAnnotations();
- injectedMethods.put(method, getParameterBindings(injectorImpl, parameterTypes, parameterAnnotations));
- }
- }
- }
-
- void findInjectedFields(InjectorImpl injectorImpl) throws Exception {
- Field[] declaredFields = this.type.getDeclaredFields();
- this.injectedFields = new HashMap<Field, Binding>();
- for (Field field : declaredFields) {
- if (field.isAnnotationPresent(Inject.class)) {
- Type fieldType = field.getGenericType();
- if (fieldType instanceof Class) {
- Class<?> fieldClass = (Class<?>) fieldType;
- this.injectedFields.put(field, injectorImpl.getBinding(Target.create(fieldClass, field
- .getAnnotations())));
- }
- }
- }
- }
-
- void findConstructor(InjectorImpl injectorImpl) throws Exception {
- Constructor<?>[] constructors = this.type.getConstructors();
- for (Constructor<?> constructor : constructors) {
- if (constructor.isAnnotationPresent(Inject.class)) {
- if (null != this.constructor) {
- throw new DependencyException("More then one constructor have @Inject annotation " + this.type);
- }
- this.constructor = constructor;
- Type[] parameterTypes = constructor.getGenericParameterTypes();
- Annotation[][] parameterAnnotations = constructor.getParameterAnnotations();
- this.constructorArguments = getParameterBindings(injectorImpl, parameterTypes, parameterAnnotations);
- }
- }
- if (null == constructor) {
- constructor = (Constructor<?>) this.type.getConstructor();
- this.constructorArguments = Collections.emptyList();
- }
- }
-
- List<Binding> getParameterBindings(InjectorImpl injectorImpl, Type[] parameterTypes,
- Annotation[][] parameterAnnotations) {
- List<Binding> arguments = new ArrayList<Binding>(parameterTypes.length);
- int i = 0;
- for (Type parameterType : parameterTypes) {
- arguments.add(injectorImpl.getBinding(Target.create(parameterType, parameterAnnotations[i])));
- i++;
- }
- return arguments;
- }
-
- public Object get() {
- if (isSingleton()) {
- if (null == value) {
- synchronized (this) {
- value = createInstance();
- }
- }
- return value;
- } else {
- Object instance = createInstance();
- return instance;
- }
- }
-
- public Binding getProvider() {
- return new StaticBinding(this);
- }
-
- void invokeInjectionMethods(Object instance) throws Exception {
- for (Method method : injectedMethods.keySet()) {
- method.invoke(instance, getArgumentValues(injectedMethods.get(method)));
- }
-
- }
-
- void injectFields(Object instance) throws Exception {
- for (Field field : injectedFields.keySet()) {
- boolean accessible = field.isAccessible();
- if (!accessible) {
- field.setAccessible(true);
- }
- field.set(instance, injectedFields.get(field).get());
- if (!accessible) {
- field.setAccessible(accessible);
- }
- }
- }
-
- Object createInstance() {
- try {
- Object[] arguments = getArgumentValues(this.constructorArguments);
- Object instance = constructor.newInstance(arguments);
- injectFields(instance);
- invokeInjectionMethods(instance);
- return instance;
- } catch (Exception e) {
- throw new DependencyException(e);
- }
- }
-
- Object[] getArgumentValues(List<Binding> argumentBinding) {
- Object[] arguments = new Object[argumentBinding.size()];
- int i = 0;
- for (Binding provider : argumentBinding) {
- arguments[i++] = provider.get();
- }
- return arguments;
- }
-
- public void init(InjectorImpl injectorImpl) {
- try {
- findConstructor(injectorImpl);
- findInjectedFields(injectorImpl);
- findInjectorMethods(injectorImpl);
- if (type.isAnnotationPresent(Singleton.class)) {
- this.singleton = true;
- }
- } catch (Exception e) {
- throw new DependencyException(e);
- }
- // TODO Auto-generated method stub
-
- }
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @return the singleton
- */
- public boolean isSingleton() {
- return this.singleton;
- }
-
- /**
- * <p class="changed_added_4_0">
- * </p>
- *
- * @param singleton
- * the singleton to set
- */
- public void setSingleton(boolean singleton) {
- this.singleton = singleton;
- }
-
-}
Copied: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/DynamicProvider.java (from rev 17623, root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/DynamicBinding.java)
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/DynamicProvider.java (rev 0)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/DynamicProvider.java 2010-06-15 20:07:22 UTC (rev 17627)
@@ -0,0 +1,158 @@
+package org.richfaces.jsr330;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.inject.Inject;
+import javax.inject.Provider;
+import javax.inject.Singleton;
+
+/**
+ * <p class="changed_added_4_0">Dynamicaly </p>
+ * @author asmirnov(a)exadel.com
+ *
+ * @param <T>
+ */
+public class DynamicProvider<T> implements Provider<T>, Initializable {
+
+ private final Class<? extends T> type;
+
+ private Constructor<T> constructor;
+
+ private List<BinderImpl<?>> constructorArguments;
+
+ private Map<Field, BinderImpl<?>> injectedFields;
+
+ private Map<Method, List<BinderImpl<?>>> injectedMethods;
+
+ public DynamicProvider(Class<? extends T> type) {
+ this.type = type;
+ }
+
+ void findInjectorMethods(Binders injectorImpl) throws Exception {
+ injectedMethods = new HashMap<Method, List<BinderImpl<?>>>();
+ Method[] methods = this.type.getMethods();
+ for (Method method : methods) {
+ if (method.isAnnotationPresent(Inject.class)) {
+ Type[] parameterTypes = method.getGenericParameterTypes();
+ Annotation[][] parameterAnnotations = method.getParameterAnnotations();
+ injectedMethods.put(method, getParameterBindings(injectorImpl, parameterTypes, parameterAnnotations));
+ }
+ }
+ }
+
+ void findInjectedFields(Binders injectorImpl) throws Exception {
+ Field[] declaredFields = this.type.getDeclaredFields();
+ this.injectedFields = new HashMap<Field, BinderImpl<?>>();
+ for (Field field : declaredFields) {
+ if (field.isAnnotationPresent(Inject.class)) {
+ Type fieldType = field.getGenericType();
+ if (fieldType instanceof Class<?>) {
+ Class<?> fieldClass = (Class<?>) fieldType;
+ this.injectedFields.put(field, injectorImpl.getBinding(Target.createNamed(fieldClass, field
+ .getAnnotations())));
+ }
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ void findConstructor(Binders injectorImpl) throws Exception {
+ Constructor<T>[] constructors = this.type.getConstructors();
+ for (Constructor<T> constructor : constructors) {
+ if (constructor.isAnnotationPresent(Inject.class)) {
+ if (null != this.constructor) {
+ throw new DependencyException("More then one constructor have @Inject annotation " + this.type);
+ }
+ this.constructor = constructor;
+ Type[] parameterTypes = constructor.getGenericParameterTypes();
+ Annotation[][] parameterAnnotations = constructor.getParameterAnnotations();
+ this.constructorArguments = getParameterBindings(injectorImpl, parameterTypes, parameterAnnotations);
+ }
+ }
+ if (null == constructor) {
+ constructor = (Constructor<T>) this.type.getConstructor();
+ this.constructorArguments = Collections.emptyList();
+ }
+ }
+
+ List<BinderImpl<?>> getParameterBindings(Binders injectorImpl, Type[] parameterTypes,
+ Annotation[][] parameterAnnotations) {
+ List<BinderImpl<?>> arguments = new ArrayList<BinderImpl<?>>(parameterTypes.length);
+ int i = 0;
+ for (Type parameterType : parameterTypes) {
+ arguments.add(injectorImpl.getBinding(Target.createNamed(parameterType, parameterAnnotations[i])));
+ i++;
+ }
+ return arguments;
+ }
+
+
+ void invokeInjectionMethods(Object instance) throws Exception {
+ for (Method method : injectedMethods.keySet()) {
+ method.invoke(instance, getArgumentValues(injectedMethods.get(method)));
+ }
+
+ }
+
+ void injectFields(Object instance) throws Exception {
+ for (Field field : injectedFields.keySet()) {
+ boolean accessible = field.isAccessible();
+ if (!accessible) {
+ field.setAccessible(true);
+ }
+ field.set(instance, injectedFields.get(field).get());
+ if (!accessible) {
+ field.setAccessible(accessible);
+ }
+ }
+ }
+
+ public T get() {
+ try {
+ Object[] arguments = getArgumentValues(this.constructorArguments);
+ T instance = constructor.newInstance(arguments);
+ inject(instance);
+ return instance;
+ } catch (Exception e) {
+ throw new DependencyException(e);
+ }
+ }
+
+ void inject(T instance) throws Exception {
+ injectFields(instance);
+ invokeInjectionMethods(instance);
+ }
+
+ Object[] getArgumentValues(List<BinderImpl<?>> argumentBinding) {
+ Object[] arguments = new Object[argumentBinding.size()];
+ int i = 0;
+ for (BinderImpl<?> provider : argumentBinding) {
+ arguments[i++] = provider.get();
+ }
+ return arguments;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.jsr330.Initializable#init(org.richfaces.jsr330.Binders)
+ */
+ public boolean init(Binders injectorImpl) {
+ try {
+ findConstructor(injectorImpl);
+ findInjectedFields(injectorImpl);
+ findInjectorMethods(injectorImpl);
+ return type.isAnnotationPresent(Singleton.class);
+ } catch (Exception e) {
+ throw new DependencyException(e);
+ }
+ }
+
+}
Added: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Initializable.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Initializable.java (rev 0)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Initializable.java 2010-06-15 20:07:22 UTC (rev 17627)
@@ -0,0 +1,12 @@
+package org.richfaces.jsr330;
+
+/**
+ * <p class="changed_added_4_0">Classes that require initialization should implement this interface</p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public interface Initializable {
+
+ public boolean init(Binders injectorImpl);
+
+}
\ No newline at end of file
Property changes on: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Initializable.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/InjectorConfig.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/InjectorConfig.java (rev 0)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/InjectorConfig.java 2010-06-15 20:07:22 UTC (rev 17627)
@@ -0,0 +1,19 @@
+package org.richfaces.jsr330;
+
+/**
+ * <p class="changed_added_4_0">
+ * Implementation provides instance of this interface to let user register services and its implementations.
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public interface InjectorConfig {
+
+ public <T> Binder<T> register(Target type);
+
+ public <T> Binder<T> register(Class<T> type, Class<?>... typeArguments);
+
+ public <T> Binder<T> register(String name, Class<T> type, Class<?>... typeArguments);
+
+}
\ No newline at end of file
Property changes on: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/InjectorConfig.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/InjectorImpl.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/InjectorImpl.java 2010-06-15 15:50:35 UTC (rev 17626)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/InjectorImpl.java 2010-06-15 20:07:22 UTC (rev 17627)
@@ -7,93 +7,122 @@
import javax.inject.Provider;
-public class InjectorImpl implements DependencyInjector {
+/**
+ * <p class="changed_added_4_0">
+ * Lightweight implementation for JSR-330 dependency injection. Supports only {@link javax.inject.Named} annotations, no
+ * scopes except {@link javax.inject.Singleton}
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class InjectorImpl implements DependencyInjector, Binders, InjectorConfig {
+ private final Map<Target, BinderImpl<?>> bindings = new ConcurrentHashMap<Target, BinderImpl<?>>();
- private final Map<Target,Binding> bindings = new ConcurrentHashMap<Target, Binding>();
-
@SuppressWarnings("unchecked")
- public <T> T create(Class<T> type,String name) {
- Target target = Target.create(type,name);
+ public <T> T create(Class<T> type, String name) {
+ Target target = Target.create(name, type);
return (T) getBinding(target).get();
}
-
+
public <T> T create(Class<T> type) {
return create(type, null);
}
- public void init(BindingModule ... modules){
+ public void init(BindingModule... modules) {
+ register(DependencyInjector.class).toInstance(this);
for (BindingModule bindingModule : modules) {
bindingModule.configure(this);
}
initProviders();
+ initSingletons();
}
- public void initSingletons() {
- Collection<Binding> values = new ArrayList<Binding>(bindings.values());
- for (Binding binding : values) {
- if (binding instanceof DynamicBinding) {
- DynamicBinding dynamicBinding = (DynamicBinding) binding;
- if(dynamicBinding.isSingleton()){
- dynamicBinding.get();
- }
- }
+ private void initSingletons() {
+ Collection<BinderImpl<?>> values = new ArrayList<BinderImpl<?>>(bindings.values());
+ for (BinderImpl<?> binding : values) {
+ binding.createInstances(this);
}
}
-
+
private void initProviders() {
- Collection<Binding> values = new ArrayList<Binding>(bindings.values());
- for (Binding binding : values) {
+ Collection<BinderImpl<?>> values = new ArrayList<BinderImpl<?>>(bindings.values());
+ for (BinderImpl<?> binding : values) {
binding.init(this);
}
-
+
}
- public Binding getBinding(Target type) {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.jsr330.Binders#getBinding(org.richfaces.jsr330.Target)
+ */
+ @SuppressWarnings("unchecked")
+ public BinderImpl<?> getBinding(Target type) {
if (bindings.containsKey(type)) {
return bindings.get(type);
- } else if(type.isConcrete()){
+ } else if (type.isConcrete()) {
// Concrete classes can be created without configuration.
- Binding binding = registerImplementation(type, type.getRawType());
+ BinderImpl binding = new BinderImpl(type.getRawType());
+ binding.to(type.getRawType());
binding.init(this);
+ binding.createInstances(this);
+ registerBinding(type, binding);
return binding;
- } else if(type.isProvider()){
- return getBinding(type.toProviderTarget()).getProvider();
+ } else if (type.isProvider()) {
+ return getBinding(type.toProviderTarget()).asProviderBinder();
} else {
- throw new DependencyException("Type "+type+" has not been registered");
+ throw new DependencyException("Type " + type + " has not been registered");
}
}
- public Binding registerProviderInstance(Target type, Provider<?> provider){
- StaticBinding binding = new StaticBinding(provider);
- registerProviderBinding(type, binding);
- return binding;
+ @SuppressWarnings("unchecked")
+ public void inject(Object value) {
+ Target target = Target.create(value.getClass());
+ Provider<?> provider = getBinding(target).getProvider();
+ if (provider instanceof DynamicProvider) {
+ try {
+ ((DynamicProvider) provider).inject(value);
+ } catch (Exception e) {
+ throw new DependencyException("Cannot inject dependencies into object " + value, e);
+ }
+ }
+
}
- public Binding registerProviderImplementation(Target type, Class<? extends Provider<?>> provider){
- DynamicBinding binding = new DynamicBinding(provider);
- registerProviderBinding(type, binding);
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.jsr330.InjectorConfig#register(org.richfaces.jsr330.Target)
+ */
+ @SuppressWarnings("unchecked")
+ public <T> Binder<T> register(Target type) {
+ BinderImpl<T> binding = new BinderImpl(type.getRawType());
+ registerBinding(type, binding);
return binding;
}
- private void registerProviderBinding(Target type, Binding binding) {
- Binding wrapper = new ProviderWrapper(binding);
- bindings.put(type, wrapper);
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.jsr330.InjectorConfig#register(java.lang.Class, java.lang.Class)
+ */
+ public <T> Binder<T> register(Class<T> type, Class<?>... typeArguments) {
+ return register(Target.create(type, typeArguments));
}
- public Binding registerImplementation(Target type, Class<?> implementation){
- DynamicBinding provider = new DynamicBinding(implementation);
- registerImplementationBinding(type, provider);
- return provider;
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.jsr330.InjectorConfig#register(java.lang.String, java.lang.Class, java.lang.Class)
+ */
+ public <T> Binder<T> register(String name, Class<T> type, Class<?>... typeArguments) {
+ return register(Target.create(name, type, typeArguments));
}
- public Binding registerInstance(Target type, Object instance){
- StaticBinding provider = new StaticBinding(instance);
- registerImplementationBinding(type, provider);
- return provider;
+ private void registerBinding(Target type, BinderImpl<?> binder) {
+ bindings.put(type, binder);
}
-
- private void registerImplementationBinding(Target type, Binding provider) {
- bindings.put(type, provider);
- }
}
Modified: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/ObjectFactory.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/ObjectFactory.java 2010-06-15 15:50:35 UTC (rev 17626)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/ObjectFactory.java 2010-06-15 20:07:22 UTC (rev 17627)
@@ -26,6 +26,9 @@
return getInjector().create(target);
}
+ public static void inject(Object value){
+ getInjector().inject(value);
+ }
private static DependencyInjector getInjector() {
return INSTANCES.get(getCurrentLoader());
}
Deleted: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/ProviderWrapper.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/ProviderWrapper.java 2010-06-15 15:50:35 UTC (rev 17626)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/ProviderWrapper.java 2010-06-15 20:07:22 UTC (rev 17627)
@@ -1,62 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.jsr330;
-
-import javax.inject.Provider;
-
-/**
- * <p class="changed_added_4_0"></p>
- * @author asmirnov(a)exadel.com
- *
- */
-public class ProviderWrapper implements Binding {
-
- private final Binding binding;
-
- public ProviderWrapper(Binding binding) {
- this.binding = binding;
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.jsr330.Binding#get()
- */
- public Object get() {
- return ((Provider) getProvider().get()).get();
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.jsr330.Binding#getProvider()
- */
- public Binding getProvider() {
- return binding;
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.jsr330.Binding#init(org.richfaces.jsr330.InjectorImpl)
- */
- public void init(InjectorImpl injectorImpl) {
- this.binding.init(injectorImpl);
- }
-
-}
Added: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/ServiceException.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/ServiceException.java (rev 0)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/ServiceException.java 2010-06-15 20:07:22 UTC (rev 17627)
@@ -0,0 +1,65 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.jsr330;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+@SuppressWarnings("serial")
+public class ServiceException extends Exception {
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ */
+ public ServiceException() {
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param message
+ */
+ public ServiceException(String message) {
+ super(message);
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param cause
+ */
+ public ServiceException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param message
+ * @param cause
+ */
+ public ServiceException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
Property changes on: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/ServiceException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/ServiceLoader.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/ServiceLoader.java (rev 0)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/ServiceLoader.java 2010-06-15 20:07:22 UTC (rev 17627)
@@ -0,0 +1,195 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.jsr330;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.regex.Pattern;
+
+/**
+ * <p class="changed_added_4_0">
+ * This class loads services from files placed to the META-INF/services in classpath.
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public final class ServiceLoader {
+
+ private static final String META_INF_SERVICES = "META-INF/services/";
+ private static final Pattern LEGAL_JAVA_NAME = Pattern.compile("^(([A-Za-z0-9_])+\\.)+[A-Z]([A-Za-z0-9_]*)$");
+
+ private ServiceLoader() {
+
+ }
+
+ /**
+ * <p class="changed_added_4_0">
+ * Load and instantiate all service implementations.
+ * </p>
+ *
+ * @param <S>
+ * @param serviceClass
+ * @return
+ * @throws ServiceException
+ */
+ public static <S> Collection<S> loadServices(Class<S> serviceClass) throws ServiceException {
+ Collection<Class<? extends S>> serviceClasses = loadServiceClasses(serviceClass);
+ List<S> instances = new ArrayList<S>();
+ try {
+ for (Class<? extends S> implementationClass : serviceClasses) {
+ instances.add(implementationClass.newInstance());
+ }
+
+ } catch (InstantiationException e) {
+ throw new ServiceException("Cannot instantiate service class, does it have default constructor ?", e);
+ } catch (IllegalAccessException e) {
+ throw new ServiceException("Cannot instantiate service class, illegal access", e);
+ }
+ return instances;
+ }
+
+ /**
+ * <p class="changed_added_4_0">
+ * Load service implementation classes.
+ * </p>
+ *
+ * @param <S>
+ * @param serviceClass
+ * @return
+ * @throws ServiceException
+ */
+ public static <S> Collection<Class<? extends S>> loadServiceClasses(Class<S> serviceClass) throws ServiceException {
+ ClassLoader classLoader = getClassLoader(serviceClass);
+ Set<String> names = new HashSet<String>();
+ Enumeration<URL> resources;
+ try {
+ resources = classLoader.getResources(META_INF_SERVICES + serviceClass.getName());
+ while (resources.hasMoreElements()) {
+ names.addAll(parse(resources.nextElement()));
+ }
+ } catch (IOException e) {
+ throw new ServiceException("Error load service descriptions", e);
+ }
+ List<Class<? extends S>> instanceClasses = new ArrayList<Class<? extends S>>();
+ for (String className : names) {
+ instanceClasses.add(loadClass(serviceClass, classLoader, className));
+ }
+ return instanceClasses;
+
+ }
+
+ static Collection<String> parse(URL url) throws ServiceException, IOException {
+ InputStream inputStream = null;
+ try {
+ URLConnection connection = url.openConnection();
+ try {
+ connection.setUseCaches(false);
+ } catch (IllegalArgumentException e) {
+ // Do nothing.
+ }
+ Set<String> names = new HashSet<String>();
+ inputStream = connection.getInputStream();
+ BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "utf-8"));
+ String line;
+ while (null != (line = reader.readLine())) {
+ parseLine(line, names);
+ }
+ return names;
+ } finally {
+ if (null != inputStream) {
+ inputStream.close();
+ }
+ }
+ }
+
+ /**
+ * <p class="changed_added_4_0">
+ * Parse a single line from service description. Skips empty lines and comments started with #
+ * </p>
+ *
+ * @param line
+ * @param names
+ * @throws ServiceException
+ */
+ static void parseLine(String line, Collection<String> names) throws ServiceException {
+ String name;
+ int commentIndex = line.indexOf('#');
+ if (commentIndex >= 0) {
+ name = line.substring(0, commentIndex);
+ } else {
+ name = line;
+ }
+ name = name.trim();
+ if (name.length() > 0) {
+ if (LEGAL_JAVA_NAME.matcher(name).matches()) {
+ names.add(name);
+ } else {
+ throw new ServiceException("Invalid java class name [" + line + "]");
+ }
+ }
+ }
+
+ /**
+ * <p class="changed_added_4_0">
+ * Get class loader
+ * </p>
+ *
+ * @param <S>
+ * @param serviceClass
+ * @return context class loader or loader with which service class has been loaded.
+ */
+ private static <S> ClassLoader getClassLoader(Class<S> serviceClass) {
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ if (null == classLoader) {
+ classLoader = serviceClass.getClassLoader();
+ }
+ return classLoader;
+ }
+
+ private static <S> Class<? extends S> loadClass(Class<S> serviceClass, ClassLoader classLoader, String className)
+ throws ServiceException {
+ try {
+ Class<?> implementationClass = classLoader.loadClass(className);
+ if (serviceClass.isAssignableFrom(implementationClass)) {
+ return implementationClass.asSubclass(serviceClass);
+ } else {
+ throw new ServiceException("Class " + className + " in not the instance of " + serviceClass.getName());
+ }
+ } catch (ClassNotFoundException e) {
+ throw new ServiceException("Class " + className + " not found", e);
+ }
+ }
+
+}
Property changes on: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/ServiceLoader.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/StaticBinding.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/StaticBinding.java 2010-06-15 15:50:35 UTC (rev 17626)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/StaticBinding.java 2010-06-15 20:07:22 UTC (rev 17627)
@@ -1,52 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.jsr330;
-
-
-/**
- * <p class="changed_added_4_0"></p>
- * @author asmirnov(a)exadel.com
- *
- */
-public class StaticBinding implements Binding {
-
- private final Object value;
-
- public StaticBinding(Object value) {
- this.value = value;
- }
-
- public Object get() {
- return value;
- }
-
- public void init(InjectorImpl injectorImpl) {
- // do nothing
- }
-
- public Binding getProvider() {
- return new StaticBinding(this);
- }
-
-}
Modified: root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Target.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Target.java 2010-06-15 15:50:35 UTC (rev 17626)
+++ root/core/branches/jsr-330/jsr330-impl/src/main/java/org/richfaces/jsr330/Target.java 2010-06-15 20:07:22 UTC (rev 17627)
@@ -52,25 +52,31 @@
private Type[] actualTypeArguments;
public Target(Type type) {
- this(type,null);
+ this(null,type);
}
- public Target(Type type, String name) {
+ public Target(String name, Type type) {
this.type = type;
this.name = name;
this.rawType = getRawClass(type);
this.actualTypeArguments = getActualTypeArguments(type);
}
- public static Target create(Class<?> type, String name) {
- return new Target(type, name);
+ public static Target create(Class<?> type, Class<?> ...typeArguments) {
+ return create(null, type, typeArguments);
}
- public static Target create(Type type, Annotation... annotations) {
+ public static Target create(String name, Class<?> type, Class<?> ...typeArguments) {
+ Target target = new Target(name, type);
+ target.actualTypeArguments = typeArguments;
+ return target;
+ }
+
+ public static Target createNamed(Type type, Annotation... annotations) {
if (null != annotations) {
for (Annotation annotation : annotations) {
if (annotation instanceof Named) {
- return new Target(type, ((Named) annotation).value());
+ return new Target(((Named) annotation).value(), type);
}
}
@@ -79,7 +85,7 @@
}
public Target toProvider() {
- Target target = new Target(type, name);
+ Target target = new Target(name, type);
target.rawType = Provider.class;
target.actualTypeArguments = new Type[]{this.type};
return target;
@@ -87,7 +93,7 @@
public Target toProviderTarget(){
if(isProvider()){
- return new Target(this.actualTypeArguments[0],name);
+ return new Target(name,this.actualTypeArguments[0]);
} else {
throw new DependencyException("Type "+this+" not is a Provider type");
}
Modified: root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/InjectorTest.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/InjectorTest.java 2010-06-15 15:50:35 UTC (rev 17626)
+++ root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/InjectorTest.java 2010-06-15 20:07:22 UTC (rev 17627)
@@ -12,10 +12,10 @@
InjectorImpl injector = new InjectorImpl();
injector.init(new BindingModule(){
- public void configure(InjectorImpl injector) {
- injector.registerImplementation(Target.create(TestInterface.class), TestConstructorInjection.class);
- injector.registerInstance(Target.create(String.class, "foo"), "bar");
- injector.registerInstance(Target.create(String.class, "bar"), "baz");
+ public void configure(InjectorConfig injector) {
+ injector.register(TestInterface.class).to(TestConstructorInjection.class);
+ injector.register("foo", String.class).toInstance("bar");
+ injector.register("bar", String.class).toInstance("baz");
}
});
@@ -29,10 +29,10 @@
InjectorImpl injector = new InjectorImpl();
injector.init(new BindingModule(){
- public void configure(InjectorImpl injector) {
- injector.registerImplementation(Target.create(TestInterface.class), TestFieldInjection.class);
- injector.registerInstance(Target.create(String.class, "foo"), "bar");
- injector.registerInstance(Target.create(String.class, "bar"), "baz");
+ public void configure(InjectorConfig injector) {
+ injector.register(TestInterface.class).to(TestFieldInjection.class);
+ injector.register("foo", String.class).toInstance("bar");
+ injector.register("bar", String.class).toInstance("baz");
}
});
@@ -46,10 +46,10 @@
InjectorImpl injector = new InjectorImpl();
injector.init(new BindingModule(){
- public void configure(InjectorImpl injector) {
- injector.registerImplementation(Target.create(TestInterface.class), TestMethodInjection.class);
- injector.registerInstance(Target.create(String.class, "foo"), "bar");
- injector.registerInstance(Target.create(String.class, "bar"), "baz");
+ public void configure(InjectorConfig injector) {
+ injector.register(TestInterface.class).to(TestMethodInjection.class);
+ injector.register("foo", String.class).toInstance("bar");
+ injector.register("bar", String.class).toInstance("baz");
}
});
@@ -63,10 +63,10 @@
InjectorImpl injector = new InjectorImpl();
injector.init(new BindingModule(){
- public void configure(InjectorImpl injector) {
- injector.registerImplementation(Target.create(TestInterface.class), TestProviderInjection.class);
- injector.registerInstance(Target.create(String.class, "foo"), "bar");
- injector.registerInstance(Target.create(String.class, "bar"), "baz");
+ public void configure(InjectorConfig injector) {
+ injector.register(TestInterface.class).to(TestProviderInjection.class);
+ injector.register("foo", String.class).toInstance("bar");
+ injector.register("bar", String.class).toInstance("baz");
}
});
@@ -80,10 +80,10 @@
InjectorImpl injector = new InjectorImpl();
injector.init(new BindingModule(){
- public void configure(InjectorImpl injector) {
- injector.registerImplementation(Target.create(TestInterface.class), TestProviderInjection.class);
- injector.registerProviderInstance(Target.create(String.class, "foo"), new FooProvider());
- injector.registerProviderImplementation(Target.create(String.class, "bar"), BarProvider.class);
+ public void configure(InjectorConfig injector) {
+ injector.register(TestInterface.class).to(TestProviderInjection.class);
+ injector.register("foo", String.class).toProviderInstance(new FooProvider());
+ injector.register("bar", String.class).toProvider(BarProvider.class);
}
});
Added: root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/ServiceLoaderTest.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/ServiceLoaderTest.java (rev 0)
+++ root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/ServiceLoaderTest.java 2010-06-15 20:07:22 UTC (rev 17627)
@@ -0,0 +1,156 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.jsr330;
+
+import static org.junit.Assert.*;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class ServiceLoaderTest {
+
+ private static final String JAVA_UTIL_LIST = "java.util.List";
+
+ private ClassLoader currentLoader;
+
+ @Before
+ public void setUp() {
+ currentLoader = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
+ }
+
+ @After
+ public void thearDown() {
+ Thread.currentThread().setContextClassLoader(currentLoader);
+ }
+
+ /**
+ * Test method for {@link org.richfaces.jsr330.ServiceLoader#loadServices(java.lang.Class)}.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testLoadServices() throws Exception {
+ Collection<List> services = ServiceLoader.loadServices(List.class);
+ assertEquals(1, services.size());
+ }
+
+ /**
+ * Test method for {@link org.richfaces.jsr330.ServiceLoader#loadServiceClasses(java.lang.Class)}.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testLoadServiceClasses() throws Exception {
+ Collection<Class<? extends List>> serviceClasses = ServiceLoader.loadServiceClasses(List.class);
+ assertEquals(1, serviceClasses.size());
+ assertEquals(TestServiceImpl.class, serviceClasses.iterator().next());
+ }
+
+ /**
+ * Test method for {@link org.richfaces.jsr330.ServiceLoader#parse(java.net.URL)}.
+ *
+ * @throws Exception
+ * @throws ServiceException
+ */
+ @Test
+ public void testParse() throws Exception {
+ URL url = this.getClass().getResource("/META-INF/services/java.util.List");
+ Collection<String> collection = ServiceLoader.parse(url);
+ assertEquals(1, collection.size());
+ assertEquals(TestServiceImpl.class.getName(), collection.iterator().next());
+ }
+
+ /**
+ * Test method for {@link org.richfaces.jsr330.ServiceLoader#parseLine(java.lang.String, java.util.Set)}.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testParseLine() throws Exception {
+ String line = "\t" + JAVA_UTIL_LIST + " ";
+ ArrayList<String> names = new ArrayList<String>();
+ ServiceLoader.parseLine(line, names);
+
+ assertEquals(1, names.size());
+ assertEquals(JAVA_UTIL_LIST, names.get(0));
+ }
+
+ /**
+ * Test method for {@link org.richfaces.jsr330.ServiceLoader#parseLine(java.lang.String, java.util.Set)}.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testParseLine1() throws Exception {
+ String line = TestServiceImpl.class.getName();
+ ArrayList<String> names = new ArrayList<String>();
+ ServiceLoader.parseLine(line, names);
+
+ assertEquals(1, names.size());
+ assertEquals(TestServiceImpl.class.getName(), names.get(0));
+ }
+
+ /**
+ * Test method for {@link org.richfaces.jsr330.ServiceLoader#parseLine(java.lang.String, java.util.Set)}.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testParseLineWithComment() throws Exception {
+ String line = JAVA_UTIL_LIST + " # comment";
+ ArrayList<String> names = new ArrayList<String>();
+ ServiceLoader.parseLine(line, names);
+
+ assertEquals(1, names.size());
+ assertEquals(JAVA_UTIL_LIST, names.get(0));
+ }
+
+ /**
+ * Test method for {@link org.richfaces.jsr330.ServiceLoader#parseLine(java.lang.String, java.util.Set)}.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testParseLineComment() throws Exception {
+ String line = " # comment";
+ ArrayList<String> names = new ArrayList<String>();
+ ServiceLoader.parseLine(line, names);
+
+ assertEquals(0, names.size());
+ }
+}
Property changes on: root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/ServiceLoaderTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestServiceImpl.java
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestServiceImpl.java (rev 0)
+++ root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestServiceImpl.java 2010-06-15 20:07:22 UTC (rev 17627)
@@ -0,0 +1,125 @@
+package org.richfaces.jsr330;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+public class TestServiceImpl implements List<String> {
+
+ public boolean add(String o) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void add(int index, String element) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public boolean addAll(Collection<? extends String> c) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean addAll(int index, Collection<? extends String> c) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void clear() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public boolean contains(Object o) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean containsAll(Collection<?> c) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public String get(int index) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int indexOf(Object o) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public boolean isEmpty() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public Iterator<String> iterator() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int lastIndexOf(Object o) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public ListIterator<String> listIterator() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ListIterator<String> listIterator(int index) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean remove(Object o) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public String remove(int index) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean removeAll(Collection<?> c) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean retainAll(Collection<?> c) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public String set(int index, String element) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int size() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public List<String> subList(int fromIndex, int toIndex) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Object[] toArray() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public <T> T[] toArray(T[] a) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Property changes on: root/core/branches/jsr-330/jsr330-impl/src/test/java/org/richfaces/jsr330/TestServiceImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: root/core/branches/jsr-330/jsr330-impl/src/test/resources/META-INF/services/java.util.List
===================================================================
--- root/core/branches/jsr-330/jsr330-impl/src/test/resources/META-INF/services/java.util.List (rev 0)
+++ root/core/branches/jsr-330/jsr330-impl/src/test/resources/META-INF/services/java.util.List 2010-06-15 20:07:22 UTC (rev 17627)
@@ -0,0 +1,3 @@
+# test implementation of List
+org.richfaces.jsr330.TestServiceImpl # comment
+
14 years, 6 months
JBoss Rich Faces SVN: r17626 - in root: archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/java/org and 38 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-06-15 11:50:35 -0400 (Tue, 15 Jun 2010)
New Revision: 17626
Added:
root/archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/java/org/
root/archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/java/org/richfaces/
root/archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/java/org/richfaces/RichBean.java
root/ui-sandbox/panels/
root/ui-sandbox/panels/branches/
root/ui-sandbox/panels/tags/
root/ui-sandbox/panels/trunk/
root/ui-sandbox/panels/trunk/bom/
root/ui-sandbox/panels/trunk/bom/pom.xml
root/ui-sandbox/panels/trunk/create-component.bat
root/ui-sandbox/panels/trunk/demo/
root/ui-sandbox/panels/trunk/demo/pom.xml
root/ui-sandbox/panels/trunk/dist/
root/ui-sandbox/panels/trunk/dist/api/
root/ui-sandbox/panels/trunk/dist/api/pom.xml
root/ui-sandbox/panels/trunk/dist/impl/
root/ui-sandbox/panels/trunk/dist/impl/pom.xml
root/ui-sandbox/panels/trunk/dist/pom.xml
root/ui-sandbox/panels/trunk/dist/ui/
root/ui-sandbox/panels/trunk/dist/ui/pom.xml
root/ui-sandbox/panels/trunk/docs/
root/ui-sandbox/panels/trunk/docs/panels-classes 1.1.png
root/ui-sandbox/panels/trunk/docs/panels-taglib 1.1.png
root/ui-sandbox/panels/trunk/docs/renderkit 1.1.png
root/ui-sandbox/panels/trunk/docs/richfaces 4.0.eap
root/ui-sandbox/panels/trunk/panels-togglePanel/
root/ui-sandbox/panels/trunk/parent/
root/ui-sandbox/panels/trunk/parent/pom.xml
root/ui-sandbox/panels/trunk/pom.xml
root/ui-sandbox/panels/trunk/readme.txt
root/ui-sandbox/panels/trunk/ui/
root/ui-sandbox/panels/trunk/ui/pom.xml
root/ui-sandbox/panels/trunk/ui/src/
root/ui-sandbox/panels/trunk/ui/src/main/
root/ui-sandbox/panels/trunk/ui/src/main/java/
root/ui-sandbox/panels/trunk/ui/src/main/java/org/
root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/
root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/
root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/AbstractSwitchablePanel.java
root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/AbstractTitledPanel.java
root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/AbstractToggleControl.java
root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/AbstractToggledPanel.java
root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/Method.java
root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/NamedPanel.java
root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/TitledPanel.java
root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/UIDivPanel.java
root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/UISwitchablePanel.java
root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/UISwitchablePanelImpl.java
root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/UISwitchablePanela.java
root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/renderkit/
root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/renderkit/html/
root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java
root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java
root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/renderkit/html/SimplePanelRenderer.java
root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java
root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java
root/ui-sandbox/panels/trunk/ui/src/main/resources/
root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/
root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/faces-config.xml
root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/panels.taglib.xml
root/ui-sandbox/panels/trunk/ui/src/test/
root/ui-sandbox/panels/trunk/ui/src/test/java/
root/ui-sandbox/panels/trunk/ui/src/test/java/org/
root/ui-sandbox/panels/trunk/ui/src/test/java/org/richfaces/
root/ui-sandbox/panels/trunk/ui/src/test/java/org/richfaces/renderkit/
root/ui-sandbox/panels/trunk/ui/src/test/java/org/richfaces/renderkit/html/
root/ui-sandbox/panels/trunk/ui/src/test/java/org/richfaces/renderkit/html/DivPanelRendererTest.java
root/ui-sandbox/panels/trunk/ui/target/
root/ui-sandbox/panels/trunk/ui/target/checkstyle-checker.xml
root/ui-sandbox/panels/trunk/ui/target/checkstyle-header.txt
root/ui-sandbox/panels/trunk/ui/target/checkstyle-result.xml
root/ui-sandbox/panels/trunk/ui/target/generated-sources/
root/ui-sandbox/panels/trunk/ui/target/generated-sources/main/
root/ui-sandbox/panels/trunk/ui/target/generated-sources/main/java/
root/ui-sandbox/panels/trunk/ui/target/generated-sources/main/resources/
root/ui-sandbox/panels/trunk/ui/target/generated-sources/main/resources/META-INF/
root/ui-sandbox/panels/trunk/ui/target/generated-sources/main/resources/META-INF/faces-config.xml
root/ui-sandbox/panels/trunk/ui/target/generated-sources/test/
root/ui-sandbox/panels/trunk/ui/target/generated-sources/test/java/
root/ui-sandbox/panels/trunk/ui/target/generated-sources/test/resources/
root/ui-sandbox/panels/trunk/ui/target/richfaces-ui-panels-ui-4.0.0-SNAPSHOT-sources.jar
root/ui-sandbox/panels/trunk/ui/target/richfaces-ui-panels-ui-4.0.0-SNAPSHOT.jar
Removed:
root/archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/java/RichBean.java
Modified:
root/archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/faces-config.xml
root/archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
root/archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/webapp/index.xhtml
root/archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/webapp/templates/template.xhtml
Log:
RF-8745 TogglePanel component
Deleted: root/archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/java/RichBean.java
===================================================================
--- root/archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/java/RichBean.java 2010-06-14 17:58:38 UTC (rev 17625)
+++ root/archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/java/RichBean.java 2010-06-15 15:50:35 UTC (rev 17626)
@@ -1,30 +0,0 @@
-#set( $symbol_pound = '#' )
-#set( $symbol_dollar = '$' )
-#set( $symbol_escape = '\' )
-package ${package};
-
-import java.io.Serializable;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class RichBean implements Serializable {
-
- private static final long serialVersionUID = -2403138958014741653L;
- private Logger logger;
- private String name;
-
- public RichBean() {
- logger = LoggerFactory.getLogger(RichBean.class);
- logger.info("post construct: initialize");
- name = "John";
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-}
Copied: root/archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/java/org/richfaces/RichBean.java (from rev 17623, root/archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/java/RichBean.java)
===================================================================
--- root/archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/java/org/richfaces/RichBean.java (rev 0)
+++ root/archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/java/org/richfaces/RichBean.java 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,27 @@
+package org.richfaces;
+
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
+
+import java.io.Serializable;
+
+public class RichBean implements Serializable {
+
+ private static final long serialVersionUID = -2403138958014741653L;
+ private Logger logger;
+ private String name;
+
+ public RichBean() {
+ logger = LoggerFactory.getLogger(RichBean.class);
+ logger.info("post construct: initialize");
+ name = "John";
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Modified: root/archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- root/archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/faces-config.xml 2010-06-14 17:58:38 UTC (rev 17625)
+++ root/archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/faces-config.xml 2010-06-15 15:50:35 UTC (rev 17626)
@@ -2,14 +2,9 @@
<faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
- <!--
- This is a workaround for JBoss AS 6 currently not processing JSF annotations.
- TODO: review and revert back to annotations.
- -->
<managed-bean>
<managed-bean-name>richBean</managed-bean-name>
- <managed-bean-class>${package}.RichBean</managed-bean-class>
+ <managed-bean-class>org.richfaces.RichBean</managed-bean-class>
<managed-bean-scope>view</managed-bean-scope>
</managed-bean>
-
</faces-config>
Modified: root/archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
===================================================================
--- root/archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml 2010-06-14 17:58:38 UTC (rev 17625)
+++ root/archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml 2010-06-15 15:50:35 UTC (rev 17626)
@@ -1,31 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
-<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
- <display-name>Sample RichFaces 4 Application</display-name>
- <context-param>
- <param-name>javax.faces.PROJECT_STAGE</param-name>
- <param-value>Development</param-value>
- </context-param>
- <context-param>
- <param-name>javax.faces.SKIP_COMMENTS</param-name>
- <param-value>true</param-value>
- </context-param>
- <servlet>
- <servlet-name>Faces Servlet</servlet-name>
- <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>Faces Servlet</servlet-name>
- <url-pattern>*.jsf</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>Faces Servlet</servlet-name>
- <url-pattern>/faces/*</url-pattern>
- </servlet-mapping>
- <welcome-file-list>
- <welcome-file>faces/index.xhtml</welcome-file>
- </welcome-file-list>
- <session-config>
- <session-timeout>30</session-timeout>
- </session-config>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ version="2.5">
+
+ <display-name>Sample RichFaces 4 Application</display-name>
+ <context-param>
+ <param-name>javax.faces.PROJECT_STAGE</param-name>
+ <param-value>Development</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.SKIP_COMMENTS</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>/faces/*</url-pattern>
+ </servlet-mapping>
+ <welcome-file-list>
+ <welcome-file>faces/index.xhtml</welcome-file>
+ </welcome-file-list>
+ <session-config>
+ <session-timeout>30</session-timeout>
+ </session-config>
</web-app>
\ No newline at end of file
Modified: root/archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/webapp/index.xhtml
===================================================================
--- root/archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/webapp/index.xhtml 2010-06-14 17:58:38 UTC (rev 17625)
+++ root/archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/webapp/index.xhtml 2010-06-15 15:50:35 UTC (rev 17626)
@@ -1,9 +1,9 @@
-#set( $symbol_pound = '#' )
-#set( $symbol_dollar = '$' )
-#set( $symbol_escape = '\' )
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:pa="http://richfaces.org/panels">
<body>
<ui:composition template="/templates/template.xhtml">
@@ -11,16 +11,9 @@
<ui:define name="title">RichFaces Sample</ui:define>
<ui:define name="body">
- <h:form prependId="false">
- <h:outputLabel value="Name:" for="nameInput" />
- <h:inputText id="nameInput" value="${symbol_pound}{richBean.name}">
- <a4j:ajax event="keyup" render="output" />
- </h:inputText>
- <h:panelGroup id="output">
- <h:outputText value="Hello ${symbol_pound}{richBean.name}!"
- rendered="${symbol_pound}{not empty richBean.name}" />
- </h:panelGroup>
- </h:form>
+ <pa:divPanel id="my_id" lang="en" onclick="#{richBean.name}">
+ other html
+ </pa:divPanel>
</ui:define>
</ui:composition>
</body>
Modified: root/archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/webapp/templates/template.xhtml
===================================================================
--- root/archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/webapp/templates/template.xhtml 2010-06-14 17:58:38 UTC (rev 17625)
+++ root/archetypes/richfaces-archetype-simpleapp/trunk/src/main/resources/archetype-resources/src/main/webapp/templates/template.xhtml 2010-06-15 15:50:35 UTC (rev 17626)
@@ -1,9 +1,8 @@
-#set( $symbol_pound = '#' )
-#set( $symbol_dollar = '$' )
-#set( $symbol_escape = '\' )
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets" >
<h:head>
<title><ui:define name="title">Application Title</ui:define></title>
Added: root/ui-sandbox/panels/trunk/bom/pom.xml
===================================================================
--- root/ui-sandbox/panels/trunk/bom/pom.xml (rev 0)
+++ root/ui-sandbox/panels/trunk/bom/pom.xml 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ 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/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-parent</artifactId>
+ <version>7</version>
+ </parent>
+
+ <groupId>org.richfaces.ui.panels</groupId>
+ <artifactId>richfaces-ui-panels-bom</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <name>Richfaces UI Components: panels bom</name>
+ <packaging>pom</packaging>
+
+ <properties>
+ <org.richfaces.core.version>4.0.0-SNAPSHOT</org.richfaces.core.version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.ui.core</groupId>
+ <artifactId>richfaces-ui-core-bom</artifactId>
+ <version>${org.richfaces.core.version}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>richfaces-ui-panels-ui</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>richfaces-ui-panels-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>richfaces-ui-panels-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/root/ui/panels/trunk/bom</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/root/ui/panels/trunk/bom</developerConnection>
+ <url>http://fisheye.jboss.org/browse/richfaces</url>
+ </scm>
+</project>
Added: root/ui-sandbox/panels/trunk/create-component.bat
===================================================================
--- root/ui-sandbox/panels/trunk/create-component.bat (rev 0)
+++ root/ui-sandbox/panels/trunk/create-component.bat 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1 @@
+mvn archetype:generate -DarchetypeGroupId=org.richfaces.archetypes -DarchetypeArtifactId=richfaces-component -Dcategory=panels -Dname=%1
\ No newline at end of file
Added: root/ui-sandbox/panels/trunk/demo/pom.xml
===================================================================
--- root/ui-sandbox/panels/trunk/demo/pom.xml (rev 0)
+++ root/ui-sandbox/panels/trunk/demo/pom.xml 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,225 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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.ui.panels</groupId>
+ <artifactId>togglePanel-demo</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <name>Richfaces UI Components: togglePanel demo</name>
+ <packaging>war</packaging>
+
+ <url>http://jboss.org/richfaces</url>
+
+ <repositories>
+ <repository>
+ <id>jboss-public-repository-group</id>
+ <name>Jboss Repository for Maven</name>
+ <url>https://repository.jboss.org/nexus/content/groups/public/</url>
+ </repository>
+ <repository>
+ <id>java-net</id>
+ <name>Java.net Maven Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ </repository>
+ </repositories>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <org.richfaces.ui.version>4.0.0-SNAPSHOT</org.richfaces.ui.version>
+ </properties>
+
+ <build>
+ <finalName>${artifactId}-${project.version}</finalName>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.1-beta-1</version>
+ <configuration>
+ <webResources>
+ <resource>
+ <directory>${basedir}/src/main/java</directory>
+ <targetPath>/WEB-INF/src</targetPath>
+ </resource>
+ </webResources>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>jee6</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.1-alpha-1</version>
+ <configuration>
+ <webappDirectory>${project.build.directory}/${project.build.finalName}-jee6</webappDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>${jsf2.api.groupid}</groupId>
+ <artifactId>${jsf2.api.artifactid}</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>${jsf2.impl.groupid}</groupId>
+ <artifactId>${jsf2.impl.artifactid}</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ <version>1.1</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>release</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>jee6</id>
+ <phase>package</phase>
+ <goals>
+ <goal>war</goal>
+ </goals>
+ <configuration>
+ <webappDirectory>${symbol_dollar}{project.build.directory}/${symbol_dollar}{project.build.finalName}-jee6</webappDirectory>
+ <classifier>jee6</classifier>
+ <packagingExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*,WEB-INF/lib/slf4j-*</packagingExcludes>
+ <warSourceExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*,WEB-INF/lib/slf4j-*</warSourceExcludes>
+ </configuration>
+ </execution>
+ </executions>
+ <configuration>
+ <webResources>
+ <resource>
+ <directory>${symbol_dollar}{basedir}/src/main/java</directory>
+ <targetPath>/WEB-INF/src</targetPath>
+ </resource>
+ </webResources>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.ui.panels</groupId>
+ <artifactId>richfaces-ui-panels-bom</artifactId>
+ <version>${version}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui.misc</groupId>
+ <artifactId>richfaces-ui-misc-bom</artifactId>
+ <version>${version}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.ui.panels</groupId>
+ <artifactId>richfaces-ui-panels-ui</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui.core</groupId>
+ <artifactId>richfaces-ui-core-ui</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui.misc</groupId>
+ <artifactId>richfaces-ui-misc-ui</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>1.5.8</version>
+ </dependency>
+
+ <dependency>
+ <groupId>net.sf.ehcache</groupId>
+ <artifactId>ehcache</artifactId>
+ </dependency>
+
+ <!-- simple logger binding: only messages of level INFO and higher are printed-->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.5.8</version>
+ </dependency>
+
+ <!-- Log4J dependency used in examples -->
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ </dependency>
+
+ <!-- Tests -->
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>5.10</version>
+ <classifier>jdk15</classifier>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
Added: root/ui-sandbox/panels/trunk/dist/api/pom.xml
===================================================================
--- root/ui-sandbox/panels/trunk/dist/api/pom.xml (rev 0)
+++ root/ui-sandbox/panels/trunk/dist/api/pom.xml 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.richfaces.ui.panels</groupId>
+ <artifactId>richfaces-ui-panels-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>richfaces-ui-panels-api</artifactId>
+ <packaging>jar</packaging>
+ <name>Richfaces UI panels api</name>
+
+ <properties>
+ <assembly.projects.group>org.richfaces.ui.panels</assembly.projects.group>
+ <faces-shade-transformers.version>1</faces-shade-transformers.version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.ui.panels</groupId>
+ <artifactId>richfaces-ui-panels-bom</artifactId>
+ <version>${project.version}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <!-- artifacts for aggregation -->
+
+
+ <!-- artifacts for javadoc generation -->
+ <dependency>
+ <groupId>${jsf2.api.groupid}</groupId>
+ <artifactId>${jsf2.api.artifactid}</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>1.3.3</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <artifactSet>
+ <includes>
+ <include>${assembly.projects.group}:*-api:*</include>
+ </includes>
+ </artifactSet>
+ <createSourcesJar>true</createSourcesJar>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.build.resources</groupId>
+ <artifactId>faces-shade-transformers</artifactId>
+ <version>${faces-shade-transformers.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+
+
+ <profiles>
+ <profile>
+ <id>release</id>
+
+ <build>
+ <plugins>
+ <plugin>
+ <!-- unpack necessary dependencies for collecting javadocs -->
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>deps</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>unpack-dependencies</goal>
+ </goals>
+ <configuration>
+ <classifier>sources</classifier>
+
+ <includeGroupIds>${assembly.projects.group}</includeGroupIds>
+ <useSubDirectoryPerArtifact>true</useSubDirectoryPerArtifact>
+ <excludeTransitive>true</excludeTransitive>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.7</version>
+ <executions>
+ <execution>
+ <id>javadoc-jar</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <sourcepath>${basedir}/target/dependency</sourcepath>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/root/ui/panels/trunk/dis...</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/root/ui/panels/trunk/dist/api</developerConnection>
+ <url>http://fisheye.jboss.org/browse/richfaces</url>
+ </scm>
+</project>
Added: root/ui-sandbox/panels/trunk/dist/impl/pom.xml
===================================================================
--- root/ui-sandbox/panels/trunk/dist/impl/pom.xml (rev 0)
+++ root/ui-sandbox/panels/trunk/dist/impl/pom.xml 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.richfaces.ui.panels</groupId>
+ <artifactId>richfaces-ui-panels-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>richfaces-ui-panels-impl</artifactId>
+ <packaging>jar</packaging>
+ <name>Richfaces UI panels api</name>
+
+ <properties>
+ <assembly.projects.group>org.richfaces.ui.panels</assembly.projects.group>
+ <faces-shade-transformers.version>1</faces-shade-transformers.version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.ui.panels</groupId>
+ <artifactId>richfaces-ui-panels-bom</artifactId>
+ <version>${project.version}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <!-- artifacts for aggregation -->
+
+ <!-- artifacts for javadoc generation -->
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>richfaces-ui-panels-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>${jsf2.api.groupid}</groupId>
+ <artifactId>${jsf2.api.artifactid}</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>1.3.3</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <artifactSet>
+ <includes>
+ <include>${assembly.projects.group}:*-impl:*</include>
+ </includes>
+ </artifactSet>
+ <createSourcesJar>true</createSourcesJar>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.build.resources</groupId>
+ <artifactId>faces-shade-transformers</artifactId>
+ <version>${faces-shade-transformers.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+
+
+ <profiles>
+ <profile>
+ <id>release</id>
+
+ <build>
+ <plugins>
+ <plugin>
+ <!-- unpack necessary dependencies for collecting javadocs -->
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>deps</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>unpack-dependencies</goal>
+ </goals>
+ <configuration>
+ <classifier>sources</classifier>
+
+ <includeGroupIds>${assembly.projects.group}</includeGroupIds>
+ <useSubDirectoryPerArtifact>true</useSubDirectoryPerArtifact>
+ <excludeTransitive>true</excludeTransitive>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.7</version>
+ <executions>
+ <execution>
+ <id>javadoc-jar</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <sourcepath>${basedir}/target/dependency</sourcepath>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/root/ui/panels/trunk/dis...</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/root/ui/panels/trunk/dist/impl</developerConnection>
+ <url>http://fisheye.jboss.org/browse/richfaces</url>
+ </scm>
+</project>
Added: root/ui-sandbox/panels/trunk/dist/pom.xml
===================================================================
--- root/ui-sandbox/panels/trunk/dist/pom.xml (rev 0)
+++ root/ui-sandbox/panels/trunk/dist/pom.xml 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.richfaces.ui.panels</groupId>
+ <artifactId>richfaces-ui-panels-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.richfaces.ui.panels</groupId>
+ <artifactId>richfaces-ui-panels-assembler</artifactId>
+ <packaging>pom</packaging>
+ <name>Richfaces UI panels assembler</name>
+
+ <modules>
+ <!-- aggregate modules -->
+ <module>api</module>
+ <module>impl</module>
+ <module>ui</module>
+ </modules>
+
+ <build>
+ <plugins>
+ <!-- We need to disable the cdk plugin for the dist modules -->
+ <plugin>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ <inherited>false</inherited>
+ </plugin>
+ </plugins>
+ </build>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/root/ui/panels/trunk/dist</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/root/ui/panels/trunk/dist</developerConnection>
+ <url>http://fisheye.jboss.org/browse/richfaces</url>
+ </scm>
+</project>
\ No newline at end of file
Added: root/ui-sandbox/panels/trunk/dist/ui/pom.xml
===================================================================
--- root/ui-sandbox/panels/trunk/dist/ui/pom.xml (rev 0)
+++ root/ui-sandbox/panels/trunk/dist/ui/pom.xml 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,205 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.richfaces.ui.panels</groupId>
+ <artifactId>richfaces-ui-panels-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>richfaces-ui-panels-ui</artifactId>
+ <packaging>jar</packaging>
+ <name>Richfaces UI panels ui</name>
+
+ <properties>
+ <assembly.projects.group>org.richfaces.ui.panels</assembly.projects.group>
+ <faces-shade-transformers.version>1</faces-shade-transformers.version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.ui.panels</groupId>
+ <artifactId>richfaces-ui-panels-bom</artifactId>
+ <version>${project.version}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <!-- artifacts for aggregation -->
+
+ <!-- artifacts for javadoc generation -->
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>richfaces-ui-panels-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${jsf2.api.groupid}</groupId>
+ <artifactId>${jsf2.api.artifactid}</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>1.3.3</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <artifactSet>
+ <includes>
+ <include>${assembly.projects.group}:*-ui:*</include>
+ </includes>
+ </artifactSet>
+ <createSourcesJar>true</createSourcesJar>
+ <transformers>
+ <transformer implementation="org.richfaces.build.shade.resource.TaglibXmlResourceTransformer">
+ <taglibs>
+ <taglib>
+ <targetNamespace>http://richfaces.org/panels</targetNamespace>
+ <sourceNamespacesPattern>.*</sourceNamespacesPattern>
+ </taglib>
+ </taglibs>
+ </transformer>
+ <transformer implementation="org.richfaces.build.shade.resource.FacesConfigXmlResourceTransformer" />
+ </transformers>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.build.resources</groupId>
+ <artifactId>faces-shade-transformers</artifactId>
+ <version>${faces-shade-transformers.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+ <profiles>
+ <profile>
+ <id>release</id>
+
+ <build>
+ <plugins>
+ <plugin>
+ <!-- unpack necessary dependencies for collecting jsdoc and javadocs -->
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>deps</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>unpack-dependencies</goal>
+ </goals>
+ <configuration>
+ <classifier>sources</classifier>
+
+ <includeGroupIds>${assembly.projects.group}</includeGroupIds>
+ <useSubDirectoryPerArtifact>true</useSubDirectoryPerArtifact>
+ <excludeTransitive>true</excludeTransitive>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+<!-- <plugin>
+ <!– collecting jsdoc –>
+ <groupId>gr.abiss.mvn.plugins</groupId>
+ <artifactId>maven-jstools-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>jsdoc</id>
+ <phase>prepare-package</phase>
+ <configuration>
+ <outputBaseDirectory>${basedir}/target</outputBaseDirectory>
+ <jsDir>${basedir}/target/dependency</jsDir>
+ <includes>**/*.js</includes>
+ <caseSensitive>true</caseSensitive>
+ </configuration>
+ <goals>
+ <goal>jsdoc</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <!– pack jsdoc to jar –>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>pack-jsodcs</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <classesDirectory>${basedir}/target/jsdoc</classesDirectory>
+ <classifier>jsdoc</classifier>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>-->
+ <plugin>
+ <!-- collecting javadoc -->
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.7</version>
+ <executions>
+ <execution>
+ <id>javadoc-jar</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <sourcepath>${basedir}/target/dependency</sourcepath>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/root/ui/panels/trunk/dis...</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/root/ui/panels/trunk/dist/ui</developerConnection>
+ <url>http://fisheye.jboss.org/browse/richfaces</url>
+ </scm>
+</project>
Added: root/ui-sandbox/panels/trunk/docs/panels-classes 1.1.png
===================================================================
(Binary files differ)
Property changes on: root/ui-sandbox/panels/trunk/docs/panels-classes 1.1.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: root/ui-sandbox/panels/trunk/docs/panels-taglib 1.1.png
===================================================================
(Binary files differ)
Property changes on: root/ui-sandbox/panels/trunk/docs/panels-taglib 1.1.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: root/ui-sandbox/panels/trunk/docs/renderkit 1.1.png
===================================================================
(Binary files differ)
Property changes on: root/ui-sandbox/panels/trunk/docs/renderkit 1.1.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: root/ui-sandbox/panels/trunk/docs/richfaces 4.0.eap
===================================================================
(Binary files differ)
Property changes on: root/ui-sandbox/panels/trunk/docs/richfaces 4.0.eap
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: root/ui-sandbox/panels/trunk/parent/pom.xml
===================================================================
--- root/ui-sandbox/panels/trunk/parent/pom.xml (rev 0)
+++ root/ui-sandbox/panels/trunk/parent/pom.xml 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ 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/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-parent</artifactId>
+ <version>7</version>
+ </parent>
+
+ <groupId>org.richfaces.ui.panels</groupId>
+ <artifactId>richfaces-ui-panels-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <name>Richfaces UI Components: panels parent</name>
+ <packaging>pom</packaging>
+
+ <properties>
+ <richfaces.checkstyle.version>1</richfaces.checkstyle.version>
+ <org.richfaces.cdk.version>4.0.0-SNAPSHOT</org.richfaces.cdk.version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.ui.panels</groupId>
+ <artifactId>richfaces-ui-panels-bom</artifactId>
+ <version>${project.version}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>annotations</artifactId>
+ <version>${org.richfaces.cdk.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ <version>${org.richfaces.cdk.version}</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>xml-maven-plugin</artifactId>
+ <version>1.0-beta-2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-archetype-plugin</artifactId>
+ <version>2.0-alpha-4</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-build-checkstyle</artifactId>
+ <version>${richfaces.checkstyle.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <version>1.0-beta-1</version>
+ <configuration>
+ <fail>false</fail>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ <configuration>
+ <library>
+ <prefix>org.richfaces</prefix>
+ <taglib>
+ <uri>http://richfaces.org/panels</uri>
+ <shortName>panels</shortName>
+ <displayName>panels components tags</displayName>
+ </taglib>
+ </library>
+ </configuration>
+ <executions>
+ <execution>
+ <id>cdk-generate-sources</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>release</id>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <javadocVersion>1.5</javadocVersion>
+ <aggregate>true</aggregate>
+ </configuration>
+ <executions>
+ <execution>
+ <id>generate-javadoc</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <configuration>
+ <aggregate>true</aggregate>
+ </configuration>
+ <executions>
+ <execution>
+ <id>generate-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/root/ui/panels/trunk/parent</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/root/ui/panels/trunk/parent</developerConnection>
+ <url>http://fisheye.jboss.org/browse/richfaces</url>
+ </scm>
+</project>
Added: root/ui-sandbox/panels/trunk/pom.xml
===================================================================
--- root/ui-sandbox/panels/trunk/pom.xml (rev 0)
+++ root/ui-sandbox/panels/trunk/pom.xml 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-parent</artifactId>
+ <version>7</version>
+ </parent>
+
+ <groupId>org.richfaces.ui.panels</groupId>
+ <artifactId>panels-aggregator</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Richfaces UI Components: panels Aggregator</name>
+
+ <modules>
+ <module>bom</module>
+ <module>parent</module>
+
+ <module>ui</module>
+ <module>demo</module>
+
+ <!--<module>old-togglePanel</module>-->
+ <!--<module>old-tabPanel</module>-->
+
+ <!--<module>dist</module>-->
+ </modules>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <!-- The dist requires clean install for prepare -->
+ <preparationGoals>clean install</preparationGoals>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <!-- The dist requires clean install for prepare -->
+ <preparationGoals>clean install</preparationGoals>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <version>1.0-beta-1</version>
+ <configuration>
+ <fail>false</fail>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/root/ui/panels/trunk</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/root/ui/panels/trunk</developerConnection>
+ <url>http://fisheye.jboss.org/browse/richfaces</url>
+ </scm>
+</project>
\ No newline at end of file
Added: root/ui-sandbox/panels/trunk/readme.txt
===================================================================
Added: root/ui-sandbox/panels/trunk/ui/pom.xml
===================================================================
--- root/ui-sandbox/panels/trunk/ui/pom.xml (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/pom.xml 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,279 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.richfaces.ui.panels</groupId>
+ <artifactId>richfaces-ui-panels-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.richfaces.ui.panels</groupId>
+ <artifactId>richfaces-ui-panels-ui</artifactId>
+ <name>Richfaces UI Components: togglePanel ui</name>
+ <packaging>jar</packaging>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.ui.misc</groupId>
+ <artifactId>richfaces-ui-misc-bom</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.richfaces.ui.core</groupId>
+ <artifactId>richfaces-ui-core-ui</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <!-- runtime -->
+<!-- <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>togglePanel-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>-->
+ <dependency>
+ <groupId>org.richfaces.ui.misc</groupId>
+ <artifactId>richfaces-ui-misc-ui</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui.core</groupId>
+ <artifactId>richfaces-ui-core-ui</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-api</artifactId>
+ </dependency>
+ <dependency>
+ <!-- todo remove this dependency or move to test scope -->
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>annotations</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- JSF with dependencies -->
+ <dependency>
+ <groupId>${jsf2.api.groupid}</groupId>
+ <artifactId>${jsf2.api.artifactid}</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- tests -->
+ <dependency>
+ <groupId>${jsf2.impl.groupid}</groupId>
+ <artifactId>${jsf2.impl.artifactid}</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <!-- todo api? -->
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.test-jsf</groupId>
+ <artifactId>jsf-test-stage</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.test-jsf</groupId>
+ <artifactId>htmlunit-client</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.test-jsf</groupId>
+ <artifactId>jsf-mock</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ <version>${org.richfaces.cdk.version}</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>xml-maven-plugin</artifactId>
+ <version>1.0-beta-2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-archetype-plugin</artifactId>
+ <version>2.0-alpha-4</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-build-checkstyle</artifactId>
+ <version>${richfaces.checkstyle.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <version>1.0-beta-1</version>
+ <configuration>
+ <fail>false</fail>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ <configuration>
+ <library>
+ <prefix>org.richfaces</prefix>
+ <taglib>
+ <uri>http://richfaces.org/panels</uri>
+ <shortName>panels</shortName>
+ <displayName>panels components tags</displayName>
+ </taglib>
+ </library>
+ </configuration>
+ <executions>
+ <execution>
+ <id>cdk-generate-sources</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>release</id>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <javadocVersion>1.5</javadocVersion>
+ <aggregate>true</aggregate>
+ </configuration>
+ <executions>
+ <execution>
+ <id>generate-javadoc</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <configuration>
+ <aggregate>true</aggregate>
+ </configuration>
+ <executions>
+ <execution>
+ <id>generate-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/root/ui/panels/trunk/tog...</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/root/ui/panels/trunk/toggle...</developerConnection>
+ <url>http://fisheye.jboss.org/browse/richfaces</url>
+ </scm>
+</project>
\ No newline at end of file
Added: root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/AbstractSwitchablePanel.java
===================================================================
--- root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/AbstractSwitchablePanel.java (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/AbstractSwitchablePanel.java 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,101 @@
+package org.richfaces.component;
+
+import org.richfaces.event.SwitchablePanelSwitchEvent;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIOutput;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.ValueChangeEvent;
+
+/**
+ * @author akolonitsky
+ * @version 1.0
+ * @since 11-Jun-2010 10:29:29 AM
+ */
+public abstract class AbstractSwitchablePanel extends UIOutput {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.SwitchablePanel";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.SwitchablePanel";
+
+ public abstract String getActiveState();
+
+ public abstract String getInitialState();
+
+ public abstract String getStatesOrder();
+
+ public abstract Mode getSwitchMode();
+
+ @Override
+ public void queueEvent(FacesEvent event) {
+ super.queueEvent(event);
+ }
+
+ @Override
+ public void broadcast(FacesEvent facesEvent) throws AbortProcessingException {
+
+ if (facesEvent instanceof ActionEvent) {
+ //TODO invoke action listener or remove it
+// if (isImmediate()) {
+// FacesContext facesContext = FacesContext.getCurrentInstance();
+// facesContext.renderResponse();
+// }
+ } //TODO else here
+
+ if (facesEvent instanceof SwitchablePanelSwitchEvent) {
+ if (isRendered()) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+
+ SwitchablePanelSwitchEvent switchEvent = (SwitchablePanelSwitchEvent) facesEvent;
+
+ Object newValue = switchEvent.getValue();
+ Object oldValue = getValue();
+ if ((oldValue == null && newValue != null) ||
+ (oldValue != null && !oldValue.equals(newValue))) {
+
+ queueEvent(new ValueChangeEvent(this, oldValue, newValue));
+ }
+
+ //TODO UIInput should update the model, not the switchable panel itself
+ ValueExpression valueBinding = getValueExpression("value");
+ if (valueBinding != null) {
+ valueBinding.setValue(facesContext.getELContext(), newValue);
+ setValue(null);
+// setLocalValueSet(false);
+ } else {
+ setValue(newValue);
+ }
+ }
+ } else /* component should throw IllegalArgumentException for unknown events - RF-30 */ {
+ super.broadcast(facesEvent);
+ }
+ }
+
+ @Override
+ public void processDecodes(FacesContext context) {
+ super.processDecodes(context);
+ }
+
+ @Override
+ public void processUpdates(FacesContext context) {
+ super.processUpdates(context);
+ }
+
+ @Override
+ public void processValidators(FacesContext context) {
+ super.processValidators(context);
+ }
+
+ @Override
+ public Object saveState(FacesContext context) {
+ return super.saveState(context);
+ }
+
+ @Override
+ public void restoreState(FacesContext context, Object state) {
+ super.restoreState(context, state);
+ }
+}
\ No newline at end of file
Added: root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/AbstractTitledPanel.java
===================================================================
--- root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/AbstractTitledPanel.java (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/AbstractTitledPanel.java 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,23 @@
+package org.richfaces.component;
+
+import org.richfaces.cdk.annotations.Attribute;
+
+/**
+ * @author akolonitsky
+ * @version 1.0
+ * @since 11-Jun-2010 10:29:29 AM
+ */
+//@JsfComponent
+public abstract class AbstractTitledPanel extends AbstractToggledPanel implements TitledPanel {
+
+ @Override
+ public String getName(){
+ return getClientId();
+ }
+
+ @Attribute
+ public abstract String getLabel();
+
+// public abstract String getIcon();
+
+}
\ No newline at end of file
Added: root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/AbstractToggleControl.java
===================================================================
--- root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/AbstractToggleControl.java (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/AbstractToggleControl.java 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,71 @@
+package org.richfaces.component;
+
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.component.behavior.ComponentControlBehavior;
+
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author akolonitsky
+ * @version 1.0
+ * @since 11-Jun-2010 10:29:30 AM
+ */
+//@JsfBehavior (generate = "org.richfaces.component.UIToggleControl")
+public abstract class AbstractToggleControl extends ComponentControlBehavior {
+
+ @Attribute
+ public abstract String getForPanel();
+
+ @Attribute
+ public abstract String getSwitchToState();
+
+ // TODO ?
+ public UISwitchablePanel getPanel() throws FacesException {
+ String target = this.getForPanel();
+
+ if (target != null) {
+
+ UIComponent targetComponent = null; /*RendererUtils.getInstance()
+ .findComponentFor(this., target);*/
+
+ if (null != targetComponent) {
+ return (UISwitchablePanel) targetComponent;
+ } else {
+ throw new FacesException("Parent panel for control (id="
+ /*+ getClientId(getFacesContext())*/
+ + ") has not been found.");
+ }
+ } else {
+
+ UIComponent control = null; // this.getParent();
+ while (control != null) {
+ if (control instanceof UISwitchablePanel) {
+ return (UISwitchablePanel) control;
+ }
+
+ control = control.getParent();
+ }
+ throw new FacesException("Parent panel for control (id="
+ + /*getClientId(getFacesContext()) + */") has not been found.");
+ }
+ }
+
+// @Override
+ protected void setupReRender(FacesContext facesContext) {
+// super.setupReRender(facesContext);
+ UISwitchablePanel togglePanel = getPanel();
+ AjaxRendererUtils.addRegionByName(facesContext, togglePanel,
+ togglePanel.getId());
+
+ AjaxRendererUtils.addRegionByName(facesContext, null/*this*/, ""
+ /*this.getId()*/);
+ }
+
+// @Override
+ public String getFamily() {
+ return ""; // COMPONENT_FAMILY;
+ }
+}
\ No newline at end of file
Added: root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/AbstractToggledPanel.java
===================================================================
--- root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/AbstractToggledPanel.java (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/AbstractToggledPanel.java 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,21 @@
+package org.richfaces.component;
+
+import org.richfaces.cdk.annotations.Attribute;
+
+import javax.faces.component.UIOutput;
+
+/**
+ * @author akolonitsky
+ * @version 1.0
+ * @since 11-Jun-2010 10:29:30 AM
+ */
+//@JsfComponent
+public abstract class AbstractToggledPanel extends UIOutput implements NamedPanel {
+
+ @Attribute
+ public abstract String getName();
+
+ @Attribute
+ public abstract String getSwitchMode();
+
+}
\ No newline at end of file
Added: root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/Method.java
===================================================================
--- root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/Method.java (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/Method.java 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,22 @@
+package org.richfaces.component;
+
+/**
+ * @author akolonitsky
+ * @since Jun 15, 2010
+ */
+public enum Method {
+ /**
+ * value for tab change method for - client-side tabs.
+ */
+ client,
+
+ /**
+ * value for tab change method - server-side tabs
+ */
+ server,
+
+ /**
+ * value for tab change method - ajax tabs
+ */
+ ajax
+}
Added: root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/NamedPanel.java
===================================================================
--- root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/NamedPanel.java (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/NamedPanel.java 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,12 @@
+package org.richfaces.component;
+
+/**
+ * @author akolonitsky
+ * @version 1.0
+ * @since 11-Jun-2010 10:29:30 AM
+ */
+public interface NamedPanel {
+
+ String getName();
+
+}
\ No newline at end of file
Added: root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/TitledPanel.java
===================================================================
--- root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/TitledPanel.java (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/TitledPanel.java 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,14 @@
+package org.richfaces.component;
+
+/**
+ * @author akolonitsky
+ * @version 1.0
+ * @created 11-Jun-2010 10:29:30 AM
+ */
+public interface TitledPanel extends NamedPanel {
+
+ public String getLabel();
+
+// public String getIcon();
+
+}
\ No newline at end of file
Added: root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/UIDivPanel.java
===================================================================
--- root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/UIDivPanel.java (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/UIDivPanel.java 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,43 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import javax.faces.component.UIComponentBase;
+
+/**
+ * @author akolonitsky
+ * @since Jun 14, 2010
+ */
+public class UIDivPanel extends UIComponentBase {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.panels.Div";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.panels.Div";
+
+ public UIDivPanel() {
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+}
Added: root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/UISwitchablePanel.java
===================================================================
--- root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/UISwitchablePanel.java (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/UISwitchablePanel.java 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,72 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+/**
+ * @author akolonitsky
+ * @since Jun 15, 2010
+ */
+public class UISwitchablePanel extends AbstractSwitchablePanel {
+
+ private enum PropertyKeys {
+ activeState,
+ initialState,
+ statesOrder,
+ switchMode,
+ }
+
+ @Override
+ public String getActiveState() {
+ return (String) getStateHelper().eval(PropertyKeys.activeState);
+ }
+
+ public void setActiveState(String activeState) {
+ getStateHelper().put(PropertyKeys.activeState, activeState);
+ }
+
+ @Override
+ public String getInitialState() {
+ return (String) getStateHelper().eval(PropertyKeys.initialState);
+ }
+
+ public void setInitialState(String initialState) {
+ getStateHelper().put(PropertyKeys.initialState, initialState);
+ }
+
+ @Override
+ public String getStatesOrder() {
+ return (String) getStateHelper().eval(PropertyKeys.statesOrder);
+ }
+
+ public void setStatesOrder(String statesOrder) {
+ getStateHelper().put(PropertyKeys.statesOrder, statesOrder);
+ }
+
+ @Override
+ public Mode getSwitchMode() {
+ return (Mode) getStateHelper().eval(PropertyKeys.switchMode, Mode.AJAX);
+ }
+
+ public void setSwitchMode(Mode switchMode) {
+ getStateHelper().put(PropertyKeys.switchMode, switchMode);
+ }
+}
Added: root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/UISwitchablePanelImpl.java
===================================================================
--- root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/UISwitchablePanelImpl.java (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/UISwitchablePanelImpl.java 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,262 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import org.richfaces.event.SwitchablePanelSwitchEvent;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIInput;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.ValueChangeEvent;
+import java.io.Serializable;
+import java.util.Iterator;
+
+/**
+ * @author Nick Belaevski - nbelaevski(a)exadel.com
+ * created 23.01.2007
+ */
+public abstract class UISwitchablePanelImpl extends UIInput implements Serializable {
+
+ /**
+ * value for tab change method - ajax tabs
+ */
+ public static final String AJAX_METHOD = "ajax";
+
+ /**
+ * value for tab change method for - client-side tabs.
+ */
+ public static final String CLIENT_METHOD = "client";
+
+ /**
+ * value for tab change method - server-side tabs
+ */
+ public static final String SERVER_METHOD = "server";
+
+ /**
+ * default tab change method - server.
+ */
+ public static final String DEFAULT_METHOD = SERVER_METHOD;
+ private String switchType;
+
+ public String getSwitchType() {
+ if (this.switchType != null) {
+ return switchType;
+ }
+
+ ValueExpression switchTypeExpression = getValueExpression("switchType");
+
+ if (switchTypeExpression != null) {
+ return (String) switchTypeExpression.getValue(FacesContext.getCurrentInstance().getELContext());
+ }
+
+ return DEFAULT_METHOD;
+ }
+
+ public void setSwitchType(String switchType) {
+ this.switchType = switchType;
+ }
+
+ public Object convertSwitchValue(UIComponent component, Object object) {
+ return object;
+ }
+
+ public void queueEvent(FacesEvent event) {
+ if ((event instanceof SwitchablePanelSwitchEvent) && this.equals(event.getComponent())) {
+ if (isImmediate()) {
+ event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+ } else {
+ event.setPhaseId(PhaseId.UPDATE_MODEL_VALUES);
+ }
+ }
+
+ super.queueEvent(event);
+ }
+
+ public void broadcast(FacesEvent facesEvent) throws AbortProcessingException {
+ if (facesEvent instanceof ActionEvent) {
+
+ // TODO invoke action listener or remove it
+ if (isImmediate()) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+
+ facesContext.renderResponse();
+ }
+ } // TODO else here
+
+ if (facesEvent instanceof SwitchablePanelSwitchEvent) {
+ if (isRendered()) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ SwitchablePanelSwitchEvent switchEvent = (SwitchablePanelSwitchEvent) facesEvent;
+ Object newValue = convertSwitchValue(switchEvent.getEventSource(), switchEvent.getValue());
+ Object oldValue = getValue();
+
+ if (((oldValue == null) && (newValue != null)) || ((oldValue != null) && !oldValue.equals(newValue))) {
+ queueEvent(new ValueChangeEvent(this, oldValue, newValue));
+ }
+
+ // TODO UIInput should update the model, not the switchable panel itself
+ ValueExpression valueBinding = getValueExpression("value");
+
+ if (valueBinding != null) {
+ valueBinding.setValue(facesContext.getELContext(), newValue);
+ setValue(null);
+ setLocalValueSet(false);
+ } else {
+ setValue(newValue);
+ }
+
+ if (AjaxRendererUtils.isAjaxRequest(facesContext)
+
+ /* && this.getSwitchType().equals(AJAX_METHOD) */
+ ) { // RF-7292
+ AjaxRendererUtils.addRegionByName(facesContext, this, this.getId());
+ }
+ }
+ } else /* component should throw IllegalArgumentException for unknown events - RF-30 */ {
+ super.broadcast(facesEvent);
+ }
+ }
+
+ public void updateModel(FacesContext context) {
+
+ // no processing here
+ }
+
+ protected Iterator<UIComponent> getSwitchedFacetsAndChildren() {
+ return getFacetsAndChildren();
+ }
+
+ public void processDecodes(FacesContext context) {
+ if (context == null) {
+ throw new NullPointerException("FacesContext is null!");
+ }
+
+ if (!isRendered()) {
+ return;
+ }
+
+ // Process all facets and children of this component
+ Iterator<UIComponent> kids = getSwitchedFacetsAndChildren();
+
+ while (kids.hasNext()) {
+ UIComponent kid = kids.next();
+
+ kid.processDecodes(context);
+ }
+
+// try {
+ decode(context);
+
+ if (isImmediate()) {
+ validate(context);
+ }
+// } catch (RuntimeException e) {
+// context.renderResponse();
+//
+// throw e;
+// }
+ }
+
+ public void processUpdates(FacesContext context) {
+ if (context == null) {
+ throw new NullPointerException("FacesContext is null!");
+ }
+
+ if (!isRendered()) {
+ return;
+ }
+
+ Iterator<UIComponent> kids = getSwitchedFacetsAndChildren();
+
+ while (kids.hasNext()) {
+ UIComponent kid = kids.next();
+
+ kid.processUpdates(context);
+ }
+
+// try {
+ updateModel(context);
+
+ if (!isValid()) {
+ context.renderResponse();
+ }
+// } catch (RuntimeException e) {
+// context.renderResponse();
+//
+// throw e;
+// }
+ }
+
+ public void processValidators(FacesContext context) {
+ if (context == null) {
+ throw new NullPointerException("FacesContext is null!");
+ }
+
+ if (!isRendered()) {
+ return;
+ }
+
+ Iterator<UIComponent> kids = getSwitchedFacetsAndChildren();
+
+ while (kids.hasNext()) {
+ UIComponent kid = (UIComponent) kids.next();
+
+ kid.processValidators(context);
+ }
+
+// try {
+ if (!isImmediate()) {
+ validate(context);
+
+ if (!isValid()) {
+ context.renderResponse();
+ }
+ }
+// } catch (RuntimeException e) {
+// context.renderResponse();
+//
+// throw e;
+// }
+ }
+
+ public Object saveState(FacesContext context) {
+ Object[] states = new Object[2];
+
+ states[0] = super.saveState(context);
+ states[1] = switchType;
+
+ return states;
+ }
+
+ public void restoreState(FacesContext context, Object state) {
+ Object[] states = (Object[]) state;
+
+ super.restoreState(context, states[0]);
+ this.switchType = (String) states[1];
+ }
+}
Added: root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/UISwitchablePanela.java
===================================================================
--- root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/UISwitchablePanela.java (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/component/UISwitchablePanela.java 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,166 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import org.richfaces.event.SwitchablePanelSwitchEvent;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIInput;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.ValueChangeEvent;
+
+/**
+ * @author Nick Belaevski - nbelaevski(a)exadel.com
+ * created 23.01.2007
+ */
+public abstract class UISwitchablePanela extends UIInput {
+
+ /**
+ * default tab change method - server.
+ */
+ public static final Method DEFAULT_METHOD = Method.ajax;
+
+ private Method switchType;
+
+ public Method getSwitchType() {
+ if (this.switchType != null) {
+ return switchType;
+ }
+
+ ValueBinding switchTypeBinding = getValueBinding("switchType");
+ if (switchTypeBinding != null) {
+ return (Method) switchTypeBinding.getValue(FacesContext.getCurrentInstance());
+ }
+
+ return DEFAULT_METHOD;
+ }
+
+ public void setSwitchType(Method switchType) {
+ this.switchType = switchType;
+ }
+
+ public Object convertSwitchValue(UIComponent component, Object object) {
+ return object;
+ }
+
+ @Override
+ public void queueEvent(FacesEvent event) {
+
+ if (event instanceof SwitchablePanelSwitchEvent && this.equals(event.getComponent())) {
+ if (isImmediate()) {
+ event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+ } else {
+ event.setPhaseId(PhaseId.UPDATE_MODEL_VALUES);
+ }
+ }
+
+ super.queueEvent(event);
+ }
+
+ @Override
+ public void broadcast(FacesEvent facesEvent) throws AbortProcessingException {
+
+ if (facesEvent instanceof ActionEvent) {
+ //TODO invoke action listener or remove it
+ if (isImmediate()) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ facesContext.renderResponse();
+ }
+ } //TODO else here
+
+
+ if (facesEvent instanceof SwitchablePanelSwitchEvent) {
+ if (isRendered()) {
+ switchPanels(facesEvent);
+ }
+ } else /* component should throw IllegalArgumentException for unknown events - RF-30 */ {
+ super.broadcast(facesEvent);
+ }
+ }
+
+ private void switchPanels(FacesEvent facesEvent) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+
+ SwitchablePanelSwitchEvent switchEvent = (SwitchablePanelSwitchEvent) facesEvent;
+ Object newValue = convertSwitchValue(switchEvent.getEventSource(),
+ switchEvent.getValue());
+
+ Object oldValue = getValue();
+ if ((oldValue == null && newValue != null) ||
+ (oldValue != null && !oldValue.equals(newValue))) {
+
+ queueEvent(new ValueChangeEvent(this, oldValue, newValue));
+ }
+
+ //TODO UIInput should update the model, not the switchable panel itself
+ ValueExpression valueBinding = getValueExpression("value");
+ if (valueBinding != null) {
+ valueBinding.setValue(facesContext.getELContext(), newValue);
+ setValue(null);
+ setLocalValueSet(false);
+ } else {
+ setValue(newValue);
+ }
+ }
+
+ public void updateModel(FacesContext context) {
+ //no processing here
+ }
+
+ @Override
+ public void processDecodes(FacesContext context) {
+ super.processDecodes(context);
+ }
+
+ @Override
+ public void processUpdates(FacesContext context) {
+ super.processUpdates(context);
+ }
+
+ @Override
+ public void processValidators(FacesContext context) {
+ super.processValidators(context);
+ }
+
+ @Override
+ public Object saveState(FacesContext context) {
+ Object[] states = new Object[2];
+ states[0] = super.saveState(context);
+ states[1] = switchType;
+
+ return states;
+ }
+
+ @Override
+ public void restoreState(FacesContext context, Object state) {
+ Object[] states = (Object[]) state;
+ super.restoreState(context, states[0]);
+
+ this.switchType = (Method) states[1];
+ }
+}
\ No newline at end of file
Added: root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java
===================================================================
--- root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,11 @@
+package org.richfaces.renderkit.html;
+
+/**
+ * @author akolonitsky
+ * @version 1.0
+ * @created 11-Jun-2010 10:29:30 AM
+ */
+public class AccordionRenderer {
+
+
+}
\ No newline at end of file
Added: root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java
===================================================================
--- root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,90 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html;
+
+import org.ajax4jsf.renderkit.RendererBase;
+import org.ajax4jsf.renderkit.RendererUtils;
+import org.richfaces.component.UIDivPanel;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * @author akolonitsky
+ * @since Jun 14, 2010
+ */
+public class DivPanelRenderer extends RendererBase {
+
+ public static final String[] ATTRIBUTES = new String[] {
+ "lang",
+ "onclick",
+ "ondblclick",
+ "onmousedown",
+ "onmousemove",
+ "onmouseout",
+ "onmouseover",
+ "onmouseup",
+ "title",
+ "style",
+ "styleClass",
+ "dir",
+ };
+
+ public DivPanelRenderer() {
+ }
+
+ @Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ super.doEncodeBegin(writer, context, component);
+
+ writer.startElement(RendererUtils.HTML.DIV_ELEM, component);
+ writer.writeAttribute("id", component.getClientId(context), "clientId");
+
+ writeAttributes(writer, component, ATTRIBUTES);
+ }
+
+ private void writeAttributes(ResponseWriter writer, UIComponent component, String[] attributes) throws IOException {
+ Map<String,Object> componentAttributes = component.getAttributes();
+ for (String attrName : attributes) {
+ Object attrValue = componentAttributes.get(attrName);
+ if (attrValue != null) {
+ // TODO Use RendererUtils
+ writer.writeAttribute(attrName, attrValue, attrName);
+ }
+ }
+ }
+
+ @Override
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ super.doEncodeEnd(writer, context, component);
+
+ writer.endElement(RendererUtils.HTML.DIV_ELEM);
+ }
+
+ @Override
+ protected Class<? extends UIComponent> getComponentClass() {
+ return UIDivPanel.class;
+ }
+}
Added: root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/renderkit/html/SimplePanelRenderer.java
===================================================================
--- root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/renderkit/html/SimplePanelRenderer.java (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/renderkit/html/SimplePanelRenderer.java 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,46 @@
+package org.richfaces.renderkit.html;
+
+import org.ajax4jsf.renderkit.RendererBase;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import java.io.IOException;
+
+/**
+ * @author akolonitsky
+ * @version 1.0
+ * @created 11-Jun-2010 10:29:30 AM
+ */
+public class SimplePanelRenderer extends RendererBase {
+
+ /**
+ * TML layout for generated markup. Possible values: "block" for generating an
+ * HTML <div> element, "inline" for generating an HTML <span> element, and "none"
+ * for generating no HTML element. There is a minor exception for the "none" case
+ * where a child element has the property "rendered" set to "false". In this case,
+ * we create an empty <span> element with same ID as the child element to use as a
+ * placeholder for later processing. Default value is "inline"
+ */
+// private ${boolean} layout;
+// private ${UIComponent} binding;
+// private ${boolean} keepTransient;
+// private String id;
+// private ${boolean} rendered;
+// private ${String} title;
+// private ${String} lang;
+// private ${String} on*Event;
+// private ${String} style;
+// private ${String} styleClass;
+//
+
+ @Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ writer.append("<div>");
+ }
+
+ @Override
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ writer.append("</div>");
+ }
+}
\ No newline at end of file
Added: root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java
===================================================================
--- root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,10 @@
+package org.richfaces.renderkit.html;
+
+/**
+ * @author akolonitsky
+ * @version 1.0
+ * @created 11-Jun-2010 10:29:30 AM
+ */
+public class TabPanelRenderer {
+
+}
\ No newline at end of file
Added: root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java
===================================================================
--- root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,10 @@
+package org.richfaces.renderkit.html;
+
+/**
+ * @author akolonitsky
+ * @version 1.0
+ * @created 11-Jun-2010 10:29:30 AM
+ */
+public class ToggleControlRenderer {
+
+}
\ No newline at end of file
Added: root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/faces-config.xml
===================================================================
--- root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/faces-config.xml (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/faces-config.xml 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<faces-config version="2.0" metadata-complete="false"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
+ xmlns="http://java.sun.com/xml/ns/javaee" xmlns:cdk="http://richfaces.org/cdk/extensions"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <component>
+ <component-type>org.richfaces.panels.Div</component-type>
+ <component-class>org.richfaces.component.UIDivPanel</component-class>
+ <property>
+ <description>The value binding expression used to wire up this
+ component to a component property of a JavaBean class
+ </description>
+ <property-name>binding</property-name>
+ <property-class>javax.faces.component.UIComponent</property-class>
+ </property>
+ <property>
+ <description>
+ The component identifier for this component. This value must be
+ unique within the closest parent component that is a naming
+ container.
+ </description>
+ <display-name>Component Identifier</display-name>
+ <icon/>
+ <property-name>id</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description>
+ Flag indicating whether or not this component should be rendered
+ (during Render Response Phase), or processed on any subsequent
+ form submit. The default value for this property is true.
+ </description>
+ <display-name>Rendered Flag</display-name>
+ <icon/>
+ <property-name>rendered</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ </component>
+
+ <render-kit>
+ <render-kit-id>HTML_BASIC</render-kit-id>
+ <renderer>
+ <component-family>org.richfaces.panels.Div</component-family>
+ <renderer-type>org.richfaces.panels.DivRenderer</renderer-type>
+ <renderer-class>org.richfaces.renderkit.html.DivPanelRenderer</renderer-class>
+ </renderer>
+ </render-kit>
+ <faces-config-extension>
+ <cdk:taglib>
+ <cdk:shortName>panels</cdk:shortName>
+ <cdk:uri>http://richfaces.org/panels</cdk:uri>
+ </cdk:taglib>
+ </faces-config-extension>
+</faces-config>
Added: root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/panels.taglib.xml
===================================================================
--- root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/panels.taglib.xml (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/src/main/resources/META-INF/panels.taglib.xml 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd" version="2.0" id="a4j">
+ <namespace>http://richfaces.org/panels</namespace>
+ <tag>
+ <tag-name>divPanel</tag-name>
+ <component>
+ <component-type>org.richfaces.panels.Div</component-type>
+ <renderer-type>org.richfaces.panels.DivRenderer</renderer-type>
+ </component>
+
+ <!-- JSF -->
+ <attribute>
+ <description>The value binding expression used to wire up this component to a component property of a JavaBean class</description>
+ <name>binding</name>
+ <type>javax.faces.component.UIComponent</type>
+ </attribute>
+ <attribute>
+ <description>The component identifier for this component. This value must be unique within the closest parent component that is a naming container.</description>
+ <name>id</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description>Flag indicating whether or not this component should be rendered (during Render Response Phase), or processed on any subsequent form submit. The default value for this property is true.</description>
+ <name>rendered</name>
+ <type>boolean</type>
+ </attribute>
+
+ <!-- HTML JS -->
+ <attribute>
+ <name>lang</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <name>onclick</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <name>ondblclick</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <name>onmousedown</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <name>onmousemove</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <name>onmouseout</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <name>onmouseover</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <name>onmouseup</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <name>title</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <name>style</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <name>styleClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <name>dir</name>
+ <type>java.lang.String</type>
+ </attribute>
+ </tag>
+</facelet-taglib>
Added: root/ui-sandbox/panels/trunk/ui/src/test/java/org/richfaces/renderkit/html/DivPanelRendererTest.java
===================================================================
--- root/ui-sandbox/panels/trunk/ui/src/test/java/org/richfaces/renderkit/html/DivPanelRendererTest.java (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/src/test/java/org/richfaces/renderkit/html/DivPanelRendererTest.java 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,16 @@
+package org.richfaces.renderkit.html;
+
+import org.junit.Test;
+
+public class DivPanelRendererTest {
+
+ @Test
+ public void testFoo() throws Exception {
+
+// renderView("/test.jsf");
+// ajax(10, "test data X", createAjaxParameters());
+// ajax(1030, "test data Y", createAjaxParameters());
+// AbstractQueueComponentTest.TestsResult result = getTestsResult();
+// System.out.println(result.getCurrentTime());
+ }
+}
\ No newline at end of file
Added: root/ui-sandbox/panels/trunk/ui/target/checkstyle-checker.xml
===================================================================
--- root/ui-sandbox/panels/trunk/ui/target/checkstyle-checker.xml (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/target/checkstyle-checker.xml 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,320 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
+ "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
+<module name="Checker">
+ <property name="severity" value="error"/>
+ <module name="Translation"/>
+ <!--<module name="FileLength">-->
+ <!--<property name="max" value="1000"/>-->
+ <!--<property name="severity" value="warning"/>-->
+ <!--</module>-->
+
+ <module name="TreeWalker">
+ <property name="severity" value="error"/>
+
+ <!-- Checks for Javadoc comments. -->
+ <!-- See http://checkstyle.sourceforge.net/config_javadoc.html -->
+ <module name="JavadocType">
+ <property name="severity" value="warning"/>
+ </module>
+ <module name="JavadocVariable">
+ <property name="scope" value="public"/>
+ <property name="severity" value="warning"/>
+ </module>
+ <module name="JavadocStyle">
+ <property name="checkEmptyJavadoc" value="true"/>
+ <property name="checkFirstSentence" value="false"/>
+ <property name="severity" value="warning"/>
+ </module>
+ </module>
+
+ <module name="TreeWalker">
+ <!-- Checks for Naming Conventions. -->
+ <!-- See http://checkstyle.sourceforge.net/config_naming.html -->
+ <module name="ConstantName">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="LocalFinalVariableName">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="LocalVariableName">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="MemberName">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="MethodName">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="PackageName">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="ParameterName">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="StaticVariableName">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="TypeName">
+ <property name="severity" value="error"/>
+ </module>
+ </module>
+
+ <module name="TreeWalker">
+ <!-- Checks for imports -->
+ <!-- See http://checkstyle.sourceforge.net/config_import.html -->
+ <module name="AvoidStarImport">
+ <property name="severity" value="warning"/>
+ </module>
+ <module name="IllegalImport">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="RedundantImport">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="UnusedImports">
+ <property name="severity" value="error"/>
+ </module>
+ </module>
+
+ <module name="TreeWalker">
+ <!-- Checks for Size Violations. -->
+ <!-- See http://checkstyle.sourceforge.net/config_sizes.html -->
+ <module name="LineLength">
+ <property name="max" value="120"/>
+ <property name="severity" value="warning"/>
+ </module>
+ <module name="MethodLength">
+ <property name="tokens" value="METHOD_DEF"/>
+ <property name="max" value="60"/>
+ <!-- I think must be 30 -->
+ <property name="countEmpty" value="false"/>
+ <property name="severity" value="warning"/>
+ </module>
+ <module name="AnonInnerLength">
+ <property name="max" value="40"/>
+ <property name="severity" value="error"/>
+ </module>
+ <module name="ParameterNumber">
+ <property name="severity" value="warning"/>
+ </module>
+ </module>
+
+ <module name="TreeWalker">
+ <!-- Checks for whitespace -->
+ <!-- See http://checkstyle.sourceforge.net/config_whitespace.html -->
+ <!--<module name="TabCharacter"/>-->
+ <module name="EmptyForIteratorPad">
+ <property name="severity" value="info"/>
+ </module>
+ <module name="MethodParamPad">
+ <property name="severity" value="info"/>
+ </module>
+ <module name="NoWhitespaceAfter">
+ <property name="severity" value="info"/>
+ </module>
+ <module name="NoWhitespaceBefore">
+ <property name="severity" value="info"/>
+ </module>
+ <module name="OperatorWrap">
+ <property name="severity" value="info"/>
+ </module>
+ <module name="ParenPad">
+ <property name="severity" value="info"/>
+ </module>
+ <module name="TypecastParenPad">
+ <property name="tokens" value="RPAREN,TYPECAST"/>
+ <property name="severity" value="info"/>
+ </module>
+ <module name="WhitespaceAfter">
+ <property name="severity" value="info"/>
+ </module>
+ <module name="WhitespaceAround">
+ <property name="tokens"
+ value="ASSIGN,BAND,BAND_ASSIGN,BOR,BOR_ASSIGN,BSR,BSR_ASSIGN,
+ BXOR,BXOR_ASSIGN,COLON,DIV,DIV_ASSIGN,EQUAL,GE,GT,LAND,LE,LITERAL_ASSERT,
+ LITERAL_CATCH,LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_FOR,LITERAL_IF,
+ LITERAL_RETURN,LITERAL_SYNCHRONIZED,LITERAL_TRY,LITERAL_WHILE,LOR,LT,MINUS,MINUS_ASSIGN,
+ MOD,MOD_ASSIGN,NOT_EQUAL,PLUS,PLUS_ASSIGN,QUESTION,SL,SLIST,SL_ASSIGN,SR,
+ SR_ASSIGN,STAR,STAR_ASSIGN,LITERAL_ASSERT,TYPE_EXTENSION_AND"/>
+ <property name="severity" value="info"/>
+ </module>
+ </module>
+
+ <module name="TreeWalker">
+ <!-- Modifier Checks -->
+ <!-- See http://checkstyle.sourceforge.net/config_modifier.html -->
+ <module name="ModifierOrder">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="RedundantModifier">
+ <property name="severity" value="info"/>
+ </module>
+
+ <!-- Checks for blocks. You know, those {}'s -->
+ <!-- http://checkstyle.sourceforge.net/config_blocks.html -->
+ <module name="AvoidNestedBlocks">
+ <property name="allowInSwitchCase" value="true"/>
+ <property name="severity" value="error"/>
+ </module>
+ <module name="EmptyBlock">
+ <property name="option" value="text"/>
+ <property name="severity" value="error"/>
+ </module>
+ <module name="LeftCurly">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="NeedBraces">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="RightCurly">
+ <property name="severity" value="error"/>
+ </module>
+ </module>
+
+ <module name="TreeWalker">
+ <!-- Checks for common coding problems -->
+ <!-- See http://checkstyle.sourceforge.net/config_coding.html -->
+ <module name="CovariantEquals">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="DoubleCheckedLocking">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="EmptyStatement">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="EqualsHashCode">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="IllegalInstantiation">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="InnerAssignment">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="MagicNumber">
+ <property name="ignoreNumbers" value="-1, 0, 1"/>
+ <property name="severity" value="warning"/>
+ <!-- TODO <property name="severity" value="error"/> -->
+ </module>
+ <module name="MissingSwitchDefault">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="ModifiedControlVariable">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="SimplifyBooleanExpression">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="SimplifyBooleanReturn">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="StringLiteralEquality">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="NestedIfDepth">
+ <property name="max" value="3"/>
+ <property name="severity" value="warning"/>
+ </module>
+ <module name="NestedTryDepth">
+ <property name="max" value="3"/>
+ <property name="severity" value="error"/>
+ </module>
+ <module name="IllegalCatch">
+ <property name="illegalClassNames"
+ value="java.lang.Throwable, java.lang.RuntimeException, java.lang.Error"/>
+ <property name="severity" value="error"/>
+ </module>
+
+ <!-- desable besause - http://jira.codehaus.org/browse/MCHECKSTYLE-111 -->
+ <!-- <module name="IllegalThrows"/> -->
+ <!-- <module name="RedundantThrows"> -->
+ <!-- <property name="severity" value="warning"/> -->
+ <!-- TODO <property name="severity" value="error"/>-->
+ <!-- </module> -->
+ <!--<module name="JavadocMethod">-->
+ <!--<property name="scope" value="public"/>-->
+ <!--<property name="severity" value="warning"/>-->
+ <!--<property name="allowMissingThrowsTags" value="true"/>-->
+ <!--</module>-->
+
+ <module name="ParameterAssignment">
+ <property name="severity" value="warning"/>
+ <!-- TODO <property name="severity" value="error"/>-->
+ </module>
+ <module name="DefaultComesLast">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="FallThrough">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="MultipleVariableDeclarations">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="UnnecessaryParentheses">
+ <property name="severity" value="info"/>
+ </module>
+ </module>
+
+ <module name="TreeWalker">
+ <!-- Checks for class design -->
+ <!-- See http://checkstyle.sourceforge.net/config_design.html -->
+ <module name="FinalClass">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="HideUtilityClassConstructor">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="InterfaceIsType">
+ <property name="severity" value="warning"/>
+ </module>
+ <module name="VisibilityModifier">
+ <property name="packageAllowed" value="true"/>
+ <property name="protectedAllowed" value="true"/>
+ <property name="severity" value="error"/>
+ </module>
+ </module>
+
+ <module name="TreeWalker">
+ <!-- Miscellaneous other checks. -->
+ <!-- See http://checkstyle.sourceforge.net/config_metrics.html -->
+ <module name="CyclomaticComplexity">
+ <property name="severity" value="warning"/>
+ </module>
+
+ <!-- Miscellaneous other checks. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html -->
+ <module name="ArrayTypeStyle">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="UpperEll">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="ParameterName">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="DeclarationOrder">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="FallThrough">
+ <property name="severity" value="error"/>
+ </module>
+ <module name="HiddenField">
+ <property name="tokens" value="VARIABLE_DEF"/>
+ <property name="severity" value="info"/>
+ </module>
+ <module name="UncommentedMain">
+ <property name="severity" value="warning"/>
+ </module>
+ <module name="TodoComment">
+ <property name="format" value="TODO"/>
+ <property name="severity" value="warning"/>
+ </module>
+
+ <module name="Indentation">
+ <property name="severity" value="error"/>
+ </module>
+ </module>
+</module>
Added: root/ui-sandbox/panels/trunk/ui/target/checkstyle-header.txt
===================================================================
--- root/ui-sandbox/panels/trunk/ui/target/checkstyle-header.txt (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/target/checkstyle-header.txt 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
Added: root/ui-sandbox/panels/trunk/ui/target/checkstyle-result.xml
===================================================================
--- root/ui-sandbox/panels/trunk/ui/target/checkstyle-result.xml (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/target/checkstyle-result.xml 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,336 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<checkstyle version="4.4">
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractSwitchablePanel.java">
+<error line="13" severity="warning" message="Javadoc has empty description section." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
+<error line="20" column="5" severity="warning" message="Missing a Javadoc comment." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck"/>
+<error line="22" column="5" severity="warning" message="Missing a Javadoc comment." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractTitledPanel.java">
+<error line="5" severity="warning" message="Javadoc has empty description section." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractToggleControl.java">
+<error line="11" severity="warning" message="Javadoc has empty description section." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractToggledPanel.java">
+<error line="7" severity="warning" message="Javadoc has empty description section." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\Method.java">
+<error line="3" severity="warning" message="Javadoc has empty description section." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\NamedPanel.java">
+<error line="3" severity="warning" message="Javadoc has empty description section." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\TitledPanel.java">
+<error line="3" severity="warning" message="Javadoc has empty description section." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UIDivPanel.java">
+<error line="26" severity="warning" message="Javadoc has empty description section." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
+<error line="32" column="5" severity="warning" message="Missing a Javadoc comment." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck"/>
+<error line="34" column="5" severity="warning" message="Missing a Javadoc comment." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UISwitchablePanel.java">
+<error line="24" severity="warning" message="Javadoc has empty description section." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
+<error line="30" severity="warning" message="Missing a Javadoc comment." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTypeCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UISwitchablePanela.java">
+<error line="37" severity="warning" message="Javadoc has empty description section." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UISwitchablePanelImpl.java">
+<error line="39" severity="warning" message="Javadoc has empty description section." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\AccordionRenderer.java">
+<error line="3" severity="warning" message="Javadoc has empty description section." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\DivPanelRenderer.java">
+<error line="34" severity="warning" message="Javadoc has empty description section." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
+<error line="40" column="5" severity="warning" message="Missing a Javadoc comment." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\SimplePanelRenderer.java">
+<error line="10" severity="warning" message="Javadoc has empty description section." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
+<error line="19" column="13" severity="warning" message="Unclosed HTML tag found: <div> element, "inline" for generating an HTML <span> elemen" source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
+<error line="19" column="60" severity="warning" message="Unclosed HTML tag found: <span> element, and "none"" source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\TabPanelRenderer.java">
+<error line="3" severity="warning" message="Javadoc has empty description section." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\ToggleControlRenderer.java">
+<error line="3" severity="warning" message="Javadoc has empty description section." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractSwitchablePanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractTitledPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractToggleControl.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractToggledPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\Method.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\NamedPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\TitledPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UIDivPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UISwitchablePanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UISwitchablePanela.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UISwitchablePanelImpl.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\AccordionRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\DivPanelRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\SimplePanelRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\TabPanelRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\ToggleControlRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractSwitchablePanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractTitledPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractToggleControl.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractToggledPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\Method.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\NamedPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\TitledPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UIDivPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UISwitchablePanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UISwitchablePanela.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UISwitchablePanelImpl.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\AccordionRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\DivPanelRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\SimplePanelRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\TabPanelRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\ToggleControlRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractSwitchablePanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractTitledPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractToggleControl.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractToggledPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\Method.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\NamedPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\TitledPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UIDivPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UISwitchablePanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UISwitchablePanela.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UISwitchablePanelImpl.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\AccordionRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\DivPanelRenderer.java">
+<error line="59" severity="warning" message="Line is longer than 120 characters." source="com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\SimplePanelRenderer.java">
+<error line="38" severity="warning" message="Line is longer than 120 characters." source="com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\TabPanelRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\ToggleControlRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractSwitchablePanel.java">
+<error line="56" column="60" severity="info" message="'||' should be on a new line." source="com.puppycrawl.tools.checkstyle.checks.whitespace.OperatorWrapCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractTitledPanel.java">
+<error line="14" column="28" severity="info" message="'{' is not preceded with whitespace." source="com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractToggleControl.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractToggledPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\Method.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\NamedPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\TitledPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UIDivPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UISwitchablePanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UISwitchablePanela.java">
+<error line="114" column="52" severity="info" message="'||' should be on a new line." source="com.puppycrawl.tools.checkstyle.checks.whitespace.OperatorWrapCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UISwitchablePanelImpl.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\AccordionRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\DivPanelRenderer.java">
+<error line="69" column="20" severity="info" message="',' is not followed by whitespace." source="com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\SimplePanelRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\TabPanelRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\ToggleControlRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractSwitchablePanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractTitledPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractToggleControl.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractToggledPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\Method.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\NamedPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\TitledPanel.java">
+<error line="10" column="5" severity="info" message="Redundant 'public' modifier." source="com.puppycrawl.tools.checkstyle.checks.modifier.RedundantModifierCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UIDivPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UISwitchablePanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UISwitchablePanela.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UISwitchablePanelImpl.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\AccordionRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\DivPanelRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\SimplePanelRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\TabPanelRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\ToggleControlRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractSwitchablePanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractTitledPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractToggleControl.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractToggledPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\Method.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\NamedPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\TitledPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UIDivPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UISwitchablePanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UISwitchablePanela.java">
+<error line="152" column="38" severity="warning" message="'2' is a magic number." source="com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UISwitchablePanelImpl.java">
+<error line="248" column="38" severity="warning" message="'2' is a magic number." source="com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\AccordionRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\DivPanelRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\SimplePanelRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\TabPanelRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\ToggleControlRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractSwitchablePanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractTitledPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractToggleControl.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractToggledPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\Method.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\NamedPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\TitledPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UIDivPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UISwitchablePanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UISwitchablePanela.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UISwitchablePanelImpl.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\AccordionRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\DivPanelRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\SimplePanelRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\TabPanelRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\ToggleControlRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractSwitchablePanel.java">
+<error line="41" severity="warning" message="Comment matches to-do format 'TODO'." source="com.puppycrawl.tools.checkstyle.checks.TodoCommentCheck"/>
+<error line="46" severity="warning" message="Comment matches to-do format 'TODO'." source="com.puppycrawl.tools.checkstyle.checks.TodoCommentCheck"/>
+<error line="62" severity="warning" message="Comment matches to-do format 'TODO'." source="com.puppycrawl.tools.checkstyle.checks.TodoCommentCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractTitledPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractToggleControl.java">
+<error line="25" severity="warning" message="Comment matches to-do format 'TODO'." source="com.puppycrawl.tools.checkstyle.checks.TodoCommentCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\AbstractToggledPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\Method.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\NamedPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\TitledPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UIDivPanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UISwitchablePanel.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UISwitchablePanela.java">
+<error line="89" severity="warning" message="Comment matches to-do format 'TODO'." source="com.puppycrawl.tools.checkstyle.checks.TodoCommentCheck"/>
+<error line="94" severity="warning" message="Comment matches to-do format 'TODO'." source="com.puppycrawl.tools.checkstyle.checks.TodoCommentCheck"/>
+<error line="120" severity="warning" message="Comment matches to-do format 'TODO'." source="com.puppycrawl.tools.checkstyle.checks.TodoCommentCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\component\UISwitchablePanelImpl.java">
+<error line="100" column="5" severity="warning" message="Cyclomatic Complexity is 11 (max allowed is 10)." source="com.puppycrawl.tools.checkstyle.checks.metrics.CyclomaticComplexityCheck"/>
+<error line="103" severity="warning" message="Comment matches to-do format 'TODO'." source="com.puppycrawl.tools.checkstyle.checks.TodoCommentCheck"/>
+<error line="109" severity="warning" message="Comment matches to-do format 'TODO'." source="com.puppycrawl.tools.checkstyle.checks.TodoCommentCheck"/>
+<error line="122" severity="warning" message="Comment matches to-do format 'TODO'." source="com.puppycrawl.tools.checkstyle.checks.TodoCommentCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\AccordionRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\DivPanelRenderer.java">
+<error line="73" severity="warning" message="Comment matches to-do format 'TODO'." source="com.puppycrawl.tools.checkstyle.checks.TodoCommentCheck"/>
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\SimplePanelRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\TabPanelRenderer.java">
+</file>
+<file name="E:\_richfaces\svn\richfaces_root_full_assembler\ui-sandbox\panels\trunk\ui\src\main\java\org\richfaces\renderkit\html\ToggleControlRenderer.java">
+</file>
+</checkstyle>
Added: root/ui-sandbox/panels/trunk/ui/target/generated-sources/main/resources/META-INF/faces-config.xml
===================================================================
--- root/ui-sandbox/panels/trunk/ui/target/generated-sources/main/resources/META-INF/faces-config.xml (rev 0)
+++ root/ui-sandbox/panels/trunk/ui/target/generated-sources/main/resources/META-INF/faces-config.xml 2010-06-15 15:50:35 UTC (rev 17626)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<faces-config version="2.0" metadata-complete="false" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:cdk="http://richfaces.org/cdk/extensions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <faces-config-extension>
+ <cdk:taglib>
+ <cdk:shortName>a4j</cdk:shortName>
+ <cdk:uri>http://richfaces.org/a4j</cdk:uri>
+ </cdk:taglib>
+ </faces-config-extension>
+</faces-config>
Added: root/ui-sandbox/panels/trunk/ui/target/richfaces-ui-panels-ui-4.0.0-SNAPSHOT-sources.jar
===================================================================
(Binary files differ)
Property changes on: root/ui-sandbox/panels/trunk/ui/target/richfaces-ui-panels-ui-4.0.0-SNAPSHOT-sources.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: root/ui-sandbox/panels/trunk/ui/target/richfaces-ui-panels-ui-4.0.0-SNAPSHOT.jar
===================================================================
(Binary files differ)
Property changes on: root/ui-sandbox/panels/trunk/ui/target/richfaces-ui-panels-ui-4.0.0-SNAPSHOT.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
14 years, 6 months
JBoss Rich Faces SVN: r17625 - in root/core/branches/jsr-330: api/src/main/java/org/ajax4jsf/cache and 16 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-06-14 13:58:38 -0400 (Mon, 14 Jun 2010)
New Revision: 17625
Added:
root/core/branches/jsr-330/impl/src/main/resources/org/ajax4jsf/cache/ehcache-failsafe-richfaces.xml
root/core/branches/jsr-330/impl/src/test/java/org/ajax4jsf/cache/lru/
root/core/branches/jsr-330/impl/src/test/java/org/ajax4jsf/cache/lru/CacheMapTest.java
Removed:
root/core/branches/jsr-330/impl/src/test/java/org/ajax4jsf/cache/lru/CacheMapTest.java
root/core/branches/jsr-330/impl/src/test/resources/oscache.properties
Modified:
root/core/branches/jsr-330/
root/core/branches/jsr-330/api/src/main/java/org/ajax4jsf/cache/CacheFactory.java
root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/ResourceParameter.java
root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/UserResource.java
root/core/branches/jsr-330/api/src/main/java/org/richfaces/skin/Skin.java
root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/CacheManager.java
root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/EhCacheCache.java
root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/EhCacheCacheFactory.java
root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/JBossCacheCacheFactory.java
root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/OSCacheCacheFactory.java
root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/lru/CacheEntry.java
root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/lru/LRUMapCacheFactory.java
root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java
root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/resource/InternetResourceService.java
root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/util/LRUMap.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/DependencyInjectionServiceImpl.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/InitializationListener.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/ServiceTrackerLockPhaseListener.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/AbstractBaseResource.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/ResourceParameterELResolver.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/UserResourceAdaptor.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/skin/BasicSkinImpl.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/skin/SkinBean.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/util/Util.java
root/core/branches/jsr-330/impl/src/main/resources/org/ajax4jsf/cache/oscache.properties
root/core/branches/jsr-330/impl/src/test/java/org/ajax4jsf/cache/BaseCacheTest.java
root/core/branches/jsr-330/impl/src/test/java/org/ajax4jsf/cache/LRUMapCacheTest.java
root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/StateHolderResourceImpl.java
Log:
Merged revisions 17619-17621,17623 via svnmerge from
https://svn.jboss.org/repos/richfaces/root/core/trunk
.......
r17619 | nbelaevski | 2010-06-12 15:25:33 -0700 (Sat, 12 Jun 2010) | 3 lines
Resources framework redesigned to work with MyFaces 2.0
Added support for maximum cache size parameter
Unit tests for resources fwk updated
.......
r17620 | nbelaevski | 2010-06-12 16:44:51 -0700 (Sat, 12 Jun 2010) | 1 line
Added missing Cache#start operation
.......
r17621 | nbelaevski | 2010-06-12 17:41:34 -0700 (Sat, 12 Jun 2010) | 1 line
Restored handling of StateHolder interface for resources
.......
r17623 | nbelaevski | 2010-06-13 10:38:26 -0700 (Sun, 13 Jun 2010) | 4 lines
@ResourceParameter handling updates:
- Removed 'value', added 'name' & 'expression' attributes
TODOs committed
.......
Property changes on: root/core/branches/jsr-330
___________________________________________________________________
Name: svnmerge-integrated
- /root/core/trunk:1-17598
+ /root/core/trunk:1-17624
Modified: root/core/branches/jsr-330/api/src/main/java/org/ajax4jsf/cache/CacheFactory.java
===================================================================
--- root/core/branches/jsr-330/api/src/main/java/org/ajax4jsf/cache/CacheFactory.java 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/api/src/main/java/org/ajax4jsf/cache/CacheFactory.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -25,6 +25,8 @@
import java.util.Map;
+import javax.faces.context.FacesContext;
+
/**
* CacheFactory is a service provider specific interface.
* Service provider should implement CacheFactory to provide
@@ -41,5 +43,7 @@
* @return an implementation specific Cache object.
* @throws CacheException if any error occurs.
*/
- public Cache createCache(Map<?, ?> env);
+ public Cache createCache(FacesContext facesContext, String cacheName, Map<?, ?> env);
+
+ public void destroy();
}
Modified: root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/ResourceParameter.java
===================================================================
--- root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/ResourceParameter.java 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/ResourceParameter.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -33,8 +33,25 @@
@Target({ElementType.FIELD, ElementType.METHOD})
public @interface ResourceParameter {
- public String value();
-
+ /**
+ * Name of the parameter to be injected. Defaults to property name if it is omitted.
+ *
+ * @return name
+ */
+ public String name() default "";
+
+ /**
+ * Expression, which value is injected into the property.
+ *
+ * @return
+ */
+ public String expression() default "";
+
+ /**
+ * Default value for injected property.
+ *
+ * @return
+ */
public String defaultValue() default "";
}
Modified: root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/UserResource.java
===================================================================
--- root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/UserResource.java 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/UserResource.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -30,6 +30,7 @@
* @author Nick Belaevski
*
*/
+//TODO nick - add abstract class
public interface UserResource {
public Map<String, String> getResponseHeaders();
Modified: root/core/branches/jsr-330/api/src/main/java/org/richfaces/skin/Skin.java
===================================================================
--- root/core/branches/jsr-330/api/src/main/java/org/richfaces/skin/Skin.java 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/api/src/main/java/org/richfaces/skin/Skin.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -269,7 +269,7 @@
* @param context -
* {@link FacesContext } for current request.
* @param name
- * name of paremeter.
+ * name of parameter.
* @return value of parameter in config, or null
*/
public Object getParameter(FacesContext context, String name);
@@ -288,9 +288,36 @@
public Object getParameter(FacesContext context, String name, Object defaultValue);
/**
+ * Get value for configuration parameter & interpret it as color string.
+ * If parameter set as EL-expression, calculate it value.
+ *
+ * @param context -
+ * {@link FacesContext } for current request.
* @param name
+ * name of parameter.
+ * @return value of parameter in config, or null
+ * @since 4.0.M1
+ */
+ public Integer getColorParameter(FacesContext context, String name);
+
+ /**
+ * Get value for configuration parameter & interpret it as color string.
+ * If parameter set as EL-expression, calculate it value.
+ *
+ * @param context -
+ * {@link FacesContext } for current request.
+ * @param name
+ * name of parameter.
+ * @param defaultValue - default value if parameter not present in Skin
* @return
+ * @since 4.0.M1
*/
+ public Integer getColorParameter(FacesContext context, String name, Object defaultValue);
+
+ /**
+ * @param name
+ * @return
+ */
public boolean containsProperty(String name);
/**
Modified: root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/CacheManager.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/CacheManager.java 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/CacheManager.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -23,11 +23,12 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.text.MessageFormat;
-import java.util.Collections;
-import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
+import javax.faces.context.FacesContext;
+
import org.ajax4jsf.cache.lru.LRUMapCacheFactory;
import org.ajax4jsf.resource.util.URLToStreamHelper;
import org.richfaces.log.RichfacesLogger;
@@ -44,39 +45,23 @@
"org.ajax4jsf.cache.EhCacheCacheFactory"};
private static final String FACTORY_PROPERTY_NAME = "org.ajax4jsf.cache.CacheFactory";
private static final Logger LOG = RichfacesLogger.CACHE.getLogger();
- private static final CacheManager INSTANCE = new CacheManager();
- // REVIEW brian(a)quiotix.com
- // Should this be a HashMap<String, WeakReference<Cache>>?
- private final Map<String, Cache> caches = Collections.synchronizedMap(new HashMap<String, Cache>());
+ private CacheFactory cacheFactory;
+
+ private final Map<String, Cache> caches = new ConcurrentHashMap<String, Cache>(1, 0.75f, 1);
- /**
- * Returns the singleton CacheManager
- */
- public static CacheManager getInstance() {
- return INSTANCE;
- }
-
public Cache getCache(String cacheName) {
return caches.get(cacheName);
}
- public Cache getNewCache(String cacheName, Map<?, ?> env) {
- createCache(cacheName, env);
-
- return getCache(cacheName);
- }
-
- public void registerCache(String cacheName, Cache cache) {
- caches.put(cacheName, cache);
- }
-
- public void createCache(String cacheName, Map<?, ?> env) {
+ public Cache createCache(FacesContext facesContext, String cacheName, Map<?, ?> env) {
CacheFactory factory = getCacheFactory(env);
- Cache cache = factory.createCache(env);
-
- registerCache(cacheName, cache);
+ Cache cache = factory.createCache(facesContext, cacheName, env);
cache.start();
+
+ caches.put(cacheName, cache);
+
+ return cache;
}
public void destroyCache(String cacheName) {
@@ -85,7 +70,11 @@
cache.stop();
}
- public CacheFactory getCacheFactory(Map<?, ?> env) {
+ private CacheFactory getCacheFactory(Map<?, ?> env) {
+ if (cacheFactory != null) {
+ return cacheFactory;
+ }
+
String[] factories;
String configuredFactoryName = findFactory(FACTORY_PROPERTY_NAME, env);
@@ -101,20 +90,22 @@
for (String factoryName : factories) {
try {
Class<?> spiClass = Class.forName(factoryName, true, loader);
- CacheFactory cacheFactory = CacheFactory.class.cast(spiClass.newInstance());
-
+ cacheFactory = CacheFactory.class.cast(spiClass.newInstance());
LOG.info(MessageFormat.format("Selected [{0}]", factoryName));
-
- return cacheFactory;
- } catch (Throwable iae) {
-
+ break;
+ } catch (LinkageError iae) {
// TODO LOG debug
+ } catch (Exception e) {
+ // TODO LOG debug
}
}
- LOG.info("Selected fallback cache factory");
-
- return new LRUMapCacheFactory();
+ if (cacheFactory == null) {
+ cacheFactory = new LRUMapCacheFactory();
+ LOG.info("Selected fallback cache factory");
+ }
+
+ return cacheFactory;
}
public Map<String, Cache> getCaches() {
@@ -237,5 +228,9 @@
for (String cacheName : caches.keySet()) {
destroyCache(cacheName);
}
+
+ if (cacheFactory != null) {
+ cacheFactory.destroy();
+ }
}
}
Modified: root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/EhCacheCache.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/EhCacheCache.java 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/EhCacheCache.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -3,30 +3,37 @@
*/
package org.ajax4jsf.cache;
+import java.util.Date;
+
import net.sf.ehcache.Ehcache;
import net.sf.ehcache.Element;
-import java.util.Date;
-
/**
* @author Nick Belaevski
* @since 4.0
*/
public class EhCacheCache implements org.ajax4jsf.cache.Cache {
+
private net.sf.ehcache.Ehcache cache;
-
- public EhCacheCache(Ehcache cache) {
+ private boolean preconfiguredCache;
+
+ public EhCacheCache(Ehcache cache, boolean preconfiguredCache) {
super();
this.cache = cache;
+ this.preconfiguredCache = preconfiguredCache;
}
public void start() {
- cache.initialise();
- cache.bootstrap();
+ if (!preconfiguredCache) {
+ cache.initialise();
+ cache.bootstrap();
+ }
}
public void stop() {
- cache.dispose();
+ if (!preconfiguredCache) {
+ cache.dispose();
+ }
}
public Object get(Object key) {
Modified: root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/EhCacheCacheFactory.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/EhCacheCacheFactory.java 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/EhCacheCacheFactory.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -3,23 +3,74 @@
*/
package org.ajax4jsf.cache;
+import java.net.URL;
+import java.text.MessageFormat;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import net.sf.ehcache.CacheManager;
+import net.sf.ehcache.Ehcache;
+
+import org.ajax4jsf.context.ContextInitParameters;
import org.richfaces.log.RichfacesLogger;
import org.slf4j.Logger;
-import java.util.Map;
-
/**
* @author Nick Belaevski
* @since 4.0
*/
public class EhCacheCacheFactory implements CacheFactory {
+
private static final Logger LOG = RichfacesLogger.CACHE.getLogger();
- public Cache createCache(Map<?, ?> env) {
- LOG.info("Creating EhCache cache instance");
+ private CacheManager cacheManager;
+
+ public EhCacheCacheFactory() {
+ super();
+
+ URL configUrl = null;
+
+ ClassLoader ccl = Thread.currentThread().getContextClassLoader();
+ if (ccl != null) {
+ configUrl = ccl.getResource("ehcache.xml");
+ }
- net.sf.ehcache.Ehcache cache = new net.sf.ehcache.Cache("org.richfaces", 256, false, true, 0, 0);
+ if (configUrl != null) {
+ LOG.info(MessageFormat.format("Using cache configuration: {0}", configUrl.toExternalForm()));
+ } else {
+ configUrl = EhCacheCacheFactory.class.getResource("ehcache-failsafe-richfaces.xml");
+ LOG.info(MessageFormat.format("Using default cache configuration: {0}", configUrl.toExternalForm()));
+ }
- return new EhCacheCache(cache);
+ cacheManager = CacheManager.create(configUrl);
}
+
+ public Cache createCache(FacesContext facesContext, String cacheName, Map<?, ?> env) {
+ LOG.info("Creating EhCache cache instance");
+
+ int maxCacheSize = ContextInitParameters.getResourcesCacheSize(facesContext);
+ boolean preconfiguredCache = false;
+
+ Ehcache ehcache = cacheManager.getEhcache(cacheName);
+ if (ehcache == null) {
+ ehcache = new net.sf.ehcache.Cache(cacheName, maxCacheSize, false, true, 0, 0);
+ } else {
+ preconfiguredCache = true;
+
+ if (ehcache.getCacheConfiguration().getMaxElementsInMemory() <= 0) {
+ LOG.info(MessageFormat.format("Maximum cache size hasn''t been set, resetting to {0} max items", maxCacheSize));
+
+ ehcache.getCacheConfiguration().setMaxElementsInMemory(maxCacheSize);
+ }
+ }
+
+ return new EhCacheCache(ehcache, preconfiguredCache);
+ }
+
+ public void destroy() {
+ cacheManager.shutdown();
+ cacheManager = null;
+ }
+
}
Modified: root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/JBossCacheCacheFactory.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/JBossCacheCacheFactory.java 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/JBossCacheCacheFactory.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -3,28 +3,37 @@
*/
package org.ajax4jsf.cache;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.text.MessageFormat;
+import java.util.Map;
+
+import javax.faces.FacesException;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.context.ContextInitParameters;
import org.ajax4jsf.resource.util.URLToStreamHelper;
import org.jboss.cache.Cache;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.EvictionAlgorithmConfig;
import org.jboss.cache.config.EvictionConfig;
import org.jboss.cache.config.EvictionRegionConfig;
+import org.jboss.cache.eviction.EvictionAlgorithmConfigBase;
import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
+import org.richfaces.log.RichfacesLogger;
+import org.slf4j.Logger;
-import javax.faces.FacesException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Map;
-
/**
* @author Nick Belaevski
* @since 4.0
*/
+public class JBossCacheCacheFactory implements CacheFactory {
-//TODO - to doc - no max size eviction support
-public class JBossCacheCacheFactory implements CacheFactory {
+ private static final Logger LOG = RichfacesLogger.CACHE.getLogger();
+
private org.jboss.cache.CacheFactory<String, Object> cacheFactory;
public JBossCacheCacheFactory() {
@@ -32,13 +41,29 @@
cacheFactory = new DefaultCacheFactory<String, Object>();
}
- public org.ajax4jsf.cache.Cache createCache(Map<?, ?> env) {
+ private void setupMaxSizeEviction(FacesContext facesContext, Cache<String, Object> cache) {
+ EvictionConfig evictionConfig = cache.getConfiguration().getEvictionConfig();
+ EvictionAlgorithmConfig evictionAlgorithmConfig = evictionConfig.getDefaultEvictionRegionConfig().
+ getEvictionAlgorithmConfig();
+
+ if (evictionAlgorithmConfig instanceof EvictionAlgorithmConfigBase) {
+ EvictionAlgorithmConfigBase baseEvicitonConfig = (EvictionAlgorithmConfigBase) evictionAlgorithmConfig;
+ if (baseEvicitonConfig.getMaxNodes() <= 0) {
+ int maxCacheSize = ContextInitParameters.getResourcesCacheSize(facesContext);
+ LOG.info(MessageFormat.format("Maximum cache size hasn''t been set, resetting to {0} max items", maxCacheSize));
+ baseEvicitonConfig.setMaxNodes(maxCacheSize);
+ }
+ }
+ }
+
+ public org.ajax4jsf.cache.Cache createCache(FacesContext facesContext, String cacheName, Map<?, ?> env) {
+ //TODO - handle cache name
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
Cache<String, Object> cache = null;
URL cacheConfigurationURL = null;
if (contextClassLoader != null) {
- cacheConfigurationURL = contextClassLoader.getResource("/jboss-cache.xml");
+ cacheConfigurationURL = contextClassLoader.getResource("jboss-cache.xml");
}
if (cacheConfigurationURL != null) {
@@ -47,6 +72,7 @@
try {
stream = URLToStreamHelper.urlToStream(cacheConfigurationURL);
cache = cacheFactory.createCache(stream);
+ setupMaxSizeEviction(facesContext, cache);
} catch (IOException e) {
throw new FacesException(e.getLocalizedMessage(), e);
} finally {
@@ -64,7 +90,8 @@
Configuration configuration = new Configuration();
EvictionRegionConfig evictionRegionConfig = new EvictionRegionConfig(Fqn.root());
ExpirationAlgorithmConfig expirationAlgorithm = new ExpirationAlgorithmConfig();
-
+ expirationAlgorithm.setMaxNodes(ContextInitParameters.getResourcesCacheSize(facesContext));
+
evictionRegionConfig.setEvictionAlgorithmConfig(expirationAlgorithm);
EvictionConfig evictionConfig = new EvictionConfig(evictionRegionConfig);
@@ -73,7 +100,11 @@
configuration.setEvictionConfig(evictionConfig);
cache = cacheFactory.createCache(configuration);
}
-
+
return new JBossCacheCache(cache);
}
+
+ public void destroy() {
+ cacheFactory = null;
+ }
}
Modified: root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/OSCacheCacheFactory.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/OSCacheCacheFactory.java 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/OSCacheCacheFactory.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -21,24 +21,35 @@
package org.ajax4jsf.cache;
-import com.opensymphony.oscache.general.GeneralCacheAdministrator;
-import org.ajax4jsf.resource.util.URLToStreamHelper;
-import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
-
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
import java.util.Properties;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.context.ContextInitParameters;
+import org.ajax4jsf.resource.util.URLToStreamHelper;
+import org.richfaces.log.RichfacesLogger;
+import org.slf4j.Logger;
+
+import com.opensymphony.oscache.base.AbstractCacheAdministrator;
+import com.opensymphony.oscache.general.GeneralCacheAdministrator;
+
/**
* @author Nick - mailto:nbelaevski@exadel.com
* created 01.05.2007
*/
public class OSCacheCacheFactory implements CacheFactory {
+
private static final Logger LOG = RichfacesLogger.CACHE.getLogger();
+ private List<GeneralCacheAdministrator> cacheAdministrators = new ArrayList<GeneralCacheAdministrator>(1);
+
private static Properties loadProperties() throws IOException {
Properties properties = new Properties();
URL resource = OSCacheCache.class.getResource("oscache.properties");
@@ -61,7 +72,8 @@
return properties;
}
- public Cache createCache(Map<?, ?> env) {
+ public Cache createCache(FacesContext facesContext, String cacheName, Map<?, ?> env) {
+ //TODO - handle cache name
Properties cacheProperties = new Properties();
try {
@@ -83,8 +95,24 @@
cacheProperties.putAll(env);
LOG.info("Creating OSCache cache instance using parameters: " + cacheProperties);
+ String property = cacheProperties.getProperty(AbstractCacheAdministrator.CACHE_CAPACITY_KEY);
+ if (property == null) {
+ int maxCacheSize = ContextInitParameters.getResourcesCacheSize(facesContext);
+ LOG.info(MessageFormat.format("Maximum cache size hasn''t been set, resetting to {0} max items", maxCacheSize));
+ cacheProperties.put(AbstractCacheAdministrator.CACHE_CAPACITY_KEY,
+ Integer.toString(maxCacheSize));
+ }
+
GeneralCacheAdministrator cacheAdministrator = new GeneralCacheAdministrator(cacheProperties);
-
+ cacheAdministrators.add(cacheAdministrator);
return new OSCacheCache(cacheAdministrator.getCache());
}
+
+ public void destroy() {
+ for (GeneralCacheAdministrator cacheAdministrator : cacheAdministrators) {
+ cacheAdministrator.destroy();
+ }
+
+ cacheAdministrators = null;
+ }
}
Modified: root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/lru/CacheEntry.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/lru/CacheEntry.java 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/lru/CacheEntry.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -108,6 +108,6 @@
@Override
public String toString() {
- return (expired == null) ? key.toString() : key + ": " + expired;
+ return "<CacheEntry> " + ((expired == null) ? key.toString() : key + ": " + expired);
}
}
Modified: root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/lru/LRUMapCacheFactory.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/lru/LRUMapCacheFactory.java 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/cache/lru/LRUMapCacheFactory.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -21,13 +21,16 @@
package org.ajax4jsf.cache.lru;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
import org.ajax4jsf.cache.Cache;
import org.ajax4jsf.cache.CacheFactory;
+import org.ajax4jsf.context.ContextInitParameters;
import org.richfaces.log.RichfacesLogger;
import org.slf4j.Logger;
-import java.util.Map;
-
/**
* @author Nick - mailto:nbelaevski@exadel.com
* created 01.05.2007
@@ -36,21 +39,22 @@
public static final String CACHE_SIZE_PARAMETER = "org.ajax4jsf.cache.LRU_MAP_CACHE_SIZE";
private static final Logger LOG = RichfacesLogger.CACHE.getLogger();
- public Cache createCache(Map<?, ?> env) {
+ public Cache createCache(FacesContext facesContext, String cacheName, Map<?, ?> env) {
+ //TODO - handle cache name
LOG.info("Creating LRUMap cache instance using parameters: " + env);
String size = (String) env.get(CACHE_SIZE_PARAMETER);
-
if ((size == null) || (size.length() == 0)) {
- LOG.info("Creating LRUMap cache instance of default capacity");
+ size = Integer.toString(ContextInitParameters.getResourcesCacheSize(facesContext));
+ }
- return new LRUMapCache();
- } else {
- int parsedSize = Integer.parseInt(size);
+ int parsedSize = Integer.parseInt(size);
- LOG.info("Creating LRUMap cache instance of " + parsedSize + " items capacity");
+ LOG.info("Creating LRUMap cache instance of " + parsedSize + " items capacity");
- return new LRUMapCache(parsedSize);
- }
+ return new LRUMapCache(parsedSize);
}
+
+ public void destroy() {
+ }
}
Modified: root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -57,8 +57,12 @@
public static final String[] QUEUE_ENABLED = {"org.richfaces.queue.enabled"};
//TODO - better name
- public static final String[] RESOURCES_TTL = {"org.richfaces.RESOURCE_DEFAULT_TTL"};
+ public static final String RESOURCES_TTL = "org.richfaces.RESOURCE_DEFAULT_TTL";
+ public static final String RESOURCES_CACHE_SIZE = "org.richfaces.RESOURCE_CACHE_SIZE";
+ private static final String[] RESOURCES_TTL_ARRAY = { RESOURCES_TTL };
+ private static final String[] RESOURCES_CACHE_SIZE_ARRAY = { RESOURCES_CACHE_SIZE };
+
private static final String INIT_PARAM_PREFIX = ContextInitParameters.class.getSimpleName() + ":";
private static final Object NULL = new Object() {
@@ -104,9 +108,13 @@
}
public static int getResourcesTimeToLive(FacesContext context) {
- return getInteger(context, RESOURCES_TTL, DEFAULT_TTL);
+ return getInteger(context, RESOURCES_TTL_ARRAY, DEFAULT_TTL);
}
+ public static int getResourcesCacheSize(FacesContext context) {
+ return getInteger(context, RESOURCES_CACHE_SIZE_ARRAY, 512);
+ }
+
/**
* Method for determining STD_CONTROLS_SKINNING_CLASSES_PARAM parameter
*
Modified: root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/resource/InternetResourceService.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/resource/InternetResourceService.java 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/resource/InternetResourceService.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -21,16 +21,10 @@
package org.ajax4jsf.resource;
-import org.ajax4jsf.Messages;
-import org.ajax4jsf.cache.Cache;
-import org.ajax4jsf.cache.CacheFactory;
-import org.ajax4jsf.cache.CacheManager;
-import org.ajax4jsf.cache.ServletContextInitMap;
-import org.ajax4jsf.resource.util.URLToStreamHelper;
-import org.ajax4jsf.webapp.BaseFilter;
-import org.ajax4jsf.webapp.WebXml;
-import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Map;
+import java.util.Properties;
import javax.faces.FacesException;
import javax.faces.FactoryFinder;
@@ -43,11 +37,17 @@
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Map;
-import java.util.Properties;
+import org.ajax4jsf.Messages;
+import org.ajax4jsf.cache.Cache;
+import org.ajax4jsf.cache.CacheManager;
+import org.ajax4jsf.cache.ServletContextInitMap;
+import org.ajax4jsf.resource.util.URLToStreamHelper;
+import org.ajax4jsf.webapp.BaseFilter;
+import org.ajax4jsf.webapp.WebXml;
+import org.richfaces.log.RichfacesLogger;
+import org.slf4j.Logger;
+
public class InternetResourceService {
static final String ENABLE_CACHING_PARAMETER = "enable-cache";
private static final String RESOURCE_LIFECYCLE_PARAMETER = "org.ajax4jsf.RESOURCE_LIFECYCLE";
@@ -85,11 +85,9 @@
// this.cacheAdmin = ServletCacheAdministrator.getInstance(
// servletContext, cacheProperties);
- CacheManager cacheManager = CacheManager.getInstance();
+ CacheManager cacheManager = new CacheManager();
Map<String, String> env = new ServletContextInitMap(servletContext);
- CacheFactory cacheFactory = cacheManager.getCacheFactory(env);
-
- this.cache = cacheFactory.createCache(env);
+ this.cache = cacheManager.createCache(FacesContext.getCurrentInstance(), "org.richfaces.resources", env);
}
// Create Resource-specific Faces Lifecycle instance.
Modified: root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/util/LRUMap.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/util/LRUMap.java 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/util/LRUMap.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -43,7 +43,7 @@
* Default capacity constructor
*/
public LRUMap() {
- this(100);
+ this(1000);
}
/**
Modified: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/DependencyInjectionServiceImpl.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/DependencyInjectionServiceImpl.java 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/DependencyInjectionServiceImpl.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -45,6 +45,7 @@
import org.richfaces.log.RichfacesLogger;
import org.richfaces.resource.PostConstructResource;
import org.richfaces.resource.ResourceParameter;
+import org.richfaces.resource.ResourceParameterELResolver;
import org.slf4j.Logger;
/**
@@ -113,10 +114,33 @@
expectedType = propertyType;
}
- Object propertyValue = getExpressionValue(context, getDependency().value(), expectedType);
+ ResourceParameter resourceParameter = getDependency();
+ String expression = resourceParameter.expression();
+ String name = resourceParameter.name();
+
+ if (expression.length() != 0 && name.length() != 0) {
+ throw new IllegalStateException(MessageFormat.format(
+ "'name' and 'expression' should not be specified simultaneously: {0}",
+ resourceParameter));
+ }
+
+ Object propertyValue = null;
+ if (expression.length() != 0) {
+ propertyValue = getExpressionValue(context, expression, expectedType);
+ } else {
+ if (name.length() == 0) {
+ name = getPropertyDescriptor().getName();
+ }
+
+ Map<String, Object> parameters = (Map<String, Object>) context.getAttributes().get(
+ ResourceParameterELResolver.CONTEXT_ATTRIBUTE_NAME);
+
+ propertyValue = parameters.get(name);
+ }
+
if (propertyValue == null || "".equals(propertyValue)) {
- String defaultValue = getDependency().defaultValue();
+ String defaultValue = resourceParameter.defaultValue();
if (defaultValue != null && defaultValue.length() != 0) {
propertyValue = getExpressionValue(context, defaultValue, expectedType);
}
Modified: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/InitializationListener.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/InitializationListener.java 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/InitializationListener.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -28,6 +28,7 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.text.MessageFormat;
+import java.util.Map;
import javax.faces.FacesException;
import javax.faces.context.FacesContext;
@@ -37,12 +38,14 @@
import javax.faces.event.SystemEvent;
import javax.faces.event.SystemEventListener;
+import org.ajax4jsf.cache.Cache;
import org.ajax4jsf.cache.CacheManager;
import org.ajax4jsf.renderkit.AJAXDataSerializer;
import org.ajax4jsf.resource.util.URLToStreamHelper;
import org.richfaces.log.RichfacesLogger;
import org.richfaces.resource.DefaultResourceCodec;
import org.richfaces.resource.ResourceCodec;
+import org.richfaces.resource.ResourceHandlerImpl;
import org.richfaces.skin.SkinFactory;
import org.richfaces.skin.SkinFactoryImpl;
import org.slf4j.Logger;
@@ -57,6 +60,8 @@
private static final Logger LOG = RichfacesLogger.APPLICATION.getLogger();
+ private static final String CACHE_MANAGER_ATTRIBUTE_NAME = InitializationListener.class.getName() + ":CacheManager";
+
/* (non-Javadoc)
* @see javax.faces.event.SystemEventListener#isListenerForSource(java.lang.Object)
*/
@@ -150,6 +155,19 @@
return instantiate(interfaceClass, implementationClass, defaultImplementationClass);
}
+ private CacheManager createAndStoreCacheManager(FacesContext context) {
+ CacheManager cacheManager = new CacheManager();
+ Map<String, Object> applicationMap = context.getExternalContext().getApplicationMap();
+ applicationMap.put(CACHE_MANAGER_ATTRIBUTE_NAME, cacheManager);
+
+ return cacheManager;
+ }
+
+ private CacheManager getStoredCacheManager(FacesContext context) {
+ Map<String, Object> applicationMap = context.getExternalContext().getApplicationMap();
+ return (CacheManager) applicationMap.get(CACHE_MANAGER_ATTRIBUTE_NAME);
+ }
+
protected void onStart() {
FacesContext facesContext = FacesContext.getCurrentInstance();
@@ -165,13 +183,21 @@
ResourceCodec resourceCodec = createServiceInstance(ResourceCodec.class, DefaultResourceCodec.class);
ServiceTracker.setService(facesContext, ResourceCodec.class, resourceCodec);
+
+ CacheManager cacheManager = createAndStoreCacheManager(facesContext);
+
+ Map<?, ?> envMap = facesContext.getExternalContext().getInitParameterMap();
+ Cache cache = cacheManager.createCache(facesContext, ResourceHandlerImpl.RESOURCE_CACHE_NAME, envMap);
+ ServiceTracker.setService(facesContext, Cache.class, cache);
}
protected void onStop() {
FacesContext facesContext = FacesContext.getCurrentInstance();
+ CacheManager cacheManager = getStoredCacheManager(facesContext);
+ cacheManager.destroy();
+
ServiceTracker.release(facesContext);
- CacheManager.getInstance().destroy();
}
/* (non-Javadoc)
Modified: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/ServiceTrackerLockPhaseListener.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/ServiceTrackerLockPhaseListener.java 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/application/ServiceTrackerLockPhaseListener.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -27,8 +27,11 @@
import javax.faces.lifecycle.Lifecycle;
/**
+ * As service tracker is filled by application startup listeners,
+ * we can't rely on some "locking" system listener that's the last in chain,
+ * so PhaseListener does the job.
+ *
* @author Nick Belaevski
- *
*/
public class ServiceTrackerLockPhaseListener implements PhaseListener {
Modified: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/AbstractBaseResource.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/AbstractBaseResource.java 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/AbstractBaseResource.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -21,8 +21,6 @@
package org.richfaces.resource;
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
@@ -158,31 +156,7 @@
FacesContext context = FacesContext.getCurrentInstance();
ResourceCodec resourceCodec = ServiceTracker.getService(context, ResourceCodec.class);
String resourceName = getResourceName();
- Object resourceData = null;
-
- if (this instanceof StateHolderResource) {
- StateHolderResource stateHolder = (StateHolderResource) this;
-
- if (!stateHolder.isTransient()) {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- DataOutputStream oos = null;
- try {
- oos = new DataOutputStream(baos);
- stateHolder.writeState(context, oos);
- } catch (IOException e) {
- throw new FacesException(e.getMessage(), e);
- } finally {
- try {
- oos.close();
- } catch (IOException e) {
- LOGGER.debug(e.getMessage(), e);
- }
- }
-
- resourceData = baos.toByteArray();
- }
- }
-
+ Object resourceData = Util.saveResourceState(context, this);
String resourceVersion = getResourceVersion();
String resourceUri = resourceCodec.encodeResource(context, resourceName, resourceData, resourceVersion);
Modified: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -21,8 +21,6 @@
package org.richfaces.resource;
-import java.io.ByteArrayInputStream;
-import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -44,7 +42,6 @@
import javax.servlet.http.HttpServletResponse;
import org.ajax4jsf.cache.Cache;
-import org.ajax4jsf.cache.CacheManager;
import org.richfaces.application.DependencyInjectionService;
import org.richfaces.application.ServiceTracker;
import org.richfaces.log.RichfacesLogger;
@@ -58,7 +55,7 @@
*/
public class ResourceHandlerImpl extends ResourceHandlerWrapper {
public static final String RICHFACES_RESOURCE_IDENTIFIER = "/rfRes/";
- public static final String RESOURCE_CACHE_NAME = ResourceHandlerImpl.class.getName() + ":CACHE";
+ public static final String RESOURCE_CACHE_NAME = "org.richfaces.ResourcesCache";
public static final String HANDLER_START_TIME_ATTRIBUTE = ResourceHandlerImpl.class.getName() + ":StartTime";
private static final Logger LOGGER = RichfacesLogger.RESOURCE.getLogger();
@@ -80,7 +77,6 @@
}
}
- private Cache cache;
private ResourceHandler defaultHandler;
public ResourceHandlerImpl(ResourceHandler defaultHandler) {
@@ -89,18 +85,8 @@
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(MessageFormat.format("Instance of {0} resource handler created", getClass().getName()));
}
-
- FacesContext facesContext = FacesContext.getCurrentInstance();
-
- initializeCache(facesContext);
}
- private void initializeCache(FacesContext facesContext) {
- Map<?, ?> envMap = facesContext.getExternalContext().getInitParameterMap();
-
- cache = CacheManager.getInstance().getNewCache(RESOURCE_CACHE_NAME, envMap);
- }
-
protected static String getResourcePathFromRequest(FacesContext context) {
String resourceName = Util.decodeResourceURL(context);
@@ -139,7 +125,7 @@
return isThisHandlerResourceRequest(context) || defaultHandler.isResourceRequest(context);
}
- private Resource lookupInCache(FacesContext context, String resourceKey) {
+ private Resource lookupInCache(Cache cache, String resourceKey) {
Resource resource = (Resource) cache.get(resourceKey);
if (LOGGER.isDebugEnabled()) {
@@ -163,7 +149,7 @@
}
private void logResourceProblem(FacesContext context, Throwable throwable, String messagePattern,
- Object... arguments) {
+ Object... arguments) {
boolean isProductionStage = context.isProjectStage(ProjectStage.Production);
if (LOGGER.isWarnEnabled() || (!isProductionStage && LOGGER.isInfoEnabled())) {
@@ -195,14 +181,15 @@
ResourceCodec resourceCodec = ServiceTracker.getService(context, ResourceCodec.class);
String resourcePath = getResourcePathFromRequest(context);
-
+
assert (resourcePath != null) && (resourcePath.length() != 0);
String resourceKey = resourceCodec.getResourceKey(context, resourcePath);
assert (resourceKey != null) && (resourceKey.length() != 0);
- Resource resource = lookupInCache(context, resourceKey);
+ Cache cache = ServiceTracker.getService(context, Cache.class);
+ Resource resource = lookupInCache(cache, resourceKey);
if (resource == null) {
String resourceName = resourceCodec.decodeResourceName(context, resourcePath);
@@ -221,7 +208,7 @@
if (resource == null) {
resource = createHandlerDependentResource(resourceName, null);
}
-
+
if (resource == null) {
logMissingResource(context, resourceName);
sendResourceNotFound(context);
@@ -236,52 +223,32 @@
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(
- MessageFormat.format(
- "Client requested {0} version of resource, server has {1} version",
- String.valueOf(requestedVersion), String.valueOf(existingVersion)));
+ MessageFormat.format(
+ "Client requested {0} version of resource, server has {1} version",
+ String.valueOf(requestedVersion), String.valueOf(existingVersion)));
}
if ((existingVersion != null) && (requestedVersion != null)
- && !existingVersion.equals(requestedVersion)) {
+ && !existingVersion.equals(requestedVersion)) {
logResourceProblem(context, null, "Resource {0} of version {1} was not found", resourceName,
- requestedVersion);
+ requestedVersion);
sendResourceNotFound(context);
return;
}
}
- if (resource instanceof StateHolderResource) {
- StateHolderResource stateHolder = (StateHolderResource) resource;
- Object decodedData = resourceCodec.decodeResourceData(context, resourcePath);
+ Object decodedData = resourceCodec.decodeResourceData(context, resourcePath);
- if (LOGGER.isDebugEnabled()) {
- if (decodedData != null) {
- LOGGER.debug("Resource state data succesfully decoded");
- } else {
- LOGGER.debug("Resource state data decoded as null");
- }
- }
-
+ if (LOGGER.isDebugEnabled()) {
if (decodedData != null) {
- DataInputStream dis = null;
- try {
- dis = new DataInputStream(new ByteArrayInputStream((byte[]) decodedData));
- stateHolder.readState(context, dis);
- } finally {
- if (dis != null) {
- try {
- dis.close();
- } catch (IOException e) {
- LOGGER.debug(e.getMessage(), e);
- }
- }
- }
+ LOGGER.debug("Resource state data succesfully decoded");
} else {
-
- // resource was transient and didn't store data
+ LOGGER.debug("Resource state data decoded as null");
}
}
+
+ Util.restoreResourceState(context, resource, decodedData);
if (resource instanceof AbstractCacheableResource) {
AbstractCacheableResource cacheableResource = (AbstractCacheableResource) resource;
@@ -296,15 +263,15 @@
// someone may provided this resource for us
// while we were reading it, check once again
- resource = lookupInCache(context, resourceKey);
+ resource = lookupInCache(cache, resourceKey);
if (resource == null) {
Date cacheExpirationDate = cachedResource.getExpired(context);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(new MessageFormat(
- "Storing {0} resource in cache until {1,date,dd MMM yyyy HH:mm:ss zzz}", Locale.US).
- format(new Object[]{resourceKey, cacheExpirationDate}));
+ "Storing {0} resource in cache until {1,date,dd MMM yyyy HH:mm:ss zzz}", Locale.US).
+ format(new Object[]{resourceKey, cacheExpirationDate}));
}
cache.put(resourceKey, cachedResource, cacheExpirationDate);
@@ -392,7 +359,7 @@
protected void injectProperties(Object resource, Map<String, String> parameters) {
FacesContext facesContext = FacesContext.getCurrentInstance();
DependencyInjectionService diService = ServiceTracker.getService(facesContext, DependencyInjectionService.class);
-
+
Map<Object, Object> attributes = facesContext.getAttributes();
try {
attributes.put(ResourceParameterELResolver.CONTEXT_ATTRIBUTE_NAME, parameters);
@@ -401,7 +368,7 @@
attributes.remove(ResourceParameterELResolver.CONTEXT_ATTRIBUTE_NAME);
}
}
-
+
/**
* Should be called only if {@link #isResourceExists(String)} returns <code>true</code>
*
@@ -415,9 +382,9 @@
if (contextClassLoader != null) {
try {
Class<?> loadedClass = Class.forName(resourceName, false, contextClassLoader);
-
+
boolean legitimateResource = false;
-
+
DynamicResource annotation = loadedClass.getAnnotation(DynamicResource.class);
legitimateResource = (annotation != null);
if (legitimateResource) {
@@ -427,7 +394,7 @@
LOGGER.debug(
MessageFormat.format("Dynamic resource annotation is not present on resource class {0}", resourceName));
}
-
+
if (!legitimateResource) {
// TODO resource marker extension name?
URL resourceMarkerUrl = contextClassLoader.getResource("META-INF/" + resourceName + ".resource.properties");
@@ -444,7 +411,7 @@
}
}
}
-
+
if (legitimateResource) {
Object wrappedResource;
if (Java2DUserResource.class.isAssignableFrom(loadedClass)) {
@@ -460,15 +427,15 @@
resource = (Resource) resourceClass.newInstance();
wrappedResource = resource;
}
-
+
if (parameters != null) {
injectProperties(wrappedResource, parameters);
}
-
+
resource.setResourceName(resourceName);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(MessageFormat.format("Successfully created instance of {0} resource",
- resourceName));
+ resourceName));
}
}
} catch (ClassNotFoundException e) {
@@ -491,10 +458,11 @@
if (resourceName.lastIndexOf(".ecss") != -1) {
result = new CompiledCSSResource(resourceName);
} else {
+ //TODO nick - libraryName as package name?
if ((resourceName != null) && ((libraryName == null) || (libraryName.length() == 0))) {
result = createHandlerDependentResource(resourceName, params);
}
-
+
if (result == null) {
result = defaultHandler.createResource(resourceName, libraryName, contentType);
}
Modified: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/ResourceParameterELResolver.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/ResourceParameterELResolver.java 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/ResourceParameterELResolver.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -34,7 +34,7 @@
*/
public class ResourceParameterELResolver extends ELResolver {
- static final String CONTEXT_ATTRIBUTE_NAME = "rfResourceParam";
+ public static final String CONTEXT_ATTRIBUTE_NAME = "rfResourceParam";
@Override
public Class<?> getCommonPropertyType(ELContext context, Object base) {
Modified: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/UserResourceAdaptor.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/UserResourceAdaptor.java 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/UserResourceAdaptor.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -21,20 +21,21 @@
*/
package org.richfaces.resource;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
import java.util.Map;
+import javax.faces.component.StateHolder;
import javax.faces.context.FacesContext;
+import org.richfaces.util.Util;
+
/**
* @author Nick Belaevski
*
*/
-public class UserResourceAdaptor extends AbstractCacheableResource implements VersionedResource, StateHolderResource {
+public class UserResourceAdaptor extends AbstractCacheableResource implements VersionedResource, StateHolder {
private UserResource userResource;
@@ -126,20 +127,26 @@
if (wrappedResource instanceof StateHolderResource) {
return ((StateHolderResource) wrappedResource).isTransient();
}
+
+ if (wrappedResource instanceof StateHolder) {
+ return ((StateHolder) wrappedResource).isTransient();
+ }
return true;
}
- public void writeState(FacesContext context, DataOutput dataOutput) throws IOException {
- if (wrappedResource instanceof StateHolderResource) {
- ((StateHolderResource) wrappedResource).writeState(context, dataOutput);
+ public void setTransient(boolean newTransientValue) {
+ if (wrappedResource instanceof StateHolder) {
+ ((StateHolder) wrappedResource).setTransient(newTransientValue);
}
}
- public void readState(FacesContext context, DataInput dataInput) throws IOException {
- if (wrappedResource instanceof StateHolderResource) {
- ((StateHolderResource) wrappedResource).readState(context, dataInput);
- }
+ public Object saveState(FacesContext context) {
+ return Util.saveResourceState(context, wrappedResource);
}
+ public void restoreState(FacesContext context, Object state) {
+ Util.restoreResourceState(context, wrappedResource, state);
+ }
+
}
Modified: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/skin/BasicSkinImpl.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/skin/BasicSkinImpl.java 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/skin/BasicSkinImpl.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -21,15 +21,19 @@
package org.richfaces.skin;
-import javax.el.ValueExpression;
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
+import java.awt.Color;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
+import javax.el.ValueExpression;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.util.HtmlColor;
+
/**
* Singleton ( in respect as collection of different skins ) for produce
* instances properties for all used skins.
@@ -85,6 +89,29 @@
return value;
}
+ protected Integer decodeColor(Object value) {
+ if (value instanceof Color) {
+ return ((Color) value).getRGB();
+ } else if (value instanceof Integer) {
+ return ((Integer) value).intValue();
+ } else {
+ String stringValue = (String) value;
+ if (stringValue != null && stringValue.length() != 0) {
+ return Integer.valueOf(HtmlColor.decode(stringValue).getRGB());
+ } else {
+ return null;
+ }
+ }
+ }
+
+ public Integer getColorParameter(FacesContext context, String name) {
+ return decodeColor(getParameter(context, name));
+ }
+
+ public Integer getColorParameter(FacesContext context, String name, Object defaultValue) {
+ return decodeColor(getParameter(context, name, defaultValue));
+ }
+
protected Object getLocalParameter(FacesContext context, String name) {
return getValueReference(context, skinParams.get(name));
}
Modified: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/skin/SkinBean.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/skin/SkinBean.java 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/skin/SkinBean.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -21,12 +21,13 @@
package org.richfaces.skin;
-import javax.faces.context.FacesContext;
import java.nio.ByteBuffer;
import java.util.AbstractMap;
import java.util.Collections;
import java.util.Set;
+import javax.faces.context.FacesContext;
+
/**
* @author shura (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:59:40 $
@@ -142,4 +143,18 @@
return bs;
}
+
+ /* (non-Javadoc)
+ * @see org.richfaces.skin.Skin#getColorParameter(javax.faces.context.FacesContext, java.lang.String)
+ */
+ public Integer getColorParameter(FacesContext context, String name) {
+ return getSkin().getColorParameter(context, name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.skin.Skin#getColorParameter(javax.faces.context.FacesContext, java.lang.String, java.lang.Object)
+ */
+ public Integer getColorParameter(FacesContext context, String name, Object defaultValue) {
+ return getSkin().getColorParameter(context, name, defaultValue);
+ }
}
Modified: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/util/Util.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/util/Util.java 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/util/Util.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -43,6 +43,8 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
@@ -74,12 +76,14 @@
import javax.faces.FacesException;
import javax.faces.application.ViewHandler;
+import javax.faces.component.StateHolder;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import org.ajax4jsf.Messages;
import org.ajax4jsf.util.base64.Codec;
import org.richfaces.log.RichfacesLogger;
+import org.richfaces.resource.StateHolderResource;
import org.slf4j.Logger;
/**
@@ -548,4 +552,66 @@
return builder.toString();
}
+
+ public static Object saveResourceState(FacesContext context, Object resource) {
+ if (resource instanceof StateHolderResource) {
+ StateHolderResource stateHolderResource = (StateHolderResource) resource;
+ if (stateHolderResource.isTransient()) {
+ return null;
+ }
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ DataOutputStream dos = new DataOutputStream(baos);
+ try {
+ stateHolderResource.writeState(context, dos);
+ } catch (IOException e) {
+ throw new FacesException(e.getMessage(), e);
+ } finally {
+ try {
+ dos.close();
+ } catch (IOException e) {
+ RESOURCE_LOGGER.debug(e.getMessage(), e);
+ }
+ }
+
+ return baos.toByteArray();
+ } else if (resource instanceof StateHolder) {
+ StateHolder stateHolder = (StateHolder) resource;
+ if (stateHolder.isTransient()) {
+ return null;
+ }
+
+ return stateHolder.saveState(context);
+ }
+
+ return null;
+ }
+
+ public static void restoreResourceState(FacesContext context, Object resource, Object state) {
+ if (state == null) {
+ //transient resource hasn't provided any data
+ return;
+ }
+
+ if (resource instanceof StateHolderResource) {
+ StateHolderResource stateHolderResource = (StateHolderResource) resource;
+
+ ByteArrayInputStream bais = new ByteArrayInputStream((byte[]) state);
+ DataInputStream dis = new DataInputStream(bais);
+ try {
+ stateHolderResource.readState(context, dis);
+ } catch (IOException e) {
+ throw new FacesException(e.getMessage(), e);
+ } finally {
+ try {
+ dis.close();
+ } catch (IOException e) {
+ RESOURCE_LOGGER.debug(e.getMessage(), e);
+ }
+ }
+ } else if (resource instanceof StateHolder) {
+ StateHolder stateHolder = (StateHolder) resource;
+ stateHolder.restoreState(context, state);
+ }
+ }
}
Copied: root/core/branches/jsr-330/impl/src/main/resources/org/ajax4jsf/cache/ehcache-failsafe-richfaces.xml (from rev 17623, root/core/trunk/impl/src/main/resources/org/ajax4jsf/cache/ehcache-failsafe-richfaces.xml)
===================================================================
--- root/core/branches/jsr-330/impl/src/main/resources/org/ajax4jsf/cache/ehcache-failsafe-richfaces.xml (rev 0)
+++ root/core/branches/jsr-330/impl/src/main/resources/org/ajax4jsf/cache/ehcache-failsafe-richfaces.xml 2010-06-14 17:58:38 UTC (rev 17625)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd"
+ updateCheck="true" monitoring="off" dynamicConfig="true">
+
+ <diskStore path="java.io.tmpdir"/>
+
+ <!--
+ Mandatory Default Cache configuration. These settings will be
+ applied to caches created programmtically using
+ CacheManager.add(String cacheName). The defaultCache has an
+ implicit name "default" which is a reserved cache name.
+ -->
+ <defaultCache
+ maxElementsInMemory="10000"
+ eternal="false"
+ timeToIdleSeconds="120"
+ timeToLiveSeconds="120"
+ overflowToDisk="true"
+ maxElementsOnDisk="10000000"
+ diskPersistent="false"
+ diskExpiryThreadIntervalSeconds="120"
+ memoryStoreEvictionPolicy="LRU"
+ />
+</ehcache>
\ No newline at end of file
Modified: root/core/branches/jsr-330/impl/src/main/resources/org/ajax4jsf/cache/oscache.properties
===================================================================
--- root/core/branches/jsr-330/impl/src/main/resources/org/ajax4jsf/cache/oscache.properties 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/impl/src/main/resources/org/ajax4jsf/cache/oscache.properties 2010-06-14 17:58:38 UTC (rev 17625)
@@ -1,7 +1,7 @@
cache.memory = true
-cache.capacity = 10000
+#cache.capacity = 1000
cache.use.host.domain.in.key = true
-
+cache.blocking = true
# CACHE IN MEMORY
#
# If you want to disable memory caching, just uncomment this line.
@@ -104,9 +104,8 @@
# Default cache size in number of items. If a size is specified but not
# an algorithm, the cache algorithm used will be LRUCache.
#
-cache.capacity=1000
+# cache.capacity=1000
-
# CACHE UNLIMITED DISK
# Use unlimited disk cache or not. The default value is false, which means
# the disk cache will be limited in size to the value specified by cache.capacity.
Modified: root/core/branches/jsr-330/impl/src/test/java/org/ajax4jsf/cache/BaseCacheTest.java
===================================================================
--- root/core/branches/jsr-330/impl/src/test/java/org/ajax4jsf/cache/BaseCacheTest.java 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/impl/src/test/java/org/ajax4jsf/cache/BaseCacheTest.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -24,15 +24,24 @@
package org.ajax4jsf.cache;
import java.util.Date;
+import java.util.LinkedHashMap;
import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicBoolean;
+import org.ajax4jsf.context.ContextInitParameters;
import org.jboss.test.faces.AbstractFacesTest;
+import org.junit.Assert;
/**
* @author Nick Belaevski
* @since 4.0
*/
public abstract class BaseCacheTest extends AbstractFacesTest {
+
+ private int sizeLimit;
+
+ private CacheManager cacheManager;
private Cache cache;
private String cacheManagerFactoryClassName;
@@ -45,28 +54,33 @@
protected void setupJsfInitParameters() {
super.setupJsfInitParameters();
this.facesServer.addInitParameter(CacheManager.CACHE_MANAGER_FACTORY_CLASS, cacheManagerFactoryClassName);
+ this.facesServer.addInitParameter(ContextInitParameters.RESOURCES_CACHE_SIZE, Integer.toString(sizeLimit));
}
+ protected Cache getCache() {
+ return cache;
+ }
+
@Override
public void setUp() throws Exception {
+ sizeLimit = 64;
+
super.setUp();
+
setupFacesRequest();
- CacheManager cacheManager = CacheManager.getInstance();
+ cacheManager = new CacheManager();
+
Map<?, ?> initParameterMap = facesContext.getExternalContext().getInitParameterMap();
- this.cache = cacheManager.getCacheFactory(initParameterMap).createCache(initParameterMap);
- this.cache.start();
+ this.cache = cacheManager.createCache(facesContext, "test-cache", initParameterMap);
}
@Override
public void tearDown() throws Exception {
super.tearDown();
- if (this.cache != null) {
- this.cache.stop();
- this.cache = null;
- }
+ cacheManager.destroy();
}
public void testBasic() throws Exception {
@@ -84,6 +98,8 @@
cache.put("a", "value-a", new Date(expirationTime));
assertEquals("value-a", cache.get("a"));
+ cache.put("b", "value-b", new Date(expirationTime));
+ assertEquals("value-b", cache.get("b"));
// interval to reach 1 second before expiration time
sleepTime = expirationTime - 1000 - System.currentTimeMillis();
assertTrue(sleepTime > 0);
@@ -96,4 +112,115 @@
Thread.sleep(sleepTime);
assertNull(cache.get("a"));
}
+
+ public void testMaxSize() throws Exception {
+ Date expirationDate = new Date(System.currentTimeMillis() +
+ 3600000 /* one hour - this should be enough for our test */);
+
+ Map<String, String> data = new LinkedHashMap<String, String>();
+ for (int i = 0; i < sizeLimit; i++) {
+ String key = UUID.randomUUID().toString();
+ String value = UUID.randomUUID().toString();
+ data.put(key, value);
+ cache.put(key, value, expirationDate);
+ }
+
+ for (Map.Entry<String, String> entry : data.entrySet()) {
+ String key = entry.getKey();
+
+ Object cacheValue = cache.get(key);
+ assertEquals(entry.getValue(), cacheValue);
+ }
+
+ String extraEntryKey = UUID.randomUUID().toString();
+ String extraEntryValue = UUID.randomUUID().toString();
+ data.put(extraEntryKey, extraEntryValue);
+ cache.put(extraEntryKey, extraEntryValue, expirationDate);
+
+ //give cache time to evict
+ Thread.sleep(2000);
+
+ int nullCounter = 0;
+ for (Map.Entry<String, String> entry : data.entrySet()) {
+ String key = entry.getKey();
+
+ Object cacheValue = cache.get(key);
+ if (cacheValue == null) {
+ nullCounter++;
+ } else {
+ assertEquals(entry.getValue(), cacheValue);
+ }
+ }
+
+ assertTrue(nullCounter == 1);
+ }
+
+ public void testThreads() throws Exception {
+ final AtomicBoolean failure = new AtomicBoolean();
+
+ Thread[] writerThreads = new Thread[10];
+
+ for (int i = 0; i < writerThreads.length; i++) {
+ writerThreads[i] = new Thread() {
+ public void run() {
+ final String key = UUID.randomUUID().toString();
+ final String value = UUID.randomUUID().toString();
+
+ cache.put(key, value, null);
+
+ Thread[] threads = new Thread[25];
+
+ for (int j = 0; j < threads.length; j++) {
+ threads[j] = new Thread() {
+ @Override
+ public void run() {
+ int retries = 1000;
+
+ for (int k = 0; k < retries; k++) {
+ if (!value.equals(cache.get(key))) {
+ failure.set(true);
+
+ return;
+ }
+ }
+ }
+ };
+ }
+
+ for (Thread thread : threads) {
+ thread.start();
+ }
+
+ int retries = 1000;
+
+ for (int k = 0; k < retries; k++) {
+ if (!value.equals(cache.get(key))) {
+ failure.set(true);
+ }
+ }
+
+ for (Thread thread : threads) {
+ try {
+ thread.join();
+ } catch (InterruptedException e) {
+
+ // TODO Auto-generated catch block
+ failure.set(true);
+ }
+ }
+ }
+ ;
+ };
+ }
+
+ for (Thread thread : writerThreads) {
+ thread.start();
+ }
+
+ for (Thread thread : writerThreads) {
+ thread.join();
+ }
+
+ Assert.assertFalse(failure.get());
+ }
}
Modified: root/core/branches/jsr-330/impl/src/test/java/org/ajax4jsf/cache/LRUMapCacheTest.java
===================================================================
--- root/core/branches/jsr-330/impl/src/test/java/org/ajax4jsf/cache/LRUMapCacheTest.java 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/impl/src/test/java/org/ajax4jsf/cache/LRUMapCacheTest.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -23,182 +23,16 @@
package org.ajax4jsf.cache;
-import java.util.Date;
-import java.util.UUID;
-import java.util.concurrent.atomic.AtomicBoolean;
+import org.ajax4jsf.cache.lru.LRUMapCacheFactory;
-import org.ajax4jsf.cache.lru.CacheEntry;
-import org.ajax4jsf.cache.lru.CacheMap;
-import org.ajax4jsf.cache.lru.LRUMapCache;
-import org.junit.Assert;
-import org.junit.Test;
-
/**
* @author Nick Belaevski
* @since 4.0
*/
-public class LRUMapCacheTest {
- @Test
- public void testBasic() throws Exception {
- LRUMapCache cache = new LRUMapCache();
+public class LRUMapCacheTest extends BaseCacheTest {
- cache.start();
- Assert.assertNull(cache.get("key"));
- cache.put("key", "value", null);
- Assert.assertEquals("value", cache.get("key"));
- cache.stop();
+ public LRUMapCacheTest() {
+ super(LRUMapCacheFactory.class.getName());
}
-
- @Test
- public void testLRUEviction() throws Exception {
- LRUMapCache cache = new LRUMapCache(3);
-
- cache.start();
- cache.put("key1", "value1", null);
- cache.put("key2", "value2", null);
- cache.put("key3", "value3", null);
- Assert.assertEquals("value1", cache.get("key1"));
- Assert.assertEquals("value2", cache.get("key2"));
- Assert.assertEquals("value3", cache.get("key3"));
- cache.get("key1");
- cache.get("key3");
- cache.put("key4", "value4", null);
- Assert.assertEquals("value1", cache.get("key1"));
- Assert.assertNull(cache.get("key2"));
- Assert.assertEquals("value3", cache.get("key3"));
- Assert.assertEquals("value4", cache.get("key4"));
- cache.stop();
- }
-
- @Test
- public void testCacheMap() throws Exception {
- CacheMap cacheMap = new CacheMap();
-
- Assert.assertTrue(cacheMap.getExpirationQueue().isEmpty());
-
- CacheEntry cacheEntry = new CacheEntry("key", "value", new Date(System.currentTimeMillis() + 1000));
-
- cacheMap.put("key", cacheEntry);
- Assert.assertNotNull(cacheMap.get("key"));
- Assert.assertSame(cacheEntry, cacheMap.get("key"));
- Assert.assertFalse(cacheMap.getExpirationQueue().isEmpty());
- cacheMap.clear();
- Assert.assertTrue(cacheMap.getExpirationQueue().isEmpty());
- cacheMap.put("key2", new CacheEntry("key2", "value2", new Date(System.currentTimeMillis() + 1000)));
- Assert.assertNotNull(cacheMap.get("key2"));
- cacheMap.remove("key2");
- Assert.assertTrue(cacheMap.getExpirationQueue().isEmpty());
- }
-
- @Test
- public void testExpiration() throws Exception {
-
- // this test uses Thread.sleep, so may fail if debugged
- LRUMapCache cache = new LRUMapCache();
-
- cache.start();
-
- long baseTime = System.currentTimeMillis();
-
- cache.put("key", "value", new Date(baseTime + 2000));
- cache.put("key2", "value2", new Date(baseTime + 3000));
- cache.put("key3", "value3", new Date(baseTime + 1000));
- cache.put("key4", "value4", new Date(baseTime + 1000));
- Assert.assertEquals("value", cache.get("key"));
- Assert.assertEquals("value2", cache.get("key2"));
- Assert.assertEquals("value3", cache.get("key3"));
- Assert.assertEquals("value4", cache.get("key4"));
-
- // prolong key4
- cache.put("key4", "new value", new Date(baseTime + 2000));
- Thread.sleep(1500);
- Assert.assertEquals("value", cache.get("key"));
- Assert.assertEquals("value2", cache.get("key2"));
- Assert.assertNull(cache.get("key3"));
- Assert.assertEquals("new value", cache.get("key4"));
- Thread.sleep(1000);
- Assert.assertNull(cache.get("key"));
- Assert.assertEquals("value2", cache.get("key2"));
- Assert.assertNull(cache.get("key3"));
- Assert.assertNull(cache.get("key4"));
- Thread.sleep(1000);
- Assert.assertNull(cache.get("key"));
- Assert.assertNull(cache.get("key2"));
- Assert.assertNull(cache.get("key3"));
- cache.stop();
- }
-
- @Test
- public void testThreads() throws Exception {
- final AtomicBoolean failure = new AtomicBoolean();
- final LRUMapCache cache = new LRUMapCache();
-
- cache.start();
-
- Thread[] writerThreads = new Thread[10];
-
- for (int i = 0; i < writerThreads.length; i++) {
- writerThreads[i] = new Thread() {
- public void run() {
- final String key = UUID.randomUUID().toString();
- final String value = UUID.randomUUID().toString();
-
- cache.put(key, value, null);
-
- Thread[] threads = new Thread[25];
-
- for (int j = 0; j < threads.length; j++) {
- threads[j] = new Thread() {
- @Override
- public void run() {
- int retries = 1000;
-
- for (int k = 0; k < retries; k++) {
- if (!value.equals(cache.get(key))) {
- failure.set(true);
-
- return;
- }
- }
- }
- };
- }
-
- for (Thread thread : threads) {
- thread.start();
- }
-
- int retries = 1000;
-
- for (int k = 0; k < retries; k++) {
- if (!value.equals(cache.get(key))) {
- failure.set(true);
- }
- }
-
- for (Thread thread : threads) {
- try {
- thread.join();
- } catch (InterruptedException e) {
-
- // TODO Auto-generated catch block
- failure.set(true);
- }
- }
- }
- ;
- };
- }
-
- for (Thread thread : writerThreads) {
- thread.start();
- }
-
- for (Thread thread : writerThreads) {
- thread.join();
- }
-
- Assert.assertFalse(failure.get());
- cache.stop();
- }
+
}
Copied: root/core/branches/jsr-330/impl/src/test/java/org/ajax4jsf/cache/lru (from rev 17623, root/core/trunk/impl/src/test/java/org/ajax4jsf/cache/lru)
Deleted: root/core/branches/jsr-330/impl/src/test/java/org/ajax4jsf/cache/lru/CacheMapTest.java
===================================================================
--- root/core/trunk/impl/src/test/java/org/ajax4jsf/cache/lru/CacheMapTest.java 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/test/java/org/ajax4jsf/cache/lru/CacheMapTest.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -1,76 +0,0 @@
-/*
- * 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.ajax4jsf.cache.lru;
-
-import java.util.Date;
-
-import junit.framework.TestCase;
-
-import org.junit.Assert;
-
-
-/**
- * @author Nick Belaevski
- *
- */
-public class CacheMapTest extends TestCase {
-
- private void addToCacheMap(CacheMap cacheMap, String key, String value) {
- CacheEntry entry = new CacheEntry(key, value, null);
- cacheMap.put(key, entry);
- }
-
- public void testLRUEviction() throws Exception {
- CacheMap cache = new CacheMap(3);
- addToCacheMap(cache, "key1", "value1");
- addToCacheMap(cache, "key2", "value2");
- addToCacheMap(cache, "key3", "value3");
- Assert.assertEquals("value1", cache.get("key1").getValue());
- Assert.assertEquals("value2", cache.get("key2").getValue());
- Assert.assertEquals("value3", cache.get("key3").getValue());
- cache.get("key1");
- cache.get("key3");
- addToCacheMap(cache, "key4", "value4");
- Assert.assertEquals("value1", cache.get("key1").getValue());
- Assert.assertNull(cache.get("key2"));
- Assert.assertEquals("value3", cache.get("key3").getValue());
- Assert.assertEquals("value4", cache.get("key4").getValue());
- }
-
- public void testExpirationQueue() throws Exception {
- CacheMap cacheMap = new CacheMap();
-
- Assert.assertTrue(cacheMap.getExpirationQueue().isEmpty());
-
- CacheEntry cacheEntry = new CacheEntry("key", "value", new Date(System.currentTimeMillis() + 1000));
- cacheMap.put("key", cacheEntry);
- Assert.assertNotNull(cacheMap.get("key"));
- Assert.assertSame(cacheEntry, cacheMap.get("key"));
- Assert.assertFalse(cacheMap.getExpirationQueue().isEmpty());
- cacheMap.clear();
- Assert.assertTrue(cacheMap.getExpirationQueue().isEmpty());
- cacheMap.put("key2", new CacheEntry("key2", "value2", new Date(System.currentTimeMillis() + 1000)));
- Assert.assertNotNull(cacheMap.get("key2"));
- cacheMap.remove("key2");
- Assert.assertTrue(cacheMap.getExpirationQueue().isEmpty());
- }
-}
Copied: root/core/branches/jsr-330/impl/src/test/java/org/ajax4jsf/cache/lru/CacheMapTest.java (from rev 17623, root/core/trunk/impl/src/test/java/org/ajax4jsf/cache/lru/CacheMapTest.java)
===================================================================
--- root/core/branches/jsr-330/impl/src/test/java/org/ajax4jsf/cache/lru/CacheMapTest.java (rev 0)
+++ root/core/branches/jsr-330/impl/src/test/java/org/ajax4jsf/cache/lru/CacheMapTest.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -0,0 +1,76 @@
+/*
+ * 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.ajax4jsf.cache.lru;
+
+import java.util.Date;
+
+import junit.framework.TestCase;
+
+import org.junit.Assert;
+
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class CacheMapTest extends TestCase {
+
+ private void addToCacheMap(CacheMap cacheMap, String key, String value) {
+ CacheEntry entry = new CacheEntry(key, value, null);
+ cacheMap.put(key, entry);
+ }
+
+ public void testLRUEviction() throws Exception {
+ CacheMap cache = new CacheMap(3);
+ addToCacheMap(cache, "key1", "value1");
+ addToCacheMap(cache, "key2", "value2");
+ addToCacheMap(cache, "key3", "value3");
+ Assert.assertEquals("value1", cache.get("key1").getValue());
+ Assert.assertEquals("value2", cache.get("key2").getValue());
+ Assert.assertEquals("value3", cache.get("key3").getValue());
+ cache.get("key1");
+ cache.get("key3");
+ addToCacheMap(cache, "key4", "value4");
+ Assert.assertEquals("value1", cache.get("key1").getValue());
+ Assert.assertNull(cache.get("key2"));
+ Assert.assertEquals("value3", cache.get("key3").getValue());
+ Assert.assertEquals("value4", cache.get("key4").getValue());
+ }
+
+ public void testExpirationQueue() throws Exception {
+ CacheMap cacheMap = new CacheMap();
+
+ Assert.assertTrue(cacheMap.getExpirationQueue().isEmpty());
+
+ CacheEntry cacheEntry = new CacheEntry("key", "value", new Date(System.currentTimeMillis() + 1000));
+ cacheMap.put("key", cacheEntry);
+ Assert.assertNotNull(cacheMap.get("key"));
+ Assert.assertSame(cacheEntry, cacheMap.get("key"));
+ Assert.assertFalse(cacheMap.getExpirationQueue().isEmpty());
+ cacheMap.clear();
+ Assert.assertTrue(cacheMap.getExpirationQueue().isEmpty());
+ cacheMap.put("key2", new CacheEntry("key2", "value2", new Date(System.currentTimeMillis() + 1000)));
+ Assert.assertNotNull(cacheMap.get("key2"));
+ cacheMap.remove("key2");
+ Assert.assertTrue(cacheMap.getExpirationQueue().isEmpty());
+ }
+}
Modified: root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/StateHolderResourceImpl.java
===================================================================
--- root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/StateHolderResourceImpl.java 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/StateHolderResourceImpl.java 2010-06-14 17:58:38 UTC (rev 17625)
@@ -38,6 +38,7 @@
* @since 4.0
*/
@DynamicResource
+//TODO add tests for StateHolder
public class StateHolderResourceImpl extends AbstractCacheableResource implements StateHolderResource {
private Object state = "";
Deleted: root/core/branches/jsr-330/impl/src/test/resources/oscache.properties
===================================================================
--- root/core/branches/jsr-330/impl/src/test/resources/oscache.properties 2010-06-14 16:48:35 UTC (rev 17624)
+++ root/core/branches/jsr-330/impl/src/test/resources/oscache.properties 2010-06-14 17:58:38 UTC (rev 17625)
@@ -1,2 +0,0 @@
-cache.memory true
-cache.capacity 15
\ No newline at end of file
14 years, 6 months
JBoss Rich Faces SVN: r17624 - in root/core/branches/jsr-330: api/src/main/java/org/richfaces/resource and 11 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-06-14 12:48:35 -0400 (Mon, 14 Jun 2010)
New Revision: 17624
Added:
root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/ImageType.java
root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/Java2DUserResource.java
root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/StateHolderResource.java
root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/UserResource.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/Java2DUserResourceAdaptor.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/UserResourceAdaptor.java
Removed:
root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/util/NumericDataInputStream.java
root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/util/NumericDataOutputStream.java
root/core/branches/jsr-330/impl/src/test/java/org/ajax4jsf/util/NumericStreamsTest.java
Modified:
root/core/branches/jsr-330/
root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/CacheableResource.java
root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/VersionedResource.java
root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java
root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/resource/Java2Dresource.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/renderkit/html/CustomizeableGradient.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/renderkit/html/images/BaseControlBackgroundImage.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/renderkit/html/images/CancelControlIcon.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/renderkit/html/images/OneColorBasedResource.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/AbstractBaseResource.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/AbstractCacheableResource.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/CachedResourceImpl.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/CompiledCSSResource.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/ResourceParameterELResolver.java
root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/TestResource2.java
root/core/branches/jsr-330/impl/src/main/resources/META-INF/resources/richfaces-base-component.js
root/core/branches/jsr-330/impl/src/main/resources/META-INF/resources/richfaces-event.js
root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/AbstractBaseResourceTest.java
root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/AbstractCacheableResourceTest.java
root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/CacheableResourceImpl.java
root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/ResourceHandlerImplTest.java
root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/StateHolderResourceImpl.java
root/core/branches/jsr-330/impl/src/test/resources/javascript/richfaces-event-qunit.js
root/core/branches/jsr-330/impl/src/test/resources/resources/full.css
root/core/branches/jsr-330/impl/src/test/resources/resources/importedEL.css
root/core/branches/jsr-330/impl/src/test/resources/resources/resource.css
Log:
Merged revisions 17591-17592,17594 via svnmerge from
https://svn.jboss.org/repos/richfaces/root/core/trunk
.......
r17591 | nbelaevski | 2010-06-10 06:44:40 -0700 (Thu, 10 Jun 2010) | 1 line
https://jira.jboss.org/browse/RF-8665
.......
r17592 | pyaschenko | 2010-06-10 07:17:06 -0700 (Thu, 10 Jun 2010) | 2 lines
Event API changes: refactoring, multiple binding was added to bindById method, used in autocomplete component
QUnit tests was fixed after the changes
.......
r17594 | pyaschenko | 2010-06-10 07:21:37 -0700 (Thu, 10 Jun 2010) | 1 line
documentation comment added
.......
Property changes on: root/core/branches/jsr-330
___________________________________________________________________
Name: svnmerge-integrated
- /root/core/trunk:1-17586
+ /root/core/trunk:1-17598
Modified: root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/CacheableResource.java
===================================================================
--- root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/CacheableResource.java 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/CacheableResource.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -21,6 +21,8 @@
*/
package org.richfaces.resource;
+import java.util.Date;
+
import javax.faces.context.FacesContext;
/**
@@ -30,4 +32,10 @@
public interface CacheableResource {
public boolean isCacheable(FacesContext context);
+
+ public Date getExpires(FacesContext context);
+
+ public int getTimeToLive(FacesContext context);
+
+ public String getEntityTag(FacesContext context);
}
Copied: root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/ImageType.java (from rev 17594, root/core/trunk/api/src/main/java/org/richfaces/resource/ImageType.java)
===================================================================
--- root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/ImageType.java (rev 0)
+++ root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/ImageType.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -0,0 +1,110 @@
+/*
+ * 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.resource;
+
+import java.awt.image.BufferedImage;
+import java.awt.image.IndexColorModel;
+
+public enum ImageType {
+ GIF("gif") {
+ @Override
+ public BufferedImage createImage(int width, int height) {
+ return createARGBImage(width, height);
+ }
+ },
+ PNG("png") {
+ @Override
+ public BufferedImage createImage(int width, int height) {
+ return createARGBImage(width, height);
+ }
+ },
+ PNG8("png") {
+ @Override
+ public BufferedImage createImage(int width, int height) {
+ return new BufferedImage(width, height, BufferedImage.TYPE_BYTE_INDEXED, SAFE_WEB_COLORS_MODEL);
+ }
+ },
+
+ // TODO - add common png8
+ JPEG("jpeg") {
+ @Override
+ public BufferedImage createImage(int width, int height) {
+ return new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
+ }
+ };
+
+ /**
+ * Default web safe colors color model
+ */
+ protected static final IndexColorModel SAFE_WEB_COLORS_MODEL;
+
+ // Build web safe 6x6x6 cube color model.
+ static {
+ byte[] webLevels = {
+ 0, 51, 102, (byte) 153, (byte) 204, (byte) 255
+ };
+ int colorsNumber = webLevels.length * webLevels.length * webLevels.length; /* 216 colors */
+ byte[] r = new byte[colorsNumber];
+ byte[] g = new byte[colorsNumber];
+ byte[] b = new byte[colorsNumber];
+
+ r[0] = 0;
+ g[0] = 0;
+ b[0] = 0;
+
+ for (int i = 0; i < webLevels.length; i++) {
+ for (int j = 0; j < webLevels.length; j++) {
+ for (int k = 0; k < webLevels.length; k++) {
+ int colorNum = i * webLevels.length * webLevels.length + j * webLevels.length + k;
+
+ r[colorNum] = webLevels[i];
+ g[colorNum] = webLevels[j];
+ b[colorNum] = webLevels[k];
+ }
+ }
+ }
+
+ SAFE_WEB_COLORS_MODEL = new IndexColorModel(8, colorsNumber, r, g, b, 0);
+ }
+
+ private String formatName;
+ private String mimeType;
+
+ private ImageType(String formatName) {
+ this.formatName = formatName;
+ this.mimeType = "image/" + formatName;
+ }
+
+ private static BufferedImage createARGBImage(int width, int height) {
+ return new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
+ }
+
+ public abstract BufferedImage createImage(int width, int height);
+
+ public String getFormatName() {
+ return formatName;
+ }
+
+ public String getMimeType() {
+ return mimeType;
+ }
+}
\ No newline at end of file
Copied: root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/Java2DUserResource.java (from rev 17594, root/core/trunk/api/src/main/java/org/richfaces/resource/Java2DUserResource.java)
===================================================================
--- root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/Java2DUserResource.java (rev 0)
+++ root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/Java2DUserResource.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -0,0 +1,45 @@
+/*
+ * 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.resource;
+
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public interface Java2DUserResource {
+
+ public Map<String, String> getResponseHeaders();
+
+ public Date getLastModified();
+
+ public ImageType getImageType();
+
+ public Dimension getDimension();
+
+ public void paint(Graphics2D graphics2D, Dimension dimension);
+
+}
Copied: root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/StateHolderResource.java (from rev 17594, root/core/trunk/api/src/main/java/org/richfaces/resource/StateHolderResource.java)
===================================================================
--- root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/StateHolderResource.java (rev 0)
+++ root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/StateHolderResource.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -0,0 +1,42 @@
+/*
+ * 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.resource;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public interface StateHolderResource {
+
+ public boolean isTransient();
+
+ public void writeState(FacesContext context, DataOutput dataOutput) throws IOException;
+
+ public void readState(FacesContext context, DataInput dataInput) throws IOException;
+
+}
Copied: root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/UserResource.java (from rev 17594, root/core/trunk/api/src/main/java/org/richfaces/resource/UserResource.java)
===================================================================
--- root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/UserResource.java (rev 0)
+++ root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/UserResource.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -0,0 +1,45 @@
+/*
+ * 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.resource;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public interface UserResource {
+
+ public Map<String, String> getResponseHeaders();
+
+ public Date getLastModified();
+
+ public InputStream getInputStream() throws IOException;
+
+ public String getContentType();
+
+ public int getContentLength();
+
+}
Modified: root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/VersionedResource.java
===================================================================
--- root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/VersionedResource.java 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/api/src/main/java/org/richfaces/resource/VersionedResource.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -28,5 +28,7 @@
* @since 4.0
*/
public interface VersionedResource {
+
public String getVersion();
+
}
Modified: root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -40,6 +40,11 @@
* @author asmirnov
*/
public final class ContextInitParameters {
+ /**
+ *
+ */
+ private static final int DEFAULT_TTL = 60 * 60 * 24;
+
public static final String[] DATATABLE_USES_VIEW_LOCALE = {"org.richfaces.datatableUsesViewLocale"};
/**
@@ -51,6 +56,9 @@
public static final String STD_CONTROLS_SKINNING_CLASSES_PARAM = "org.richfaces.ENABLE_CONTROL_SKINNING_CLASSES";
public static final String[] QUEUE_ENABLED = {"org.richfaces.queue.enabled"};
+ //TODO - better name
+ public static final String[] RESOURCES_TTL = {"org.richfaces.RESOURCE_DEFAULT_TTL"};
+
private static final String INIT_PARAM_PREFIX = ContextInitParameters.class.getSimpleName() + ":";
private static final Object NULL = new Object() {
@@ -95,6 +103,10 @@
return getBooleanValue(paramValue, true);
}
+ public static int getResourcesTimeToLive(FacesContext context) {
+ return getInteger(context, RESOURCES_TTL, DEFAULT_TTL);
+ }
+
/**
* Method for determining STD_CONTROLS_SKINNING_CLASSES_PARAM parameter
*
@@ -106,11 +118,11 @@
return getBooleanValue(paramValue, false);
}
- static int getInteger(FacesContext context, String[] paramNames, int defaulValue) {
+ static int getInteger(FacesContext context, String[] paramNames, int defaultValue) {
String initParameter = getInitParameter(context, paramNames);
if (null == initParameter) {
- return defaulValue;
+ return defaultValue;
} else {
try {
return Integer.parseInt(initParameter);
@@ -120,21 +132,21 @@
}
}
- static String getString(FacesContext context, String[] paramNames, String defaulValue) {
+ static String getString(FacesContext context, String[] paramNames, String defaultValue) {
String initParameter = getInitParameter(context, paramNames);
if (null == initParameter) {
- return defaulValue;
+ return defaultValue;
} else {
return initParameter;
}
}
- static boolean getBoolean(FacesContext context, String[] paramNames, boolean defaulValue) {
+ static boolean getBoolean(FacesContext context, String[] paramNames, boolean defaultValue) {
String initParameter = getInitParameter(context, paramNames);
if (null == initParameter) {
- return defaulValue;
+ return defaultValue;
} else if ("true".equalsIgnoreCase(initParameter) || "yes".equalsIgnoreCase(initParameter)) {
return true;
} else if ("false".equalsIgnoreCase(initParameter) || "no".equalsIgnoreCase(initParameter)) {
Modified: root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/resource/Java2Dresource.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/resource/Java2Dresource.java 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/resource/Java2Dresource.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -25,21 +25,21 @@
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
-import java.awt.image.IndexColorModel;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import java.io.DataInput;
+import java.io.DataOutput;
import java.io.IOException;
import java.io.InputStream;
-import javax.faces.component.StateHolder;
import javax.faces.context.FacesContext;
import javax.imageio.ImageIO;
import org.ajax4jsf.util.HtmlColor;
import org.ajax4jsf.util.HtmlDimensions;
-import org.ajax4jsf.util.NumericDataInputStream;
-import org.ajax4jsf.util.NumericDataOutputStream;
import org.richfaces.resource.AbstractCacheableResource;
+import org.richfaces.resource.ImageType;
+import org.richfaces.resource.StateHolderResource;
import org.richfaces.skin.Skin;
import org.richfaces.skin.SkinFactory;
@@ -47,7 +47,7 @@
* @author shura (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.3 $ $Date: 2007/02/01 15:31:57 $
*/
-public abstract class Java2Dresource extends AbstractCacheableResource implements StateHolder {
+public abstract class Java2Dresource extends AbstractCacheableResource implements StateHolderResource {
private static final String SKIN_MARKER = "Skin.";
private ImageType imageType;
@@ -56,91 +56,6 @@
this.imageType = imageType;
}
- public static enum ImageType {
- GIF("gif") {
- @Override
- public BufferedImage createImage(int width, int height) {
- return createARGBImage(width, height);
- }
- },
- PNG("png") {
- @Override
- public BufferedImage createImage(int width, int height) {
- return createARGBImage(width, height);
- }
- },
- PNG8("png") {
- @Override
- public BufferedImage createImage(int width, int height) {
- return new BufferedImage(width, height, BufferedImage.TYPE_BYTE_INDEXED, SAFE_WEB_COLORS_MODEL);
- }
- },
-
- // TODO - add common png8
- JPEG("jpeg") {
- @Override
- public BufferedImage createImage(int width, int height) {
- return new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
- }
- };
-
- /**
- * Default web safe colors color model
- */
- protected static final IndexColorModel SAFE_WEB_COLORS_MODEL;
-
- // Build web safe 6x6x6 cube color model.
- static {
- byte[] webLevels = {
- 0, 51, 102, (byte) 153, (byte) 204, (byte) 255
- };
- int colorsNumber = webLevels.length * webLevels.length * webLevels.length; /* 216 colors */
- byte[] r = new byte[colorsNumber];
- byte[] g = new byte[colorsNumber];
- byte[] b = new byte[colorsNumber];
-
- r[0] = 0;
- g[0] = 0;
- b[0] = 0;
-
- for (int i = 0; i < webLevels.length; i++) {
- for (int j = 0; j < webLevels.length; j++) {
- for (int k = 0; k < webLevels.length; k++) {
- int colorNum = i * webLevels.length * webLevels.length + j * webLevels.length + k;
-
- r[colorNum] = webLevels[i];
- g[colorNum] = webLevels[j];
- b[colorNum] = webLevels[k];
- }
- }
- }
-
- SAFE_WEB_COLORS_MODEL = new IndexColorModel(8, colorsNumber, r, g, b, 0);
- }
-
- private String formatName;
- private String mimeType;
-
- private ImageType(String formatName) {
- this.formatName = formatName;
- this.mimeType = "image/" + formatName;
- }
-
- private static BufferedImage createARGBImage(int width, int height) {
- return new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
- }
-
- protected abstract BufferedImage createImage(int width, int height);
-
- protected String getFormatName() {
- return formatName;
- }
-
- protected String getMimeType() {
- return mimeType;
- }
- }
-
/**
* Primary calculation of image dimensions - used when HTML code is
* generated to render IMG's width and height Subclasses should override
@@ -208,32 +123,6 @@
return imageType.getMimeType();
}
- protected void writeState(FacesContext context, NumericDataOutputStream stream) {
- }
-
- protected void readState(FacesContext context, NumericDataInputStream stream) {
- }
-
- public boolean isTransient() {
- return false;
- }
-
- public void restoreState(FacesContext context, Object state) {
- readState(context, new NumericDataInputStream((byte[]) state));
- }
-
- public Object saveState(FacesContext context) {
- NumericDataOutputStream stream = new NumericDataOutputStream();
-
- writeState(context, stream);
-
- return stream.getBytes();
- }
-
- public void setTransient(boolean newTransientValue) {
- throw new UnsupportedOperationException();
- }
-
protected String getValueParameter(FacesContext context, String name) {
SkinFactory skinFactory = SkinFactory.getInstance();
@@ -291,4 +180,12 @@
return null;
}
}
+
+ public void readState(FacesContext context, DataInput dataInput) throws IOException {}
+
+ public void writeState(FacesContext context, DataOutput dataOutput) throws IOException {}
+
+ public boolean isTransient() {
+ return false;
+ }
}
Deleted: root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/util/NumericDataInputStream.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/util/NumericDataInputStream.java 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/util/NumericDataInputStream.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -1,106 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.util;
-
-import java.awt.*;
-import java.io.ByteArrayInputStream;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-/**
- * Original idea by Igor Shabalov
- *
- * @author Nick Belaevski
- * @since 4.0
- */
-public class NumericDataInputStream {
- static final int BYTES_IN_INT = Integer.SIZE >> 3;
- static final int BYTES_IN_SHORT = Short.SIZE >> 3;
- static final int BYTES_IN_COLOR = BYTES_IN_INT - 1;
-
- // the size of maximum object in bytes that this stream can operate (int)
- static final int MAX_BYTES = BYTES_IN_INT;
- static final ByteOrder BUFFER_BYTES_ORDER = ByteOrder.LITTLE_ENDIAN;
- private byte[] bytes = new byte[MAX_BYTES];
- private ByteBuffer buffer = ByteBuffer.wrap(bytes).order(BUFFER_BYTES_ORDER);
- private ByteArrayInputStream byteArrayStream;
-
- public NumericDataInputStream(byte[] buf) {
- super();
- byteArrayStream = new ByteArrayInputStream(buf);
- }
-
- public NumericDataInputStream(byte[] buf, int offset, int length) {
- super();
- byteArrayStream = new ByteArrayInputStream(buf, offset, length);
- }
-
- public byte readByte() {
- int read = byteArrayStream.read();
-
- if (read >= 0) {
- return (byte) read;
- } else {
- throw new IllegalStateException("Data is invalid or corrupted");
- }
- }
-
- public short readShort() {
- int read = byteArrayStream.read(bytes, 0, BYTES_IN_SHORT);
-
- if (read == BYTES_IN_SHORT) {
- buffer.rewind();
-
- return buffer.asShortBuffer().get();
- } else {
- throw new IllegalStateException("Data is invalid or corrupted");
- }
- }
-
- public int readInt() {
- int read = byteArrayStream.read(bytes, 0, BYTES_IN_INT);
-
- if (read == BYTES_IN_INT) {
- buffer.rewind();
-
- return buffer.asIntBuffer().get();
- } else {
- throw new IllegalStateException("Data is invalid or corrupted");
- }
- }
-
- public int readIntColor() {
- int read = byteArrayStream.read(bytes, 0, BYTES_IN_COLOR);
-
- if (read == BYTES_IN_COLOR) {
- buffer.rewind();
-
- return buffer.asIntBuffer().get() & 0x00FFFFFF;
- } else {
- throw new IllegalStateException("Data is invalid or corrupted");
- }
- }
-
- public Color readColor() {
- return new Color(readIntColor());
- }
-}
Deleted: root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/util/NumericDataOutputStream.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/util/NumericDataOutputStream.java 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/main/java/org/ajax4jsf/util/NumericDataOutputStream.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -1,82 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.util;
-
-import static org.ajax4jsf.util.NumericDataInputStream.*;
-
-import java.awt.*;
-import java.io.ByteArrayOutputStream;
-import java.nio.ByteBuffer;
-
-/**
- * Original idea by Igor Shabalov
- *
- * @author Nick Belaevski
- * @since 4.0
- */
-public class NumericDataOutputStream {
- private ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
- private byte[] bytes = new byte[MAX_BYTES];
- private ByteBuffer buffer = ByteBuffer.wrap(bytes).order(BUFFER_BYTES_ORDER);
-
- public NumericDataOutputStream writeByte(byte value) {
- byteStream.write(value);
-
- return this;
- }
-
- public NumericDataOutputStream writeShort(short value) {
- buffer.rewind();
- buffer.asShortBuffer().put(value);
- byteStream.write(bytes, 0, BYTES_IN_SHORT);
-
- return this;
- }
-
- private void writeInteger(int value, int numBytes) {
- buffer.rewind();
- buffer.asIntBuffer().put(value);
- byteStream.write(bytes, 0, numBytes);
- }
-
- public NumericDataOutputStream writeInt(int value) {
- writeInteger(value, BYTES_IN_INT);
-
- return this;
- }
-
- public NumericDataOutputStream writeIntColor(int value) {
- writeInteger(value, BYTES_IN_COLOR);
-
- return this;
- }
-
- public NumericDataOutputStream writeColor(Color value) {
- writeIntColor(value.getRGB());
-
- return this;
- }
-
- public byte[] getBytes() {
- return byteStream.toByteArray();
- }
-}
Modified: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -28,15 +28,17 @@
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
import javax.faces.context.FacesContext;
import org.ajax4jsf.resource.Java2Dresource;
-import org.ajax4jsf.util.NumericDataInputStream;
-import org.ajax4jsf.util.NumericDataOutputStream;
import org.richfaces.renderkit.html.images.GradientType;
import org.richfaces.renderkit.html.images.GradientType.BiColor;
import org.richfaces.resource.DynamicResource;
+import org.richfaces.resource.ImageType;
import org.richfaces.skin.Skin;
/**
@@ -254,28 +256,20 @@
}
}
- @Override
- protected void readState(FacesContext context, NumericDataInputStream stream) {
- super.readState(context, stream);
-
- this.headerBackgroundColor = stream.readInt();
- this.headerGradientColor = stream.readInt();
- this.gradientType = GradientType.values()[stream.readByte()];
+ public void readState(FacesContext context, DataInput dataInput) throws IOException {
+ super.readState(context, dataInput);
+ this.headerBackgroundColor = dataInput.readInt();
+ this.headerGradientColor = dataInput.readInt();
+ this.gradientType = GradientType.values()[dataInput.readByte()];
}
-
+
@Override
- protected void writeState(FacesContext context,
- NumericDataOutputStream stream) {
- super.writeState(context, stream);
+ public void writeState(FacesContext context, DataOutput dataOutput) throws IOException {
+ super.writeState(context, dataOutput);
- stream.writeInt(this.headerBackgroundColor);
- stream.writeInt(this.headerGradientColor);
- stream.writeByte((byte) this.gradientType.ordinal());
+ dataOutput.writeInt(this.headerBackgroundColor);
+ dataOutput.writeInt(this.headerGradientColor);
+ dataOutput.writeByte((byte) this.gradientType.ordinal());
}
- public boolean isCacheable() {
- return true;
- }
-
-
}
Modified: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/renderkit/html/CustomizeableGradient.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/renderkit/html/CustomizeableGradient.java 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/renderkit/html/CustomizeableGradient.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -28,15 +28,18 @@
import java.awt.RenderingHints;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
import javax.faces.context.FacesContext;
import org.ajax4jsf.resource.Java2Dresource;
-import org.ajax4jsf.util.NumericDataInputStream;
import org.richfaces.renderkit.html.images.GradientAlignment;
import org.richfaces.renderkit.html.images.GradientType;
import org.richfaces.renderkit.html.images.GradientType.BiColor;
import org.richfaces.resource.DynamicResource;
+import org.richfaces.resource.ImageType;
import org.richfaces.skin.Skin;
/**
@@ -168,24 +171,25 @@
}
@Override
- protected void readState(FacesContext context, NumericDataInputStream stream) {
- super.readState(context, stream);
+ public void readState(FacesContext context, DataInput dataInput) throws IOException {
+ super.readState(context, dataInput);
- this.baseColor = stream.readIntColor();
- this.gradientColor = stream.readIntColor();
- this.gradientHeight = stream.readInt();
- this.gradientAlignment = GradientAlignment.values()[stream.readByte()];
- this.gradientType = GradientType.values()[stream.readByte()];
+ this.baseColor = dataInput.readInt();
+ this.gradientColor = dataInput.readInt();
+ this.gradientHeight = dataInput.readInt();
+ this.gradientAlignment = GradientAlignment.values()[dataInput.readByte()];
+ this.gradientType = GradientType.values()[dataInput.readByte()];
}
+
@Override
- protected void writeState(FacesContext context, org.ajax4jsf.util.NumericDataOutputStream stream) {
- super.writeState(context, stream);
+ public void writeState(FacesContext context, DataOutput dataOutput) throws IOException {
+ super.writeState(context, dataOutput);
- stream.writeIntColor(this.baseColor);
- stream.writeIntColor(this.gradientColor);
- stream.writeInt(this.gradientHeight);
- stream.writeByte((byte) this.gradientAlignment.ordinal());
- stream.writeByte((byte) this.gradientType.ordinal());
+ dataOutput.writeInt(this.baseColor);
+ dataOutput.writeInt(this.gradientColor);
+ dataOutput.writeInt(this.gradientHeight);
+ dataOutput.writeByte((byte) this.gradientAlignment.ordinal());
+ dataOutput.writeByte((byte) this.gradientType.ordinal());
}
protected static String safeTrim(String s) {
Modified: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/renderkit/html/images/BaseControlBackgroundImage.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/renderkit/html/images/BaseControlBackgroundImage.java 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/renderkit/html/images/BaseControlBackgroundImage.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -21,10 +21,12 @@
package org.richfaces.renderkit.html.images;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
import javax.faces.context.FacesContext;
-import org.ajax4jsf.util.NumericDataInputStream;
-import org.ajax4jsf.util.NumericDataOutputStream;
import org.richfaces.renderkit.html.BaseGradient;
import org.richfaces.skin.Skin;
@@ -50,31 +52,21 @@
}
@Override
- protected void writeState(FacesContext context,
- NumericDataOutputStream stream) {
+ public void writeState(FacesContext context,
+ DataOutput stream) throws IOException {
super.writeState(context, stream);
stream.writeInt(this.height);
}
@Override
- protected void readState(FacesContext context, NumericDataInputStream stream) {
+ public void readState(FacesContext context, DataInput stream) throws IOException {
super.readState(context, stream);
this.height = stream.readInt();
- }
- @Override
- public void restoreState(FacesContext context, Object state) {
- super.restoreState(context, state);
-
//TODO - create a special method?
this.gradientType = GradientType.PLAIN;
}
- @Override
- public Object saveState(FacesContext context) {
- return super.saveState(context);
- }
-
}
Modified: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/renderkit/html/images/CancelControlIcon.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/renderkit/html/images/CancelControlIcon.java 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/renderkit/html/images/CancelControlIcon.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -25,13 +25,16 @@
import java.awt.GradientPaint;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
import javax.faces.context.FacesContext;
import org.ajax4jsf.resource.Java2Dresource;
import org.ajax4jsf.util.HtmlColor;
-import org.ajax4jsf.util.NumericDataInputStream;
import org.richfaces.resource.DynamicResource;
+import org.richfaces.resource.ImageType;
/**
* implementation of the default CANCEL icon renderer
@@ -59,18 +62,18 @@
}
@Override
- protected void readState(FacesContext context, NumericDataInputStream stream) {
+ public void readState(FacesContext context, DataInput stream) throws IOException {
super.readState(context, stream);
- this.iconColor = stream.readIntColor();
- this.iconBorderColor = stream.readIntColor();
+ this.iconColor = stream.readInt();
+ this.iconBorderColor = stream.readInt();
}
- protected void writeState(FacesContext context, org.ajax4jsf.util.NumericDataOutputStream stream) {
+ public void writeState(FacesContext context, DataOutput stream) throws IOException {
super.writeState(context, stream);
- stream.writeIntColor(this.iconColor);
- stream.writeIntColor(this.iconBorderColor);
+ stream.writeInt(this.iconColor);
+ stream.writeInt(this.iconBorderColor);
}
@Override
Modified: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/renderkit/html/images/OneColorBasedResource.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/renderkit/html/images/OneColorBasedResource.java 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/renderkit/html/images/OneColorBasedResource.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -27,6 +27,7 @@
import org.ajax4jsf.resource.Java2Dresource;
import org.ajax4jsf.resource.ResourceContext;
import org.richfaces.resource.DynamicResource;
+import org.richfaces.resource.ImageType;
@DynamicResource
public abstract class OneColorBasedResource extends Java2Dresource {
Modified: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/AbstractBaseResource.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/AbstractBaseResource.java 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/AbstractBaseResource.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -21,9 +21,8 @@
package org.richfaces.resource;
-import static org.richfaces.resource.ResourceUtils.millisToSecond;
-import static org.richfaces.resource.ResourceUtils.secondToMillis;
-
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
@@ -38,10 +37,8 @@
import javax.faces.FacesException;
import javax.faces.application.Resource;
-import javax.faces.component.StateHolder;
import javax.faces.context.FacesContext;
-import org.ajax4jsf.resource.InternetResource;
import org.richfaces.application.ServiceTracker;
import org.richfaces.log.RichfacesLogger;
import org.richfaces.util.Util;
@@ -67,19 +64,6 @@
}
/**
- * <b>IMPORTANT:</b> this method returned TTL in RF 3.x, now it returns expiration time
- *
- * @return Returns the expired.
- */
- protected Date getExpires(FacesContext context) {
- return null;
- }
-
- protected int getTimeToLive(FacesContext context) {
- return 0;
- }
-
- /**
* TODO optimize/review?
*
* @return Returns the lastModified.
@@ -158,17 +142,7 @@
return classLoader;
}
- protected String getEntityTag(FacesContext context) {
- int contentLength = getContentLength(context);
- Date lastModified = getLastModified(context);
-
- if ((contentLength < 0) || (lastModified == null)) {
- return null;
- }
-
- return ResourceUtils.formatWeakTag(contentLength + "-" + lastModified.getTime());
- }
-
+ //TODO nick - review
private String getResourceVersion() {
if (this instanceof VersionedResource) {
return ((VersionedResource) this).getVersion();
@@ -186,11 +160,26 @@
String resourceName = getResourceName();
Object resourceData = null;
- if (this instanceof StateHolder) {
- StateHolder stateHolder = (StateHolder) this;
+ if (this instanceof StateHolderResource) {
+ StateHolderResource stateHolder = (StateHolderResource) this;
if (!stateHolder.isTransient()) {
- resourceData = stateHolder.saveState(context);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ DataOutputStream oos = null;
+ try {
+ oos = new DataOutputStream(baos);
+ stateHolder.writeState(context, oos);
+ } catch (IOException e) {
+ throw new FacesException(e.getMessage(), e);
+ } finally {
+ try {
+ oos.close();
+ } catch (IOException e) {
+ LOGGER.debug(e.getMessage(), e);
+ }
+ }
+
+ resourceData = baos.toByteArray();
}
}
@@ -216,15 +205,16 @@
long getCurrentTime() {
return System.currentTimeMillis();
}
-
- private boolean canBeCached(FacesContext context) {
- if (this instanceof CacheableResource) {
- return ((CacheableResource) this).isCacheable(context);
- }
-
- return false;
+
+ protected void addNoCacheResponseHeaders(FacesContext facesContext, Map<String, String> headers) {
+ headers.put("Expires", "0");
+ headers.put("Cache-Control", "max-age=0, no-store, no-cache");
+ headers.put("Pragma", "no-cache");
}
+ protected void addCacheControlResponseHeaders(FacesContext facesContext, Map<String, String> headers) {
+ addNoCacheResponseHeaders(facesContext, headers);
+ }
@Override
public Map<String, String> getResponseHeaders() {
@@ -252,46 +242,10 @@
headers.put("Last-Modified", Util.formatHttpDate(lastModified));
}
- if (canBeCached(facesContext)) {
- long currentTime = getCurrentTime();
- String formattedExpireDate;
- long maxAge = getTimeToLive(facesContext);
-
- if (maxAge > 0) {
- formattedExpireDate = Util.formatHttpDate(currentTime + secondToMillis(maxAge));
- } else {
- Date expired = getExpires(facesContext);
-
- if (expired != null) {
- formattedExpireDate = Util.formatHttpDate(expired);
- maxAge = millisToSecond(expired.getTime() - currentTime);
- } else {
- maxAge = InternetResource.DEFAULT_TTL;
- formattedExpireDate = Util.formatHttpDate(currentTime + secondToMillis(maxAge));
- }
- }
-
- if (formattedExpireDate != null) {
- headers.put("Expires", formattedExpireDate);
- }
-
- if (maxAge > 0) {
- headers.put("Cache-Control", "max-age=" + maxAge);
- }
-
- String entityTag = getEntityTag(facesContext);
-
- if (entityTag != null) {
- headers.put("ETag", entityTag);
- }
- } else {
- headers.put("Expires", "0");
- headers.put("Cache-Control", "max-age=0, no-store, no-cache");
- headers.put("Pragma", "no-cache");
- }
-
headers.put("Date", Util.formatHttpDate(getCurrentTime()));
+ addCacheControlResponseHeaders(facesContext, headers);
+
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Created set of response headers");
@@ -342,20 +296,7 @@
@Override
public long getExpiration() {
- FacesContext facesContext = FacesContext.getCurrentInstance();
- long ttl = AbstractBaseResource.this.getTimeToLive(facesContext);
-
- if (ttl > 0) {
- return System.currentTimeMillis() + secondToMillis(ttl);
- }
-
- Date date = AbstractBaseResource.this.getExpires(facesContext);
-
- if (date != null) {
- return date.getTime();
- }
-
- return System.currentTimeMillis() + secondToMillis(InternetResource.DEFAULT_TTL);
+ return 0;
}
@Override
Modified: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/AbstractCacheableResource.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/AbstractCacheableResource.java 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/AbstractCacheableResource.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -21,12 +21,16 @@
package org.richfaces.resource;
+import static org.richfaces.resource.ResourceUtils.millisToSecond;
+import static org.richfaces.resource.ResourceUtils.secondToMillis;
+
import java.util.Date;
import java.util.Map;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
+import org.ajax4jsf.context.ContextInitParameters;
import org.richfaces.log.RichfacesLogger;
import org.richfaces.util.Util;
import org.slf4j.Logger;
@@ -143,4 +147,67 @@
return false;
}
+
+ /**
+ * <b>IMPORTANT:</b> this method returned TTL in RF 3.x, now it returns expiration time
+ *
+ * @return Returns the expired.
+ */
+ public Date getExpires(FacesContext context) {
+ return null;
+ }
+
+ public int getTimeToLive(FacesContext context) {
+ return 0;
+ }
+
+ public String getEntityTag(FacesContext context) {
+ int contentLength = getContentLength(context);
+ Date lastModified = getLastModified(context);
+
+ if ((contentLength < 0) || (lastModified == null)) {
+ return null;
+ }
+
+ return ResourceUtils.formatWeakTag(contentLength + "-" + lastModified.getTime());
+ }
+
+ @Override
+ protected void addCacheControlResponseHeaders(FacesContext facesContext, Map<String, String> headers) {
+ if (isCacheable(facesContext)) {
+ long currentTime = getCurrentTime();
+ String formattedExpireDate;
+ long maxAge = getTimeToLive(facesContext);
+
+ if (maxAge > 0) {
+ formattedExpireDate = Util.formatHttpDate(currentTime + secondToMillis(maxAge));
+ } else {
+ Date expired = getExpires(facesContext);
+
+ if (expired != null) {
+ formattedExpireDate = Util.formatHttpDate(expired);
+ maxAge = millisToSecond(expired.getTime() - currentTime);
+ } else {
+ maxAge = ContextInitParameters.getResourcesTimeToLive(facesContext);
+ formattedExpireDate = Util.formatHttpDate(currentTime + secondToMillis(maxAge));
+ }
+ }
+
+ if (formattedExpireDate != null) {
+ headers.put("Expires", formattedExpireDate);
+ }
+
+ if (maxAge > 0) {
+ headers.put("Cache-Control", "max-age=" + maxAge);
+ }
+
+ String entityTag = getEntityTag(facesContext);
+
+ if (entityTag != null) {
+ headers.put("ETag", entityTag);
+ }
+ } else {
+ addNoCacheResponseHeaders(facesContext, headers);
+ }
+ }
}
Modified: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/CachedResourceImpl.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/CachedResourceImpl.java 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/CachedResourceImpl.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -204,7 +204,7 @@
}
@Override
- protected String getEntityTag(FacesContext context) {
+ public String getEntityTag(FacesContext context) {
return entityTag;
}
Modified: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/CompiledCSSResource.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/CompiledCSSResource.java 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/CompiledCSSResource.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -22,15 +22,15 @@
package org.richfaces.resource;
import java.io.ByteArrayInputStream;
+import java.io.DataInput;
+import java.io.DataOutput;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
-import java.nio.ByteBuffer;
import java.text.MessageFormat;
import javax.faces.application.ProjectStage;
import javax.faces.application.Resource;
-import javax.faces.component.StateHolder;
import javax.faces.context.FacesContext;
import org.richfaces.log.RichfacesLogger;
@@ -49,7 +49,7 @@
/**
* @author amarkhel Class, that represented dynamic CSS resource.
*/
-public class CompiledCSSResource extends AbstractCacheableResource implements StateHolder {
+public class CompiledCSSResource extends AbstractCacheableResource implements StateHolderResource {
private static final String ECSS = ".ecss";
@@ -236,17 +236,11 @@
return false;
}
- public void restoreState(FacesContext context, Object state) {
+ public void readState(FacesContext context, DataInput dataInput) throws IOException {
//do nothing
}
- public Object saveState(FacesContext context) {
- ByteBuffer buffer = ByteBuffer.allocate(4);
- buffer.putInt(getSkinHashCode(context));
- return buffer.array();
+ public void writeState(FacesContext context, DataOutput dataOutput) throws IOException {
+ dataOutput.writeInt(getSkinHashCode(context));
}
-
- public void setTransient(boolean newTransientValue) {
- //do nothing
- }
}
\ No newline at end of file
Copied: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/Java2DUserResourceAdaptor.java (from rev 17594, root/core/trunk/impl/src/main/java/org/richfaces/resource/Java2DUserResourceAdaptor.java)
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/Java2DUserResourceAdaptor.java (rev 0)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/Java2DUserResourceAdaptor.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -0,0 +1,163 @@
+/*
+ * 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.resource;
+
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Date;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+import javax.imageio.ImageIO;
+
+import org.ajax4jsf.util.HtmlColor;
+import org.ajax4jsf.util.HtmlDimensions;
+import org.richfaces.skin.Skin;
+import org.richfaces.skin.SkinFactory;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class Java2DUserResourceAdaptor implements UserResource {
+
+ private Java2DUserResource j2DUserResource;
+
+ public Java2DUserResourceAdaptor(Java2DUserResource userResource) {
+ this.j2DUserResource = userResource;
+ }
+
+ public InputStream getInputStream() throws IOException {
+ Dimension dimension = j2DUserResource.getDimension();
+ int width = dimension.width;
+ int height = dimension.height;
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ ImageType imageType = j2DUserResource.getImageType();
+
+ if ((width > 0) && (height > 0)) {
+ BufferedImage image = imageType.createImage(width, height);
+ Graphics2D g2d = image.createGraphics();
+
+ try {
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
+
+ g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,
+ RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+
+ j2DUserResource.paint(g2d, dimension);
+ } finally {
+ g2d.dispose();
+ }
+
+ try {
+ ImageIO.write(image, imageType.getFormatName(), baos);
+ } finally {
+ try {
+ baos.close();
+ } catch (IOException e) {
+
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+
+ return new ByteArrayInputStream(baos.toByteArray());
+ }
+
+ public String getContentType() {
+ return j2DUserResource.getImageType().getMimeType();
+ }
+
+ protected String getValueParameter(FacesContext context, String name) {
+ SkinFactory skinFactory = SkinFactory.getInstance();
+
+ Skin skin = skinFactory.getSkin(context);
+ String value = (String) skin.getParameter(context, name);
+
+ if (value == null || value.length() == 0) {
+ skin = skinFactory.getDefaultSkin(context);
+ value = (String) skin.getParameter(context, name);
+ }
+
+ return value;
+ }
+
+ protected Integer getColorValueParameter(FacesContext context, String name, boolean useDefault) {
+ Skin skin;
+ if (useDefault) {
+ skin = SkinFactory.getInstance().getDefaultSkin(context);
+ } else {
+ skin = SkinFactory.getInstance().getSkin(context);
+ }
+
+ return decodeColor((String) skin.getParameter(context, name));
+ }
+
+ protected Integer getHeight(FacesContext context, String heightParamName) {
+ SkinFactory skinFactory = SkinFactory.getInstance();
+ Skin skin = skinFactory.getSkin(context);
+
+ String height = (String) skin.getParameter(context, heightParamName);
+ if (height == null || height.length() == 0) {
+ skin = skinFactory.getDefaultSkin(context);
+ height = (String) skin.getParameter(context, heightParamName);
+ }
+
+ if (height != null && height.length() != 0) {
+ return Integer.valueOf(HtmlDimensions.decode(height).intValue());
+ } else {
+ return Integer.valueOf(16);
+ }
+ }
+
+ protected Integer decodeColor(String value) {
+ if (value != null && value.length() != 0) {
+ return Integer.valueOf(HtmlColor.decode(value).getRGB());
+ } else {
+ return null;
+ }
+ }
+
+ public int getContentLength() {
+ return -1;
+ }
+
+ public Date getLastModified() {
+ return j2DUserResource.getLastModified();
+ }
+
+ public Map<String, String> getResponseHeaders() {
+ return j2DUserResource.getResponseHeaders();
+ }
+
+}
Modified: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -21,6 +21,8 @@
package org.richfaces.resource;
+import java.io.ByteArrayInputStream;
+import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -34,7 +36,7 @@
import javax.faces.application.ProjectStage;
import javax.faces.application.Resource;
import javax.faces.application.ResourceHandler;
-import javax.faces.component.StateHolder;
+import javax.faces.application.ResourceHandlerWrapper;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.imageio.ImageIO;
@@ -54,7 +56,7 @@
* @author Nick Belaevski
* @since 4.0
*/
-public class ResourceHandlerImpl extends ResourceHandler {
+public class ResourceHandlerImpl extends ResourceHandlerWrapper {
public static final String RICHFACES_RESOURCE_IDENTIFIER = "/rfRes/";
public static final String RESOURCE_CACHE_NAME = ResourceHandlerImpl.class.getName() + ":CACHE";
public static final String HANDLER_START_TIME_ATTRIBUTE = ResourceHandlerImpl.class.getName() + ":StartTime";
@@ -217,7 +219,7 @@
}
if (resource == null) {
- resource = createHandlerDependentResource(resourceName);
+ resource = createHandlerDependentResource(resourceName, null);
}
if (resource == null) {
@@ -249,8 +251,8 @@
}
}
- if (resource instanceof StateHolder) {
- StateHolder stateHolder = (StateHolder) resource;
+ if (resource instanceof StateHolderResource) {
+ StateHolderResource stateHolder = (StateHolderResource) resource;
Object decodedData = resourceCodec.decodeResourceData(context, resourcePath);
if (LOGGER.isDebugEnabled()) {
@@ -262,7 +264,19 @@
}
if (decodedData != null) {
- stateHolder.restoreState(context, decodedData);
+ DataInputStream dis = null;
+ try {
+ dis = new DataInputStream(new ByteArrayInputStream((byte[]) decodedData));
+ stateHolder.readState(context, dis);
+ } finally {
+ if (dis != null) {
+ try {
+ dis.close();
+ } catch (IOException e) {
+ LOGGER.debug(e.getMessage(), e);
+ }
+ }
+ }
} else {
// resource was transient and didn't store data
@@ -375,7 +389,7 @@
}
}
- protected void injectProperties(Resource resource, Map<String, String> parameters) {
+ protected void injectProperties(Object resource, Map<String, String> parameters) {
FacesContext facesContext = FacesContext.getCurrentInstance();
DependencyInjectionService diService = ServiceTracker.getService(facesContext, DependencyInjectionService.class);
@@ -394,7 +408,7 @@
* @param resourceName
* @return
*/
- protected Resource createHandlerDependentResource(String resourceName) {
+ protected Resource createHandlerDependentResource(String resourceName, Map<String, String> parameters) {
Resource resource = null;
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
@@ -402,11 +416,9 @@
try {
Class<?> loadedClass = Class.forName(resourceName, false, contextClassLoader);
- Class<? extends Resource> resourceClass = loadedClass.asSubclass(Resource.class);
-
boolean legitimateResource = false;
- DynamicResource annotation = resourceClass.getAnnotation(DynamicResource.class);
+ DynamicResource annotation = loadedClass.getAnnotation(DynamicResource.class);
legitimateResource = (annotation != null);
if (legitimateResource) {
LOGGER.debug(
@@ -434,7 +446,25 @@
}
if (legitimateResource) {
- resource = (Resource) resourceClass.newInstance();
+ Object wrappedResource;
+ if (Java2DUserResource.class.isAssignableFrom(loadedClass)) {
+ Java2DUserResource java2DUserResource = (Java2DUserResource) loadedClass.newInstance();
+ wrappedResource = java2DUserResource;
+ resource = new UserResourceAdaptor(new Java2DUserResourceAdaptor(java2DUserResource), java2DUserResource);
+ } else if (UserResource.class.isAssignableFrom(loadedClass)) {
+ UserResource userResource = (UserResource) loadedClass.newInstance();
+ wrappedResource = userResource;
+ resource = new UserResourceAdaptor(userResource, userResource);
+ } else {
+ Class<? extends Resource> resourceClass = loadedClass.asSubclass(Resource.class);
+ resource = (Resource) resourceClass.newInstance();
+ wrappedResource = resource;
+ }
+
+ if (parameters != null) {
+ injectProperties(wrappedResource, parameters);
+ }
+
resource.setResourceName(resourceName);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(MessageFormat.format("Successfully created instance of {0} resource",
@@ -462,7 +492,7 @@
result = new CompiledCSSResource(resourceName);
} else {
if ((resourceName != null) && ((libraryName == null) || (libraryName.length() == 0))) {
- result = createHandlerDependentResource(resourceName);
+ result = createHandlerDependentResource(resourceName, params);
}
if (result == null) {
@@ -470,10 +500,6 @@
}
}
- if (result != null) {
- injectProperties(result, params);
- }
-
return result;
}
@@ -508,4 +534,9 @@
public boolean libraryExists(String libraryName) {
return defaultHandler.libraryExists(libraryName);
}
+
+ @Override
+ public ResourceHandler getWrapped() {
+ return defaultHandler;
+ }
}
\ No newline at end of file
Modified: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/ResourceParameterELResolver.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/ResourceParameterELResolver.java 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/ResourceParameterELResolver.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -69,7 +69,9 @@
@Override
public void setValue(ELContext context, Object base, Object property, Object value) {
- throw new UnsupportedOperationException();
+ if (CONTEXT_ATTRIBUTE_NAME.equals(property) && base == null) {
+ throw new UnsupportedOperationException();
+ }
}
}
Modified: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/TestResource2.java
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/TestResource2.java 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/TestResource2.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -25,13 +25,14 @@
import java.awt.Dimension;
import java.awt.GradientPaint;
import java.awt.Graphics2D;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
import javax.faces.context.FacesContext;
import org.ajax4jsf.resource.Java2Dresource;
import org.ajax4jsf.util.HtmlColor;
-import org.ajax4jsf.util.NumericDataInputStream;
-import org.ajax4jsf.util.NumericDataOutputStream;
import org.richfaces.VersionBean;
import org.richfaces.skin.Skin;
import org.richfaces.skin.SkinFactory;
@@ -62,16 +63,15 @@
}
@Override
- protected void readState(FacesContext context, NumericDataInputStream stream) {
+ public void readState(FacesContext context, DataInput stream) throws IOException {
super.readState(context, stream);
- this.color = stream.readColor();
+ this.color = new Color(stream.readInt());
}
@Override
- protected void writeState(FacesContext context,
- NumericDataOutputStream stream) {
+ public void writeState(FacesContext context, DataOutput stream) throws IOException {
super.writeState(context, stream);
- stream.writeColor(this.color);
+ stream.writeInt(this.color.getRGB());
}
@Override
Copied: root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/UserResourceAdaptor.java (from rev 17594, root/core/trunk/impl/src/main/java/org/richfaces/resource/UserResourceAdaptor.java)
===================================================================
--- root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/UserResourceAdaptor.java (rev 0)
+++ root/core/branches/jsr-330/impl/src/main/java/org/richfaces/resource/UserResourceAdaptor.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -0,0 +1,145 @@
+/*
+ * 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.resource;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Date;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class UserResourceAdaptor extends AbstractCacheableResource implements VersionedResource, StateHolderResource {
+
+ private UserResource userResource;
+
+ private Object wrappedResource;
+
+ public UserResourceAdaptor(UserResource userResource, Object wrappedResource) {
+ super();
+ this.userResource = userResource;
+ this.wrappedResource = wrappedResource;
+ }
+
+ @Override
+ public InputStream getInputStream() throws IOException {
+ return userResource.getInputStream();
+ }
+
+ @Override
+ public Map<String, String> getResponseHeaders() {
+ Map<String, String> headers = super.getResponseHeaders();
+
+ Map<String, String> userHeaders = userResource.getResponseHeaders();
+ if (userHeaders != null) {
+ headers.putAll(userHeaders);
+ }
+
+ return headers;
+ }
+
+ @Override
+ public String getContentType() {
+ return userResource.getContentType();
+ }
+
+ @Override
+ protected int getContentLength(FacesContext context) {
+ return userResource.getContentLength();
+ }
+
+ @Override
+ protected Date getLastModified(FacesContext context) {
+ return userResource.getLastModified();
+ }
+
+ public String getVersion() {
+ if (wrappedResource instanceof VersionedResource) {
+ return ((VersionedResource) wrappedResource).getVersion();
+ }
+
+ return null;
+ }
+
+ @Override
+ public boolean isCacheable(FacesContext context) {
+ if (wrappedResource instanceof CacheableResource) {
+ return ((CacheableResource) wrappedResource).isCacheable(context);
+ }
+
+ return false;
+ }
+
+ @Override
+ public Date getExpires(FacesContext context) {
+ if (wrappedResource instanceof CacheableResource) {
+ return ((CacheableResource) wrappedResource).getExpires(context);
+ }
+
+ return null;
+ }
+
+ @Override
+ public String getEntityTag(FacesContext context) {
+ if (wrappedResource instanceof CacheableResource) {
+ return ((CacheableResource) wrappedResource).getEntityTag(context);
+ }
+
+ return null;
+ }
+
+ @Override
+ public int getTimeToLive(FacesContext context) {
+ if (wrappedResource instanceof CacheableResource) {
+ return ((CacheableResource) wrappedResource).getTimeToLive(context);
+ }
+
+ return 0;
+ }
+
+ public boolean isTransient() {
+ if (wrappedResource instanceof StateHolderResource) {
+ return ((StateHolderResource) wrappedResource).isTransient();
+ }
+
+ return true;
+ }
+
+ public void writeState(FacesContext context, DataOutput dataOutput) throws IOException {
+ if (wrappedResource instanceof StateHolderResource) {
+ ((StateHolderResource) wrappedResource).writeState(context, dataOutput);
+ }
+ }
+
+ public void readState(FacesContext context, DataInput dataInput) throws IOException {
+ if (wrappedResource instanceof StateHolderResource) {
+ ((StateHolderResource) wrappedResource).readState(context, dataInput);
+ }
+ }
+
+}
Modified: root/core/branches/jsr-330/impl/src/main/resources/META-INF/resources/richfaces-base-component.js
===================================================================
--- root/core/branches/jsr-330/impl/src/main/resources/META-INF/resources/richfaces-base-component.js 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/main/resources/META-INF/resources/richfaces-base-component.js 2010-06-14 16:48:35 UTC (rev 17624)
@@ -150,7 +150,8 @@
* @function
* @name RichFaces.BaseComponent#destroy
*
- * */
+ * */
+ // TODO: add to article
destroy: function() {
}
};
Modified: root/core/branches/jsr-330/impl/src/main/resources/META-INF/resources/richfaces-event.js
===================================================================
--- root/core/branches/jsr-330/impl/src/main/resources/META-INF/resources/richfaces-event.js 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/main/resources/META-INF/resources/richfaces-event.js 2010-06-14 16:48:35 UTC (rev 17624)
@@ -2,6 +2,9 @@
* @author Pavel Yaschenko
*/
+// TODO: add support to bind multiple events using type param as an object with eventType,function pairs // see bindById method
+// TODO: update js docs
+
(function($, richfaces) {
/**
@@ -27,13 +30,27 @@
return element;
}
+ var getHandlerWrapper = function (component, fn) {
+ return f = function (e,d){
+ fn.call(component||this, e, this, d);
+ };
+ }
+
+ var getMultipleHandlerWrapper = function (object, component) {
+ var result = {};
+ for (var type in object) {
+ result[type] = getHandlerWrapper(component, object[type]);
+ }
+ return result;
+ }
+
$.extend(richfaces.Event, {
/**
* @constant
* @name RichFaces.Event.RICH_NAMESPACE
* @type string
* */
- RICH_NAMESPACE : "RICH:",
+ RICH_NAMESPACE : "RICH",
/**
* Attach an event handler to execute when the DOM is fully loaded.
@@ -65,12 +82,10 @@
* It is a context for an event handler
* @return {function} function that binded to the element's event
* */
- bind : function(selector, type, fn, data) {
+ bind : function(selector, type, fn, component, data) {
// type: namespace can be used, like onclick.rf.conponentName
- var f = function (e,d){
- e.data.fn.call(e.data.component||this, e, this, d);
- };
- getEventElement(selector).bind(type, {component: data, fn:fn}, f);
+ var f = getHandlerWrapper(component, fn);
+ getEventElement(selector).bind(type, data, f);
return f;
},
@@ -86,12 +101,15 @@
* It is a context for an event handler
* @return {function} function that binded to the element's event
* */
- bindById : function(id, type, fn, data) {
+ bindById : function(id, type, fn, component, data) {
// type: namespace can be used, like onclick.rf.conponentName
- var f = function (e,d){
- e.data.fn.call(e.data.component||this, e, this, d);
- };
- $(document.getElementById(id)).bind(type, {component: data, fn:fn}, f);
+ if (typeof type == "object") {
+ // in this case fn == component object
+ $(document.getElementById(id)).bind(getMultipleHandlerWrapper(type, fn), data);
+ } else {
+ var f = getHandlerWrapper(component, fn);
+ $(document.getElementById(id)).bind(type, data, f);
+ }
return f;
},
@@ -108,12 +126,10 @@
* It is a context for an event handler
* @return {function} function that binded to the element's event
* */
- bindOne: function(selector, type, fn, data) {
+ bindOne: function(selector, type, fn, component, data) {
// type: namespace can be used, like onclick.rf.conponentName
- var f = function (e,d){
- e.data.fn.call(e.data.component||this, e, this, d);
- };
- getEventElement(selector).one(type, {component: data, fn:fn}, f);
+ var f = getHandlerWrapper(component, fn);
+ getEventElement(selector).one(type, data, f);
return f;
},
@@ -130,12 +146,10 @@
* It is a context for an event handler
* @return {function} function that binded to the element's event
* */
- bindOneById: function(id, type, fn, data) {
+ bindOneById: function(id, type, fn, component, data) {
// type: namespace can be used, like onclick.rf.conponentName
- var f = function (e,d){
- e.data.fn.call(e.data.component||this, e, this, d);
- };
- $(document.getElementById(id)).one(type, {component: data, fn:fn}, f);
+ var f = getHandlerWrapper(component, fn);
+ $(document.getElementById(id)).one(type, data, f);
return f;
},
Deleted: root/core/branches/jsr-330/impl/src/test/java/org/ajax4jsf/util/NumericStreamsTest.java
===================================================================
--- root/core/branches/jsr-330/impl/src/test/java/org/ajax4jsf/util/NumericStreamsTest.java 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/test/java/org/ajax4jsf/util/NumericStreamsTest.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -1,74 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-package org.ajax4jsf.util;
-
-import java.awt.Color;
-
-import junit.framework.TestCase;
-
-/**
- * @author Nick Belaevski
- * @since 4.0
- */
-public class NumericStreamsTest extends TestCase {
- public void testByte() throws Exception {
- byte[] bytes = new NumericDataOutputStream().writeByte((byte) 0xDF).writeByte((byte) 0x90).writeByte(
- (byte) 0xAA).getBytes();
- NumericDataInputStream inputStream = new NumericDataInputStream(bytes);
-
- assertEquals((byte) 0xDF, inputStream.readByte());
- assertEquals((byte) 0x90, inputStream.readByte());
- assertEquals((byte) 0xAA, inputStream.readByte());
- }
-
- public void testShort() throws Exception {
- byte[] bytes = new NumericDataOutputStream().writeShort((short) 0xA7DF).writeShort((short) 0xFE90).writeShort(
- (short) 0x34AA).getBytes();
- NumericDataInputStream inputStream = new NumericDataInputStream(bytes);
-
- assertEquals((short) 0xA7DF, inputStream.readShort());
- assertEquals((short) 0xFE90, inputStream.readShort());
- assertEquals((short) 0x34AA, inputStream.readShort());
- }
-
- public void testColor() throws Exception {
- byte[] bytes = new NumericDataOutputStream().writeColor(new Color(0xA7DFE0)).writeIntColor(0xE2349A).writeColor(
- new Color(0x4812F9)).getBytes();
- NumericDataInputStream inputStream = new NumericDataInputStream(bytes);
-
- assertEquals(0xA7DFE0, inputStream.readIntColor());
- assertEquals(new Color(0xE2349A), inputStream.readColor());
- assertEquals(0x4812F9, inputStream.readIntColor());
- }
-
- public void testInt() throws Exception {
- byte[] bytes =
- new NumericDataOutputStream().writeInt(0x12A7DFE0).writeInt(0x67E2349A).writeInt(0xBD4812F9).getBytes();
- NumericDataInputStream inputStream = new NumericDataInputStream(bytes);
-
- assertEquals(0x12A7DFE0, inputStream.readInt());
- assertEquals(0x67E2349A, inputStream.readInt());
- assertEquals(0xBD4812F9, inputStream.readInt());
- }
-}
Modified: root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/AbstractBaseResourceTest.java
===================================================================
--- root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/AbstractBaseResourceTest.java 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/AbstractBaseResourceTest.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -24,6 +24,8 @@
package org.richfaces.resource;
import java.io.ByteArrayInputStream;
+import java.io.DataInput;
+import java.io.DataOutput;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
@@ -34,7 +36,6 @@
import java.util.Map;
import java.util.TimeZone;
-import javax.faces.component.StateHolder;
import javax.faces.context.FacesContext;
import org.easymock.EasyMock;
@@ -125,12 +126,12 @@
}
public void testGetRequestPath() throws Exception {
- Object resourceState = new Object();
+ String resourceState = "data";
ResourceCodec resourceCodec = EasyMock.createMock(ResourceCodec.class);
EasyMock.expect(resourceCodec.encodeResource(EasyMock.same(facesContext),
EasyMock.eq("org.richfaces.resource.MockStateAwareResource"),
- EasyMock.same(resourceState), EasyMock.eq("4_0_alpha"))).andReturn("/rfRes/Resource0/4_0_alpha/data");
+ EasyMock.aryEq(resourceState.getBytes()), EasyMock.eq("4_0_alpha"))).andReturn("/rfRes/Resource0/4_0_alpha/data");
EasyMock.expect(resourceCodec.encodeResource(EasyMock.same(facesContext),
EasyMock.eq("org.richfaces.resource.MockStateAwareResource"),
EasyMock.eq(null), EasyMock.eq("4_0_alpha"))).andReturn("/rfRes/Resource1/4_0_alpha");
@@ -143,7 +144,7 @@
MockStateAwareResourceImpl stateAwareResourceImpl = new MockStateAwareResourceImpl();
stateAwareResourceImpl.setVersion("4_0_alpha");
- stateAwareResourceImpl.restoreState(facesContext, resourceState);
+ stateAwareResourceImpl.setState(resourceState);
assertEquals("org.richfaces.resource.MockStateAwareResource", stateAwareResourceImpl.getResourceName());
assertEquals("/rfRes/Resource0/4_0_alpha/data.jsf", stateAwareResourceImpl.getRequestPath());
stateAwareResourceImpl.setTransient(true);
@@ -191,7 +192,6 @@
assertEquals(130, urlConnection.getContentLength());
assertEquals("image/gif", urlConnection.getContentType());
assertEquals(lastModified.getTime(), urlConnection.getLastModified());
- assertEquals(expired.getTime(), urlConnection.getExpiration());
assertSame(stream, urlConnection.getInputStream());
assertSame(url, urlConnection.getURL());
@@ -202,7 +202,6 @@
assertEquals(-1, urlConnection2.getContentLength());
assertNull(urlConnection2.getContentType());
assertEquals(0, urlConnection2.getLastModified());
- assertTrue(urlConnection2.getExpiration() > 0);
}
public void testDefaults() throws Exception {
@@ -299,7 +298,7 @@
}
@Override
- protected Date getExpires(FacesContext context) {
+ public Date getExpires(FacesContext context) {
return expired;
}
@@ -308,7 +307,7 @@
}
@Override
- protected String getEntityTag(FacesContext context) {
+ public String getEntityTag(FacesContext context) {
return entityTag;
}
@@ -334,7 +333,7 @@
}
@Override
- protected int getTimeToLive(FacesContext context) {
+ public int getTimeToLive(FacesContext context) {
return ttl;
}
@@ -344,30 +343,37 @@
}
- private class MockStateAwareResourceImpl extends MockResourceImpl implements StateHolder {
- private boolean _transient = false;
- private Object resourceState;
+ private class MockStateAwareResourceImpl extends MockResourceImpl implements StateHolderResource {
+ private boolean _transient;
+
+ private String resourceState;
+
public MockStateAwareResourceImpl() {
super();
setResourceName("org.richfaces.resource.MockStateAwareResource");
}
+ public void setState(String resourceState) {
+ this.resourceState = resourceState;
+ }
+
+ public void setTransient(boolean transient1) {
+ _transient = transient1;
+ }
+
public boolean isTransient() {
return _transient;
}
- public void setTransient(boolean newTransientValue) {
- this._transient = newTransientValue;
+ public void readState(FacesContext context, DataInput dataInput) throws IOException {
+ resourceState = dataInput.readLine();
}
- public Object saveState(FacesContext context) {
- return resourceState;
+ public void writeState(FacesContext context, DataOutput objectOutput) throws IOException {
+ objectOutput.writeBytes(resourceState);
}
- public void restoreState(FacesContext context, Object state) {
- this.resourceState = state;
- }
}
Modified: root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/AbstractCacheableResourceTest.java
===================================================================
--- root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/AbstractCacheableResourceTest.java 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/AbstractCacheableResourceTest.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -276,7 +276,7 @@
}
@Override
- protected String getEntityTag(FacesContext context) {
+ public String getEntityTag(FacesContext context) {
return entityTag;
}
Modified: root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/CacheableResourceImpl.java
===================================================================
--- root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/CacheableResourceImpl.java 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/CacheableResourceImpl.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -83,7 +83,7 @@
}
@Override
- protected Date getExpires(FacesContext context) {
+ public Date getExpires(FacesContext context) {
return ResourceHandlerImplTest.expires;
}
}
Modified: root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/ResourceHandlerImplTest.java
===================================================================
--- root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/ResourceHandlerImplTest.java 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/ResourceHandlerImplTest.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -224,16 +224,16 @@
EasyMock.expect(mockedCodec.decodeResourceName(EasyMock.<FacesContext>notNull(),
EasyMock.eq("StateHolderResource"))).andReturn("org.richfaces.resource.StateHolderResourceImpl");
EasyMock.expect(mockedCodec.decodeResourceData(EasyMock.<FacesContext>notNull(),
- EasyMock.eq("StateHolderResource"))).andReturn("test text");
+ EasyMock.eq("StateHolderResource"))).andReturn("test text".getBytes());
EasyMock.expect(mockedCodec.decodeResourceVersion(EasyMock.<FacesContext>notNull(),
EasyMock.eq("StateHolderResource"))).andReturn(null);
EasyMock.expect(mockedCodec.getResourceKey(EasyMock.<FacesContext>notNull(),
- EasyMock.eq("StateHolderResource"))).andReturn("StateHolderResource.jsf?do=1");
+ EasyMock.eq("StateHolderResource"))).andReturn("StateHolderResource.jsf?db=1");
EasyMock.replay(mockedCodec);
ServiceTracker.setService(facesContext, ResourceCodec.class, mockedCodec);
WebRequestSettings settings =
- new WebRequestSettings(new URL("http://localhost/rfRes/StateHolderResource.jsf?do=1"));
+ new WebRequestSettings(new URL("http://localhost/rfRes/StateHolderResource.jsf?db=1"));
WebResponse resourceResponse = webClient.loadWebResponse(settings);
assertEquals(HttpServletResponse.SC_OK, resourceResponse.getStatusCode());
Modified: root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/StateHolderResourceImpl.java
===================================================================
--- root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/StateHolderResourceImpl.java 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/test/java/org/richfaces/resource/StateHolderResourceImpl.java 2010-06-14 16:48:35 UTC (rev 17624)
@@ -24,12 +24,13 @@
package org.richfaces.resource;
import java.io.ByteArrayInputStream;
+import java.io.DataInput;
+import java.io.DataOutput;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import javax.faces.FacesException;
-import javax.faces.component.StateHolder;
import javax.faces.context.FacesContext;
/**
@@ -37,7 +38,7 @@
* @since 4.0
*/
@DynamicResource
-public class StateHolderResourceImpl extends AbstractCacheableResource implements StateHolder {
+public class StateHolderResourceImpl extends AbstractCacheableResource implements StateHolderResource {
private Object state = "";
@Override
@@ -64,4 +65,12 @@
public void setTransient(boolean newTransientValue) {
throw new UnsupportedOperationException();
}
+
+ public void readState(FacesContext context, DataInput dataInput) throws IOException {
+ state = dataInput.readLine();
+ }
+
+ public void writeState(FacesContext context, DataOutput dataOutput) throws IOException {
+ dataOutput.writeBytes(state.toString());
+ }
}
Modified: root/core/branches/jsr-330/impl/src/test/resources/javascript/richfaces-event-qunit.js
===================================================================
--- root/core/branches/jsr-330/impl/src/test/resources/javascript/richfaces-event-qunit.js 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/test/resources/javascript/richfaces-event-qunit.js 2010-06-14 16:48:35 UTC (rev 17624)
@@ -20,12 +20,10 @@
var domElement = element;
var callback = function (e, o, d) {
- expect(6);
+ expect(4);
equals(e.type, "click");
equals(o, element);
equals(d, testData2);
- equals(e.data.component, testData1);
- equals(typeof e.data.fn, "function");
equals(this, testData1);
};
return callback;
Modified: root/core/branches/jsr-330/impl/src/test/resources/resources/full.css
===================================================================
--- root/core/branches/jsr-330/impl/src/test/resources/resources/full.css 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/test/resources/resources/full.css 2010-06-14 16:48:35 UTC (rev 17624)
@@ -22,5 +22,5 @@
padding: 10px !important;
border: 1px solid green;
background-image: url(image.png);
- background: red url(/rfRes/org.richfaces.renderkit.html.images.ButtonBackgroundImage.jsf?db=eAF79urt!-Pnr!xn4mZgYAAAREsHMw__);
+ background: red url(/rfRes/org.richfaces.renderkit.html.images.ButtonBackgroundImage.jsf?db=eAH7!!bVs!9Xzh9nYmBg4AYARSUHMw__);
}
Modified: root/core/branches/jsr-330/impl/src/test/resources/resources/importedEL.css
===================================================================
--- root/core/branches/jsr-330/impl/src/test/resources/resources/importedEL.css 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/test/resources/resources/importedEL.css 2010-06-14 16:48:35 UTC (rev 17624)
@@ -22,5 +22,5 @@
padding: 10px !important;
border: 1px solid green;
background-image: url(image.png);
- background: red url(/rfRes/org.richfaces.renderkit.html.images.ButtonBackgroundImage.jsf?db=eAF79urt!-Pnr!xn4mZgYAAAREsHMw__);
+ background: red url(/rfRes/org.richfaces.renderkit.html.images.ButtonBackgroundImage.jsf?db=eAH7!!bVs!9Xzh9nYmBg4AYARSUHMw__);
}
\ No newline at end of file
Modified: root/core/branches/jsr-330/impl/src/test/resources/resources/resource.css
===================================================================
--- root/core/branches/jsr-330/impl/src/test/resources/resources/resource.css 2010-06-13 17:38:26 UTC (rev 17623)
+++ root/core/branches/jsr-330/impl/src/test/resources/resources/resource.css 2010-06-14 16:48:35 UTC (rev 17624)
@@ -1,3 +1,3 @@
body {
- background: red url(/rfRes/org.richfaces.renderkit.html.images.ButtonBackgroundImage.jsf?db=eAF79urt!-Pnr!xn4mZgYAAAREsHMw__);
+ background: red url(/rfRes/org.richfaces.renderkit.html.images.ButtonBackgroundImage.jsf?db=eAH7!!bVs!9Xzh9nYmBg4AYARSUHMw__);
}
\ No newline at end of file
14 years, 6 months
JBoss Rich Faces SVN: r17623 - in root/core/trunk: impl/src/main/java/org/richfaces/application and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-06-13 13:38:26 -0400 (Sun, 13 Jun 2010)
New Revision: 17623
Modified:
root/core/trunk/api/src/main/java/org/richfaces/resource/ResourceParameter.java
root/core/trunk/api/src/main/java/org/richfaces/resource/UserResource.java
root/core/trunk/impl/src/main/java/org/richfaces/application/DependencyInjectionServiceImpl.java
root/core/trunk/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
root/core/trunk/impl/src/main/java/org/richfaces/resource/ResourceParameterELResolver.java
root/core/trunk/impl/src/test/java/org/richfaces/resource/StateHolderResourceImpl.java
Log:
@ResourceParameter handling updates:
- Removed 'value', added 'name' & 'expression' attributes
TODOs committed
Modified: root/core/trunk/api/src/main/java/org/richfaces/resource/ResourceParameter.java
===================================================================
--- root/core/trunk/api/src/main/java/org/richfaces/resource/ResourceParameter.java 2010-06-13 14:29:14 UTC (rev 17622)
+++ root/core/trunk/api/src/main/java/org/richfaces/resource/ResourceParameter.java 2010-06-13 17:38:26 UTC (rev 17623)
@@ -33,8 +33,25 @@
@Target({ElementType.FIELD, ElementType.METHOD})
public @interface ResourceParameter {
- public String value();
-
+ /**
+ * Name of the parameter to be injected. Defaults to property name if it is omitted.
+ *
+ * @return name
+ */
+ public String name() default "";
+
+ /**
+ * Expression, which value is injected into the property.
+ *
+ * @return
+ */
+ public String expression() default "";
+
+ /**
+ * Default value for injected property.
+ *
+ * @return
+ */
public String defaultValue() default "";
}
Modified: root/core/trunk/api/src/main/java/org/richfaces/resource/UserResource.java
===================================================================
--- root/core/trunk/api/src/main/java/org/richfaces/resource/UserResource.java 2010-06-13 14:29:14 UTC (rev 17622)
+++ root/core/trunk/api/src/main/java/org/richfaces/resource/UserResource.java 2010-06-13 17:38:26 UTC (rev 17623)
@@ -30,6 +30,7 @@
* @author Nick Belaevski
*
*/
+//TODO nick - add abstract class
public interface UserResource {
public Map<String, String> getResponseHeaders();
Modified: root/core/trunk/impl/src/main/java/org/richfaces/application/DependencyInjectionServiceImpl.java
===================================================================
--- root/core/trunk/impl/src/main/java/org/richfaces/application/DependencyInjectionServiceImpl.java 2010-06-13 14:29:14 UTC (rev 17622)
+++ root/core/trunk/impl/src/main/java/org/richfaces/application/DependencyInjectionServiceImpl.java 2010-06-13 17:38:26 UTC (rev 17623)
@@ -45,6 +45,7 @@
import org.richfaces.log.RichfacesLogger;
import org.richfaces.resource.PostConstructResource;
import org.richfaces.resource.ResourceParameter;
+import org.richfaces.resource.ResourceParameterELResolver;
import org.slf4j.Logger;
/**
@@ -113,10 +114,33 @@
expectedType = propertyType;
}
- Object propertyValue = getExpressionValue(context, getDependency().value(), expectedType);
+ ResourceParameter resourceParameter = getDependency();
+ String expression = resourceParameter.expression();
+ String name = resourceParameter.name();
+
+ if (expression.length() != 0 && name.length() != 0) {
+ throw new IllegalStateException(MessageFormat.format(
+ "'name' and 'expression' should not be specified simultaneously: {0}",
+ resourceParameter));
+ }
+
+ Object propertyValue = null;
+ if (expression.length() != 0) {
+ propertyValue = getExpressionValue(context, expression, expectedType);
+ } else {
+ if (name.length() == 0) {
+ name = getPropertyDescriptor().getName();
+ }
+
+ Map<String, Object> parameters = (Map<String, Object>) context.getAttributes().get(
+ ResourceParameterELResolver.CONTEXT_ATTRIBUTE_NAME);
+
+ propertyValue = parameters.get(name);
+ }
+
if (propertyValue == null || "".equals(propertyValue)) {
- String defaultValue = getDependency().defaultValue();
+ String defaultValue = resourceParameter.defaultValue();
if (defaultValue != null && defaultValue.length() != 0) {
propertyValue = getExpressionValue(context, defaultValue, expectedType);
}
Modified: root/core/trunk/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
===================================================================
--- root/core/trunk/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java 2010-06-13 14:29:14 UTC (rev 17622)
+++ root/core/trunk/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java 2010-06-13 17:38:26 UTC (rev 17623)
@@ -458,6 +458,7 @@
if (resourceName.lastIndexOf(".ecss") != -1) {
result = new CompiledCSSResource(resourceName);
} else {
+ //TODO nick - libraryName as package name?
if ((resourceName != null) && ((libraryName == null) || (libraryName.length() == 0))) {
result = createHandlerDependentResource(resourceName, params);
}
Modified: root/core/trunk/impl/src/main/java/org/richfaces/resource/ResourceParameterELResolver.java
===================================================================
--- root/core/trunk/impl/src/main/java/org/richfaces/resource/ResourceParameterELResolver.java 2010-06-13 14:29:14 UTC (rev 17622)
+++ root/core/trunk/impl/src/main/java/org/richfaces/resource/ResourceParameterELResolver.java 2010-06-13 17:38:26 UTC (rev 17623)
@@ -34,7 +34,7 @@
*/
public class ResourceParameterELResolver extends ELResolver {
- static final String CONTEXT_ATTRIBUTE_NAME = "rfResourceParam";
+ public static final String CONTEXT_ATTRIBUTE_NAME = "rfResourceParam";
@Override
public Class<?> getCommonPropertyType(ELContext context, Object base) {
Modified: root/core/trunk/impl/src/test/java/org/richfaces/resource/StateHolderResourceImpl.java
===================================================================
--- root/core/trunk/impl/src/test/java/org/richfaces/resource/StateHolderResourceImpl.java 2010-06-13 14:29:14 UTC (rev 17622)
+++ root/core/trunk/impl/src/test/java/org/richfaces/resource/StateHolderResourceImpl.java 2010-06-13 17:38:26 UTC (rev 17623)
@@ -38,6 +38,7 @@
* @since 4.0
*/
@DynamicResource
+//TODO add tests for StateHolder
public class StateHolderResourceImpl extends AbstractCacheableResource implements StateHolderResource {
private Object state = "";
14 years, 6 months