http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java ---------------------------------------------------------------------- diff --git a/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java b/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java deleted file mode 100755 index 1a813d9..0000000 --- a/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java +++ /dev/null @@ -1,348 +0,0 @@ -// *************************************************************************************************************************** -// * 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.rest.RestContext.*; -import static org.apache.juneau.rest.annotation.HookEvent.*; -import static org.apache.juneau.internal.StringUtils.*; - -import java.io.*; -import java.net.URI; -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.microservice.*; -import org.apache.juneau.rest.*; -import org.apache.juneau.rest.annotation.*; -import org.apache.juneau.rest.annotation.Properties; -import org.apache.juneau.rest.converters.*; -import org.apache.juneau.transforms.*; - -/** - * REST resource for viewing and accessing log files. - */ -@RestResource( - path="/logs", - title="Log files", - description="Log files from this service", - properties={ - @Property(name=HTML_uriAnchorText, value=PROPERTY_NAME), - }, - flags={REST_allowMethodParam}, - pojoSwaps={ - IteratorSwap.class, // Allows Iterators and Iterables to be serialized. - DateSwap.ISO8601DT.class // Serialize Date objects as ISO8601 strings. - } -) -@SuppressWarnings("nls") -public class LogsResource extends Resource { - private static final long serialVersionUID = 1L; - - private File logDir; - private LogEntryFormatter leFormatter; - - private final FileFilter filter = new FileFilter() { - @Override /* FileFilter */ - public boolean accept(File f) { - return f.isDirectory() || f.getName().endsWith(".log"); - } - }; - - /** - * Initializes the log directory and formatter. - * - * @param config The resource config. - * @throws Exception - */ - @RestHook(INIT) - public void init(RestConfig config) throws Exception { - ConfigFile cf = config.getConfigFile(); - - logDir = new File(cf.getString("Logging/logDir", ".")); - 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") - ); - } - - /** - * [GET /*] - Get file details or directory listing. - * - * @param req The HTTP request - * @param res The HTTP response - * @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="/*", - swagger=@MethodSwagger( - responses={@Response(200),@Response(404)} - ) - ) - public Object getFileOrDirectory(RestRequest req, RestResponse res, @Properties ObjectMap properties, @PathRemainder String path) throws Exception { - - File f = getFile(path); - - if (f.isDirectory()) { - Set<FileResource> l = new TreeSet<FileResource>(new FileResourceComparator()); - File[] files = f.listFiles(filter); - if (files != null) { - for (File fc : files) { - URI fUrl = new URI("servlet:/" + fc.getName()); - l.add(new FileResource(fc, fUrl)); - } - } - return l; - } - - return new FileResource(f, new URI("servlet:/")); - } - - /** - * [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="/*", - swagger=@MethodSwagger( - responses={@Response(200),@Response(404)} - ) - ) - @SuppressWarnings("nls") - public void viewFile(RestRequest req, RestResponse res, @PathRemainder String path, @Properties ObjectMap properties, @Query("highlight") boolean highlight, @Query("start") String start, @Query("end") String end, @Query("thread") String thread, @Query("loggers") String[] loggers, @Query("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 = parseISO8601Date(start), endDate = 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, - swagger=@MethodSwagger( - responses={@Response(200),@Response(404)} - ) - ) - public LogParser viewParsedEntries(RestRequest req, @PathRemainder String path, @Query("start") String start, @Query("end") String end, @Query("thread") String thread, @Query("loggers") String[] loggers, @Query("severity") String[] severity) throws Exception { - - File f = getFile(path); - Date startDate = parseISO8601Date(start), endDate = 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="/*", - swagger=@MethodSwagger( - responses={@Response(200),@Response(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"); - 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="/*", - swagger=@MethodSwagger( - responses={@Response(200),@Response(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 + "/.."); - } - - 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(swap=DateSwap.DateTimeMedium.class) public Date lastModified; - public URI view, highlighted, parsed, download, delete; - - public FileResource(File f, URI uri) throws Exception { - this.f = f; - this.type = (f.isDirectory() ? "dir" : "file"); - this.name = f.isDirectory() ? new Link(f.getName(), uri.toString()) : f.getName(); - this.size = f.isDirectory() ? null : f.length(); - this.lastModified = new Date(f.lastModified()); - if (f.canRead() && ! f.isDirectory()) { - this.view = new URI(uri + "?method=VIEW"); - this.highlighted = new URI(uri + "?method=VIEW&highlight=true"); - this.parsed = new URI(uri + "?method=PARSE"); - this.download = new URI(uri + "?method=DOWNLOAD"); - this.delete = new URI(uri + "?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/ab15d45b/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/SampleRootResource.java ---------------------------------------------------------------------- diff --git a/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/SampleRootResource.java b/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/SampleRootResource.java deleted file mode 100755 index 4122d6a..0000000 --- a/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/SampleRootResource.java +++ /dev/null @@ -1,29 +0,0 @@ -// *************************************************************************************************************************** -// * 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.rest.annotation.*; - -/** - * Sample root REST resource. - */ -@RestResource( - path="/", - title="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/ab15d45b/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/ShutdownResource.java ---------------------------------------------------------------------- diff --git a/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/ShutdownResource.java b/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/ShutdownResource.java deleted file mode 100755 index 5ef8d9f..0000000 --- a/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/ShutdownResource.java +++ /dev/null @@ -1,52 +0,0 @@ -// *************************************************************************************************************************** -// * 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.rest.annotation.*; - -/** - * Provides the capability to shut down this REST microservice through a REST call. - */ -@RestResource( - path="/shutdown", - title="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/ab15d45b/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/package.html ---------------------------------------------------------------------- diff --git a/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/package.html b/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/package.html deleted file mode 100755 index 422f5d2..0000000 --- a/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/package.html +++ /dev/null @@ -1,31 +0,0 @@ -<!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/ab15d45b/juneau-microservice/src/test/java/.gitignore ---------------------------------------------------------------------- diff --git a/juneau-microservice/src/test/java/.gitignore b/juneau-microservice/src/test/java/.gitignore deleted file mode 100644 index 8a0051a..0000000 --- a/juneau-microservice/src/test/java/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ - *************************************************************************************************************************** - * 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. * - *************************************************************************************************************************** http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-releng/juneau-all/.classpath ---------------------------------------------------------------------- diff --git a/juneau-releng/juneau-all/.classpath b/juneau-releng/juneau-all/.classpath new file mode 100644 index 0000000..fd7ad7f --- /dev/null +++ b/juneau-releng/juneau-all/.classpath @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" output="target/classes" path="src/main/java"> + <attributes> + <attribute name="optional" value="true"/> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="src" output="target/test-classes" path="src/test/java"> + <attributes> + <attribute name="optional" value="true"/> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="output" path="target/classes"/> +</classpath> http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-releng/juneau-all/.gitignore ---------------------------------------------------------------------- diff --git a/juneau-releng/juneau-all/.gitignore b/juneau-releng/juneau-all/.gitignore new file mode 100644 index 0000000..c7a6c82 --- /dev/null +++ b/juneau-releng/juneau-all/.gitignore @@ -0,0 +1,4 @@ +/target/ +/.settings/ +/.DS_Store +/bin/ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-releng/juneau-all/.project ---------------------------------------------------------------------- diff --git a/juneau-releng/juneau-all/.project b/juneau-releng/juneau-all/.project new file mode 100644 index 0000000..5ba7b4e --- /dev/null +++ b/juneau-releng/juneau-all/.project @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>juneau-all</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + </natures> +</projectDescription> http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-releng/juneau-all/pom.xml ---------------------------------------------------------------------- diff --git a/juneau-releng/juneau-all/pom.xml b/juneau-releng/juneau-all/pom.xml new file mode 100644 index 0000000..66f7275 --- /dev/null +++ b/juneau-releng/juneau-all/pom.xml @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + *************************************************************************************************************************** + * 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. * + *************************************************************************************************************************** +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-releng</artifactId> + <version>6.3.2-incubating-SNAPSHOT</version> + </parent> + + <artifactId>juneau-all</artifactId> + <name>Apache Juneau UberJar</name> + <description>Combined contents of Core/Server/Client/Microservice jars</description> + <packaging>jar</packaging> + + <dependencies> + <dependency> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-marshall</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-marshall-rdf</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-rest-server</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-rest-client</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-microservice</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + + <!-- Creates our juneau-all jar file that's a combo of our 4 modules. --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <version>2.4.3</version> + <configuration> + <createDependencyReducedPom>false</createDependencyReducedPom> + <artifactSet> + <includes> + <include>org.apache.juneau:juneau-core</include> + <include>org.apache.juneau:juneau-core-rdf</include> + <include>org.apache.juneau:juneau-rest</include> + <include>org.apache.juneau:juneau-rest-jaxrs</include> + <include>org.apache.juneau:juneau-rest-client</include> + <include>org.apache.juneau:juneau-microservice</include> + </includes> + </artifactSet> + </configuration> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + </execution> + <execution> + <id>source-jar</id> + <goals> + <goal>shade</goal> + </goals> + <configuration> + <createSourcesJar>true</createSourcesJar> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-releng/juneau-all/src/assembly/all.xml ---------------------------------------------------------------------- diff --git a/juneau-releng/juneau-all/src/assembly/all.xml b/juneau-releng/juneau-all/src/assembly/all.xml new file mode 100644 index 0000000..f3fb07e --- /dev/null +++ b/juneau-releng/juneau-all/src/assembly/all.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + *************************************************************************************************************************** + * 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. * + *************************************************************************************************************************** +--> +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd"> + <id>all</id> + <formats> + <format>dir</format> + <format>zip</format> + </formats> + <includeBaseDirectory>false</includeBaseDirectory> + <dependencySets> + <dependencySet> + <includes> + <include>*</include> + </includes> + <outputDirectory></outputDirectory> + </dependencySet> + </dependencySets> +</assembly> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-releng/juneau-distrib/.gitignore ---------------------------------------------------------------------- diff --git a/juneau-releng/juneau-distrib/.gitignore b/juneau-releng/juneau-distrib/.gitignore new file mode 100644 index 0000000..d274d47 --- /dev/null +++ b/juneau-releng/juneau-distrib/.gitignore @@ -0,0 +1,3 @@ +/target/ +/.settings/ +/.DS_Store http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-releng/juneau-distrib/.project ---------------------------------------------------------------------- diff --git a/juneau-releng/juneau-distrib/.project b/juneau-releng/juneau-distrib/.project new file mode 100644 index 0000000..f35cb6c --- /dev/null +++ b/juneau-releng/juneau-distrib/.project @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>juneau-distrib</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + </natures> +</projectDescription> http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-releng/juneau-distrib/pom.xml ---------------------------------------------------------------------- diff --git a/juneau-releng/juneau-distrib/pom.xml b/juneau-releng/juneau-distrib/pom.xml new file mode 100644 index 0000000..b5d156b --- /dev/null +++ b/juneau-releng/juneau-distrib/pom.xml @@ -0,0 +1,225 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + *************************************************************************************************************************** + * 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. * + *************************************************************************************************************************** +--> +<project + xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-releng</artifactId> + <version>6.3.2-incubating-SNAPSHOT</version> + </parent> + + <artifactId>juneau-distrib</artifactId> + <packaging>pom</packaging> + <name>Apache Juneau Distribution</name> + <description>Location to find fully built Juneau distributions.</description> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + + <artifactItem> + <outputDirectory>${project.build.directory}/bin</outputDirectory> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-all</artifactId> + <version>${project.version}</version> + </artifactItem> + <artifactItem> + <outputDirectory>${project.build.directory}/src</outputDirectory> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-all</artifactId> + <version>${project.version}</version> + <type>jar</type> + <classifier>sources</classifier> + </artifactItem> + + <artifactItem> + <outputDirectory>${project.build.directory}/src/osgi-bundles</outputDirectory> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-marshall</artifactId> + <version>${project.version}</version> + <type>jar</type> + <classifier>sources</classifier> + </artifactItem> + <artifactItem> + <outputDirectory>${project.build.directory}/bin/osgi-bundles</outputDirectory> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-marshall</artifactId> + <version>${project.version}</version> + </artifactItem> + + <artifactItem> + <outputDirectory>${project.build.directory}/src/osgi-bundles</outputDirectory> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-marshall-rdf</artifactId> + <version>${project.version}</version> + <type>jar</type> + <classifier>sources</classifier> + </artifactItem> + <artifactItem> + <outputDirectory>${project.build.directory}/bin/osgi-bundles</outputDirectory> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-marshall-rdf</artifactId> + <version>${project.version}</version> + </artifactItem> + + <artifactItem> + <outputDirectory>${project.build.directory}/src/osgi-bundles</outputDirectory> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-svl</artifactId> + <version>${project.version}</version> + <type>jar</type> + <classifier>sources</classifier> + </artifactItem> + <artifactItem> + <outputDirectory>${project.build.directory}/bin/osgi-bundles</outputDirectory> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-svl</artifactId> + <version>${project.version}</version> + </artifactItem> + + <artifactItem> + <outputDirectory>${project.build.directory}/src/osgi-bundles</outputDirectory> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-config</artifactId> + <version>${project.version}</version> + <type>jar</type> + <classifier>sources</classifier> + </artifactItem> + <artifactItem> + <outputDirectory>${project.build.directory}/bin/osgi-bundles</outputDirectory> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-config</artifactId> + <version>${project.version}</version> + </artifactItem> + + <artifactItem> + <outputDirectory>${project.build.directory}/src/osgi-bundles</outputDirectory> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-dto</artifactId> + <version>${project.version}</version> + <type>jar</type> + <classifier>sources</classifier> + </artifactItem> + <artifactItem> + <outputDirectory>${project.build.directory}/bin/osgi-bundles</outputDirectory> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-dto</artifactId> + <version>${project.version}</version> + </artifactItem> + + <artifactItem> + <outputDirectory>${project.build.directory}/src/osgi-bundles</outputDirectory> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-rest-server</artifactId> + <version>${project.version}</version> + <type>jar</type> + <classifier>sources</classifier> + </artifactItem> + <artifactItem> + <outputDirectory>${project.build.directory}/bin/osgi-bundles</outputDirectory> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-rest-server</artifactId> + <version>${project.version}</version> + </artifactItem> + + <artifactItem> + <outputDirectory>${project.build.directory}/src/osgi-bundles</outputDirectory> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-rest-jaxrs</artifactId> + <version>${project.version}</version> + <type>jar</type> + <classifier>sources</classifier> + </artifactItem> + <artifactItem> + <outputDirectory>${project.build.directory}/bin/osgi-bundles</outputDirectory> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-rest-jaxrs</artifactId> + <version>${project.version}</version> + </artifactItem> + + <artifactItem> + <outputDirectory>${project.build.directory}/src/osgi-bundles</outputDirectory> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-rest-client</artifactId> + <version>${project.version}</version> + <type>jar</type> + <classifier>sources</classifier> + </artifactItem> + <artifactItem> + <outputDirectory>${project.build.directory}/bin/osgi-bundles</outputDirectory> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-rest-client</artifactId> + <version>${project.version}</version> + </artifactItem> + + <artifactItem> + <outputDirectory>${project.build.directory}/src/osgi-bundles</outputDirectory> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-microservice</artifactId> + <version>${project.version}</version> + <type>jar</type> + <classifier>sources</classifier> + </artifactItem> + <artifactItem> + <outputDirectory>${project.build.directory}/bin/osgi-bundles</outputDirectory> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-microservice</artifactId> + <version>${project.version}</version> + </artifactItem> + + </artifactItems> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <executions> + <execution> + <id>juneau-assembly</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + <configuration> + <finalName>apache-juneau-${project.version}</finalName> + <descriptors> + <descriptor>src/assembly/src.xml</descriptor> + <descriptor>src/assembly/bin.xml</descriptor> + </descriptors> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-releng/juneau-distrib/src/assembly/bin.xml ---------------------------------------------------------------------- diff --git a/juneau-releng/juneau-distrib/src/assembly/bin.xml b/juneau-releng/juneau-distrib/src/assembly/bin.xml new file mode 100644 index 0000000..335f164 --- /dev/null +++ b/juneau-releng/juneau-distrib/src/assembly/bin.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + *************************************************************************************************************************** + * 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. * + *************************************************************************************************************************** +--> +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd"> + <id>bin</id> + <formats> + <format>zip</format> + </formats> + <includeBaseDirectory>false</includeBaseDirectory> + <fileSets> + <fileSet> + <includes> + <include>**</include> + </includes> + <directory>target/bin</directory> + <outputDirectory>apache-juneau-${project.version}</outputDirectory> + </fileSet> + <fileSet> + <includes> + <include>DISCLAIMER</include> + <include>LICENSE</include> + <include>NOTICE</include> + <include>RELEASE-NOTES.txt</include> + </includes> + <directory>..</directory> + <outputDirectory>apache-juneau-${project.version}</outputDirectory> + </fileSet> + </fileSets> +</assembly> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-releng/juneau-distrib/src/assembly/src.xml ---------------------------------------------------------------------- diff --git a/juneau-releng/juneau-distrib/src/assembly/src.xml b/juneau-releng/juneau-distrib/src/assembly/src.xml new file mode 100644 index 0000000..ee6ae99 --- /dev/null +++ b/juneau-releng/juneau-distrib/src/assembly/src.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + *************************************************************************************************************************** + * 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. * + *************************************************************************************************************************** +--> +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd"> + <id>src</id> + <formats> + <format>zip</format> + </formats> + <includeBaseDirectory>false</includeBaseDirectory> + <fileSets> + <fileSet> + <includes> + <include>**</include> + </includes> + <directory>target/src</directory> + <outputDirectory>apache-juneau-${project.version}</outputDirectory> + </fileSet> + <fileSet> + <includes> + <include>LICENSE</include> + <include>NOTICE</include> + <include>RELEASE-NOTES.txt</include> + </includes> + <directory>..</directory> + <outputDirectory>apache-juneau-${project.version}</outputDirectory> + </fileSet> + </fileSets> +</assembly> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-rest-client/.classpath ---------------------------------------------------------------------- diff --git a/juneau-rest-client/.classpath b/juneau-rest-client/.classpath deleted file mode 100644 index 1211fbf..0000000 --- a/juneau-rest-client/.classpath +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" output="target/test-classes" path="src/test/java"> - <attributes> - <attribute name="optional" value="true"/> - <attribute name="maven.pomderived" value="true"/> - </attributes> - </classpathentry> - <classpathentry kind="src" output="target/classes" path="src/main/java"> - <attributes> - <attribute name="optional" value="true"/> - <attribute name="maven.pomderived" value="true"/> - </attributes> - </classpathentry> - <classpathentry kind="src" path="/juneau-core"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"> - <attributes> - <attribute name="maven.pomderived" value="true"/> - </attributes> - </classpathentry> - <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> - <attributes> - <attribute name="maven.pomderived" value="true"/> - </attributes> - </classpathentry> - <classpathentry kind="output" path="target/classes"/> -</classpath> http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-rest-client/.gitignore ---------------------------------------------------------------------- diff --git a/juneau-rest-client/.gitignore b/juneau-rest-client/.gitignore deleted file mode 100644 index d274d47..0000000 --- a/juneau-rest-client/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/target/ -/.settings/ -/.DS_Store http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-rest-client/.project ---------------------------------------------------------------------- diff --git a/juneau-rest-client/.project b/juneau-rest-client/.project deleted file mode 100644 index ddd7643..0000000 --- a/juneau-rest-client/.project +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - *************************************************************************************************************************** - * 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. * - *************************************************************************************************************************** ---> -<projectDescription> - <name>juneau-rest-client</name> - <comment>REST client API. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment> - <projects> - <project>juneau-core</project> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.m2e.core.maven2Builder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.m2e.core.maven2Nature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-rest-client/pom.xml ---------------------------------------------------------------------- diff --git a/juneau-rest-client/pom.xml b/juneau-rest-client/pom.xml deleted file mode 100644 index bc4b2f0..0000000 --- a/juneau-rest-client/pom.xml +++ /dev/null @@ -1,79 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - *************************************************************************************************************************** - * 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. * - *************************************************************************************************************************** ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - - <modelVersion>4.0.0</modelVersion> - <artifactId>juneau-rest-client</artifactId> - <name>Apache Juneau REST Client API</name> - <description>REST client API</description> - <packaging>bundle</packaging> - - <parent> - <groupId>org.apache.juneau</groupId> - <artifactId>juneau</artifactId> - <version>6.3.2-incubating-SNAPSHOT</version> - </parent> - - <dependencies> - <dependency> - <groupId>org.apache.juneau</groupId> - <artifactId>juneau-core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - </dependency> - </dependencies> - - <properties> - <!-- Skip javadoc generation since we generate them in the aggregate pom --> - <maven.javadoc.skip>true</maven.javadoc.skip> - </properties> - - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <version>3.2.0</version> - <extensions>true</extensions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-source-plugin</artifactId> - <executions> - <execution> - <id>attach-sources</id> - <phase>verify</phase> - <goals> - <goal>jar-no-fork</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <includes> - <include>**/*Test.class</include> - </includes> - </configuration> - </plugin> - </plugins> - </build> -</project> http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/AllowAllRedirects.java ---------------------------------------------------------------------- diff --git a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/AllowAllRedirects.java b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/AllowAllRedirects.java deleted file mode 100644 index 17e945f..0000000 --- a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/AllowAllRedirects.java +++ /dev/null @@ -1,33 +0,0 @@ -// *************************************************************************************************************************** -// * 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.rest.client; - -import org.apache.http.impl.client.*; - -/** - * Redirect strategy that allows for redirects on any request type, not just <code>GET</code> or <code>HEAD</code>. - * - * <h5 class='section'>Notes:</h5> - * <ul> - * <li> - * This class is similar to <code>org.apache.http.impl.client.LaxRedirectStrategy</code> - * in Apache HttpClient 4.2, but also allows for redirects on <code>PUTs</code> and <code>DELETEs</code>. - * </ul> - */ -public class AllowAllRedirects extends DefaultRedirectStrategy { - - @Override /* DefaultRedirectStrategy */ - protected boolean isRedirectable(final String method) { - return true; - } -} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/DateHeader.java ---------------------------------------------------------------------- diff --git a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/DateHeader.java b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/DateHeader.java deleted file mode 100644 index 98f2412..0000000 --- a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/DateHeader.java +++ /dev/null @@ -1,42 +0,0 @@ -// *************************************************************************************************************************** -// * 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.rest.client; - -import java.util.*; - -import org.apache.http.client.utils.*; -import org.apache.http.message.*; - -/** - * Convenience class for setting date headers in RFC2616 format. - * - * <p> - * Equivalent to the following code: - * <p class='bcode'> - * Header h = <jk>new</jk> Header(name, DateUtils.<jsm>formatDate</jsm>(value)); - * </p> - */ -public final class DateHeader extends BasicHeader { - - private static final long serialVersionUID = 1L; - - /** - * Creates a date request property in RFC2616 format. - * - * @param name The header name. - * @param value The header value. - */ - public DateHeader(String name, Date value) { - super(name, DateUtils.formatDate(value)); - } -} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/HttpMethod.java ---------------------------------------------------------------------- diff --git a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/HttpMethod.java b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/HttpMethod.java deleted file mode 100644 index 9dc0d67..0000000 --- a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/HttpMethod.java +++ /dev/null @@ -1,61 +0,0 @@ -// *************************************************************************************************************************** -// * 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.rest.client; - -/** - * Enumeration of HTTP methods. - */ -public enum HttpMethod { - - /** HTTP GET */ - GET(false), - - /** HTTP PUT */ - PUT(true), - - /** HTTP POST */ - POST(true), - - /** HTTP DELETE */ - DELETE(false), - - /** HTTP OPTIONS */ - OPTIONS(false), - - /** HTTP HEAD */ - HEAD(false), - - /** HTTP TRACE */ - TRACE(false), - - /** HTTP CONNECT */ - CONNECT(false), - - /** HTTP MOVE */ - MOVE(false); - - private boolean hasContent; - - HttpMethod(boolean hasContent) { - this.hasContent = hasContent; - } - - /** - * Returns whether this HTTP method normally has content. - * - * @return <jk>true</jk> if this HTTP method normally has content. - */ - public boolean hasContent() { - return hasContent; - } -} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/NameValuePairs.java ---------------------------------------------------------------------- diff --git a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/NameValuePairs.java b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/NameValuePairs.java deleted file mode 100644 index e7ab3a1..0000000 --- a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/NameValuePairs.java +++ /dev/null @@ -1,85 +0,0 @@ -// *************************************************************************************************************************** -// * 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.rest.client; - -import java.util.*; - -import org.apache.http.*; -import org.apache.http.client.entity.*; -import org.apache.http.message.*; -import org.apache.juneau.internal.*; -import org.apache.juneau.serializer.*; -import org.apache.juneau.urlencoding.*; - -/** - * Convenience class for constructing instances of <code>List<NameValuePair></code> for the - * {@link UrlEncodedFormEntity} class. - * - * <p> - * Instances of this method can be passed directly to the {@link RestClient#doPost(Object, Object)} method or - * {@link RestCall#input(Object)} methods to perform URL-encoded form posts. - * - * <h5 class='section'>Example:</h5> - * <p class='bcode'> - * NameValuePairs params = <jk>new</jk> NameValuePairs() - * .append(<js>"j_username"</js>, user) - * .append(<js>"j_password"</js>, pw); - * restClient.doPost(url, params).run(); - * </p> - */ -public final class NameValuePairs extends LinkedList<NameValuePair> { - - private static final long serialVersionUID = 1L; - - /** - * Appends the specified pair to the end of this list. - * - * @param pair The pair to append to this list. - * @return This object (for method chaining). - */ - public NameValuePairs append(NameValuePair pair) { - super.add(pair); - return this; - } - - /** - * Appends the specified name/value pair to the end of this list. - * - * <p> - * The value is simply converted to a string using <code>toString()</code>, or <js>"null"</js> if <jk>null</jk>. - * - * @param name The pair name. - * @param value The pair value. - * @return This object (for method chaining). - */ - public NameValuePairs append(String name, Object value) { - super.add(new BasicNameValuePair(name, StringUtils.toString(value))); - return this; - } - - /** - * Appends the specified name/value pair to the end of this list. - * - * <p> - * The value is converted to UON notation using the {@link UrlEncodingSerializer} defined on the client. - * - * @param name The pair name. - * @param value The pair value. - * @param partSerializer The serializer to use for converting values to simple strings. - * @return This object (for method chaining). - */ - public NameValuePairs append(String name, Object value, PartSerializer partSerializer) { - super.add(new SerializedNameValuePair(name, value, partSerializer)); - return this; - } -} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/ab15d45b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponsePattern.java ---------------------------------------------------------------------- diff --git a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponsePattern.java b/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponsePattern.java deleted file mode 100644 index cf491c6..0000000 --- a/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponsePattern.java +++ /dev/null @@ -1,133 +0,0 @@ -// *************************************************************************************************************************** -// * 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.rest.client; - -import java.io.*; -import java.util.regex.*; - -/** - * Used to find regular expression matches in REST responses made through {@link RestCall}. - * - * <p> - * Response patterns are applied to REST calls through the {@link RestCall#responsePattern(ResponsePattern)} method. - * - * <h5 class='section'>Example:</h5> - * - * This example shows how to use a response pattern finder to find and capture patterns for <js>"x=number"</js> and - * <js>"y=string"</js> from a response body. - * <p class='bcode'> - * <jk>final</jk> List<Number> xList = <jk>new</jk> ArrayList<Number>(); - * <jk>final</jk> List<String> yList = <jk>new</jk> ArrayList<String>(); - * - * restClient.doGet(<jsf>URL</jsf>) - * .addResponsePattern( - * <jk>new</jk> ResponsePattern(<js>"x=(\\d+)"</js>) { - * <ja>@Override</ja> - * <jk>public void</jk> onMatch(RestCall restCall, Matcher m) <jk>throws</jk> RestCallException { - * xList.add(Integer.<jsm>parseInt</jsm>(m.group(1))); - * } - * <ja>@Override</ja> - * <jk>public void</jk> onNoMatch(RestCall restCall) <jk>throws</jk> RestCallException { - * <jk>throw new</jk> RestCallException(<js>"No X's found!"</js>); - * } - * } - * ) - * .addResponsePattern( - * <jk>new</jk> ResponsePattern(<js>"y=(\\S+)"</js>) { - * <ja>@Override</ja> - * <jk>public void</jk> onMatch(RestCall restCall, Matcher m) <jk>throws</jk> RestCallException { - * yList.add(m.group(1)); - * } - * <ja>@Override</ja> - * <jk>public void</jk> onNoMatch(RestCall restCall) <jk>throws</jk> RestCallException { - * <jk>throw new</jk> RestCallException(<js>"No Y's found!"</js>); - * } - * } - * ) - * .run(); - * </p> - * - * <h5 class='notes'>Important Notes:</h5> - * <ol class='notes'> - * <li> - * Using response patterns does not affect the functionality of any of the other methods - * used to retrieve the response such as {@link RestCall#getResponseAsString()} or {@link RestCall#getResponse(Class)}. - * <br>HOWEVER, if you want to retrieve the entire text of the response from inside the match methods, use - * {@link RestCall#getCapturedResponse()} since this method will not absorb the response for those other methods. - * <li> - * Response pattern methods are NOT executed if a REST exception occurs during the request. - * <li> - * The {@link RestCall#successPattern(String)} and {@link RestCall#failurePattern(String)} methods use instances - * of this class to throw {@link RestCallException RestCallExceptions} when success patterns are not found or - * failure patterns are found. - * <li> - * {@link ResponsePattern} objects are reusable and thread-safe. - * </ol> - */ -public abstract class ResponsePattern { - - private Pattern pattern; - - /** - * Constructor. - * - * @param pattern Regular expression pattern. - */ - public ResponsePattern(String pattern) { - this.pattern = Pattern.compile(pattern); - } - - void match(RestCall rc) throws RestCallException { - try { - Matcher m = pattern.matcher(rc.getCapturedResponse()); - boolean found = false; - while (m.find()) { - onMatch(rc, m); - found = true; - } - if (! found) - onNoMatch(rc); - } catch (IOException e) { - throw new RestCallException(e); - } - } - - /** - * Returns the pattern passed in through the constructor. - * - * @return The pattern passed in through the constructor. - */ - protected String getPattern() { - return pattern.pattern(); - } - - /** - * Instances can override this method to handle when a regular expression pattern matches on the output. - * - * <p> - * This method is called once for every pattern match that occurs in the response text. - * - * @param rc The {@link RestCall} that this pattern finder is being used on. - * @param m The regular expression {@link Matcher}. Can be used to retrieve group matches in the pattern. - * @throws RestCallException Instances can throw an exception if a failure condition is detected. - */ - public void onMatch(RestCall rc, Matcher m) throws RestCallException {} - - /** - * Instances can override this method to handle when a regular expression pattern doesn't match on the output. - * - * @param rc The {@link RestCall} that this pattern finder is being used on. - * @throws RestCallException Instances can throw an exception if a failure condition is detected. - */ - public void onNoMatch(RestCall rc) throws RestCallException {} -}