You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gp...@apache.org on 2011/03/29 13:18:09 UTC
svn commit: r1086547 - in /myfaces/extensions/cdi/trunk:
core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/event/
core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/util/
examples/jsf-examples/hello_myf...
Author: gpetracek
Date: Tue Mar 29 11:18:09 2011
New Revision: 1086547
URL: http://svn.apache.org/viewvc?rev=1086547&view=rev
Log:
EXTCDI-151 improve javadoc and cleanup
Modified:
myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/event/WindowContextEvent.java
myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/util/ClassUtils.java
myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf20/pom.xml
myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf20/src/test/java/org/apache/myfaces/extensions/cdi/example/test/BaseCargoTest.java
myfaces/extensions/cdi/trunk/jee-modules/bv-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/bv/impl/CdiAwareBeanValidationProducer.java
myfaces/extensions/cdi/trunk/jee-modules/bv-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/bv/impl/CdiAwareValidatorFactory.java
myfaces/extensions/cdi/trunk/jee-modules/bv-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/bv/impl/InjectableConstraintValidatorFactory.java
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/listener/startup/JsfStartupEvent.java
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/DefaultWindowContextQuotaHandler.java
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/ExceptionUtils.java
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/JsfUtils.java
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/SecurityUtils.java
myfaces/extensions/cdi/trunk/jse-modules/scripting-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/scripting/impl/ScriptEngineManagerProducer.java
myfaces/extensions/cdi/trunk/jse-modules/scripting-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/scripting/impl/spi/LanguageBean.java
myfaces/extensions/cdi/trunk/jse-modules/scripting-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/scripting/impl/util/ExceptionUtils.java
myfaces/extensions/cdi/trunk/test-modules/cargo-test-module/pom.xml
myfaces/extensions/cdi/trunk/test-modules/cargo-test-module/src/test/java/org/apache/myfaces/extensions/cdi/test/cargo/conversation/BaseConversationTest.java
Modified: myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/event/WindowContextEvent.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/event/WindowContextEvent.java?rev=1086547&r1=1086546&r2=1086547&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/event/WindowContextEvent.java (original)
+++ myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/event/WindowContextEvent.java Tue Mar 29 11:18:09 2011
@@ -29,6 +29,10 @@ public abstract class WindowContextEvent
{
private final WindowContext windowContext;
+ /**
+ * Constructor for creating the event for the given {@link WindowContext}
+ * @param windowContext window-context for which the event gets created
+ */
public WindowContextEvent(WindowContext windowContext)
{
this.windowContext = windowContext;
Modified: myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/util/ClassUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/util/ClassUtils.java?rev=1086547&r1=1086546&r2=1086547&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/util/ClassUtils.java (original)
+++ myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/util/ClassUtils.java Tue Mar 29 11:18:09 2011
@@ -57,6 +57,9 @@ public abstract class ClassUtils
{
ClassLoader loader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
{
+ /**
+ * {@inheritDoc}
+ */
public ClassLoader run()
{
try
Modified: myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf20/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf20/pom.xml?rev=1086547&r1=1086546&r2=1086547&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf20/pom.xml (original)
+++ myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf20/pom.xml Tue Mar 29 11:18:09 2011
@@ -35,7 +35,7 @@
<properties>
<cargo.context>cargo-test</cargo.context>
- <cargo.port>8787</cargo.port> <!-- use port 8787 in order to prevent port-already-in-use on hudson -->
+ <cargo.port>9090</cargo.port> <!-- use port 9090 in order to prevent port-already-in-use on hudson -->
</properties>
<dependencies>
Modified: myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf20/src/test/java/org/apache/myfaces/extensions/cdi/example/test/BaseCargoTest.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf20/src/test/java/org/apache/myfaces/extensions/cdi/example/test/BaseCargoTest.java?rev=1086547&r1=1086546&r2=1086547&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf20/src/test/java/org/apache/myfaces/extensions/cdi/example/test/BaseCargoTest.java (original)
+++ myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf20/src/test/java/org/apache/myfaces/extensions/cdi/example/test/BaseCargoTest.java Tue Mar 29 11:18:09 2011
@@ -28,6 +28,6 @@ abstract class BaseCargoTest extends Abs
@Override
protected String getCustomBaseURL()
{
- return "http://localhost:8787/cargo-test/";
+ return "http://localhost:9090/cargo-test/";
}
}
\ No newline at end of file
Modified: myfaces/extensions/cdi/trunk/jee-modules/bv-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/bv/impl/CdiAwareBeanValidationProducer.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/bv-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/bv/impl/CdiAwareBeanValidationProducer.java?rev=1086547&r1=1086546&r2=1086547&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/bv-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/bv/impl/CdiAwareBeanValidationProducer.java (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/bv-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/bv/impl/CdiAwareBeanValidationProducer.java Tue Mar 29 11:18:09 2011
@@ -42,6 +42,13 @@ public class CdiAwareBeanValidationProdu
{
}
+ /**
+ * Creates an injectable {@link ValidatorFactory} which supports cdi based dependency injection for
+ * {@link javax.validation.ConstraintValidator}s
+ * @param validatorFactoryResolver resolver for resolving a custom configured {@link ValidatorFactory}
+ * for wrapping it
+ * @return injectable validator-factory
+ */
@Produces
@Dependent
@Advanced
@@ -58,6 +65,13 @@ public class CdiAwareBeanValidationProdu
return new InjectableValidatorFactory(new CdiAwareValidatorFactory(validatorFactory));
}
+ /**
+ * Creates an injectable {@link Validator} which supports cdi based dependency injection for
+ * {@link javax.validation.ConstraintValidator}s
+ * @param validatorFactoryResolver resolver for resolving a custom configured {@link ValidatorFactory}
+ * which should be used as wrapped factory
+ * @return injectable validator
+ */
@Produces
@Dependent
@Advanced
@@ -69,6 +83,13 @@ public class CdiAwareBeanValidationProdu
validatorFactoryResolver).getValidator());
}
+ /**
+ * Creates an injectable {@link ConstraintValidatorFactory} which supports cdi based dependency injection for
+ * {@link javax.validation.ConstraintValidator}s
+ * @param validatorFactoryResolver resolver for resolving a custom configured {@link ValidatorFactory}
+ * which should be used as wrapped factory
+ * @return injectable constraint-validator-factory
+ */
@Produces
@Dependent
@Advanced
@@ -80,6 +101,12 @@ public class CdiAwareBeanValidationProdu
.getConstraintValidatorFactory());
}
+ /**
+ * Creates an injectable {@link MessageInterpolator}
+ * @param validatorFactoryResolver resolver for resolving a custom configured {@link ValidatorFactory}
+ * which should be used as wrapped factory
+ * @return injectable message-interpolator
+ */
@Produces
@Dependent
@Advanced
Modified: myfaces/extensions/cdi/trunk/jee-modules/bv-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/bv/impl/CdiAwareValidatorFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/bv-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/bv/impl/CdiAwareValidatorFactory.java?rev=1086547&r1=1086546&r2=1086547&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/bv-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/bv/impl/CdiAwareValidatorFactory.java (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/bv-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/bv/impl/CdiAwareValidatorFactory.java Tue Mar 29 11:18:09 2011
@@ -91,6 +91,9 @@ public class CdiAwareValidatorFactory im
{
return new ConstraintValidatorFactory()
{
+ /**
+ * {@inheritDoc}
+ */
@SuppressWarnings({"unchecked"})
public <T extends ConstraintValidator<?, ?>> T getInstance(Class<T> targetClass)
{
Modified: myfaces/extensions/cdi/trunk/jee-modules/bv-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/bv/impl/InjectableConstraintValidatorFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/bv-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/bv/impl/InjectableConstraintValidatorFactory.java?rev=1086547&r1=1086546&r2=1086547&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/bv-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/bv/impl/InjectableConstraintValidatorFactory.java (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/bv-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/bv/impl/InjectableConstraintValidatorFactory.java Tue Mar 29 11:18:09 2011
@@ -59,6 +59,10 @@ class InjectableConstraintValidatorFacto
/*
* generated
*/
+
+ /**
+ * {@inheritDoc}
+ */
public <T extends ConstraintValidator<?, ?>> T getInstance(Class<T> tClass)
{
return getWrapped().getInstance(tClass);
Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/listener/startup/JsfStartupEvent.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/listener/startup/JsfStartupEvent.java?rev=1086547&r1=1086546&r2=1086547&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/listener/startup/JsfStartupEvent.java (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/listener/startup/JsfStartupEvent.java Tue Mar 29 11:18:09 2011
@@ -38,6 +38,9 @@ class JsfStartupEvent implements Startup
this.facesContext = facesContext;
}
+ /**
+ * {@inheritDoc}
+ */
public Map<String, Serializable> getApplicationParameters()
{
return this.facesContext.getExternalContext().getInitParameterMap();
Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/DefaultWindowContextQuotaHandler.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/DefaultWindowContextQuotaHandler.java?rev=1086547&r1=1086546&r2=1086547&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/DefaultWindowContextQuotaHandler.java (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/DefaultWindowContextQuotaHandler.java Tue Mar 29 11:18:09 2011
@@ -74,7 +74,7 @@ public class DefaultWindowContextQuotaHa
{
if(!cleanupWindowContext())
{
- throw tooManyOpenWindowException(this.maxWindowContextCount);
+ throw tooManyOpenWindowException();
}
}
Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/ExceptionUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/ExceptionUtils.java?rev=1086547&r1=1086546&r2=1086547&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/ExceptionUtils.java (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/ExceptionUtils.java Tue Mar 29 11:18:09 2011
@@ -46,36 +46,59 @@ public abstract class ExceptionUtils
// prevent instantiation
}
- public static RuntimeException tooManyOpenWindowException(int windowContextTimeoutInMinutes)
+ /**
+ * Creates an exception which signals that a user opened too many windows.
+ * @return exception which can be thrown
+ */
+ public static RuntimeException tooManyOpenWindowException()
{
return new UnhandledException("Too many active windows/tabs have been opened!" +
- " Please continue with one of the existing windows or wait up to "
- + windowContextTimeoutInMinutes + " minutes.");
+ " Please continue with one of the existing windows.");
}
+ /**
+ * Creates an exception in case of a custom implementation of {@link WindowContextManager} which doesn't implement
+ * {@link EditableWindowContextManager}
+ * @param windowContextManager found window-context-manager instance
+ * @return exception which can be thrown
+ */
public static RuntimeException windowContextManagerNotEditableException(WindowContextManager windowContextManager)
{
return new UnhandledException(windowContextManager.getClass().getName() + " has to implement "
+ EditableWindowContextManager.class.getName());
}
+ /**
+ * Creates an exception in case of a custom implementation of {@link WindowContext} which doesn't implement
+ * {@link EditableWindowContext}
+ * @param windowContext found window-context instance
+ * @return exception which can be thrown
+ */
public static RuntimeException windowContextNotEditableException(WindowContext windowContext)
{
return new UnhandledException(windowContext.getClass().getName() + " has to implement "
+ EditableWindowContext.class.getName());
}
+ /**
+ * Creates an exception in case of a custom implementation of {@link Conversation} which doesn't implement
+ * {@link EditableConversation}
+ * @param conversation found conversation instance
+ * @return exception which can be thrown
+ */
public static RuntimeException conversationNotEditableException(Conversation conversation)
{
return new UnhandledException(conversation.getClass().getName() + " has to implement "
+ EditableConversation.class.getName());
}
- public static RuntimeException invalidViewException(String viewId)
- {
- return new UnhandledException("View-ID: " + viewId + " doesn't exist.");
- }
-
+ /**
+ * Creates an exception if a method is annotated with {@link BeforePhase} or {@link AfterPhase} and
+ * has an unsupported signature
+ * @param targetClass class which contains the method
+ * @param method annotated but invalid method
+ * @return exception which can be thrown
+ */
public static IllegalArgumentException invalidPhasesCallbackMethod(Class targetClass, Method method)
{
return new IllegalArgumentException(targetClass.getName() + "#" + method.getName() + " is annotated with " +
@@ -85,6 +108,10 @@ public abstract class ExceptionUtils
PhaseId.class.getName());
}
+ /**
+ * Creates an exception in case of an unsupported usage of {@link BeforePhase}
+ * @return exception which can be thrown
+ */
public static IllegalStateException unsupportedPhasesLifecycleCallback()
{
return new IllegalStateException("The usage of @ + " + BeforePhase.class.getName() +
@@ -94,11 +121,23 @@ public abstract class ExceptionUtils
"protected void preRestoreView(@Observes @BeforePhase(PhaseId.RESTORE_VIEW) PhaseEvent event) ");
}
+ /**
+ * Creates an exception if there is no conversation with the given key
+ * @param conversationKey current conversation-key
+ * @return exception which can be thrown
+ */
public static IllegalArgumentException conversationNotFoundException(String conversationKey)
{
return new IllegalArgumentException("Cannot find conversation with key: " + conversationKey);
}
+ /**
+ * Creates an exception if {@link org.apache.myfaces.extensions.cdi.jsf.api.config.view.Page}
+ * is used for a page bean and there is no class annotated with {@link InlineViewConfigRoot}
+ * to mark the package root
+ * @param viewDefinitionClass class with the invalid usage
+ * @return exception which can be thrown
+ */
public static IllegalStateException missingInlineViewConfigRootMarkerException(
Class<? extends ViewConfig> viewDefinitionClass)
{
@@ -115,6 +154,12 @@ public abstract class ExceptionUtils
throw new IllegalStateException(message.toString());
}
+ /**
+ * Creates an exception if there are multiple classes annotated with {@link InlineViewConfigRoot} in an web-app.
+ * @param storedPageClass registered class which hosts {@link InlineViewConfigRoot}
+ * @param viewConfigRootClass current class which also hosts {@link InlineViewConfigRoot}
+ * @return exception which can be thrown
+ */
public static IllegalStateException ambiguousViewConfigRootException(
Class storedPageClass, Class viewConfigRootClass)
{
@@ -129,6 +174,13 @@ public abstract class ExceptionUtils
throw new IllegalStateException(message.toString());
}
+ /**
+ * Creates an exception if there are multiple classes which represent the same view-id
+ * @param viewId current view-id
+ * @param newDef current view-config class
+ * @param existingDef registered view-config class
+ * @return exception which can be thrown
+ */
public static IllegalArgumentException ambiguousViewDefinitionException(String viewId,
Class<? extends ViewConfig> newDef,
Class<? extends ViewConfig> existingDef)
@@ -139,6 +191,12 @@ public abstract class ExceptionUtils
newDef.getName() + ") is invalid");
}
+ /**
+ * Creates an exception if there are multiple classes which represent the same default-error-view
+ * @param newDef current view-config class
+ * @param existingDef registered view-config class
+ * @return exception which can be thrown
+ */
public static IllegalStateException ambiguousDefaultErrorViewDefinitionException(Class<? extends ViewConfig> newDef,
Class<? extends ViewConfig> existingDef)
{
Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/JsfUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/JsfUtils.java?rev=1086547&r1=1086546&r2=1086547&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/JsfUtils.java (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/JsfUtils.java Tue Mar 29 11:18:09 2011
@@ -18,8 +18,6 @@
*/
package org.apache.myfaces.extensions.cdi.jsf.impl.util;
-import org.apache.myfaces.extensions.cdi.core.api.util.ClassUtils;
-
import javax.faces.FactoryFinder;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
@@ -50,16 +48,26 @@ public abstract class JsfUtils
// prevent instantiation
}
+ /**
+ * Resets the conversation cache of the current request
+ */
public static void resetConversationCache()
{
RequestCache.resetConversationCache();
}
+ /**
+ * Resets all caches of the current request
+ */
public static void resetCaches()
{
RequestCache.resetCache();
}
+ /**
+ * Adds the given {@link PhaseListener} to the application
+ * @param phaseListener current phase-listener
+ */
public static void registerPhaseListener(PhaseListener phaseListener)
{
LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder.getFactory(
@@ -76,11 +84,21 @@ public abstract class JsfUtils
}
}
+ /**
+ * Exposes the default message-bundle of jsf for the given {@link Locale}
+ * @param locale current local
+ * @return default message-bundle
+ */
public static ResourceBundle getDefaultFacesMessageBundle(Locale locale)
{
return ResourceBundle.getBundle(FacesMessage.FACES_MESSAGES, locale);
}
+ /**
+ * Exposes the (optional) custom message-bundle configured in the faces-config for the given {@link Locale}
+ * @param locale current local
+ * @return custom message-bundle
+ */
public static ResourceBundle getCustomFacesMessageBundle(Locale locale)
{
FacesContext facesContext = FacesContext.getCurrentInstance();
@@ -94,31 +112,14 @@ public abstract class JsfUtils
return ResourceBundle.getBundle(bundleName, locale);
}
- @Deprecated
- public static <T> T getCustomImplementation(Class<T> targetType)
- {
- String className = getWebXmlParameter(targetType.getName());
-
- if(className != null && !"".equals(className.trim()))
- {
- return ClassUtils.tryToInstantiateClassForName(className, targetType);
- }
- return null;
- }
-
- public static String getWebXmlParameter(String parameterKey)
- {
- return FacesContext.getCurrentInstance().getExternalContext().getInitParameter(parameterKey);
- }
-
/**
* Encodes the given value using URLEncoder.encode() with the charset returned
* from ExternalContext.getResponseCharacterEncoding().
* This is exactly how the ExternalContext impl encodes URL parameter values.
*
- * @param value
- * @param externalContext
- * @return
+ * @param value value which should be encoded
+ * @param externalContext current external-context
+ * @return encoded value
*/
public static String encodeURLParameterValue(String value, ExternalContext externalContext)
{
@@ -134,6 +135,12 @@ public abstract class JsfUtils
}
}
+ /**
+ * Adds the current request-parameters to the given url
+ * @param externalContext current external-context
+ * @param url current url
+ * @return url with request-parameters
+ */
public static String addRequestParameter(ExternalContext externalContext, String url)
{
StringBuilder finalUrl = new StringBuilder(url);
@@ -165,6 +172,12 @@ public abstract class JsfUtils
return finalUrl.toString();
}
+ /**
+ * Exposes all request-parameters (including or excluding the view-state)
+ * @param externalContext current external-context
+ * @param filterViewState flag which indicates if the view-state should be added or not
+ * @return current request-parameters
+ */
public static Set<RequestParameter> getRequestParameters(ExternalContext externalContext, boolean filterViewState)
{
Set<RequestParameter> result = new HashSet<RequestParameter>();
Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/SecurityUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/SecurityUtils.java?rev=1086547&r1=1086546&r2=1086547&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/SecurityUtils.java (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/SecurityUtils.java Tue Mar 29 11:18:09 2011
@@ -51,12 +51,21 @@ public abstract class SecurityUtils
// prevent instantiation
}
+ /**
+ * Processes a security violation without triggering the navigation to the error page
+ * @param runtimeException current exception
+ * @return error view which can be used e.g. for manual navigation
+ */
public static Class<? extends ViewConfig> handleSecurityViolationWithoutNavigation(
RuntimeException runtimeException)
{
return tryToHandleSecurityViolation(runtimeException, false);
}
+ /**
+ * Processes a security violation including the navigation to the error page
+ * @param runtimeException current exception
+ */
public static void tryToHandleSecurityViolation(RuntimeException runtimeException)
{
tryToHandleSecurityViolation(runtimeException, true);
Modified: myfaces/extensions/cdi/trunk/jse-modules/scripting-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/scripting/impl/ScriptEngineManagerProducer.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jse-modules/scripting-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/scripting/impl/ScriptEngineManagerProducer.java?rev=1086547&r1=1086546&r2=1086547&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jse-modules/scripting-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/scripting/impl/ScriptEngineManagerProducer.java (original)
+++ myfaces/extensions/cdi/trunk/jse-modules/scripting-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/scripting/impl/ScriptEngineManagerProducer.java Tue Mar 29 11:18:09 2011
@@ -38,6 +38,8 @@ import java.util.Map;
/**
* @author Gerhard Petracek
*/
+//TODO producers have to create serializable instances
+
@ApplicationScoped
public class ScriptEngineManagerProducer
{
@@ -46,6 +48,12 @@ public class ScriptEngineManagerProducer
}
//this syntax is neede for using it via the expression language
+
+ /**
+ * Creates an alias for #createScriptExecutorBean
+ * which creates a helper which allows to use a {@link ScriptExecutor} within el-expressions
+ * @return el-helper for the script-executor
+ */
@Produces
@Dependent
@Named(SCRIPT_EXECUTOR_ALIAS)
@@ -54,6 +62,10 @@ public class ScriptEngineManagerProducer
return createScriptExecutorBean();
}
+ /**
+ * Creates a helper which allows to use a {@link ScriptExecutor} within el-expressions
+ * @return el-helper for the script-executor
+ */
@Produces
@Dependent
@Named(SCRIPT_EXECUTOR)
@@ -65,9 +77,15 @@ public class ScriptEngineManagerProducer
private interface PlaceHolderLanguage extends Language{}
+ /**
+ * Creates a {@link ScriptExecutor} for the specified language
+ * @param injectionPoint target injection-point
+ * @param languageManager current language-manager
+ * @return script-executor for the language specified at the given injection-point
+ */
@Produces
@ScriptLanguage(PlaceHolderLanguage.class)
- @Deprecated
+ @Dependent
public ScriptExecutor createScriptExecutor(InjectionPoint injectionPoint, LanguageManager languageManager)
{
ScriptEngine scriptEngine = createScriptEngineByLanguageName(injectionPoint, languageManager);
@@ -80,9 +98,15 @@ public class ScriptEngineManagerProducer
return new DefaultScriptExecutor(scriptEngine);
}
+ /**
+ * Creates a {@link ScriptBuilder} for the specified language
+ * @param injectionPoint target injection-point
+ * @param languageManager current language-manager
+ * @return script-builder for the language specified at the given injection-point
+ */
@Produces
@ScriptLanguage(PlaceHolderLanguage.class)
- @Deprecated
+ @Dependent
public ScriptBuilder createScriptBuilder(InjectionPoint injectionPoint, LanguageManager languageManager)
{
ScriptEngine scriptEngine = createScriptEngineByLanguageName(injectionPoint, languageManager);
@@ -95,8 +119,15 @@ public class ScriptEngineManagerProducer
return new DefaultScriptBuilder(scriptEngine);
}
+ /**
+ * Creates a {@link ScriptEngine} for the specified language
+ * @param injectionPoint target injection-point
+ * @param languageManager current language-manager
+ * @return script-engine for the language specified at the given injection-point
+ */
@Produces
@ScriptLanguage(PlaceHolderLanguage.class)
+ @Dependent
public ScriptEngine createScriptEngineByLanguageName(InjectionPoint injectionPoint, LanguageManager languageManager)
{
Class<? extends Language> language =
Modified: myfaces/extensions/cdi/trunk/jse-modules/scripting-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/scripting/impl/spi/LanguageBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jse-modules/scripting-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/scripting/impl/spi/LanguageBean.java?rev=1086547&r1=1086546&r2=1086547&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jse-modules/scripting-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/scripting/impl/spi/LanguageBean.java (original)
+++ myfaces/extensions/cdi/trunk/jse-modules/scripting-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/scripting/impl/spi/LanguageBean.java Tue Mar 29 11:18:09 2011
@@ -25,7 +25,16 @@ import org.apache.myfaces.extensions.cdi
*/
public interface LanguageBean extends Language
{
+ /**
+ * Type-safe id which should be used to identify the language
+ * @return id of the language
+ */
Class<? extends Language> getId();
+ /**
+ * TODO
+ * Names which can be used for the {@link org.apache.myfaces.extensions.cdi.scripting.api.LanguageManager}
+ * @return possible names for the the current language
+ */
String[] getAlternativeNames();
}
Modified: myfaces/extensions/cdi/trunk/jse-modules/scripting-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/scripting/impl/util/ExceptionUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jse-modules/scripting-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/scripting/impl/util/ExceptionUtils.java?rev=1086547&r1=1086546&r2=1086547&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jse-modules/scripting-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/scripting/impl/util/ExceptionUtils.java (original)
+++ myfaces/extensions/cdi/trunk/jse-modules/scripting-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/scripting/impl/util/ExceptionUtils.java Tue Mar 29 11:18:09 2011
@@ -36,21 +36,42 @@ public abstract class ExceptionUtils
// prevent instantiation
}
+ /**
+ * Creates an exception if the script-language isn't known
+ * @param name unknown name
+ * @return exception which can be thrown
+ */
public static RuntimeException unknownScriptingLanguage(String name)
{
return new UnhandledException("No scripting engine found for: " + name);
}
+ /**
+ * Creates an exception if there is no script-language type available
+ * @return exception which can be thrown
+ */
public static RuntimeException noScriptingLanguageAvailable()
{
return new UnhandledException("No bean of type " + LanguageBean.class.getName() + " found!");
}
+ /**
+ * Creates an exception if the type of the script-language isn't known
+ * @param languageType unknown language type
+ * @return exception which can be thrown
+ */
public static RuntimeException noScriptingLanguageAvailableFor(Class<? extends Language> languageType)
{
return new UnhandledException("No language is mapped to " + languageType.getName());
}
+ /**
+ * Creates an exception if there are multiple language types
+ * @param id language id
+ * @param foundLanguage registered language
+ * @param newLanguage found language
+ * @return exception which can be thrown
+ */
public static RuntimeException ambiguousLanguageDefinition(
Class<? extends Language> id, Language foundLanguage, Language newLanguage)
{
@@ -58,6 +79,11 @@ public abstract class ExceptionUtils
foundLanguage.getClass().getName() + " with " + newLanguage.getClass().getName());
}
+ /**
+ * Creates an exception if e.g. bindings would be overruled
+ * @param newValueHint name of the argument
+ * @return exception which can be thrown
+ */
public static RuntimeException overrideBuilderState(String newValueHint)
{
return new UnhandledException("Invalid script builder (" + ScriptBuilder.class.getName() + ") state. " +
Modified: myfaces/extensions/cdi/trunk/test-modules/cargo-test-module/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/cargo-test-module/pom.xml?rev=1086547&r1=1086546&r2=1086547&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/cargo-test-module/pom.xml (original)
+++ myfaces/extensions/cdi/trunk/test-modules/cargo-test-module/pom.xml Tue Mar 29 11:18:09 2011
@@ -38,7 +38,7 @@
<properties>
<cargo.context>cargo-test</cargo.context>
- <cargo.port>8787</cargo.port> <!-- use port 8787 in order to prevent port-already-in-use on hudson -->
+ <cargo.port>9090</cargo.port> <!-- use port 9090 in order to prevent port-already-in-use on hudson -->
</properties>
<build>
Modified: myfaces/extensions/cdi/trunk/test-modules/cargo-test-module/src/test/java/org/apache/myfaces/extensions/cdi/test/cargo/conversation/BaseConversationTest.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/cargo-test-module/src/test/java/org/apache/myfaces/extensions/cdi/test/cargo/conversation/BaseConversationTest.java?rev=1086547&r1=1086546&r2=1086547&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/cargo-test-module/src/test/java/org/apache/myfaces/extensions/cdi/test/cargo/conversation/BaseConversationTest.java (original)
+++ myfaces/extensions/cdi/trunk/test-modules/cargo-test-module/src/test/java/org/apache/myfaces/extensions/cdi/test/cargo/conversation/BaseConversationTest.java Tue Mar 29 11:18:09 2011
@@ -31,6 +31,6 @@ abstract class BaseConversationTest exte
@Override
protected String getCustomBaseURL()
{
- return "http://localhost:8787/cargo-test/";
+ return "http://localhost:9090/cargo-test/";
}
}