Weld SVN: r5180 - in core/tags/glassfish-integration/1.0.0-SP4: bom and 8 other directories.
by weld-commits@lists.jboss.org
Author: rogerk
Date: 2009-11-30 15:26:04 -0500 (Mon, 30 Nov 2009)
New Revision: 5180
Modified:
core/tags/glassfish-integration/1.0.0-SP4/bom/pom.xml
core/tags/glassfish-integration/1.0.0-SP4/embedded-tck-runner/pom.xml
core/tags/glassfish-integration/1.0.0-SP4/impl/pom.xml
core/tags/glassfish-integration/1.0.0-SP4/inject-tck-runner/pom.xml
core/tags/glassfish-integration/1.0.0-SP4/jboss-tck-runner/pom.xml
core/tags/glassfish-integration/1.0.0-SP4/osgi-bundle/pom.xml
core/tags/glassfish-integration/1.0.0-SP4/parent/pom.xml
core/tags/glassfish-integration/1.0.0-SP4/pom.xml
core/tags/glassfish-integration/1.0.0-SP4/porting-package/pom.xml
core/tags/glassfish-integration/1.0.0-SP4/tests/pom.xml
Log:
pom version changes
Modified: core/tags/glassfish-integration/1.0.0-SP4/bom/pom.xml
===================================================================
--- core/tags/glassfish-integration/1.0.0-SP4/bom/pom.xml 2009-11-30 19:56:05 UTC (rev 5179)
+++ core/tags/glassfish-integration/1.0.0-SP4/bom/pom.xml 2009-11-30 20:26:04 UTC (rev 5180)
@@ -3,7 +3,7 @@
<groupId>org.jboss.weld</groupId>
<artifactId>weld-core-bom</artifactId>
<packaging>pom</packaging>
- <version>1.0.0</version>
+ <version>1.0.0-SP4</version>
<parent>
<groupId>org.jboss.weld</groupId>
@@ -175,9 +175,9 @@
<!-- SCM and distribution management -->
<scm>
- <connection>scm:svn:https://svn.jboss.org/repos/weld/core/tags/1.0.0/bom</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/weld/core/branches/1.0.0/bom</developerConnection>
- <url>https://svn.jboss.org/repos/weld/core/tags/1.0.0/core/bom</url>
+ <connection>scm:svn:https://svn.jboss.org/repos/weld/core/tags/glassfish-integration/...</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/weld/core/tags/glassfish-integration/...</developerConnection>
+ <url>https://svn.jboss.org/repos/weld/core/tags/1.0.0-SP4/core/bom</url>
</scm>
</project>
Modified: core/tags/glassfish-integration/1.0.0-SP4/embedded-tck-runner/pom.xml
===================================================================
--- core/tags/glassfish-integration/1.0.0-SP4/embedded-tck-runner/pom.xml 2009-11-30 19:56:05 UTC (rev 5179)
+++ core/tags/glassfish-integration/1.0.0-SP4/embedded-tck-runner/pom.xml 2009-11-30 20:26:04 UTC (rev 5180)
@@ -2,7 +2,7 @@
<parent>
<artifactId>weld-parent</artifactId>
<groupId>org.jboss.weld</groupId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0-SP4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.weld</groupId>
Modified: core/tags/glassfish-integration/1.0.0-SP4/impl/pom.xml
===================================================================
--- core/tags/glassfish-integration/1.0.0-SP4/impl/pom.xml 2009-11-30 19:56:05 UTC (rev 5179)
+++ core/tags/glassfish-integration/1.0.0-SP4/impl/pom.xml 2009-11-30 20:26:04 UTC (rev 5180)
@@ -2,7 +2,7 @@
<parent>
<artifactId>weld-core-parent</artifactId>
<groupId>org.jboss.weld</groupId>
- <version>1.0.0</version>
+ <version>1.0.0-SP4</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: core/tags/glassfish-integration/1.0.0-SP4/inject-tck-runner/pom.xml
===================================================================
--- core/tags/glassfish-integration/1.0.0-SP4/inject-tck-runner/pom.xml 2009-11-30 19:56:05 UTC (rev 5179)
+++ core/tags/glassfish-integration/1.0.0-SP4/inject-tck-runner/pom.xml 2009-11-30 20:26:04 UTC (rev 5180)
@@ -2,7 +2,7 @@
<parent>
<artifactId>weld-core-parent</artifactId>
<groupId>org.jboss.weld</groupId>
- <version>1.0.0</version>
+ <version>1.0.0-SP4</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: core/tags/glassfish-integration/1.0.0-SP4/jboss-tck-runner/pom.xml
===================================================================
--- core/tags/glassfish-integration/1.0.0-SP4/jboss-tck-runner/pom.xml 2009-11-30 19:56:05 UTC (rev 5179)
+++ core/tags/glassfish-integration/1.0.0-SP4/jboss-tck-runner/pom.xml 2009-11-30 20:26:04 UTC (rev 5180)
@@ -2,7 +2,7 @@
<parent>
<artifactId>weld-core-parent</artifactId>
<groupId>org.jboss.weld</groupId>
- <version>1.0.0</version>
+ <version>1.0.0-SP4</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: core/tags/glassfish-integration/1.0.0-SP4/osgi-bundle/pom.xml
===================================================================
--- core/tags/glassfish-integration/1.0.0-SP4/osgi-bundle/pom.xml 2009-11-30 19:56:05 UTC (rev 5179)
+++ core/tags/glassfish-integration/1.0.0-SP4/osgi-bundle/pom.xml 2009-11-30 20:26:04 UTC (rev 5180)
@@ -16,7 +16,7 @@
<parent>
<artifactId>weld-core-parent</artifactId>
<groupId>org.jboss.weld</groupId>
- <version>1.0.0</version>
+ <version>1.0.0-SP4</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: core/tags/glassfish-integration/1.0.0-SP4/parent/pom.xml
===================================================================
--- core/tags/glassfish-integration/1.0.0-SP4/parent/pom.xml 2009-11-30 19:56:05 UTC (rev 5179)
+++ core/tags/glassfish-integration/1.0.0-SP4/parent/pom.xml 2009-11-30 20:26:04 UTC (rev 5180)
@@ -7,7 +7,7 @@
<parent>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-core-bom</artifactId>
- <version>1.0.0</version>
+ <version>1.0.0-SP4</version>
<relativePath>../bom</relativePath>
</parent>
Modified: core/tags/glassfish-integration/1.0.0-SP4/pom.xml
===================================================================
--- core/tags/glassfish-integration/1.0.0-SP4/pom.xml 2009-11-30 19:56:05 UTC (rev 5179)
+++ core/tags/glassfish-integration/1.0.0-SP4/pom.xml 2009-11-30 20:26:04 UTC (rev 5180)
@@ -3,7 +3,7 @@
<groupId>org.jboss.weld</groupId>
<artifactId>weld-core-build-aggregator</artifactId>
<packaging>pom</packaging>
- <version>1.0.0</version>
+ <version>1.0.0-SP4</version>
<parent>
<groupId>org.jboss.weld</groupId>
@@ -18,9 +18,9 @@
<!-- SCM and distribution management -->
<scm>
- <connection>scm:svn:https://svn.jboss.org/repos/weld/core/tags/1.0.0</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/weld/core/branches/1.0.0</developerConnection>
- <url>https://svn.jboss.org/repos/weld/core/tags/1.0.0</url>
+ <connection>scm:svn:https://svn.jboss.org/repos/weld/core/tags/glassfish-integration/...</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/weld/core/tags/glassfish-integration/...</developerConnection>
+ <url>https://svn.jboss.org/repos/weld/core/tags/glassfish-integration/1.0.0-SP4</url>
</scm>
<profiles>
Modified: core/tags/glassfish-integration/1.0.0-SP4/porting-package/pom.xml
===================================================================
--- core/tags/glassfish-integration/1.0.0-SP4/porting-package/pom.xml 2009-11-30 19:56:05 UTC (rev 5179)
+++ core/tags/glassfish-integration/1.0.0-SP4/porting-package/pom.xml 2009-11-30 20:26:04 UTC (rev 5180)
@@ -2,7 +2,7 @@
<parent>
<artifactId>weld-core-parent</artifactId>
<groupId>org.jboss.weld</groupId>
- <version>1.0.0</version>
+ <version>1.0.0-SP4</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: core/tags/glassfish-integration/1.0.0-SP4/tests/pom.xml
===================================================================
--- core/tags/glassfish-integration/1.0.0-SP4/tests/pom.xml 2009-11-30 19:56:05 UTC (rev 5179)
+++ core/tags/glassfish-integration/1.0.0-SP4/tests/pom.xml 2009-11-30 20:26:04 UTC (rev 5180)
@@ -2,7 +2,7 @@
<parent>
<artifactId>weld-core-parent</artifactId>
<groupId>org.jboss.weld</groupId>
- <version>1.0.0</version>
+ <version>1.0.0-SP4</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
14 years, 9 months
Weld SVN: r5179 - core/tags/glassfish-integration.
by weld-commits@lists.jboss.org
Author: rogerk
Date: 2009-11-30 14:56:05 -0500 (Mon, 30 Nov 2009)
New Revision: 5179
Added:
core/tags/glassfish-integration/1.0.0-SP4/
Log:
1.0.0 SP4 tag create from copy
Copied: core/tags/glassfish-integration/1.0.0-SP4 (from rev 5178, core/branches/1.0.0)
14 years, 9 months
Weld SVN: r5178 - core/trunk/impl/src/main/java/org/jboss/weld/util.
by weld-commits@lists.jboss.org
Author: dallen6
Date: 2009-11-30 11:46:51 -0500 (Mon, 30 Nov 2009)
New Revision: 5178
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/util/Reflections.java
Log:
Fixed problem with NoSuchMethodException
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/Reflections.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/Reflections.java 2009-11-30 15:42:09 UTC (rev 5177)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/Reflections.java 2009-11-30 16:46:51 UTC (rev 5178)
@@ -57,6 +57,8 @@
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLogger.Level;
+import ch.qos.cal10n.IMessageConveyor;
+
/**
* Utility class for static reflection-type operations
*
@@ -69,6 +71,9 @@
private static final LocLogger log = loggerFactory().getLogger(UTIL);
private static final XLogger xLog = loggerFactory().getXLogger(UTIL);
+ // Exception messages
+ private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+
public static final Type[] EMPTY_TYPES = {};
public static final Annotation[] EMPTY_ANNOTATIONS = {};
@@ -563,7 +568,7 @@
{
throw new WeldException(ERROR_INVOKING_METHOD, e, methodName, instance.getClass());
}
- catch (NoSuchMethodException e)
+ catch (java.lang.NoSuchMethodException e)
{
throw new WeldException(ERROR_INVOKING_METHOD, e, methodName, instance.getClass());
}
@@ -670,7 +675,7 @@
// Expected, nothing to see here.
}
}
- throw new WeldException(NO_SUCH_METHOD, methodName + Arrays.asList(parameterTypes).toString().replace("[", "(").replace("]", ")"), c.getName());
+ throw new NoSuchMethodException(messageConveyer.getMessage(NO_SUCH_METHOD, methodName + Arrays.asList(parameterTypes).toString().replace("[", "(").replace("]", ")"), c.getName()));
}
/**
14 years, 9 months
Weld SVN: r5177 - in core/trunk/impl/src/main: java/org/jboss/weld/bean and 8 other directories.
by weld-commits@lists.jboss.org
Author: dallen6
Date: 2009-11-30 10:42:09 -0500 (Mon, 30 Nov 2009)
New Revision: 5177
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/DefinitionException.java
core/trunk/impl/src/main/java/org/jboss/weld/DeploymentException.java
core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenArgumentException.java
core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenStateException.java
core/trunk/impl/src/main/java/org/jboss/weld/WeldException.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/InterceptorImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractDefinitionContainerEvent.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractDeploymentContainerEvent.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeBeanDiscoveryImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/injection/ConstructorInjectionPoint.java
core/trunk/impl/src/main/java/org/jboss/weld/injection/ParameterInjectionPoint.java
core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/BeanMessage.java
core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/UtilMessage.java
core/trunk/impl/src/main/java/org/jboss/weld/util/ApiAbstraction.java
core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java
core/trunk/impl/src/main/java/org/jboss/weld/util/DeploymentStructures.java
core/trunk/impl/src/main/java/org/jboss/weld/util/Observers.java
core/trunk/impl/src/main/java/org/jboss/weld/util/Proxies.java
core/trunk/impl/src/main/java/org/jboss/weld/util/Reflections.java
core/trunk/impl/src/main/java/org/jboss/weld/util/collections/ConcurrentCache.java
core/trunk/impl/src/main/java/org/jboss/weld/util/dom/NodeListIterator.java
core/trunk/impl/src/main/java/org/jboss/weld/util/serviceProvider/DefaultServiceLoader.java
core/trunk/impl/src/main/resources/org/jboss/weld/messages/bean_en.properties
core/trunk/impl/src/main/resources/org/jboss/weld/messages/util_en.properties
Log:
Additional exception message conversions for localization
Modified: core/trunk/impl/src/main/java/org/jboss/weld/DefinitionException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/DefinitionException.java 2009-11-30 14:07:40 UTC (rev 5176)
+++ core/trunk/impl/src/main/java/org/jboss/weld/DefinitionException.java 2009-11-30 15:42:09 UTC (rev 5177)
@@ -17,6 +17,9 @@
package org.jboss.weld;
import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
+
+import java.util.List;
+
import ch.qos.cal10n.IMessageConveyor;
/**
@@ -31,6 +34,8 @@
// Exception messages
private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+ private String message = null;
+
public DefinitionException()
{
super();
@@ -38,27 +43,60 @@
public <E extends Enum<?>> DefinitionException(E key, Object... args)
{
- super(messageConveyer.getMessage(key, args));
+ super();
+ this.message = messageConveyer.getMessage(key, args);
}
public <E extends Enum<?>> DefinitionException(E key, Throwable throwable, Object... args)
{
- super(messageConveyer.getMessage(key, args), throwable);
+ super(throwable);
+ this.message = messageConveyer.getMessage(key, args);
}
public DefinitionException(String message, Throwable throwable)
{
- super(message, throwable);
+ super(throwable);
+ this.message = message;
}
public DefinitionException(String message)
{
- super(message);
+ super();
+ this.message = message;
}
public DefinitionException(Throwable throwable)
{
super(throwable);
+ this.message = throwable.getLocalizedMessage();
}
+ public DefinitionException(List<Throwable> errors)
+ {
+ super();
+ StringBuilder errorMessage = new StringBuilder();
+ boolean firstError = true;
+ for (Throwable throwable : errors)
+ {
+ if (!firstError)
+ {
+ errorMessage.append('\n');
+ }
+ errorMessage.append(throwable.getLocalizedMessage());
+ }
+ message = errorMessage.toString();
+ }
+
+ @Override
+ public String getLocalizedMessage()
+ {
+ return getMessage();
+ }
+
+ @Override
+ public String getMessage()
+ {
+ return message;
+ }
+
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/DeploymentException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/DeploymentException.java 2009-11-30 14:07:40 UTC (rev 5176)
+++ core/trunk/impl/src/main/java/org/jboss/weld/DeploymentException.java 2009-11-30 15:42:09 UTC (rev 5177)
@@ -17,6 +17,9 @@
package org.jboss.weld;
import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
+
+import java.util.List;
+
import ch.qos.cal10n.IMessageConveyor;
/**
@@ -31,6 +34,8 @@
// Exception messages
private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+ private String message = null;
+
public DeploymentException()
{
super();
@@ -38,27 +43,60 @@
public <E extends Enum<?>> DeploymentException(E key, Object... args)
{
- super(messageConveyer.getMessage(key, args));
+ super();
+ this.message = messageConveyer.getMessage(key, args);
}
public <E extends Enum<?>> DeploymentException(E key, Throwable throwable, Object... args)
{
- super(messageConveyer.getMessage(key, args), throwable);
+ super(throwable);
+ this.message = messageConveyer.getMessage(key, args);
}
public DeploymentException(String message, Throwable throwable)
{
- super(message, throwable);
+ super(throwable);
+ this.message = message;
}
public DeploymentException(String message)
{
- super(message);
+ super();
+ this.message = message;
}
public DeploymentException(Throwable throwable)
{
super(throwable);
+ this.message = throwable.getLocalizedMessage();
}
+ public DeploymentException(List<Throwable> errors)
+ {
+ super();
+ StringBuilder errorMessage = new StringBuilder();
+ boolean firstError = true;
+ for (Throwable throwable : errors)
+ {
+ if (!firstError)
+ {
+ errorMessage.append('\n');
+ }
+ errorMessage.append(throwable.getLocalizedMessage());
+ }
+ message = errorMessage.toString();
+ }
+
+ @Override
+ public String getLocalizedMessage()
+ {
+ return getMessage();
+ }
+
+ @Override
+ public String getMessage()
+ {
+ return message;
+ }
+
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenArgumentException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenArgumentException.java 2009-11-30 14:07:40 UTC (rev 5176)
+++ core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenArgumentException.java 2009-11-30 15:42:09 UTC (rev 5177)
@@ -34,6 +34,11 @@
// Exception messages
private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+ public ForbiddenArgumentException(Throwable throwable)
+ {
+ super(throwable.getLocalizedMessage(), throwable);
+ }
+
public <E extends Enum<?>> ForbiddenArgumentException(E key, Object... args)
{
super(messageConveyer.getMessage(key, args));
Modified: core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenStateException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenStateException.java 2009-11-30 14:07:40 UTC (rev 5176)
+++ core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenStateException.java 2009-11-30 15:42:09 UTC (rev 5177)
@@ -37,4 +37,9 @@
{
super(messageConveyer.getMessage(key, args));
}
+
+ public ForbiddenStateException(Throwable cause)
+ {
+ super(cause.getLocalizedMessage(), cause);
+ }
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/WeldException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/WeldException.java 2009-11-30 14:07:40 UTC (rev 5176)
+++ core/trunk/impl/src/main/java/org/jboss/weld/WeldException.java 2009-11-30 15:42:09 UTC (rev 5177)
@@ -34,7 +34,7 @@
public WeldException(Throwable throwable)
{
- super(throwable);
+ super(throwable.getLocalizedMessage(), throwable);
}
public <E extends Enum<?>> WeldException(E key, Object... args)
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/InterceptorImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/InterceptorImpl.java 2009-11-30 14:07:40 UTC (rev 5176)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/InterceptorImpl.java 2009-11-30 15:42:09 UTC (rev 5177)
@@ -33,8 +33,8 @@
import org.jboss.interceptor.registry.InterceptorClassMetadataRegistry;
import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.DeploymentException;
+import org.jboss.weld.WeldException;
import org.jboss.weld.introspector.WeldClass;
-import org.jboss.weld.logging.messages.BeanMessage;
import org.jboss.weld.util.Beans;
/**
@@ -83,7 +83,7 @@
return new DirectClassInterceptionHandler(instance, getType()).invoke(ctx.getTarget(), org.jboss.interceptor.model.InterceptionType.valueOf(type.name()), ctx);
} catch (Exception e)
{
- throw new RuntimeException(e);
+ throw new WeldException(e);
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractDefinitionContainerEvent.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractDefinitionContainerEvent.java 2009-11-30 14:07:40 UTC (rev 5176)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractDefinitionContainerEvent.java 2009-11-30 15:42:09 UTC (rev 5177)
@@ -39,8 +39,7 @@
super.fire();
if (!getErrors().isEmpty())
{
- // FIXME communicate all the captured definition errors in this exception
- throw new DefinitionException(getErrors().get(0));
+ throw new DefinitionException(getErrors());
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractDeploymentContainerEvent.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractDeploymentContainerEvent.java 2009-11-30 14:07:40 UTC (rev 5176)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractDeploymentContainerEvent.java 2009-11-30 15:42:09 UTC (rev 5177)
@@ -39,8 +39,7 @@
super.fire();
if (!getErrors().isEmpty())
{
- // FIXME communicate all the captured deployment errors in this exception
- throw new DeploymentException(getErrors().get(0));
+ throw new DeploymentException(getErrors());
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeBeanDiscoveryImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeBeanDiscoveryImpl.java 2009-11-30 14:07:40 UTC (rev 5176)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeBeanDiscoveryImpl.java 2009-11-30 15:42:09 UTC (rev 5177)
@@ -23,6 +23,7 @@
import javax.enterprise.inject.spi.BeforeBeanDiscovery;
import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.InvalidOperationException;
import org.jboss.weld.bootstrap.BeanDeployment;
import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
import org.jboss.weld.bootstrap.spi.Deployment;
@@ -68,7 +69,7 @@
public void addStereotype(Class<? extends Annotation> stereotype, Annotation... stereotypeDef)
{
- throw new UnsupportedOperationException();
+ throw new InvalidOperationException();
}
public void addAnnotatedType(AnnotatedType<?> type)
Modified: core/trunk/impl/src/main/java/org/jboss/weld/injection/ConstructorInjectionPoint.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/injection/ConstructorInjectionPoint.java 2009-11-30 14:07:40 UTC (rev 5176)
+++ core/trunk/impl/src/main/java/org/jboss/weld/injection/ConstructorInjectionPoint.java 2009-11-30 15:42:09 UTC (rev 5177)
@@ -38,6 +38,7 @@
import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.InvalidObjectException;
+import org.jboss.weld.InvalidOperationException;
import org.jboss.weld.introspector.ConstructorSignature;
import org.jboss.weld.introspector.ForwardingWeldConstructor;
import org.jboss.weld.introspector.WeldClass;
@@ -150,7 +151,7 @@
public void inject(Object declaringInstance, Object value)
{
- throw new UnsupportedOperationException();
+ throw new InvalidOperationException();
}
/**
Modified: core/trunk/impl/src/main/java/org/jboss/weld/injection/ParameterInjectionPoint.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/injection/ParameterInjectionPoint.java 2009-11-30 14:07:40 UTC (rev 5176)
+++ core/trunk/impl/src/main/java/org/jboss/weld/injection/ParameterInjectionPoint.java 2009-11-30 15:42:09 UTC (rev 5177)
@@ -16,7 +16,11 @@
*/
package org.jboss.weld.injection;
-import java.io.InvalidObjectException;
+import static org.jboss.weld.logging.messages.BeanMessage.CANNOT_READ_OBJECT;
+import static org.jboss.weld.logging.messages.BeanMessage.IP_NOT_CONSTRUCTOR_OR_METHOD;
+import static org.jboss.weld.logging.messages.BeanMessage.PARAM_NOT_IN_PARAM_LIST;
+import static org.jboss.weld.logging.messages.BeanMessage.PROXY_REQUIRED;
+
import java.io.ObjectInputStream;
import java.io.ObjectStreamException;
import java.io.Serializable;
@@ -32,6 +36,9 @@
import javax.enterprise.inject.spi.Decorator;
import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.ForbiddenStateException;
+import org.jboss.weld.InvalidObjectException;
+import org.jboss.weld.InvalidOperationException;
import org.jboss.weld.introspector.ConstructorSignature;
import org.jboss.weld.introspector.ForwardingWeldParameter;
import org.jboss.weld.introspector.MethodSignature;
@@ -84,7 +91,7 @@
public void inject(Object declaringInstance, Object value)
{
- throw new UnsupportedOperationException();
+ throw new InvalidOperationException();
}
@SuppressWarnings("unchecked")
@@ -128,7 +135,7 @@
private void readObject(ObjectInputStream stream) throws InvalidObjectException
{
- throw new InvalidObjectException("Proxy required");
+ throw new InvalidObjectException(PROXY_REQUIRED);
}
private static class SerializationProxy<T> extends WeldInjectionPointSerializationProxy<T, Object>
@@ -156,7 +163,7 @@
}
else
{
- throw new IllegalStateException("Cannot handle injection point as neither constructor or method. Injection Point: " + injectionPoint);
+ throw new ForbiddenStateException(IP_NOT_CONSTRUCTOR_OR_METHOD, injectionPoint);
}
}
@@ -181,7 +188,7 @@
}
else
{
- throw new IllegalStateException("Parameter not in list. Parameter position: " + parameterPosition + "; Parameters: " + method.getParameters());
+ throw new ForbiddenStateException(PARAM_NOT_IN_PARAM_LIST, parameterPosition, method.getParameters());
}
}
else if (constructorSignature != null)
@@ -198,12 +205,12 @@
}
else
{
- throw new IllegalStateException("Parameter not in list. Parameter position: " + parameterPosition + "; Parameters: " + constructor.getParameters());
+ throw new ForbiddenStateException(PARAM_NOT_IN_PARAM_LIST, parameterPosition, constructor.getParameters());
}
}
else
{
- throw new IllegalStateException("Cannot read object");
+ throw new ForbiddenStateException(CANNOT_READ_OBJECT);
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/BeanMessage.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/BeanMessage.java 2009-11-30 14:07:40 UTC (rev 5176)
+++ core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/BeanMessage.java 2009-11-30 15:42:09 UTC (rev 5177)
@@ -108,6 +108,9 @@
@MessageId("000087") MESSAGE_DRIVEN_BEANS_CANNOT_BE_MANAGED,
@MessageId("000088") OBSERVER_METHOD_MUST_BE_STATIC_OR_BUSINESS,
@MessageId("000089") TOO_MANY_EJBS_FOR_CLASS,
- @MessageId("000090") ABSTRACT_METHOD_MUST_MATCH_DECORATED_TYPE;
+ @MessageId("000090") ABSTRACT_METHOD_MUST_MATCH_DECORATED_TYPE,
+ @MessageId("000091") IP_NOT_CONSTRUCTOR_OR_METHOD,
+ @MessageId("000092") PARAM_NOT_IN_PARAM_LIST,
+ @MessageId("000093") CANNOT_READ_OBJECT;
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/UtilMessage.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/UtilMessage.java 2009-11-30 14:07:40 UTC (rev 5176)
+++ core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/UtilMessage.java 2009-11-30 15:42:09 UTC (rev 5177)
@@ -21,6 +21,31 @@
{
@MessageId("000800") SERVICE_LOADER_LOADING_ERROR,
- @MessageId("000801") SECURITY_EXCEPTION_SCANNING;
+ @MessageId("000801") SECURITY_EXCEPTION_SCANNING,
+ @MessageId("000802") XML_DOM_READONLY,
+ @MessageId("000803") DECLARED_EXTENSION_DOES_NOT_IMPLEMENT_EXTENSION,
+ @MessageId("000804") CLASS_NOT_ENUM,
+ @MessageId("000805") TOO_MANY_POST_CONSTRUCT_METHODS,
+ @MessageId("000806") TOO_MANY_PRE_DESTROY_METHODS,
+ @MessageId("000807") INITIALIZER_CANNOT_BE_PRODUCER,
+ @MessageId("000808") INITIALIZER_CANNOT_BE_DISPOSAL_METHOD,
+ @MessageId("000809") INITIALIZER_CANNOT_BE_OBSERVER,
+ @MessageId("000810") QUALIFIER_ON_FINAL_FIELD,
+ @MessageId("000811") TOO_MANY_INITIALIZERS,
+ @MessageId("000812") AMBIGUOUS_CONSTRUCTOR,
+ @MessageId("000813") INVALID_QUANTITY_INJECTABLE_FIELDS_AND_INITIALIZER_METHODS,
+ @MessageId("000814") ANNOTATION_NOT_QUALIFIER,
+ @MessageId("000815") REDUNDANT_QUALIFIER,
+ @MessageId("000816") UNABLE_TO_FIND_CONSTRUCTOR,
+ @MessageId("000817") UNABLE_TO_FIND_BEAN_DEPLOYMENT_ARCHIVE,
+ @MessageId("000818") EVENT_TYPE_NOT_ALLOWED,
+ @MessageId("000819") TYPE_PARAMETER_NOT_ALLOWED_IN_EVENT_TYPE,
+ @MessageId("000820") CANNOT_PROXY_NON_CLASS_TYPE,
+ @MessageId("000821") INSTANCE_NOT_A_PROXY,
+ @MessageId("000822") ACCESS_ERROR_ON_CONSTRUCTOR,
+ @MessageId("000823") ERROR_INVOKING_METHOD,
+ @MessageId("000824") ACCESS_ERROR_ON_FIELD,
+ @MessageId("000825") NO_SUCH_METHOD,
+ @MessageId("000826") ANNOTATION_VALUES_INACCESSIBLE;
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/ApiAbstraction.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/ApiAbstraction.java 2009-11-30 14:07:40 UTC (rev 5176)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/ApiAbstraction.java 2009-11-30 15:42:09 UTC (rev 5177)
@@ -16,8 +16,11 @@
*/
package org.jboss.weld.util;
+import static org.jboss.weld.logging.messages.UtilMessage.CLASS_NOT_ENUM;
+
import java.lang.annotation.Annotation;
+import org.jboss.weld.ForbiddenArgumentException;
import org.jboss.weld.resources.spi.ResourceLoader;
import org.jboss.weld.resources.spi.ResourceLoadingException;
@@ -112,7 +115,7 @@
{
if (!clazz.isEnum())
{
- throw new IllegalArgumentException(clazz + " is not an enum!");
+ throw new ForbiddenArgumentException(CLASS_NOT_ENUM, clazz);
}
try
{
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java 2009-11-30 14:07:40 UTC (rev 5176)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java 2009-11-30 15:42:09 UTC (rev 5177)
@@ -25,6 +25,17 @@
import static org.jboss.weld.logging.messages.BeanMessage.FOUND_ONE_PRE_DESTROY_METHOD;
import static org.jboss.weld.logging.messages.BeanMessage.FOUND_POST_CONSTRUCT_METHODS;
import static org.jboss.weld.logging.messages.BeanMessage.FOUND_PRE_DESTROY_METHODS;
+import static org.jboss.weld.logging.messages.UtilMessage.AMBIGUOUS_CONSTRUCTOR;
+import static org.jboss.weld.logging.messages.UtilMessage.ANNOTATION_NOT_QUALIFIER;
+import static org.jboss.weld.logging.messages.UtilMessage.INITIALIZER_CANNOT_BE_DISPOSAL_METHOD;
+import static org.jboss.weld.logging.messages.UtilMessage.INITIALIZER_CANNOT_BE_OBSERVER;
+import static org.jboss.weld.logging.messages.UtilMessage.INITIALIZER_CANNOT_BE_PRODUCER;
+import static org.jboss.weld.logging.messages.UtilMessage.INVALID_QUANTITY_INJECTABLE_FIELDS_AND_INITIALIZER_METHODS;
+import static org.jboss.weld.logging.messages.UtilMessage.QUALIFIER_ON_FINAL_FIELD;
+import static org.jboss.weld.logging.messages.UtilMessage.REDUNDANT_QUALIFIER;
+import static org.jboss.weld.logging.messages.UtilMessage.TOO_MANY_POST_CONSTRUCT_METHODS;
+import static org.jboss.weld.logging.messages.UtilMessage.TOO_MANY_PRE_DESTROY_METHODS;
+import static org.jboss.weld.logging.messages.UtilMessage.UNABLE_TO_FIND_CONSTRUCTOR;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
@@ -57,6 +68,7 @@
import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.Container;
import org.jboss.weld.DefinitionException;
+import org.jboss.weld.ForbiddenArgumentException;
import org.jboss.weld.bean.DecoratorImpl;
import org.jboss.weld.bean.RIBean;
import org.jboss.weld.bean.SessionBean;
@@ -192,7 +204,7 @@
log.trace(FOUND_POST_CONSTRUCT_METHODS, postConstructMethods, type);
if (postConstructMethods.size() > 1)
{
- throw new DefinitionException("Cannot have more than one post construct method annotated with @PostConstruct for " + type);
+ throw new DefinitionException(TOO_MANY_POST_CONSTRUCT_METHODS, type);
}
else if (postConstructMethods.size() == 1)
{
@@ -214,7 +226,7 @@
{
// TODO actually this is wrong, in EJB you can have @PreDestroy methods
// on the superclass, though the CDI spec is silent on the issue
- throw new DefinitionException("Cannot have more than one pre destroy method annotated with @PreDestroy for " + type);
+ throw new DefinitionException(TOO_MANY_PRE_DESTROY_METHODS, type);
}
else if (preDestroyMethods.size() == 1)
{
@@ -349,15 +361,15 @@
{
if (method.getAnnotation(Produces.class) != null)
{
- throw new DefinitionException("Initializer method " + method.toString() + " cannot be annotated @Produces on " + type);
+ throw new DefinitionException(INITIALIZER_CANNOT_BE_PRODUCER, method, type);
}
else if (method.getAnnotatedWBParameters(Disposes.class).size() > 0)
{
- throw new DefinitionException("Initializer method " + method.toString() + " cannot have parameters annotated @Disposes on " + type);
+ throw new DefinitionException(INITIALIZER_CANNOT_BE_DISPOSAL_METHOD, method, type);
}
else if (method.getAnnotatedWBParameters(Observes.class).size() > 0)
{
- throw new DefinitionException("Initializer method " + method.toString() + " cannot be annotated @Observes on " + type);
+ throw new DefinitionException(INITIALIZER_CANNOT_BE_OBSERVER, method, type);
}
else
{
@@ -433,7 +445,7 @@
{
if (annotatedField.isFinal())
{
- throw new DefinitionException("Don't place binding annotations on final fields " + annotatedField);
+ throw new DefinitionException(QUALIFIER_ON_FINAL_FIELD, annotatedField);
}
FieldInjectionPoint<?, ?> fieldInjectionPoint = FieldInjectionPoint.of(declaringBean, annotatedField);
injectableFields.add(fieldInjectionPoint);
@@ -628,7 +640,7 @@
{
if (initializerAnnotatedConstructors.size() > 1)
{
- throw new DefinitionException("Cannot have more than one constructor annotated with @Initializer for " + type);
+ throw new DefinitionException(AMBIGUOUS_CONSTRUCTOR, type);
}
}
else if (initializerAnnotatedConstructors.size() == 1)
@@ -645,7 +657,7 @@
if (constructor == null)
{
- throw new DefinitionException("Cannot determine constructor to use for " + type);
+ throw new DefinitionException(UNABLE_TO_FIND_CONSTRUCTOR, type);
}
else
{
@@ -732,7 +744,7 @@
{
if (injectableFields.size() != initializerMethods.size())
{
- throw new IllegalArgumentException("injectableFields and initializerMethods must have the same size. InjectableFields: " + injectableFields + "; InitializerMethods: " + initializerMethods);
+ throw new ForbiddenArgumentException(INVALID_QUANTITY_INJECTABLE_FIELDS_AND_INITIALIZER_METHODS, injectableFields, initializerMethods);
}
for (int i = 0; i < injectableFields.size(); i++)
{
@@ -773,11 +785,11 @@
{
if (!Container.instance().deploymentServices().get(MetaAnnotationStore.class).getBindingTypeModel(qualifier.annotationType()).isValid())
{
- throw new IllegalArgumentException("Annotation is not a qualifier. Qualifier: " + qualifier);
+ throw new ForbiddenArgumentException(ANNOTATION_NOT_QUALIFIER, qualifier);
}
if (checkedNewQualifiers.contains(qualifier))
{
- throw new IllegalArgumentException("Qualifier is already present. Qualifier: " + qualifier + "; All qualifiers: " + Arrays.asList(newQualifiers));
+ throw new ForbiddenArgumentException(REDUNDANT_QUALIFIER, qualifier, Arrays.asList(newQualifiers));
}
checkedNewQualifiers.add(qualifier);
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/DeploymentStructures.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/DeploymentStructures.java 2009-11-30 14:07:40 UTC (rev 5176)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/DeploymentStructures.java 2009-11-30 15:42:09 UTC (rev 5177)
@@ -1,8 +1,11 @@
package org.jboss.weld.util;
+import static org.jboss.weld.logging.messages.UtilMessage.UNABLE_TO_FIND_BEAN_DEPLOYMENT_ARCHIVE;
+
import java.util.Map;
import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.ForbiddenStateException;
import org.jboss.weld.bootstrap.BeanDeployment;
import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
import org.jboss.weld.bootstrap.spi.Deployment;
@@ -17,7 +20,7 @@
BeanDeploymentArchive beanDeploymentArchive = deployment.loadBeanDeploymentArchive(clazz);
if (beanDeploymentArchive == null)
{
- throw new IllegalStateException("Unable to find Bean Deployment Archive for " + clazz);
+ throw new ForbiddenStateException(UNABLE_TO_FIND_BEAN_DEPLOYMENT_ARCHIVE, clazz);
}
else
{
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/Observers.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/Observers.java 2009-11-30 14:07:40 UTC (rev 5176)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/Observers.java 2009-11-30 15:42:09 UTC (rev 5177)
@@ -16,10 +16,15 @@
*/
package org.jboss.weld.util;
+import static org.jboss.weld.logging.messages.UtilMessage.EVENT_TYPE_NOT_ALLOWED;
+import static org.jboss.weld.logging.messages.UtilMessage.TYPE_PARAMETER_NOT_ALLOWED_IN_EVENT_TYPE;
+
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
+import org.jboss.weld.ForbiddenArgumentException;
+
/**
* @author pmuir
*
@@ -41,13 +46,13 @@
}
else
{
- throw new IllegalArgumentException("Event type " + resolvedType + " is not allowed");
+ throw new ForbiddenArgumentException(EVENT_TYPE_NOT_ALLOWED, resolvedType);
}
for (Type type : types)
{
if (type instanceof TypeVariable<?>)
{
- throw new IllegalArgumentException("Cannot provide an event type parameterized with a type parameter " + resolvedType);
+ throw new ForbiddenArgumentException(TYPE_PARAMETER_NOT_ALLOWED_IN_EVENT_TYPE, resolvedType);
}
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/Proxies.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/Proxies.java 2009-11-30 14:07:40 UTC (rev 5176)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/Proxies.java 2009-11-30 15:42:09 UTC (rev 5177)
@@ -16,6 +16,9 @@
*/
package org.jboss.weld.util;
+import static org.jboss.weld.logging.messages.UtilMessage.CANNOT_PROXY_NON_CLASS_TYPE;
+import static org.jboss.weld.logging.messages.UtilMessage.INSTANCE_NOT_A_PROXY;
+
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
@@ -28,6 +31,8 @@
import javassist.util.proxy.ProxyFactory;
import javassist.util.proxy.ProxyObject;
+import org.jboss.weld.ForbiddenArgumentException;
+
/**
* Utilties for working with Javassist proxies
*
@@ -109,7 +114,7 @@
}
else
{
- throw new IllegalArgumentException("Cannot proxy non-Class Type " + type);
+ throw new ForbiddenArgumentException(CANNOT_PROXY_NON_CLASS_TYPE, type);
}
return this;
}
@@ -257,7 +262,7 @@
}
else
{
- throw new IllegalArgumentException("Instance not a proxy. Instance: " + instance);
+ throw new ForbiddenArgumentException(INSTANCE_NOT_A_PROXY, instance);
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/Reflections.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/Reflections.java 2009-11-30 14:07:40 UTC (rev 5176)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/Reflections.java 2009-11-30 15:42:09 UTC (rev 5177)
@@ -18,6 +18,11 @@
import static org.jboss.weld.logging.Category.UTIL;
import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
+import static org.jboss.weld.logging.messages.UtilMessage.ACCESS_ERROR_ON_CONSTRUCTOR;
+import static org.jboss.weld.logging.messages.UtilMessage.ACCESS_ERROR_ON_FIELD;
+import static org.jboss.weld.logging.messages.UtilMessage.ANNOTATION_VALUES_INACCESSIBLE;
+import static org.jboss.weld.logging.messages.UtilMessage.ERROR_INVOKING_METHOD;
+import static org.jboss.weld.logging.messages.UtilMessage.NO_SUCH_METHOD;
import static org.jboss.weld.logging.messages.UtilMessage.SECURITY_EXCEPTION_SCANNING;
import java.beans.Introspector;
@@ -45,6 +50,8 @@
import javax.inject.Qualifier;
import org.jboss.weld.DeploymentException;
+import org.jboss.weld.ForbiddenArgumentException;
+import org.jboss.weld.WeldException;
import org.jboss.weld.util.reflection.ParameterizedTypeImpl;
import org.slf4j.cal10n.LocLogger;
import org.slf4j.ext.XLogger;
@@ -443,7 +450,7 @@
}
catch (Exception e)
{
- throw new RuntimeException("Error accessing constructor (with parameters " + Arrays.toString(parameterTypes) + ") of " + clazz, e);
+ throw new WeldException(ACCESS_ERROR_ON_CONSTRUCTOR, e, clazz);
}
}
@@ -529,15 +536,15 @@
}
catch (IllegalArgumentException e)
{
- throw new RuntimeException("Error invoking method " + method.getName() + " on " + method.getDeclaringClass(), e);
+ throw new WeldException(ERROR_INVOKING_METHOD, e, method.getName(), method.getDeclaringClass());
}
catch (IllegalAccessException e)
{
- throw new RuntimeException("Error invoking method " + method.getName() + " on " + method.getDeclaringClass(), e);
+ throw new WeldException(ERROR_INVOKING_METHOD, e, method.getName(), method.getDeclaringClass());
}
catch (InvocationTargetException e)
{
- throw new RuntimeException("Error invoking method " + method.getName() + " on " + method.getDeclaringClass(), e);
+ throw new WeldException(ERROR_INVOKING_METHOD, e, method.getName(), method.getDeclaringClass());
}
}
@@ -554,11 +561,11 @@
}
catch (SecurityException e)
{
- throw new RuntimeException("Error invoking method " + methodName + " on " + instance.getClass(), e);
+ throw new WeldException(ERROR_INVOKING_METHOD, e, methodName, instance.getClass());
}
catch (NoSuchMethodException e)
{
- throw new RuntimeException("Error invoking method " + methodName + " on " + instance.getClass(), e);
+ throw new WeldException(ERROR_INVOKING_METHOD, e, methodName, instance.getClass());
}
}
@@ -577,11 +584,11 @@
}
catch (IllegalArgumentException e)
{
- throw new RuntimeException("Error getting field " + field.getName() + " on " + field.getDeclaringClass(), e);
+ throw new WeldException(ACCESS_ERROR_ON_FIELD, e, field.getName(), field.getDeclaringClass());
}
catch (IllegalAccessException e)
{
- throw new RuntimeException("Error getting field " + field.getName() + " on " + field.getDeclaringClass(), e);
+ throw new WeldException(ACCESS_ERROR_ON_FIELD, e, field.getName(), field.getDeclaringClass());
}
}
@@ -593,11 +600,11 @@
}
catch (SecurityException e)
{
- throw new RuntimeException("Error getting field " + fieldName + " on " + target.getClass(), e);
+ throw new WeldException(ACCESS_ERROR_ON_FIELD, e, fieldName, target.getClass());
}
catch (NoSuchFieldException e)
{
- throw new RuntimeException("Error getting field " + fieldName + " on " + target.getClass(), e);
+ throw new WeldException(ACCESS_ERROR_ON_FIELD, e, fieldName, target.getClass());
}
}
@@ -617,7 +624,7 @@
}
catch (NoSuchMethodException e)
{
- throw new IllegalArgumentException(e);
+ throw new ForbiddenArgumentException(e);
}
}
@@ -663,7 +670,7 @@
// Expected, nothing to see here.
}
}
- throw new NoSuchMethodException("Method " + methodName + Arrays.asList(parameterTypes).toString().replace("[", "(").replace("]", ")") + " not implemented by instance " + c.getName());
+ throw new WeldException(NO_SUCH_METHOD, methodName + Arrays.asList(parameterTypes).toString().replace("[", "(").replace("]", ")"), c.getName());
}
/**
@@ -1067,7 +1074,7 @@
}
catch (Exception e)
{
- throw new DeploymentException("Cannot access values() on annotation", e);
+ throw new DeploymentException(ANNOTATION_VALUES_INACCESSIBLE, e);
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/collections/ConcurrentCache.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/collections/ConcurrentCache.java 2009-11-30 14:07:40 UTC (rev 5176)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/collections/ConcurrentCache.java 2009-11-30 15:42:09 UTC (rev 5177)
@@ -23,6 +23,8 @@
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;
+import org.jboss.weld.ForbiddenStateException;
+
import com.google.common.collect.ForwardingMap;
/**
@@ -180,7 +182,7 @@
}
else
{
- throw new IllegalStateException(e.getCause());
+ throw new ForbiddenStateException(e.getCause());
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/dom/NodeListIterator.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/dom/NodeListIterator.java 2009-11-30 14:07:40 UTC (rev 5176)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/dom/NodeListIterator.java 2009-11-30 15:42:09 UTC (rev 5177)
@@ -16,8 +16,11 @@
*/
package org.jboss.weld.util.dom;
+import static org.jboss.weld.logging.messages.UtilMessage.XML_DOM_READONLY;
+
import java.util.Iterator;
+import org.jboss.weld.InvalidOperationException;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -46,7 +49,7 @@
public void remove()
{
- throw new UnsupportedOperationException("XML DOM is readonly");
+ throw new InvalidOperationException(XML_DOM_READONLY);
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/serviceProvider/DefaultServiceLoader.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/serviceProvider/DefaultServiceLoader.java 2009-11-30 14:07:40 UTC (rev 5176)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/serviceProvider/DefaultServiceLoader.java 2009-11-30 15:42:09 UTC (rev 5177)
@@ -16,6 +16,8 @@
*/
package org.jboss.weld.util.serviceProvider;
+import static org.jboss.weld.logging.messages.UtilMessage.DECLARED_EXTENSION_DOES_NOT_IMPLEMENT_EXTENSION;
+
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
@@ -27,6 +29,8 @@
import java.util.Iterator;
import java.util.Set;
+import org.jboss.weld.ForbiddenStateException;
+import org.jboss.weld.InvalidOperationException;
import org.jboss.weld.util.Reflections;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -129,7 +133,7 @@
*/
public static <S> DefaultServiceLoader<S> loadInstalled(Class<S> service)
{
- throw new UnsupportedOperationException();
+ throw new InvalidOperationException();
}
private final String serviceFile;
@@ -206,7 +210,7 @@
}
catch (ClassCastException e)
{
- throw new IllegalStateException("Extension " + line + " does not implement Extension");
+ throw new ForbiddenStateException(DECLARED_EXTENSION_DOES_NOT_IMPLEMENT_EXTENSION, line);
}
Constructor<? extends S> constructor = Reflections.ensureAccessible(serviceClass.getConstructor());
S instance = constructor.newInstance();
Modified: core/trunk/impl/src/main/resources/org/jboss/weld/messages/bean_en.properties
===================================================================
--- core/trunk/impl/src/main/resources/org/jboss/weld/messages/bean_en.properties 2009-11-30 14:07:40 UTC (rev 5176)
+++ core/trunk/impl/src/main/resources/org/jboss/weld/messages/bean_en.properties 2009-11-30 15:42:09 UTC (rev 5177)
@@ -89,3 +89,6 @@
OBSERVER_METHOD_MUST_BE_STATIC_OR_BUSINESS=Observer method must be static or business method\: {0} on {1}
TOO_MANY_EJBS_FOR_CLASS=Unable to determine EJB for {0}, multiple EJBs with that class\: {1}
ABSTRACT_METHOD_MUST_MATCH_DECORATED_TYPE=Method {0} defined on {1} does not match a method on decorated type {2}
+IP_NOT_CONSTRUCTOR_OR_METHOD=Cannot handle injection point as a constructor or method\: {0}
+PARAM_NOT_IN_PARAM_LIST=Parameter position {0} is not in the parameter list\: {1}
+CANNOT_READ_OBJECT=Cannot read object
Modified: core/trunk/impl/src/main/resources/org/jboss/weld/messages/util_en.properties
===================================================================
--- core/trunk/impl/src/main/resources/org/jboss/weld/messages/util_en.properties 2009-11-30 14:07:40 UTC (rev 5176)
+++ core/trunk/impl/src/main/resources/org/jboss/weld/messages/util_en.properties 2009-11-30 15:42:09 UTC (rev 5177)
@@ -1,2 +1,27 @@
SERVICE_LOADER_LOADING_ERROR=Error loading service {0}
SECURITY_EXCEPTION_SCANNING=Security exception scanning {0}
+XML_DOM_READONLY=XML DOM is readonly
+DECLARED_EXTENSION_DOES_NOT_IMPLEMENT_EXTENSION=Extension {0} does not implement Extension
+CLASS_NOT_ENUM={0} is not an enum
+TOO_MANY_POST_CONSTRUCT_METHODS=Cannot have more than one post construct method annotated with @PostConstruct for {0}
+TOO_MANY_PRE_DESTROY_METHODS=Cannot have more than one pre destroy method annotated @PreDestroy for {0}
+INITIALIZER_CANNOT_BE_PRODUCER=Initializer method {0} cannot be annotated @Produces on {1}
+INITIALIZER_CANNOT_BE_DISPOSAL_METHOD=Initializer method {0} cannot have parameters annotated @Disposes on {1}
+INITIALIZER_CANNOT_BE_OBSERVER=Initializer method {0} cannot be annotated @Observes on {1}
+QUALIFIER_ON_FINAL_FIELD=Cannot place qualifiers on final fields\: {0}
+TOO_MANY_INITIALIZERS=Cannot have more than one constructor annotated with @Initializer for {0}
+AMBIGUOUS_CONSTRUCTOR=Cannot determine constructor to use for {0}
+INVALID_QUANTITY_INJECTABLE_FIELDS_AND_INITIALIZER_METHODS=injectableFields and initializerMethods must have the same size.\\n\\nInjectable Fields\: {0}\\nInitializerMethods\: {1}
+ANNOTATION_NOT_QUALIFIER=Annotation {0} is not a qualifier
+REDUNDANT_QUALIFIER=Qualifier {0} is already present in the set {1}
+UNABLE_TO_FIND_CONSTRUCTOR=Cannot determine constructor to use for {0}
+UNABLE_TO_FIND_BEAN_DEPLOYMENT_ARCHIVE=Unable to find Bean Deployment Archive for {0}
+EVENT_TYPE_NOT_ALLOWED=Event type {0} is not allowed
+TYPE_PARAMETER_NOT_ALLOWED_IN_EVENT_TYPE=Cannot provide an event type parameterized with a type parameter {0}
+CANNOT_PROXY_NON_CLASS_TYPE=Cannot proxy non-Class Type {0}
+INSTANCE_NOT_A_PROXY=Instance {0} is not a proxy
+ACCESS_ERROR_ON_CONSTRUCTOR=Error accessing constructor of {0} with parameters {1}
+ERROR_INVOKING_METHOD=Error invoking method {0} on {1}
+ACCESS_ERROR_ON_FIELD=Error getting field {0} on {1}
+NO_SUCH_METHOD=Method {0} not implemented by instance {1}
+ANNOTATION_VALUES_INACCESSIBLE=Cannot access values() on annotation
14 years, 9 months
Weld SVN: r5175 - in java-se/trunk/src: main/java/org/jboss/weld/environment/se/beans and 1 other directories.
by weld-commits@lists.jboss.org
Author: peteroyle
Date: 2009-11-29 23:33:32 -0500 (Sun, 29 Nov 2009)
New Revision: 5175
Modified:
java-se/trunk/src/main/java/org/jboss/weld/environment/se/Weld.java
java-se/trunk/src/main/java/org/jboss/weld/environment/se/beans/InstanceManager.java
java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/WeldMainTest.java
Log:
Fixed the API for selecting events using Weld.event()
Modified: java-se/trunk/src/main/java/org/jboss/weld/environment/se/Weld.java
===================================================================
--- java-se/trunk/src/main/java/org/jboss/weld/environment/se/Weld.java 2009-11-30 03:42:28 UTC (rev 5174)
+++ java-se/trunk/src/main/java/org/jboss/weld/environment/se/Weld.java 2009-11-30 04:33:32 UTC (rev 5175)
@@ -89,7 +89,7 @@
return instanceManager.getInstances();
}
- public Instance<Event> event()
+ public Event<Object> event()
{
return instanceManager.getEvents();
}
Modified: java-se/trunk/src/main/java/org/jboss/weld/environment/se/beans/InstanceManager.java
===================================================================
--- java-se/trunk/src/main/java/org/jboss/weld/environment/se/beans/InstanceManager.java 2009-11-30 03:42:28 UTC (rev 5174)
+++ java-se/trunk/src/main/java/org/jboss/weld/environment/se/beans/InstanceManager.java 2009-11-30 04:33:32 UTC (rev 5175)
@@ -33,7 +33,7 @@
{
@Inject Instance<Object> instances;
- @Inject Instance<Event> events;
+ @Inject Event<Object> events;
public InstanceManager()
{
@@ -44,7 +44,7 @@
return instances;
}
- public Instance<Event> getEvents()
+ public Event<Object> getEvents()
{
return events;
}
Modified: java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/WeldMainTest.java
===================================================================
--- java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/WeldMainTest.java 2009-11-30 03:42:28 UTC (rev 5174)
+++ java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/WeldMainTest.java 2009-11-30 04:33:32 UTC (rev 5175)
@@ -65,9 +65,7 @@
ObserverTestBean.reset();
Weld weld = new Weld().initialize();
- weld.getBeanManager().fireEvent(new CustomEvent());
-// TODO(PR): this should work. What's with the compile error?
-// weld.event().select(CustomEvent.class).fire(new CustomEvent());
+ weld.event().select(CustomEvent.class).fire(new CustomEvent());
Assert.assertTrue(ObserverTestBean.isBuiltInObserved());
Assert.assertTrue(ObserverTestBean.isCustomObserved());
14 years, 9 months
Weld SVN: r5174 - in archetypes/trunk/jsf: jee-minimal/src/main/resources/archetype-resources and 1 other directory.
by weld-commits@lists.jboss.org
Author: sboscarine
Date: 2009-11-29 22:42:28 -0500 (Sun, 29 Nov 2009)
New Revision: 5174
Modified:
archetypes/trunk/jsf/jee-minimal/src/main/resources/archetype-resources/pom.xml
archetypes/trunk/jsf/jee/src/main/resources/archetype-resources/pom.xml
Log:
clean up
Modified: archetypes/trunk/jsf/jee/src/main/resources/archetype-resources/pom.xml
===================================================================
--- archetypes/trunk/jsf/jee/src/main/resources/archetype-resources/pom.xml 2009-11-29 23:11:26 UTC (rev 5173)
+++ archetypes/trunk/jsf/jee/src/main/resources/archetype-resources/pom.xml 2009-11-30 03:42:28 UTC (rev 5174)
@@ -7,14 +7,17 @@
<packaging>war</packaging>
<name>${artifactId}</name>
<version>${version}</version>
-
+
<properties>
<!--
eliminates [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is
platform dependent!
-->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <!-- To set the jboss.home environment variable the Maven way, set the jboss.home property in an active profile in the Maven 2 settings.xml file -->
+ <!--
+ To set the jboss.home environment variable the Maven way, set the jboss.home property in an active profile in
+ the Maven 2 settings.xml file
+ -->
<jboss.home>${env.JBOSS_HOME}</jboss.home>
<jboss.domain>default</jboss.domain>
<!-- The version of Weld extensions in use -->
@@ -54,7 +57,7 @@
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.0.0.GA</version>
- <scope>runtime</scope>
+ <!-- <scope>runtime</scope>-->
</dependency>
<!-- JSF 2.0 -->
<dependency>
@@ -64,12 +67,10 @@
</dependency>
<!-- Optional, but pretty useful. -->
- <!--
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>jstl</artifactId>
- </dependency>
- -->
+ <!--<dependency>-->
+ <!-- <groupId>javax.servlet</groupId>-->
+ <!-- <artifactId>jstl</artifactId>-->
+ <!--</dependency>-->
<!-- Optional, but highly recommended. -->
<dependency>
@@ -97,68 +98,52 @@
- <!-- Experimental Dependencies. -->
-
-
- <!-- JPA Dependencies. -->
- <!-- Dan, should this be provided? -->
- <dependency>
- <groupId>javax.persistence</groupId>
- <artifactId>persistence-api</artifactId>
- </dependency>
- <!-- Dan, should this be provided? -->
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate</artifactId>
- <version>3.2.6.ga</version>
- <!-- why? -->
- <exclusions>
- <exclusion>
- <groupId>javax.transaction</groupId>
- <artifactId>jta</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <!-- Dan, should this be provided? -->
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-entitymanager</artifactId>
- <version>3.4.0.GA</version>
- </dependency>
- <!-- Dan, should this be provided? -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <version>1.4.2</version>
- </dependency>
-<!-- <dependency>-->
-<!-- <groupId>c3p0</groupId>-->
-<!-- <artifactId>c3p0</artifactId>-->
-<!-- <version>0.9.1.2</version>-->
-<!-- </dependency>-->
- <!-- Hypersonic in-memory database. Replace with a driver that reflects your database. -->
- <dependency>
- <groupId>org.hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <version>1.8.0.10</version>
- </dependency>
-
-
-
-
- <!-- Bean Validation API (JSR 303) -->
+ <!--
+ Experimental Dependencies. Still working through these. If these are incorrect, please change and notify
+ someone at weld-dev(a)lists.jboss.org They will be finalized soon.
+ -->
+ <!-- JPA Dependencies. -->
+ <!-- Should this be provided? -->
<dependency>
- <groupId>javax.validation</groupId>
- <artifactId>validation-api</artifactId>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
</dependency>
-
- <!-- Bean Validation Implementation -->
+ <!-- Should this be provided? -->
<dependency>
<groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>4.0.0.GA</version>
+ <artifactId>hibernate</artifactId>
+ <version>3.2.6.ga</version>
+ <!-- why? -->
+ <exclusions>
+ <exclusion>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
-
+ <!-- Should this be provided? -->
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
+ <version>3.4.0.GA</version>
+ </dependency>
+ <!-- Should this be provided? -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>1.4.2</version>
+ </dependency>
+ <!--<dependency>-->
+ <!-- <groupId>c3p0</groupId>-->
+ <!-- <artifactId>c3p0</artifactId>-->
+ <!-- <version>0.9.1.2</version>-->
+ <!--</dependency>-->
+ <!-- Hypersonic in-memory database. Replace with a driver that reflects your database. -->
+ <dependency>
+ <groupId>org.hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.10</version>
+ </dependency>
</dependencies>
<build>
<finalName>${artifactId}</finalName>
@@ -179,11 +164,11 @@
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<wtpversion>2.0</wtpversion>
-<!-- <downloadSources>true</downloadSources>-->
-<!-- <downloadJavadocs>true</downloadJavadocs>-->
+ <!-- <downloadSources>true</downloadSources>-->
+ <!-- <downloadJavadocs>true</downloadJavadocs>-->
</configuration>
</plugin>
-
+
<!-- Configure the JBoss Maven deploy plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
Modified: archetypes/trunk/jsf/jee-minimal/src/main/resources/archetype-resources/pom.xml
===================================================================
--- archetypes/trunk/jsf/jee-minimal/src/main/resources/archetype-resources/pom.xml 2009-11-29 23:11:26 UTC (rev 5173)
+++ archetypes/trunk/jsf/jee-minimal/src/main/resources/archetype-resources/pom.xml 2009-11-30 03:42:28 UTC (rev 5174)
@@ -45,17 +45,19 @@
<artifactId>jsr250-api</artifactId>
<scope>provided</scope>
</dependency>
+ <!-- Bean Validation API (JSR 303) -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<scope>provided</scope>
</dependency>
+ <!-- Bean Validation Implementation -->
<!-- Provided on JBoss AS, not necessarily Java EE 6. Useful to give you extra built in constraints! -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.0.0.GA</version>
- <scope>runtime</scope>
+<!-- <scope>runtime</scope>-->
</dependency>
<!-- JSF 2.0 -->
<dependency>
@@ -96,20 +98,6 @@
</exclusions>
</dependency>
-
-
- <!-- Bean Validation API (JSR 303) -->
- <dependency>
- <groupId>javax.validation</groupId>
- <artifactId>validation-api</artifactId>
- </dependency>
-
- <!-- Bean Validation Implementation -->
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>4.0.0.GA</version>
- </dependency>
</dependencies>
<build>
<finalName>${artifactId}</finalName>
14 years, 9 months
Weld SVN: r5173 - in java-se/trunk: src/main/java/org/jboss/weld/environment/se and 2 other directories.
by weld-commits@lists.jboss.org
Author: peteroyle
Date: 2009-11-29 18:11:26 -0500 (Sun, 29 Nov 2009)
New Revision: 5173
Added:
java-se/trunk/src/main/java/org/jboss/weld/environment/se/Weld.java
java-se/trunk/src/main/java/org/jboss/weld/environment/se/beans/InstanceManager.java
java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/WeldMainTest.java
Modified:
java-se/trunk/
java-se/trunk/src/main/java/org/jboss/weld/environment/se/StartMain.java
Log:
Initial addition of new API for booting Weld from SE
Property changes on: java-se/trunk
___________________________________________________________________
Name: svn:ignore
+ target
Modified: java-se/trunk/src/main/java/org/jboss/weld/environment/se/StartMain.java
===================================================================
--- java-se/trunk/src/main/java/org/jboss/weld/environment/se/StartMain.java 2009-11-29 21:13:40 UTC (rev 5172)
+++ java-se/trunk/src/main/java/org/jboss/weld/environment/se/StartMain.java 2009-11-29 23:11:26 UTC (rev 5173)
@@ -18,16 +18,7 @@
import javax.enterprise.inject.spi.BeanManager;
-import org.jboss.weld.bootstrap.api.Bootstrap;
-import org.jboss.weld.bootstrap.api.Environments;
-import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.weld.context.api.BeanStore;
-import org.jboss.weld.context.api.helpers.ConcurrentHashMapBeanStore;
-import org.jboss.weld.manager.api.WeldManager;
-import org.jboss.weld.environment.se.discovery.SEWeldDeployment;
import org.jboss.weld.environment.se.events.ContainerInitialized;
-import org.jboss.weld.environment.se.util.Reflections;
-import org.jboss.weld.environment.se.util.WeldManagerUtils;
/**
* This is the main class that should always be called from the command line for
@@ -41,58 +32,34 @@
public class StartMain
{
- private static final String BOOTSTRAP_IMPL_CLASS_NAME = "org.jboss.weld.bootstrap.WeldBootstrap";
- private final Bootstrap bootstrap;
- private final BeanStore applicationBeanStore;
- public static String[] PARAMETERS;
- private WeldManager manager;
+ public static String[] PARAMETERS;
- public StartMain(String[] commandLineArgs)
- {
- PARAMETERS = commandLineArgs;
- try
- {
- bootstrap = Reflections.newInstance(BOOTSTRAP_IMPL_CLASS_NAME, Bootstrap.class);
- }
- catch (Exception e)
- {
- throw new IllegalStateException("Error loading Weld bootstrap, check that Weld is on the classpath", e);
- }
- this.applicationBeanStore = new ConcurrentHashMapBeanStore();
- }
+ public StartMain(String[] commandLineArgs)
+ {
+ PARAMETERS = commandLineArgs;
+ }
- public BeanManager go()
- {
- SEWeldDeployment deployment = new SEWeldDeployment()
- {
- };
- bootstrap.startContainer(Environments.SE, deployment, this.applicationBeanStore);
- final BeanDeploymentArchive mainBeanDepArch = deployment.getBeanDeploymentArchives().get(0);
- this.manager = bootstrap.getManager(mainBeanDepArch);
- bootstrap.startInitialization();
- bootstrap.deployBeans();
- WeldManagerUtils.getInstanceByType(manager, ShutdownManager.class).setBootstrap(bootstrap);
- bootstrap.validateBeans();
- bootstrap.endInitialization();
+ public BeanManager go()
+ {
+ Weld weld = new Weld().initialize();
- this.manager.fireEvent(new ContainerInitialized());
- return this.manager;
- }
+ weld.getBeanManager().fireEvent(new ContainerInitialized());
+ return weld.getBeanManager();
+ }
- /**
- * The main method called from the command line.
- *
- * @param args the command line arguments
- */
- public static void main(String[] args)
- {
- new StartMain(args).go();
- }
+ /**
+ * The main method called from the command line.
+ *
+ * @param args the command line arguments
+ */
+ public static void main(String[] args)
+ {
+ new StartMain(args).go();
+ }
- public static String[] getParameters()
- {
- // TODO(PR): make immutable
- return PARAMETERS;
- }
-
+ public static String[] getParameters()
+ {
+ // TODO(PR): make immutable
+ return PARAMETERS;
+ }
}
Added: java-se/trunk/src/main/java/org/jboss/weld/environment/se/Weld.java
===================================================================
--- java-se/trunk/src/main/java/org/jboss/weld/environment/se/Weld.java (rev 0)
+++ java-se/trunk/src/main/java/org/jboss/weld/environment/se/Weld.java 2009-11-29 23:11:26 UTC (rev 5173)
@@ -0,0 +1,108 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.environment.se;
+
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.spi.BeanManager;
+import org.jboss.weld.bootstrap.api.Bootstrap;
+import org.jboss.weld.bootstrap.api.Environments;
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.context.api.BeanStore;
+import org.jboss.weld.context.api.helpers.ConcurrentHashMapBeanStore;
+import org.jboss.weld.environment.se.beans.InstanceManager;
+import org.jboss.weld.environment.se.discovery.SEWeldDeployment;
+import org.jboss.weld.environment.se.util.Reflections;
+import org.jboss.weld.environment.se.util.WeldManagerUtils;
+import org.jboss.weld.manager.api.WeldManager;
+
+/**
+ * An alternative means of booting Weld form an arbitrary main method within an
+ * SE application, <em>without</em> using the built-in ContainerInitialized event.
+ * Typical usage of the API looks like this:
+ * <code>
+ * Weld weld = new Weld().initialize();
+ * weld.instance().select(Foo.class).get();
+ * weld.event().select(Bar.class).fire( new Bar() );
+ * weld.shutdown();
+ * </code>
+ *
+ * @author Peter Royle
+ */
+public class Weld
+{
+
+ private static final String BOOTSTRAP_IMPL_CLASS_NAME = "org.jboss.weld.bootstrap.WeldBootstrap";
+ private final Bootstrap bootstrap;
+ private final BeanStore applicationBeanStore;
+ private WeldManager manager;
+ private InstanceManager instanceManager;
+
+ public Weld()
+ {
+ try
+ {
+ bootstrap = Reflections.newInstance(BOOTSTRAP_IMPL_CLASS_NAME, Bootstrap.class);
+ } catch (Exception e)
+ {
+ throw new IllegalStateException("Error loading Weld bootstrap, check that Weld is on the classpath", e);
+ }
+ this.applicationBeanStore = new ConcurrentHashMapBeanStore();
+ }
+
+ public Weld initialize()
+ {
+
+ SEWeldDeployment deployment = new SEWeldDeployment()
+ {
+ };
+ bootstrap.startContainer(Environments.SE, deployment, this.applicationBeanStore);
+ final BeanDeploymentArchive mainBeanDepArch = deployment.getBeanDeploymentArchives().get(0);
+ this.manager = bootstrap.getManager(mainBeanDepArch);
+ bootstrap.startInitialization();
+ bootstrap.deployBeans();
+ WeldManagerUtils.getInstanceByType(manager, ShutdownManager.class).setBootstrap(bootstrap);
+ bootstrap.validateBeans();
+ bootstrap.endInitialization();
+
+ instanceManager = WeldManagerUtils.getInstanceByType(manager, InstanceManager.class);
+
+ return this;
+ }
+
+ public Instance<Object> instance()
+ {
+ return instanceManager.getInstances();
+ }
+
+ public Instance<Event> event()
+ {
+ return instanceManager.getEvents();
+ }
+
+ public BeanManager getBeanManager()
+ {
+ return manager;
+ }
+
+ /**
+ * Convenience method for shutting down the container.
+ */
+ public void shutdown() {
+ WeldManagerUtils.getInstanceByType(manager, ShutdownManager.class).shutdown();
+ }
+}
Added: java-se/trunk/src/main/java/org/jboss/weld/environment/se/beans/InstanceManager.java
===================================================================
--- java-se/trunk/src/main/java/org/jboss/weld/environment/se/beans/InstanceManager.java (rev 0)
+++ java-se/trunk/src/main/java/org/jboss/weld/environment/se/beans/InstanceManager.java 2009-11-29 23:11:26 UTC (rev 5173)
@@ -0,0 +1,51 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.environment.se.beans;
+
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+import org.jboss.weld.environment.se.Weld;
+
+/**
+ * A managed bean which holds all of the injected instances of managed beans and
+ * events. It is primarily used as a delegate for the Weld class's instance()
+ * and event() methods.
+ *
+ * @see Weld
+ * @author Peter Royle
+ */
+public class InstanceManager
+{
+
+ @Inject Instance<Object> instances;
+ @Inject Instance<Event> events;
+
+ public InstanceManager()
+ {
+ }
+
+ public Instance<Object> getInstances()
+ {
+ return instances;
+ }
+
+ public Instance<Event> getEvents()
+ {
+ return events;
+ }
+}
Added: java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/WeldMainTest.java
===================================================================
--- java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/WeldMainTest.java (rev 0)
+++ java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/WeldMainTest.java 2009-11-29 23:11:26 UTC (rev 5173)
@@ -0,0 +1,91 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.environment.se.test;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.util.AnnotationLiteral;
+
+import org.jboss.weld.environment.se.Weld;
+import org.jboss.weld.environment.se.events.Shutdown;
+import org.jboss.weld.environment.se.test.beans.CustomEvent;
+import org.jboss.weld.environment.se.test.beans.InitObserverTestBean;
+import org.jboss.weld.environment.se.test.beans.MainTestBean;
+import org.jboss.weld.environment.se.test.beans.ObserverTestBean;
+import org.jboss.weld.environment.se.test.beans.ParametersTestBean;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Peter Royle
+ */
+public class WeldMainTest
+{
+
+ /**
+ * Test the alternate API for boting Weld from an SE app.
+ */
+ @Test
+ public void testInitialize()
+ {
+
+ Weld weld = new Weld().initialize();
+
+ MainTestBean mainTestBean = weld.instance().select(MainTestBean.class).get();
+ Assert.assertNotNull(mainTestBean);
+
+ ParametersTestBean paramsBean = mainTestBean.getParametersTestBean();
+ Assert.assertNotNull(paramsBean);
+ Assert.assertNotNull(paramsBean.getParameters());
+
+ shutdownManager(weld.getBeanManager());
+ }
+
+ /**
+ * Test the firing of observers using the alternate API for boting Weld from an SE app.
+ */
+ @Test
+ public void testObservers()
+ {
+ InitObserverTestBean.reset();
+ ObserverTestBean.reset();
+
+ Weld weld = new Weld().initialize();
+ weld.getBeanManager().fireEvent(new CustomEvent());
+// TODO(PR): this should work. What's with the compile error?
+// weld.event().select(CustomEvent.class).fire(new CustomEvent());
+
+ Assert.assertTrue(ObserverTestBean.isBuiltInObserved());
+ Assert.assertTrue(ObserverTestBean.isCustomObserved());
+ Assert.assertFalse(ObserverTestBean.isInitObserved());
+
+ Assert.assertFalse(InitObserverTestBean.isInitObserved());
+ }
+
+ private void shutdownManager(BeanManager manager)
+ {
+ manager.fireEvent(manager, new ShutdownAnnotation());
+ }
+
+ private static class ShutdownAnnotation extends AnnotationLiteral<Shutdown>
+ {
+
+ public ShutdownAnnotation()
+ {
+ }
+ }
+}
14 years, 9 months
Weld SVN: r5172 - in archetypes/trunk/jsf: jee-minimal/src/main/resources/archetype-resources and 1 other directory.
by weld-commits@lists.jboss.org
Author: sboscarine
Date: 2009-11-29 16:13:40 -0500 (Sun, 29 Nov 2009)
New Revision: 5172
Modified:
archetypes/trunk/jsf/jee-minimal/src/main/resources/archetype-resources/pom.xml
archetypes/trunk/jsf/jee/src/main/resources/archetype-resources/pom.xml
Log:
fixed bugs
Modified: archetypes/trunk/jsf/jee/src/main/resources/archetype-resources/pom.xml
===================================================================
--- archetypes/trunk/jsf/jee/src/main/resources/archetype-resources/pom.xml 2009-11-29 20:55:27 UTC (rev 5171)
+++ archetypes/trunk/jsf/jee/src/main/resources/archetype-resources/pom.xml 2009-11-29 21:13:40 UTC (rev 5172)
@@ -17,15 +17,16 @@
<!-- To set the jboss.home environment variable the Maven way, set the jboss.home property in an active profile in the Maven 2 settings.xml file -->
<jboss.home>${env.JBOSS_HOME}</jboss.home>
<jboss.domain>default</jboss.domain>
- <weld.api.version>1.0</weld.api.version>
+ <!-- The version of Weld extensions in use -->
+ <weld.extensions.version>1.0.0-CR2</weld.extensions.version>
</properties>
<dependencyManagement>
<dependencies>
<!-- Import scope will provide versions for dependencies below. -->
<dependency>
<groupId>org.jboss.weld</groupId>
- <artifactId>weld-api-bom</artifactId>
- <version>${weld.api.version}</version>
+ <artifactId>weld-extensions-bom</artifactId>
+ <version>${weld.extensions.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@@ -83,6 +84,9 @@
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>el-impl</artifactId>
+ <scope>runtime</scope>
+ <!-- FIXME this version should be in the Weld API BOM -->
+ <version>2.1.2-b04</version>
<exclusions>
<exclusion>
<groupId>javax.el</groupId>
@@ -93,6 +97,9 @@
+ <!-- Experimental Dependencies. -->
+
+
<!-- JPA Dependencies. -->
<!-- Dan, should this be provided? -->
<dependency>
@@ -139,18 +146,30 @@
+ <!-- Bean Validation API (JSR 303) -->
+ <dependency>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ </dependency>
+ <!-- Bean Validation Implementation -->
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>4.0.0.GA</version>
+ </dependency>
+
</dependencies>
<build>
<finalName>${artifactId}</finalName>
<plugins>
- <!-- Compiler plugin enforces Java 1.5 compatiblity -->
+ <!-- Compiler plugin enforces Java 1.6 compatiblity -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
- <source>1.5</source>
- <target>1.5</target>
+ <source>1.6</source>
+ <target>1.6</target>
</configuration>
</plugin>
Modified: archetypes/trunk/jsf/jee-minimal/src/main/resources/archetype-resources/pom.xml
===================================================================
--- archetypes/trunk/jsf/jee-minimal/src/main/resources/archetype-resources/pom.xml 2009-11-29 20:55:27 UTC (rev 5171)
+++ archetypes/trunk/jsf/jee-minimal/src/main/resources/archetype-resources/pom.xml 2009-11-29 21:13:40 UTC (rev 5172)
@@ -17,15 +17,17 @@
<!-- To set the jboss.home environment variable the Maven way, set the jboss.home property in an active profile in the Maven 2 settings.xml file -->
<jboss.home>${env.JBOSS_HOME}</jboss.home>
<jboss.domain>default</jboss.domain>
- <weld.api.version>1.0</weld.api.version>
+ <!-- The version of Weld extensions in use -->
+ <weld.extensions.version>1.0.0-CR2</weld.extensions.version>
+
</properties>
<dependencyManagement>
<dependencies>
<!-- Import scope will provide versions for dependencies below. -->
<dependency>
<groupId>org.jboss.weld</groupId>
- <artifactId>weld-api-bom</artifactId>
- <version>${weld.api.version}</version>
+ <artifactId>weld-extensions-bom</artifactId>
+ <version>${weld.extensions.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@@ -94,17 +96,31 @@
</exclusions>
</dependency>
+
+
+ <!-- Bean Validation API (JSR 303) -->
+ <dependency>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ </dependency>
+
+ <!-- Bean Validation Implementation -->
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>4.0.0.GA</version>
+ </dependency>
</dependencies>
<build>
<finalName>${artifactId}</finalName>
<plugins>
- <!-- Compiler plugin enforces Java 1.5 compatiblity -->
+ <!-- Compiler plugin enforces Java 1.6 compatibility -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
- <source>1.5</source>
- <target>1.5</target>
+ <source>1.6</source>
+ <target>1.6</target>
</configuration>
</plugin>
@@ -130,4 +146,4 @@
</plugin>
</plugins>
</build>
-</project>
+</project>
\ No newline at end of file
14 years, 9 months
Weld SVN: r5171 - archetypes/trunk/jsf/servlet-minimal/src/main/resources/archetype-resources.
by weld-commits@lists.jboss.org
Author: sboscarine
Date: 2009-11-29 15:55:27 -0500 (Sun, 29 Nov 2009)
New Revision: 5171
Modified:
archetypes/trunk/jsf/servlet-minimal/src/main/resources/archetype-resources/pom.xml
Log:
documentation error
Modified: archetypes/trunk/jsf/servlet-minimal/src/main/resources/archetype-resources/pom.xml
===================================================================
--- archetypes/trunk/jsf/servlet-minimal/src/main/resources/archetype-resources/pom.xml 2009-11-28 17:41:34 UTC (rev 5170)
+++ archetypes/trunk/jsf/servlet-minimal/src/main/resources/archetype-resources/pom.xml 2009-11-29 20:55:27 UTC (rev 5171)
@@ -7,18 +7,17 @@
<packaging>war</packaging>
<name>${artifactId}</name>
<version>${version}</version>
-
+
<properties>
<!--
eliminates [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is
platform dependent!
-->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-
<!-- The version of Weld extensions in use -->
<weld.extensions.version>1.0.0-CR2</weld.extensions.version>
</properties>
-
+
<dependencyManagement>
<dependencies>
<!-- Import scope will provide versions for dependencies below. -->
@@ -31,22 +30,22 @@
</dependency>
</dependencies>
</dependencyManagement>
-
+
<dependencies>
-
+
<!-- Common to JEE and Servlet containers -->
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<scope>provided</scope>
</dependency>
-
+
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>jsr250-api</artifactId>
<scope>provided</scope>
</dependency>
-
+
<!-- JSF 2.0 API -->
<dependency>
<groupId>javax.faces</groupId>
@@ -55,10 +54,7 @@
<!-- Optional, but pretty useful. -->
<!--
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>jstl</artifactId>
- </dependency>
+ <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> </dependency>
-->
<!-- Optional, but highly recommended. -->
@@ -85,20 +81,7 @@
<scope>runtime</scope>
</dependency>
- <!-- Bean Validation API (JSR 303) -->
<dependency>
- <groupId>javax.validation</groupId>
- <artifactId>validation-api</artifactId>
- </dependency>
-
- <!-- Bean Validation Implementation -->
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>4.0.0.GA</version>
- </dependency>
-
- <dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>el-impl</artifactId>
<scope>runtime</scope>
@@ -109,11 +92,22 @@
</exclusion>
</exclusions>
</dependency>
-
<!-- end Jetty/Tomcat-specific scopes and artifacts -->
-
+
+ <!-- Bean Validation API (JSR 303) -->
+ <dependency>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ </dependency>
+
+ <!-- Bean Validation Implementation -->
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>4.0.0.GA</version>
+ </dependency>
</dependencies>
-
+
<build>
<finalName>${artifactId}</finalName>
<plugins>
@@ -137,7 +131,7 @@
<downloadJavadocs>true</downloadJavadocs>
</configuration>
</plugin>
-
+
<!-- Embedded Jetty (jetty:run) -->
<plugin>
<groupId>org.mortbay.jetty</groupId>
@@ -169,15 +163,12 @@
<!-- Embedded port -->
<port>9090</port>
<!--
- The default authentication credentials for remote deployment are username "admin" with no password
- To override credentials, define a server in settings.xml and activate it using the <server> element
+ The default authentication credentials for remote deployment are username "admin" with no password To
+ override credentials, define a server in settings.xml and activate it using the <server> element
-->
<url>http://localhost:8080/manager</url>
</configuration>
</plugin>
-
</plugins>
-
</build>
-
-</project>
+</project>
\ No newline at end of file
14 years, 9 months