[richfaces-svn-commits] JBoss Rich Faces SVN: r19005 - in branches/RFPL-434/core/commons: src/main/java/org/richfaces and 2 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Sat Aug 28 15:55:30 EDT 2010


Author: nbelaevski
Date: 2010-08-28 15:55:30 -0400 (Sat, 28 Aug 2010)
New Revision: 19005

Added:
   branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/
   branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java
   branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/InterpolationException.java
   branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageBundle.java
   branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageFactory.java
   branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageInterpolator.java
   branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/CoreMessages.java
   branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/FacesMessages.java
Modified:
   branches/RFPL-434/core/commons/pom.xml
Log:
RFPL-434

Modified: branches/RFPL-434/core/commons/pom.xml
===================================================================
--- branches/RFPL-434/core/commons/pom.xml	2010-08-27 13:58:13 UTC (rev 19004)
+++ branches/RFPL-434/core/commons/pom.xml	2010-08-28 19:55:30 UTC (rev 19005)
@@ -54,6 +54,10 @@
             <artifactId>jsf-mock</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+        </dependency>
     </dependencies>
     
     <scm>

Added: branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java	                        (rev 0)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/BundleLoader.java	2010-08-28 19:55:30 UTC (rev 19005)
@@ -0,0 +1,192 @@
+/*
+ * 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.richfaces.l10n;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import javax.faces.application.Application;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+
+import com.google.common.base.Function;
+import com.google.common.collect.MapMaker;
+
+/**
+ * @author Nick Belaevski
+ * 
+ */
+public class BundleLoader {
+
+    private static final class BundleKey {
+
+        private Locale locale;
+
+        private String baseName;
+
+        public BundleKey(String baseName, Locale locale) {
+            super();
+            this.baseName = baseName;
+            this.locale = locale;
+        }
+
+        public String getBaseName() {
+            return baseName;
+        }
+
+        public Locale getLocale() {
+            return locale;
+        }
+
+        @Override
+        public int hashCode() {
+            final int prime = 31;
+            int result = 1;
+            result = prime * result + ((baseName == null) ? 0 : baseName.hashCode());
+            result = prime * result + ((locale == null) ? 0 : locale.hashCode());
+            return result;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            BundleKey other = (BundleKey) obj;
+            if (baseName == null) {
+                if (other.baseName != null) {
+                    return false;
+                }
+            } else if (!baseName.equals(other.baseName)) {
+                return false;
+            }
+            if (locale == null) {
+                if (other.locale != null) {
+                    return false;
+                }
+            } else if (!locale.equals(other.locale)) {
+                return false;
+            }
+            return true;
+        }
+
+    }
+
+    private static ConcurrentMap<ClassLoader, ConcurrentMap<BundleKey, ResourceBundle>> bundlesCache = new MapMaker()
+        .weakKeys().makeComputingMap(new Function<ClassLoader, ConcurrentMap<BundleKey, ResourceBundle>>() {
+
+            public ConcurrentMap<BundleKey, ResourceBundle> apply(ClassLoader from) {
+                return new ConcurrentHashMap<BundleKey, ResourceBundle>();
+            };
+
+        });
+
+    private ClassLoader getClassLoader() {
+        return Thread.currentThread().getContextClassLoader();
+    }
+
+    private MessageBundle asMessageBundle(Enum<?> messageKey) throws IllegalArgumentException {
+        MessageBundle bundleAnnotation = messageKey.getClass().getAnnotation(MessageBundle.class);
+
+        if (bundleAnnotation == null) {
+            throw new IllegalArgumentException(MessageFormat.format(
+                "Cannot detect baseName for enumeration {0} in class {1}", messageKey.toString(), messageKey.getClass()
+                    .getName()));
+        }
+
+        return bundleAnnotation;
+    }
+
+    private Locale detectLocale(FacesContext context) {
+        UIViewRoot viewRoot = context.getViewRoot();
+        if (viewRoot != null && viewRoot.getLocale() != null) {
+            return viewRoot.getLocale();
+        }
+
+        return Locale.getDefault();
+    }
+
+    protected ResourceBundle getOrCreateResourceBundle(BundleKey bundleKey) throws MissingResourceException {
+        ClassLoader loader = getClassLoader();
+        ConcurrentMap<BundleKey, ResourceBundle> bundles = bundlesCache.get(loader);
+        ResourceBundle bundle = bundles.get(bundleKey);
+
+        if (bundle == null) {
+            bundle = ResourceBundle.getBundle(bundleKey.getBaseName(), bundleKey.getLocale(), loader);
+            bundles.put(bundleKey, bundle);
+        }
+
+        return bundle;
+    }
+
+    public ResourceBundle getBundle(Enum<?> messageKey, Locale locale) throws MissingResourceException,
+        IllegalArgumentException {
+        MessageBundle bundleAnnotation = asMessageBundle(messageKey);
+        BundleKey bundleKey = new BundleKey(bundleAnnotation.baseName(), locale);
+
+        ResourceBundle bundle = getOrCreateResourceBundle(bundleKey);
+
+        return bundle;
+    }
+
+    public ResourceBundle getApplicationBundle(FacesContext facesContext, Enum<?> messageKey, boolean useDefaultLocale)
+        throws MissingResourceException, IllegalArgumentException  {
+        
+        MessageBundle messageBundle = asMessageBundle(messageKey);
+        
+        if (facesContext == null) {
+            throw new MissingResourceException("FacesContext is null", getClass().getName(), messageKey.toString());
+        }
+
+        if (!messageBundle.useApplicationBundle()) {
+            throw new MissingResourceException("MessageBundle annotation doesn't declare application bundle as used", 
+                getClass().getName(), messageKey.toString());
+        }
+        
+        Application application = facesContext.getApplication();
+        
+        if (application == null || application.getMessageBundle() == null) {
+            throw new MissingResourceException("Cannot read message bundle name from application", 
+                getClass().getName(), messageKey.toString());
+        }
+        
+        Locale locale;
+        if (!useDefaultLocale) {
+            locale = detectLocale(facesContext);
+        } else {
+            locale = Locale.getDefault();
+        }
+        
+        BundleKey bundleKey = new BundleKey(application.getMessageBundle(), locale);
+        return getOrCreateResourceBundle(bundleKey);
+    }
+}

