Seam SVN: r12786 - modules/xml/trunk/docs/en-US.
by seam-commits@lists.jboss.org
Author: swd847
Date: 2010-05-24 17:47:00 -0400 (Mon, 24 May 2010)
New Revision: 12786
Modified:
modules/xml/trunk/docs/en-US/xml-general.xml
Log:
updated docs for SEAMXML-2
Modified: modules/xml/trunk/docs/en-US/xml-general.xml
===================================================================
--- modules/xml/trunk/docs/en-US/xml-general.xml 2010-05-24 21:40:30 UTC (rev 12785)
+++ modules/xml/trunk/docs/en-US/xml-general.xml 2010-05-24 21:47:00 UTC (rev 12786)
@@ -67,6 +67,17 @@
to resolve classes in the java package <literal>org.jboss.seam.xml.test.injection</literal>,
so in the example above <literal><test:ProducerBean></literal> resolves to
<literal>org.jboss.seam.xml.test.injection.ProducerBean</literal>.</para>
+
+ <para>It is possible to map an XML namespace to multiple java packages. This is
+ done by sperating the packages with a colon like so:</para>
+ <programlisting>
+ <![CDATA[
+ xmlns:test="urn:java:com.mydomain.package1:com.mydomain.package2"
+ ]]>
+ </programlisting>
+ <para>The namespaces are searched in the order they are specified in the xml
+ document.</para>
+
<programlisting>
<![CDATA[
<test:ProducerQualifier>
14 years
Seam SVN: r12785 - modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/fieldset.
by seam-commits@lists.jboss.org
Author: swd847
Date: 2010-05-24 17:40:30 -0400 (Mon, 24 May 2010)
New Revision: 12785
Modified:
modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/fieldset/ArrayFieldValue.java
modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/fieldset/MapFieldValue.java
Log:
updated tests to test for SEAMXML-4
Modified: modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/fieldset/ArrayFieldValue.java
===================================================================
--- modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/fieldset/ArrayFieldValue.java 2010-05-24 20:17:59 UTC (rev 12784)
+++ modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/fieldset/ArrayFieldValue.java 2010-05-24 21:40:30 UTC (rev 12785)
@@ -7,6 +7,6 @@
public class ArrayFieldValue
{
public int[] iarray;
- public Class[] carray;
+ public Class<?>[] carray;
public String[] sarray;
}
Modified: modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/fieldset/MapFieldValue.java
===================================================================
--- modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/fieldset/MapFieldValue.java 2010-05-24 20:17:59 UTC (rev 12784)
+++ modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/fieldset/MapFieldValue.java 2010-05-24 21:40:30 UTC (rev 12785)
@@ -10,5 +10,5 @@
{
public Map<Integer, String> map1;
- public Map<String, Class> map2;
+ public Map<String, Class<?>> map2;
}
14 years
Seam SVN: r12784 - in modules: faces/trunk/impl/src/test/java/org/jboss/seam/faces/context and 8 other directories.
by seam-commits@lists.jboss.org
Author: lincolnthree
Date: 2010-05-24 16:17:59 -0400 (Mon, 24 May 2010)
New Revision: 12784
Added:
modules/international/trunk/impl/src/test/java/org/jboss/seam/international/status/
modules/international/trunk/impl/src/test/java/org/jboss/seam/international/status/builder/
modules/international/trunk/impl/src/test/java/org/jboss/seam/international/status/builder/TemplateMessageTest.java
Removed:
modules/international/trunk/api/src/test/java/org/jboss/seam/international/status/builder/
modules/international/trunk/impl/src/test/java/org/jboss/seam/international/status/builder/TemplateMessageTest.java
Modified:
modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/context/FacesAnnotationsAdapterExtensionTest.java
modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/context/conversation/ConversationBoundaryInterceptorTest.java
modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/environment/ExternalContextProducerTest.java
modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/environment/FacesContextProducerTest.java
modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/PhaseEventBridgeTest.java
modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/SystemEventBridgeTest.java
modules/faces/trunk/pom.xml
modules/international/trunk/pom.xml
Log:
Updated Arquillian Version -- i18n module still not building due to integration bugs between XML module and Arquillian.
Modified: modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/context/FacesAnnotationsAdapterExtensionTest.java
===================================================================
--- modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/context/FacesAnnotationsAdapterExtensionTest.java 2010-05-24 16:00:44 UTC (rev 12783)
+++ modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/context/FacesAnnotationsAdapterExtensionTest.java 2010-05-24 20:17:59 UTC (rev 12784)
@@ -18,7 +18,7 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.seam.faces.context;
import static org.junit.Assert.assertTrue;
@@ -26,7 +26,7 @@
import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.ArchivePaths;
-import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
import org.junit.Test;
@@ -42,7 +42,7 @@
@Deployment
public static JavaArchive createTestArchive()
{
- return Archives.create("test.jar", JavaArchive.class).addClasses(ImproperlyAnnotatedBean.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
+ return ShrinkWrap.create("test.jar", JavaArchive.class).addClasses(ImproperlyAnnotatedBean.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
}
@Test
Modified: modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/context/conversation/ConversationBoundaryInterceptorTest.java
===================================================================
--- modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/context/conversation/ConversationBoundaryInterceptorTest.java 2010-05-24 16:00:44 UTC (rev 12783)
+++ modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/context/conversation/ConversationBoundaryInterceptorTest.java 2010-05-24 20:17:59 UTC (rev 12784)
@@ -18,7 +18,7 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.seam.faces.context.conversation;
import static org.junit.Assert.assertEquals;
@@ -33,7 +33,7 @@
import org.jboss.seam.faces.MockConversation;
import org.jboss.seam.faces.MockLogger;
import org.jboss.shrinkwrap.api.ArchivePaths;
-import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -48,7 +48,7 @@
@Deployment
public static JavaArchive createTestArchive()
{
- return Archives.create("test.jar", JavaArchive.class).addClasses(ConversationBoundaryInterceptor.class, ConversationalBean.class, MockLogger.class, MockConversation.class).addManifestResource(ConversationBoundaryInterceptorTest.class.getPackage().getName().replaceAll("\\.", "/") + "/ConversationBoundaryInterceptorTest-beans.xml", ArchivePaths.create("beans.xml"));
+ return ShrinkWrap.create("test.jar", JavaArchive.class).addClasses(ConversationBoundaryInterceptor.class, ConversationalBean.class, MockLogger.class, MockConversation.class).addManifestResource(ConversationBoundaryInterceptorTest.class.getPackage().getName().replaceAll("\\.", "/") + "/ConversationBoundaryInterceptorTest-beans.xml", ArchivePaths.create("beans.xml"));
}
@Inject
Modified: modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/environment/ExternalContextProducerTest.java
===================================================================
--- modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/environment/ExternalContextProducerTest.java 2010-05-24 16:00:44 UTC (rev 12783)
+++ modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/environment/ExternalContextProducerTest.java 2010-05-24 20:17:59 UTC (rev 12784)
@@ -18,7 +18,7 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.seam.faces.environment;
import javax.enterprise.context.ContextNotActiveException;
@@ -33,7 +33,7 @@
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ArchivePaths;
-import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
import org.junit.Test;
@@ -51,7 +51,7 @@
@Deployment
public static Archive<?> createTestArchive()
{
- return Archives.create("test.jar", JavaArchive.class).addClass(FacesContextProducer.class).addClass(ExternalContextProducer.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
+ return ShrinkWrap.create("test.jar", JavaArchive.class).addClass(FacesContextProducer.class).addClass(ExternalContextProducer.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
}
@Inject
Modified: modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/environment/FacesContextProducerTest.java
===================================================================
--- modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/environment/FacesContextProducerTest.java 2010-05-24 16:00:44 UTC (rev 12783)
+++ modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/environment/FacesContextProducerTest.java 2010-05-24 20:17:59 UTC (rev 12784)
@@ -18,7 +18,7 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.seam.faces.environment;
import javax.enterprise.context.ContextNotActiveException;
@@ -33,7 +33,7 @@
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ArchivePaths;
-import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
import org.junit.Test;
@@ -41,8 +41,7 @@
/**
* Verify that the FacesContextProducer produces the same FacesContext as
- * returned by FacesContext#getCurrentInstance() and by the CDI producer
- * method.
+ * returned by FacesContext#getCurrentInstance() and by the CDI producer method.
*
* @author Dan Allen
*/
@@ -52,7 +51,7 @@
@Deployment
public static Archive<?> createTestArchive()
{
- return Archives.create("test.jar", JavaArchive.class).addClass(FacesContextProducer.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
+ return ShrinkWrap.create("test.jar", JavaArchive.class).addClass(FacesContextProducer.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
}
@Inject
Modified: modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/PhaseEventBridgeTest.java
===================================================================
--- modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/PhaseEventBridgeTest.java 2010-05-24 16:00:44 UTC (rev 12783)
+++ modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/PhaseEventBridgeTest.java 2010-05-24 20:17:59 UTC (rev 12784)
@@ -18,7 +18,7 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.seam.faces.event;
import java.util.ArrayList;
@@ -32,7 +32,7 @@
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.seam.faces.MockLogger;
import org.jboss.shrinkwrap.api.ArchivePaths;
-import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
import org.jboss.test.faces.mock.context.MockFacesContext;
@@ -44,7 +44,7 @@
/**
*
* @author Nicklas Karlsson
- *
+ *
*/
@RunWith(Arquillian.class)
public class PhaseEventBridgeTest
@@ -66,7 +66,7 @@
@Deployment
public static JavaArchive createTestArchive()
{
- return Archives.create("test.jar", JavaArchive.class).addClasses(MockPhaseEventObserver.class, PhaseEventBridge.class, BeanManagerAware.class, MockLogger.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
+ return ShrinkWrap.create("test.jar", JavaArchive.class).addClasses(MockPhaseEventObserver.class, PhaseEventBridge.class, BeanManagerAware.class, MockLogger.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
}
@Inject
@@ -88,7 +88,7 @@
fireBeforePhases(ALL_PHASES);
}
- private void fireBeforePhases(List<PhaseId> phases)
+ private void fireBeforePhases(final List<PhaseId> phases)
{
for (PhaseId phaseId : phases)
{
@@ -96,7 +96,7 @@
}
}
- private void fireBeforePhase(PhaseId phaseId)
+ private void fireBeforePhase(final PhaseId phaseId)
{
phaseEventBridge.beforePhase(new PhaseEvent(facesContext, phaseId, lifecycle));
}
@@ -106,7 +106,7 @@
fireAfterPhases(ALL_PHASES);
}
- private void fireAfterPhases(List<PhaseId> phases)
+ private void fireAfterPhases(final List<PhaseId> phases)
{
for (PhaseId phaseId : phases)
{
@@ -114,7 +114,7 @@
}
}
- private void fireAfterPhase(PhaseId phaseId)
+ private void fireAfterPhase(final PhaseId phaseId)
{
phaseEventBridge.afterPhase(new PhaseEvent(facesContext, phaseId, lifecycle));
}
Modified: modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/SystemEventBridgeTest.java
===================================================================
--- modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/SystemEventBridgeTest.java 2010-05-24 16:00:44 UTC (rev 12783)
+++ modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/SystemEventBridgeTest.java 2010-05-24 20:17:59 UTC (rev 12784)
@@ -48,7 +48,7 @@
import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.ArchivePaths;
-import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
import org.jboss.test.faces.mock.application.MockApplication;
@@ -69,7 +69,7 @@
@Deployment
public static JavaArchive createTestArchive()
{
- return Archives.create("test.jar", JavaArchive.class).addClasses(SystemEventObserver.class, SystemEventBridge.class, BeanManagerAware.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
+ return ShrinkWrap.create("test.jar", JavaArchive.class).addClasses(SystemEventObserver.class, SystemEventBridge.class, BeanManagerAware.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
}
@Inject
@@ -156,7 +156,7 @@
{
fireAndAssert("11", new PostValidateEvent(component));
}
-
+
@Test
public void testObservePostAddToView()
{
@@ -167,19 +167,19 @@
public void testObservePostAddToViewComponent()
{
fireAndAssert("13", new PostAddToViewEvent(component));
- }
-
+ }
+
@Test
public void testObservePostConstructViewMap()
{
fireAndAssert("14", new PostConstructViewMapEvent(uiViewRoot));
}
-
+
@Test
public void testObservePostConstructSpecificViewMap()
{
fireAndAssert("14a", new PostConstructViewMapEvent(uiViewRoot));
- }
+ }
@Test
public void testObservePostRestoreState()
@@ -191,20 +191,20 @@
public void testObservePostRestoreStateComponent()
{
fireAndAssert("16", new PostRestoreStateEvent(component));
- }
-
+ }
+
@Test
public void testObservePreDestroyViewMap()
{
fireAndAssert("17", new PreDestroyViewMapEvent(uiViewRoot));
- }
-
+ }
+
@Test
public void testObservePreDestroySpecificViewMap()
{
fireAndAssert("17a", new PreDestroyViewMapEvent(uiViewRoot));
- }
-
+ }
+
@Test
public void testObservePreRemoveFromView()
{
@@ -215,8 +215,8 @@
public void testObservePreRemoveFromViewComponent()
{
fireAndAssert("19", new PreRemoveFromViewEvent(component));
- }
-
+ }
+
@Test
public void testObservePreRenderComponent()
{
@@ -227,25 +227,25 @@
public void testObservePreRenderComponentComponent()
{
fireAndAssert("21", new PreRenderComponentEvent(component));
- }
-
+ }
+
@Test
public void testObservePreRenderView()
{
fireAndAssert("22", new PreRenderViewEvent(uiViewRoot));
- }
-
+ }
+
@Test
public void testObservePreRenderSpecificView()
{
fireAndAssert("23", new PreRenderViewEvent(uiViewRoot));
- }
-
-
- private void fireAndAssert(String caseId, SystemEvent... events)
+ }
+
+ private void fireAndAssert(final String caseId, final SystemEvent... events)
{
observer.reset();
- for (SystemEvent e : events) {
+ for (SystemEvent e : events)
+ {
listener.processEvent(e);
}
observer.assertObservations(caseId, events);
Modified: modules/faces/trunk/pom.xml
===================================================================
--- modules/faces/trunk/pom.xml 2010-05-24 16:00:44 UTC (rev 12783)
+++ modules/faces/trunk/pom.xml 2010-05-24 20:17:59 UTC (rev 12784)
@@ -31,15 +31,17 @@
<properties>
<seam.i18n.version>3.0.0-SNAPSHOT</seam.i18n.version>
- <arquillian.version>1.0.0.Alpha1</arquillian.version>
+ <weldx.version>1.0.0.Alpha2</weldx.version>
+
+ <arquillian.version>1.0.0.Alpha2</arquillian.version>
+ <jsfunit.version>1.2.0.Final</jsfunit.version>
<jsfmock.version>1.0.0</jsfmock.version>
- <jsfunit.version>1.2.0.Final</jsfunit.version>
- <weldx.version>1.0.0-SNAPSHOT</weldx.version>
<weld.api.version>1.0-SP1</weld.api.version>
+ <weld.core.version>1.0.1-Final</weld.core.version>
<junit.version>4.8.1</junit.version>
+ <slf4j.version>1.5.10</slf4j.version>
<emma.maven.plugin.version>1.0-alpha-2</emma.maven.plugin.version>
<emma4it.maven.plugin.version>1.3</emma4it.maven.plugin.version>
- <slf4j.version>1.5.10</slf4j.version>
</properties>
<dependencyManagement>
@@ -54,6 +56,14 @@
</dependencies>
</dependencyManagement>
+ <repositories>
+ <repository>
+ <id>jboss-public-repository-group</id>
+ <name>JBoss Public Maven Repository Group</name>
+ <url>https://repository.jboss.org/nexus/content/groups/public/</url>
+ </repository>
+ </repositories>
+
<dependencies>
<dependency>
<groupId>org.jboss.seam.international</groupId>
@@ -116,6 +126,19 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-core</artifactId>
+ <version>${weld.core.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>${slf4j.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.jboss.test-jsf</groupId>
<artifactId>jsf-mock</artifactId>
<version>${jsfmock.version}</version>
@@ -247,10 +270,8 @@
</developers>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/seam/modules/faces/trunk
- </connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/seam/modules/faces/trunk
- </developerConnection>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/seam/modules/faces/trunk </connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/seam/modules/faces/trunk </developerConnection>
<url>http://fisheye.jboss.org/browse/Seam/modules/faces/trunk</url>
</scm>
</project>
Copied: modules/international/trunk/impl/src/test/java/org/jboss/seam/international/status/builder (from rev 12781, modules/international/trunk/api/src/test/java/org/jboss/seam/international/status/builder)
Deleted: modules/international/trunk/impl/src/test/java/org/jboss/seam/international/status/builder/TemplateMessageTest.java
===================================================================
--- modules/international/trunk/api/src/test/java/org/jboss/seam/international/status/builder/TemplateMessageTest.java 2010-05-24 15:43:41 UTC (rev 12781)
+++ modules/international/trunk/impl/src/test/java/org/jboss/seam/international/status/builder/TemplateMessageTest.java 2010-05-24 20:17:59 UTC (rev 12784)
@@ -1,87 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.international.status.builder;
-
-import static org.junit.Assert.assertEquals;
-
-import javax.inject.Inject;
-
-import org.jboss.arquillian.api.Deployment;
-import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.seam.international.status.Bundles;
-import org.jboss.seam.international.status.MessageFactory;
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.ArchivePaths;
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
- *
- */
-(a)RunWith(Arquillian.class)
-public class TemplateMessageTest
-{
- @Deployment
- public static Archive<?> createTestArchive()
- {
- return ShrinkWrap.create("test.jar", JavaArchive.class).addClasses(MessageFactory.class, Bundles.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
- }
-
- @Inject
- MessageFactory factory;
-
- @Test
- public void testParameterizedTemplate() throws Exception
- {
- String expected = "There are 5 cars, and they are all green; green is the best color.";
- TemplateMessage builder = factory.info("There are {0} cars, and they are all {1}; {1} is the best color.", 5, "green");
- assertEquals(expected, builder.build().getText());
- }
-
- @Test
- public void testParameterizedTemplateInsertsParamNumbersIfNotEnoughParamValues() throws Exception
- {
- String expected = "There are 5 cars, and they are all {1}; {1} is the best color.";
- TemplateMessage builder = factory.warn("There are {0} cars, and they are all {1}; {1} is the best color.", 5);
- assertEquals(expected, builder.build().getText());
- }
-
- @Test
- public void testPlainTextTemplate() throws Exception
- {
- String expected = "There are 5 cars, and they are all green; green is the best color.";
- TemplateMessage builder = factory.error("There are 5 cars, and they are all green; green is the best color.");
- assertEquals(expected, builder.build().getText());
- }
-
- @Test
- public void testPlainTextTemplateWithParamsIsUnmodified() throws Exception
- {
- String expected = "There are 5 cars, and they are all green; green is the best color.";
- TemplateMessage builder = factory.fatal("There are 5 cars, and they are all green; green is the best color.", "blue", "red", 6);
- assertEquals(expected, builder.build().getText());
- }
-}
Copied: modules/international/trunk/impl/src/test/java/org/jboss/seam/international/status/builder/TemplateMessageTest.java (from rev 12783, modules/international/trunk/api/src/test/java/org/jboss/seam/international/status/builder/TemplateMessageTest.java)
===================================================================
--- modules/international/trunk/impl/src/test/java/org/jboss/seam/international/status/builder/TemplateMessageTest.java (rev 0)
+++ modules/international/trunk/impl/src/test/java/org/jboss/seam/international/status/builder/TemplateMessageTest.java 2010-05-24 20:17:59 UTC (rev 12784)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.international.status.builder;
+
+import static org.junit.Assert.assertEquals;
+
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.international.status.Bundles;
+import org.jboss.seam.international.status.MessageFactory;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ */
+(a)RunWith(Arquillian.class)
+public class TemplateMessageTest
+{
+ @Deployment
+ public static Archive<?> createTestArchive()
+ {
+ return ShrinkWrap.create("test.jar", JavaArchive.class).addClasses(MessageFactory.class, Bundles.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
+ }
+
+ @Inject
+ MessageFactory factory;
+
+ @Test
+ public void testParameterizedTemplate() throws Exception
+ {
+ String expected = "There are 5 cars, and they are all green; green is the best color.";
+ TemplateMessage builder = factory.info("There are {0} cars, and they are all {1}; {1} is the best color.", 5, "green");
+ assertEquals(expected, builder.build().getText());
+ }
+
+ @Test
+ public void testParameterizedTemplateInsertsParamNumbersIfNotEnoughParamValues() throws Exception
+ {
+ String expected = "There are 5 cars, and they are all {1}; {1} is the best color.";
+ TemplateMessage builder = factory.warn("There are {0} cars, and they are all {1}; {1} is the best color.", 5);
+ assertEquals(expected, builder.build().getText());
+ }
+
+ @Test
+ public void testPlainTextTemplate() throws Exception
+ {
+ String expected = "There are 5 cars, and they are all green; green is the best color.";
+ TemplateMessage builder = factory.error("There are 5 cars, and they are all green; green is the best color.");
+ assertEquals(expected, builder.build().getText());
+ }
+
+ @Test
+ public void testPlainTextTemplateWithParamsIsUnmodified() throws Exception
+ {
+ String expected = "There are 5 cars, and they are all green; green is the best color.";
+ TemplateMessage builder = factory.fatal("There are 5 cars, and they are all green; green is the best color.", "blue", "red", 6);
+ assertEquals(expected, builder.build().getText());
+ }
+}
Modified: modules/international/trunk/pom.xml
===================================================================
--- modules/international/trunk/pom.xml 2010-05-24 16:00:44 UTC (rev 12783)
+++ modules/international/trunk/pom.xml 2010-05-24 20:17:59 UTC (rev 12784)
@@ -1,230 +1,253 @@
<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>
+ 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.weld</groupId>
- <artifactId>weld-parent</artifactId>
- <version>9</version>
- </parent>
+ <parent>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-parent</artifactId>
+ <version>9</version>
+ </parent>
- <artifactId>seam-international-parent</artifactId>
- <groupId>org.jboss.seam.international</groupId>
- <version>3.0.0-SNAPSHOT</version>
+ <artifactId>seam-international-parent</artifactId>
+ <groupId>org.jboss.seam.international</groupId>
+ <version>3.0.0-SNAPSHOT</version>
- <packaging>pom</packaging>
- <name>Seam International Module Parent POM</name>
+ <packaging>pom</packaging>
+ <name>Seam International Module Parent POM</name>
- <description>The Parent for Seam International Module</description>
- <url>http://www.seamframework.org</url>
+ <description>The Parent for Seam International Module</description>
+ <url>http://www.seamframework.org</url>
- <modules>
- <module>api</module>
- <module>impl</module>
- <!--module>docs</module-->
- <!--module>examples/??</module-->
- </modules>
+ <modules>
+ <module>api</module>
+ <module>impl</module>
+ <!--module>docs</module-->
+ <!--module>examples/??</module-->
+ </modules>
- <properties>
- <arquillian.version>1.0.0-SNAPSHOT</arquillian.version>
- <seam.xml.version>3.0.0-SNAPSHOT</seam.xml.version>
- <weld.extensions.version>1.0.0.Alpha2</weld.extensions.version>
- <weld.api.version>1.0-SP1</weld.api.version>
- <junit.version>4.8.1</junit.version>
- <slf4j.version>1.5.10</slf4j.version>
- <joda-time.version>1.6</joda-time.version>
- <pretty-time.version>1.0.6</pretty-time.version>
- <commons-lang.version>2.5</commons-lang.version>
- <emma.maven.plugin.version>1.0-alpha-2</emma.maven.plugin.version>
- <emma4it.maven.plugin.version>1.3</emma4it.maven.plugin.version>
- </properties>
+ <properties>
+ <seam.xml.version>3.0.0-SNAPSHOT</seam.xml.version>
+ <weldx.version>1.0.0.Alpha2</weldx.version>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.jboss.weld</groupId>
- <artifactId>weld-api-bom</artifactId>
- <version>${weld.api.version}</version>
- <scope>import</scope>
- <type>pom</type>
- </dependency>
- </dependencies>
- </dependencyManagement>
+ <arquillian.version>1.0.0.Alpha2</arquillian.version>
+ <weld.api.version>1.0-SP1</weld.api.version>
+ <weld.core.version>1.0.1-Final</weld.core.version>
+ <junit.version>4.8.1</junit.version>
+ <slf4j.version>1.5.10</slf4j.version>
+ <joda-time.version>1.6</joda-time.version>
+ <pretty-time.version>1.0.6</pretty-time.version>
+ <commons-lang.version>2.5</commons-lang.version>
+ <emma.maven.plugin.version>1.0-alpha-2</emma.maven.plugin.version>
+ <emma4it.maven.plugin.version>1.3</emma4it.maven.plugin.version>
+ </properties>
- <dependencies>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-api-bom</artifactId>
+ <version>${weld.api.version}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
- <!-- Environment Dependencies -->
- <dependency>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.enterprise</groupId>
- <artifactId>cdi-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.weld</groupId>
- <artifactId>weld-extensions</artifactId>
- <version>${weld.extensions.version}</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>${slf4j.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>joda-time</groupId>
- <artifactId>joda-time</artifactId>
- <version>${joda-time.version}</version>
- </dependency>
- <dependency>
- <groupId>com.ocpsoft</groupId>
- <artifactId>ocpsoft-pretty-time</artifactId>
- <version>${pretty-time.version}</version>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>${commons-lang.version}</version>
- </dependency>
+ <repositories>
+ <repository>
+ <id>jboss-public-repository-group</id>
+ <name>JBoss Public Maven Repository Group</name>
+ <url>https://repository.jboss.org/nexus/content/groups/public/</url>
+ </repository>
+ </repositories>
- <!-- Test Dependencies -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.arquillian</groupId>
- <artifactId>arquillian-junit</artifactId>
- <version>${arquillian.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.arquillian.container</groupId>
- <artifactId>arquillian-weld-embedded</artifactId>
- <version>${arquillian.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.seam.xml</groupId>
- <artifactId>seam-xml-bean-config</artifactId>
- <version>${seam.xml.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <dependencies>
- <developers>
- <developer>
- <name>Lincoln Baxter, III</name>
- <email>lincolnbaxter(a)gmail.com</email>
- <url>http://ocpsoft.com</url>
- <organization>JBoss, by Red Hat</organization>
- <organizationUrl>http://jboss.org</organizationUrl>
- <timezone>EST</timezone>
- <roles>
- <role>Project Lead</role>
- </roles>
- </developer>
- <developer>
- <name>Ken Finnigan</name>
- <timezone>GMT</timezone>
- <roles>
- <role>Project Lead</role>
- </roles>
- </developer>
- </developers>
+ <!-- Environment Dependencies -->
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-extensions</artifactId>
+ <version>${weldx.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>joda-time</groupId>
+ <artifactId>joda-time</artifactId>
+ <version>${joda-time.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.ocpsoft</groupId>
+ <artifactId>ocpsoft-pretty-time</artifactId>
+ <version>${pretty-time.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>${commons-lang.version}</version>
+ </dependency>
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/seam/modules/international/trunk</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/seam/modules/international/trunk</developerConnection>
- <url>http://fisheye.jboss.org/browse/Seam/modules/international/trunk</url>
- </scm>
+ <!-- Test Dependencies -->
+ <dependency>
+ <groupId>org.jboss.seam.xml</groupId>
+ <artifactId>seam-xml-bean-config</artifactId>
+ <version>${seam.xml.version}</version>
+ <scope>test</scope>
+ </dependency>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.0.2</version>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-junit</artifactId>
+ <version>${arquillian.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-weld-embedded</artifactId>
+ <version>${arquillian.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-core</artifactId>
+ <version>${weld.core.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>${slf4j.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
- <profiles>
- <profile>
- <id>code-coverage</id>
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>emma-maven-plugin</artifactId>
- <version>${emma.maven.plugin.version}</version>
- <inherited>true</inherited>
- <executions>
- <execution>
- <id>instrumentation</id>
- <phase>process-classes</phase>
- <goals>
- <goal>instrument</goal>
- </goals>
- <configuration>
- <verbose>true</verbose>
- </configuration>
- </execution>
- <execution>
- <id>cleaning</id>
- <phase>clean</phase>
- <goals>
- <goal>clean</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <inherited>true</inherited>
- <configuration>
- <forkMode>once</forkMode>
- <classesDirectory>${project.build.directory}/generated-classes/emma/classes</classesDirectory>
- </configuration>
- </plugin>
+ <profiles>
+ <profile>
+ <id>code-coverage</id>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>emma-maven-plugin</artifactId>
+ <version>${emma.maven.plugin.version}</version>
+ <inherited>true</inherited>
+ <executions>
+ <execution>
+ <id>instrumentation</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>instrument</goal>
+ </goals>
+ <configuration>
+ <verbose>true</verbose>
+ </configuration>
+ </execution>
+ <execution>
+ <id>cleaning</id>
+ <phase>clean</phase>
+ <goals>
+ <goal>clean</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
- <plugin>
- <groupId>org.sonatype.maven.plugin</groupId>
- <artifactId>emma4it-maven-plugin</artifactId>
- <version>${emma4it.maven.plugin.version}</version>
- <executions>
- <execution>
- <id>report</id>
- <phase>test</phase>
- <goals>
- <goal>report</goal>
- </goals>
- <configuration>
- <sourceSets>
- <sourceSet>
- <directory>${project.build.sourceDirectory}</directory>
- </sourceSet>
- </sourceSets>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
- </profile>
- </profiles>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <forkMode>once</forkMode>
+ <classesDirectory>${project.build.directory}/generated-classes/emma/classes</classesDirectory>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.sonatype.maven.plugin</groupId>
+ <artifactId>emma4it-maven-plugin</artifactId>
+ <version>${emma4it.maven.plugin.version}</version>
+ <executions>
+ <execution>
+ <id>report</id>
+ <phase>test</phase>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ <configuration>
+ <sourceSets>
+ <sourceSet>
+ <directory>${project.build.sourceDirectory}</directory>
+ </sourceSet>
+ </sourceSets>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ </profile>
+ </profiles>
+
+ <developers>
+ <developer>
+ <name>Lincoln Baxter, III</name>
+ <email>lincolnbaxter(a)gmail.com</email>
+ <url>http://ocpsoft.com</url>
+ <organization>JBoss, by Red Hat</organization>
+ <organizationUrl>http://jboss.org</organizationUrl>
+ <timezone>EST</timezone>
+ <roles>
+ <role>Project Lead</role>
+ </roles>
+ </developer>
+ <developer>
+ <name>Ken Finnigan</name>
+ <timezone>GMT</timezone>
+ <roles>
+ <role>Project Lead</role>
+ </roles>
+ </developer>
+ </developers>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/seam/modules/international/trunk</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/seam/modules/international/trunk</developerConnection>
+ <url>http://fisheye.jboss.org/browse/Seam/modules/international/trunk</url>
+ </scm>
</project>
14 years
Seam SVN: r12783 - modules/international/trunk/api/src/test/java/org/jboss/seam/international/status/builder.
by seam-commits@lists.jboss.org
Author: lincolnthree
Date: 2010-05-24 12:00:44 -0400 (Mon, 24 May 2010)
New Revision: 12783
Modified:
modules/international/trunk/api/src/test/java/org/jboss/seam/international/status/builder/TemplateMessageTest.java
Log:
Too many tests failing, un-commenting since this doesn't matter at the moment.
Modified: modules/international/trunk/api/src/test/java/org/jboss/seam/international/status/builder/TemplateMessageTest.java
===================================================================
--- modules/international/trunk/api/src/test/java/org/jboss/seam/international/status/builder/TemplateMessageTest.java 2010-05-24 15:59:12 UTC (rev 12782)
+++ modules/international/trunk/api/src/test/java/org/jboss/seam/international/status/builder/TemplateMessageTest.java 2010-05-24 16:00:44 UTC (rev 12783)
@@ -41,47 +41,47 @@
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*
*/
-//(a)RunWith(Arquillian.class)
+(a)RunWith(Arquillian.class)
public class TemplateMessageTest
{
-// @Deployment
-// public static Archive<?> createTestArchive()
-// {
-// return ShrinkWrap.create("test.jar", JavaArchive.class).addClasses(MessageFactory.class, Bundles.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
-// }
-//
-// @Inject
-// MessageFactory factory;
+ @Deployment
+ public static Archive<?> createTestArchive()
+ {
+ return ShrinkWrap.create("test.jar", JavaArchive.class).addClasses(MessageFactory.class, Bundles.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
+ }
+ @Inject
+ MessageFactory factory;
+
@Test
public void testParameterizedTemplate() throws Exception
{
-// String expected = "There are 5 cars, and they are all green; green is the best color.";
-// TemplateMessage builder = factory.info("There are {0} cars, and they are all {1}; {1} is the best color.", 5, "green");
-// assertEquals(expected, builder.build().getText());
+ String expected = "There are 5 cars, and they are all green; green is the best color.";
+ TemplateMessage builder = factory.info("There are {0} cars, and they are all {1}; {1} is the best color.", 5, "green");
+ assertEquals(expected, builder.build().getText());
}
-// @Test
-// public void testParameterizedTemplateInsertsParamNumbersIfNotEnoughParamValues() throws Exception
-// {
-// String expected = "There are 5 cars, and they are all {1}; {1} is the best color.";
-// TemplateMessage builder = factory.warn("There are {0} cars, and they are all {1}; {1} is the best color.", 5);
-// assertEquals(expected, builder.build().getText());
-// }
-//
-// @Test
-// public void testPlainTextTemplate() throws Exception
-// {
-// String expected = "There are 5 cars, and they are all green; green is the best color.";
-// TemplateMessage builder = factory.error("There are 5 cars, and they are all green; green is the best color.");
-// assertEquals(expected, builder.build().getText());
-// }
-//
-// @Test
-// public void testPlainTextTemplateWithParamsIsUnmodified() throws Exception
-// {
-// String expected = "There are 5 cars, and they are all green; green is the best color.";
-// TemplateMessage builder = factory.fatal("There are 5 cars, and they are all green; green is the best color.", "blue", "red", 6);
-// assertEquals(expected, builder.build().getText());
-// }
+ @Test
+ public void testParameterizedTemplateInsertsParamNumbersIfNotEnoughParamValues() throws Exception
+ {
+ String expected = "There are 5 cars, and they are all {1}; {1} is the best color.";
+ TemplateMessage builder = factory.warn("There are {0} cars, and they are all {1}; {1} is the best color.", 5);
+ assertEquals(expected, builder.build().getText());
+ }
+
+ @Test
+ public void testPlainTextTemplate() throws Exception
+ {
+ String expected = "There are 5 cars, and they are all green; green is the best color.";
+ TemplateMessage builder = factory.error("There are 5 cars, and they are all green; green is the best color.");
+ assertEquals(expected, builder.build().getText());
+ }
+
+ @Test
+ public void testPlainTextTemplateWithParamsIsUnmodified() throws Exception
+ {
+ String expected = "There are 5 cars, and they are all green; green is the best color.";
+ TemplateMessage builder = factory.fatal("There are 5 cars, and they are all green; green is the best color.", "blue", "red", 6);
+ assertEquals(expected, builder.build().getText());
+ }
}
14 years
Seam SVN: r12782 - modules/international/trunk/api/src/test/java/org/jboss/seam/international/status/builder.
by seam-commits@lists.jboss.org
Author: lincolnthree
Date: 2010-05-24 11:59:12 -0400 (Mon, 24 May 2010)
New Revision: 12782
Modified:
modules/international/trunk/api/src/test/java/org/jboss/seam/international/status/builder/TemplateMessageTest.java
Log:
Arquillian currently not working -- working with Aslak to figure out what's going on with this test case. Commenting out for now.
Modified: modules/international/trunk/api/src/test/java/org/jboss/seam/international/status/builder/TemplateMessageTest.java
===================================================================
--- modules/international/trunk/api/src/test/java/org/jboss/seam/international/status/builder/TemplateMessageTest.java 2010-05-24 15:43:41 UTC (rev 12781)
+++ modules/international/trunk/api/src/test/java/org/jboss/seam/international/status/builder/TemplateMessageTest.java 2010-05-24 15:59:12 UTC (rev 12782)
@@ -41,47 +41,47 @@
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*
*/
-(a)RunWith(Arquillian.class)
+//(a)RunWith(Arquillian.class)
public class TemplateMessageTest
{
- @Deployment
- public static Archive<?> createTestArchive()
- {
- return ShrinkWrap.create("test.jar", JavaArchive.class).addClasses(MessageFactory.class, Bundles.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
- }
+// @Deployment
+// public static Archive<?> createTestArchive()
+// {
+// return ShrinkWrap.create("test.jar", JavaArchive.class).addClasses(MessageFactory.class, Bundles.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
+// }
+//
+// @Inject
+// MessageFactory factory;
- @Inject
- MessageFactory factory;
-
@Test
public void testParameterizedTemplate() throws Exception
{
- String expected = "There are 5 cars, and they are all green; green is the best color.";
- TemplateMessage builder = factory.info("There are {0} cars, and they are all {1}; {1} is the best color.", 5, "green");
- assertEquals(expected, builder.build().getText());
+// String expected = "There are 5 cars, and they are all green; green is the best color.";
+// TemplateMessage builder = factory.info("There are {0} cars, and they are all {1}; {1} is the best color.", 5, "green");
+// assertEquals(expected, builder.build().getText());
}
- @Test
- public void testParameterizedTemplateInsertsParamNumbersIfNotEnoughParamValues() throws Exception
- {
- String expected = "There are 5 cars, and they are all {1}; {1} is the best color.";
- TemplateMessage builder = factory.warn("There are {0} cars, and they are all {1}; {1} is the best color.", 5);
- assertEquals(expected, builder.build().getText());
- }
-
- @Test
- public void testPlainTextTemplate() throws Exception
- {
- String expected = "There are 5 cars, and they are all green; green is the best color.";
- TemplateMessage builder = factory.error("There are 5 cars, and they are all green; green is the best color.");
- assertEquals(expected, builder.build().getText());
- }
-
- @Test
- public void testPlainTextTemplateWithParamsIsUnmodified() throws Exception
- {
- String expected = "There are 5 cars, and they are all green; green is the best color.";
- TemplateMessage builder = factory.fatal("There are 5 cars, and they are all green; green is the best color.", "blue", "red", 6);
- assertEquals(expected, builder.build().getText());
- }
+// @Test
+// public void testParameterizedTemplateInsertsParamNumbersIfNotEnoughParamValues() throws Exception
+// {
+// String expected = "There are 5 cars, and they are all {1}; {1} is the best color.";
+// TemplateMessage builder = factory.warn("There are {0} cars, and they are all {1}; {1} is the best color.", 5);
+// assertEquals(expected, builder.build().getText());
+// }
+//
+// @Test
+// public void testPlainTextTemplate() throws Exception
+// {
+// String expected = "There are 5 cars, and they are all green; green is the best color.";
+// TemplateMessage builder = factory.error("There are 5 cars, and they are all green; green is the best color.");
+// assertEquals(expected, builder.build().getText());
+// }
+//
+// @Test
+// public void testPlainTextTemplateWithParamsIsUnmodified() throws Exception
+// {
+// String expected = "There are 5 cars, and they are all green; green is the best color.";
+// TemplateMessage builder = factory.fatal("There are 5 cars, and they are all green; green is the best color.", "blue", "red", 6);
+// assertEquals(expected, builder.build().getText());
+// }
}
14 years
Seam SVN: r12781 - in modules: faces/trunk/api/src/main/java/org/jboss/seam/faces and 15 other directories.
by seam-commits@lists.jboss.org
Author: lincolnthree
Date: 2010-05-24 11:43:41 -0400 (Mon, 24 May 2010)
New Revision: 12781
Added:
modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/
modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/Bundles.java
modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/Level.java
modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/Message.java
modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/MessageBuilder.java
modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/MessageFactory.java
modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/Messages.java
modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/MutableMessage.java
modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/builder/
modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/builder/BundleKey.java
modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/builder/BundleMessage.java
modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/builder/Interpolator.java
modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/builder/TemplateMessage.java
modules/international/trunk/api/src/test/java/org/
modules/international/trunk/api/src/test/java/org/jboss/
modules/international/trunk/api/src/test/java/org/jboss/seam/
modules/international/trunk/api/src/test/java/org/jboss/seam/international/
modules/international/trunk/api/src/test/java/org/jboss/seam/international/status/
modules/international/trunk/api/src/test/java/org/jboss/seam/international/status/builder/
modules/international/trunk/api/src/test/java/org/jboss/seam/international/status/builder/TemplateMessageTest.java
modules/international/trunk/impl/src/main/java/org/jboss/seam/international/status/
modules/international/trunk/impl/src/main/java/org/jboss/seam/international/status/MessageImpl.java
Removed:
modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/display/
modules/faces/trunk/api/src/test/java/org/jboss/seam/faces/display/
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/display/SeamMessage.java
Modified:
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/display/SeamMessages.java
modules/faces/trunk/pom.xml
modules/international/trunk/pom.xml
Log:
Moved SeamMessages to the International Module, with new API.
@Inject Messages messages;
..
messages.add(messages.info("new message using factory & builder pattern!"));
Deleted: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/display/SeamMessage.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/display/SeamMessage.java 2010-05-24 09:25:47 UTC (rev 12780)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/display/SeamMessage.java 2010-05-24 15:43:41 UTC (rev 12781)
@@ -1,165 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.seam.faces.display;
-
-/**
- * @author <a href="mailto:lincolnbaxter@gmail.com>Lincoln Baxter, III</a>
- *
- */
-public class SeamMessage implements Message
-{
- private static final long serialVersionUID = 6650116552438358826L;
-
- private String message;
- private String details;
- private String clientId;
- private final Level level;
-
- public SeamMessage(final Level level)
- {
- this.level = level;
- }
-
- @Override
- public String toString()
- {
- return "SeamMessage [clientId=" + clientId + ", details=" + details + ", level=" + level + ", message=" + message + "]";
- }
-
- public Message component(final String clientId)
- {
- this.clientId = clientId;
- return this;
- }
-
- public Message details(final String details)
- {
- this.details = details;
- return this;
- }
-
- public Message summary(final String message)
- {
- this.message = message;
- return this;
- }
-
- /*
- * Getters & Setters
- */
- public Level getLevel()
- {
- return level;
- }
-
- public String getMessage()
- {
- return message;
- }
-
- public String getDetails()
- {
- return details;
- }
-
- public String getClientId()
- {
- return clientId;
- }
-
- @Override
- public int hashCode()
- {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((clientId == null) ? 0 : clientId.hashCode());
- result = prime * result + ((details == null) ? 0 : details.hashCode());
- result = prime * result + ((level == null) ? 0 : level.hashCode());
- result = prime * result + ((message == null) ? 0 : message.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(final Object obj)
- {
- if (this == obj)
- {
- return true;
- }
- if (obj == null)
- {
- return false;
- }
- if (getClass() != obj.getClass())
- {
- return false;
- }
- SeamMessage other = (SeamMessage) obj;
- if (clientId == null)
- {
- if (other.clientId != null)
- {
- return false;
- }
- }
- else if (!clientId.equals(other.clientId))
- {
- return false;
- }
- if (details == null)
- {
- if (other.details != null)
- {
- return false;
- }
- }
- else if (!details.equals(other.details))
- {
- return false;
- }
- if (level == null)
- {
- if (other.level != null)
- {
- return false;
- }
- }
- else if (!level.equals(other.level))
- {
- return false;
- }
- if (message == null)
- {
- if (other.message != null)
- {
- return false;
- }
- }
- else if (!message.equals(other.message))
- {
- return false;
- }
- return true;
- }
-
-}
Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/display/SeamMessages.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/display/SeamMessages.java 2010-05-24 09:25:47 UTC (rev 12780)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/display/SeamMessages.java 2010-05-24 15:43:41 UTC (rev 12781)
@@ -23,56 +23,63 @@
package org.jboss.seam.faces.display;
import java.io.Serializable;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
import javax.enterprise.context.SessionScoped;
import javax.enterprise.event.Observes;
import javax.faces.application.FacesMessage;
+import javax.faces.application.FacesMessage.Severity;
import javax.faces.event.PhaseEvent;
+import javax.inject.Inject;
import org.jboss.seam.faces.event.qualifier.Before;
import org.jboss.seam.faces.event.qualifier.RenderResponse;
+import org.jboss.seam.international.status.Level;
+import org.jboss.seam.international.status.Message;
+import org.jboss.seam.international.status.Messages;
/**
+ * Convert Seam Messages into FacesMessages <br>
+ * TODO perform EL evaluation.
+ *
* @author <a href="mailto:lincolnbaxter@gmail.com>Lincoln Baxter, III</a>
*
*/
@SessionScoped
-public class SeamMessages implements Messages, Serializable
+public class SeamMessages implements Serializable
{
private static final long serialVersionUID = -2908193057765795662L;
- private final Set<Message> messages = Collections.synchronizedSet(new HashSet<Message>());
+ @Inject
+ Messages sm;
+
@SuppressWarnings("unused")
private void convert(@Observes @Before @RenderResponse final PhaseEvent event)
{
- for (Message m : messages)
+ for (Message m : sm.getAll())
{
- event.getFacesContext().addMessage(m.getClientId(), new FacesMessage(m.getLevel().getSeverity(), m.getMessage(), m.getDetails()));
+ event.getFacesContext().addMessage(m.getTargets(), new FacesMessage(getSeverity(m.getLevel()), m.getText(), null));
}
- clear();
+ sm.clear();
}
- public void clear()
+ private Severity getSeverity(final Level level)
{
- messages.clear();
- }
-
- public Message add(final Level level)
- {
- Message result = new SeamMessage(level);
- messages.add(result);
- return result;
- }
-
- public Set<Message> getAll()
- {
- Set<Message> result;
- synchronized (messages)
+ Severity result = FacesMessage.SEVERITY_INFO;
+ switch (level)
{
- result = Collections.unmodifiableSet(messages);
+ case INFO:
+ break;
+ case WARN:
+ result = FacesMessage.SEVERITY_WARN;
+ break;
+ case ERROR:
+ result = FacesMessage.SEVERITY_ERROR;
+ break;
+ case FATAL:
+ result = FacesMessage.SEVERITY_FATAL;
+ break;
+ default:
+ break;
}
return result;
}
Modified: modules/faces/trunk/pom.xml
===================================================================
--- modules/faces/trunk/pom.xml 2010-05-24 09:25:47 UTC (rev 12780)
+++ modules/faces/trunk/pom.xml 2010-05-24 15:43:41 UTC (rev 12781)
@@ -30,6 +30,7 @@
</modules>
<properties>
+ <seam.i18n.version>3.0.0-SNAPSHOT</seam.i18n.version>
<arquillian.version>1.0.0.Alpha1</arquillian.version>
<jsfmock.version>1.0.0</jsfmock.version>
<jsfunit.version>1.2.0.Final</jsfunit.version>
@@ -54,6 +55,11 @@
</dependencyManagement>
<dependencies>
+ <dependency>
+ <groupId>org.jboss.seam.international</groupId>
+ <artifactId>seam-international</artifactId>
+ <version>${seam.i18n.version}</version>
+ </dependency>
<!-- Environment Dependencies -->
<dependency>
Added: modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/Bundles.java
===================================================================
--- modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/Bundles.java (rev 0)
+++ modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/Bundles.java 2010-05-24 15:43:41 UTC (rev 12781)
@@ -0,0 +1,104 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.international.status;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.ResourceBundle;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Named;
+
+/**
+ * Maintains a global map of {@link ResourceBundle} objects.
+ *
+ * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ */
+@Named
+@ApplicationScoped
+public class Bundles implements Map<String, ResourceBundle>
+{
+ private final Map<String, ResourceBundle> bundles = new ConcurrentHashMap<String, ResourceBundle>();
+
+ public void clear()
+ {
+ bundles.clear();
+ }
+
+ public boolean containsKey(final Object key)
+ {
+ return bundles.containsKey(key);
+ }
+
+ public boolean containsValue(final Object value)
+ {
+ return bundles.containsValue(value);
+ }
+
+ public Set<java.util.Map.Entry<String, ResourceBundle>> entrySet()
+ {
+ return bundles.entrySet();
+ }
+
+ public ResourceBundle get(final Object key)
+ {
+ return bundles.get(key);
+ }
+
+ public boolean isEmpty()
+ {
+ return bundles.isEmpty();
+ }
+
+ public Set<String> keySet()
+ {
+ return keySet();
+ }
+
+ public ResourceBundle put(final String key, final ResourceBundle value)
+ {
+ return put(key, value);
+ }
+
+ public void putAll(final Map<? extends String, ? extends ResourceBundle> m)
+ {
+ bundles.putAll(m);
+ }
+
+ public ResourceBundle remove(final Object key)
+ {
+ return bundles.remove(key);
+ }
+
+ public int size()
+ {
+ return bundles.size();
+ }
+
+ public Collection<ResourceBundle> values()
+ {
+ return bundles.values();
+ }
+}
\ No newline at end of file
Added: modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/Level.java
===================================================================
--- modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/Level.java (rev 0)
+++ modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/Level.java 2010-05-24 15:43:41 UTC (rev 12781)
@@ -0,0 +1,16 @@
+/**
+ *
+ */
+package org.jboss.seam.international.status;
+
+/**
+ * Severity of a given {@link Message}, used to represent varying levels of
+ * importance to the end user.
+ *
+ * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ */
+public enum Level
+{
+ INFO, WARN, ERROR, FATAL;
+}
\ No newline at end of file
Added: modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/Message.java
===================================================================
--- modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/Message.java (rev 0)
+++ modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/Message.java 2010-05-24 15:43:41 UTC (rev 12781)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.international.status;
+
+import java.io.Serializable;
+
+/**
+ * An object representing a message that needs to be displayed to the User.
+ *
+ * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ */
+public interface Message extends Serializable
+{
+ /**
+ * Get the {@link Level} representing the severity of this message.
+ */
+ Level getLevel();
+
+ /**
+ * Get the message text.
+ */
+ String getText();
+
+ /**
+ * Get the targets for which a given view-layer or consumer should display
+ * this message, or to which this message should be attached.
+ */
+ String getTargets();
+}
Added: modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/MessageBuilder.java
===================================================================
--- modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/MessageBuilder.java (rev 0)
+++ modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/MessageBuilder.java 2010-05-24 15:43:41 UTC (rev 12781)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.international.status;
+
+/**
+ * A {@link MessageBuilder} is used to generate populated {@link Message}
+ * objects. These messages may then be added to the outgoing message cache via
+ * {@link Messages}
+ *
+ * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ */
+public interface MessageBuilder
+{
+ /**
+ * Generate a {@link Message} that represents the internal state of this
+ * builder.
+ */
+ Message build();
+}
Added: modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/MessageFactory.java
===================================================================
--- modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/MessageFactory.java (rev 0)
+++ modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/MessageFactory.java 2010-05-24 15:43:41 UTC (rev 12781)
@@ -0,0 +1,125 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.international.status;
+
+import javax.inject.Inject;
+
+import org.jboss.seam.international.status.builder.BundleKey;
+import org.jboss.seam.international.status.builder.BundleMessage;
+import org.jboss.seam.international.status.builder.TemplateMessage;
+
+/**
+ * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ */
+public class MessageFactory
+{
+ @Inject
+ Bundles bundles;
+
+ /*
+ * Bundle Factory Methods
+ */
+ public BundleMessage info(final BundleKey message)
+ {
+ return new BundleMessage(bundles, Level.INFO).text(message);
+ }
+
+ public BundleMessage info(final BundleKey message, final Object... params)
+ {
+ return new BundleMessage(bundles, Level.INFO).text(message).textParams(params);
+ }
+
+ public BundleMessage warn(final BundleKey message)
+ {
+ return new BundleMessage(bundles, Level.WARN).text(message);
+ }
+
+ public BundleMessage warn(final BundleKey message, final Object... params)
+ {
+ return new BundleMessage(bundles, Level.WARN).text(message).textParams(params);
+ }
+
+ public BundleMessage error(final BundleKey message)
+ {
+ return new BundleMessage(bundles, Level.ERROR).text(message);
+ }
+
+ public BundleMessage error(final BundleKey message, final Object... params)
+ {
+ return new BundleMessage(bundles, Level.ERROR).text(message).textParams(params);
+ }
+
+ public BundleMessage fatal(final BundleKey message)
+ {
+ return new BundleMessage(bundles, Level.FATAL).text(message);
+ }
+
+ public BundleMessage fatal(final BundleKey message, final Object... params)
+ {
+ return new BundleMessage(bundles, Level.FATAL).text(message).textParams(params);
+ }
+
+ /*
+ * Template Factory Methods
+ */
+ public TemplateMessage info(final String message)
+ {
+ return new TemplateMessage(Level.INFO).text(message);
+ }
+
+ public TemplateMessage info(final String message, final Object... params)
+ {
+ return new TemplateMessage(Level.INFO).text(message).textParams(params);
+ }
+
+ public TemplateMessage warn(final String message)
+ {
+ return new TemplateMessage(Level.WARN).text(message);
+ }
+
+ public TemplateMessage warn(final String message, final Object... params)
+ {
+ return new TemplateMessage(Level.WARN).text(message).textParams(params);
+ }
+
+ public TemplateMessage error(final String message)
+ {
+ return new TemplateMessage(Level.ERROR).text(message);
+ }
+
+ public TemplateMessage error(final String message, final Object... params)
+ {
+ return new TemplateMessage(Level.ERROR).text(message).textParams(params);
+ }
+
+ public TemplateMessage fatal(final String message)
+ {
+ return new TemplateMessage(Level.FATAL).text(message);
+ }
+
+ public TemplateMessage fatal(final String message, final Object... params)
+ {
+ return new TemplateMessage(Level.FATAL).text(message).textParams(params);
+ }
+
+}
Added: modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/Messages.java
===================================================================
--- modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/Messages.java (rev 0)
+++ modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/Messages.java 2010-05-24 15:43:41 UTC (rev 12781)
@@ -0,0 +1,182 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.seam.international.status;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+
+import org.jboss.seam.international.status.builder.BundleKey;
+import org.jboss.seam.international.status.builder.BundleMessage;
+import org.jboss.seam.international.status.builder.TemplateMessage;
+
+/**
+ * A convenient way to add messages to be displayed to the user as Feedback,
+ * Toast, Alerts, etc...
+ *
+ * @author <a href="mailto:lincolnbaxter@gmail.com>Lincoln Baxter, III</a>
+ *
+ */
+@SessionScoped
+public class Messages implements Serializable
+{
+ private static final long serialVersionUID = -2908193057765795662L;
+ private final Set<Message> messages = Collections.synchronizedSet(new HashSet<Message>());
+
+ @Inject
+ MessageFactory factory;
+
+ /**
+ * Clear all pending messages.
+ */
+ public void clear()
+ {
+ messages.clear();
+ }
+
+ /**
+ * Retrieve all pending {@link Messages} in their final state - as they will
+ * be displayed to the user.
+ */
+ public Set<Message> getAll()
+ {
+ Set<Message> result = new HashSet<Message>();
+ synchronized (messages)
+ {
+ result.addAll(messages);
+ }
+ return result;
+ }
+
+ /**
+ * Add a {@link Message} object to the pending message cache. Messages remain
+ * pending until cleared by and displayed in the View Layer, or until cleared
+ * manually by calling {@link #clear()}, or until the user's Session expires.
+ * <p>
+ * <b>Note:</b> Duplicate messages are ignored.
+ */
+ public void add(final Message message)
+ {
+ messages.add(message);
+ }
+
+ /**
+ * Add a {@link Message} object, produced by the provided
+ * {@link MessageBuilder}, to the pending message cache.
+ */
+ public void add(final MessageBuilder builder)
+ {
+ messages.add(builder.build());
+ }
+
+ /*
+ * Bundle Factory Methods
+ */
+ public BundleMessage info(final BundleKey message)
+ {
+ return factory.info(message);
+ }
+
+ public BundleMessage info(final BundleKey message, final Object... params)
+ {
+ return factory.info(message, params);
+ }
+
+ public BundleMessage warn(final BundleKey message)
+ {
+ return factory.warn(message);
+ }
+
+ public BundleMessage warn(final BundleKey message, final Object... params)
+ {
+ return factory.warn(message, params);
+ }
+
+ public BundleMessage error(final BundleKey message)
+ {
+ return factory.error(message);
+ }
+
+ public BundleMessage error(final BundleKey message, final Object... params)
+ {
+ return factory.error(message, params);
+ }
+
+ public BundleMessage fatal(final BundleKey message)
+ {
+ return factory.fatal(message);
+ }
+
+ public BundleMessage fatal(final BundleKey message, final Object... params)
+ {
+ return factory.fatal(message, params);
+ }
+
+ /*
+ * Template Factory Methods
+ */
+ public TemplateMessage info(final String message)
+ {
+ return factory.info(message);
+ }
+
+ public TemplateMessage info(final String message, final Object... params)
+ {
+ return factory.info(message, params);
+ }
+
+ public TemplateMessage warn(final String message)
+ {
+ return factory.warn(message);
+ }
+
+ public TemplateMessage warn(final String message, final Object... params)
+ {
+ return factory.warn(message, params);
+ }
+
+ public TemplateMessage error(final String message)
+ {
+ return factory.error(message);
+ }
+
+ public TemplateMessage error(final String message, final Object... params)
+ {
+ return factory.error(message, params);
+ }
+
+ public TemplateMessage fatal(final String message)
+ {
+ return factory.fatal(message);
+ }
+
+ public TemplateMessage fatal(final String message, final Object... params)
+ {
+ return factory.fatal(message, params);
+ }
+
+}
Added: modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/MutableMessage.java
===================================================================
--- modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/MutableMessage.java (rev 0)
+++ modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/MutableMessage.java 2010-05-24 15:43:41 UTC (rev 12781)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.international.status;
+
+/**
+ * A stateful {@link Message} object.
+ *
+ * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ */
+public interface MutableMessage extends Message
+{
+ /**
+ * Set the {@link Level} representing the severity of this message.
+ */
+ void setLevel(Level level);
+
+ /**
+ * Set the message text.
+ */
+ void setText(String summary);
+
+ /**
+ * Set the targets for which a given view-layer or consumer should display
+ * this message, or to which this message should be attached.
+ */
+ void setTargets(String targets);
+}
Added: modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/builder/BundleKey.java
===================================================================
--- modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/builder/BundleKey.java (rev 0)
+++ modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/builder/BundleKey.java 2010-05-24 15:43:41 UTC (rev 12781)
@@ -0,0 +1,120 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.international.status.builder;
+
+import java.io.Serializable;
+import java.util.ResourceBundle;
+
+/**
+ * Represents the name/key pair for a {@link ResourceBundle} lookup.
+ *
+ * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ */
+public class BundleKey implements Serializable
+{
+ private static final long serialVersionUID = -4817189437146173796L;
+
+ private String bundle;
+ private String key;
+
+ public BundleKey(final String bundle, final String key)
+ {
+ super();
+ this.bundle = bundle;
+ this.key = key;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((bundle == null) ? 0 : bundle.hashCode());
+ result = prime * result + ((key == null) ? 0 : key.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(final Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (obj == null)
+ {
+ return false;
+ }
+ if (getClass() != obj.getClass())
+ {
+ return false;
+ }
+ BundleKey other = (BundleKey) obj;
+ if (bundle == null)
+ {
+ if (other.bundle != null)
+ {
+ return false;
+ }
+ }
+ else if (!bundle.equals(other.bundle))
+ {
+ return false;
+ }
+ if (key == null)
+ {
+ if (other.key != null)
+ {
+ return false;
+ }
+ }
+ else if (!key.equals(other.key))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /*
+ * Getters & Setters
+ */
+ public String getBundle()
+ {
+ return bundle;
+ }
+
+ public void setBundle(final String bundle)
+ {
+ this.bundle = bundle;
+ }
+
+ public String getKey()
+ {
+ return key;
+ }
+
+ public void setKey(final String key)
+ {
+ this.key = key;
+ }
+}
Added: modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/builder/BundleMessage.java
===================================================================
--- modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/builder/BundleMessage.java (rev 0)
+++ modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/builder/BundleMessage.java 2010-05-24 15:43:41 UTC (rev 12781)
@@ -0,0 +1,134 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.international.status.builder;
+
+import org.jboss.seam.international.status.Bundles;
+import org.jboss.seam.international.status.Level;
+import org.jboss.seam.international.status.Message;
+import org.jboss.seam.international.status.MessageBuilder;
+
+/**
+ * This {@link MessageBuilder} implementation creates {@link Message} objects by
+ * loading resource bundle keys as templates with values supplied as parameters.
+ * <p>
+ * <b>For example:</b>
+ * <p>
+ * Given the following {@link Message} m
+ *
+ * <pre>
+ * Message m = {@link MessageFactory}.info(new {@link BundleKey}("messageBundle", "keyName"), 5, "green")
+ * .defaultText("This is default text.").build();
+ * </pre>
+ *
+ * And the corresponding messageBundle.properties file:<br>
+ *
+ * <pre>
+ * keyName=There are {0} cars, and they are all {1}.
+ * </pre>
+ *
+ * A subsequent call to <code>m.getText()</code> will return:<br/>
+ *
+ * <pre>
+ * "There are 5 cars, and they are all green."
+ * </pre>
+ *
+ * <b>Note:</b> If a bundle/key pair cannot be resolved, the default template
+ * will be used instead. If there is no default template, a String
+ * representation of the {@link BundleKey} will be displayed instead.
+ * <p>
+ *
+ * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ */
+public class BundleMessage implements MessageBuilder
+{
+ private TemplateMessage template;
+ private String textDefault;
+ private BundleKey textKey;
+
+ private final Bundles bundles;
+
+ public BundleMessage(final Bundles bundles, final Level level)
+ {
+ this.bundles = bundles;
+ this.template.level(level);
+ }
+
+ /**
+ * Produce a {@link Message} object as represented by the current state of
+ * <code>this</code> builder.
+ */
+ public Message build()
+ {
+ String text;
+ try
+ {
+ text = bundles.get(textKey.getBundle()).getString(textKey.getKey());
+ }
+ catch (Exception e)
+ {
+ text = textDefault;
+ }
+
+ if ((text == null) || "".equals(text))
+ {
+ text = textKey.toString();
+ }
+
+ template.text(text);
+ return template.build();
+ }
+
+ /*
+ * Setters
+ */
+
+ public BundleMessage text(final BundleKey text)
+ {
+ this.textKey = text;
+ return this;
+ }
+
+ public BundleMessage textDefault(final String text)
+ {
+ this.textDefault = text;
+ return this;
+ }
+
+ public BundleMessage textParams(final Object... textParams)
+ {
+ this.template.textParams(textParams);
+ return this;
+ }
+
+ public BundleMessage targets(final String targets)
+ {
+ this.template.targets(targets);
+ return this;
+ }
+
+ public BundleMessage setLevel(final Level level)
+ {
+ this.template.level(level);
+ return this;
+ }
+}
Added: modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/builder/Interpolator.java
===================================================================
--- modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/builder/Interpolator.java (rev 0)
+++ modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/builder/Interpolator.java 2010-05-24 15:43:41 UTC (rev 12781)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.international.status.builder;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Populates an interpolated string using the given template and parameters:
+ * <p>
+ * <b>For example:</b><br>
+ * Template:
+ * <code>"This is a {0} template with {1} parameters. Just {1}."</code><br>
+ * Parameters: <code>"simple", 2</code><br>
+ * Result: <code>"This is a simple template with 2 parameters. Just 2"</code>
+ *
+ *
+ * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ */
+class Interpolator
+{
+ private static final String templateRegex = "\\{(\\d+)\\}";
+ private static final Pattern templatePattern = Pattern.compile(templateRegex);
+
+ /**
+ * Populate a template with the corresponding parameters.
+ */
+ public String populate(final String template, final Object... params)
+ {
+ StringBuffer result = new StringBuffer();
+ if (template != null)
+ {
+ Matcher matcher = templatePattern.matcher(template);
+ while (matcher.find())
+ {
+ int index = Integer.valueOf(matcher.group(1));
+ Object value = matcher.group();
+
+ if (params.length > index)
+ {
+ if (params[index] != null)
+ {
+ value = params[index];
+ }
+ }
+ matcher.appendReplacement(result, value.toString());
+ }
+ matcher.appendTail(result);
+ }
+ return result.toString();
+ }
+}
Added: modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/builder/TemplateMessage.java
===================================================================
--- modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/builder/TemplateMessage.java (rev 0)
+++ modules/international/trunk/api/src/main/java/org/jboss/seam/international/status/builder/TemplateMessage.java 2010-05-24 15:43:41 UTC (rev 12781)
@@ -0,0 +1,113 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.international.status.builder;
+
+import org.jboss.seam.international.status.Level;
+import org.jboss.seam.international.status.Message;
+import org.jboss.seam.international.status.MessageBuilder;
+import org.jboss.seam.international.status.MutableMessage;
+
+/**
+ * This {@link MessageBuilder} implementation creates {@link Message} objects by
+ * interpolating templates with values supplied as parameters.
+ * <p>
+ * <b>For example:</b> Given the following {@link Message} m
+ *
+ * <pre>
+ * Message m = {@link MessageFactory}.info("There are {0} cars, and they are all {1}.", 5, "green").build();
+ * </pre>
+ *
+ * A subsequent call to <code>m.getSummary()</code> will return:<br/>
+ * <code>"There are 5 cars, and they are all green."</code>;
+ * <p>
+ *
+ * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ */
+public class TemplateMessage implements MessageBuilder
+{
+ private static final String MESSAGE_IMPL_CLASS = "org.jboss.seam.international.status.MessageImpl";
+
+ private final Interpolator templater = new Interpolator();
+
+ private String summary;
+ private Object[] summaryParams;
+
+ private String targets;
+ private Level level;
+
+ public TemplateMessage(final Level level)
+ {
+ this.level = level;
+ }
+
+ /**
+ * Produce a {@link Message} object as represented by the current state of
+ * <code>this</code> builder.
+ */
+ public Message build()
+ {
+ Class<?> type;
+ try
+ {
+ type = Class.forName(MESSAGE_IMPL_CLASS);
+ MutableMessage message = (MutableMessage) type.newInstance();
+
+ message.setLevel(level);
+ message.setText(templater.populate(summary, summaryParams));
+ message.setTargets(targets);
+
+ return message;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to create message: " + MESSAGE_IMPL_CLASS, e);
+ }
+ }
+
+ /*
+ * Setters
+ */
+ public TemplateMessage text(final String summary)
+ {
+ this.summary = summary;
+ return this;
+ }
+
+ public TemplateMessage textParams(final Object... summaryParams)
+ {
+ this.summaryParams = summaryParams;
+ return this;
+ }
+
+ public TemplateMessage targets(final String targets)
+ {
+ this.targets = targets;
+ return this;
+ }
+
+ public TemplateMessage level(final Level level)
+ {
+ this.level = level;
+ return this;
+ }
+}
Added: modules/international/trunk/api/src/test/java/org/jboss/seam/international/status/builder/TemplateMessageTest.java
===================================================================
--- modules/international/trunk/api/src/test/java/org/jboss/seam/international/status/builder/TemplateMessageTest.java (rev 0)
+++ modules/international/trunk/api/src/test/java/org/jboss/seam/international/status/builder/TemplateMessageTest.java 2010-05-24 15:43:41 UTC (rev 12781)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.international.status.builder;
+
+import static org.junit.Assert.assertEquals;
+
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.international.status.Bundles;
+import org.jboss.seam.international.status.MessageFactory;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ */
+(a)RunWith(Arquillian.class)
+public class TemplateMessageTest
+{
+ @Deployment
+ public static Archive<?> createTestArchive()
+ {
+ return ShrinkWrap.create("test.jar", JavaArchive.class).addClasses(MessageFactory.class, Bundles.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
+ }
+
+ @Inject
+ MessageFactory factory;
+
+ @Test
+ public void testParameterizedTemplate() throws Exception
+ {
+ String expected = "There are 5 cars, and they are all green; green is the best color.";
+ TemplateMessage builder = factory.info("There are {0} cars, and they are all {1}; {1} is the best color.", 5, "green");
+ assertEquals(expected, builder.build().getText());
+ }
+
+ @Test
+ public void testParameterizedTemplateInsertsParamNumbersIfNotEnoughParamValues() throws Exception
+ {
+ String expected = "There are 5 cars, and they are all {1}; {1} is the best color.";
+ TemplateMessage builder = factory.warn("There are {0} cars, and they are all {1}; {1} is the best color.", 5);
+ assertEquals(expected, builder.build().getText());
+ }
+
+ @Test
+ public void testPlainTextTemplate() throws Exception
+ {
+ String expected = "There are 5 cars, and they are all green; green is the best color.";
+ TemplateMessage builder = factory.error("There are 5 cars, and they are all green; green is the best color.");
+ assertEquals(expected, builder.build().getText());
+ }
+
+ @Test
+ public void testPlainTextTemplateWithParamsIsUnmodified() throws Exception
+ {
+ String expected = "There are 5 cars, and they are all green; green is the best color.";
+ TemplateMessage builder = factory.fatal("There are 5 cars, and they are all green; green is the best color.", "blue", "red", 6);
+ assertEquals(expected, builder.build().getText());
+ }
+}
Added: modules/international/trunk/impl/src/main/java/org/jboss/seam/international/status/MessageImpl.java
===================================================================
--- modules/international/trunk/impl/src/main/java/org/jboss/seam/international/status/MessageImpl.java (rev 0)
+++ modules/international/trunk/impl/src/main/java/org/jboss/seam/international/status/MessageImpl.java 2010-05-24 15:43:41 UTC (rev 12781)
@@ -0,0 +1,157 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.international.status;
+
+/**
+ * A basic implementation of {@link MutableMessage}.
+ *
+ * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ */
+public class MessageImpl implements Message, MutableMessage
+{
+ private static final long serialVersionUID = -1812292372048679525L;
+
+ private String summary;
+ private String details;
+ private String targets;
+ private Level level;
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((details == null) ? 0 : details.hashCode());
+ result = prime * result + ((targets == null) ? 0 : targets.hashCode());
+ result = prime * result + ((level == null) ? 0 : level.hashCode());
+ result = prime * result + ((summary == null) ? 0 : summary.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(final Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (obj == null)
+ {
+ return false;
+ }
+ if (getClass() != obj.getClass())
+ {
+ return false;
+ }
+ MessageImpl other = (MessageImpl) obj;
+ if (details == null)
+ {
+ if (other.details != null)
+ {
+ return false;
+ }
+ }
+ else if (!details.equals(other.details))
+ {
+ return false;
+ }
+ if (targets == null)
+ {
+ if (other.targets != null)
+ {
+ return false;
+ }
+ }
+ else if (!targets.equals(other.targets))
+ {
+ return false;
+ }
+ if (level == null)
+ {
+ if (other.level != null)
+ {
+ return false;
+ }
+ }
+ else if (!level.equals(other.level))
+ {
+ return false;
+ }
+ if (summary == null)
+ {
+ if (other.summary != null)
+ {
+ return false;
+ }
+ }
+ else if (!summary.equals(other.summary))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /*
+ * Getters & Setters
+ */
+ public String getText()
+ {
+ return summary;
+ }
+
+ public String getDetails()
+ {
+ return details;
+ }
+
+ public String getTargets()
+ {
+ return targets;
+ }
+
+ public Level getLevel()
+ {
+ return level;
+ }
+
+ public void setText(final String summary)
+ {
+ this.summary = summary;
+ }
+
+ public void setDetails(final String details)
+ {
+ this.details = details;
+ }
+
+ public void setTargets(final String targets)
+ {
+ this.targets = targets;
+ }
+
+ public void setLevel(final Level level)
+ {
+ this.level = level;
+ }
+
+}
Modified: modules/international/trunk/pom.xml
===================================================================
--- modules/international/trunk/pom.xml 2010-05-24 09:25:47 UTC (rev 12780)
+++ modules/international/trunk/pom.xml 2010-05-24 15:43:41 UTC (rev 12781)
@@ -28,7 +28,7 @@
<properties>
<arquillian.version>1.0.0-SNAPSHOT</arquillian.version>
<seam.xml.version>3.0.0-SNAPSHOT</seam.xml.version>
- <weld.extensions.version>1.0.0.Alpha1</weld.extensions.version>
+ <weld.extensions.version>1.0.0.Alpha2</weld.extensions.version>
<weld.api.version>1.0-SP1</weld.api.version>
<junit.version>4.8.1</junit.version>
<slf4j.version>1.5.10</slf4j.version>
14 years
Seam SVN: r12780 - modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2010-05-24 05:25:47 -0400 (Mon, 24 May 2010)
New Revision: 12780
Modified:
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java
Log:
add JpaIdentityStore configuration properties
Modified: modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java
===================================================================
--- modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java 2010-05-24 09:10:22 UTC (rev 12779)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java 2010-05-24 09:25:47 UTC (rev 12780)
@@ -4,6 +4,7 @@
import java.util.List;
import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
import org.picketlink.idm.api.Group;
import org.picketlink.idm.api.IdentityType;
@@ -21,6 +22,10 @@
{
private static final long serialVersionUID = 7729139146633529501L;
+ private static final String DEFAULT_USER_IDENTITY_TYPE = "USER";
+ private static final String DEFAULT_ROLE_IDENTITY_TYPE = "ROLE";
+ private static final String DEFAULT_GROUP_IDENTITY_TYPE = "GROUP";
+
private Logger log = LoggerFactory.getLogger(JpaIdentityStore.class);
private Class<?> identityObjectEntity;
@@ -28,6 +33,80 @@
private Class<?> identityObjectCredentialEntity;
private Class<?> identityObjectAttributeEntity;
+ private String userIdentityType = DEFAULT_USER_IDENTITY_TYPE;
+ private String roleIdentityType = DEFAULT_ROLE_IDENTITY_TYPE;
+ private String groupIdentityType = DEFAULT_GROUP_IDENTITY_TYPE;
+
+ public Class<?> getIdentityObjectEntity()
+ {
+ return identityObjectEntity;
+ }
+
+ public void setIdentityObjectEntity(Class<?> identityObjectEntity)
+ {
+ this.identityObjectEntity = identityObjectEntity;
+ }
+
+ public Class<?> getIdentityObjectRelationshipEntity()
+ {
+ return identityObjectRelationshipEntity;
+ }
+
+ public void setIdentityObjectRelationshipEntity(Class<?> identityObjectRelationshipEntity)
+ {
+ this.identityObjectRelationshipEntity = identityObjectRelationshipEntity;
+ }
+
+ public Class<?> getIdentityObjectCredentialEntity()
+ {
+ return identityObjectCredentialEntity;
+ }
+
+ public void setIdentityObjectCredentialEntity(Class<?> identityObjectCredentialEntity)
+ {
+ this.identityObjectCredentialEntity = identityObjectCredentialEntity;
+ }
+
+ public Class<?> getIdentityObjectAttributeEntity()
+ {
+ return identityObjectAttributeEntity;
+ }
+
+ public void setIdentityObjectAttributeEntity(Class<?> identityObjectAttributeEntity)
+ {
+ this.identityObjectAttributeEntity = identityObjectAttributeEntity;
+ }
+
+ public String getUserIdentityType()
+ {
+ return userIdentityType;
+ }
+
+ public void setUserIdentityType(String userIdentityType)
+ {
+ this.userIdentityType = userIdentityType;
+ }
+
+ public String getRoleIdentityType()
+ {
+ return roleIdentityType;
+ }
+
+ public void setRoleIdentityType(String roleIdentityType)
+ {
+ this.roleIdentityType = roleIdentityType;
+ }
+
+ public String getGroupIdentityType()
+ {
+ return groupIdentityType;
+ }
+
+ public void setGroupIdentityType(String groupIdentityType)
+ {
+ this.groupIdentityType = groupIdentityType;
+ }
+
@Inject PasswordEncoder passwordEncoder;
public boolean addUserToGroup(String username, Group group)
@@ -198,5 +277,4 @@
// TODO Auto-generated method stub
return false;
}
-
}
14 years
Seam SVN: r12779 - in modules/security/trunk/api/src/main/java/org/jboss/seam/security: session and 1 other directory.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2010-05-24 05:10:22 -0400 (Mon, 24 May 2010)
New Revision: 12779
Added:
modules/security/trunk/api/src/main/java/org/jboss/seam/security/session/
modules/security/trunk/api/src/main/java/org/jboss/seam/security/session/SessionManager.java
Log:
add session management interface
Added: modules/security/trunk/api/src/main/java/org/jboss/seam/security/session/SessionManager.java
===================================================================
--- modules/security/trunk/api/src/main/java/org/jboss/seam/security/session/SessionManager.java (rev 0)
+++ modules/security/trunk/api/src/main/java/org/jboss/seam/security/session/SessionManager.java 2010-05-24 09:10:22 UTC (rev 12779)
@@ -0,0 +1,6 @@
+package org.jboss.seam.security.session;
+
+public interface SessionManager
+{
+
+}
14 years
Seam SVN: r12778 - modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2010-05-24 05:07:58 -0400 (Mon, 24 May 2010)
New Revision: 12778
Modified:
modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObject.java
modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObjectCredential.java
modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObjectCredentialType.java
modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObjectRelationship.java
modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObjectRelationshipType.java
modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObjectType.java
Log:
add identity management annotations
Modified: modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObject.java
===================================================================
--- modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObject.java 2010-05-24 09:04:05 UTC (rev 12777)
+++ modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObject.java 2010-05-24 09:07:58 UTC (rev 12778)
@@ -7,6 +7,10 @@
import javax.persistence.Id;
import javax.persistence.ManyToOne;
+import org.jboss.seam.security.annotations.management.IdentityEntityName;
+import org.jboss.seam.security.annotations.management.IdentityEntityType;
+import org.jboss.seam.security.annotations.management.IdentityProperty;
+import org.jboss.seam.security.annotations.management.PropertyType;
import org.picketlink.idm.spi.model.IdentityObjectType;
/**
@@ -33,6 +37,7 @@
this.id = id;
}
+ @IdentityProperty(PropertyType.NAME)
public String getName()
{
return name;
@@ -43,7 +48,7 @@
this.name = name;
}
- @ManyToOne
+ @ManyToOne @IdentityProperty(PropertyType.TYPE)
public IdentityObjectType getType()
{
return type;
Modified: modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObjectCredential.java
===================================================================
--- modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObjectCredential.java 2010-05-24 09:04:05 UTC (rev 12777)
+++ modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObjectCredential.java 2010-05-24 09:07:58 UTC (rev 12778)
@@ -7,6 +7,11 @@
import javax.persistence.Id;
import javax.persistence.ManyToOne;
+import org.jboss.seam.security.annotations.management.IdentityEntityType;
+import org.jboss.seam.security.annotations.management.IdentityEntityValue;
+import org.jboss.seam.security.annotations.management.IdentityProperty;
+import org.jboss.seam.security.annotations.management.PropertyType;
+
/**
*
* @author Shane Bryzak
@@ -43,6 +48,7 @@
this.identityObject = identityObject;
}
+ @ManyToOne @IdentityProperty(PropertyType.TYPE)
public IdentityObjectCredentialType getCredentialType()
{
return credentialType;
@@ -53,6 +59,7 @@
this.credentialType = credentialType;
}
+ @IdentityProperty(PropertyType.VALUE)
public String getValue()
{
return value;
Modified: modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObjectCredentialType.java
===================================================================
--- modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObjectCredentialType.java 2010-05-24 09:04:05 UTC (rev 12777)
+++ modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObjectCredentialType.java 2010-05-24 09:07:58 UTC (rev 12778)
@@ -6,6 +6,9 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
+import org.jboss.seam.security.annotations.management.IdentityProperty;
+import org.jboss.seam.security.annotations.management.PropertyType;
+
/**
*
* @author Shane Bryzak
@@ -29,6 +32,7 @@
this.id = id;
}
+ @IdentityProperty(PropertyType.NAME)
public String getName()
{
return name;
Modified: modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObjectRelationship.java
===================================================================
--- modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObjectRelationship.java 2010-05-24 09:04:05 UTC (rev 12777)
+++ modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObjectRelationship.java 2010-05-24 09:07:58 UTC (rev 12778)
@@ -7,6 +7,9 @@
import javax.persistence.Id;
import javax.persistence.ManyToOne;
+import org.jboss.seam.security.annotations.management.IdentityProperty;
+import org.jboss.seam.security.annotations.management.PropertyType;
+
/**
*
* @author Shane Bryzak
@@ -33,6 +36,7 @@
this.id = id;
}
+ @IdentityProperty(PropertyType.NAME)
public String getName()
{
return name;
@@ -43,7 +47,7 @@
this.name = name;
}
- @ManyToOne
+ @ManyToOne @IdentityProperty(PropertyType.TYPE)
public IdentityObjectRelationshipType getRelationshipType()
{
return relationshipType;
@@ -54,7 +58,7 @@
this.relationshipType = relationshipType;
}
- @ManyToOne
+ @ManyToOne @IdentityProperty(PropertyType.RELATIONSHIP_FROM)
public IdentityObject getFromObject()
{
return fromObject;
@@ -65,7 +69,7 @@
this.fromObject = fromObject;
}
- @ManyToOne
+ @ManyToOne @IdentityProperty(PropertyType.RELATIONSHIP_TO)
public IdentityObject getToObject()
{
return toObject;
Modified: modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObjectRelationshipType.java
===================================================================
--- modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObjectRelationshipType.java 2010-05-24 09:04:05 UTC (rev 12777)
+++ modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObjectRelationshipType.java 2010-05-24 09:07:58 UTC (rev 12778)
@@ -6,6 +6,9 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
+import org.jboss.seam.security.annotations.management.IdentityProperty;
+import org.jboss.seam.security.annotations.management.PropertyType;
+
/**
*
* @author Shane Bryzak
@@ -29,6 +32,7 @@
this.id = id;
}
+ @IdentityProperty(PropertyType.NAME)
public String getName()
{
return name;
Modified: modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObjectType.java
===================================================================
--- modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObjectType.java 2010-05-24 09:04:05 UTC (rev 12777)
+++ modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/model/IdentityObjectType.java 2010-05-24 09:07:58 UTC (rev 12778)
@@ -6,6 +6,9 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
+import org.jboss.seam.security.annotations.management.IdentityProperty;
+import org.jboss.seam.security.annotations.management.PropertyType;
+
/**
*
* @author Shane Bryzak
@@ -29,6 +32,7 @@
this.id = id;
}
+ @IdentityProperty(PropertyType.NAME)
public String getName()
{
return name;
14 years
Seam SVN: r12777 - modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2010-05-24 05:04:05 -0400 (Mon, 24 May 2010)
New Revision: 12777
Added:
modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/IdentityProperty.java
modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/PropertyType.java
Removed:
modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/IdentityEntityName.java
modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/IdentityEntityType.java
modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/IdentityEntityValue.java
modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/RelationshipFrom.java
modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/RelationshipTo.java
Log:
let's do this a different way...
Deleted: modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/IdentityEntityName.java
===================================================================
--- modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/IdentityEntityName.java 2010-05-24 08:58:55 UTC (rev 12776)
+++ modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/IdentityEntityName.java 2010-05-24 09:04:05 UTC (rev 12777)
@@ -1,23 +0,0 @@
-package org.jboss.seam.security.annotations.management;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- *
- * @author Shane Bryzak
- */
-@Target({METHOD,FIELD})
-@Documented
-@Retention(RUNTIME)
-@Inherited
-public @interface IdentityEntityName
-{
-
-}
Deleted: modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/IdentityEntityType.java
===================================================================
--- modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/IdentityEntityType.java 2010-05-24 08:58:55 UTC (rev 12776)
+++ modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/IdentityEntityType.java 2010-05-24 09:04:05 UTC (rev 12777)
@@ -1,22 +0,0 @@
-package org.jboss.seam.security.annotations.management;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- *
- * @author Shane Bryzak
- */
-@Target({METHOD,FIELD})
-@Documented
-@Retention(RUNTIME)
-@Inherited
-public @interface IdentityEntityType {
-
-}
Deleted: modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/IdentityEntityValue.java
===================================================================
--- modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/IdentityEntityValue.java 2010-05-24 08:58:55 UTC (rev 12776)
+++ modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/IdentityEntityValue.java 2010-05-24 09:04:05 UTC (rev 12777)
@@ -1,23 +0,0 @@
-package org.jboss.seam.security.annotations.management;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- *
- * @author Shane Bryzak
- */
-@Target({METHOD,FIELD})
-@Documented
-@Retention(RUNTIME)
-@Inherited
-public @interface IdentityEntityValue
-{
-
-}
Added: modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/IdentityProperty.java
===================================================================
--- modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/IdentityProperty.java (rev 0)
+++ modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/IdentityProperty.java 2010-05-24 09:04:05 UTC (rev 12777)
@@ -0,0 +1,22 @@
+package org.jboss.seam.security.annotations.management;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ *
+ * @author Shane Bryzak
+ */
+@Target({METHOD,FIELD})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface IdentityProperty {
+ PropertyType value();
+}
Added: modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/PropertyType.java
===================================================================
--- modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/PropertyType.java (rev 0)
+++ modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/PropertyType.java 2010-05-24 09:04:05 UTC (rev 12777)
@@ -0,0 +1,9 @@
+package org.jboss.seam.security.annotations.management;
+
+/**
+ *
+ * @author Shane Bryzak
+ */
+public enum PropertyType {
+ NAME, TYPE, VALUE, RELATIONSHIP_FROM, RELATIONSHIP_TO
+}
Deleted: modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/RelationshipFrom.java
===================================================================
--- modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/RelationshipFrom.java 2010-05-24 08:58:55 UTC (rev 12776)
+++ modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/RelationshipFrom.java 2010-05-24 09:04:05 UTC (rev 12777)
@@ -1,24 +0,0 @@
-package org.jboss.seam.security.annotations.management;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- *
- * @author Shane Bryzak
- *
- */
-@Target({METHOD,FIELD})
-@Documented
-@Retention(RUNTIME)
-@Inherited
-public @interface RelationshipFrom
-{
-
-}
Deleted: modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/RelationshipTo.java
===================================================================
--- modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/RelationshipTo.java 2010-05-24 08:58:55 UTC (rev 12776)
+++ modules/security/trunk/api/src/main/java/org/jboss/seam/security/annotations/management/RelationshipTo.java 2010-05-24 09:04:05 UTC (rev 12777)
@@ -1,23 +0,0 @@
-package org.jboss.seam.security.annotations.management;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- *
- * @author Shane Bryzak
- *
- */
-@Target({METHOD,FIELD})
-@Documented
-@Retention(RUNTIME)
-@Inherited
-public @interface RelationshipTo {
-
-}
14 years