juneau-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamesbog...@apache.org
Subject [44/51] [partial] incubator-juneau git commit: Merge changes from GitHub repo.
Date Mon, 01 Aug 2016 16:54:09 GMT
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/244cc21a/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/DirectoryResource.java
----------------------------------------------------------------------
diff --git a/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/DirectoryResource.java b/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/DirectoryResource.java
new file mode 100755
index 0000000..53b79b9
--- /dev/null
+++ b/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/DirectoryResource.java
@@ -0,0 +1,357 @@
+/***************************************************************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations under the License.
+ ***************************************************************************************************************************/
+package org.apache.juneau.microservice.resources;
+
+import static java.util.logging.Level.*;
+import static javax.servlet.http.HttpServletResponse.*;
+import static org.apache.juneau.html.HtmlDocSerializerContext.*;
+import static org.apache.juneau.server.RestServletContext.*;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import java.util.logging.*;
+
+import javax.servlet.*;
+
+import org.apache.juneau.*;
+import org.apache.juneau.annotation.*;
+import org.apache.juneau.microservice.*;
+import org.apache.juneau.server.*;
+import org.apache.juneau.server.annotation.*;
+import org.apache.juneau.server.converters.*;
+import org.apache.juneau.transforms.*;
+import org.apache.juneau.utils.*;
+
+/**
+ * REST resource that allows access to a file system directory.
+ * <p>
+ * 	The root directory is specified in one of two ways:
+ * </p>
+ * <ul class='spaced-list'>
+ * 	<li>Specifying the location via a <l>DirectoryResource.rootDir</l> property.
+ * 	<li>Overriding the {@link #getRootDir()} method.
+ * </ul>
+ * <p>
+ * 	Read/write access control is handled through the following properties:
+ * </p>
+ * <ul class='spaced-list'>
+ * 	<li><l>DirectoryResource.allowViews</l> - If <jk>true</jk>, allows view and download access to files.
+ * 	<li><l>DirectoryResource.allowPuts</l> - If <jk>true</jk>, allows files to be created or overwritten.
+ * 	<li><l>DirectoryResource.allowDeletes</l> - If <jk>true</jk>, allows files to be deleted.
+ * </ul>
+ * <p>
+ * 	Access can also be controlled by overriding the {@link #checkAccess(RestRequest)} method.
+ * </p>
+ */
+@RestResource(
+	label="File System Explorer",
+	description="Contents of $A{path}",
+	messages="nls/DirectoryResource",
+	properties={
+		@Property(name=HTML_uriAnchorText, value=PROPERTY_NAME),
+		@Property(name=HTMLDOC_links, value="{up:'$R{requestParentURI}',options:'?method=OPTIONS',source:'$R{servletParentURI}/source?classes=(org.apache.juneau.server.samples.DirectoryResource)'}"),
+		@Property(name=REST_allowMethodParam, value="*"),
+		@Property(name="DirectoryResource.rootDir", value=""),
+		@Property(name="DirectoryResource.allowViews", value="false"),
+		@Property(name="DirectoryResource.allowDeletes", value="false"),
+		@Property(name="DirectoryResource.allowPuts", value="false")
+	}
+)
+public class DirectoryResource extends Resource {
+	private static final long serialVersionUID = 1L;
+
+	private File rootDir;     // The root directory
+
+	// Settings enabled through servlet init parameters
+	private boolean allowDeletes, allowPuts, allowViews;
+
+	private static Logger logger = Logger.getLogger(DirectoryResource.class.getName());
+
+	@Override /* Servlet */
+	public void init() throws ServletException {
+		ObjectMap p = getProperties();
+		rootDir = new File(p.getString("DirectoryResource.rootDir"));
+		allowViews = p.getBoolean("DirectoryResource.allowViews", false);
+		allowDeletes = p.getBoolean("DirectoryResource.allowDeletes", false);
+		allowPuts = p.getBoolean("DirectoryResource.allowPuts", false);
+	}
+
+	/**
+	 * Returns the root directory defined by the 'rootDir' init parameter.
+	 * Subclasses can override this method to provide their own root directory.
+	 * @return The root directory.
+	 */
+	protected File getRootDir() {
+		if (rootDir == null) {
+			rootDir = new File(getProperties().getString("rootDir"));
+			if (! rootDir.exists())
+				if (! rootDir.mkdirs())
+					throw new RuntimeException("Could not create root dir");
+		}
+		return rootDir;
+	}
+
+	/**
+	 * [GET /*]
+	 *  On directories, returns a directory listing.
+	 *  On files, returns information about the file.
+	 *
+	 * @param req The HTTP request.
+	 * @return Either a FileResource or list of FileResources depending on whether it's a
+	 * 	file or directory.
+	 * @throws Exception - If file could not be read or access was not granted.
+	 */
+	@RestMethod(name="GET", path="/*",
+		description="On directories, returns a directory listing.\nOn files, returns information about the file.",
+		converters={Queryable.class}
+	)
+	public Object doGet(RestRequest req) throws Exception {
+		checkAccess(req);
+
+		String pathInfo = req.getPathInfo();
+		File f = pathInfo == null ? rootDir : new File(rootDir.getAbsolutePath() + pathInfo);
+
+		if (!f.exists())
+			throw new RestException(SC_NOT_FOUND, "File not found");
+
+		req.setAttribute("path", f.getAbsolutePath());
+
+		if (f.isDirectory()) {
+			List<FileResource> l = new LinkedList<FileResource>();
+			for (File fc : f.listFiles()) {
+				URL fUrl = new URL(req.getRequestURL().append("/").append(fc.getName()).toString());
+				l.add(new FileResource(fc, fUrl));
+			}
+			return l;
+		}
+
+		return new FileResource(f, new URL(req.getRequestURL().toString()));
+	}
+
+	/**
+	 * [DELETE /*]
+	 *  Delete a file on the file system.
+	 *
+	 * @param req The HTTP request.
+	 * @return The message <js>"File deleted"</js> if successful.
+	 * @throws Exception - If file could not be read or access was not granted.
+	 */
+	@RestMethod(name="DELETE", path="/*",
+		description="Delete a file on the file system."
+	)
+	public Object doDelete(RestRequest req) throws Exception {
+		checkAccess(req);
+
+		File f = new File(rootDir.getAbsolutePath() + req.getPathInfo());
+		deleteFile(f);
+
+		if (req.getHeader("Accept").contains("text/html"))
+			return new Redirect();
+		return "File deleted";
+	}
+
+	/**
+	 * [PUT /*]
+	 * Add or overwrite a file on the file system.
+	 *
+	 * @param req The HTTP request.
+	 * @return The message <js>"File added"</js> if successful.
+	 * @throws Exception - If file could not be read or access was not granted.
+	 */
+	@RestMethod(name="PUT", path="/*",
+		description="Add or overwrite a file on the file system."
+	)
+	public Object doPut(RestRequest req) throws Exception {
+		checkAccess(req);
+
+		File f = new File(rootDir.getAbsolutePath() + req.getPathInfo());
+		String parentSubPath = f.getParentFile().getAbsolutePath().substring(rootDir.getAbsolutePath().length());
+		BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(f));
+		IOPipe.create(req.getInputStream(), bos).closeOut().run();
+		if (req.getContentType().contains("html"))
+			return new Redirect(parentSubPath);
+		return "File added";
+	}
+
+	/**
+	 * [VIEW /*]
+	 * 	View the contents of a file.
+	 * 	Applies to files only.
+	 *
+	 * @param req The HTTP request.
+	 * @param res The HTTP response.
+	 * @return A Reader containing the contents of the file.
+	 * @throws Exception - If file could not be read or access was not granted.
+	 */
+	@RestMethod(name="VIEW", path="/*",
+		description="View the contents of a file.\nApplies to files only."
+	)
+	public Reader doView(RestRequest req, RestResponse res) throws Exception {
+		checkAccess(req);
+
+		File f = new File(rootDir.getAbsolutePath() + req.getPathInfo());
+
+		if (!f.exists())
+			throw new RestException(SC_NOT_FOUND, "File not found");
+
+		if (f.isDirectory())
+			throw new RestException(SC_METHOD_NOT_ALLOWED, "VIEW not available on directories");
+
+		res.setContentType("text/plain");
+		return new FileReader(f);
+	}
+
+	/**
+	 * [DOWNLOAD /*]
+	 * 	Download the contents of a file.
+	 * 	Applies to files only.
+	 *
+	 * @param req The HTTP request.
+	 * @param res The HTTP response.
+	 * @return A Reader containing the contents of the file.
+	 * @throws Exception - If file could not be read or access was not granted.
+	 */
+	@RestMethod(name="DOWNLOAD", path="/*",
+		description="Download the contents of a file.\nApplies to files only."
+	)
+	public Reader doDownload(RestRequest req, RestResponse res) throws Exception {
+		checkAccess(req);
+
+		File f = new File(rootDir.getAbsolutePath() + req.getPathInfo());
+
+		if (!f.exists())
+			throw new RestException(SC_NOT_FOUND, "File not found");
+
+		if (f.isDirectory())
+			throw new RestException(SC_METHOD_NOT_ALLOWED, "DOWNLOAD not available on directories");
+
+		res.setContentType("application");
+		return new FileReader(f);
+	}
+
+	/**
+	 * Verify that the specified request is allowed.
+	 * Subclasses can override this method to provide customized behavior.
+	 * Method should throw a {@link RestException} if the request should be disallowed.
+	 *
+	 * @param req The HTTP request.
+	 */
+	protected void checkAccess(RestRequest req) {
+		String method = req.getMethod();
+		if (method.equals("VIEW") && ! allowViews)
+			throw new RestException(SC_METHOD_NOT_ALLOWED, "VIEW not enabled");
+		if (method.equals("PUT") && ! allowPuts)
+			throw new RestException(SC_METHOD_NOT_ALLOWED, "PUT not enabled");
+		if (method.equals("DELETE") && ! allowDeletes)
+			throw new RestException(SC_METHOD_NOT_ALLOWED, "DELETE not enabled");
+		if (method.equals("DOWNLOAD") && ! allowViews)
+			throw new RestException(SC_METHOD_NOT_ALLOWED, "DOWNLOAD not enabled");
+	}
+
+	/** File POJO */
+	public class FileResource {
+		private File f;
+		private URL url;
+
+		/**
+		 * Constructor.
+		 * @param f The file.
+		 * @param url The URL of the file resource.
+		 */
+		public FileResource(File f, URL url) {
+			this.f = f;
+			this.url = url;
+		}
+
+		// Bean property getters
+
+		/**
+		 * @return The URL of the file resource.
+		 */
+		public URL getUrl() {
+			return url;
+		}
+
+		/**
+		 * @return The file type.
+		 */
+		public String getType() {
+			return (f.isDirectory() ? "dir" : "file");
+		}
+
+		/**
+		 * @return The file name.
+		 */
+		public String getName() {
+			return f.getName();
+		}
+
+		/**
+		 * @return The file size.
+		 */
+		public long getSize() {
+			return f.length();
+		}
+
+		/**
+		 * @return The file last modified timestamp.
+		 */
+		@BeanProperty(transform=DateTransform.ISO8601DTP.class)
+		public Date getLastModified() {
+			return new Date(f.lastModified());
+		}
+
+		/**
+		 * @return A hyperlink to view the contents of the file.
+		 * @throws Exception If access is not allowed.
+		 */
+		public URL getView() throws Exception {
+			if (allowViews && f.canRead() && ! f.isDirectory())
+				return new URL(url + "?method=VIEW");
+			return null;
+		}
+
+		/**
+		 * @return A hyperlink to download the contents of the file.
+		 * @throws Exception If access is not allowed.
+		 */
+		public URL getDownload() throws Exception {
+			if (allowViews && f.canRead() && ! f.isDirectory())
+				return new URL(url + "?method=DOWNLOAD");
+			return null;
+		}
+
+		/**
+		 * @return A hyperlink to delete the file.
+		 * @throws Exception If access is not allowed.
+		 */
+		public URL getDelete() throws Exception {
+			if (allowDeletes && f.canWrite())
+				return new URL(url + "?method=DELETE");
+			return null;
+		}
+	}
+
+	/** Utility method */
+	private void deleteFile(File f) {
+		try {
+			if (f.isDirectory())
+				for (File fc : f.listFiles())
+					deleteFile(fc);
+			f.delete();
+		} catch (Exception e) {
+			logger.log(WARNING, "Cannot delete file '" + f.getAbsolutePath() + "'", e);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/244cc21a/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/LogEntryFormatter.java
----------------------------------------------------------------------
diff --git a/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/LogEntryFormatter.java b/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/LogEntryFormatter.java
new file mode 100644
index 0000000..413c815
--- /dev/null
+++ b/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/LogEntryFormatter.java
@@ -0,0 +1,256 @@
+/***************************************************************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations under the License.
+ ***************************************************************************************************************************/
+package org.apache.juneau.microservice.resources;
+
+import java.text.*;
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+import java.util.logging.*;
+import java.util.logging.Formatter;
+import java.util.regex.*;
+
+import org.apache.juneau.internal.*;
+
+/**
+ * Log entry formatter.
+ * <p>
+ * 	Uses three simple parameter for configuring log entry formats:
+ * 	<ul class='spaced-list'>
+ * 		<li><code>dateFormat</code> - A {@link SimpleDateFormat} string describing the format for dates.
+ * 		<li><code>format</code> - A string with <code>{...}</code> replacement variables representing predefined fields.
+ * 		<li><code>useStackTraceHashes</code> - A setting that causes duplicate stack traces to be replaced with 8-character hash strings.
+ * 	</ul>
+ * <p>
+ * 	This class converts the format strings into a regular expression that can be used to parse the resulting log file.
+ *
+ * @author jbognar
+ */
+public class LogEntryFormatter extends Formatter {
+
+	private ConcurrentHashMap<String,AtomicInteger> hashes;
+	private DateFormat df;
+	private String format;
+	private Pattern rePattern;
+	private Map<String,Integer> fieldIndexes;
+
+	/**
+	 * Create a new formatter.
+	 *
+	 * @param format The log entry format.  e.g. <js>"[{date} {level}] {msg}%n"</js>
+	 * 	The string can contain any of the following variables:
+	 * 		<ol>
+	 * 			<li><js>"{date}"</js> - The date, formatted per <js>"Logging/dateFormat"</js>.
+	 * 			<li><js>"{class}"</js> - The class name.
+	 * 			<li><js>"{method}"</js> - The method name.
+	 * 			<li><js>"{logger}"</js> - The logger name.
+	 * 			<li><js>"{level}"</js> - The log level name.
+	 * 			<li><js>"{msg}"</js> - The log message.
+	 * 			<li><js>"{threadid}"</js> - The thread ID.
+	 * 			<li><js>"{exception}"</js> - The localized exception message.
+	 *		</ol>
+	 * @param dateFormat The {@link SimpleDateFormat} format to use for dates.  e.g. <js>"yyyy.MM.dd hh:mm:ss"</js>.
+	 * @param useStackTraceHashes If <jk>true</jk>, only print unique stack traces once and then refer to them by a
+	 * 	simple 8 character hash identifier.
+	 */
+	public LogEntryFormatter(String format, String dateFormat, boolean useStackTraceHashes) {
+		this.df = new SimpleDateFormat(dateFormat);
+		if (useStackTraceHashes)
+			hashes = new ConcurrentHashMap<String,AtomicInteger>();
+
+		fieldIndexes = new HashMap<String,Integer>();
+
+		format = format
+			.replaceAll("\\{date\\}", "%1\\$s")
+			.replaceAll("\\{class\\}", "%2\\$s")
+			.replaceAll("\\{method\\}", "%3\\$s")
+			.replaceAll("\\{logger\\}", "%4\\$s")
+			.replaceAll("\\{level\\}", "%5\\$s")
+			.replaceAll("\\{msg\\}", "%6\\$s")
+			.replaceAll("\\{threadid\\}", "%7\\$s")
+			.replaceAll("\\{exception\\}", "%8\\$s");
+
+		this.format = format;
+
+		// Construct a regular expression to match this log entry.
+		int index = 1;
+		StringBuilder re = new StringBuilder();
+		int S1 = 1; // Looking for %
+		int S2 = 2; // Found %, looking for number.
+		int S3 = 3; // Found number, looking for $.
+		int S4 = 4; // Found $, looking for s.
+		int state = 1;
+		int i1 = 0;
+		for (int i = 0; i < format.length(); i++) {
+			char c = format.charAt(i);
+			if (state == S1) {
+				if (c == '%')
+					state = S2;
+				else {
+					if (! (Character.isLetterOrDigit(c) || Character.isWhitespace(c)))
+						re.append('\\');
+					re.append(c);
+				}
+			} else if (state == S2) {
+				if (Character.isDigit(c)) {
+					i1 = i;
+					state = S3;
+				} else {
+					re.append("\\%").append(c);
+					state = S1;
+				}
+			} else if (state == S3) {
+				if (c == '$') {
+					state = S4;
+				} else {
+					re.append("\\%").append(format.substring(i1, i));
+					state = S1;
+				}
+			} else if (state == S4) {
+				if (c == 's') {
+					int group = Integer.parseInt(format.substring(i1, i-1));
+					switch (group) {
+						case 1:
+							fieldIndexes.put("date", index++);
+							re.append("(" + dateFormat.replaceAll("[mHhsSdMy]", "\\\\d").replaceAll("\\.", "\\\\.") + ")");
+							break;
+						case 2:
+							fieldIndexes.put("class", index++);
+							re.append("([\\p{javaJavaIdentifierPart}\\.]+)");
+							break;
+						case 3:
+							fieldIndexes.put("method", index++);
+							re.append("([\\p{javaJavaIdentifierPart}\\.]+)");
+							break;
+						case 4:
+							fieldIndexes.put("logger", index++);
+							re.append("([\\w\\d\\.\\_]+)");
+							break;
+						case 5:
+							fieldIndexes.put("level", index++);
+							re.append("(SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST)");
+							break;
+						case 6:
+							fieldIndexes.put("msg", index++);
+							re.append("(.*)");
+							break;
+						case 7:
+							fieldIndexes.put("threadid", index++);
+							re.append("(\\\\d+)");
+							break;
+						case 8:
+							fieldIndexes.put("exception", index++);
+							re.append("(.*)");
+							break;
+					}
+				} else {
+					re.append("\\%").append(format.substring(i1, i));
+				}
+				state = S1;
+			}
+		}
+
+		// The log parser
+		String sre = re.toString();
+		if (sre.endsWith("\\%n"))
+			sre = sre.substring(0, sre.length()-3);
+
+		// Replace instances of %n.
+		sre = sre.replaceAll("\\\\%n", "\\\\n");
+
+		rePattern = Pattern.compile(sre);
+		fieldIndexes = Collections.unmodifiableMap(fieldIndexes);
+	}
+
+	/**
+	 * Returns the regular expression pattern used for matching log entries.
+	 *
+	 * @return The regular expression pattern used for matching log entries.
+	 */
+	public Pattern getLogEntryPattern() {
+		return rePattern;
+	}
+
+	/**
+	 * Returns the {@link DateFormat} used for matching dates.
+	 *
+	 * @return The {@link DateFormat} used for matching dates.
+	 */
+	public DateFormat getDateFormat() {
+		return df;
+	}
+
+	/**
+	 * Given a matcher that has matched the pattern specified by {@link #getLogEntryPattern()},
+	 * returns the field value from the match.
+	 *
+	 * @param fieldName The field name.  Possible values are:
+	 * 	<ul>
+	 * 		<li><js>"date"</js>
+	 * 		<li><js>"class"</js>
+	 * 		<li><js>"method"</js>
+	 * 		<li><js>"logger"</js>
+	 * 		<li><js>"level"</js>
+	 * 		<li><js>"msg"</js>
+	 * 		<li><js>"threadid"</js>
+	 * 		<li><js>"exception"</js>
+	 *	</ul>
+	 * @param m The matcher.
+	 * @return The field value, or <jk>null</jk> if the specified field does not exist.
+	 */
+	public String getField(String fieldName, Matcher m) {
+		Integer i = fieldIndexes.get(fieldName);
+		return (i == null ? null : m.group(i));
+	}
+
+	@Override /* Formatter */
+	public String format(LogRecord r) {
+		String msg = formatMessage(r);
+		Throwable t = r.getThrown();
+		String hash = null;
+		int c = 0;
+		if (hashes != null && t != null) {
+			hash = hashCode(t);
+			hashes.putIfAbsent(hash, new AtomicInteger(0));
+			c = hashes.get(hash).incrementAndGet();
+			if (c == 1) {
+				msg = '[' + hash + '.' + c + "] " + msg;
+			} else {
+				msg = '[' + hash + '.' + c + "] " + msg + ", " + t.getLocalizedMessage();
+				t = null;
+			}
+		}
+		String s = String.format(format,
+			df.format(new Date(r.getMillis())),
+			r.getSourceClassName(),
+			r.getSourceMethodName(),
+			r.getLoggerName(),
+			r.getLevel(),
+			msg,
+			r.getThreadID(),
+			r.getThrown() == null ? "" : r.getThrown().getMessage());
+		if (t != null)
+			s += String.format("%n%s", StringUtils.getStackTrace(r.getThrown()));
+		return s;
+	}
+
+	private String hashCode(Throwable t) {
+		int i = 0;
+		while (t != null) {
+			for (StackTraceElement e : t.getStackTrace())
+				i ^= e.hashCode();
+			t = t.getCause();
+		}
+		return Integer.toHexString(i);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/244cc21a/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/LogParser.java
----------------------------------------------------------------------
diff --git a/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/LogParser.java b/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/LogParser.java
new file mode 100644
index 0000000..3984a45
--- /dev/null
+++ b/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/LogParser.java
@@ -0,0 +1,229 @@
+/***************************************************************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations under the License.
+ ***************************************************************************************************************************/
+package org.apache.juneau.microservice.resources;
+
+import java.io.*;
+import java.nio.charset.*;
+import java.text.*;
+import java.util.*;
+import java.util.regex.*;
+
+
+/**
+ * Utility class for reading log files.
+ * <p>
+ * Provides the capability of returning splices of log files based on dates and filtering based
+ * on thread and logger names.
+ */
+public class LogParser implements Iterable<LogParser.Entry>, Iterator<LogParser.Entry> {
+	private BufferedReader br;
+	private LogEntryFormatter formatter;
+	private Date start, end;
+	private Set<String> loggerFilter, severityFilter;
+	private String threadFilter;
+	private Entry next;
+
+	/**
+	 * Constructor.
+	 *
+	 * @param formatter The log entry formatter.
+	 * @param f The log file.
+	 * @param start Don't return rows before this date.  If <jk>null</jk>, start from the beginning of the file.
+	 * @param end Don't return rows after this date.  If <jk>null</jk>, go to the end of the file.
+	 * @param thread Only return log entries with this thread name.
+	 * @param loggers Only return log entries produced by these loggers (simple class names).
+	 * @param severity Only return log entries with the specified severity.
+	 * @throws IOException
+	 */
+	public LogParser(LogEntryFormatter formatter, File f, Date start, Date end, String thread, String[] loggers, String[] severity) throws IOException {
+		br = new BufferedReader(new InputStreamReader(new FileInputStream(f), Charset.defaultCharset()));
+		this.formatter = formatter;
+		this.start = start;
+		this.end = end;
+		this.threadFilter = thread;
+		if (loggers != null)
+			this.loggerFilter = new HashSet<String>(Arrays.asList(loggers));
+		if (severity != null)
+			this.severityFilter = new HashSet<String>(Arrays.asList(severity));
+
+		// Find the first line.
+		String line;
+		while (next == null && (line = br.readLine()) != null) {
+			Entry e = new Entry(line);
+			if (e.matches())
+				next = e;
+		}
+	}
+
+	@Override /* Iterator */
+	public boolean hasNext() {
+		return next != null;
+	}
+
+	@Override /* Iterator */
+	public Entry next() {
+		Entry current = next;
+		Entry prev = next;
+		try {
+			next = null;
+			String line = null;
+			while (next == null && (line = br.readLine()) != null) {
+				Entry e = new Entry(line);
+				if (e.isRecord) {
+					if (e.matches())
+						next = e;
+					prev = null;
+ 				} else {
+					if (prev != null)
+						prev.addText(e.line);
+				}
+			}
+		} catch (IOException e) {
+			throw new RuntimeException(e);
+		}
+		return current;
+	}
+
+	@Override /* Iterator */
+	public void remove() {
+		throw new NoSuchMethodError();
+	}
+
+	@Override /* Iterable */
+	public Iterator<Entry> iterator() {
+		return this;
+	}
+
+	/**
+	 * Closes the underlying reader.
+	 *
+	 * @throws IOException
+	 */
+	public void close() throws IOException {
+		br.close();
+	}
+
+	/**
+	 * Serializes the contents of the parsed log file to the specified writer
+	 * and then closes the underlying reader.
+	 *
+	 * @param w The writer to write the log file to.
+	 * @throws IOException
+	 */
+	public void writeTo(Writer w) throws IOException {
+		try {
+			if (! hasNext())
+				w.append("[EMPTY]"); //$NON-NLS-1$
+			else for (LogParser.Entry le : this)
+				le.append(w);
+		} finally {
+			close();
+		}
+	}
+
+	/**
+	 * Represents a single line from the log file.
+	 */
+	@SuppressWarnings("javadoc")
+	public class Entry {
+		public Date date;
+		public String severity, logger;
+		protected String line, text;
+		protected String thread;
+		protected List<String> additionalText;
+		protected boolean isRecord;
+
+		Entry(String line) throws IOException {
+			try {
+				this.line = line;
+				Matcher m = formatter.getLogEntryPattern().matcher(line);
+				if (m.matches()) {
+					isRecord = true;
+					String s = formatter.getField("date", m);
+					if (s != null)
+						date = formatter.getDateFormat().parse(s);
+					thread = formatter.getField("thread", m);
+					severity = formatter.getField("level", m);
+					logger = formatter.getField("logger", m);
+					text = formatter.getField("msg", m);
+					if (logger != null && logger.indexOf('.') > -1)
+						logger = logger.substring(logger.lastIndexOf('.')+1);
+				}
+			} catch (ParseException e) {
+				throw new IOException(e);
+			}
+		}
+
+		private void addText(String t) {
+			if (additionalText == null)
+				additionalText = new LinkedList<String>();
+			additionalText.add(t);
+		}
+
+		public String getText() {
+			if (additionalText == null)
+				return text;
+			int i = text.length();
+			for (String s : additionalText)
+				i += s.length() + 1;
+			StringBuilder sb = new StringBuilder(i);
+			sb.append(text);
+			for (String s : additionalText)
+				sb.append('\n').append(s);
+			return sb.toString();
+		}
+
+		public String getThread() {
+			return thread;
+		}
+
+		public Writer appendHtml(Writer w) throws IOException {
+			w.append(toHtml(line)).append("<br>"); //$NON-NLS-1$
+			if (additionalText != null)
+				for (String t : additionalText)
+					w.append(toHtml(t)).append("<br>"); //$NON-NLS-1$
+			return w;
+		}
+
+		protected Writer append(Writer w) throws IOException {
+			w.append(line).append('\n');
+			if (additionalText != null)
+				for (String t : additionalText)
+					w.append(t).append('\n');
+			return w;
+		}
+
+		private boolean matches() {
+			if (! isRecord)
+				return false;
+			if (start != null && date.before(start))
+				return false;
+			if (end != null && date.after(end))
+				return false;
+			if (threadFilter != null && ! threadFilter.equals(thread))
+				return false;
+			if (loggerFilter != null && ! loggerFilter.contains(logger))
+				return false;
+			if (severityFilter != null && ! severityFilter.contains(severity))
+				return false;
+			return true;
+		}
+	}
+
+	private String toHtml(String s) {
+		if (s.indexOf('<') != -1)
+			return s.replaceAll("<", "&lt;");  //$NON-NLS-1$//$NON-NLS-2$
+		return s;
+	}
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/244cc21a/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java
----------------------------------------------------------------------
diff --git a/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java b/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java
new file mode 100755
index 0000000..1d945f4
--- /dev/null
+++ b/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java
@@ -0,0 +1,302 @@
+/***************************************************************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations under the License.
+ ***************************************************************************************************************************/
+package org.apache.juneau.microservice.resources;
+
+import static javax.servlet.http.HttpServletResponse.*;
+import static org.apache.juneau.html.HtmlDocSerializerContext.*;
+import static org.apache.juneau.server.RestServletContext.*;
+
+import java.io.*;
+import java.net.*;
+import java.nio.charset.*;
+import java.util.*;
+
+import org.apache.juneau.*;
+import org.apache.juneau.annotation.*;
+import org.apache.juneau.dto.*;
+import org.apache.juneau.ini.*;
+import org.apache.juneau.internal.*;
+import org.apache.juneau.microservice.*;
+import org.apache.juneau.server.*;
+import org.apache.juneau.server.annotation.*;
+import org.apache.juneau.server.annotation.Properties;
+import org.apache.juneau.server.converters.*;
+import org.apache.juneau.transforms.*;
+
+/**
+ * REST resource for viewing and accessing log files.
+ */
+@RestResource(
+	path="/logs",
+	label="Log files",
+	description="Log files from this service",
+	properties={
+		@Property(name=HTML_uriAnchorText, value=PROPERTY_NAME),
+		@Property(name=REST_allowMethodParam, value="true")
+	},
+	transforms={
+		IteratorTransform.class,       // Allows Iterators and Iterables to be serialized.
+		DateTransform.ISO8601DT.class  // Serialize Date objects as ISO8601 strings.
+	}
+)
+@SuppressWarnings("nls")
+public class LogsResource extends Resource {
+	private static final long serialVersionUID = 1L;
+
+	private ConfigFile cf = getConfig();
+
+	private File logDir = new File(cf.getString("Logging/logDir", "."));
+	private LogEntryFormatter leFormatter = new LogEntryFormatter(
+		cf.getString("Logging/format", "[{date} {level}] {msg}%n"),
+		cf.getString("Logging/dateFormat", "yyyy.MM.dd hh:mm:ss"),
+		cf.getBoolean("Logging/useStackTraceHashes")
+	);
+
+	private final FileFilter filter = new FileFilter() {
+		@Override /* FileFilter */
+		public boolean accept(File f) {
+			return f.isDirectory() || f.getName().endsWith(".log");
+		}
+	};
+
+	/**
+	 * [GET /*] - Get file details or directory listing.
+	 *
+	 * @param req The HTTP request
+	 * @param properties The writable properties for setting the descriptions.
+	 * @param path The log file path.
+	 * @return The log file.
+	 * @throws Exception
+	 */
+	@RestMethod(name="GET", path="/*", rc={200,404})
+	public Object getFileOrDirectory(RestRequest req, @Properties ObjectMap properties, @PathRemainder String path) throws Exception {
+
+		File f = getFile(path);
+
+		if (f.isDirectory()) {
+			Set<FileResource> l = new TreeSet<FileResource>(new FileResourceComparator());
+			for (File fc : f.listFiles(filter)) {
+				URL fUrl = new URL(req.getTrimmedRequestURL().append('/').append(fc.getName()).toString());
+				l.add(new FileResource(fc, fUrl));
+			}
+			properties.put(HTMLDOC_description, "Contents of " + f.getAbsolutePath());
+			return l;
+		}
+
+		properties.put(HTMLDOC_description, "File details on " + f.getAbsolutePath());
+		return new FileResource(f, new URL(req.getTrimmedRequestURL().toString()));
+	}
+
+	/**
+	 * [VIEW /*] - Retrieve the contents of a log file.
+	 *
+	 * @param req The HTTP request.
+	 * @param res The HTTP response.
+	 * @param path The log file path.
+	 * @param properties The writable properties for setting the descriptions.
+	 * @param highlight If <code>true</code>, add color highlighting based on severity.
+	 * @param start Optional start timestamp.  Don't print lines logged before the specified timestamp.  Example:  "&start=2014-01-23 11:25:47".
+	 * @param end Optional end timestamp.  Don't print lines logged after the specified timestamp.  Example:  "&end=2014-01-23 11:25:47".
+	 * @param thread Optional thread name filter.  Only show log entries with the specified thread name.  Example: "&thread=pool-33-thread-1".
+	 * @param loggers Optional logger filter.  Only show log entries if they were produced by one of the specified loggers (simple class name).  Example: "&loggers=(LinkIndexService,LinkIndexRestService)".
+	 * @param severity Optional severity filter.  Only show log entries with the specified severity.  Example: "&severity=(ERROR,WARN)".
+	 * @throws Exception
+	 */
+	@RestMethod(name="VIEW", path="/*", rc={200,404})
+	@SuppressWarnings("nls")
+	public void viewFile(RestRequest req, RestResponse res, @PathRemainder String path, @Properties ObjectMap properties, @Param("highlight") boolean highlight, @Param("start") String start, @Param("end") String end, @Param("thread") String thread, @Param("loggers") String[] loggers, @Param("severity") String[] severity) throws Exception {
+
+		File f = getFile(path);
+		if (f.isDirectory())
+			throw new RestException(SC_METHOD_NOT_ALLOWED, "View not available on directories");
+
+		Date startDate = StringUtils.parseISO8601Date(start), endDate = StringUtils.parseISO8601Date(end);
+
+		if (! highlight) {
+			Object o = getReader(f, startDate, endDate, thread, loggers, severity);
+			res.setContentType("text/plain");
+			if (o instanceof Reader)
+				res.setOutput(o);
+			else {
+				LogParser p = (LogParser)o;
+				Writer w = res.getNegotiatedWriter();
+				try {
+					p.writeTo(w);
+				} finally {
+					w.flush();
+					w.close();
+				}
+			}
+			return;
+		}
+
+		res.setContentType("text/html");
+		PrintWriter w = res.getNegotiatedWriter();
+		try {
+			w.println("<html><body style='font-family:monospace;font-size:8pt;white-space:pre;'>");
+			LogParser lp = getLogParser(f, startDate, endDate, thread, loggers, severity);
+			try {
+				if (! lp.hasNext())
+					w.append("<span style='color:gray'>[EMPTY]</span>");
+				else for (LogParser.Entry le : lp) {
+					char s = le.severity.charAt(0);
+					String color = "black";
+					//SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST
+					if (s == 'I')
+						color = "#006400";
+					else if (s == 'W')
+						color = "#CC8400";
+					else if (s == 'E' || s == 'S')
+						color = "#DD0000";
+					else if (s == 'D' || s == 'F' || s == 'T')
+						color = "#000064";
+					w.append("<span style='color:").append(color).append("'>");
+					le.appendHtml(w).append("</span>");
+				}
+				w.append("</body></html>");
+			} finally {
+				lp.close();
+			}
+		} finally {
+			w.close();
+		}
+	}
+
+	/**
+	 * [VIEW /*] - Retrieve the contents of a log file as parsed entries.
+	 *
+	 * @param req The HTTP request.
+	 * @param path The log file path.
+	 * @param start Optional start timestamp.  Don't print lines logged before the specified timestamp.  Example:  "&start=2014-01-23 11:25:47".
+	 * @param end Optional end timestamp.  Don't print lines logged after the specified timestamp.  Example:  "&end=2014-01-23 11:25:47".
+	 * @param thread Optional thread name filter.  Only show log entries with the specified thread name.  Example: "&thread=pool-33-thread-1".
+	 * @param loggers Optional logger filter.  Only show log entries if they were produced by one of the specified loggers (simple class name).  Example: "&loggers=(LinkIndexService,LinkIndexRestService)".
+	 * @param severity Optional severity filter.  Only show log entries with the specified severity.  Example: "&severity=(ERROR,WARN)".
+	 * @return The parsed contents of the log file.
+	 * @throws Exception
+	 */
+	@RestMethod(name="PARSE", path="/*", converters=Queryable.class, rc={200,404})
+	public LogParser viewParsedEntries(RestRequest req, @PathRemainder String path, @Param("start") String start, @Param("end") String end, @Param("thread") String thread, @Param("loggers") String[] loggers, @Param("severity") String[] severity) throws Exception {
+
+		File f = getFile(path);
+		Date startDate = StringUtils.parseISO8601Date(start), endDate = StringUtils.parseISO8601Date(end);
+
+		if (f.isDirectory())
+			throw new RestException(SC_METHOD_NOT_ALLOWED, "View not available on directories");
+
+		return getLogParser(f, startDate, endDate, thread, loggers, severity);
+	}
+
+	/**
+	 * [DOWNLOAD /*] - Download file.
+	 *
+	 * @param res The HTTP response.
+	 * @param path The log file path.
+	 * @return The contents of the log file.
+	 * @throws Exception
+	 */
+	@RestMethod(name="DOWNLOAD", path="/*", rc={200,404})
+	public Object downloadFile(RestResponse res, @PathRemainder String path) throws Exception {
+
+		File f = getFile(path);
+
+		if (f.isDirectory())
+			throw new RestException(SC_METHOD_NOT_ALLOWED, "Download not available on directories");
+
+		res.setContentType("application/octet-stream"); //$NON-NLS-1$
+		res.setContentLength((int)f.length());
+		return new FileInputStream(f);
+	}
+
+	/**
+	 * [DELETE /*] - Delete a file.
+	 *
+	 * @param path The log file path.
+	 * @return A redirect object to the root.
+	 * @throws Exception
+	 */
+	@RestMethod(name="DELETE", path="/*", rc={200,404})
+	public Object deleteFile(@PathRemainder String path) throws Exception {
+
+		File f = getFile(path);
+
+		if (f.isDirectory())
+			throw new RestException(SC_BAD_REQUEST, "Delete not available on directories.");
+
+		if (f.canWrite())
+			if (! f.delete())
+				throw new RestException(SC_FORBIDDEN, "Could not delete file.");
+
+		return new Redirect(path + "/.."); //$NON-NLS-1$
+	}
+
+	private static BufferedReader getReader(File f) throws IOException {
+		return new BufferedReader(new InputStreamReader(new FileInputStream(f), Charset.defaultCharset()));
+	}
+
+	private File getFile(String path) {
+		if (path != null && path.indexOf("..") != -1)
+			throw new RestException(SC_NOT_FOUND, "File not found.");
+		File f = (path == null ? logDir : new File(logDir.getAbsolutePath() + '/' + path));
+		if (filter.accept(f))
+			return f;
+		throw new RestException(SC_NOT_FOUND, "File not found.");
+	}
+
+	/**
+	 * File bean.
+	 */
+	@SuppressWarnings("javadoc")
+	public static class FileResource {
+		private File f;
+		public String type;
+		public Object name;
+		public Long size;
+		@BeanProperty(transform=DateTransform.Medium.class) public Date lastModified;
+		public URL view, highlighted, parsed, download, delete;
+
+		public FileResource(File f, URL url) throws IOException {
+			this.f = f;
+			this.type = (f.isDirectory() ? "dir" : "file");
+			this.name = f.isDirectory() ? new Link(f.getName(), url.toString()) : f.getName();
+			this.size = f.isDirectory() ? null : f.length();
+			this.lastModified = new Date(f.lastModified());
+			if (f.canRead() && ! f.isDirectory()) {
+				this.view = new URL(url + "?method=VIEW");
+				this.highlighted = new URL(url + "?method=VIEW&highlight=true");
+				this.parsed = new URL(url + "?method=PARSE");
+				this.download = new URL(url + "?method=DOWNLOAD");
+				this.delete = new URL(url + "?method=DELETE");
+			}
+		}
+	}
+
+	private static class FileResourceComparator implements Comparator<FileResource>, Serializable {
+		private static final long serialVersionUID = 1L;
+		@Override /* Comparator */
+		public int compare(FileResource o1, FileResource o2) {
+			int c = o1.type.compareTo(o2.type);
+			return c != 0 ? c : o1.f.getName().compareTo(o2.f.getName());
+		}
+	}
+
+	private Object getReader(File f, final Date start, final Date end, final String thread, final String[] loggers, final String[] severity) throws IOException {
+		if (start == null && end == null && thread == null && loggers == null)
+			return getReader(f);
+		return getLogParser(f, start, end, thread, loggers, severity);
+	}
+
+	private LogParser getLogParser(File f, final Date start, final Date end, final String thread, final String[] loggers, final String[] severity) throws IOException {
+		return new LogParser(leFormatter, f, start, end, thread, loggers, severity);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/244cc21a/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/SampleRootResource.java
----------------------------------------------------------------------
diff --git a/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/SampleRootResource.java b/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/SampleRootResource.java
new file mode 100755
index 0000000..0dcf933
--- /dev/null
+++ b/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/SampleRootResource.java
@@ -0,0 +1,31 @@
+/***************************************************************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations under the License.
+ ***************************************************************************************************************************/
+package org.apache.juneau.microservice.resources;
+
+import org.apache.juneau.microservice.*;
+import org.apache.juneau.server.annotation.*;
+
+/**
+ * Sample root REST resource.
+ *
+ * @author James Bognar (james.bognar@salesforce.com)
+ */
+@RestResource(
+	path="/",
+	label="Sample Root Resource",
+	description="This is a sample router page",
+	children={ConfigResource.class,LogsResource.class}
+)
+public class SampleRootResource extends ResourceGroup {
+	private static final long serialVersionUID = 1L;
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/244cc21a/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/ShutdownResource.java
----------------------------------------------------------------------
diff --git a/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/ShutdownResource.java b/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/ShutdownResource.java
new file mode 100755
index 0000000..924a165
--- /dev/null
+++ b/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/ShutdownResource.java
@@ -0,0 +1,52 @@
+/***************************************************************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations under the License.
+ ***************************************************************************************************************************/
+package org.apache.juneau.microservice.resources;
+
+import org.apache.juneau.microservice.*;
+import org.apache.juneau.server.annotation.*;
+
+/**
+ * Provides the capability to shut down this REST microservice through a REST call.
+ */
+@RestResource(
+	path="/shutdown",
+	label="Shut down this resource"
+)
+public class ShutdownResource extends Resource {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * [GET /] - Shutdown this resource.
+	 *
+	 * @return The string <js>"OK"</js>.
+	 * @throws Exception
+	 */
+	@RestMethod(name="GET", path="/", description="Show contents of config file.")
+	public String shutdown() throws Exception {
+		new Thread(
+			new Runnable() {
+				@Override /* Runnable */
+				public void run() {
+					try {
+						Thread.sleep(1000);
+					System.exit(0);
+					} catch (InterruptedException e) {
+						e.printStackTrace();
+					}
+				}
+			}
+		).start();
+		return "OK";
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/244cc21a/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/package.html
----------------------------------------------------------------------
diff --git a/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/package.html b/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/package.html
new file mode 100755
index 0000000..422f5d2
--- /dev/null
+++ b/org.apache.juneau.microservice/src/main/java/org/apache/juneau/microservice/resources/package.html
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML>
+<!--
+/***************************************************************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations under the License.
+ *
+ ***************************************************************************************************************************/
+ -->
+<html>
+<head>
+	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<style type="text/css">
+		/* For viewing in Page Designer */
+		@IMPORT url("../javadoc.css");
+		body { 
+			margin: 20px; 
+		}	
+	</style>
+</head>
+<body>
+<p>Predefined Microservice Resources</p>
+</body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/244cc21a/org.apache.juneau.releng/.classpath
----------------------------------------------------------------------
diff --git a/org.apache.juneau.releng/.classpath b/org.apache.juneau.releng/.classpath
new file mode 100755
index 0000000..3ea783e
--- /dev/null
+++ b/org.apache.juneau.releng/.classpath
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry exported="true" kind="lib" path="lib/derby/derby.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/jaxrs/jsr311-api-1.1.1.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/javax.servlet_2.5.0.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/commons-codec-1.9/commons-codec-1.9.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/commons-fileupload/org.apache.commons.fileupload_1.3.1.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/httpclient/commons-logging-1.1.1.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/httpclient/httpclient-4.5.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/httpclient/httpcomponents-client-4.5-src.zip"/>
+	<classpathentry exported="true" kind="lib" path="lib/httpclient/httpcore-4.4.1.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/httpclient/httpmime-4.5.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/jaxrs/wink-common-1.2.1-incubating.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/jaxrs/wink-server-1.2.1-incubating.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/jena/jena-core-2.7.1-sources.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/jena/jena-core-2.7.1.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/jena/jena-iri-0.9.2.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/jena/log4j-1.2.16.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/jena/slf4j-api-1.6.4.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/jena/slf4j-log4j12-1.6.4.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/junit/hamcrest-core-1.3.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/junit/junit-4.12.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/jena/xercesImpl-2.9.1.jar"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/244cc21a/org.apache.juneau.releng/.gitignore
----------------------------------------------------------------------
diff --git a/org.apache.juneau.releng/.gitignore b/org.apache.juneau.releng/.gitignore
new file mode 100644
index 0000000..a42a3f9
--- /dev/null
+++ b/org.apache.juneau.releng/.gitignore
@@ -0,0 +1,5 @@
+bin/
+build/
+old_source/
+/out.html
+/TESTS-TestSuites.xml

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/244cc21a/org.apache.juneau.releng/.jazzignore
----------------------------------------------------------------------
diff --git a/org.apache.juneau.releng/.jazzignore b/org.apache.juneau.releng/.jazzignore
new file mode 100755
index 0000000..f8f7ec4
--- /dev/null
+++ b/org.apache.juneau.releng/.jazzignore
@@ -0,0 +1,37 @@
+### Jazz Ignore 0
+# Ignored files and folders will not be committed, but may be modified during 
+# accept or update.  
+# - Ignore properties should contain a space separated list of filename patterns.  
+# - Each pattern is case sensitive and surrounded by braces ('{' and '}').  
+# - "*" matches zero or more characters.  
+# - "?" matches a single character.  
+# - The pattern list may be split across lines by ending the line with a 
+#     backslash and starting the next line with a tab.  
+# - Patterns in core.ignore prevent matching resources in the same 
+#     directory from being committed.  
+# - Patterns in core.ignore.recursive matching resources in the current 
+#     directory and all subdirectories from being committed.  
+# - The default value of core.ignore.recursive is *.class 
+# - The default value for core.ignore is bin 
+# 
+# To ignore shell scripts and hidden files in this subtree: 
+#     e.g: core.ignore.recursive = {*.sh} {\.*} 
+# 
+# To ignore resources named 'bin' in the current directory (but allow 
+#  them in any sub directorybelow): 
+#     e.g: core.ignore = {bin} 
+# 
+# NOTE: modifying ignore files will not change the ignore status of 
+#     Eclipse derived resources.
+
+core.ignore.recursive= \
+	{*.class} 
+
+core.ignore= \
+	{CT_Results} \
+	{CT_Results_html} \
+	{bin} \
+	{build} \
+	{doc} \
+	{docstage} \
+	{temp.build} 

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/244cc21a/org.apache.juneau.releng/.project
----------------------------------------------------------------------
diff --git a/org.apache.juneau.releng/.project b/org.apache.juneau.releng/.project
new file mode 100755
index 0000000..fa8e64f
--- /dev/null
+++ b/org.apache.juneau.releng/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.apache.juneau.releng</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/244cc21a/org.apache.juneau.releng/.settings/org.eclipse.jdt.core.prefs
----------------------------------------------------------------------
diff --git a/org.apache.juneau.releng/.settings/org.eclipse.jdt.core.prefs b/org.apache.juneau.releng/.settings/org.eclipse.jdt.core.prefs
new file mode 100755
index 0000000..9370afe
--- /dev/null
+++ b/org.apache.juneau.releng/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,25 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.source=1.6

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/244cc21a/org.apache.juneau.releng/META-INF/MANIFEST.MF
----------------------------------------------------------------------
diff --git a/org.apache.juneau.releng/META-INF/MANIFEST.MF b/org.apache.juneau.releng/META-INF/MANIFEST.MF
new file mode 100755
index 0000000..32b19be
--- /dev/null
+++ b/org.apache.juneau.releng/META-INF/MANIFEST.MF
@@ -0,0 +1,44 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Juneau Releng
+Bundle-SymbolicName: org.apache.juneau.releng
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: IBM
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ClassPath: 
+ lib/derby/derby.jar,
+ lib/jaxrs/jsr311-api-1.1.1.jar,
+ lib/httpclient/httpclient-4.5.jar,
+ lib/httpclient/httpmime-4.5.jar,
+ lib/httpclient/httpcore-4.4.1.jar
+Export-Package: 
+ com.hp.hpl.jena.rdf.model,
+ com.hp.hpl.jena.shared,
+ org.apache.derby.jdbc,
+ javax.ws.rs,
+ javax.ws.rs.core,
+ javax.ws.rs.ext,
+ org.apache.commons.fileupload,
+ org.apache.commons.fileupload.servlet,
+ org.apache.http,
+ org.apache.http.auth,
+ org.apache.http.client,
+ org.apache.http.client.config,
+ org.apache.http.client.entity,
+ org.apache.http.client.methods,
+ org.apache.http.client.params,
+ org.apache.http.client.utils,
+ org.apache.http.config,
+ org.apache.http.conn,
+ org.apache.http.conn.scheme,
+ org.apache.http.conn.ssl,
+ org.apache.http.conn.socket,
+ org.apache.http.entity,
+ org.apache.http.entity.mime,
+ org.apache.http.impl.client,
+ org.apache.http.impl.conn,
+ org.apache.http.impl.cookie,
+ org.apache.http.message,
+ org.apache.http.params,
+ org.apache.http.protocol,
+ org.apache.http.util

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/244cc21a/org.apache.juneau.releng/Readme.txt
----------------------------------------------------------------------
diff --git a/org.apache.juneau.releng/Readme.txt b/org.apache.juneau.releng/Readme.txt
new file mode 100755
index 0000000..dce0414
--- /dev/null
+++ b/org.apache.juneau.releng/Readme.txt
@@ -0,0 +1,33 @@
+#================================================================================
+# Juneau Components List
+#================================================================================
+
+---------------------------------------------------------------------------------
+juneau-all.jar
+Contains all binaries from the Core, Server, Client, and Microservice APIs
+---------------------------------------------------------------------------------
+
+---------------------------------------------------------------------------------
+bundles/*
+Contents of juneau-all.jar as individual OSGi bundles.
+---------------------------------------------------------------------------------
+
+---------------------------------------------------------------------------------
+source/*
+Same as the binaries, except includes all the source code as well.
+---------------------------------------------------------------------------------
+
+---------------------------------------------------------------------------------
+juneau-javadocs.war
+The docs for everything.
+---------------------------------------------------------------------------------
+
+---------------------------------------------------------------------------------
+microservice-project.zip
+The Eclipse project template for creating a microservice.
+---------------------------------------------------------------------------------
+
+---------------------------------------------------------------------------------
+microservice-samples-project.zip
+The Eclipse project for running the samples.
+---------------------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/244cc21a/org.apache.juneau.releng/build.properties
----------------------------------------------------------------------
diff --git a/org.apache.juneau.releng/build.properties b/org.apache.juneau.releng/build.properties
new file mode 100755
index 0000000..7444406
--- /dev/null
+++ b/org.apache.juneau.releng/build.properties
@@ -0,0 +1,33 @@
+# ***************************************************************************************************************************
+# * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
+# * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
+# * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            * 
+# * with the License.  You may obtain a copy of the License at                                                              *
+# *                                                                                                                         *
+# *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
+# *                                                                                                                         *
+# * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
+# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
+# * specific language governing permissions and limitations under the License.                                              *
+# ***************************************************************************************************************************
+
+bin.includes = lib/derby/derby.jar,\
+               lib/jaxrs/jsr311-api-1.1.1.jar,\
+               META-INF/,\
+               .
+jars.extra.classpath = lib/jaxrs/jsr311-api-1.1.1.jar,\
+                       lib/jena/jena-core-2.7.1-sources.jar,\
+                       lib/jena/jena-core-2.7.1.jar,\
+                       lib/jena/jena-iri-0.9.2.jar,\
+                       lib/jena/log4j-1.2.16.jar,\
+                       lib/jena/slf4j-api-1.6.4.jar,\
+                       lib/jena/slf4j-log4j12-1.6.4.jar
+nls_exclude=**/*.html
+
+jre.compilation.profile = JavaSE-1.6
+
+version = 6.0.0
+
+dir.build=build
+		
+


Mime
View raw message