Added: branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/InterpolationException.java
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/InterpolationException.java	                        (rev 0)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/InterpolationException.java	2010-08-28 19:55:30 UTC (rev 19005)
@@ -0,0 +1,74 @@
+/*
+ * 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.richfaces.l10n;
+
+/**
+ * @author Nick Belaevski
+ * 
+ */
+public class InterpolationException extends Exception {
+
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 218954633540769880L;
+
+    private String messageKey;
+    
+    /**
+     * 
+     */
+    public InterpolationException() {
+        super();
+    }
+
+    /**
+     * @param message
+     * @param cause
+     */
+    public InterpolationException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    /**
+     * @param message
+     */
+    public InterpolationException(String message) {
+        super(message);
+    }
+
+    /**
+     * @param cause
+     */
+    public InterpolationException(Throwable cause) {
+        super(cause);
+    }
+
+    public InterpolationException initMessageKey(String messageKey) {
+        this.messageKey = messageKey;
+        return this;
+    }
+    
+    public String getMessageKey() {
+        return messageKey;
+    }
+}

Added: branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageBundle.java
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageBundle.java	                        (rev 0)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageBundle.java	2010-08-28 19:55:30 UTC (rev 19005)
@@ -0,0 +1,41 @@
+/*
+ * 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.richfaces.l10n;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @author Nick Belaevski
+ * 
+ */
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target(ElementType.TYPE)
+public @interface MessageBundle {
+
+    public String baseName(); 
+    
+    public boolean useApplicationBundle();
+    
+}

