You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2017/12/03 17:15:22 UTC

[1/2] juneau git commit: Improved microservice console support.

Repository: juneau
Updated Branches:
  refs/heads/master 14becdd04 -> 9b8b457fd


Improved microservice console support.

Project: http://git-wip-us.apache.org/repos/asf/juneau/repo
Commit: http://git-wip-us.apache.org/repos/asf/juneau/commit/9c7f3a44
Tree: http://git-wip-us.apache.org/repos/asf/juneau/tree/9c7f3a44
Diff: http://git-wip-us.apache.org/repos/asf/juneau/diff/9c7f3a44

Branch: refs/heads/master
Commit: 9c7f3a44ac875a020bd6c50a4be02c04db3fd508
Parents: 14becdd
Author: JamesBognar <ja...@apache.org>
Authored: Sun Dec 3 12:07:31 2017 -0500
Committer: JamesBognar <ja...@apache.org>
Committed: Sun Dec 3 12:07:31 2017 -0500

----------------------------------------------------------------------
 .../src/main/java/org/apache/juneau/utils/Args.java       | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/juneau/blob/9c7f3a44/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/Args.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/Args.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/Args.java
index 081e69b..b16e16d 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/Args.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/Args.java
@@ -17,6 +17,7 @@ import static org.apache.juneau.internal.StringUtils.*;
 import java.util.*;
 
 import org.apache.juneau.*;
+import org.apache.juneau.internal.*;
 
 /**
  * Utility class to make it easier to work with command-line arguments pass in through a
@@ -140,6 +141,15 @@ public final class Args extends ObjectMap {
 	}
 
 	/**
+	 * Constructor.
+	 *
+	 * @param args Arguments passed in as a raw command line.
+	 */
+	public Args(String args) {
+		this(StringUtils.splitQuoted(args));
+	}
+	
+	/**
 	 * Returns main argument at the specified index, or <jk>null</jk> if the index is out of range.
 	 *
 	 * <p>


[2/2] juneau git commit: Minor API changes.

Posted by ja...@apache.org.
Minor API changes.

Project: http://git-wip-us.apache.org/repos/asf/juneau/repo
Commit: http://git-wip-us.apache.org/repos/asf/juneau/commit/9b8b457f
Tree: http://git-wip-us.apache.org/repos/asf/juneau/tree/9b8b457f
Diff: http://git-wip-us.apache.org/repos/asf/juneau/diff/9b8b457f

Branch: refs/heads/master
Commit: 9b8b457fd1e504330836a56043670b5f90e48e40
Parents: 9c7f3a4
Author: JamesBognar <ja...@apache.org>
Authored: Sun Dec 3 12:15:18 2017 -0500
Committer: JamesBognar <ja...@apache.org>
Committed: Sun Dec 3 12:15:18 2017 -0500

----------------------------------------------------------------------
 .../org/apache/juneau/utils/MessageBundle.java  | 57 ++++++++++++++++++++
 1 file changed, 57 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/juneau/blob/9b8b457f/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/MessageBundle.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/MessageBundle.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/MessageBundle.java
index 84bb9cb..304f8a8 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/MessageBundle.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/MessageBundle.java
@@ -84,6 +84,63 @@ public class MessageBundle extends ResourceBundle {
 
 	/**
 	 * Constructor.
+	 * 
+	 * <p>
+	 * When this method is used, the bundle path is determined by searching for the resource bundle
+	 * in the following locations:
+	 * <ul>
+	 * 	<li><code>[package].ForClass.properties</code>
+	 * 	<li><code>[package].nls.ForClass.properties</code>
+	 * 	<li><code>[package].i18n.ForClass.properties</code>
+	 * </ul>
+	 * 
+	 * @param forClass The class 
+	 * @return A new message bundle belonging to the class.
+	 */
+	public static final MessageBundle create(Class<?> forClass) {
+		return create(forClass, findBundlePath(forClass));
+	}
+	
+	/**
+	 * Constructor.
+	 * 
+	 * <p>
+	 * A shortcut for calling <code>new MessageBundle(forClass, bundlePath)</code>.
+	 * 
+	 * 
+	 * @param forClass The class 
+	 * @param bundlePath The location of the resource bundle.
+	 * @return A new message bundle belonging to the class.
+	 */
+	public static final MessageBundle create(Class<?> forClass, String bundlePath) {
+		return new MessageBundle(forClass, bundlePath);
+	}
+	
+	private static final String findBundlePath(Class<?> forClass) {
+		String path = forClass.getName();
+		if (tryBundlePath(forClass, path))
+			return path;
+		path = forClass.getPackage().getName() + ".nls." + forClass.getSimpleName(); 
+		if (tryBundlePath(forClass, path))
+			return path;
+		path = forClass.getPackage().getName() + ".i18n." + forClass.getSimpleName();
+		if (tryBundlePath(forClass, path))
+			return path;
+		return null;
+	}
+	
+	private static final boolean tryBundlePath(Class<?> c, String path) {
+		try {
+			path = c.getName();
+			ResourceBundle.getBundle(path, Locale.getDefault(), c.getClassLoader());
+			return true;
+		} catch (MissingResourceException e) {
+			return false;
+		}
+	}
+
+	/**
+	 * Constructor.
 	 *
 	 * @param forClass The class using this resource bundle.
 	 * @param bundlePath