[webbeans-commits] Webbeans SVN: r2228 - in examples/trunk/jsf2: WebContent/WEB-INF and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-27 12:23:19 -0400 (Fri, 27 Mar 2009)
New Revision: 2228
Removed:
examples/trunk/jsf2/WebContent/WEB-INF/faces-config.xml
Modified:
examples/trunk/jsf2/WebContent/WEB-INF/web.xml
examples/trunk/jsf2/build.xml
examples/trunk/jsf2/pom.xml
Log:
minor
Deleted: examples/trunk/jsf2/WebContent/WEB-INF/faces-config.xml
===================================================================
--- examples/trunk/jsf2/WebContent/WEB-INF/faces-config.xml 2009-03-27 14:19:05 UTC (rev 2227)
+++ examples/trunk/jsf2/WebContent/WEB-INF/faces-config.xml 2009-03-27 16:23:19 UTC (rev 2228)
@@ -1,11 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<faces-config version="1.2"
- xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
-
- <application>
- <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
- </application>
-
-</faces-config>
Modified: examples/trunk/jsf2/WebContent/WEB-INF/web.xml
===================================================================
--- examples/trunk/jsf2/WebContent/WEB-INF/web.xml 2009-03-27 14:19:05 UTC (rev 2227)
+++ examples/trunk/jsf2/WebContent/WEB-INF/web.xml 2009-03-27 16:23:19 UTC (rev 2228)
@@ -12,18 +12,12 @@
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
-
- <context-param>
- <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
- <param-value>.xhtml</param-value>
- </context-param>
<session-config>
<session-timeout>10</session-timeout>
Modified: examples/trunk/jsf2/build.xml
===================================================================
--- examples/trunk/jsf2/build.xml 2009-03-27 14:19:05 UTC (rev 2227)
+++ examples/trunk/jsf2/build.xml 2009-03-27 16:23:19 UTC (rev 2228)
@@ -1,7 +1,7 @@
<project basedir="." name="Numberguess Example Build" default="restart">
- <property name="example.name" value="webbeans-numberguess" />
+ <property name="example.name" value="webbeans-numberguess-jsf2" />
<import file="../build.xml" />
-</project>
\ No newline at end of file
+</project>
Modified: examples/trunk/jsf2/pom.xml
===================================================================
--- examples/trunk/jsf2/pom.xml 2009-03-27 14:19:05 UTC (rev 2227)
+++ examples/trunk/jsf2/pom.xml 2009-03-27 16:23:19 UTC (rev 2228)
@@ -43,35 +43,22 @@
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>com.sun.facelets</groupId>
- <artifactId>jsf-facelets</artifactId>
- </dependency>
+<!-- <dependency>-->
+<!-- <groupId>javax.el</groupId>-->
+<!-- <artifactId>el-ri</artifactId>-->
+<!-- <exclusions>-->
+<!-- <exclusion>-->
+<!-- <groupId>javax.el</groupId>-->
+<!-- <artifactId>el-api</artifactId>-->
+<!-- </exclusion>-->
+<!-- </exclusions>-->
+<!-- <scope>runtime</scope>-->
+<!-- </dependency>-->
- <!-- <dependency>
- <groupId>org.jboss.el</groupId>
- <artifactId>jboss-el</artifactId>
- <exclusions>
- <exclusion>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>-->
-
<dependency>
- <groupId>javax.el</groupId>
- <artifactId>el-ri</artifactId>
- <exclusions>
- <exclusion>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
<groupId>javax.annotation</groupId>
<artifactId>jsr250-api</artifactId>
+ <scope>provided</scope>
</dependency>
</dependencies>
15 years, 5 months
[webbeans-commits] Webbeans SVN: r2227 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-03-27 10:19:05 -0400 (Fri, 27 Mar 2009)
New Revision: 2227
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/SimpleBeanA.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/SimpleBeanB.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/SimpleBeanZ.java
Removed:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/DummyContext.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/DummyScoped.java
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/DestroyedInstanceReturnedByGetTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/GetOnInactiveContextTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/GetTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/GetWithNoCreationalContextTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/MySessionBean.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/NormalContextTest.java
Log:
Added/enabled more context tests.
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/DestroyedInstanceReturnedByGetTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/DestroyedInstanceReturnedByGetTest.java 2009-03-27 13:06:18 UTC (rev 2226)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/DestroyedInstanceReturnedByGetTest.java 2009-03-27 14:19:05 UTC (rev 2227)
@@ -1,7 +1,6 @@
package org.jboss.jsr299.tck.tests.context;
import javax.context.ApplicationScoped;
-import javax.context.Context;
import javax.context.SessionScoped;
import javax.inject.manager.Bean;
@@ -13,22 +12,7 @@
@Artifact
public class DestroyedInstanceReturnedByGetTest extends AbstractJSR299Test
{
-
-
- Context context;
-
- @Override
- public void beforeMethod()
- {
- super.beforeMethod();
- if (context == null)
- {
- context = new DummyContext();
- getCurrentManager().addContext(context);
- }
- }
-
- @Test(groups = { "contexts", "ri-broken" })
+ @Test(groups = { "contexts" })
@SpecAssertion(section = "8.1", id = "g")
public void testDestroyedInstanceMustNotBeReturnedByGet()
{
@@ -36,19 +20,20 @@
MyCreationalContext<MySessionBean> myCreationalContext = new MyCreationalContext<MySessionBean>();
MySessionBean beanInstance = getCurrentManager().getContext(SessionScoped.class).get(mySessionBean, myCreationalContext);
assert beanInstance != null;
- mySessionBean.destroy(beanInstance);
- MySessionBean beanInstanceFromGet = getCurrentManager().getContext(SessionScoped.class).get(mySessionBean);
- assert beanInstanceFromGet != beanInstance;
+ this.destroyContext(getCurrentManager().getContext(SessionScoped.class));
+ this.setContextActive(getCurrentManager().getContext(SessionScoped.class));
+ beanInstance = getCurrentManager().getContext(SessionScoped.class).get(mySessionBean);
+ assert beanInstance == null;
Bean<MyApplicationBean> myApplicationBean = getCurrentManager().resolveByType(MyApplicationBean.class).iterator().next();
MyCreationalContext<MyApplicationBean> myCreationalContextForApplication = new MyCreationalContext<MyApplicationBean>();
MyApplicationBean myApplicationBeanInstance = getCurrentManager().getContext(ApplicationScoped.class).get(myApplicationBean, myCreationalContextForApplication);
assert myApplicationBeanInstance != null;
- myApplicationBean.destroy(myApplicationBeanInstance);
-
- MyApplicationBean mySecondApplicationBeanInstance = getCurrentManager().getContext(ApplicationScoped.class).get(myApplicationBean);
- assert mySecondApplicationBeanInstance != null;
- assert myApplicationBeanInstance != mySecondApplicationBeanInstance;
+ this.destroyContext(getCurrentManager().getContext(ApplicationScoped.class));
+ this.setContextActive(getCurrentManager().getContext(ApplicationScoped.class));
+
+ myApplicationBeanInstance = getCurrentManager().getContext(ApplicationScoped.class).get(myApplicationBean);
+ assert myApplicationBeanInstance == null;
}
}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/DummyContext.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/DummyContext.java 2009-03-27 13:06:18 UTC (rev 2226)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/DummyContext.java 2009-03-27 14:19:05 UTC (rev 2227)
@@ -1,30 +0,0 @@
-package org.jboss.jsr299.tck.tests.context;
-
-import java.lang.annotation.Annotation;
-
-import javax.context.Context;
-import javax.context.Contextual;
-import javax.context.CreationalContext;
-
-class DummyContext implements Context
-{
- public <T> T get(Contextual<T> bean, CreationalContext<T> creationalContext)
- {
- throw new UnsupportedOperationException();
- }
-
- public <T> T get(Contextual<T> contextual)
- {
- return get(contextual, null);
- }
-
- public Class<? extends Annotation> getScopeType()
- {
- return DummyScoped.class;
- }
-
- public boolean isActive()
- {
- return true;
- }
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/DummyScoped.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/DummyScoped.java 2009-03-27 13:06:18 UTC (rev 2226)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/DummyScoped.java 2009-03-27 14:19:05 UTC (rev 2227)
@@ -1,13 +0,0 @@
-package org.jboss.jsr299.tck.tests.context;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-import javax.context.ScopeType;
-
-@ScopeType
-(a)Retention(RetentionPolicy.RUNTIME)
-@interface DummyScoped
-{
-
-}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/GetOnInactiveContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/GetOnInactiveContextTest.java 2009-03-27 13:06:18 UTC (rev 2226)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/GetOnInactiveContextTest.java 2009-03-27 14:19:05 UTC (rev 2227)
@@ -13,21 +13,6 @@
@Artifact
public class GetOnInactiveContextTest extends AbstractJSR299Test
{
-
-
- Context context;
-
- public void initContext()
- {
- initContext();
- if (context == null)
- {
- context = new DummyContext();
- getCurrentManager().addContext(context);
- }
- }
-
-
@Test(groups = { "contexts" }, expectedExceptions = { ContextNotActiveException.class })
@SpecAssertion(section = "8.1", id = "h")
public void testInvokingGetOnInactiveContextFails()
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/GetTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/GetTest.java 2009-03-27 13:06:18 UTC (rev 2226)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/GetTest.java 2009-03-27 14:19:05 UTC (rev 2227)
@@ -1,7 +1,6 @@
package org.jboss.jsr299.tck.tests.context;
import javax.context.ApplicationScoped;
-import javax.context.Context;
import javax.context.Contextual;
import javax.context.CreationalContext;
import javax.context.SessionScoped;
@@ -14,24 +13,10 @@
@Artifact
public class GetTest extends AbstractJSR299Test
{
-
- Context context;
-
- public void initContext()
- {
- if (context == null)
- {
- context = new DummyContext();
- getCurrentManager().addContext(context);
- }
- }
-
-
@Test(groups = { "contexts" })
@SpecAssertion(section = "8.1", id = "e")
public void testGetMayNotCreateNewInstanceUnlessCreationalContextGiven()
{
- initContext();
Contextual<MySessionBean> mySessionBean = getCurrentManager().resolveByType(MySessionBean.class).iterator().next();
assert getCurrentManager().getContext(SessionScoped.class).get(mySessionBean) == null;
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/GetWithNoCreationalContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/GetWithNoCreationalContextTest.java 2009-03-27 13:06:18 UTC (rev 2226)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/GetWithNoCreationalContextTest.java 2009-03-27 14:19:05 UTC (rev 2227)
@@ -1,6 +1,5 @@
package org.jboss.jsr299.tck.tests.context;
-import javax.context.Context;
import javax.context.Contextual;
import javax.context.SessionScoped;
@@ -12,24 +11,10 @@
@Artifact
public class GetWithNoCreationalContextTest extends AbstractJSR299Test
{
-
- Context context;
-
- public void initContext()
- {
- if (context == null)
- {
- context = new DummyContext();
- getCurrentManager().addContext(context);
- }
- }
-
-
@Test(groups = { "contexts" })
@SpecAssertion(section = "8.1", id = "b")
public void testGetWithoutCreationalContextReturnsNull()
{
- initContext();
Contextual<MySessionBean> mySessionBean = getCurrentManager().resolveByType(MySessionBean.class).iterator().next();
assert getCurrentManager().getContext(SessionScoped.class).get(mySessionBean) == null;
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/MySessionBean.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/MySessionBean.java 2009-03-27 13:06:18 UTC (rev 2226)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/MySessionBean.java 2009-03-27 14:19:05 UTC (rev 2227)
@@ -2,13 +2,11 @@
import java.io.Serializable;
-@DummyScoped
+import javax.context.SessionScoped;
+
+@SessionScoped
class MySessionBean implements Serializable
{
-
- /**
- *
- */
private static final long serialVersionUID = 1L;
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/NormalContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/NormalContextTest.java 2009-03-27 13:06:18 UTC (rev 2226)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/NormalContextTest.java 2009-03-27 14:19:05 UTC (rev 2227)
@@ -24,22 +24,13 @@
public class NormalContextTest extends AbstractJSR299Test
{
- Context context;
-
- public void initContext()
- {
- if (context == null)
- {
- context = new DummyContext();
- getCurrentManager().addContext(context);
- }
- }
-
@Test(groups = { "contexts" })
- @SpecAssertion(section = "8.1", id = "a")
+ @SpecAssertions( {
+ @SpecAssertion(section = "8.1", id = "a"),
+ @SpecAssertion(section = "8.2", id = "c")
+ } )
public void testGetReturnsExistingInstance()
{
- initContext();
Contextual<MySessionBean> mySessionBean = getCurrentManager().resolveByType(MySessionBean.class).iterator().next();
MyCreationalContext<MySessionBean> myCreationalContext = new MyCreationalContext<MySessionBean>();
MySessionBean beanInstance = getCurrentManager().getContext(SessionScoped.class).get(mySessionBean, myCreationalContext);
@@ -54,7 +45,6 @@
} )
public void testGetWithCreationalContextReturnsNewInstance()
{
- initContext();
MyContextual bean = new MyContextual(getCurrentManager());
bean.setShouldReturnNullInstances(false);
getCurrentManager().addBean(bean);
@@ -69,7 +59,6 @@
@SpecAssertion(section = "8.1", id = "d")
public void testGetMayNotReturnNullUnlessNoCreationalContextOrContextualCreateReturnsNull()
{
- initContext();
// The case of no creational context is already tested where a null is
// returned. Here we just test that the contextual create can return null.
MyContextual bean = new MyContextual(getCurrentManager());
@@ -85,11 +74,11 @@
@SpecAssertions( {
@SpecAssertion(section = "6", id = "i"),
@SpecAssertion(section = "6", id = "j"),
- @SpecAssertion(section = "8.1", id = "f")
+ @SpecAssertion(section = "8.1", id = "f"),
+ @SpecAssertion(section = "8.2", id = "d")
})
public void testContextDestroysBeansWhenDestroyed()
{
- initContext();
MyContextual bean = new MyContextual(getCurrentManager());
bean.setShouldReturnNullInstances(false);
getCurrentManager().addBean(bean);
@@ -102,4 +91,15 @@
destroyContext(sessionContext);
assert bean.isDestroyCalled();
}
+
+ @Test(groups = { "contexts" })
+ @SpecAssertions( {
+ @SpecAssertion(section = "8.2", id = "e")
+ })
+ public void testSameNormalScopeBeanInjectedEverywhere()
+ {
+ SimpleBeanA instanceOfA = getCurrentManager().getInstanceByType(SimpleBeanA.class);
+ SimpleBeanB instanceOfB = getCurrentManager().getInstanceByType(SimpleBeanB.class);
+ assert instanceOfA.getZ() == instanceOfB.getZ();
+ }
}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/SimpleBeanA.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/SimpleBeanA.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/SimpleBeanA.java 2009-03-27 14:19:05 UTC (rev 2227)
@@ -0,0 +1,20 @@
+package org.jboss.jsr299.tck.tests.context;
+
+import java.io.Serializable;
+
+import javax.context.SessionScoped;
+import javax.inject.Current;
+
+@SessionScoped
+public class SimpleBeanA implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ @Current @SessionScoped
+ private SimpleBeanZ z;
+
+ public SimpleBeanZ getZ()
+ {
+ return z;
+ }
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/SimpleBeanA.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/SimpleBeanB.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/SimpleBeanB.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/SimpleBeanB.java 2009-03-27 14:19:05 UTC (rev 2227)
@@ -0,0 +1,20 @@
+package org.jboss.jsr299.tck.tests.context;
+
+import java.io.Serializable;
+
+import javax.context.SessionScoped;
+import javax.inject.Current;
+
+@SessionScoped
+public class SimpleBeanB implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ @Current @SessionScoped
+ private SimpleBeanZ z;
+
+ public SimpleBeanZ getZ()
+ {
+ return z;
+ }
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/SimpleBeanB.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/SimpleBeanZ.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/SimpleBeanZ.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/SimpleBeanZ.java 2009-03-27 14:19:05 UTC (rev 2227)
@@ -0,0 +1,12 @@
+package org.jboss.jsr299.tck.tests.context;
+
+import java.io.Serializable;
+
+import javax.context.SessionScoped;
+
+@SessionScoped
+public class SimpleBeanZ implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/SimpleBeanZ.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 5 months
[webbeans-commits] Webbeans SVN: r2226 - examples/trunk/numberguess.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-27 09:06:18 -0400 (Fri, 27 Mar 2009)
New Revision: 2226
Modified:
examples/trunk/numberguess/pom.xml
Log:
mark deps provided
Modified: examples/trunk/numberguess/pom.xml
===================================================================
--- examples/trunk/numberguess/pom.xml 2009-03-27 13:03:49 UTC (rev 2225)
+++ examples/trunk/numberguess/pom.xml 2009-03-27 13:06:18 UTC (rev 2226)
@@ -46,6 +46,7 @@
<dependency>
<groupId>com.sun.facelets</groupId>
<artifactId>jsf-facelets</artifactId>
+ <scope>runtime</scope>
</dependency>
<!-- <dependency>
@@ -72,6 +73,7 @@
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>jsr250-api</artifactId>
+ <scope>provided</scope>
</dependency>
</dependencies>
15 years, 5 months
[webbeans-commits] Webbeans SVN: r2225 - extensions/trunk/logger/.settings.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-27 09:03:49 -0400 (Fri, 27 Mar 2009)
New Revision: 2225
Modified:
extensions/trunk/logger/.settings/
Log:
ignores
Property changes on: extensions/trunk/logger/.settings
___________________________________________________________________
Name: svn:ignore
+ org.eclipse.jdt.core.prefs
15 years, 5 months
[webbeans-commits] Webbeans SVN: r2224 - ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-27 08:35:49 -0400 (Fri, 27 Mar 2009)
New Revision: 2224
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
Log:
account for jpa services not being specified
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-03-27 11:16:11 UTC (rev 2223)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-03-27 12:35:49 UTC (rev 2224)
@@ -261,7 +261,7 @@
!ejbApiAbstraction.ENTERPRISE_BEAN_CLASS.isAssignableFrom(rawType) &&
!jsfApiAbstraction.UICOMPONENT_CLASS.isAssignableFrom(rawType) &&
hasSimpleWebBeanConstructor(clazz)
- && !manager.getServices().get(JpaServices.class).discoverEntities().contains(clazz.getRawType());
+ && manager.getServices().contains(JpaServices.class) ? !manager.getServices().get(JpaServices.class).discoverEntities().contains(clazz.getRawType()) : true;
}
private static boolean hasSimpleWebBeanConstructor(AnnotatedClass<?> type)
15 years, 5 months
[webbeans-commits] Webbeans SVN: r2223 - in ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren: impl and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: vitold
Date: 2009-03-27 07:16:11 -0400 (Fri, 27 Mar 2009)
New Revision: 2223
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/NotSimpleBeanChildrenChecker.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/SimpleBeanChildrenChecker.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/impl/BeanChildrenCheckerImpl.java
Log:
finish with 9.5.3
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/NotSimpleBeanChildrenChecker.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/NotSimpleBeanChildrenChecker.java 2009-03-27 08:06:18 UTC (rev 2222)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/NotSimpleBeanChildrenChecker.java 2009-03-27 11:16:11 UTC (rev 2223)
@@ -6,6 +6,7 @@
import javax.inject.DefinitionException;
import org.dom4j.Element;
+import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.xml.ParseXmlHelper;
import org.jboss.webbeans.xml.XmlConstants;
import org.jboss.webbeans.xml.XmlEnvironment;
@@ -43,4 +44,9 @@
throw new DefinitionException("Declaration of not a simple bean '" + beanChildElement.getParent().getName() +
"' contains a child <" + beanChildElement.getName() + "> which type is javax.decorator.Decorator");
}
+
+ public void checkForConstructor(Element beanElement, AnnotatedClass<?> beanClass)
+ {
+ //There is nothing to validate
+ }
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/SimpleBeanChildrenChecker.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/SimpleBeanChildrenChecker.java 2009-03-27 08:06:18 UTC (rev 2222)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/ext/SimpleBeanChildrenChecker.java 2009-03-27 11:16:11 UTC (rev 2223)
@@ -1,11 +1,16 @@
package org.jboss.webbeans.xml.checker.beanchildren.ext;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.inject.DefinitionException;
import org.dom4j.Element;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.introspector.AnnotatedConstructor;
+import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.xml.ParseXmlHelper;
import org.jboss.webbeans.xml.XmlConstants;
import org.jboss.webbeans.xml.XmlEnvironment;
@@ -47,4 +52,42 @@
"> in bean '" + beanChildElement.getParent().getName() + "'");
haveBeanDecoratorDeclaration = true;
}
+
+ public void checkForConstructor(Element beanElement, AnnotatedClass<?> beanClass)
+ {
+ if(constructorParameters.size() == 0)
+ return;
+
+ List<AnnotatedConstructor<?>> matchableConstructors = new ArrayList<AnnotatedConstructor<?>>();
+
+ for(AnnotatedConstructor<?> constructor : beanClass.getConstructors())
+ {
+ List<? extends AnnotatedParameter<?>> parameters = constructor.getParameters();
+
+ if(parameters.size() != constructorParameters.size())
+ continue;
+
+ boolean isMacthable = true;
+
+ for(int i = 0; i < parameters.size(); i++)
+ {
+ if(!parameters.get(i).isAssignableFrom(constructorParameters.get(i)))
+ {
+ isMacthable = false;
+ break;
+ }
+ }
+
+ if(isMacthable)
+ matchableConstructors.add(constructor);
+ }
+
+ if(matchableConstructors.size() == 0)
+ throw new DefinitionException("There is no constructor of the simple bean '" + beanElement.getName() +
+ "' with the same number and types of parameters as declared");
+
+ if(matchableConstructors.size() > 1)
+ throw new DefinitionException("There is more than one constructor of the simple bean '" + beanElement.getName() +
+ "' with the same number and types of parameters as declared");
+ }
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/impl/BeanChildrenCheckerImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/impl/BeanChildrenCheckerImpl.java 2009-03-27 08:06:18 UTC (rev 2222)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/impl/BeanChildrenCheckerImpl.java 2009-03-27 11:16:11 UTC (rev 2223)
@@ -1,6 +1,8 @@
package org.jboss.webbeans.xml.checker.beanchildren.impl;
+import java.util.ArrayList;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -41,6 +43,8 @@
protected boolean haveBeanInterceptorDeclaration = false;
protected boolean haveBeanDecoratorDeclaration = false;
+
+ protected List<AnnotatedClass<?>> constructorParameters = new ArrayList<AnnotatedClass<?>>();
public abstract void checkForInterceptorChild(Element beanElement);
@@ -50,6 +54,8 @@
public abstract void checkChildForDecoratorType(Element beanElement);
+ public abstract void checkForConstructor(Element beanElement, AnnotatedClass<?> beanClass);
+
public BeanChildrenCheckerImpl(XmlEnvironment environment, Map<String, Set<String>> packagesMap)
{
this.environment = environment;
@@ -70,11 +76,12 @@
while(beanIterator.hasNext())
{
Element beanChildElement = (Element)beanIterator.next();
- checkBeanChild(beanChildElement);
+ checkBeanChild(beanChildElement, beanClass);
}
+ checkForConstructor(beanElement, beanClass);
}
- private void checkBeanChild(Element beanChildElement)
+ private void checkBeanChild(Element beanChildElement, AnnotatedClass<?> beanClass)
{
//TODO: not finished
try
@@ -91,7 +98,8 @@
}
if(isJavaClass || isInterface)
{
- //TODO: bean child element declaring a parameter of the bean constructor
+ //bean child element declaring a parameter of the bean constructor
+ constructorParameters.add(beanChildClass);
return;
}
throw new DefinitionException(new DefinitionException(beanChildElement.getName() + " can't be interpreted as a Java class or interface or Java Annotation type"));
@@ -108,7 +116,8 @@
Namespace beanChildNamespace = beanChildElement.getNamespace();
if(beanChildNamespace.equals(beanNamespace))
{
- //TODO: bean child element declaring a method or field of the bean.
+ //bean child element declaring a method or field of the bean.
+ checkFieldOrMethodChild(beanChildElement, beanClass);
return;
}
throw new DefinitionException("Can't determine type of element <" + beanChildElement.getName() + "> in bean '" +
@@ -155,5 +164,9 @@
throw new DefinitionException("Can't determine annotation type of <" + beanChildElement.getName() + "> element in bean '" +
beanChildElement.getParent().getName() + "'");
}
-
+
+ private void checkFieldOrMethodChild(Element beanChildElement, AnnotatedClass<?> beanClass)
+ {
+ //TODO: not finished
+ }
}
15 years, 5 months
[webbeans-commits] Webbeans SVN: r2222 - in ri/trunk/impl/src/main/java/org/jboss/webbeans/xml: checker/beanchildren/impl and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: vitold
Date: 2009-03-27 04:06:18 -0400 (Fri, 27 Mar 2009)
New Revision: 2222
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/impl/BeanChildrenCheckerImpl.java
Log:
minor
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java 2009-03-27 05:56:12 UTC (rev 2221)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java 2009-03-27 08:06:18 UTC (rev 2222)
@@ -54,7 +54,7 @@
}
if (classesList.size() == 0)
- throw new DefinitionException("Could not find '" + className + "'");
+ throw new DefinitionException("Could not find '" + className + "'", new DefinitionException(className + " not a Java type"));
if (classesList.size() == 1)
return classesList.get(0);
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/impl/BeanChildrenCheckerImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/impl/BeanChildrenCheckerImpl.java 2009-03-27 05:56:12 UTC (rev 2221)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/beanchildren/impl/BeanChildrenCheckerImpl.java 2009-03-27 08:06:18 UTC (rev 2222)
@@ -94,10 +94,15 @@
//TODO: bean child element declaring a parameter of the bean constructor
return;
}
- throw new DefinitionException();//bean child element can't be interpreted as a Java class or interface or Java Annotation type
+ throw new DefinitionException(new DefinitionException(beanChildElement.getName() + " can't be interpreted as a Java class or interface or Java Annotation type"));
}
catch(DefinitionException e)
{
+ if(!(e.getCause() instanceof DefinitionException))
+ {
+ throw new DefinitionException(e);
+ }
+
Element beanElement = beanChildElement.getParent();
Namespace beanNamespace = beanElement.getNamespace();
Namespace beanChildNamespace = beanChildElement.getNamespace();
15 years, 5 months
[webbeans-commits] Webbeans SVN: r2221 - doc/trunk/reference/zh-CN.
by webbeans-commits@lists.jboss.org
Author: alartin
Date: 2009-03-27 01:56:12 -0400 (Fri, 27 Mar 2009)
New Revision: 2221
Modified:
doc/trunk/reference/zh-CN/Author_Group.po
doc/trunk/reference/zh-CN/master.po
doc/trunk/reference/zh-CN/ri-spi.po
doc/trunk/reference/zh-CN/ri.po
Log:
recent updated
Modified: doc/trunk/reference/zh-CN/Author_Group.po
===================================================================
--- doc/trunk/reference/zh-CN/Author_Group.po 2009-03-26 21:29:53 UTC (rev 2220)
+++ doc/trunk/reference/zh-CN/Author_Group.po 2009-03-27 05:56:12 UTC (rev 2221)
@@ -6,7 +6,7 @@
"Project-Id-Version: Introduction_to_Web_Beans VERSION\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-03-17 20:14+0000\n"
-"PO-Revision-Date: 2009-03-12 11:59+0800\n"
+"PO-Revision-Date: 2009-03-27 13:39+0800\n"
"Last-Translator: Sean Wu <alartin(a)gmail.com>\n"
"Language-Team: none\n"
"MIME-Version: 1.0\n"
@@ -22,12 +22,8 @@
#. Tag: affiliation
#: Author_Group.xml:7
#, no-c-format
-msgid ""
-"<jobtitle>JSR-299 specification lead</jobtitle> <orgname>Red Hat Middleware "
-"LLC</orgname>"
-msgstr ""
-"<jobtitle>JSR-299规范领导者</jobtitle> <orgname>红帽中间件有限责任公司</"
-"orgname>"
+msgid "<jobtitle>JSR-299 specification lead</jobtitle> <orgname>Red Hat Middleware LLC</orgname>"
+msgstr "<jobtitle>JSR-299规范领导者</jobtitle> <orgname>红帽中间件有限责任公司</orgname>"
#. Tag: author
#: Author_Group.xml:12
@@ -38,12 +34,8 @@
#. Tag: affiliation
#: Author_Group.xml:15
#, no-c-format
-msgid ""
-"<jobtitle>Web Beans (JSR-299 Reference Implementation) lead </jobtitle> "
-"<orgname>Red Hat Middleware LLC</orgname>"
-msgstr ""
-"<jobtitle>Web Beans (JSR-299参考实现) 领导者 </jobtitle> <orgname>红帽中间件"
-"有限责任公司</orgname>"
+msgid "<jobtitle>Web Beans (JSR-299 Reference Implementation) lead </jobtitle> <orgname>Red Hat Middleware LLC</orgname>"
+msgstr "<jobtitle>Web Beans (JSR-299参考实现) 领导者 </jobtitle> <orgname>红帽中间件有限责任公司</orgname>"
#. Tag: othercredit
#: Author_Group.xml:21
@@ -52,10 +44,11 @@
msgstr "<firstname>Nicola</firstname> <surname>Benaglia</surname>"
#. Tag: contrib
-#: Author_Group.xml:24 Author_Group.xml:53
+#: Author_Group.xml:24
+#: Author_Group.xml:53
#, no-c-format
msgid "Italian Translation"
-msgstr "意大利语翻译"
+msgstr "意大利文翻译"
#. Tag: othercredit
#: Author_Group.xml:26
@@ -67,10 +60,12 @@
#: Author_Group.xml:29
#, no-c-format
msgid "Spanish Translation"
-msgstr "西班牙语翻译"
+msgstr "西班牙文翻译"
#. Tag: orgname
-#: Author_Group.xml:31 Author_Group.xml:39 Author_Group.xml:47
+#: Author_Group.xml:31
+#: Author_Group.xml:39
+#: Author_Group.xml:47
#, no-c-format
msgid "Red Hat Middleware LLC"
msgstr "红帽中间件有限责任公司"
@@ -85,7 +80,7 @@
#: Author_Group.xml:37
#, no-c-format
msgid "Korean Translation"
-msgstr "韩国语翻译"
+msgstr "韩文翻译"
#. Tag: othercredit
#: Author_Group.xml:42
@@ -107,18 +102,19 @@
#. Tag: othercredit
#: Author_Group.xml:55
-#, fuzzy, no-c-format
+#, no-c-format
msgid "<firstname>Sean</firstname> <surname>Wu</surname>"
-msgstr "<firstname>Pete</firstname> <surname>Muir</surname>"
+msgstr "<firstname>Sean</firstname> <surname>Wu</surname>"
#. Tag: contrib
#: Author_Group.xml:58
-#, fuzzy, no-c-format
+#, no-c-format
msgid "Simplified Chinese Translation"
-msgstr "繁体中文翻译"
+msgstr "简体中文翻译"
#. Tag: orgname
#: Author_Group.xml:60
#, no-c-format
msgid "Kava Community"
-msgstr ""
+msgstr "Kava社区"
+
Modified: doc/trunk/reference/zh-CN/master.po
===================================================================
--- doc/trunk/reference/zh-CN/master.po 2009-03-26 21:29:53 UTC (rev 2220)
+++ doc/trunk/reference/zh-CN/master.po 2009-03-27 05:56:12 UTC (rev 2221)
@@ -6,7 +6,7 @@
"Project-Id-Version: master.xml\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-03-17 20:14+0000\n"
-"PO-Revision-Date: 2009-03-13 14:08+0800\n"
+"PO-Revision-Date: 2009-03-27 13:37+0800\n"
"Last-Translator: Sean Wu <alartin(a)gmail.com>\n"
"Language-Team: none\n"
"MIME-Version: 1.0\n"
@@ -22,26 +22,14 @@
#. Tag: para
#: master.xml:11
#, no-c-format
-msgid ""
-"JSR-299 has recently changed its name from \"Web Beans\" to \"Java Contexts "
-"and Dependency Injection\". The reference guide still refers to JSR-299 as "
-"\"Web Beans\" and the JSR-299 Reference Implementation as the \"Web Beans RI"
-"\". Other documentation, blogs, forum posts etc. may use the new "
-"nomenclature, including the new name for the JSR-299 Reference "
-"Implementation - \"Web Beans\"."
-msgstr ""
-"JSR-299最近将名字从\"Web Beans\"改为\"Java上下文和依赖注入\"。参考指南仍然使"
-"用\"Web Beans\"名称,参考实现仍然使用\"Web Beans RI\"名称。其他的文档,博客,"
-"论坛帖子等等可能使用新的命名,包括新的JSR-299参考实现的名字- \"Web Beans\"。"
+msgid "JSR-299 has recently changed its name from \"Web Beans\" to \"Java Contexts and Dependency Injection\". The reference guide still refers to JSR-299 as \"Web Beans\" and the JSR-299 Reference Implementation as the \"Web Beans RI\". Other documentation, blogs, forum posts etc. may use the new nomenclature, including the new name for the JSR-299 Reference Implementation - \"Web Beans\"."
+msgstr "JSR-299最近将名字从\"Web Beans\"改为\"Java上下文和依赖注入\"。参考指南仍然使用\"Web Beans\"名称,参考实现仍然使用\"Web Beans RI\"名称。其他的文档,博客,论坛帖子等等可能使用新的命名,包括新的JSR-299参考实现的名字- \"Web Beans\"。"
#. Tag: para
#: master.xml:20
#, no-c-format
-msgid ""
-"You'll also find that some of the more recent functionality to be specified "
-"is missing (such as producer fields, realization, asynchronous events, XML "
-"mapping of EE resources)."
-msgstr ""
+msgid "You'll also find that some of the more recent functionality to be specified is missing (such as producer fields, realization, asynchronous events, XML mapping of EE resources)."
+msgstr "你也将发现一些指定的最近的一些功能缺失了(例如生产者域,实现(realization),异步事件,Java EE资源的XML映射)"
#. Tag: title
#: master.xml:30
@@ -66,3 +54,4 @@
#, no-c-format
msgid "Web Beans and the Java EE ecosystem"
msgstr "Web Beans和Java EE生态系统"
+
Modified: doc/trunk/reference/zh-CN/ri-spi.po
===================================================================
--- doc/trunk/reference/zh-CN/ri-spi.po 2009-03-26 21:29:53 UTC (rev 2220)
+++ doc/trunk/reference/zh-CN/ri-spi.po 2009-03-27 05:56:12 UTC (rev 2221)
@@ -6,7 +6,7 @@
"Project-Id-Version: master.xml\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-03-17 20:14+0000\n"
-"PO-Revision-Date: 2009-03-13 15:35+0800\n"
+"PO-Revision-Date: 2009-03-27 13:50+0800\n"
"Last-Translator: Sean Wu <alartin(a)gmail.com>\n"
"Language-Team: none\n"
"MIME-Version: 1.0\n"
@@ -22,29 +22,14 @@
#. Tag: para
#: ri-spi.xml:6
#, no-c-format
-msgid ""
-"Currently the Web Beans RI only runs in JBoss AS 5; integrating the RI into "
-"other EE environments (for example another application server like "
-"Glassfish), into a servlet container (like Tomcat), or with an Embedded "
-"EJB3.1 implementation is fairly easy. In this Appendix we will briefly "
-"discuss the steps needed."
-msgstr ""
-"目前,Web Bean的参考实现只能运行在JBoss AS5中;将参考实现整合到其他EE环境中"
-"(例如像Glassfish的其他的应用服务器)以及一个Servlet容器(像Tomcat)中或者一"
-"个内嵌的EJB3.1实现中相当容易。在附录中我们将简要的讨论所需的步骤。"
+msgid "Currently the Web Beans RI only runs in JBoss AS 5; integrating the RI into other EE environments (for example another application server like Glassfish), into a servlet container (like Tomcat), or with an Embedded EJB3.1 implementation is fairly easy. In this Appendix we will briefly discuss the steps needed."
+msgstr "目前,Web Bean的参考实现只能运行在JBoss AS5中;将参考实现整合到其他EE环境中(例如像Glassfish的其他的应用服务器)以及一个Servlet容器(像Tomcat)中或者一个内嵌的EJB3.1实现中相当容易。在附录中我们将简要的讨论所需的步骤。"
#. Tag: para
#: ri-spi.xml:15
#, no-c-format
-msgid ""
-"It should be possible to run Web Beans in an SE environment, but you'll to "
-"do more work, adding your own contexts and lifecycle. The Web Beans RI "
-"currently doesn't expose lifecycle extension points, so you would have to "
-"code directly against Web Beans RI classes."
-msgstr ""
-"Web Bean可以在SE环境中运行,但是你需要做更多的工作,添加你自己的上下文和生命"
-"周期。Web Bean参考实现目前没有暴露生命周期扩展点,所以你不得不直接编写Web "
-"Bean参考实现的类。"
+msgid "It should be possible to run Web Beans in an SE environment, but you'll to do more work, adding your own contexts and lifecycle. The Web Beans RI currently doesn't expose lifecycle extension points, so you would have to code directly against Web Beans RI classes."
+msgstr "Web Bean可以在SE环境中运行,但是你需要做更多的工作,添加你自己的上下文和生命周期。Web Bean参考实现目前没有暴露生命周期扩展点,所以你不得不直接编写Web Bean参考实现的类。"
#. Tag: title
#: ri-spi.xml:24
@@ -54,24 +39,15 @@
#. Tag: para
#: ri-spi.xml:26
-#, fuzzy, no-c-format
-msgid ""
-"The Web Beans SPI is located in <literal>webbeans-ri-spi</literal> module, "
-"and packaged as <literal>webbeans-ri-spi.jar</literal>. Some SPIs are "
-"optional, if you need to override the default behavior, others are required."
-msgstr ""
-"Web Bean的SPI位于<literal>webbeans-ri-spi</literal>模块中,打包为"
-"<literal>webbeans-ri-spi.jar</literal>。"
+#, no-c-format
+msgid "The Web Beans SPI is located in <literal>webbeans-ri-spi</literal> module, and packaged as <literal>webbeans-ri-spi.jar</literal>. Some SPIs are optional, if you need to override the default behavior, others are required."
+msgstr "Web Bean的SPI位于<literal>webbeans-ri-spi</literal>模块中,打包为<literal>webbeans-ri-spi.jar</literal>。一些SPI是可选的,如果你需要覆盖默认行为,你需要其他的SPI。"
#. Tag: para
#: ri-spi.xml:33
#, no-c-format
-msgid ""
-"All interfaces in the SPI support the decorator pattern and provide a "
-"<literal>Forwarding</literal> class."
-msgstr ""
-"所有的SPI接口都支持装饰器模式,并且提供一个 <literal>Forwarding</literal> "
-"类。"
+msgid "All interfaces in the SPI support the decorator pattern and provide a <literal>Forwarding</literal> class."
+msgstr "所有的SPI接口都支持装饰器模式,并且提供一个 <literal>Forwarding</literal> 类。"
#. Tag: title
#: ri-spi.xml:39
@@ -81,12 +57,11 @@
#. Tag: programlisting
#: ri-spi.xml:41
-#, fuzzy, no-c-format
+#, no-c-format
msgid ""
"<![CDATA[public interface WebBeanDiscovery {\n"
" /**\n"
-" * Gets list of all classes in classpath archives with web-beans.xml "
-"files\n"
+" * Gets list of all classes in classpath archives with web-beans.xml files\n"
" * \n"
" * @return An iterable over the classes \n"
" */\n"
@@ -103,8 +78,7 @@
msgstr ""
"<![CDATA[public interface WebBeanDiscovery {\n"
" /**\n"
-" * Gets list of all classes in classpath archives with web-beans.xml "
-"files\n"
+" * Gets list of all classes in classpath archives with web-beans.xml files\n"
" * \n"
" * @return An iterable over the classes \n"
" */\n"
@@ -117,25 +91,13 @@
" */\n"
" public Iterable<URL> discoverWebBeansXml();\n"
" \n"
-" /**\n"
-" * Gets a descriptor for each EJB in the application\n"
-" * \n"
-" * @return The bean class to descriptor map \n"
-" */\n"
-" public Iterable<EjbDescriptor<?>> discoverEjbs();\n"
-" \n"
"}]]>"
#. Tag: para
#: ri-spi.xml:43
#, no-c-format
-msgid ""
-"The discovery of Web Bean classes and <literal>web-bean.xml</literal> files "
-"is self-explanatory (the algorithm is described in Section 11.1 of the JSR-"
-"299 specification, and isn't repeated here)."
-msgstr ""
-"Web Bean类的发现和 <literal>web-bean.xml</literal> 配置文件的都是自解释性的"
-"(算法在JSR-299规范中已经描述了,这里就不再重复)"
+msgid "The discovery of Web Bean classes and <literal>web-bean.xml</literal> files is self-explanatory (the algorithm is described in Section 11.1 of the JSR-299 specification, and isn't repeated here)."
+msgstr "Web Bean类的发现和 <literal>web-bean.xml</literal> 配置文件的都是自解释性的(算法在JSR-299规范中已经描述了,这里就不再重复)"
#. Tag: title
#: ri-spi.xml:52
@@ -146,15 +108,8 @@
#. Tag: para
#: ri-spi.xml:54
#, no-c-format
-msgid ""
-"The Web Beans RI also delegates EJB3 bean discovery to the container so that "
-"it doesn't have to scan for EJB3 annotations or parse <literal>ejb-jar.xml</"
-"literal>. For each EJB in the application an EJBDescriptor should be "
-"discovered:"
-msgstr ""
-"Web Bean参考实现也将EJB3 Bean的发现委托给容器,以便它不用再扫描EJB3注释和解"
-"析 <literal>ejb-jar.xml</literal> 文件。对于应用中的每个EJB都应发现一个"
-"EJBDescriptor:"
+msgid "The Web Beans RI also delegates EJB3 bean discovery to the container so that it doesn't have to scan for EJB3 annotations or parse <literal>ejb-jar.xml</literal>. For each EJB in the application an EJBDescriptor should be discovered:"
+msgstr "Web Bean参考实现也将EJB3 Bean的发现委托给容器,以便它不用再扫描EJB3注释和解析 <literal>ejb-jar.xml</literal> 文件。对于应用中的每个EJB都应发现一个EJBDescriptor:"
#. Tag: programlisting
#: ri-spi.xml:61
@@ -204,16 +159,14 @@
" * \n"
" * @return An iterator over the local business interfaces\n"
" */\n"
-" public Iterable<BusinessInterfaceDescriptor<?>> getLocalBusinessInterfaces"
-"();\n"
+" public Iterable<BusinessInterfaceDescriptor<?>> getLocalBusinessInterfaces();\n"
" \n"
" /**\n"
" * Gets the remote business interfaces of the EJB\n"
" * \n"
" * @return An iterator over the remote business interfaces\n"
" */\n"
-" public Iterable<BusinessInterfaceDescriptor<?>> "
-"getRemoteBusinessInterfaces();\n"
+" public Iterable<BusinessInterfaceDescriptor<?>> getRemoteBusinessInterfaces();\n"
" \n"
" /**\n"
" * Get the remove methods of the EJB\n"
@@ -274,16 +227,14 @@
" * \n"
" * @return An iterator over the local business interfaces\n"
" */\n"
-" public Iterable<BusinessInterfaceDescriptor<?>> getLocalBusinessInterfaces"
-"();\n"
+" public Iterable<BusinessInterfaceDescriptor<?>> getLocalBusinessInterfaces();\n"
" \n"
" /**\n"
" * Gets the remote business interfaces of the EJB\n"
" * \n"
" * @return An iterator over the remote business interfaces\n"
" */\n"
-" public Iterable<BusinessInterfaceDescriptor<?>> "
-"getRemoteBusinessInterfaces();\n"
+" public Iterable<BusinessInterfaceDescriptor<?>> getRemoteBusinessInterfaces();\n"
" \n"
" /**\n"
" * Get the remove methods of the EJB\n"
@@ -333,61 +284,32 @@
#. Tag: para
#: ri-spi.xml:65
#, no-c-format
-msgid ""
-"The <literal>EjbDescriptor</literal> is fairly self-explanatory, and should "
-"return the relevant metadata as defined in the EJB specification. In "
-"addition to these two interfaces, there is "
-"<literal>BusinessInterfaceDescriptor</literal> which represents a local "
-"business interface (encapsulating the interface class and jndi name used to "
-"look up an instance of the EJB)."
-msgstr ""
-" <literal>EjbDescriptor</literal> 具有相当的自解释性,应该返回EJB规范中定义的"
-"相关元数据。除了这两个接口,还有一个表示本地业务接口的 "
-"<literal>BusinessInterfaceDescriptor</literal> (封装了接口类和用于查询EJB实"
-"例的jndi名字)"
+msgid "The <literal>EjbDescriptor</literal> is fairly self-explanatory, and should return the relevant metadata as defined in the EJB specification. In addition to these two interfaces, there is <literal>BusinessInterfaceDescriptor</literal> which represents a local business interface (encapsulating the interface class and jndi name used to look up an instance of the EJB)."
+msgstr " <literal>EjbDescriptor</literal> 具有相当的自解释性,应该返回EJB规范中定义的相关元数据。除了这两个接口,还有一个表示本地业务接口的 <literal>BusinessInterfaceDescriptor</literal> (封装了接口类和用于查询EJB实例的jndi名字)"
#. Tag: title
#: ri-spi.xml:77
#, no-c-format
-msgid ""
-"<literal>@EJB</literal>, <literal>@PersistenceContext</literal> and "
-"<literal>@Resource</literal> resolution"
-msgstr ""
-"<literal>@EJB</literal>, <literal>@PersistenceContext</literal> 和 "
-"<literal>@Resource</literal> 的解析"
+msgid "<literal>@EJB</literal>, <literal>@PersistenceContext</literal> and <literal>@Resource</literal> resolution"
+msgstr "<literal>@EJB</literal>, <literal>@PersistenceContext</literal> 和 <literal>@Resource</literal> 的解析"
#. Tag: para
#: ri-spi.xml:79
#, no-c-format
-msgid ""
-"The resolution of <literal>@EJB</literal>, <literal>@PersistenceContext</"
-"literal> and <literal>@Resource</literal> is delegated to the container. You "
-"must provide an implementation of <literal>org.jboss.webbeans.ejb.spi."
-"EjbResolver</literal> which provides these operations. Web Beans passes in "
-"the <literal>javax.inject.manager.InjectionPoint</literal> the resolution is "
-"for, as well as the <literal>NamingContext</literal> in use for each "
-"resolution request."
-msgstr ""
-"<literal>@EJB</literal>, <literal>@PersistenceContext</literal> 和 "
-"<literal>@Resource</literal> 的解析被委托给容器。你必须提供一个 <literal>org."
-"jboss.webbeans.ejb.spi.EjbResolver</literal> 实现来完成这些工作。每次解析请求"
-"到来时,Web Beans都将 <literal>javax.inject.manager.InjectionPoint</literal> "
-"以及 <literal>NamingContext</literal> 传递进来以便解析。"
+msgid "The resolution of <literal>@EJB</literal>, <literal>@PersistenceContext</literal> and <literal>@Resource</literal> is delegated to the container. You must provide an implementation of <literal>org.jboss.webbeans.ejb.spi.EjbResolver</literal> which provides these operations. Web Beans passes in the <literal>javax.inject.manager.InjectionPoint</literal> the resolution is for, as well as the <literal>NamingContext</literal> in use for each resolution request."
+msgstr "<literal>@EJB</literal>, <literal>@PersistenceContext</literal> 和 <literal>@Resource</literal> 的解析被委托给容器。你必须提供一个 <literal>org.jboss.webbeans.ejb.spi.EjbResolver</literal> 实现来完成这些工作。每次解析请求到来时,Web Beans都将 <literal>javax.inject.manager.InjectionPoint</literal> 以及 <literal>NamingContext</literal> 传递进来以便解析。"
#. Tag: title
#: ri-spi.xml:104
#, no-c-format
msgid "Transaction Services"
-msgstr ""
+msgstr "事务服务"
#. Tag: para
#: ri-spi.xml:106
#, no-c-format
-msgid ""
-"The Web Beans RI must delegate JTA activities to the container. The SPI "
-"provides a couple hooks to easily achieve this with the "
-"<literal>TransactionServices</literal> interface."
-msgstr ""
+msgid "The Web Beans RI must delegate JTA activities to the container. The SPI provides a couple hooks to easily achieve this with the <literal>TransactionServices</literal> interface."
+msgstr "Web Bean RI必须将JTA活动委托给容器。SPI提供者提供一些钩子(hooks)结合<literal>TransactionServices</literal> 接口来轻松完成这个任务。"
#. Tag: programlisting
#: ri-spi.xml:112
@@ -411,12 +333,10 @@
" * @see javax.transaction.Synchronization\n"
" * @param synchronizedObserver\n"
" */\n"
-" public void registerSynchronization(Synchronization "
-"synchronizedObserver);\n"
+" public void registerSynchronization(Synchronization synchronizedObserver);\n"
"\n"
" /**\n"
-" * Queries the status of the current execution to see if a transaction "
-"is\n"
+" * Queries the status of the current execution to see if a transaction is\n"
" * currently active.\n"
" * \n"
" * @return true if a transaction is active\n"
@@ -424,36 +344,52 @@
" public boolean isTransactionActive();\n"
"}]]>"
msgstr ""
+"<![CDATA[public interface TransactionServices\n"
+"{\n"
+" /**\n"
+" * Possible status conditions for a transaction. This can be used by SPI\n"
+" * providers to keep track for which status an observer is used.\n"
+" */\n"
+" public static enum Status\n"
+" {\n"
+" ALL, SUCCESS, FAILURE\n"
+" }\n"
+"\n"
+" /**\n"
+" * Registers a synchronization object with the currently executing\n"
+" * transaction.\n"
+" * \n"
+" * @see javax.transaction.Synchronization\n"
+" * @param synchronizedObserver\n"
+" */\n"
+" public void registerSynchronization(Synchronization synchronizedObserver);\n"
+"\n"
+" /**\n"
+" * Queries the status of the current execution to see if a transaction is\n"
+" * currently active.\n"
+" * \n"
+" * @return true if a transaction is active\n"
+" */\n"
+" public boolean isTransactionActive();\n"
+"}]]>"
#. Tag: para
#: ri-spi.xml:114
#, no-c-format
-msgid ""
-"The enumeration <literal>Status</literal> is a convenience for implementors "
-"to be able to keep track of whether a synchronization is supposed to notify "
-"an observer only when the transaction is successful, or after a failure, or "
-"regardless of the status of the transaction."
-msgstr ""
+msgid "The enumeration <literal>Status</literal> is a convenience for implementors to be able to keep track of whether a synchronization is supposed to notify an observer only when the transaction is successful, or after a failure, or regardless of the status of the transaction."
+msgstr "枚举 <literal>Status</literal> 对实现者来说是一个很方便的工具,可以追踪在事务成功或者失败或者无论事务成功还是失败的情况下,是否应该将一个同步通知给观察者。"
#. Tag: para
#: ri-spi.xml:121
#, no-c-format
-msgid ""
-"Any <literal>javax.transaction.Synchronization</literal> implementation may "
-"be passed to the <literal>registerSynchronization()</literal> method and the "
-"SPI implementation should immediately register the synchronization with the "
-"JTA transaction manager used for the EJBs."
-msgstr ""
+msgid "Any <literal>javax.transaction.Synchronization</literal> implementation may be passed to the <literal>registerSynchronization()</literal> method and the SPI implementation should immediately register the synchronization with the JTA transaction manager used for the EJBs."
+msgstr "任何 <literal>javax.transaction.Synchronization</literal> 实现必须传递给 <literal>registerSynchronization()</literal> 方法,SPI实现应该立刻将同步注册到EJB使用的JTA事务管理器。"
#. Tag: para
#: ri-spi.xml:128
#, no-c-format
-msgid ""
-"To make it easier to determine whether or not a transaction is currently "
-"active for the requesting thread, the <literal>isTransactionActive()</"
-"literal> method can be used. The SPI implementation should query the same "
-"JTA transaction manager used for the EJBs."
-msgstr ""
+msgid "To make it easier to determine whether or not a transaction is currently active for the requesting thread, the <literal>isTransactionActive()</literal> method can be used. The SPI implementation should query the same JTA transaction manager used for the EJBs."
+msgstr "为了更容易的决定对于请求线程来说一个事务在当前是否是活动的,我们可以使用<literal>isTransactionActive()</literal> 方法。SPI实现应该查询EJB使用的同一个JTA事务管理器。"
#. Tag: title
#: ri-spi.xml:137
@@ -464,17 +400,8 @@
#. Tag: para
#: ri-spi.xml:139
#, no-c-format
-msgid ""
-"Web Beans expects the Application Server or other container to provide the "
-"storage for each application's context. The <literal>org.jboss.webbeans."
-"context.api.BeanStore</literal> should be implemented to provide an "
-"application scoped storage. You may find <literal>org.jboss.webbeans.context."
-"api.helpers.ConcurrentHashMapBeanStore</literal> useful."
-msgstr ""
-"Web Bean期望应用服务器或者其他容器能够提供每个应用上下文的存储。<literal>org."
-"jboss.webbeans.context.api.BeanStore</literal> 应该被实现以便提供一个应用范围"
-"的存储。你也许会发现 <literal>org.jboss.webbeans.context.api.helpers."
-"ConcurrentHashMapBeanStore</literal> 非常有用。"
+msgid "Web Beans expects the Application Server or other container to provide the storage for each application's context. The <literal>org.jboss.webbeans.context.api.BeanStore</literal> should be implemented to provide an application scoped storage. You may find <literal>org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore</literal> useful."
+msgstr "Web Bean期望应用服务器或者其他容器能够提供每个应用上下文的存储。<literal>org.jboss.webbeans.context.api.BeanStore</literal> 应该被实现以便提供一个应用范围的存储。你也许会发现 <literal>org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore</literal> 非常有用。"
#. Tag: title
#: ri-spi.xml:152
@@ -485,83 +412,38 @@
#. Tag: para
#: ri-spi.xml:153
#, no-c-format
-msgid ""
-"The <literal>org.jboss.webbeans.bootstrap.api.Bootstrap</literal> interface "
-"defines the bootstrap for Web Beans. To boot Web Beans, you must obtain an "
-"instance of <literal>org.jboss.webbeans.bootstrap.WebBeansBootstrap</"
-"literal> (which implements <literal>Boostrap</literal>), tell it about the "
-"SPIs in use, and then request the container start."
-msgstr ""
-" <literal>org.jboss.webbeans.bootstrap.api.Bootstrap</literal> 接口定义了Web "
-"Bean的自举机制。为了启动Web Beans,你必须获得一个<literal>org.jboss.webbeans."
-"bootstrap.WebBeansBootstrap</literal> 实例(它实现了<literal>Boostrap</"
-"literal>) ,告诉它使用的SPI,然后请求容器启动。 "
+msgid "The <literal>org.jboss.webbeans.bootstrap.api.Bootstrap</literal> interface defines the bootstrap for Web Beans. To boot Web Beans, you must obtain an instance of <literal>org.jboss.webbeans.bootstrap.WebBeansBootstrap</literal> (which implements <literal>Boostrap</literal>), tell it about the SPIs in use, and then request the container start."
+msgstr " <literal>org.jboss.webbeans.bootstrap.api.Bootstrap</literal> 接口定义了Web Bean的自举机制。为了启动Web Beans,你必须获得一个<literal>org.jboss.webbeans.bootstrap.WebBeansBootstrap</literal> 实例(它实现了<literal>Boostrap</literal>) ,告诉它使用的SPI,然后请求容器启动。 "
#. Tag: para
#: ri-spi.xml:162
#, no-c-format
-msgid ""
-"The bootstrap is split into phases, bootstrap initialization and bootstrap. "
-"Initialization will create a manager, and add the standard (specification "
-"defined) contexts. Bootstrap will discover EJBs, classes and XML; add beans "
-"defined using annotations; add beans defined using XML; and validate all "
-"beans."
-msgstr ""
-"自举可以划分为阶段,自举初始化和自举。初始化将创建一个管理器,添加标准(规范"
-"定义的)的上下文。自举将发现EJB,类和XML;添加注释定义的Bean;添加XML定义的"
-"Bean;和验证所有的Bean。"
+msgid "The bootstrap is split into phases, bootstrap initialization and bootstrap. Initialization will create a manager, and add the standard (specification defined) contexts. Bootstrap will discover EJBs, classes and XML; add beans defined using annotations; add beans defined using XML; and validate all beans."
+msgstr "自举可以划分为阶段,自举初始化和自举。初始化将创建一个管理器,添加标准(规范定义的)的上下文。自举将发现EJB,类和XML;添加注释定义的Bean;添加XML定义的Bean;和验证所有的Bean。"
#. Tag: para
#: ri-spi.xml:170
#, no-c-format
-msgid ""
-"To initialize the bootstrap you call <literal>Bootstrap.initialize()</"
-"literal>. Before calling <literal>initialize()</literal> you must have "
-"called <literal>Bootstrap.setEjbResolver()</literal>. If you are not using "
-"the built in <literal>DefaultNamingContext</literal> or the built in "
-"<literal>DefaultResourceLoader</literal> you must set these before calling "
-"<literal>initialize()</literal>."
-msgstr ""
-"为了初始化自举,你需要调用 <literal>Bootstrap.initialize()</literal> 。在调"
-"用 <literal>initialize()</literal> 之前你必须调用 <literal>Bootstrap."
-"setEjbResolver()</literal> 。如果你没有使用内置的"
-"<literal>DefaultNamingContext</literal>或者<literal>DefaultResourceLoader</"
-"literal>,你必须在调用<literal>initialize()</literal>之前设置它们。"
+msgid "To initialize the bootstrap you call <literal>Bootstrap.initialize()</literal>. Before calling <literal>initialize()</literal> you must have called <literal>Bootstrap.setEjbResolver()</literal>. If you are not using the built in <literal>DefaultNamingContext</literal> or the built in <literal>DefaultResourceLoader</literal> you must set these before calling <literal>initialize()</literal>."
+msgstr "为了初始化自举,你需要调用 <literal>Bootstrap.initialize()</literal> 。在调用 <literal>initialize()</literal> 之前你必须调用 <literal>Bootstrap.setEjbResolver()</literal> 。如果你没有使用内置的<literal>DefaultNamingContext</literal>或者<literal>DefaultResourceLoader</literal>,你必须在调用<literal>initialize()</literal>之前设置它们。"
#. Tag: para
#: ri-spi.xml:180
#, no-c-format
-msgid ""
-"Having called <literal>initialize()</literal>, the <literal>Manager</"
-"literal> can be obtained by calling <literal>Bootstrap.getManager()</"
-"literal>."
-msgstr ""
-"调用<literal>initialize()</literal>后,我们能够通过<literal>Bootstrap."
-"getManager()</literal>来获得<literal>管理器</literal>。"
+msgid "Having called <literal>initialize()</literal>, the <literal>Manager</literal> can be obtained by calling <literal>Bootstrap.getManager()</literal>."
+msgstr "调用<literal>initialize()</literal>后,我们能够通过<literal>Bootstrap.getManager()</literal>来获得<literal>管理器</literal>。"
#. Tag: para
#: ri-spi.xml:186
#, no-c-format
-msgid ""
-"To boot the container you call <literal>Bootstrap.boot()</literal>. Before "
-"calling <literal>boot()</literal> you must have called <literal>Bootstrap."
-"setWebBeanDiscovery()</literal>, <literal>Bootstrap.setEjbDiscovery()</"
-"literal> and <literal>Bootstrap.setApplicationContext()</literal>."
-msgstr ""
-"启动容器你需要调用 <literal>Bootstrap.boot()</literal> 。在调用<literal>boot"
-"()</literal>之前,你必须调用<literal>Bootstrap.setWebBeanDiscovery()</"
-"literal>, <literal>Bootstrap.setEjbDiscovery()</literal> 和 "
-"<literal>Bootstrap.setApplicationContext()</literal>。"
+msgid "To boot the container you call <literal>Bootstrap.boot()</literal>. Before calling <literal>boot()</literal> you must have called <literal>Bootstrap.setWebBeanDiscovery()</literal>, <literal>Bootstrap.setEjbDiscovery()</literal> and <literal>Bootstrap.setApplicationContext()</literal>."
+msgstr "启动容器你需要调用 <literal>Bootstrap.boot()</literal> 。在调用<literal>boot()</literal>之前,你必须调用<literal>Bootstrap.setWebBeanDiscovery()</literal>, <literal>Bootstrap.setEjbDiscovery()</literal> 和 <literal>Bootstrap.setApplicationContext()</literal>。"
#. Tag: para
#: ri-spi.xml:194
#, no-c-format
-msgid ""
-"To shutdown the container you call <literal>Bootstrap.shutdown()</literal>. "
-"This allows the container to perform any cleanup operations needed."
-msgstr ""
-"要关闭容器,你需要调用 <literal>Bootstrap.shutdown()</literal>。这将让容器执"
-"行一些必要的清洁工作。"
+msgid "To shutdown the container you call <literal>Bootstrap.shutdown()</literal>. This allows the container to perform any cleanup operations needed."
+msgstr "要关闭容器,你需要调用 <literal>Bootstrap.shutdown()</literal>。这将让容器执行一些必要的清洁工作。"
#. Tag: title
#: ri-spi.xml:203
@@ -572,15 +454,8 @@
#. Tag: para
#: ri-spi.xml:205
#, no-c-format
-msgid ""
-"The Web Beans RI implements JNDI binding and lookup according to standards, "
-"however you may want to alter the binding and lookup (for example in an "
-"environment where JNDI isn't available). To do this, implement <literal>org."
-"jboss.webbeans.resources.spi.NamingContext</literal>:"
-msgstr ""
-" Web Beans 参考实现实现了JNDI 的绑定和根据标准来查询,然而你可能想要改变这些"
-"绑定和查询(例如在一个没有JNDI的环境中)。你可以通过实现 <literal>org.jboss."
-"webbeans.resources.spi.NamingContext</literal>来完成这个工作:"
+msgid "The Web Beans RI implements JNDI binding and lookup according to standards, however you may want to alter the binding and lookup (for example in an environment where JNDI isn't available). To do this, implement <literal>org.jboss.webbeans.resources.spi.NamingContext</literal>:"
+msgstr " Web Beans 参考实现实现了JNDI 的绑定和根据标准来查询,然而你可能想要改变这些绑定和查询(例如在一个没有JNDI的环境中)。你可以通过实现 <literal>org.jboss.webbeans.resources.spi.NamingContext</literal>来完成这个工作:"
#. Tag: programlisting
#: ri-spi.xml:213
@@ -639,16 +514,8 @@
#. Tag: para
#: ri-spi.xml:220
#, no-c-format
-msgid ""
-"The Web Beans RI needs to load classes and resources from the classpath at "
-"various times. By default, they are loaded from the same classloader that "
-"was used to load the RI, however this may not be correct for some "
-"environments. If this is case, you can implement <literal>org.jboss.webbeans."
-"spi.ResourceLoader</literal>:"
-msgstr ""
-"Web Beans参考实现需要在不同时间从类路径上加载类和资源。默认情况下,它们使用加"
-"载参考实现的类加载器加载,但是这在一些环境中可能是不适合的。如果出现这种情况"
-"的话,你可以实现<literal>org.jboss.webbeans.spi.ResourceLoader</literal> :"
+msgid "The Web Beans RI needs to load classes and resources from the classpath at various times. By default, they are loaded from the same classloader that was used to load the RI, however this may not be correct for some environments. If this is case, you can implement <literal>org.jboss.webbeans.spi.ResourceLoader</literal>:"
+msgstr "Web Beans参考实现需要在不同时间从类路径上加载类和资源。默认情况下,它们使用加载参考实现的类加载器加载,但是这在一些环境中可能是不适合的。如果出现这种情况的话,你可以实现<literal>org.jboss.webbeans.spi.ResourceLoader</literal> :"
#. Tag: programlisting
#: ri-spi.xml:228
@@ -723,35 +590,20 @@
#. Tag: para
#: ri-spi.xml:235
#, no-c-format
-msgid ""
-"Java EE / Servlet does not provide any hooks which can be used to provide "
-"injection into Servlets, so Web Beans provides an API to allow the container "
-"to request JSR-299 injection for a Servlet."
-msgstr ""
-"Java EE/Servlet并不没有提供任何钩子来支持向Servlet注入,所以Web Bean提供了一"
-"个接口来允许容器为一个Servlet请求JSR-299的注入。"
+msgid "Java EE / Servlet does not provide any hooks which can be used to provide injection into Servlets, so Web Beans provides an API to allow the container to request JSR-299 injection for a Servlet."
+msgstr "Java EE/Servlet并不没有提供任何钩子来支持向Servlet注入,所以Web Bean提供了一个接口来允许容器为一个Servlet请求JSR-299的注入。"
#. Tag: para
#: ri-spi.xml:241
#, no-c-format
-msgid ""
-"To be compliant with JSR-299, the container should request servlet injection "
-"for each newly instantiated servlet after the constructor returns and before "
-"the servlet is placed into service."
-msgstr ""
-"为了和JSR-299兼容,容器应该在构造器返回之后,在Servlet被放到服务中之前,为每"
-"个新实例化的Servlet请求Servlet注入。"
+msgid "To be compliant with JSR-299, the container should request servlet injection for each newly instantiated servlet after the constructor returns and before the servlet is placed into service."
+msgstr "为了和JSR-299兼容,容器应该在构造器返回之后,在Servlet被放到服务中之前,为每个新实例化的Servlet请求Servlet注入。"
#. Tag: para
#: ri-spi.xml:247
#, no-c-format
-msgid ""
-"To perform injection on a servlet call <literal>WebBeansManager.injectServlet"
-"()</literal>. The manager can be obtained from <literal>Bootstrap.getManager"
-"()</literal>."
-msgstr ""
-"执行Servlet注入时需要调用 <literal>WebBeansManager.injectServlet()</"
-"literal>。你可以通过 <literal>Bootstrap.getManager()</literal>来获得管理器。"
+msgid "To perform injection on a servlet call <literal>WebBeansManager.injectServlet()</literal>. The manager can be obtained from <literal>Bootstrap.getManager()</literal>."
+msgstr "执行Servlet注入时需要调用 <literal>WebBeansManager.injectServlet()</literal>。你可以通过 <literal>Bootstrap.getManager()</literal>来获得管理器。"
#. Tag: title
#: ri-spi.xml:258
@@ -762,9 +614,7 @@
#. Tag: para
#: ri-spi.xml:260
#, no-c-format
-msgid ""
-"There are a number of requirements that the Web Beans RI places on the "
-"container for correct functioning that fall outside implementation of APIs"
+msgid "There are a number of requirements that the Web Beans RI places on the container for correct functioning that fall outside implementation of APIs"
msgstr "为了接口实现之外的正确的功能,Web Beans参考实现对容器有大量的要求。"
#. Tag: term
@@ -776,14 +626,8 @@
#. Tag: para
#: ri-spi.xml:272
#, no-c-format
-msgid ""
-"If you are integrating the Web Beans RI into an environment that supports "
-"deployment of multiple applications, you must enable, automatically, or "
-"through user configuation, classloader isolation for each Web Beans "
-"application."
-msgstr ""
-"如果你将一个Web Bean参考实现整合到一个支持多应用部署的环境中,你需要以用户配"
-"置或者自动化方式为每个Web Bean应用激活类加载器隔离。"
+msgid "If you are integrating the Web Beans RI into an environment that supports deployment of multiple applications, you must enable, automatically, or through user configuation, classloader isolation for each Web Beans application."
+msgstr "如果你将一个Web Bean参考实现整合到一个支持多应用部署的环境中,你需要以用户配置或者自动化方式为每个Web Bean应用激活类加载器隔离。"
#. Tag: term
#: ri-spi.xml:281
@@ -794,30 +638,14 @@
#. Tag: para
#: ri-spi.xml:285
#, no-c-format
-msgid ""
-"If you are integrating the Web Beans into a Servlet environment you must "
-"register <literal>org.jboss.webbeans.servlet.WebBeansListener</literal> as a "
-"Servlet listener, either automatically, or through user configuration, for "
-"each Web Beans application which uses Servlet."
-msgstr ""
-"如果你将Web Bean整合到一个Servlet环境中,对每个使用Servlet的 Web Bean应用,你"
-"需要以用户配置或者自动化形式将 <literal>org.jboss.webbeans.servlet."
-"WebBeansListener</literal> 注册为一个Servlet监听器。"
+msgid "If you are integrating the Web Beans into a Servlet environment you must register <literal>org.jboss.webbeans.servlet.WebBeansListener</literal> as a Servlet listener, either automatically, or through user configuration, for each Web Beans application which uses Servlet."
+msgstr "如果你将Web Bean整合到一个Servlet环境中,对每个使用Servlet的 Web Bean应用,你需要以用户配置或者自动化形式将 <literal>org.jboss.webbeans.servlet.WebBeansListener</literal> 注册为一个Servlet监听器。"
#. Tag: para
#: ri-spi.xml:294
#, no-c-format
-msgid ""
-"If you are integrating the Web Beans into a JSF environment you must "
-"register <literal>org.jboss.webbeans.servlet.ConversationPropagationFilter</"
-"literal> as a Servlet listener, either automatically, or through user "
-"configuration, for each Web Beans application which uses JSF. This filter "
-"can be registered for all Servlet deployment safely."
-msgstr ""
-"如果你将Web Bean整合到一个JSF环境中,对每个使用JSF的 Web Bean应用,你需要以用"
-"户配置或者自动化形式将 <literal>org.jboss.webbeans.servlet."
-"ConversationPropagationFilter</literal> 注册为一个Servlet监听器。这个过滤器可"
-"以安全地向所有Servlet部署注册。"
+msgid "If you are integrating the Web Beans into a JSF environment you must register <literal>org.jboss.webbeans.servlet.ConversationPropagationFilter</literal> as a Servlet listener, either automatically, or through user configuration, for each Web Beans application which uses JSF. This filter can be registered for all Servlet deployment safely."
+msgstr "如果你将Web Bean整合到一个JSF环境中,对每个使用JSF的 Web Bean应用,你需要以用户配置或者自动化形式将 <literal>org.jboss.webbeans.servlet.ConversationPropagationFilter</literal> 注册为一个Servlet监听器。这个过滤器可以安全地向所有Servlet部署注册。"
#. Tag: term
#: ri-spi.xml:306
@@ -828,26 +656,14 @@
#. Tag: para
#: ri-spi.xml:310
#, no-c-format
-msgid ""
-"If you are integrating the Web Beans into an EJB environment you must "
-"register <literal>org.jboss.webbeans.ejb.SessionBeanInterceptor</literal> as "
-"a EJB interceptor for all EJBs in the application, either automatically, or "
-"through user configuration, for each Web Beans application which uses "
-"enterprise beans."
-msgstr ""
-"如果你将Web Beans整合到EJB环境中,对每个使用企业级Bean的Web Bean应用,你需要"
-"以用户配置或者自动化形式将 <literal>org.jboss.webbeans.ejb."
-"SessionBeanInterceptor</literal> 注册为应用中所有EJB的EJB拦截器。"
+msgid "If you are integrating the Web Beans into an EJB environment you must register <literal>org.jboss.webbeans.ejb.SessionBeanInterceptor</literal> as a EJB interceptor for all EJBs in the application, either automatically, or through user configuration, for each Web Beans application which uses enterprise beans."
+msgstr "如果你将Web Beans整合到EJB环境中,对每个使用企业级Bean的Web Bean应用,你需要以用户配置或者自动化形式将 <literal>org.jboss.webbeans.ejb.SessionBeanInterceptor</literal> 注册为应用中所有EJB的EJB拦截器。"
#. Tag: para
#: ri-spi.xml:320
#, no-c-format
-msgid ""
-"You must register the <literal>SessionBeanInterceptor</literal> as the inner "
-"most interceptor in the stack for all EJBs."
-msgstr ""
-"你必须为所有的EJB在栈中将<literal>SessionBeanInterceptor</literal> 注册为一个"
-"最内部的拦截器。"
+msgid "You must register the <literal>SessionBeanInterceptor</literal> as the inner most interceptor in the stack for all EJBs."
+msgstr "你必须为所有的EJB在栈中将<literal>SessionBeanInterceptor</literal> 注册为一个最内部的拦截器。"
#. Tag: term
#: ri-spi.xml:328
@@ -858,14 +674,9 @@
#. Tag: para
#: ri-spi.xml:332
#, no-c-format
-msgid ""
-"If you are integrating the Web Beans into an environment that supports "
-"deployment of applications, you must insert the <literal>webbeans-ri.jar</"
-"literal> into the applications isolated classloader. It cannot be loaded "
-"from a shared classloader."
-msgstr ""
-"如果你将Web Bean整合到一个支持应用部署的环境中,你必须将<literal>webbeans-ri."
-"jar</literal> 插入到应用隔离的类加载器中。它不能被一个共享的类加载器加载。"
+msgid "If you are integrating the Web Beans into an environment that supports deployment of applications, you must insert the <literal>webbeans-ri.jar</literal> into the applications isolated classloader. It cannot be loaded from a shared classloader."
+msgstr "如果你将Web Bean整合到一个支持应用部署的环境中,你必须将<literal>webbeans-ri.jar</literal> 插入到应用隔离的类加载器中。它不能被一个共享的类加载器加载。"
#~ msgid "Currently, the only SPI to implement is the bootstrap spi:"
#~ msgstr "目前,只有bootstrap SPI可以实现:"
+
Modified: doc/trunk/reference/zh-CN/ri.po
===================================================================
--- doc/trunk/reference/zh-CN/ri.po 2009-03-26 21:29:53 UTC (rev 2220)
+++ doc/trunk/reference/zh-CN/ri.po 2009-03-27 05:56:12 UTC (rev 2221)
@@ -6,7 +6,7 @@
"Project-Id-Version: master.xml\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-03-17 20:14+0000\n"
-"PO-Revision-Date: 2009-03-13 14:16+0800\n"
+"PO-Revision-Date: 2009-03-27 13:53+0800\n"
"Last-Translator: Sean Wu <alartin(a)gmail.com>\n"
"Language-Team: none\n"
"MIME-Version: 1.0\n"
@@ -22,28 +22,14 @@
#. Tag: para
#: ri.xml:6
#, no-c-format
-msgid ""
-"The Web Beans Reference Implementation is being developed at <ulink url="
-"\"http://seamframework.org/WebBeans\">the Seam project</ulink>. You can "
-"download the latest developer release of Web Beans from the <ulink url="
-"\"http://seamframework.org/Download\">the downloads page</ulink>."
-msgstr ""
-"Web Bean参考实现由<ulink url=\"http://seamframework.org/WebBeans\">Seam项目</"
-"ulink>开发。你可以从<ulink url=\"http://seamframework.org/Download\">the "
-"downloads page</ulink>下载最新的开发者版本。"
+msgid "The Web Beans Reference Implementation is being developed at <ulink url=\"http://seamframework.org/WebBeans\">the Seam project</ulink>. You can download the latest developer release of Web Beans from the <ulink url=\"http://seamframework.org/Download\">the downloads page</ulink>."
+msgstr "Web Bean参考实现由<ulink url=\"http://seamframework.org/WebBeans\">Seam项目</ulink>开发。你可以从<ulink url=\"http://seamframework.org/Download\">the downloads page</ulink>下载最新的开发者版本。"
#. Tag: para
#: ri.xml:13
-#, fuzzy, no-c-format
-msgid ""
-"The Web Beans RI comes with a two deployable example applications: "
-"<literal>webbeans-numberguess</literal>, a war example, containing only "
-"simple beans, and <literal>webbeans-translator</literal> an ear example, "
-"containing enterprise beans. To run the examples you'll need the following:"
-msgstr ""
-"Web Beans RI自带了两个例子:<literal>webbeans-numberguess</literal> (一个仅包"
-"含一个简单Bean的WAR应用例子)和<literal>webbeans-translator</literal> (一个包"
-"含企业Bean的EAR应用例子)。"
+#, no-c-format
+msgid "The Web Beans RI comes with a two deployable example applications: <literal>webbeans-numberguess</literal>, a war example, containing only simple beans, and <literal>webbeans-translator</literal> an ear example, containing enterprise beans. To run the examples you'll need the following:"
+msgstr "Web Beans RI自带了两个例子:<literal>webbeans-numberguess</literal> (一个仅包含一个简单Bean的WAR应用例子)和<literal>webbeans-translator</literal> (一个包含企业Bean的EAR应用例子)。为了运行例子,你需要:"
#. Tag: para
#: ri.xml:22
@@ -66,14 +52,8 @@
#. Tag: para
#: ri.xml:32
#, fuzzy, no-c-format
-msgid ""
-"Currently, the Web Beans RI only runs on JBoss Application Server 5. You'll "
-"need to download JBoss AS 5.0.1.GA from <ulink url=\"http://www.jboss.org/"
-"jbossas/downloads/\">jboss.org</ulink>, and unzip it. For example:"
-msgstr ""
-"当前,Web Beans参考实现只能运行在JBoss AS 5之上。你需要从<ulink url=\"http://"
-"www.jboss.org/jbossas/downloads/\">jboss.org</ulink>下载JBoss AS 5.0.0.GA, 然"
-"后解压。例如:"
+msgid "Currently, the Web Beans RI only runs on JBoss Application Server 5. You'll need to download JBoss AS 5.0.1.GA from <ulink url=\"http://www.jboss.org/jbossas/downloads/\">jboss.org</ulink>, and unzip it. For example:"
+msgstr "当前,Web Beans参考实现只能运行在JBoss AS 5之上。你需要从<ulink url=\"http://www.jboss.org/jbossas/downloads/\">jboss.org</ulink>下载JBoss AS 5.0.0.GA, 然后解压。例如:"
#. Tag: programlisting
#: ri.xml:39
@@ -88,12 +68,8 @@
#. Tag: para
#: ri.xml:41
#, fuzzy, no-c-format
-msgid ""
-"Next, download the Web Beans RI from <ulink url=\"http://seamframework.org/"
-"Download\">seamframework.org</ulink>, and unzip it. For example"
-msgstr ""
-"然后从<ulink url=\"http://seamframework.org/WebBeans\">seamframework.org</"
-"ulink>下载Web Beans的参考实现,然后解压。例如:"
+msgid "Next, download the Web Beans RI from <ulink url=\"http://seamframework.org/Download\">seamframework.org</ulink>, and unzip it. For example"
+msgstr "然后从<ulink url=\"http://seamframework.org/WebBeans\">seamframework.org</ulink>下载Web Beans的参考实现,然后解压。例如:"
#. Tag: programlisting
#: ri.xml:47
@@ -108,13 +84,8 @@
#. Tag: para
#: ri.xml:50
#, no-c-format
-msgid ""
-"Next, we need to tell Web Beans where JBoss is located. Edit <literal>jboss-"
-"as/build.properties</literal> and set the <literal>jboss.home</literal> "
-"property. For example:"
-msgstr ""
-"然后,我们需要告诉Web Beans JBoss的位置。编辑<literal>jboss-as/build."
-"properties</literal>,设置<literal>jboss.home</literal>属性。例如:"
+msgid "Next, we need to tell Web Beans where JBoss is located. Edit <literal>jboss-as/build.properties</literal> and set the <literal>jboss.home</literal> property. For example:"
+msgstr "然后,我们需要告诉Web Beans JBoss的位置。编辑<literal>jboss-as/build.properties</literal>,设置<literal>jboss.home</literal>属性。例如:"
#. Tag: programlisting
#: ri.xml:56
@@ -125,31 +96,20 @@
#. Tag: para
#: ri.xml:59
#, fuzzy, no-c-format
-msgid ""
-"A new deployer, <literal>webbeans.deployer</literal> is added to JBoss AS. "
-"This adds supports for Web Bean archives to JBoss AS, and allows the Web "
-"Beans RI to query the EJB3 container and discover which EJBs are installed "
-"in your application."
-msgstr ""
-"当前,我们需要两个更新。首先,需要添加一个新的部署器<literal>webbeans."
-"deployer</literal>。这个部署器提供JBoss AS对Web Bean档案包的支持,能够让Web "
-"Beans参考实现查询EJB3容器,发现应用中安装的EJB。第二,需要更新JBoss EJB3。"
+msgid "A new deployer, <literal>webbeans.deployer</literal> is added to JBoss AS. This adds supports for Web Bean archives to JBoss AS, and allows the Web Beans RI to query the EJB3 container and discover which EJBs are installed in your application."
+msgstr "当前,我们需要两个更新。首先,需要添加一个新的部署器<literal>webbeans.deployer</literal>。这个部署器提供JBoss AS对Web Bean档案包的支持,能够让Web Beans参考实现查询EJB3容器,发现应用中安装的EJB。第二,需要更新JBoss EJB3。"
#. Tag: para
#: ri.xml:67
#, no-c-format
msgid "Web Beans is bundled with JBoss AS 5.1 and above."
-msgstr ""
+msgstr "JBoss AS 5.1版本及以上捆绑了Web Bean。"
#. Tag: para
#: ri.xml:72
#, fuzzy, no-c-format
-msgid ""
-"To install Web Beans, you'll need Ant 1.7.0 installed, and the "
-"<literal>ANT_HOME</literal> environment variable set. For example:"
-msgstr ""
-"为了安装更新,你需要安装Ant 1.7.0,设置<literal>ANT_HOME</literal>环境变量。"
-"例如:"
+msgid "To install Web Beans, you'll need Ant 1.7.0 installed, and the <literal>ANT_HOME</literal> environment variable set. For example:"
+msgstr "为了安装更新,你需要安装Ant 1.7.0,设置<literal>ANT_HOME</literal>环境变量。例如:"
#. Tag: programlisting
#: ri.xml:77
@@ -164,9 +124,7 @@
#. Tag: para
#: ri.xml:79
#, fuzzy, no-c-format
-msgid ""
-"Then, you can install the update. The update script will use Maven to "
-"download Web Beans automatically."
+msgid "Then, you can install the update. The update script will use Maven to download Web Beans automatically."
msgstr "然后,你需要安装更新,更新脚本使用Maven来自动下载Web Beans和EJB3。"
#. Tag: programlisting
@@ -188,8 +146,7 @@
#. Tag: para
#: ri.xml:91
#, no-c-format
-msgid ""
-"The build scripts for the examples offer a number of targets, these are:"
+msgid "The build scripts for the examples offer a number of targets, these are:"
msgstr "例子的构建脚本包含多个目标:"
#. Tag: para
@@ -201,17 +158,13 @@
#. Tag: para
#: ri.xml:103
#, no-c-format
-msgid ""
-"<literal>ant explode</literal> - update an exploded example, without "
-"restarting the deployment"
-msgstr ""
-"<literal>ant explode</literal> - 无需重新部署,更新一个exploded形式部署的例子"
+msgid "<literal>ant explode</literal> - update an exploded example, without restarting the deployment"
+msgstr "<literal>ant explode</literal> - 无需重新部署,更新一个exploded形式部署的例子"
#. Tag: para
#: ri.xml:109
#, no-c-format
-msgid ""
-"<literal>ant deploy</literal> - deploy the example in compressed jar format"
+msgid "<literal>ant deploy</literal> - deploy the example in compressed jar format"
msgstr "<literal>ant deploy</literal> - 以压缩jar包形式部署例子"
#. Tag: para
@@ -263,25 +216,14 @@
#. Tag: para
#: ri.xml:144
#, no-c-format
-msgid ""
-"Wait for the application to deploy, and enjoy hours of fun at <ulink url="
-"\"http://localhost:8080/webbeans-numberguess\"></ulink>!"
-msgstr ""
-"等待应用部署完毕,好好体验一下<ulink url=\"http://localhost:8080/webbeans-"
-"numberguess\"></ulink>!"
+msgid "Wait for the application to deploy, and enjoy hours of fun at <ulink url=\"http://localhost:8080/webbeans-numberguess\"></ulink>!"
+msgstr "等待应用部署完毕,好好体验一下<ulink url=\"http://localhost:8080/webbeans-numberguess\"></ulink>!"
#. Tag: para
#: ri.xml:149
#, no-c-format
-msgid ""
-"The Web Beans RI includes a second simple example that will translate your "
-"text into Latin. The numberguess example is a war example, and uses only "
-"simple beans; the translator example is an ear example, and includes "
-"enterprise beans, packaged in an EJB module. To try it out:"
-msgstr ""
-"Web Bean参考实现的第二个简单例子能够将你的文本翻译为拉丁文。猜数字例子是一个"
-"WAR应用,仅仅使用了一个简单Beans;翻译器例子是一个EAR应用,包含了打包在EJB模"
-"块中的企业Beans。试一下:"
+msgid "The Web Beans RI includes a second simple example that will translate your text into Latin. The numberguess example is a war example, and uses only simple beans; the translator example is an ear example, and includes enterprise beans, packaged in an EJB module. To try it out:"
+msgstr "Web Bean参考实现的第二个简单例子能够将你的文本翻译为拉丁文。猜数字例子是一个WAR应用,仅仅使用了一个简单Beans;翻译器例子是一个EAR应用,包含了打包在EJB模块中的企业Beans。试一下:"
#. Tag: programlisting
#: ri.xml:156
@@ -296,12 +238,8 @@
#. Tag: para
#: ri.xml:158
#, no-c-format
-msgid ""
-"Wait for the application to deploy, and visit <ulink url=\"http://"
-"localhost:8080/webbeans-translator\"></ulink>!"
-msgstr ""
-"等待应用部署,试一下<ulink url=\"http://localhost:8080/webbeans-translator"
-"\"></ulink>!"
+msgid "Wait for the application to deploy, and visit <ulink url=\"http://localhost:8080/webbeans-translator\"></ulink>!"
+msgstr "等待应用部署,试一下<ulink url=\"http://localhost:8080/webbeans-translator\"></ulink>!"
#. Tag: title
#: ri.xml:164
@@ -312,37 +250,20 @@
#. Tag: para
#: ri.xml:166
#, no-c-format
-msgid ""
-"In the numberguess application you get given 10 attempts to guess a number "
-"between 1 and 100. After each attempt, you will be told whether you are too "
-"high, or too low."
-msgstr ""
-"在猜数字应用中,你有十次机会来猜一个1到100之间的数字。每次猜测之后,应用都会"
-"告诉你你猜的数字是高了还是低了。"
+msgid "In the numberguess application you get given 10 attempts to guess a number between 1 and 100. After each attempt, you will be told whether you are too high, or too low."
+msgstr "在猜数字应用中,你有十次机会来猜一个1到100之间的数字。每次猜测之后,应用都会告诉你你猜的数字是高了还是低了。"
#. Tag: para
#: ri.xml:172
#, no-c-format
-msgid ""
-"The numberguess example is comprised of a number of Web Beans, configuration "
-"files, and Facelet JSF pages, packaged as a war. Let's start with the "
-"configuration files."
-msgstr ""
-"猜数字应用由Web Beans,配置文件,Facelete JSF页面组成,打包为一个WAR。我们先"
-"看一下配置文件。"
+msgid "The numberguess example is comprised of a number of Web Beans, configuration files, and Facelet JSF pages, packaged as a war. Let's start with the configuration files."
+msgstr "猜数字应用由Web Beans,配置文件,Facelete JSF页面组成,打包为一个WAR。我们先看一下配置文件。"
#. Tag: para
#: ri.xml:178
#, no-c-format
-msgid ""
-"All the configuration files for this example are located in <literal>WEB-INF/"
-"</literal>, which is stored in <literal>WebContent</literal> in the source "
-"tree. First, we have <literal>faces-config.xml</literal>, in which we tell "
-"JSF to use Facelets:"
-msgstr ""
-"猜数字应用的所有的配置文件位于<literal>WEB-INF/</literal>,这个目录位于源码树"
-"的<literal>WebContent</literal>中。首先,我们在faces-config.xml文件中告诉JSF"
-"使用Faceletes:"
+msgid "All the configuration files for this example are located in <literal>WEB-INF/</literal>, which is stored in <literal>WebContent</literal> in the source tree. First, we have <literal>faces-config.xml</literal>, in which we tell JSF to use Facelets:"
+msgstr "猜数字应用的所有的配置文件位于<literal>WEB-INF/</literal>,这个目录位于源码树的<literal>WebContent</literal>中。首先,我们在faces-config.xml文件中告诉JSF使用Faceletes:"
#. Tag: programlisting
#: ri.xml:186
@@ -352,8 +273,7 @@
"<faces-config version=\"1.2\"\n"
" xmlns=\"http://java.sun.com/xml/ns/javaee\"\n"
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
-" xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://"
-"java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd\">\n"
+" xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd\">\n"
" \n"
" <application>\n"
" <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>\n"
@@ -365,8 +285,7 @@
"<faces-config version=\"1.2\"\n"
" xmlns=\"http://java.sun.com/xml/ns/javaee\"\n"
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
-" xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://"
-"java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd\">\n"
+" xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd\">\n"
" \n"
" <application>\n"
" <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>\n"
@@ -377,12 +296,8 @@
#. Tag: para
#: ri.xml:188
#, no-c-format
-msgid ""
-"There is an empty <literal>web-beans.xml</literal> file, which marks this "
-"application as a Web Beans application."
-msgstr ""
-"这有一个空的<literal>web-beans.xml</literal>文件,标识这个应用是一个Web Beans"
-"应用。"
+msgid "There is an empty <literal>web-beans.xml</literal> file, which marks this application as a Web Beans application."
+msgstr "这有一个空的<literal>web-beans.xml</literal>文件,标识这个应用是一个Web Beans应用。"
#. Tag: para
#: ri.xml:193
@@ -394,17 +309,12 @@
#: ri.xml:195
#, fuzzy, no-c-format
msgid ""
-"<programlistingco> <areaspec> <area id=\"faces.servlet\" coords=\"12\"/> "
-"<area id=\"faces.servlet.mapping\" coords=\"18\"/> <area id=\"faces.default."
-"suffix\" coords=\"23\"/> <area id=\"session.timeout\" coords=\"28\"/> <area "
-"id=\"webbeans.listener\" coords=\"32\"/> </areaspec> <programlisting><![CDATA"
-"[<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+"<programlistingco> <areaspec> <area id=\"faces.servlet\" coords=\"12\"/> <area id=\"faces.servlet.mapping\" coords=\"18\"/> <area id=\"faces.default.suffix\" coords=\"23\"/> <area id=\"session.timeout\" coords=\"28\"/> <area id=\"webbeans.listener\" coords=\"32\"/> </areaspec> <programlisting><![CDATA[<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"\n"
"<web-app version=\"2.5\"\n"
" xmlns=\"http://java.sun.com/xml/ns/javaee\"\n"
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
-" xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://java.sun."
-"com/xml/ns/javaee/web-app_2_5.xsd\">\n"
+" xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd\">\n"
" \n"
" <display-name>Web Beans Numbergues example</display-name>\n"
"\n"
@@ -430,23 +340,7 @@
" <session-timeout>10</session-timeout>\n"
" </session-config>\n"
"\n"
-"</web-app>]]></programlisting> <calloutlist> <callout arearefs=\"faces."
-"servlet\"> <para> Enable and load the JSF servlet </para> </callout> "
-"<callout arearefs=\"faces.servlet.mapping\"> <para> Configure requests to "
-"<literal>.jsf</literal> pages to be handled by JSF </para> </callout> "
-"<callout arearefs=\"faces.default.suffix\"> <para> Tell JSF that we will be "
-"giving our source files (facelets) an extension of <literal>.jsf</literal> </"
-"para> </callout> <callout arearefs=\"session.timeout\"> <para> Configure a "
-"session timeout of 10 minutes </para> </callout> </calloutlist> </"
-"programlistingco> <note> <para> Whilst this demo is a JSF demo, you can use "
-"the Web Beans RI with any Servlet based web framework. </para> </note> "
-"<para> Let's take a look at the Facelet view: </para> <programlistingco> "
-"<areaspec> <area id=\"template\" coords=\"8\"/> <area id=\"messages\" coords="
-"\"12\"/> <area id=\"instructions\" coords=\"19\"/> <area id=\"guess\" coords="
-"\"25\"/> <area id=\"validator\" coords=\"30\"/> <area id=\"submit\" coords="
-"\"33\"/> </areaspec> <programlisting><![CDATA[<!DOCTYPE html PUBLIC \"-//"
-"W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/"
-"xhtml1-transitional.dtd\">\n"
+"</web-app>]]></programlisting> <calloutlist> <callout arearefs=\"faces.servlet\"> <para> Enable and load the JSF servlet </para> </callout> <callout arearefs=\"faces.servlet.mapping\"> <para> Configure requests to <literal>.jsf</literal> pages to be handled by JSF </para> </callout> <callout arearefs=\"faces.default.suffix\"> <para> Tell JSF that we will be giving our source files (facelets) an extension of <literal>.jsf</literal> </para> </callout> <callout arearefs=\"session.timeout\"> <para> Configure a session timeout of 10 minutes </para> </callout> </calloutlist> </programlistingco> <note> <para> Whilst this demo is a JSF demo, you can use the Web Beans RI with any Servlet based web framework. </para> </note> <para> Let's take a look at the Facelet view: </para> <programlistingco> <areaspec> <area id=\"template\" coords=\"8\"/> <area id=\"messages\" coords=\"12\"/> <area id=\"instructions\" coords=\"19\"/> <area id=\"guess\" coords=\"25\"/> <area id=\"validator\" coo!
rds=\"30\"/> <area id=\"submit\" coords=\"33\"/> </areaspec> <programlisting><![CDATA[<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"
"<html xmlns=\"http://www.w3.org/1999/xhtml\"\n"
" xmlns:ui=\"http://java.sun.com/jsf/facelets\"\n"
" xmlns:h=\"http://java.sun.com/jsf/html\"\n"
@@ -459,15 +353,12 @@
" <h:form id=\"NumberGuessMain\">\n"
" <div style=\"color: red\">\n"
" <h:messages id=\"messages\" globalOnly=\"false\"/>\n"
-" <h:outputText id=\"Higher\" value=\"Higher!\" rendered=\"#{game."
-"number gt game.guess and game.guess ne 0}\"/>\n"
-" <h:outputText id=\"Lower\" value=\"Lower!\" rendered=\"#{game."
-"number lt game.guess and game.guess ne 0}\"/>\n"
+" <h:outputText id=\"Higher\" value=\"Higher!\" rendered=\"#{game.number gt game.guess and game.guess ne 0}\"/>\n"
+" <h:outputText id=\"Lower\" value=\"Lower!\" rendered=\"#{game.number lt game.guess and game.guess ne 0}\"/>\n"
" </div>\n"
" \n"
" <div>\n"
-" I'm thinking of a number between #{game.smallest} and #{game."
-"biggest}.\n"
+" I'm thinking of a number between #{game.smallest} and #{game.biggest}.\n"
" You have #{game.remainingGuesses} guesses.\n"
" </div>\n"
" \n"
@@ -487,41 +378,19 @@
" disabled=\"#{game.number eq game.guess}\"/>\n"
" </div>\n"
" <div>\n"
-" <h:commandButton id=\"RestartButton\" value=\"Reset\" action=\"#"
-"{game.reset}\" immediate=\"true\" />\n"
+" <h:commandButton id=\"RestartButton\" value=\"Reset\" action=\"#{game.reset}\" immediate=\"true\" />\n"
" </div>\n"
" </h:form>\n"
" </ui:define>\n"
" </ui:composition>\n"
-"</html>]]></programlisting> <calloutlist> <callout arearefs=\"template\"> "
-"<para> Facelets is a templating language for JSF, here we are wrapping our "
-"page in a template which defines the header. </para> </callout> <callout "
-"arearefs=\"messages\"> <para> There are a number of messages which can be "
-"sent to the user, \"Higher!\", \"Lower!\" and \"Correct!\" </para> </"
-"callout> <callout arearefs=\"instructions\"> <para> As the user guesses, the "
-"range of numbers they can guess gets smaller - this sentance changes to make "
-"sure they know what range to guess in. </para> </callout> <callout arearefs="
-"\"guess\"> <para> This input field is bound to a Web Bean, using the value "
-"expression. </para> </callout> <callout arearefs=\"validator\"> <para> A "
-"range validator is used to make sure the user doesn't accidentally input a "
-"number outside of the range in which they can guess - if the validator "
-"wasn't here, the user might use up a guess on an out of range number. </"
-"para> </callout> <callout arearefs=\"submit\"> <para> And, of course, there "
-"must be a way for the user to send their guess to the server. Here we bind "
-"to an action method on the Web Bean. </para> </callout> </calloutlist> </"
-"programlistingco>"
+"</html>]]></programlisting> <calloutlist> <callout arearefs=\"template\"> <para> Facelets is a templating language for JSF, here we are wrapping our page in a template which defines the header. </para> </callout> <callout arearefs=\"messages\"> <para> There are a number of messages which can be sent to the user, \"Higher!\", \"Lower!\" and \"Correct!\" </para> </callout> <callout arearefs=\"instructions\"> <para> As the user guesses, the range of numbers they can guess gets smaller - this sentance changes to make sure they know what range to guess in. </para> </callout> <callout arearefs=\"guess\"> <para> This input field is bound to a Web Bean, using the value expression. </para> </callout> <callout arearefs=\"validator\"> <para> A range validator is used to make sure the user doesn't accidentally input a number outside of the range in which they can guess - if the validator wasn't here, the user might use up a guess on an out of range number. </para> </callout> <callout !
arearefs=\"submit\"> <para> And, of course, there must be a way for the user to send their guess to the server. Here we bind to an action method on the Web Bean. </para> </callout> </calloutlist> </programlistingco>"
msgstr ""
-"<programlistingco> <areaspec> <area id=\"faces.servlet\" coords=\"12\"/> "
-"<area id=\"faces.servlet.mapping\" coords=\"18\"/> <area id=\"faces.default."
-"suffix\" coords=\"23\"/> <area id=\"session.timeout\" coords=\"28\"/> <area "
-"id=\"webbeans.listener\" coords=\"32\"/> </areaspec> <programlisting><![CDATA"
-"[<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+"<programlistingco> <areaspec> <area id=\"faces.servlet\" coords=\"12\"/> <area id=\"faces.servlet.mapping\" coords=\"18\"/> <area id=\"faces.default.suffix\" coords=\"23\"/> <area id=\"session.timeout\" coords=\"28\"/> <area id=\"webbeans.listener\" coords=\"32\"/> </areaspec> <programlisting><![CDATA[<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"\n"
"<web-app version=\"2.5\"\n"
" xmlns=\"http://java.sun.com/xml/ns/javaee\"\n"
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
-" xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://java.sun."
-"com/xml/ns/javaee/web-app_2_5.xsd\">\n"
+" xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd\">\n"
" \n"
" <display-name>Web Beans Numbergues example</display-name>\n"
"\n"
@@ -548,31 +417,10 @@
" </session-config>\n"
" \n"
" <listener>\n"
-" <listener-class>org.jboss.webbeans.servlet.WebBeansListener</listener-"
-"class>\n"
+" <listener-class>org.jboss.webbeans.servlet.WebBeansListener</listener-class>\n"
" </listener>\n"
"\n"
-"</web-app>]]></programlisting> <calloutlist> <callout arearefs=\"faces."
-"servlet\"> <para> Enable and load the JSF servlet </para> </callout> "
-"<callout arearefs=\"faces.servlet.mapping\"> <para> Configure requests to "
-"<literal>.jsf</literal> pages to be handled by JSF </para> </callout> "
-"<callout arearefs=\"faces.default.suffix\"> <para> Tell JSF that we will be "
-"giving our source files (facelets) an extension of <literal>.jsf</literal> </"
-"para> </callout> <callout arearefs=\"session.timeout\"> <para> Configure a "
-"session timeout of 10 minutes </para> </callout> <callout arearefs="
-"\"webbeans.listener\"> <para> Configure the Web Beans listener, so that Web "
-"Beans services can be used in the servlet request </para> </callout> </"
-"calloutlist> </programlistingco> <note> <para> The only configuration "
-"required by the Web Beans RI in <literal>web.xml</literal> is to add the Web "
-"Beans listener. </para> <para> Whilst this demo is a JSF demo, you can use "
-"the Web Beans RI with any Servlet based web framework; just configure the "
-"Web Beans listener. </para> </note> <para> Let's take a look at the Facelet "
-"view: </para> <programlistingco> <areaspec> <area id=\"template\" coords=\"8"
-"\"/> <area id=\"messages\" coords=\"12\"/> <area id=\"instructions\" coords="
-"\"19\"/> <area id=\"guess\" coords=\"25\"/> <area id=\"validator\" coords="
-"\"29\"/> <area id=\"submit\" coords=\"32\"/> </areaspec> <programlisting><!"
-"[CDATA[<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" "
-"\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"
+"</web-app>]]></programlisting> <calloutlist> <callout arearefs=\"faces.servlet\"> <para> Enable and load the JSF servlet </para> </callout> <callout arearefs=\"faces.servlet.mapping\"> <para> Configure requests to <literal>.jsf</literal> pages to be handled by JSF </para> </callout> <callout arearefs=\"faces.default.suffix\"> <para> Tell JSF that we will be giving our source files (facelets) an extension of <literal>.jsf</literal> </para> </callout> <callout arearefs=\"session.timeout\"> <para> Configure a session timeout of 10 minutes </para> </callout> <callout arearefs=\"webbeans.listener\"> <para> Configure the Web Beans listener, so that Web Beans services can be used in the servlet request </para> </callout> </calloutlist> </programlistingco> <note> <para> The only configuration required by the Web Beans RI in <literal>web.xml</literal> is to add the Web Beans listener. </para> <para> Whilst this demo is a JSF demo, you can use the Web Beans RI with any Servlet based!
web framework; just configure the Web Beans listener. </para> </note> <para> Let's take a look at the Facelet view: </para> <programlistingco> <areaspec> <area id=\"template\" coords=\"8\"/> <area id=\"messages\" coords=\"12\"/> <area id=\"instructions\" coords=\"19\"/> <area id=\"guess\" coords=\"25\"/> <area id=\"validator\" coords=\"29\"/> <area id=\"submit\" coords=\"32\"/> </areaspec> <programlisting><![CDATA[<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"
"<html xmlns=\"http://www.w3.org/1999/xhtml\"\n"
" xmlns:ui=\"http://java.sun.com/jsf/facelets\"\n"
" xmlns:h=\"http://java.sun.com/jsf/html\"\n"
@@ -585,15 +433,12 @@
" <h:form id=\"NumberGuessMain\">\n"
" <div style=\"color: red\">\n"
" <h:messages id=\"messages\" globalOnly=\"false\"/>\n"
-" <h:outputText id=\"Higher\" value=\"Higher!\" rendered=\"#{game."
-"number gt game.guess}\"/>\n"
-" <h:outputText id=\"Lower\" value=\"Lower!\" rendered=\"#{game."
-"number lt game.guess}\"/>\n"
+" <h:outputText id=\"Higher\" value=\"Higher!\" rendered=\"#{game.number gt game.guess}\"/>\n"
+" <h:outputText id=\"Lower\" value=\"Lower!\" rendered=\"#{game.number lt game.guess}\"/>\n"
" </div>\n"
" \n"
" <div>\n"
-" I'm thinking of a number between #{game.smallest} and #{game."
-"biggest}.\n"
+" I'm thinking of a number between #{game.smallest} and #{game.biggest}.\n"
" You have #{game.remainingGuesses} guesses.\n"
" </div>\n"
" \n"
@@ -614,34 +459,13 @@
" </h:form>\n"
" </ui:define>\n"
" </ui:composition>\n"
-"</html>]]></programlisting> <calloutlist> <callout arearefs=\"template\"> "
-"<para> Facelets is a templating language for JSF, here we are wrapping our "
-"page in a template which defines the header. </para> </callout> <callout "
-"arearefs=\"messages\"> <para> There are a number of messages which can be "
-"sent to the user, \"Higher!\", \"Lower!\" and \"Correct!\" </para> </"
-"callout> <callout arearefs=\"instructions\"> <para> As the user guesses, the "
-"range of numbers they can guess gets smaller - this sentance changes to make "
-"sure they know what range to guess in. </para> </callout> <callout arearefs="
-"\"guess\"> <para> This input field is bound to a Web Bean, using the value "
-"expression. </para> </callout> <callout arearefs=\"validator\"> <para> A "
-"range validator is used to make sure the user doesn't accidentally input a "
-"number outside of the range in which they can guess - if the validator "
-"wasn't here, the user might use up a guess on an out of range number. </"
-"para> </callout> <callout arearefs=\"submit\"> <para> And, of course, there "
-"must be a way for the user to send their guess to the server. Here we bind "
-"to an action method on the Web Bean. </para> </callout> </calloutlist> </"
-"programlistingco>"
+"</html>]]></programlisting> <calloutlist> <callout arearefs=\"template\"> <para> Facelets is a templating language for JSF, here we are wrapping our page in a template which defines the header. </para> </callout> <callout arearefs=\"messages\"> <para> There are a number of messages which can be sent to the user, \"Higher!\", \"Lower!\" and \"Correct!\" </para> </callout> <callout arearefs=\"instructions\"> <para> As the user guesses, the range of numbers they can guess gets smaller - this sentance changes to make sure they know what range to guess in. </para> </callout> <callout arearefs=\"guess\"> <para> This input field is bound to a Web Bean, using the value expression. </para> </callout> <callout arearefs=\"validator\"> <para> A range validator is used to make sure the user doesn't accidentally input a number outside of the range in which they can guess - if the validator wasn't here, the user might use up a guess on an out of range number. </para> </callout> <callout !
arearefs=\"submit\"> <para> And, of course, there must be a way for the user to send their guess to the server. Here we bind to an action method on the Web Bean. </para> </callout> </calloutlist> </programlistingco>"
#. Tag: para
#: ri.xml:297
#, no-c-format
-msgid ""
-"The example exists of 4 classes, the first two of which are binding types. "
-"First, there is the <literal>@Random</literal> binding type, used for "
-"injecting a random number:"
-msgstr ""
-"这个例子包括4个类,前面两个是绑定类型。首先,这有一个<literal>@Random</"
-"literal>绑定类型,用来注入一个随机数:"
+msgid "The example exists of 4 classes, the first two of which are binding types. First, there is the <literal>@Random</literal> binding type, used for injecting a random number:"
+msgstr "这个例子包括4个类,前面两个是绑定类型。首先,这有一个<literal>@Random</literal>绑定类型,用来注入一个随机数:"
#. Tag: programlisting
#: ri.xml:303
@@ -662,9 +486,7 @@
#. Tag: para
#: ri.xml:305
#, no-c-format
-msgid ""
-"There is also the <literal>@MaxNumber</literal> binding type, used for "
-"injecting the maximum number that can be injected:"
+msgid "There is also the <literal>@MaxNumber</literal> binding type, used for injecting the maximum number that can be injected:"
msgstr "这还有一个<literal>@MaxNumber</literal>绑定类型,用来注入一个最大值:"
#. Tag: programlisting
@@ -688,13 +510,8 @@
#. Tag: para
#: ri.xml:312
#, no-c-format
-msgid ""
-"The <literal>Generator</literal> class is responsible for creating the "
-"random number, via a producer method. It also exposes the maximum possible "
-"number via a producer method:"
-msgstr ""
-"<literal>Generator</literal>类通过一个生产者(producer)方法创建一个随机数。它"
-"也通过一个生产者方法暴露可能的最大值:"
+msgid "The <literal>Generator</literal> class is responsible for creating the random number, via a producer method. It also exposes the maximum possible number via a producer method:"
+msgstr "<literal>Generator</literal>类通过一个生产者(producer)方法创建一个随机数。它也通过一个生产者方法暴露可能的最大值:"
#. Tag: programlisting
#: ri.xml:318
@@ -703,8 +520,7 @@
"<![CDATA[@ApplicationScoped\n"
"public class Generator {\n"
" \n"
-" private java.util.Random random = new java.util.Random( System."
-"currentTimeMillis() );\n"
+" private java.util.Random random = new java.util.Random( System.currentTimeMillis() );\n"
" \n"
" private int maxNumber = 100;\n"
" \n"
@@ -727,8 +543,7 @@
"<![CDATA[@ApplicationScoped\n"
"public class Generator {\n"
" \n"
-" private java.util.Random random = new java.util.Random( System."
-"currentTimeMillis() );\n"
+" private java.util.Random random = new java.util.Random( System.currentTimeMillis() );\n"
" \n"
" private int maxNumber = 100;\n"
" \n"
@@ -751,35 +566,20 @@
#. Tag: para
#: ri.xml:320
#, no-c-format
-msgid ""
-"You'll notice that the <literal>Generator</literal> is application scoped; "
-"therefore we don't get a different random each time."
-msgstr ""
-"你会注意到<literal>Generator</literal>是应用范围的;因此我们不会每次都得到一"
-"个不同的随机对象。"
+msgid "You'll notice that the <literal>Generator</literal> is application scoped; therefore we don't get a different random each time."
+msgstr "你会注意到<literal>Generator</literal>是应用范围的;因此我们不会每次都得到一个不同的随机对象。"
#. Tag: para
#: ri.xml:325
#, no-c-format
-msgid ""
-"The final Web Bean in the application is the session scoped <literal>Game</"
-"literal>."
+msgid "The final Web Bean in the application is the session scoped <literal>Game</literal>."
msgstr "最终的应用中的Web Bean是会话范围的 <literal>Game</literal> 。"
#. Tag: para
#: ri.xml:330
#, fuzzy, no-c-format
-msgid ""
-"You'll note that we've used the <literal>@Named</literal> annotation, so "
-"that we can use the bean through EL in the JSF page. Finally, we've used "
-"constructor injection to initialize the game with a random number. And of "
-"course, we need to tell the player when they've won, so we give feedback "
-"with a <literal>FacesMessage</literal>."
-msgstr ""
-"你也许注意到我们使用了 <literal>@Named</literal>注释,以便我们能够通过EL(表"
-"达式语言)在JSF页面中使用Bean。最后,我们通过构造器注入来初始化猜数字游戏并给"
-"它设一个随机数。当然,在玩家猜对数字后,我们需要告诉玩家他赢了,所以我们通过"
-"<literal>FacesMessage</literal>反馈给玩家一条信息。"
+msgid "You'll note that we've used the <literal>@Named</literal> annotation, so that we can use the bean through EL in the JSF page. Finally, we've used constructor injection to initialize the game with a random number. And of course, we need to tell the player when they've won, so we give feedback with a <literal>FacesMessage</literal>."
+msgstr "你也许注意到我们使用了 <literal>@Named</literal>注释,以便我们能够通过EL(表达式语言)在JSF页面中使用Bean。最后,我们通过构造器注入来初始化猜数字游戏并给它设一个随机数。当然,在玩家猜对数字后,我们需要告诉玩家他赢了,所以我们通过<literal>FacesMessage</literal>反馈给玩家一条信息。"
#. Tag: programlisting
#: ri.xml:338
@@ -863,8 +663,7 @@
" }\n"
" if (guess == number)\n"
" {\n"
-" FacesContext.getCurrentInstance().addMessage(null, new FacesMessage"
-"(\"Correct!\"));\n"
+" FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(\"Correct!\"));\n"
" }\n"
" remainingGuesses--;\n"
" return null;\n"
@@ -876,8 +675,7 @@
" this.smallest = 0;\n"
" this.guess = 0;\n"
" this.remainingGuesses = 10;\n"
-" this.number = manager.getInstanceByType(Integer.class, new "
-"AnnotationLiteral<Random>(){});\n"
+" this.number = manager.getInstanceByType(Integer.class, new AnnotationLiteral<Random>(){});\n"
" }\n"
" \n"
"}]]>"
@@ -960,8 +758,7 @@
" }\n"
" if (guess == number)\n"
" {\n"
-" FacesContext.getCurrentInstance().addMessage(null, new FacesMessage"
-"(\"Correct!\"));\n"
+" FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(\"Correct!\"));\n"
" }\n"
" remainingGuesses--;\n"
" return null;\n"
@@ -973,8 +770,7 @@
" this.smallest = 0;\n"
" this.guess = 0;\n"
" this.remainingGuesses = 10;\n"
-" this.number = manager.getInstanceByType(Integer.class, new "
-"AnnotationLiteral<Random>(){});\n"
+" this.number = manager.getInstanceByType(Integer.class, new AnnotationLiteral<Random>(){});\n"
" }\n"
" \n"
"}]]>"
@@ -988,40 +784,26 @@
#. Tag: para
#: ri.xml:344
#, no-c-format
-msgid ""
-"The translator example will take any sentences you enter, and translate them "
-"to Latin."
+msgid "The translator example will take any sentences you enter, and translate them to Latin."
msgstr "翻译器例子能够将你输入的句子翻译为拉丁文。"
#. Tag: para
#: ri.xml:349
#, fuzzy, no-c-format
-msgid ""
-"The translator example is built as an ear, and contains EJBs. As a result, "
-"it's structure is more complex than the numberguess example."
-msgstr ""
-"翻译器例子是一个EAR应用,包含EJBs和企业Beans。因此,它的结构比猜数字例子复"
-"杂。"
+msgid "The translator example is built as an ear, and contains EJBs. As a result, it's structure is more complex than the numberguess example."
+msgstr "翻译器例子是一个EAR应用,包含EJBs和企业Beans。因此,它的结构比猜数字例子复杂。"
#. Tag: para
#: ri.xml:355
#, no-c-format
-msgid ""
-"EJB 3.1 and Jave EE 6 allow you to package EJBs in a war, which will make "
-"this structure much simpler!"
+msgid "EJB 3.1 and Jave EE 6 allow you to package EJBs in a war, which will make this structure much simpler!"
msgstr "EJB3.1和Java EE 6允许你在WAR包中打包EJBs, 这将让这个结构更加简单!"
#. Tag: para
#: ri.xml:361
#, fuzzy, no-c-format
-msgid ""
-"First, let's take a look at the ear aggregator, which is located in "
-"<literal>webbeans-translator-ear</literal> module. Maven automatically "
-"generates the <literal>application.xml</literal> for us:"
-msgstr ""
-"首先,让我们看一下EAR聚合器,它位于<literal>webbeans-translator-ear</literal>"
-"模块下。Maven将为我们自动生成<literal>application.xml</literal>和"
-"<literal>jboss-app.xml</literal>文件:"
+msgid "First, let's take a look at the ear aggregator, which is located in <literal>webbeans-translator-ear</literal> module. Maven automatically generates the <literal>application.xml</literal> for us:"
+msgstr "首先,让我们看一下EAR聚合器,它位于<literal>webbeans-translator-ear</literal>模块下。Maven将为我们自动生成<literal>application.xml</literal>和<literal>jboss-app.xml</literal>文件:"
#. Tag: programlisting
#: ri.xml:367
@@ -1053,8 +835,7 @@
" </webModule>\n"
" </modules>\n"
" <jboss>\n"
-" <loader-repository>webbeans.jboss.org:loader=webbeans-translator</"
-"loader-repository>\n"
+" <loader-repository>webbeans.jboss.org:loader=webbeans-translator</loader-repository>\n"
" </jboss>\n"
" </configuration>\n"
"</plugin>]]>"
@@ -1062,24 +843,14 @@
#. Tag: para
#: ri.xml:369
#, fuzzy, no-c-format
-msgid ""
-"Here we set the context path, which gives us a nice url (<ulink url=\"http://"
-"localhost:8080/webbeans-translator\">http://localhost:8080/webbeans-"
-"translator</ulink>)."
-msgstr ""
-"我们需要在这里做些事情-首先我们需要设置上下文路径为一个不错的URL(<ulink url="
-"\"http://localhost:8080/webbeans-translator\">http://localhost:8080/webbeans-"
-"translator</ulink>),我们还需要将JBoss AS的类加载器隔离配置激活。"
+msgid "Here we set the context path, which gives us a nice url (<ulink url=\"http://localhost:8080/webbeans-translator\">http://localhost:8080/webbeans-translator</ulink>)."
+msgstr "我们需要在这里做些事情-首先我们需要设置上下文路径为一个不错的URL(<ulink url=\"http://localhost:8080/webbeans-translator\">http://localhost:8080/webbeans-translator</ulink>),我们还需要将JBoss AS的类加载器隔离配置激活。"
#. Tag: para
#: ri.xml:375
#, fuzzy, no-c-format
-msgid ""
-"If you aren't using Maven to generate these files, you would need "
-"<literal>META-INF/application.xml</literal>:"
-msgstr ""
-"如果你不使用Maven来生成这些文件,你将需要<literal>META-INF/jboss-app.xml</"
-"literal>:"
+msgid "If you aren't using Maven to generate these files, you would need <literal>META-INF/application.xml</literal>:"
+msgstr "如果你不使用Maven来生成这些文件,你将需要<literal>META-INF/jboss-app.xml</literal>:"
#. Tag: programlisting
#: ri.xml:380
@@ -1088,12 +859,10 @@
"<![CDATA[<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<application xmlns=\"http://java.sun.com/xml/ns/javaee\" \n"
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
-" xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://"
-"java.sun.com/xml/ns/javaee/application_5.xsd\"\n"
+" xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd\"\n"
" version=\"5\">\n"
" <display-name>webbeans-translator-ear</display-name>\n"
-" <description>Ear Example for the reference implementation of JSR 299: Web "
-"Beans</description>\n"
+" <description>Ear Example for the reference implementation of JSR 299: Web Beans</description>\n"
" \n"
" <module>\n"
" <web>\n"
@@ -1109,12 +878,10 @@
"<![CDATA[<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<application xmlns=\"http://java.sun.com/xml/ns/javaee\" \n"
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
-" xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://"
-"java.sun.com/xml/ns/javaee/application_5.xsd\"\n"
+" xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd\"\n"
" version=\"5\">\n"
" <display-name>webbeans-translator-ear</display-name>\n"
-" <description>Ear Example for the reference implementation of JSR 299: Web "
-"Beans</description>\n"
+" <description>Ear Example for the reference implementation of JSR 299: Web Beans</description>\n"
" \n"
" <module>\n"
" <web>\n"
@@ -1130,25 +897,14 @@
#. Tag: para
#: ri.xml:383
#, fuzzy, no-c-format
-msgid ""
-"Next, lets look at the war. Just as in the numberguess example, we have a "
-"<literal>faces-config.xml</literal> (to enable Facelets) and a <literal>web."
-"xml</literal> (to enable JSF) in <literal>WebContent/WEB-INF</literal>."
-msgstr ""
-"然后,我们看一下WAR包。在猜数字例子中,我们需要<literal>faces-config.xml</"
-"literal>(配置Facelets)和一个位于<literal>WebContent/WEB-INF</literal>下的"
-"<literal>web.xml</literal>(配置JSF并将Web Beans服务加入Servlet容器中)。"
+msgid "Next, lets look at the war. Just as in the numberguess example, we have a <literal>faces-config.xml</literal> (to enable Facelets) and a <literal>web.xml</literal> (to enable JSF) in <literal>WebContent/WEB-INF</literal>."
+msgstr "然后,我们看一下WAR包。在猜数字例子中,我们需要<literal>faces-config.xml</literal>(配置Facelets)和一个位于<literal>WebContent/WEB-INF</literal>下的<literal>web.xml</literal>(配置JSF并将Web Beans服务加入Servlet容器中)。"
#. Tag: para
#: ri.xml:390
#, no-c-format
-msgid ""
-"More intersting is the facelet used to translate text. Just as in the "
-"numberguess example we have a template, which surrounds the form (ommitted "
-"here for brevity):"
-msgstr ""
-"更有意思的是用来翻译文本的facelet。在猜数字应用中我们有一个模板,这个模板套着"
-"表单(省略了表单):"
+msgid "More intersting is the facelet used to translate text. Just as in the numberguess example we have a template, which surrounds the form (ommitted here for brevity):"
+msgstr "更有意思的是用来翻译文本的facelet。在猜数字应用中我们有一个模板,这个模板套着表单(省略了表单):"
#. Tag: programlisting
#: ri.xml:396
@@ -1167,8 +923,7 @@
" </tr>\n"
" <tr>\n"
" <td>\n"
-" <h:inputTextarea id=\"text\" value=\"#{translator.text}\" "
-"required=\"true\" rows=\"5\" cols=\"80\" />\n"
+" <h:inputTextarea id=\"text\" value=\"#{translator.text}\" required=\"true\" rows=\"5\" cols=\"80\" />\n"
" </td>\n"
" <td>\n"
" <h:outputText value=\"#{translator.translatedText}\" />\n"
@@ -1176,8 +931,7 @@
" </tr>\n"
" </table>\n"
" <div>\n"
-" <h:commandButton id=\"button\" value=\"Translate\" action=\"#"
-"{translator.translate}\"/>\n"
+" <h:commandButton id=\"button\" value=\"Translate\" action=\"#{translator.translate}\"/>\n"
" </div>\n"
" \n"
"</h:form>]]>"
@@ -1195,8 +949,7 @@
" </tr>\n"
" <tr>\n"
" <td>\n"
-" <h:inputTextarea id=\"text\" value=\"#{translator.text}\" "
-"required=\"true\" rows=\"5\" cols=\"80\" />\n"
+" <h:inputTextarea id=\"text\" value=\"#{translator.text}\" required=\"true\" rows=\"5\" cols=\"80\" />\n"
" </td>\n"
" <td>\n"
" <h:outputText value=\"#{translator.translatedText}\" />\n"
@@ -1204,8 +957,7 @@
" </tr>\n"
" </table>\n"
" <div>\n"
-" <h:commandButton id=\"button\" value=\"Translate\" action=\"#"
-"{translator.translate}\"/>\n"
+" <h:commandButton id=\"button\" value=\"Translate\" action=\"#{translator.translate}\"/>\n"
" </div>\n"
" \n"
"</h:form>]]>"
@@ -1213,54 +965,26 @@
#. Tag: para
#: ri.xml:398
#, no-c-format
-msgid ""
-"The user can enter some text in the lefthand textarea, and hit the translate "
-"button to see the result to the right."
+msgid "The user can enter some text in the lefthand textarea, and hit the translate button to see the result to the right."
msgstr "用户可以在左手边的文本区输入一些文本,点击翻译按钮查看右边的翻译结果。"
#. Tag: para
#: ri.xml:403
#, fuzzy, no-c-format
-msgid ""
-"Finally, let's look at the ejb module, <literal>webbeans-translator-ejb</"
-"literal>. In <literal>src/main/resources/META-INF</literal> there is just an "
-"empty <literal>web-beans.xml</literal>, used to mark the archive as "
-"containing Web Beans."
-msgstr ""
-"最后,我们看一下EJB模块,<literal>webbeans-translator-ejb</literal>。在"
-"<literal>src/main/resources/META-INF</literal>下有两个配置文件,一个是空的"
-"<literal>web-beans.xml</literal>,用来标识这个档案包包含Web Beans,一个是"
-"<literal>ejb-jar.xml</literal>。Web Beans为所有的EJB提供注入和初始化服务,使"
-"用<literal>ejb-jar.xml</literal>文件来配置。你将在使用Web Beans的EJB项目中需"
-"要这些配置:"
+msgid "Finally, let's look at the ejb module, <literal>webbeans-translator-ejb</literal>. In <literal>src/main/resources/META-INF</literal> there is just an empty <literal>web-beans.xml</literal>, used to mark the archive as containing Web Beans."
+msgstr "最后,我们看一下EJB模块,<literal>webbeans-translator-ejb</literal>。在<literal>src/main/resources/META-INF</literal>下有两个配置文件,一个是空的<literal>web-beans.xml</literal>,用来标识这个档案包包含Web Beans,一个是<literal>ejb-jar.xml</literal>。Web Beans为所有的EJB提供注入和初始化服务,使用<literal>ejb-jar.xml</literal>文件来配置。你将在使用Web Beans的EJB项目中需要这些配置:"
#. Tag: para
#: ri.xml:411
#, fuzzy, no-c-format
-msgid ""
-"We've saved the most interesting bit to last, the code! The project has two "
-"simple beans, <literal>SentenceParser</literal> and <literal>TextTranslator</"
-"literal> and two enterprise beans, <literal>TranslatorControllerBean</"
-"literal> and <literal>SentenceTranslator</literal>. You should be getting "
-"quite familiar with what a Web Bean looks like by now, so we'll just "
-"highlight the most interesting bits here."
-msgstr ""
-"我们将最有意思的部分放在最后,那就是代码!这个例子有两个简单Beans, "
-"<literal>SentanceParser</literal>和<literal>TextTranslator</literal>,还有两"
-"个企业Beans,<literal>TanslatorControllerBean</literal>和"
-"<literal>SentenceTranslator</literal>。现在你应该对Web Beans有点熟悉了,我们"
-"在这里着重最有意思的部分。"
+msgid "We've saved the most interesting bit to last, the code! The project has two simple beans, <literal>SentenceParser</literal> and <literal>TextTranslator</literal> and two enterprise beans, <literal>TranslatorControllerBean</literal> and <literal>SentenceTranslator</literal>. You should be getting quite familiar with what a Web Bean looks like by now, so we'll just highlight the most interesting bits here."
+msgstr "我们将最有意思的部分放在最后,那就是代码!这个例子有两个简单Beans, <literal>SentanceParser</literal>和<literal>TextTranslator</literal>,还有两个企业Beans,<literal>TanslatorControllerBean</literal>和<literal>SentenceTranslator</literal>。现在你应该对Web Beans有点熟悉了,我们在这里着重最有意思的部分。"
#. Tag: para
#: ri.xml:421
#, fuzzy, no-c-format
-msgid ""
-"Both <literal>SentenceParser</literal> and <literal>TextTranslator</literal> "
-"are dependent beans, and <literal>TextTranslator</literal> uses constructor "
-"initialization:"
-msgstr ""
-"<literal>SentanceParser</literal>和<literal>TextTranslator</literal>是相互依"
-"赖的Beans,<literal>TextTranslator</literal>使用构造器初始化:"
+msgid "Both <literal>SentenceParser</literal> and <literal>TextTranslator</literal> are dependent beans, and <literal>TextTranslator</literal> uses constructor initialization:"
+msgstr "<literal>SentanceParser</literal>和<literal>TextTranslator</literal>是相互依赖的Beans,<literal>TextTranslator</literal>使用构造器初始化:"
#. Tag: programlisting
#: ri.xml:427
@@ -1271,8 +995,7 @@
" private Translator sentenceTranslator; \n"
" \n"
" @Initializer\n"
-" TextTranslator(SentenceParser sentenceParser, Translator "
-"sentenceTranslator) \n"
+" TextTranslator(SentenceParser sentenceParser, Translator sentenceTranslator) \n"
" { \n"
" this.sentenceParser = sentenceParser; \n"
" this.sentenceTranslator = sentenceTranslator;]]>"
@@ -1282,8 +1005,7 @@
" private Translator sentenceTranslator; \n"
" \n"
" @Initializer\n"
-" TextTranslator(SentenceParser sentenceParser, Translator "
-"sentenceTranslator) \n"
+" TextTranslator(SentenceParser sentenceParser, Translator sentenceTranslator) \n"
" { \n"
" this.sentenceParser = sentenceParser; \n"
" this.sentenceTranslator = sentenceTranslator;]]>"
@@ -1291,25 +1013,14 @@
#. Tag: para
#: ri.xml:429
#, no-c-format
-msgid ""
-"<literal>TextTranslator</literal> is a stateless bean (with a local business "
-"interface), where the magic happens - of course, we couldn't develop a full "
-"translator, but we gave it a good go!"
-msgstr ""
-"<literal>TextTranslator</literal>是一个无状态Bean(拥有一个本地业务接口),这"
-"里是魔术展现的地方-当然,我们不会开发一个完整的翻译器,但我们可以开发一个不错"
-"的小玩意!"
+msgid "<literal>TextTranslator</literal> is a stateless bean (with a local business interface), where the magic happens - of course, we couldn't develop a full translator, but we gave it a good go!"
+msgstr "<literal>TextTranslator</literal>是一个无状态Bean(拥有一个本地业务接口),这里是魔术展现的地方-当然,我们不会开发一个完整的翻译器,但我们可以开发一个不错的小玩意!"
#. Tag: para
#: ri.xml:435
#, no-c-format
-msgid ""
-"Finally, there is UI orientated controller, that collects the text from the "
-"user, and dispatches it to the translator. This is a request scoped, named, "
-"stateful session bean, which injects the translator."
-msgstr ""
-"最后,这里又要一个面向UI的控制器,从用户输入处搜集文本,转发给翻译器。这个控"
-"制器是请求范围的,具名的,有状态的会话Bean,它可以将翻译器注入进来。"
+msgid "Finally, there is UI orientated controller, that collects the text from the user, and dispatches it to the translator. This is a request scoped, named, stateful session bean, which injects the translator."
+msgstr "最后,这里又要一个面向UI的控制器,从用户输入处搜集文本,转发给翻译器。这个控制器是请求范围的,具名的,有状态的会话Bean,它可以将翻译器注入进来。"
#. Tag: programlisting
#: ri.xml:441
@@ -1362,34 +1073,20 @@
#. Tag: para
#: ri.xml:453
#, no-c-format
-msgid ""
-"The Web Beans manager will call the remove method for you when the bean is "
-"destroyed; in this case at the end of the request."
-msgstr ""
-"Web Beans管理器在这个bean销毁的时候调用remove方法;在这个例子中是请求结束的时"
-"候。"
+msgid "The Web Beans manager will call the remove method for you when the bean is destroyed; in this case at the end of the request."
+msgstr "Web Beans管理器在这个bean销毁的时候调用remove方法;在这个例子中是请求结束的时候。"
#. Tag: para
#: ri.xml:459
#, fuzzy, no-c-format
-msgid ""
-"That concludes our short tour of the Web Beans examples. For more on Web "
-"Beans , or to help out, please visit <ulink url=\"http://www.seamframework."
-"org/WebBeans/Development\">http://www.seamframework.org/WebBeans/"
-"Development</ulink>."
-msgstr ""
-"Web Beans参考实现的例子到此结束。想要获得关于参考实现更多的知识或者帮助,请访"
-"问<ulink url=\"http://www.seamframework.org/WebBeans/Development\">http://"
-"www.seamframework.org/WebBeans/Development</ulink>。"
+msgid "That concludes our short tour of the Web Beans examples. For more on Web Beans , or to help out, please visit <ulink url=\"http://www.seamframework.org/WebBeans/Development\">http://www.seamframework.org/WebBeans/Development</ulink>."
+msgstr "Web Beans参考实现的例子到此结束。想要获得关于参考实现更多的知识或者帮助,请访问<ulink url=\"http://www.seamframework.org/WebBeans/Development\">http://www.seamframework.org/WebBeans/Development</ulink>。"
#. Tag: para
#: ri.xml:465
#, no-c-format
-msgid ""
-"We need help in all areas - bug fixing, writing new features, writing "
-"examples and translating this reference guide."
-msgstr ""
-"我们在各个方面都需要帮助-bug修复,新特性开发,例子开发和参考指南的翻译等等。"
+msgid "We need help in all areas - bug fixing, writing new features, writing examples and translating this reference guide."
+msgstr "我们在各个方面都需要帮助-bug修复,新特性开发,例子开发和参考指南的翻译等等。"
#~ msgid ""
#~ "As Web Beans is a new piece of software, you need to update JBoss AS to "
@@ -1398,7 +1095,6 @@
#~ msgstr ""
#~ "因为Web Beans是新的软件,你需要更新JBoss AS来运行Web Beans的参考实现。"
#~ "JBoss AS未来的版本将包括这些更新,这些步骤将不再是必须的。"
-
#~ msgid ""
#~ "The final Web Bean in the application is the session scoped "
#~ "<literal>Game</literal>. By making <literal>Game</literal> session "
@@ -1408,7 +1104,6 @@
#~ "最后,应用的Web Bean是会话范围的 <literal>Game</literal>。通过将 "
#~ "<literal>Game</literal>的范围设为会话范围,你可以为每个浏览器会话启动一个"
#~ "猜数字游戏。你可以简单地添加一个复位按钮-对于读者来说是一个很好的练习 :)"
-
#~ msgid ""
#~ "<![CDATA[@Named\n"
#~ "@SessionScoped\n"
@@ -1487,7 +1182,6 @@
#~ " }\n"
#~ " \n"
#~ "}]]>"
-
#~ msgid ""
#~ "<![CDATA[<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
#~ "<!DOCTYPE jboss-app\n"
@@ -1506,10 +1200,8 @@
#~ " <loader-repository>webbeans.jboss.org:loader=webbeans-translator</"
#~ "loader-repository>\n"
#~ "</jboss-app>]]>"
-
#~ msgid "and <literal>META-INF/application.xml</literal>:"
#~ msgstr "和 <literal>META-INF/application.xml</literal>:"
-
#~ msgid ""
#~ "<![CDATA[<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
#~ "<ejb-jar xmlns=\"http://java.sun.com/xml/ns/javaee\" \n"
@@ -1558,3 +1250,4 @@
#~ " </assembly-descriptor>\n"
#~ " \n"
#~ "</ejb-jar>]]>"
+
15 years, 5 months
[webbeans-commits] Webbeans SVN: r2220 - in tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/context/session and 3 other directories.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-03-26 17:29:53 -0400 (Thu, 26 Mar 2009)
New Revision: 2220
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ServiceMethodServlet.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/IntrospectSession.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/InvalidateSession.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/SimpleSessionBean.java
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/application/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/application/web.xml
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ApplicationContextTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/FilterTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/ServiceMethodServlet.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/SessionContextTest.java
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/session/web.xml
Log:
Finished session context tests and added an application context test
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ApplicationContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ApplicationContextTest.java 2009-03-26 18:06:38 UTC (rev 2219)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ApplicationContextTest.java 2009-03-26 21:29:53 UTC (rev 2220)
@@ -4,22 +4,32 @@
import org.jboss.jsr299.tck.AbstractJSR299Test;
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Resource;
+import org.jboss.testharness.impl.packaging.Resources;
+import org.jboss.testharness.impl.packaging.war.WarArtifactDescriptor;
import org.testng.annotations.Test;
+import com.gargoylesoftware.htmlunit.WebClient;
+
/**
*
* Spec version: PRD2
*/
@Artifact
-@IntegrationTest
+@IntegrationTest(runLocally=true)
+@Resources({
+ @Resource(destination=WarArtifactDescriptor.WEB_XML_DESTINATION, source="web.xml")
+})
public class ApplicationContextTest extends AbstractJSR299Test
{
- @Test(groups = { "stub", "contexts", "servlet", "integration" })
+ @Test(groups = { "contexts", "servlet", "integration" })
@SpecAssertion(section = "8.5.3", id = "a")
- public void testApplicationScopeActiveDuringServiceMethod()
+ public void testApplicationScopeActiveDuringServiceMethod() throws Exception
{
- assert false;
+ WebClient webClient = new WebClient();
+ webClient.setThrowExceptionOnFailingStatusCode(true);
+ webClient.getPage(getContextPath() + "serviceMethodTest");
}
@Test(groups = { "stub", "contexts", "webservice", "integration" })
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ServiceMethodServlet.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ServiceMethodServlet.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ServiceMethodServlet.java 2009-03-26 21:29:53 UTC (rev 2220)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, 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.jsr299.tck.tests.context.application;
+
+import java.io.IOException;
+
+import javax.context.ApplicationScoped;
+import javax.inject.Current;
+import javax.inject.manager.Manager;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Servlet used just to test context during service method.
+ *
+ * @author David Allen
+ *
+ */
+public class ServiceMethodServlet extends HttpServlet
+{
+
+ private static final long serialVersionUID = 1L;
+
+ @Current
+ private Manager jsr299Manager;
+
+ @Override
+ protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ if (!jsr299Manager.getContext(ApplicationScoped.class).isActive())
+ {
+ throw new ServletException("Application context is not active");
+ }
+ else
+ {
+ super.service(req, resp);
+ }
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ resp.setContentType("text/text");
+ resp.getWriter().println("It worked!");
+ }
+
+ @Override
+ public void init() throws ServletException
+ {
+ //TODO Remove init code once injection works in servlet container
+ try
+ {
+ InitialContext ic = new InitialContext();
+ jsr299Manager = (Manager) ic.lookup("java:app/Manager");
+ }
+ catch (NamingException e)
+ {
+ throw new ServletException("Error looking up manager", e);
+ }
+ }
+
+ @Override
+ public void init(ServletConfig config) throws ServletException
+ {
+ init();
+ }
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ServiceMethodServlet.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/FilterTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/FilterTest.java 2009-03-26 18:06:38 UTC (rev 2219)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/FilterTest.java 2009-03-26 21:29:53 UTC (rev 2220)
@@ -6,23 +6,21 @@
import javax.inject.Current;
import javax.inject.manager.Manager;
import javax.naming.InitialContext;
-import javax.naming.NamingException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletResponse;
public class FilterTest implements Filter
{
-
@Current
private Manager jsr299Manager;
public void destroy()
{
+ jsr299Manager = null;
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
@@ -42,14 +40,13 @@
//TODO Remove init code once injection works in servlet container
try
{
- InitialContext ic = new InitialContext();
- jsr299Manager = (Manager) ic.lookup("java:app/Manager");
if (jsr299Manager == null)
{
- throw new ServletException("Failed to find the Manager in JNDI");
+ InitialContext ic = new InitialContext();
+ jsr299Manager = (Manager) ic.lookup("java:app/Manager");
}
}
- catch (NamingException e)
+ catch (Exception e)
{
throw new ServletException("Error looking up manager", e);
}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/IntrospectSession.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/IntrospectSession.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/IntrospectSession.java 2009-03-26 21:29:53 UTC (rev 2220)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, 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.jsr299.tck.tests.context.session;
+
+import java.io.IOException;
+
+import javax.inject.Current;
+import javax.inject.manager.Manager;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Used to process requests to check which session context is in use.
+ *
+ * @author David Allen
+ *
+ */
+public class IntrospectSession extends HttpServlet
+{
+ private static final long serialVersionUID = 1L;
+
+ @Current
+ private Manager jsr299Manager;
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ resp.setContentType("text/text");
+ SimpleSessionBean aBean = jsr299Manager.getInstanceByType(SimpleSessionBean.class);
+ resp.getWriter().print(aBean.hashCode());
+ }
+
+ @Override
+ public void init() throws ServletException
+ {
+ //TODO Remove init code once injection works in servlet container
+ try
+ {
+ InitialContext ic = new InitialContext();
+ jsr299Manager = (Manager) ic.lookup("java:app/Manager");
+ }
+ catch (NamingException e)
+ {
+ throw new ServletException("Error looking up manager", e);
+ }
+ }
+
+ @Override
+ public void init(ServletConfig config) throws ServletException
+ {
+ init();
+ }
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/IntrospectSession.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/InvalidateSession.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/InvalidateSession.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/InvalidateSession.java 2009-03-26 21:29:53 UTC (rev 2220)
@@ -0,0 +1,65 @@
+package org.jboss.jsr299.tck.tests.context.session;
+
+import java.io.IOException;
+
+import javax.inject.Current;
+import javax.inject.manager.Manager;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class InvalidateSession extends HttpServlet
+{
+ private static final long serialVersionUID = 1L;
+
+ @Current
+ private Manager jsr299Manager;
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ resp.setContentType("text/text");
+
+ if (req.getParameter("timeout") != null)
+ {
+ SimpleSessionBean.setBeanDestroyed(false);
+ jsr299Manager.getInstanceByType(SimpleSessionBean.class);
+ req.getSession().setMaxInactiveInterval(Integer.parseInt(req.getParameter("timeout")));
+ }
+ else if (req.getParameter("isBeanDestroyed") != null)
+ {
+ resp.getWriter().print(SimpleSessionBean.isBeanDestroyed());
+ }
+ else
+ {
+ SimpleSessionBean.setBeanDestroyed(false);
+ jsr299Manager.getInstanceByType(SimpleSessionBean.class);
+ req.getSession().invalidate();
+ }
+ }
+
+ @Override
+ public void init() throws ServletException
+ {
+ //TODO Remove init code once injection works in servlet container
+ try
+ {
+ InitialContext ic = new InitialContext();
+ jsr299Manager = (Manager) ic.lookup("java:app/Manager");
+ }
+ catch (NamingException e)
+ {
+ throw new ServletException("Error looking up manager", e);
+ }
+ }
+
+ @Override
+ public void init(ServletConfig config) throws ServletException
+ {
+ init();
+ }
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/InvalidateSession.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/ServiceMethodServlet.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/ServiceMethodServlet.java 2009-03-26 18:06:38 UTC (rev 2219)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/ServiceMethodServlet.java 2009-03-26 21:29:53 UTC (rev 2220)
@@ -72,10 +72,6 @@
{
InitialContext ic = new InitialContext();
jsr299Manager = (Manager) ic.lookup("java:app/Manager");
- if (jsr299Manager == null)
- {
- throw new ServletException("Failed to find the Manager in JNDI");
- }
}
catch (NamingException e)
{
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/SessionContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/SessionContextTest.java 2009-03-26 18:06:38 UTC (rev 2219)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/SessionContextTest.java 2009-03-26 21:29:53 UTC (rev 2220)
@@ -9,6 +9,7 @@
import org.jboss.testharness.impl.packaging.war.WarArtifactDescriptor;
import org.testng.annotations.Test;
+import com.gargoylesoftware.htmlunit.TextPage;
import com.gargoylesoftware.htmlunit.WebClient;
/**
@@ -23,7 +24,6 @@
})
public class SessionContextTest extends AbstractJSR299Test
{
-
@Test(groups = { "contexts", "servlet", "integration" })
@SpecAssertion(section = "8.5.2", id = "a")
public void testSessionScopeActiveDuringServiceMethod() throws Exception
@@ -42,25 +42,62 @@
webClient.getPage(getContextPath() + "SimplePage.html");
}
- @Test(groups = { "stub", "contexts", "servlet", "integration" })
+ @Test(groups = { "contexts", "servlet", "integration" })
@SpecAssertion(section = "8.5.2", id = "c")
public void testSessionContextSharedBetweenServletRequestsInSameHttpSession() throws Exception
{
- assert false;
+ WebClient webClient = new WebClient();
+ webClient.setThrowExceptionOnFailingStatusCode(true);
+ TextPage firstRequestResult = webClient.getPage(getContextPath() + "IntrospectSession");
+ assert firstRequestResult.getContent() != null;
+ assert Long.parseLong(firstRequestResult.getContent()) != 0;
+ // Make a second request and make sure the same context is used
+ TextPage secondRequestResult = webClient.getPage(getContextPath() + "IntrospectSession");
+ assert secondRequestResult.getContent() != null;
+ assert Long.parseLong(secondRequestResult.getContent()) == Long.parseLong(firstRequestResult.getContent());
}
- @Test(groups = { "stub", "contexts", "integration" })
+ @Test(groups = { "contexts", "integration" })
@SpecAssertion(section = "8.5.2", id = "d")
- public void testSessionContextDestroyedWhenHttpSessionInvalidated()
+ public void testSessionContextDestroyedWhenHttpSessionInvalidated() throws Exception
{
- assert false;
+ WebClient webClient = new WebClient();
+ webClient.setThrowExceptionOnFailingStatusCode(true);
+ TextPage firstRequestResult = webClient.getPage(getContextPath() + "IntrospectSession");
+ assert firstRequestResult.getContent() != null;
+ assert Long.parseLong(firstRequestResult.getContent()) != 0;
+ webClient.getPage(getContextPath() + "InvalidateSession");
+ // Make a second request and make sure the same context is not there
+ TextPage secondRequestResult = webClient.getPage(getContextPath() + "IntrospectSession");
+ assert secondRequestResult.getContent() != null;
+ assert Long.parseLong(secondRequestResult.getContent()) != Long.parseLong(firstRequestResult.getContent());
+
+ // As final confirmation that the context was destroyed, check that its beans
+ // were also destroyed.
+ TextPage beanDestructionResult = webClient.getPage(getContextPath() + "InvalidateSession?isBeanDestroyed");
+ assert Boolean.parseBoolean(beanDestructionResult.getContent());
}
- @Test(groups = { "stub", "contexts", "integration" })
+ @Test(groups = { "contexts", "integration" })
@SpecAssertion(section = "8.5.2", id = "e")
- public void testSessionContextDestroyedWhenHttpSessionTimesOut()
+ public void testSessionContextDestroyedWhenHttpSessionTimesOut() throws Exception
{
- assert false;
+ WebClient webClient = new WebClient();
+ webClient.setThrowExceptionOnFailingStatusCode(true);
+ TextPage firstRequestResult = webClient.getPage(getContextPath() + "IntrospectSession");
+ assert firstRequestResult.getContent() != null;
+ assert Long.parseLong(firstRequestResult.getContent()) != 0;
+ webClient.getPage(getContextPath() + "InvalidateSession?timeout=1");
+ Thread.sleep(1500);
+ // Make a second request and make sure the same context is not there
+ TextPage secondRequestResult = webClient.getPage(getContextPath() + "IntrospectSession");
+ assert secondRequestResult.getContent() != null;
+ assert Long.parseLong(secondRequestResult.getContent()) != Long.parseLong(firstRequestResult.getContent());
+
+ // As final confirmation that the context was destroyed, check that its beans
+ // were also destroyed.
+ TextPage beanDestructionResult = webClient.getPage(getContextPath() + "InvalidateSession?isBeanDestroyed");
+ assert Boolean.parseBoolean(beanDestructionResult.getContent());
}
}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/SimpleSessionBean.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/SimpleSessionBean.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/SimpleSessionBean.java 2009-03-26 21:29:53 UTC (rev 2220)
@@ -0,0 +1,30 @@
+package org.jboss.jsr299.tck.tests.context.session;
+
+import java.io.Serializable;
+
+import javax.annotation.PreDestroy;
+import javax.context.SessionScoped;
+
+@SessionScoped
+class SimpleSessionBean implements Serializable
+{
+
+ private static final long serialVersionUID = 1L;
+ private static boolean beanDestroyed = false;
+
+ @PreDestroy
+ public void destroyBean()
+ {
+ beanDestroyed = true;
+ }
+
+ public static boolean isBeanDestroyed()
+ {
+ return beanDestroyed;
+ }
+
+ public static void setBeanDestroyed(boolean beanDestroyed)
+ {
+ SimpleSessionBean.beanDestroyed = beanDestroyed;
+ }
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/SimpleSessionBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/application/web.xml (from rev 2212, tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/session/web.xml)
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/application/web.xml (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/application/web.xml 2009-03-26 21:29:53 UTC (rev 2220)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+ <description>Test servlets used to test session contexts.</description>
+ <display-name>Session Context Tests</display-name>
+ <listener>
+ <listener-class>org.jboss.testharness.impl.runner.servlet.HarnessServletListener</listener-class>
+ </listener>
+ <servlet>
+ <display-name>serviceMethod</display-name>
+ <servlet-name>service</servlet-name>
+ <servlet-class>org.jboss.jsr299.tck.tests.context.application.ServiceMethodServlet</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>service</servlet-name>
+ <url-pattern>/serviceMethodTest</url-pattern>
+ </servlet-mapping>
+ <session-config>
+ <session-timeout>10</session-timeout>
+ </session-config>
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ </login-config>
+</web-app>
Modified: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/session/web.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/session/web.xml 2009-03-26 18:06:38 UTC (rev 2219)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/session/web.xml 2009-03-26 21:29:53 UTC (rev 2220)
@@ -20,10 +20,28 @@
<servlet-name>service</servlet-name>
<servlet-class>org.jboss.jsr299.tck.tests.context.session.ServiceMethodServlet</servlet-class>
</servlet>
+ <servlet>
+ <display-name>Introspection Service for Sessions</display-name>
+ <servlet-name>sessionIntrospector</servlet-name>
+ <servlet-class>org.jboss.jsr299.tck.tests.context.session.IntrospectSession</servlet-class>
+ </servlet>
+ <servlet>
+ <display-name>Session Invalidation</display-name>
+ <servlet-name>invalidator</servlet-name>
+ <servlet-class>org.jboss.jsr299.tck.tests.context.session.InvalidateSession</servlet-class>
+ </servlet>
<servlet-mapping>
<servlet-name>service</servlet-name>
<url-pattern>/serviceMethodTest</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>sessionIntrospector</servlet-name>
+ <url-pattern>/IntrospectSession</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>invalidator</servlet-name>
+ <url-pattern>/InvalidateSession</url-pattern>
+ </servlet-mapping>
<session-config>
<session-timeout>10</session-timeout>
</session-config>
15 years, 5 months
[webbeans-commits] Webbeans SVN: r2219 - in examples/trunk: jsf2 and 11 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-26 14:06:38 -0400 (Thu, 26 Mar 2009)
New Revision: 2219
Added:
examples/trunk/jsf2/
examples/trunk/jsf2/WebContent/
examples/trunk/jsf2/WebContent/WEB-INF/
examples/trunk/jsf2/WebContent/WEB-INF/beans.xml
examples/trunk/jsf2/WebContent/WEB-INF/faces-config.xml
examples/trunk/jsf2/WebContent/WEB-INF/web.xml
examples/trunk/jsf2/WebContent/home.xhtml
examples/trunk/jsf2/WebContent/index.html
examples/trunk/jsf2/WebContent/style/
examples/trunk/jsf2/WebContent/template.xhtml
examples/trunk/jsf2/build.xml
examples/trunk/jsf2/pom.xml
examples/trunk/jsf2/src/
examples/trunk/jsf2/src/main/
examples/trunk/jsf2/src/main/java/
examples/trunk/jsf2/src/main/java/org/
examples/trunk/jsf2/src/main/java/org/jboss/
examples/trunk/jsf2/src/main/java/org/jboss/webbeans/
examples/trunk/jsf2/src/main/java/org/jboss/webbeans/examples/
examples/trunk/jsf2/src/main/java/org/jboss/webbeans/examples/numberguess/
examples/trunk/jsf2/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java
examples/trunk/jsf2/src/main/java/org/jboss/webbeans/examples/numberguess/Generator.java
examples/trunk/jsf2/src/main/java/org/jboss/webbeans/examples/numberguess/MaxNumber.java
examples/trunk/jsf2/src/main/java/org/jboss/webbeans/examples/numberguess/Random.java
examples/trunk/jsf2/src/main/resources/
examples/trunk/jsf2/src/main/resources/META-INF/
Modified:
examples/trunk/pom.xml
Log:
add jsf2 example stub
Property changes on: examples/trunk/jsf2
___________________________________________________________________
Name: svn:ignore
+ .classpath
target
.project
.settings
pom.xml.releaseBackup
Added: examples/trunk/jsf2/WebContent/WEB-INF/beans.xml
===================================================================
Added: examples/trunk/jsf2/WebContent/WEB-INF/faces-config.xml
===================================================================
--- examples/trunk/jsf2/WebContent/WEB-INF/faces-config.xml (rev 0)
+++ examples/trunk/jsf2/WebContent/WEB-INF/faces-config.xml 2009-03-26 18:06:38 UTC (rev 2219)
@@ -0,0 +1,11 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<faces-config version="1.2"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+
+ <application>
+ <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
+ </application>
+
+</faces-config>
Added: examples/trunk/jsf2/WebContent/WEB-INF/web.xml
===================================================================
--- examples/trunk/jsf2/WebContent/WEB-INF/web.xml (rev 0)
+++ examples/trunk/jsf2/WebContent/WEB-INF/web.xml 2009-03-26 18:06:38 UTC (rev 2219)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app version="2.5"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+
+ <display-name>Web Beans Numberguess example</display-name>
+
+ <!-- JSF -->
+
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+
+ <session-config>
+ <session-timeout>10</session-timeout>
+ </session-config>
+
+</web-app>
Added: examples/trunk/jsf2/WebContent/home.xhtml
===================================================================
--- examples/trunk/jsf2/WebContent/home.xhtml (rev 0)
+++ examples/trunk/jsf2/WebContent/home.xhtml 2009-03-26 18:06:38 UTC (rev 2219)
@@ -0,0 +1,34 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core">
+
+ <ui:composition template="template.xhtml">
+ <ui:define name="content">
+ <h1>Guess a number...</h1>
+ <h:form id="NumberGuessMain">
+ <div style="color: red">
+ <h:messages id="messages" globalOnly="false"/>
+ <h:outputText id="Higher" value="Higher!" rendered="#{game.number gt game.guess and game.guess ne 0}"/>
+ <h:outputText id="Lower" value="Lower!" rendered="#{game.number lt game.guess and game.guess ne 0}"/>
+ </div>
+
+ <div>
+ I'm thinking of a number between #{game.smallest} and #{game.biggest}. You have #{game.remainingGuesses} guesses.
+ </div>
+
+ <div>
+ Your guess:
+ <h:inputText id="inputGuess" value="#{game.guess}" required="true" size="3" disabled="#{game.number eq game.guess}">
+ <f:validateLongRange maximum="#{game.biggest}" minimum="#{game.smallest}"/>
+ </h:inputText>
+ <h:commandButton id="GuessButton" value="Guess" action="#{game.check}" disabled="#{game.number eq game.guess}"/>
+ </div>
+ <div>
+ <h:commandButton id="RestartButton" value="Reset" action="#{game.reset}" immediate="true" />
+ </div>
+ </h:form>
+ </ui:define>
+ </ui:composition>
+</html>
Added: examples/trunk/jsf2/WebContent/index.html
===================================================================
--- examples/trunk/jsf2/WebContent/index.html (rev 0)
+++ examples/trunk/jsf2/WebContent/index.html 2009-03-26 18:06:38 UTC (rev 2219)
@@ -0,0 +1,5 @@
+<html>
+<head>
+ <meta http-equiv="Refresh" content="0; URL=home.jsf">
+</head>
+</html>
\ No newline at end of file
Added: examples/trunk/jsf2/WebContent/template.xhtml
===================================================================
--- examples/trunk/jsf2/WebContent/template.xhtml (rev 0)
+++ examples/trunk/jsf2/WebContent/template.xhtml 2009-03-26 18:06:38 UTC (rev 2219)
@@ -0,0 +1,34 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core">
+
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <title>Numberguess</title>
+ <link href="style/main.css" rel="stylesheet" type="text/css"/>
+ <ui:insert name="head"/>
+</head>
+
+<body>
+
+ <div id="container">
+ <div id="header">
+
+ </div>
+
+ <div id="sidebar">
+
+ </div>
+
+ <div id="content">
+ <ui:insert name="content"/>
+ </div>
+
+ <br style="clear:both"/>
+ </div>
+
+</body>
+</html>
+
Added: examples/trunk/jsf2/build.xml
===================================================================
--- examples/trunk/jsf2/build.xml (rev 0)
+++ examples/trunk/jsf2/build.xml 2009-03-26 18:06:38 UTC (rev 2219)
@@ -0,0 +1,7 @@
+<project basedir="." name="Numberguess Example Build" default="restart">
+
+ <property name="example.name" value="webbeans-numberguess" />
+
+ <import file="../build.xml" />
+
+</project>
\ No newline at end of file
Added: examples/trunk/jsf2/pom.xml
===================================================================
--- examples/trunk/jsf2/pom.xml (rev 0)
+++ examples/trunk/jsf2/pom.xml 2009-03-26 18:06:38 UTC (rev 2219)
@@ -0,0 +1,84 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.jboss.webbeans.examples</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.jboss.webbeans.examples</groupId>
+ <artifactId>webbeans-numberguess-jsf2</artifactId>
+ <packaging>war</packaging>
+ <name>Web Beans Examples: Numberguess for JSF2</name>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>codehaus snapshot repository</id>
+ <url>http://snapshots.repository.codehaus.org/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <scope>test</scope>
+ <classifier>jdk15</classifier>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.webbeans</groupId>
+ <artifactId>jsr299-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.facelets</groupId>
+ <artifactId>jsf-facelets</artifactId>
+ </dependency>
+
+ <!-- <dependency>
+ <groupId>org.jboss.el</groupId>
+ <artifactId>jboss-el</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>-->
+
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-ri</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>jsr250-api</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>webbeans-numberguess-jsf2</finalName>
+ </build>
+
+</project>
+
Added: examples/trunk/jsf2/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java
===================================================================
--- examples/trunk/jsf2/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java (rev 0)
+++ examples/trunk/jsf2/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java 2009-03-26 18:06:38 UTC (rev 2219)
@@ -0,0 +1,94 @@
+package org.jboss.webbeans.examples.numberguess;
+
+
+import java.io.Serializable;
+
+import javax.annotation.Named;
+import javax.annotation.PostConstruct;
+import javax.context.SessionScoped;
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+import javax.inject.AnnotationLiteral;
+import javax.inject.Current;
+import javax.inject.manager.Manager;
+
+@Named
+@SessionScoped
+public class Game implements Serializable
+{
+ private int number;
+
+ private int guess;
+ private int smallest;
+
+ @MaxNumber
+ private int maxNumber;
+
+ private int biggest;
+ private int remainingGuesses;
+
+ @Current Manager manager;
+
+ public Game()
+ {
+ }
+
+ public int getNumber()
+ {
+ return number;
+ }
+
+ public int getGuess()
+ {
+ return guess;
+ }
+
+ public void setGuess(int guess)
+ {
+ this.guess = guess;
+ }
+
+ public int getSmallest()
+ {
+ return smallest;
+ }
+
+ public int getBiggest()
+ {
+ return biggest;
+ }
+
+ public int getRemainingGuesses()
+ {
+ return remainingGuesses;
+ }
+
+ public String check() throws InterruptedException
+ {
+ if (guess>number)
+ {
+ biggest = guess - 1;
+ }
+ if (guess<number)
+ {
+ smallest = guess + 1;
+ }
+ if (guess == number)
+ {
+ FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Correct!"));
+ }
+ remainingGuesses--;
+ return null;
+ }
+
+ @PostConstruct
+ public void reset()
+ {
+ this.smallest = 0;
+ this.guess = 0;
+ this.remainingGuesses = 10;
+ this.biggest = maxNumber;
+ this.number = manager.getInstanceByType(Integer.class, new AnnotationLiteral<Random>(){});
+ }
+
+}
Added: examples/trunk/jsf2/src/main/java/org/jboss/webbeans/examples/numberguess/Generator.java
===================================================================
--- examples/trunk/jsf2/src/main/java/org/jboss/webbeans/examples/numberguess/Generator.java (rev 0)
+++ examples/trunk/jsf2/src/main/java/org/jboss/webbeans/examples/numberguess/Generator.java 2009-03-26 18:06:38 UTC (rev 2219)
@@ -0,0 +1,33 @@
+package org.jboss.webbeans.examples.numberguess;
+
+
+import java.io.Serializable;
+
+import javax.context.ApplicationScoped;
+import javax.inject.Produces;
+
+@ApplicationScoped
+public class Generator implements Serializable
+{
+
+ private static final long serialVersionUID = -7213673465118041882L;
+
+ private java.util.Random random = new java.util.Random( System.currentTimeMillis() );
+
+ private int maxNumber = 100;
+
+ java.util.Random getRandom()
+ {
+ return random;
+ }
+
+ @Produces @Random int next() {
+ return getRandom().nextInt(maxNumber);
+ }
+
+ @Produces @MaxNumber int getMaxNumber()
+ {
+ return maxNumber;
+ }
+
+}
Added: examples/trunk/jsf2/src/main/java/org/jboss/webbeans/examples/numberguess/MaxNumber.java
===================================================================
--- examples/trunk/jsf2/src/main/java/org/jboss/webbeans/examples/numberguess/MaxNumber.java (rev 0)
+++ examples/trunk/jsf2/src/main/java/org/jboss/webbeans/examples/numberguess/MaxNumber.java 2009-03-26 18:06:38 UTC (rev 2219)
@@ -0,0 +1,23 @@
+package org.jboss.webbeans.examples.numberguess;
+
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.BindingType;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+public @interface MaxNumber
+{
+
+}
Added: examples/trunk/jsf2/src/main/java/org/jboss/webbeans/examples/numberguess/Random.java
===================================================================
--- examples/trunk/jsf2/src/main/java/org/jboss/webbeans/examples/numberguess/Random.java (rev 0)
+++ examples/trunk/jsf2/src/main/java/org/jboss/webbeans/examples/numberguess/Random.java 2009-03-26 18:06:38 UTC (rev 2219)
@@ -0,0 +1,23 @@
+package org.jboss.webbeans.examples.numberguess;
+
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.BindingType;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+public @interface Random
+{
+
+}
Modified: examples/trunk/pom.xml
===================================================================
--- examples/trunk/pom.xml 2009-03-26 17:36:33 UTC (rev 2218)
+++ examples/trunk/pom.xml 2009-03-26 18:06:38 UTC (rev 2219)
@@ -46,6 +46,7 @@
<modules>
<module>numberguess</module>
+ <module>jsf2</module>
<module>translator</module>
<module>login</module>
<module>conversations</module>
15 years, 5 months