Added: branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageFactory.java
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageFactory.java	                        (rev 0)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageFactory.java	2010-08-28 19:55:30 UTC (rev 19005)
@@ -0,0 +1,154 @@
+/*
+ * 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.richfaces.l10n;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.application.FacesMessage.Severity;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Nick Belaevski
+ * 
+ */
+public class MessageFactory {
+
+    private enum BundleLoaderInvoker {
+        application {
+            @Override
+            public ResourceBundle getBundle(BundleLoader bundleLoader, FacesContext context, Enum<?> messageKey,
+                Locale locale) throws MissingResourceException {
+
+                return bundleLoader.getApplicationBundle(context, messageKey, false);
+            }
+        }, 
+        
+        annotation {
+            @Override
+            public ResourceBundle getBundle(BundleLoader bundleLoader, FacesContext context, Enum<?> messageKey,
+                Locale locale) throws MissingResourceException {
+
+                return bundleLoader.getBundle(messageKey, locale);
+            }
+        }, 
+        
+        applicationDefaultLocale {
+            @Override
+            public ResourceBundle getBundle(BundleLoader bundleLoader, FacesContext context, Enum<?> messageKey,
+                Locale locale) throws MissingResourceException {
+
+                return bundleLoader.getApplicationBundle(context, messageKey, true);
+            }
+        }, 
+        
+        anotationDefaultLocale {
+            @Override
+            public ResourceBundle getBundle(BundleLoader bundleLoader, FacesContext context, Enum<?> messageKey,
+                Locale locale) throws MissingResourceException {
+
+                return bundleLoader.getBundle(messageKey, Locale.getDefault());
+            }
+        };
+
+        public abstract ResourceBundle getBundle(BundleLoader bundleLoader, FacesContext context, Enum<?> messageKey,
+            Locale locale) throws MissingResourceException;
+    }
+
+    private BundleLoader bundleLoader;
+
+    public MessageFactory(BundleLoader bundleLoader) {
+        super();
+        this.bundleLoader = bundleLoader;
+    }
+
+    public FacesMessage createMessage(FacesContext facesContext, Enum<?> messageKey, Object... args) {
+        return createMessage(facesContext, FacesMessage.SEVERITY_INFO, messageKey, args);
+    }
+
+    public FacesMessage createMessage(FacesContext facesContext, Severity severity, Enum<?> messageKey, Object... args) {
+        Locale locale;
+        FacesMessage result = null;
+
+        if (facesContext != null) {
+            UIViewRoot viewRoot = facesContext.getViewRoot();
+
+            if (viewRoot != null) {
+                locale = viewRoot.getLocale();
+
+                if (locale != null) {
+                    result = createMessage(facesContext, severity, locale, messageKey, args);
+                }
+            }
+        }
+
+        if (result == null) {
+            locale = Locale.getDefault();
+            result = createMessage(facesContext, severity, locale, messageKey, args);
+        }
+
+        return result;
+    }
+
+    protected FacesMessage createMessage(FacesContext context, Severity severity, Locale locale, Enum<?> messageKey,
+        Object... args) {
+        
+        MessageBundle messageBundle = messageKey.getClass().getAnnotation(MessageBundle.class);
+
+        if (messageBundle == null) {
+            return null;
+        }
+
+        String messageId = messageKey.toString();
+
+        String summary = null;
+        String detail = null;
+
+        for (BundleLoaderInvoker invoker : BundleLoaderInvoker.values()) {
+            try {
+                ResourceBundle bundle = invoker.getBundle(bundleLoader, context, messageKey, locale);
+                summary = bundle.getString(messageId);
+                detail = bundle.getString(messageId + "_detail");
+            } catch (MissingResourceException e) {
+                // do nothing
+            }
+            
+            if (summary != null) {
+                break;
+            }
+        }
+
+        String formattedSummary = MessageFormat.format(summary, args);
+        String formattedDetail = null;
+
+        if (detail != null) {
+            formattedDetail = MessageFormat.format(detail, args);
+        }
+
+        return new FacesMessage(severity, formattedSummary, formattedDetail);
+    }
+
+}

