[seam-commits] Seam SVN: r13235 - in examples/trunk/booking-simplified/src/main: java/org/jboss/seam/examples/booking/security and 3 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Thu Jun 17 22:53:28 EDT 2010
Author: lincolnthree
Date: 2010-06-17 22:53:28 -0400 (Thu, 17 Jun 2010)
New Revision: 13235
Added:
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/international/
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/international/status/
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/international/status/Bundles.java
examples/trunk/booking-simplified/src/main/webapp/WEB-INF/seam-beans.xml
Modified:
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/security/Authenticator.java
examples/trunk/booking-simplified/src/main/webapp/WEB-INF/beans.xml
Log:
Modified: examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/security/Authenticator.java
===================================================================
--- examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/security/Authenticator.java 2010-06-17 23:25:45 UTC (rev 13234)
+++ examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/security/Authenticator.java 2010-06-18 02:53:28 UTC (rev 13235)
@@ -23,6 +23,7 @@
import javax.ejb.Stateless;
import javax.enterprise.event.Event;
+import javax.enterprise.inject.Instance;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
@@ -43,7 +44,7 @@
public class Authenticator
{
@Inject
- private Logger log;
+ private Instance<Logger> log;
@PersistenceContext
private EntityManager em;
@@ -60,7 +61,7 @@
public boolean authenticate()
{
- log.info("Logging in " + credentials.getUsername());
+ log.get().info("Logging in " + credentials.getUsername());
if ((credentials.getUsername() == null) || (credentials.getPassword() == null))
{
messages.info(new DefaultBundleKey("identity.loginFailed"));
Added: examples/trunk/booking-simplified/src/main/java/org/jboss/seam/international/status/Bundles.java
===================================================================
--- examples/trunk/booking-simplified/src/main/java/org/jboss/seam/international/status/Bundles.java (rev 0)
+++ examples/trunk/booking-simplified/src/main/java/org/jboss/seam/international/status/Bundles.java 2010-06-18 02:53:28 UTC (rev 13235)
@@ -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;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+/**
+ * Maintains a global map of {@link ResourceBundle} objects.
+ *
+ * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
+ *
+ */
+ at Named
+ at ApplicationScoped
+public class Bundles implements Map<String, ResourceBundle>, Serializable
+{
+ private static final long serialVersionUID = 1207758648760266247L;
+
+ private final Map<String, ResourceBundle> bundles = new ConcurrentHashMap<String, ResourceBundle>();
+
+ @Inject
+ private Instance<Locale> locale;
+
+ 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)
+ {
+ Locale loc = locale.get();
+ String lookup = key.toString() + loc.toString();
+ if (!containsKey(lookup))
+ {
+ ResourceBundle bundle = ResourceBundle.getBundle(key.toString(), loc);
+ bundles.put(lookup, bundle);
+ }
+ return bundles.get(lookup);
+ }
+
+ 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
Modified: examples/trunk/booking-simplified/src/main/webapp/WEB-INF/beans.xml
===================================================================
--- examples/trunk/booking-simplified/src/main/webapp/WEB-INF/beans.xml 2010-06-17 23:25:45 UTC (rev 13234)
+++ examples/trunk/booking-simplified/src/main/webapp/WEB-INF/beans.xml 2010-06-18 02:53:28 UTC (rev 13235)
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:i18n="urn:java:org.jboss.seam.international.locale"
xsi:schemaLocation="
- http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
<interceptors>
<class>org.jboss.seam.faces.context.conversation.ConversationBoundaryInterceptor</class>
@@ -11,6 +10,5 @@
<alternatives>
<class>org.jboss.seam.examples.booking.bootstrap.ApplicationInitializer</class>
</alternatives>
- <!-- not being set -->
- <i18n:DefaultLocaleProducer defaultLocaleKey="en"/>
+
</beans>
Added: examples/trunk/booking-simplified/src/main/webapp/WEB-INF/seam-beans.xml
===================================================================
--- examples/trunk/booking-simplified/src/main/webapp/WEB-INF/seam-beans.xml (rev 0)
+++ examples/trunk/booking-simplified/src/main/webapp/WEB-INF/seam-beans.xml 2010-06-18 02:53:28 UTC (rev 13235)
@@ -0,0 +1,34 @@
+<!--
+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.
+-->
+<beans xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:s="urn:java:seam:core"
+ xmlns:lc="urn:java:org.jboss.seam.international.locale"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/javaee
+ http://docs.jboss.org/cdi/beans_1_0.xsd">
+
+ <lc:DefaultLocaleProducer>
+ <s:extends />
+ <lc:defaultLocaleKey>DE</lc:defaultLocaleKey>
+ </lc:DefaultLocaleProducer>
+</beans>
\ No newline at end of file
More information about the seam-commits
mailing list