Weld SVN: r4999 - doc/trunk/reference/en-US.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-11-12 15:14:27 -0500 (Thu, 12 Nov 2009)
New Revision: 4999
Modified:
doc/trunk/reference/en-US/scopescontexts.xml
Log:
singleton scope
Modified: doc/trunk/reference/en-US/scopescontexts.xml
===================================================================
--- doc/trunk/reference/en-US/scopescontexts.xml 2009-11-12 19:55:19 UTC (rev 4998)
+++ doc/trunk/reference/en-US/scopescontexts.xml 2009-11-12 20:14:27 UTC (rev 4999)
@@ -282,12 +282,69 @@
</section>
</section>
+
+ <section>
+ <title>The singleton pseudo-scope</title>
+
+ <para>
+ In addition to the four built-in scopes, CDI also supports two <emphasis>pseudo-scopes</emphasis>. The first
+ is the <literal>singleton pseudo-scope</literal>, which we specify using the annotation <literal>@Singleton</literal>.
+ </para>
+
+ <note>
+ <para>
+ Unlike the other scopes, which belong to the package <literal>javax.enterprise.context</literal>, the
+ <literal>@Singleton</literal> annotation is defined in the package <literal>javax.inject</literal>.
+ </para>
+ </note>
+
+ <para>
+ You can guess what "singleton" means here. It means a bean that is instantiated once. Unfortunately, there's
+ a little problem with this pseudo-scope. Beans with scope <literal>@Singleton</literal> don't have a proxy
+ object. Clients hold a direct reference to the singleton instance. So we need to consider the case of a client
+ that can be serialized, for example, any bean with scope <literal>@SessionScoped</literal> or
+ <literal>@ConversationScoped</literal>, any dependent object of a bean with scope <literal>@SessionScoped</literal>
+ or <literal>@ConversationScoped</literal>, or any stateful session bean.
+ </para>
+
+ <para>
+ Now, if the singleton instance is a simple, immutable, serializable object like a string, a number or a date,
+ we probably don't mind too much if it gets duplicated via serialization. However, that makes it no stop being a
+ true singleton, and we may as well have just declared it with the default scope.
+ </para>
+ <para>There are several ways to ensure that the singleton bean remains a singleton when its client gets serialized:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ have the singleton bean implement <literal>writeResolve()</literal> and <literal>readReplace()</literal>
+ (as defined by the Java serialization specification),
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ make sure the client keeps only a transient reference to the singleton bean, or
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ give the client a reference of type <literal>Instance<X></literal> where <literal>X</literal> is the
+ bean type of the singleton bean.
+ </para>
+ </listitem>
+ </itemizedlist>
+
+ <para>A third, better solution is to instead use <literal>@ApplicationScoped</literal>, allowing the container to
+ proxy the bean, and take care of serialization problems automatically.</para>
+
+ </section>
+
<section>
<title>The dependent pseudo-scope</title>
<para>
- In addition to the four built-in scopes, CDI features the so-called <emphasis>dependent pseudo-scope</emphasis>.
+ Finally, CDI features the so-called <emphasis>dependent pseudo-scope</emphasis>.
This is the default scope for a bean which does not explicitly declare a scope type.
</para>
@@ -298,10 +355,15 @@
<programlisting role="JAVA"><![CDATA[public class Calculator { ... }]]></programlisting>
<para>
- An instances of a dependent bean is never shared between different clients or different injection points. It is
+ An instance of a dependent bean is never shared between different clients or different injection points. It is
strictly a <emphasis>dependent object</emphasis> of some other object. It is instantiated when the object it
belongs to is created, and destroyed when the object it belongs to is destroyed.
</para>
+
+ <para>
+ Beans with scope <literal>@Dependent</literal> don't need a proxy object. The client holds a direct reference
+ to its instance.
+ </para>
<para>
CDI makes it easy to obtain a dependent instance of a bean, even if the bean is already declared as a bean with
14 years, 7 months
Weld SVN: r4997 - extensions/trunk.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-11-12 14:55:04 -0500 (Thu, 12 Nov 2009)
New Revision: 4997
Added:
extensions/trunk/archetypes/
Log:
add archetypes dir
14 years, 7 months
Weld SVN: r4996 - doc/trunk/reference/en-US.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-11-11 22:04:49 -0500 (Wed, 11 Nov 2009)
New Revision: 4996
Modified:
doc/trunk/reference/en-US/weldexamples.xml
Log:
fix
Modified: doc/trunk/reference/en-US/weldexamples.xml
===================================================================
--- doc/trunk/reference/en-US/weldexamples.xml 2009-11-11 21:56:16 UTC (rev 4995)
+++ doc/trunk/reference/en-US/weldexamples.xml 2009-11-12 03:04:49 UTC (rev 4996)
@@ -887,9 +887,9 @@
The <literal>reset()</literal> method makes a call to the
injected <literal>rndGenerator</literal> in order to get
the random number at the start of each game. Note that it
- cannot use <literal>manager.getInstanceByType(Integer.class, new AnnotationLiteral<Random>(){})</literal>
- as the JSF example does because there will not be any active
- contexts like there is during a JSF request.
+ can't use <literal>Instance.get()</literal> like the JSF
+ example does because there will not be any active contexts
+ like there are during a JSF request.
</para>
</callout>
</calloutlist>
14 years, 7 months
Weld SVN: r4994 - doc/tags.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-11-11 16:56:08 -0500 (Wed, 11 Nov 2009)
New Revision: 4994
Added:
doc/tags/weld-docbook-xslt-1.1.1-Beta5/
Log:
[maven-scm] copy for tag weld-docbook-xslt-1.1.1-Beta5
Copied: doc/tags/weld-docbook-xslt-1.1.1-Beta5 (from rev 4993, doc/trunk/xslt)
14 years, 7 months
Weld SVN: r4992 - examples/trunk/jsf/permalink.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-11-11 16:37:56 -0500 (Wed, 11 Nov 2009)
New Revision: 4992
Modified:
examples/trunk/jsf/permalink/pom.xml
Log:
fix permalink in servlet
Modified: examples/trunk/jsf/permalink/pom.xml
===================================================================
--- examples/trunk/jsf/permalink/pom.xml 2009-11-11 21:37:22 UTC (rev 4991)
+++ examples/trunk/jsf/permalink/pom.xml 2009-11-11 21:37:56 UTC (rev 4992)
@@ -283,6 +283,9 @@
<resource>
<directory>src/log/resources</directory>
</resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
</resources>
<plugins>
@@ -411,6 +414,9 @@
<resource>
<directory>src/log/resources</directory>
</resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
</resources>
<plugins>
<plugin>
14 years, 7 months
Weld SVN: r4991 - examples/tags/1.0.0-CR2/jsf/permalink.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-11-11 16:37:22 -0500 (Wed, 11 Nov 2009)
New Revision: 4991
Modified:
examples/tags/1.0.0-CR2/jsf/permalink/pom.xml
Log:
fix permalink in tomcat and jetty
Modified: examples/tags/1.0.0-CR2/jsf/permalink/pom.xml
===================================================================
--- examples/tags/1.0.0-CR2/jsf/permalink/pom.xml 2009-11-11 21:19:05 UTC (rev 4990)
+++ examples/tags/1.0.0-CR2/jsf/permalink/pom.xml 2009-11-11 21:37:22 UTC (rev 4991)
@@ -283,6 +283,9 @@
<resource>
<directory>src/log/resources</directory>
</resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
</resources>
<plugins>
@@ -411,6 +414,9 @@
<resource>
<directory>src/log/resources</directory>
</resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
</resources>
<plugins>
<plugin>
14 years, 7 months
Weld SVN: r4990 - in core/trunk/impl/src/main: java/org/jboss/weld/bean and 4 other directories.
by weld-commits@lists.jboss.org
Author: dallen6
Date: 2009-11-11 16:19:05 -0500 (Wed, 11 Nov 2009)
New Revision: 4990
Added:
core/trunk/impl/src/main/java/org/jboss/weld/CreationException.java
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessAnnotatedTypeImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSessionBeanImpl.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/BootstrapMessage.java
core/trunk/impl/src/main/resources/org/jboss/weld/messages/bean_en.properties
core/trunk/impl/src/main/resources/org/jboss/weld/messages/bootstrap_en.properties
Log:
Additional exception conversion for localized messages
Added: core/trunk/impl/src/main/java/org/jboss/weld/CreationException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/CreationException.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/CreationException.java 2009-11-11 21:19:05 UTC (rev 4990)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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;
+
+import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
+import ch.qos.cal10n.IMessageConveyor;
+
+/**
+ * A version of {@link javax.enterprise.inject.CreationException} that supports
+ * message localization.
+ *
+ * @author David Allen
+ *
+ */
+public class CreationException extends javax.enterprise.inject.CreationException
+{
+
+ private static final long serialVersionUID = 5167626747306493463L;
+
+ // Exception messages
+ private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+
+ public <E extends Enum<?>> CreationException(E key, Object... args)
+ {
+ super(messageConveyer.getMessage(key, args));
+ }
+
+ public <E extends Enum<?>> CreationException(E key, Throwable throwable, Object... args)
+ {
+ super(messageConveyer.getMessage(key, args), throwable);
+ }
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/CreationException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java 2009-11-11 18:03:28 UTC (rev 4989)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java 2009-11-11 21:19:05 UTC (rev 4990)
@@ -16,6 +16,19 @@
*/
package org.jboss.weld.bean;
+import static org.jboss.weld.logging.messages.BeanMessage.CANNOT_DESTROY_ENTERPRISE_BEAN_NOT_CREATED;
+import static org.jboss.weld.logging.messages.BeanMessage.CANNOT_DESTROY_NULL_BEAN;
+import static org.jboss.weld.logging.messages.BeanMessage.EJB_CANNOT_BE_DECORATOR;
+import static org.jboss.weld.logging.messages.BeanMessage.EJB_CANNOT_BE_INTERCEPTOR;
+import static org.jboss.weld.logging.messages.BeanMessage.EJB_NOT_FOUND;
+import static org.jboss.weld.logging.messages.BeanMessage.MESSAGE_DRIVEN_BEANS_CANNOT_BE_MANAGED;
+import static org.jboss.weld.logging.messages.BeanMessage.OBSERVER_METHOD_MUST_BE_STATIC_OR_BUSINESS;
+import static org.jboss.weld.logging.messages.BeanMessage.PROXY_INSTANTIATION_BEAN_ACCESS_FAILED;
+import static org.jboss.weld.logging.messages.BeanMessage.PROXY_INSTANTIATION_FAILED;
+import static org.jboss.weld.logging.messages.BeanMessage.SCOPE_NOT_ALLOWED_ON_SINGLETON_BEAN;
+import static org.jboss.weld.logging.messages.BeanMessage.SCOPE_NOT_ALLOWED_ON_STATELESS_SESSION_BEAN;
+import static org.jboss.weld.logging.messages.BeanMessage.SPECIALIZING_ENTERPRISE_BEAN_MUST_EXTEND_AN_ENTERPRISE_BEAN;
+
import java.io.Serializable;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
@@ -31,7 +44,6 @@
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.event.Observes;
-import javax.enterprise.inject.CreationException;
import javax.enterprise.inject.Typed;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.enterprise.inject.spi.InjectionTarget;
@@ -39,7 +51,11 @@
import org.jboss.interceptor.model.InterceptionModel;
import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.CreationException;
import org.jboss.weld.DefinitionException;
+import org.jboss.weld.ForbiddenArgumentException;
+import org.jboss.weld.ForbiddenStateException;
+import org.jboss.weld.WeldException;
import org.jboss.weld.bean.interceptor.InterceptorBindingsAdapter;
import org.jboss.weld.bean.proxy.EnterpriseBeanInstance;
import org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler;
@@ -170,15 +186,15 @@
}
catch (InstantiationException e)
{
- throw new RuntimeException("Could not instantiate enterprise proxy for " + toString(), e);
+ throw new WeldException(PROXY_INSTANTIATION_FAILED, e, this);
}
catch (IllegalAccessException e)
{
- throw new RuntimeException("Could not access bean correctly when creating enterprise proxy for " + toString(), e);
+ throw new WeldException(PROXY_INSTANTIATION_BEAN_ACCESS_FAILED, e, this);
}
catch (Exception e)
{
- throw new CreationException("could not find the EJB in JNDI " + proxyClass, e);
+ throw new CreationException(EJB_NOT_FOUND, e, proxyClass);
}
}
@@ -217,11 +233,11 @@
{
if (getType().isAnnotationPresent(Interceptor.class))
{
- throw new DefinitionException("Enterprise beans cannot be interceptors");
+ throw new DefinitionException(EJB_CANNOT_BE_INTERCEPTOR, getType());
}
if (getType().isAnnotationPresent(Decorator.class))
{
- throw new DefinitionException("Enterprise beans cannot be decorators");
+ throw new DefinitionException(EJB_CANNOT_BE_DECORATOR, getType());
}
}
@@ -233,11 +249,11 @@
{
if (ejbDescriptor.isStateless() && !isDependent())
{
- throw new DefinitionException("Scope " + getScope() + " is not allowed on stateless enterprise beans for " + getType() + ". Only @Dependent is allowed on stateless enterprise beans");
+ throw new DefinitionException(SCOPE_NOT_ALLOWED_ON_STATELESS_SESSION_BEAN, getScope(), getType());
}
if (ejbDescriptor.isSingleton() && !(isDependent() || getScope().equals(ApplicationScoped.class)))
{
- throw new DefinitionException("Scope " + getScope() + " is not allowed on singleton enterprise beans for " + getType() + ". Only @Dependent or @ApplicationScoped is allowed on singleton enterprise beans");
+ throw new DefinitionException(SCOPE_NOT_ALLOWED_ON_SINGLETON_BEAN, getScope(), getType());
}
}
@@ -251,7 +267,7 @@
// We appear to check this twice?
if (!environment.getEjbDescriptors().contains(getAnnotatedItem().getWeldSuperclass().getJavaClass()))
{
- throw new DefinitionException("Annotation defined specializing EJB must have EJB superclass");
+ throw new DefinitionException(SPECIALIZING_ENTERPRISE_BEAN_MUST_EXTEND_AN_ENTERPRISE_BEAN, this);
}
}
@@ -260,12 +276,12 @@
{
if (environment.getClassBean(getAnnotatedItem().getWeldSuperclass()) == null)
{
- throw new IllegalStateException(toString() + " does not specialize a bean");
+ throw new ForbiddenStateException(SPECIALIZING_ENTERPRISE_BEAN_MUST_EXTEND_AN_ENTERPRISE_BEAN, this);
}
AbstractClassBean<?> specializedBean = environment.getClassBean(getAnnotatedItem().getWeldSuperclass());
if (!(specializedBean instanceof SessionBean<?>))
{
- throw new IllegalStateException(toString() + " doesn't have a session bean as a superclass " + specializedBean);
+ throw new ForbiddenStateException(SPECIALIZING_ENTERPRISE_BEAN_MUST_EXTEND_AN_ENTERPRISE_BEAN, this);
}
else
{
@@ -292,11 +308,11 @@
{
if (instance == null)
{
- throw new IllegalArgumentException("instance to destroy cannot be null");
+ throw new ForbiddenArgumentException(CANNOT_DESTROY_NULL_BEAN, this);
}
if (!(instance instanceof EnterpriseBeanInstance))
{
- throw new IllegalArgumentException("Cannot destroy session bean instance not created by the container");
+ throw new ForbiddenArgumentException(CANNOT_DESTROY_ENTERPRISE_BEAN_NOT_CREATED, instance);
}
EnterpriseBeanInstance enterpriseBeanInstance = (EnterpriseBeanInstance) instance;
enterpriseBeanInstance.destroy(Marker.INSTANCE, this, creationalContext);
@@ -310,7 +326,7 @@
{
if (ejbDescriptor.isMessageDriven())
{
- throw new DefinitionException("Message Driven Beans can't be Managed Beans");
+ throw new DefinitionException(MESSAGE_DRIVEN_BEANS_CANNOT_BE_MANAGED, this);
}
}
@@ -372,7 +388,7 @@
{
if (!isMethodExistsOnTypes(method))
{
- throw new DefinitionException("Observer method must be static or business method: " + method + " on " + getAnnotatedItem());
+ throw new DefinitionException(OBSERVER_METHOD_MUST_BE_STATIC_OR_BUSINESS, method, getAnnotatedItem());
}
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java 2009-11-11 18:03:28 UTC (rev 4989)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java 2009-11-11 21:19:05 UTC (rev 4990)
@@ -16,6 +16,8 @@
*/
package org.jboss.weld.bootstrap;
+import static org.jboss.weld.logging.messages.BootstrapMessage.BEAN_IS_BOTH_INTERCEPTOR_AND_DECORATOR;
+
import java.util.HashSet;
import java.util.Set;
@@ -130,7 +132,7 @@
{
if (clazz.isAnnotationPresent(Decorator.class))
{
- throw new DeploymentException("Class " + clazz.getName() + " has both @Interceptor and @Decorator annotations");
+ throw new DeploymentException(BEAN_IS_BOTH_INTERCEPTOR_AND_DECORATOR, clazz.getName());
}
}
@@ -138,7 +140,7 @@
{
if (clazz.isAnnotationPresent(Interceptor.class))
{
- throw new DeploymentException("Class " + clazz.getName() + " has both @Interceptor and @Decorator annotations");
+ throw new DeploymentException(BEAN_IS_BOTH_INTERCEPTOR_AND_DECORATOR, clazz.getName());
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java 2009-11-11 18:03:28 UTC (rev 4989)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java 2009-11-11 21:19:05 UTC (rev 4990)
@@ -19,7 +19,12 @@
import static org.jboss.weld.logging.Category.BOOTSTRAP;
import static org.jboss.weld.logging.Category.VERSION;
import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
+import static org.jboss.weld.logging.messages.BootstrapMessage.BEAN_STORE_MISSING;
+import static org.jboss.weld.logging.messages.BootstrapMessage.DEPLOYMENT_ARCHIVE_NULL;
+import static org.jboss.weld.logging.messages.BootstrapMessage.DEPLOYMENT_REQUIRED;
import static org.jboss.weld.logging.messages.BootstrapMessage.JTA_UNAVAILABLE;
+import static org.jboss.weld.logging.messages.BootstrapMessage.MANAGER_NOT_INITIALIZED;
+import static org.jboss.weld.logging.messages.BootstrapMessage.UNSPECIFIED_REQUIRED_SERVICE;
import static org.jboss.weld.logging.messages.BootstrapMessage.VALIDATING_BEANS;
import java.net.URL;
@@ -30,13 +35,14 @@
import java.util.Set;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
-
import javax.enterprise.inject.spi.Extension;
import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.Container;
import org.jboss.weld.ContextualStoreImpl;
+import org.jboss.weld.ForbiddenArgumentException;
+import org.jboss.weld.ForbiddenStateException;
import org.jboss.weld.Validator;
import org.jboss.weld.Container.Status;
import org.jboss.weld.bean.builtin.BeanManagerBean;
@@ -187,7 +193,7 @@
// Check the id is not null
if (beanDeploymentArchive.getId() == null)
{
- throw new IllegalArgumentException("BeanDeploymentArchive must not be null " + beanDeploymentArchive);
+ throw new ForbiddenArgumentException(DEPLOYMENT_ARCHIVE_NULL, beanDeploymentArchive);
}
BeanDeployment parent = managerAwareBeanDeploymentArchives.get(beanDeploymentArchive);
@@ -233,7 +239,7 @@
{
if (deployment == null)
{
- throw new IllegalArgumentException("Must start the container with a deployment");
+ throw new ForbiddenArgumentException(DEPLOYMENT_REQUIRED);
}
if (!deployment.getServices().contains(ResourceLoader.class))
{
@@ -265,7 +271,7 @@
// }
if (applicationBeanStore == null)
{
- throw new IllegalStateException("No application context BeanStore set");
+ throw new ForbiddenStateException(BEAN_STORE_MISSING);
}
this.deployment = deployment;
@@ -335,7 +341,7 @@
{
if (deploymentManager == null)
{
- throw new IllegalStateException("Manager has not been initialized");
+ throw new ForbiddenStateException(MANAGER_NOT_INITIALIZED);
}
ExtensionBeanDeployer extensionBeanDeployer = new ExtensionBeanDeployer(deploymentManager, deployment, beanDeployments);
@@ -446,7 +452,7 @@
{
if (!services.contains(serviceType))
{
- throw new IllegalStateException("Required service " + serviceType.getName() + " has not been specified");
+ throw new ForbiddenStateException(UNSPECIFIED_REQUIRED_SERVICE, serviceType.getName());
}
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessAnnotatedTypeImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessAnnotatedTypeImpl.java 2009-11-11 18:03:28 UTC (rev 4989)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessAnnotatedTypeImpl.java 2009-11-11 21:19:05 UTC (rev 4990)
@@ -16,12 +16,15 @@
*/
package org.jboss.weld.bootstrap.events;
+import static org.jboss.weld.logging.messages.BootstrapMessage.ANNOTATION_TYPE_NULL;
+
import java.lang.reflect.Type;
import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.ProcessAnnotatedType;
import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.ForbiddenArgumentException;
import org.jboss.weld.introspector.WeldClass;
/**
@@ -60,7 +63,7 @@
{
if (type == null)
{
- throw new IllegalArgumentException("Cannot set the type to null (if you want to stop the type being used, call veto()) " + this);
+ throw new ForbiddenArgumentException(ANNOTATION_TYPE_NULL, this);
}
this.annotatedType = type;
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSessionBeanImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSessionBeanImpl.java 2009-11-11 18:03:28 UTC (rev 4989)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSessionBeanImpl.java 2009-11-11 21:19:05 UTC (rev 4990)
@@ -1,5 +1,7 @@
package org.jboss.weld.bootstrap.events;
+import static org.jboss.weld.logging.messages.BootstrapMessage.BEAN_TYPE_NOT_EJB;
+
import java.lang.reflect.Type;
import javax.enterprise.inject.spi.AnnotatedType;
@@ -7,6 +9,7 @@
import javax.enterprise.inject.spi.SessionBeanType;
import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.ForbiddenStateException;
import org.jboss.weld.bean.SessionBean;
public class ProcessSessionBeanImpl<X> extends AbstractProcessClassBean<Object, SessionBean<Object>> implements ProcessSessionBean<X>
@@ -48,7 +51,7 @@
}
else
{
- throw new IllegalStateException("Bean type is not STATELESS, STATEFUL or SINGELTON " + getBean());
+ throw new ForbiddenStateException(BEAN_TYPE_NOT_EJB, getBean());
}
}
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-11 18:03:28 UTC (rev 4989)
+++ core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/BeanMessage.java 2009-11-11 21:19:05 UTC (rev 4990)
@@ -96,6 +96,16 @@
@MessageId("000075") PUBLIC_FIELD_ON_NORMAL_SCOPED_BEAN_NOT_ALLOWED,
@MessageId("000076") PARAMETER_ANNOTATION_NOT_ALLOWED_ON_CONSTRUCTOR,
@MessageId("000077") MULTIPLE_DISPOSAL_METHODS,
- @MessageId("000078") PRODUCER_METHOD_NOT_SPECIALIZING
+ @MessageId("000078") PRODUCER_METHOD_NOT_SPECIALIZING,
+ @MessageId("000079") EJB_NOT_FOUND,
+ @MessageId("000080") EJB_CANNOT_BE_INTERCEPTOR,
+ @MessageId("000081") EJB_CANNOT_BE_DECORATOR,
+ @MessageId("000082") SCOPE_NOT_ALLOWED_ON_STATELESS_SESSION_BEAN,
+ @MessageId("000083") SCOPE_NOT_ALLOWED_ON_SINGLETON_BEAN,
+ @MessageId("000084") SPECIALIZING_ENTERPRISE_BEAN_MUST_EXTEND_AN_ENTERPRISE_BEAN,
+ @MessageId("000085") CANNOT_DESTROY_NULL_BEAN,
+ @MessageId("000086") CANNOT_DESTROY_ENTERPRISE_BEAN_NOT_CREATED,
+ @MessageId("000087") MESSAGE_DRIVEN_BEANS_CANNOT_BE_MANAGED,
+ @MessageId("000088") OBSERVER_METHOD_MUST_BE_STATIC_OR_BUSINESS;
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/BootstrapMessage.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/BootstrapMessage.java 2009-11-11 18:03:28 UTC (rev 4989)
+++ core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/BootstrapMessage.java 2009-11-11 21:19:05 UTC (rev 4990)
@@ -27,6 +27,14 @@
@MessageId("000106") FOUND_BEAN,
@MessageId("000107") FOUND_INTERCEPTOR,
@MessageId("000108") FOUND_DECORATOR,
- @MessageId("000109") FOUND_OBSERVER_METHOD;
+ @MessageId("000109") FOUND_OBSERVER_METHOD,
+ @MessageId("000110") ANNOTATION_TYPE_NULL,
+ @MessageId("000111") BEAN_TYPE_NOT_EJB,
+ @MessageId("000112") BEAN_IS_BOTH_INTERCEPTOR_AND_DECORATOR,
+ @MessageId("000113") DEPLOYMENT_ARCHIVE_NULL,
+ @MessageId("000114") DEPLOYMENT_REQUIRED,
+ @MessageId("000115") BEAN_STORE_MISSING,
+ @MessageId("000116") MANAGER_NOT_INITIALIZED,
+ @MessageId("000117") UNSPECIFIED_REQUIRED_SERVICE;
}
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-11 18:03:28 UTC (rev 4989)
+++ core/trunk/impl/src/main/resources/org/jboss/weld/messages/bean_en.properties 2009-11-11 21:19:05 UTC (rev 4990)
@@ -77,3 +77,13 @@
PARAMETER_ANNOTATION_NOT_ALLOWED_ON_CONSTRUCTOR=Managed bean constructor must not have a parameter annotated {0}\: {1}
MULTIPLE_DISPOSAL_METHODS=Cannot declare multiple disposal methods for this producer method.\\n\\nProducer method\: {0}\\nDisposal methods\: {1}
PRODUCER_METHOD_NOT_SPECIALIZING=Specialized producer method does not override a method on the direct superclass\: {0}
+EJB_NOT_FOUND=Could not find the EJB in JNDI\: {0}
+EJB_CANNOT_BE_INTERCEPTOR=Enterprise beans cannot be interceptors\: {0}
+EJB_CANNOT_BE_DECORATOR=Enterprise beans cannot be decorators\: {0}
+SCOPE_NOT_ALLOWED_ON_STATELESS_SESSION_BEAN=Scope {0} is not allowed on stateless enterprise beans for {1}. Only @Dependent is allowed on stateless enterprise beans.
+SCOPE_NOT_ALLOWED_ON_SINGLETON_BEAN=Scope {0} is not allowed on singleton enterprise beans for {1}. Only @Dependent is allowed on singleton enterprise beans.
+SPECIALIZING_ENTERPRISE_BEAN_MUST_EXTEND_AN_ENTERPRISE_BEAN=Specializing enterprise bean must extend another enterprise bean\: {0}
+CANNOT_DESTROY_NULL_BEAN=Cannot destroy null instance of {0}
+CANNOT_DESTROY_ENTERPRISE_BEAN_NOT_CREATED=Cannot destroy session bean instance not created by the container\: {0}
+MESSAGE_DRIVEN_BEANS_CANNOT_BE_MANAGED=Message driven beans cannot be Managed Beans\: {0}
+OBSERVER_METHOD_MUST_BE_STATIC_OR_BUSINESS=Observer method must be static or business method\: {0} on {1}
Modified: core/trunk/impl/src/main/resources/org/jboss/weld/messages/bootstrap_en.properties
===================================================================
--- core/trunk/impl/src/main/resources/org/jboss/weld/messages/bootstrap_en.properties 2009-11-11 18:03:28 UTC (rev 4989)
+++ core/trunk/impl/src/main/resources/org/jboss/weld/messages/bootstrap_en.properties 2009-11-11 21:19:05 UTC (rev 4990)
@@ -7,3 +7,11 @@
FOUND_INTERCEPTOR=Interceptor: {0}
FOUND_DECORATOR=Decorator: {0}
FOUND_OBSERVER_METHOD=ObserverMethod\: {0}
+ANNOTATION_TYPE_NULL=Cannot set the annotation type to null (if you want to stop the type being used, call veto())\: {0}
+BEAN_TYPE_NOT_EJB=Bean type is not STATELESS, STATEFUL or SINGLETON\: {0}
+BEAN_IS_BOTH_INTERCEPTOR_AND_DECORATOR=Class {0} has both @Interceptor and @Decorator annotations
+DEPLOYMENT_ARCHIVE_NULL=BeanDeploymentArchive must not be null\: {0}
+DEPLOYMENT_REQUIRED=Must start the container with a deployment
+BEAN_STORE_MISSING=No application context BeanStore set
+MANAGER_NOT_INITIALIZED=Manager has not been initialized
+UNSPECIFIED_REQUIRED_SERVICE=Required service {0} has not been specified
14 years, 7 months
Weld SVN: r4989 - doc/trunk/xslt/src/main/resources/xslt/org/jboss/weld.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-11-11 13:03:28 -0500 (Wed, 11 Nov 2009)
New Revision: 4989
Modified:
doc/trunk/xslt/src/main/resources/xslt/org/jboss/weld/pdf.xsl
Log:
title color
Modified: doc/trunk/xslt/src/main/resources/xslt/org/jboss/weld/pdf.xsl
===================================================================
--- doc/trunk/xslt/src/main/resources/xslt/org/jboss/weld/pdf.xsl 2009-11-11 17:30:44 UTC (rev 4988)
+++ doc/trunk/xslt/src/main/resources/xslt/org/jboss/weld/pdf.xsl 2009-11-11 18:03:28 UTC (rev 4989)
@@ -16,10 +16,10 @@
<xsl:import href="classpath:/xslt/org/jboss/seam/pdf.xsl"/>
<!-- Change the font color for titles to black one -->
- <xsl:param name="title.color">black</xsl:param>
- <xsl:param name="titlepage.color">black</xsl:param>
- <xsl:param name="chapter.title.color">black</xsl:param>
- <xsl:param name="section.title.color">black</xsl:param>
+ <xsl:param name="title.color">brown</xsl:param>
+ <xsl:param name="titlepage.color">brown</xsl:param>
+ <xsl:param name="chapter.title.color">brown</xsl:param>
+ <xsl:param name="section.title.color">brown</xsl:param>
<!-- Change to monospace font for programlisting, needed to workaround crappy callouts -->
<xsl:param name="programlisting.font" select="$monospace.font.family" />
@@ -29,6 +29,7 @@
<xsl:param name="body.font.size" select="'70%'" />
<xsl:param name="chapter.title.font.size" select="'60%'" />
<xsl:param name="section.title.font.size" select="'60%'" />
+ <xsl:param name="title.font.size" select="'60%'" />
<xsl:template name="book.titlepage.recto">
<xsl:choose>
14 years, 7 months