Added: branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageInterpolator.java
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageInterpolator.java	                        (rev 0)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/l10n/MessageInterpolator.java	2010-08-28 19:55:30 UTC (rev 19005)
@@ -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.richfaces.l10n;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Nick Belaevski
+ * 
+ */
+public class MessageInterpolator {
+
+    private BundleLoader bundleLoader;
+    
+    private boolean checkApplicationBundle;
+
+    public MessageInterpolator(BundleLoader bundleLoader) {
+        this(bundleLoader, false);
+    }
+    
+    public MessageInterpolator(BundleLoader bundleLoader, boolean checkApplicationBundle) {
+        super();
+        this.bundleLoader = bundleLoader;
+        this.checkApplicationBundle = checkApplicationBundle;
+    }
+
+    protected String getMessageKey(Enum<?> key) {
+        return key.toString();
+    }
+    
+    protected String getPattern(Locale locale, Enum<?> key) throws MissingResourceException {
+        String messageKey = getMessageKey(key);
+        try {
+            ResourceBundle bundle = bundleLoader.getBundle(key, locale);
+            String messagePattern = bundle.getString(messageKey);
+            
+            return messagePattern;
+        } catch (MissingResourceException e) {
+            if (checkApplicationBundle) {
+                FacesContext facesContext = FacesContext.getCurrentInstance();
+                try {
+                    ResourceBundle bundle = bundleLoader.getApplicationBundle(facesContext, key, false);
+                    return bundle.getString(messageKey);
+                } catch (MissingResourceException e1) {
+                    ResourceBundle bundle = bundleLoader.getApplicationBundle(facesContext, key, true);
+                    return bundle.getString(messageKey);
+                }
+            } else {
+                throw e;
+            }
+        }
+    }
+    
+    public String interpolate(Locale locale, Enum<?> key, Object... args) throws InterpolationException {
+        try {
+            String messagePattern = getPattern(locale, key);
+            return MessageFormat.format(messagePattern, args);
+        } catch (MissingResourceException e) {
+            throw new InterpolationException(e).initMessageKey(key.toString());
+        }
+    }
+    
+}

Added: branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/CoreMessages.java
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/CoreMessages.java	                        (rev 0)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/CoreMessages.java	2010-08-28 19:55:30 UTC (rev 19005)
@@ -0,0 +1,36 @@
+/*
+ * 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.richfaces.log;
+
+import org.richfaces.l10n.MessageBundle;
+
+
+/**
+ * @author Nick Belaevski
+ * 
+ */
+ at MessageBundle(baseName = "org.richfaces.Messages", useApplicationBundle = true)
+public final class CoreMessages {
+
+    private CoreMessages() {}
+
+}

Added: branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/FacesMessages.java
===================================================================
--- branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/FacesMessages.java	                        (rev 0)
+++ branches/RFPL-434/core/commons/src/main/java/org/richfaces/log/FacesMessages.java	2010-08-28 19:55:30 UTC (rev 19005)
@@ -0,0 +1,109 @@
+/*
+ * 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.richfaces.log;
+
+import javax.faces.application.FacesMessage;
+
+import org.richfaces.l10n.MessageBundle;
+
+/**
+ * @author Nick Belaevski
+ * 
+ */
+ at MessageBundle(baseName = FacesMessage.FACES_MESSAGES, useApplicationBundle = true)
+public enum FacesMessages {
+
+    UIINPUT_CONVERSION("javax.faces.component.UIInput.CONVERSION"),
+    UIINPUT_REQUIRED("javax.faces.component.UIInput.REQUIRED"),
+    UIINPUT_UPDATE("javax.faces.component.UIInput.UPDATE"),
+    UISELECTONE_INVALID("javax.faces.component.UISelectOne.INVALID"),
+    UISELECTMANY_INVALID("javax.faces.component.UISelectMany.INVALID"),
+    BIG_DECIMAL_CONVERTER_DECIMAL("javax.faces.converter.BigDecimalConverter.DECIMAL"),
+    BIG_DECIMAL_CONVERTER_DECIMAL_DETAIL("javax.faces.converter.BigDecimalConverter.DECIMAL_detail"),
+    BIG_INTEGER_CONVERTER_BIGINTEGER("javax.faces.converter.BigIntegerConverter.BIGINTEGER"),
+    BIG_INTEGER_CONVERTER_BIGINTEGER_DETAIL("javax.faces.converter.BigIntegerConverter.BIGINTEGER_detail"),
+    BOOLEAN_CONVERTER_BOOLEAN("javax.faces.converter.BooleanConverter.BOOLEAN"),
+    BOOLEAN_CONVERTER_BOOLEAN_DETAIL("javax.faces.converter.BooleanConverter.BOOLEAN_detail"),
+    BYTE_CONVERTER_BYTE("javax.faces.converter.ByteConverter.BYTE"),
+    BYTE_CONVERTER_BYTE_DETAIL("javax.faces.converter.ByteConverter.BYTE_detail"),
+    CHARACTER_CONVERTER_CHARACTER("javax.faces.converter.CharacterConverter.CHARACTER"),
+    CHARACTER_CONVERTER_CHARACTER_DETAIL("javax.faces.converter.CharacterConverter.CHARACTER_detail"),
+    DATE_TIME_CONVERTER_DATE("javax.faces.converter.DateTimeConverter.DATE"),
+    DATE_TIME_CONVERTER_DATE_DETAIL("javax.faces.converter.DateTimeConverter.DATE_detail"),
+    DATE_TIME_CONVERTER_TIME("javax.faces.converter.DateTimeConverter.TIME"),
+    DATE_TIME_CONVERTER_TIME_DETAIL("javax.faces.converter.DateTimeConverter.TIME_detail"),
+    DATE_TIME_CONVERTER_DATETIME("javax.faces.converter.DateTimeConverter.DATETIME"),
+    DATE_TIME_CONVERTER_DATETIME_DETAIL("javax.faces.converter.DateTimeConverter.DATETIME_detail"),
+    DATE_TIME_CONVERTER_PATTERN_TYPE("javax.faces.converter.DateTimeConverter.PATTERN_TYPE"),
+    DOUBLE_CONVERTER_DOUBLE("javax.faces.converter.DoubleConverter.DOUBLE"),
+    DOUBLE_CONVERTER_DOUBLE_DETAIL("javax.faces.converter.DoubleConverter.DOUBLE_detail"),
+    ENUM_CONVERTER_ENUM("javax.faces.converter.EnumConverter.ENUM"),
+    ENUM_CONVERTER_ENUM_DETAIL("javax.faces.converter.EnumConverter.ENUM_detail"),
+    ENUM_CONVERTER_ENUM_NO_CLASS("javax.faces.converter.EnumConverter.ENUM_NO_CLASS"),
+    ENUM_CONVERTER_ENUM_NO_CLASS_DETAIL("javax.faces.converter.EnumConverter.ENUM_NO_CLASS_detail"),
+    FLOAT_CONVERTER_FLOAT("javax.faces.converter.FloatConverter.FLOAT"),
+    FLOAT_CONVERTER_FLOAT_DETAIL("javax.faces.converter.FloatConverter.FLOAT_detail"),
+    INTEGER_CONVERTER_INTEGER("javax.faces.converter.IntegerConverter.INTEGER"),
+    INTEGER_CONVERTER_INTEGER_DETAIL("javax.faces.converter.IntegerConverter.INTEGER_detail"),
+    LONG_CONVERTER_LONG("javax.faces.converter.LongConverter.LONG"),
+    LONG_CONVERTER_LONG_DETAIL("javax.faces.converter.LongConverter.LONG_detail"),
+    NUMBER_CONVERTER_CURRENCY("javax.faces.converter.NumberConverter.CURRENCY"),
+    NUMBER_CONVERTER_CURRENCY_DETAIL("javax.faces.converter.NumberConverter.CURRENCY_detail"),
+    NUMBER_CONVERTER_PERCENT("javax.faces.converter.NumberConverter.PERCENT"),
+    NUMBER_CONVERTER_PERCENT_DETAIL("javax.faces.converter.NumberConverter.PERCENT_detail"),
+    NUMBER_CONVERTER_NUMBER("javax.faces.converter.NumberConverter.NUMBER"),
+    NUMBER_CONVERTER_NUMBER_DETAIL("javax.faces.converter.NumberConverter.NUMBER_detail"),
+    NUMBER_CONVERTER_PATTERN("javax.faces.converter.NumberConverter.PATTERN"),
+    NUMBER_CONVERTER_PATTERN_DETAIL("javax.faces.converter.NumberConverter.PATTERN_detail"),
+    SHORT_CONVERTER_SHORT("javax.faces.converter.ShortConverter.SHORT"),
+    SHORT_CONVERTER_SHORT_DETAIL("javax.faces.converter.ShortConverter.SHORT_detail"),
+    CONVERTER_STRING("javax.faces.converter.STRING"),
+    DOUBLE_RANGE_VALIDATOR_MAXIMUM("javax.faces.validator.DoubleRangeValidator.MAXIMUM"),
+    DOUBLE_RANGE_VALIDATOR_MINIMUM("javax.faces.validator.DoubleRangeValidator.MINIMUM"),
+    DOUBLE_RANGE_VALIDATOR_NOT_IN_RANGE("javax.faces.validator.DoubleRangeValidator.NOT_IN_RANGE"),
+    DOUBLE_RANGE_VALIDATOR_TYPE("javax.faces.validator.DoubleRangeValidator.TYPE"),
+    LENGTH_VALIDATOR_MAXIMUM("javax.faces.validator.LengthValidator.MAXIMUM"),
+    LENGTH_VALIDATOR_MINIMUM("javax.faces.validator.LengthValidator.MINIMUM"),
+    LONG_RANGE_VALIDATOR_MAXIMUM("javax.faces.validator.LongRangeValidator.MAXIMUM"),
+    LONG_RANGE_VALIDATOR_MINIMUM("javax.faces.validator.LongRangeValidator.MINIMUM"),
+    LONG_RANGE_VALIDATOR_NOT_IN_RANGE("javax.faces.validator.LongRangeValidator.NOT_IN_RANGE"),
+    LONG_RANGE_VALIDATOR_TYPE("javax.faces.validator.LongRangeValidator.TYPE"),
+    VALIDATOR_NOT_IN_RANGE("javax.faces.validator.NOT_IN_RANGE"),
+    REGEX_VALIDATOR_PATTERN_NOT_SET("javax.faces.validator.RegexValidator.PATTERN_NOT_SET"),
+    REGEX_VALIDATOR_PATTERN_NOT_SET_DETAIL("javax.faces.validator.RegexValidator.PATTERN_NOT_SET_detail"),
+    REGEX_VALIDATOR_NOT_MATCHED("javax.faces.validator.RegexValidator.NOT_MATCHED"),
+    REGEX_VALIDATOR_NOT_MATCHED_DETAIL("javax.faces.validator.RegexValidator.NOT_MATCHED_detail"),
+    REGEX_VALIDATOR_MATCH_EXCEPTION("javax.faces.validator.RegexValidator.MATCH_EXCEPTION"),
+    REGEX_VALIDATOR_MATCH_EXCEPTION_DETAIL("javax.faces.validator.RegexValidator.MATCH_EXCEPTION_detail"),
+    BEAN_VALIDATOR_MESSAGE("javax.faces.validator.BeanValidator.MESSAGE");
+
+    private String key;
+
+    private FacesMessages(String key) {
+        this.key = key;
+    }
+
+    @Override
+    public String toString() {
+        return key;
+    }
+}



More information about the richfaces-svn-commits mailing list