repo_name
stringlengths 7
104
| file_path
stringlengths 13
198
| context
stringlengths 67
7.15k
| import_statement
stringlengths 16
4.43k
| code
stringlengths 40
6.98k
| prompt
stringlengths 227
8.27k
| next_line
stringlengths 8
795
|
|---|---|---|---|---|---|---|
jenkinsci/plugin-compat-tester
|
plugins-compat-tester/src/main/java/org/jenkins/tools/test/util/ExecutedTestNamesSolver.java
|
// Path: plugins-compat-tester/src/main/java/org/jenkins/tools/test/exception/ExecutedTestNamesSolverException.java
// public class ExecutedTestNamesSolverException extends Exception {
//
// private static final long serialVersionUID = 1L;
//
// public ExecutedTestNamesSolverException() {
// super();
// }
//
// public ExecutedTestNamesSolverException(String msg) {
// super(msg);
// }
//
// public ExecutedTestNamesSolverException(String msg, Exception e) {
// super(msg, e);
// }
//
// public ExecutedTestNamesSolverException(Exception e) {
// super(e);
// }
// }
|
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.jenkins.tools.test.exception.ExecutedTestNamesSolverException;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
|
package org.jenkins.tools.test.util;
public class ExecutedTestNamesSolver {
private static final String WARNING_MSG = "[WARNING] Unable to retrieve info from: %s";
private static final String TEST_PLACEHOLDER = "TEST-%s.xml";
/*
Element names for failure and error as declared at
https://maven.apache.org/surefire/maven-failsafe-plugin/xsd/failsafe-test-report-3.0.xsd and
https://gitbox.apache.org/repos/asf?p=maven-surefire.git;a=blob;f=maven-surefire-plugin/src/site/resources/xsd/surefire-test-report-3.0.xsd
*/
private static final String FAILURE_ELEMENT = "failure";
private static final String ERROR_ELEMENT = "error";
|
// Path: plugins-compat-tester/src/main/java/org/jenkins/tools/test/exception/ExecutedTestNamesSolverException.java
// public class ExecutedTestNamesSolverException extends Exception {
//
// private static final long serialVersionUID = 1L;
//
// public ExecutedTestNamesSolverException() {
// super();
// }
//
// public ExecutedTestNamesSolverException(String msg) {
// super(msg);
// }
//
// public ExecutedTestNamesSolverException(String msg, Exception e) {
// super(msg, e);
// }
//
// public ExecutedTestNamesSolverException(Exception e) {
// super(e);
// }
// }
// Path: plugins-compat-tester/src/main/java/org/jenkins/tools/test/util/ExecutedTestNamesSolver.java
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.jenkins.tools.test.exception.ExecutedTestNamesSolverException;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
package org.jenkins.tools.test.util;
public class ExecutedTestNamesSolver {
private static final String WARNING_MSG = "[WARNING] Unable to retrieve info from: %s";
private static final String TEST_PLACEHOLDER = "TEST-%s.xml";
/*
Element names for failure and error as declared at
https://maven.apache.org/surefire/maven-failsafe-plugin/xsd/failsafe-test-report-3.0.xsd and
https://gitbox.apache.org/repos/asf?p=maven-surefire.git;a=blob;f=maven-surefire-plugin/src/site/resources/xsd/surefire-test-report-3.0.xsd
*/
private static final String FAILURE_ELEMENT = "failure";
private static final String ERROR_ELEMENT = "error";
|
public ExecutedTestNamesDetails solve(Set<String> types, Set<String> executedTests, File baseDirectory) throws ExecutedTestNamesSolverException {
|
jenkinsci/plugin-compat-tester
|
plugins-compat-tester/src/main/java/org/jenkins/tools/test/hook/DeclarativePipelineHook.java
|
// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/PomData.java
// public class PomData {
// public final String artifactId;
// public final String groupId;
//
// @Nonnull
// private final String packaging;
//
// @CheckForNull
// public final MavenCoordinates parent;
// private String connectionUrl;
// private String scmTag;
// private List<String> warningMessages = new ArrayList<>();
//
// public PomData(String artifactId, @CheckForNull String packaging, String connectionUrl, String scmTag, @CheckForNull MavenCoordinates parent, String groupId){
// this.artifactId = artifactId;
// this.groupId = groupId;
// this.packaging = packaging != null ? packaging : "jar";
// this.setConnectionUrl(connectionUrl);
// this.scmTag = scmTag;
// this.parent = parent;
// }
//
// public String getConnectionUrl() {
// return connectionUrl;
// }
//
// public void setConnectionUrl(String connectionUrl) {
// this.connectionUrl = connectionUrl;
// }
//
// @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "Deliberately mutable")
// public List<String> getWarningMessages() {
// return warningMessages;
// }
//
// @Nonnull
// public String getPackaging() {
// return packaging;
// }
//
// public String getScmTag() {
// return scmTag;
// }
//
// public boolean isPluginPOM() {
// if (parent != null) {
// return parent.matches("org.jenkins-ci.plugins", "plugin");
// } else { // Interpolate by packaging
// return "hpi".equalsIgnoreCase(packaging);
// }
// }
// }
|
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jenkins.tools.test.model.PomData;
|
package org.jenkins.tools.test.hook;
/**
* Workaround for the Pipeline: Declarative plugins since they are stored in a central repository.
*/
public class DeclarativePipelineHook extends AbstractMultiParentHook {
private static final Logger LOGGER = Logger.getLogger(DeclarativePipelineHook.class.getName());
@Override
protected String getParentFolder() {
return "pipeline-model-definition";
}
@Override
protected String getParentProjectName() {
return "pipeline-model-definition";
}
@Override
public boolean check(Map<String, Object> info) {
return isDPPlugin(info);
}
private boolean isDPPlugin(Map<String, Object> moreInfo) {
|
// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/PomData.java
// public class PomData {
// public final String artifactId;
// public final String groupId;
//
// @Nonnull
// private final String packaging;
//
// @CheckForNull
// public final MavenCoordinates parent;
// private String connectionUrl;
// private String scmTag;
// private List<String> warningMessages = new ArrayList<>();
//
// public PomData(String artifactId, @CheckForNull String packaging, String connectionUrl, String scmTag, @CheckForNull MavenCoordinates parent, String groupId){
// this.artifactId = artifactId;
// this.groupId = groupId;
// this.packaging = packaging != null ? packaging : "jar";
// this.setConnectionUrl(connectionUrl);
// this.scmTag = scmTag;
// this.parent = parent;
// }
//
// public String getConnectionUrl() {
// return connectionUrl;
// }
//
// public void setConnectionUrl(String connectionUrl) {
// this.connectionUrl = connectionUrl;
// }
//
// @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "Deliberately mutable")
// public List<String> getWarningMessages() {
// return warningMessages;
// }
//
// @Nonnull
// public String getPackaging() {
// return packaging;
// }
//
// public String getScmTag() {
// return scmTag;
// }
//
// public boolean isPluginPOM() {
// if (parent != null) {
// return parent.matches("org.jenkins-ci.plugins", "plugin");
// } else { // Interpolate by packaging
// return "hpi".equalsIgnoreCase(packaging);
// }
// }
// }
// Path: plugins-compat-tester/src/main/java/org/jenkins/tools/test/hook/DeclarativePipelineHook.java
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jenkins.tools.test.model.PomData;
package org.jenkins.tools.test.hook;
/**
* Workaround for the Pipeline: Declarative plugins since they are stored in a central repository.
*/
public class DeclarativePipelineHook extends AbstractMultiParentHook {
private static final Logger LOGGER = Logger.getLogger(DeclarativePipelineHook.class.getName());
@Override
protected String getParentFolder() {
return "pipeline-model-definition";
}
@Override
protected String getParentProjectName() {
return "pipeline-model-definition";
}
@Override
public boolean check(Map<String, Object> info) {
return isDPPlugin(info);
}
private boolean isDPPlugin(Map<String, Object> moreInfo) {
|
PomData data = (PomData) moreInfo.get("pomData");
|
jenkinsci/plugin-compat-tester
|
plugins-compat-tester/src/main/java/org/jenkins/tools/test/hook/BlueOceanHook.java
|
// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/PomData.java
// public class PomData {
// public final String artifactId;
// public final String groupId;
//
// @Nonnull
// private final String packaging;
//
// @CheckForNull
// public final MavenCoordinates parent;
// private String connectionUrl;
// private String scmTag;
// private List<String> warningMessages = new ArrayList<>();
//
// public PomData(String artifactId, @CheckForNull String packaging, String connectionUrl, String scmTag, @CheckForNull MavenCoordinates parent, String groupId){
// this.artifactId = artifactId;
// this.groupId = groupId;
// this.packaging = packaging != null ? packaging : "jar";
// this.setConnectionUrl(connectionUrl);
// this.scmTag = scmTag;
// this.parent = parent;
// }
//
// public String getConnectionUrl() {
// return connectionUrl;
// }
//
// public void setConnectionUrl(String connectionUrl) {
// this.connectionUrl = connectionUrl;
// }
//
// @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "Deliberately mutable")
// public List<String> getWarningMessages() {
// return warningMessages;
// }
//
// @Nonnull
// public String getPackaging() {
// return packaging;
// }
//
// public String getScmTag() {
// return scmTag;
// }
//
// public boolean isPluginPOM() {
// if (parent != null) {
// return parent.matches("org.jenkins-ci.plugins", "plugin");
// } else { // Interpolate by packaging
// return "hpi".equalsIgnoreCase(packaging);
// }
// }
// }
|
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jenkins.tools.test.model.PomData;
|
package org.jenkins.tools.test.hook;
/**
* Workaround for the Blue Ocean plugins since they are
* stored in a central repository.
*/
public class BlueOceanHook extends AbstractMultiParentHook {
private static final Logger LOGGER = Logger.getLogger(BlueOceanHook.class.getName());
@Override
protected String getParentFolder() {
return "blueocean";
}
@Override
protected String getParentProjectName() {
return "blueocean-parent";
}
@Override
public boolean check(Map<String, Object> info) {
return isBOPlugin(info);
}
private boolean isBOPlugin(Map<String, Object> moreInfo) {
|
// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/PomData.java
// public class PomData {
// public final String artifactId;
// public final String groupId;
//
// @Nonnull
// private final String packaging;
//
// @CheckForNull
// public final MavenCoordinates parent;
// private String connectionUrl;
// private String scmTag;
// private List<String> warningMessages = new ArrayList<>();
//
// public PomData(String artifactId, @CheckForNull String packaging, String connectionUrl, String scmTag, @CheckForNull MavenCoordinates parent, String groupId){
// this.artifactId = artifactId;
// this.groupId = groupId;
// this.packaging = packaging != null ? packaging : "jar";
// this.setConnectionUrl(connectionUrl);
// this.scmTag = scmTag;
// this.parent = parent;
// }
//
// public String getConnectionUrl() {
// return connectionUrl;
// }
//
// public void setConnectionUrl(String connectionUrl) {
// this.connectionUrl = connectionUrl;
// }
//
// @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "Deliberately mutable")
// public List<String> getWarningMessages() {
// return warningMessages;
// }
//
// @Nonnull
// public String getPackaging() {
// return packaging;
// }
//
// public String getScmTag() {
// return scmTag;
// }
//
// public boolean isPluginPOM() {
// if (parent != null) {
// return parent.matches("org.jenkins-ci.plugins", "plugin");
// } else { // Interpolate by packaging
// return "hpi".equalsIgnoreCase(packaging);
// }
// }
// }
// Path: plugins-compat-tester/src/main/java/org/jenkins/tools/test/hook/BlueOceanHook.java
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jenkins.tools.test.model.PomData;
package org.jenkins.tools.test.hook;
/**
* Workaround for the Blue Ocean plugins since they are
* stored in a central repository.
*/
public class BlueOceanHook extends AbstractMultiParentHook {
private static final Logger LOGGER = Logger.getLogger(BlueOceanHook.class.getName());
@Override
protected String getParentFolder() {
return "blueocean";
}
@Override
protected String getParentProjectName() {
return "blueocean-parent";
}
@Override
public boolean check(Map<String, Object> info) {
return isBOPlugin(info);
}
private boolean isBOPlugin(Map<String, Object> moreInfo) {
|
PomData data = (PomData) moreInfo.get("pomData");
|
jenkinsci/plugin-compat-tester
|
plugins-compat-tester/src/main/java/org/jenkins/tools/test/model/PluginRemoting.java
|
// Path: plugins-compat-tester/src/main/java/org/jenkins/tools/test/exception/PluginSourcesUnavailableException.java
// public class PluginSourcesUnavailableException extends Exception {
//
// public PluginSourcesUnavailableException(String message, Throwable cause){
// super(message, cause);
// }
// }
|
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.tools.ant.filters.StringInputStream;
import org.jenkins.tools.test.exception.PluginSourcesUnavailableException;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
|
/*
* The MIT License
*
* Copyright (c) 2004-2018, Sun Microsystems, Inc., Kohsuke Kawaguchi,
* Erik Ramfelt, Koichi Fujikawa, Red Hat, Inc., Seiji Sogabe,
* Stephen Connolly, Tom Huybrechts, Yahoo! Inc., Alan Harder, CloudBees, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.jenkins.tools.test.model;
/**
* Utility class providing business for retrieving plugin POM data
*
* @author Frederic Camblor
*/
public class PluginRemoting {
private static final Logger LOGGER = Logger.getLogger(PluginRemoting.class.getName());
private String hpiRemoteUrl;
private File pomFile;
public PluginRemoting(String hpiRemoteUrl){
this.hpiRemoteUrl = hpiRemoteUrl;
}
public PluginRemoting(File pomFile){
this.pomFile = pomFile;
}
|
// Path: plugins-compat-tester/src/main/java/org/jenkins/tools/test/exception/PluginSourcesUnavailableException.java
// public class PluginSourcesUnavailableException extends Exception {
//
// public PluginSourcesUnavailableException(String message, Throwable cause){
// super(message, cause);
// }
// }
// Path: plugins-compat-tester/src/main/java/org/jenkins/tools/test/model/PluginRemoting.java
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.tools.ant.filters.StringInputStream;
import org.jenkins.tools.test.exception.PluginSourcesUnavailableException;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
/*
* The MIT License
*
* Copyright (c) 2004-2018, Sun Microsystems, Inc., Kohsuke Kawaguchi,
* Erik Ramfelt, Koichi Fujikawa, Red Hat, Inc., Seiji Sogabe,
* Stephen Connolly, Tom Huybrechts, Yahoo! Inc., Alan Harder, CloudBees, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.jenkins.tools.test.model;
/**
* Utility class providing business for retrieving plugin POM data
*
* @author Frederic Camblor
*/
public class PluginRemoting {
private static final Logger LOGGER = Logger.getLogger(PluginRemoting.class.getName());
private String hpiRemoteUrl;
private File pomFile;
public PluginRemoting(String hpiRemoteUrl){
this.hpiRemoteUrl = hpiRemoteUrl;
}
public PluginRemoting(File pomFile){
this.pomFile = pomFile;
}
|
private String retrievePomContent() throws PluginSourcesUnavailableException{
|
jenkinsci/plugin-compat-tester
|
plugins-compat-tester/src/main/java/org/jenkins/tools/test/hook/JacocoHook.java
|
// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/PomData.java
// public class PomData {
// public final String artifactId;
// public final String groupId;
//
// @Nonnull
// private final String packaging;
//
// @CheckForNull
// public final MavenCoordinates parent;
// private String connectionUrl;
// private String scmTag;
// private List<String> warningMessages = new ArrayList<>();
//
// public PomData(String artifactId, @CheckForNull String packaging, String connectionUrl, String scmTag, @CheckForNull MavenCoordinates parent, String groupId){
// this.artifactId = artifactId;
// this.groupId = groupId;
// this.packaging = packaging != null ? packaging : "jar";
// this.setConnectionUrl(connectionUrl);
// this.scmTag = scmTag;
// this.parent = parent;
// }
//
// public String getConnectionUrl() {
// return connectionUrl;
// }
//
// public void setConnectionUrl(String connectionUrl) {
// this.connectionUrl = connectionUrl;
// }
//
// @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "Deliberately mutable")
// public List<String> getWarningMessages() {
// return warningMessages;
// }
//
// @Nonnull
// public String getPackaging() {
// return packaging;
// }
//
// public String getScmTag() {
// return scmTag;
// }
//
// public boolean isPluginPOM() {
// if (parent != null) {
// return parent.matches("org.jenkins-ci.plugins", "plugin");
// } else { // Interpolate by packaging
// return "hpi".equalsIgnoreCase(packaging);
// }
// }
// }
//
// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/hook/PluginCompatTesterHookBeforeExecution.java
// public abstract class PluginCompatTesterHookBeforeExecution implements PluginCompatTesterHook {
// /**
// * Check the value of {@code args} (the arguments with which to run {@code mvn test}) and {@code
// * pomData} (if the plugin should be checked out again).
// */
// @Override
// public void validate(Map<String, Object> toCheck) {
// if((toCheck.get("args") != null &&
// toCheck.get("args") instanceof String) &&
// (toCheck.get("pomData") != null &&
// toCheck.get("pomData") instanceof PomData) ) {
// throw new IllegalArgumentException("A hook modified a required parameter for plugin test execution.");
// }
// }
// }
|
import org.jenkins.tools.test.model.PomData;
import org.jenkins.tools.test.model.hook.PluginCompatTesterHookBeforeExecution;
import java.util.List;
import java.util.Map;
import java.util.stream.IntStream;
|
package org.jenkins.tools.test.hook;
/**
* Workaround for JaCoCo plugin since it needs execute the jacoco:prepare-agent goal before execution.
*/
public class JacocoHook extends PluginCompatTesterHookBeforeExecution {
@Override
public boolean check(Map<String, Object> info) {
|
// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/PomData.java
// public class PomData {
// public final String artifactId;
// public final String groupId;
//
// @Nonnull
// private final String packaging;
//
// @CheckForNull
// public final MavenCoordinates parent;
// private String connectionUrl;
// private String scmTag;
// private List<String> warningMessages = new ArrayList<>();
//
// public PomData(String artifactId, @CheckForNull String packaging, String connectionUrl, String scmTag, @CheckForNull MavenCoordinates parent, String groupId){
// this.artifactId = artifactId;
// this.groupId = groupId;
// this.packaging = packaging != null ? packaging : "jar";
// this.setConnectionUrl(connectionUrl);
// this.scmTag = scmTag;
// this.parent = parent;
// }
//
// public String getConnectionUrl() {
// return connectionUrl;
// }
//
// public void setConnectionUrl(String connectionUrl) {
// this.connectionUrl = connectionUrl;
// }
//
// @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "Deliberately mutable")
// public List<String> getWarningMessages() {
// return warningMessages;
// }
//
// @Nonnull
// public String getPackaging() {
// return packaging;
// }
//
// public String getScmTag() {
// return scmTag;
// }
//
// public boolean isPluginPOM() {
// if (parent != null) {
// return parent.matches("org.jenkins-ci.plugins", "plugin");
// } else { // Interpolate by packaging
// return "hpi".equalsIgnoreCase(packaging);
// }
// }
// }
//
// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/hook/PluginCompatTesterHookBeforeExecution.java
// public abstract class PluginCompatTesterHookBeforeExecution implements PluginCompatTesterHook {
// /**
// * Check the value of {@code args} (the arguments with which to run {@code mvn test}) and {@code
// * pomData} (if the plugin should be checked out again).
// */
// @Override
// public void validate(Map<String, Object> toCheck) {
// if((toCheck.get("args") != null &&
// toCheck.get("args") instanceof String) &&
// (toCheck.get("pomData") != null &&
// toCheck.get("pomData") instanceof PomData) ) {
// throw new IllegalArgumentException("A hook modified a required parameter for plugin test execution.");
// }
// }
// }
// Path: plugins-compat-tester/src/main/java/org/jenkins/tools/test/hook/JacocoHook.java
import org.jenkins.tools.test.model.PomData;
import org.jenkins.tools.test.model.hook.PluginCompatTesterHookBeforeExecution;
import java.util.List;
import java.util.Map;
import java.util.stream.IntStream;
package org.jenkins.tools.test.hook;
/**
* Workaround for JaCoCo plugin since it needs execute the jacoco:prepare-agent goal before execution.
*/
public class JacocoHook extends PluginCompatTesterHookBeforeExecution {
@Override
public boolean check(Map<String, Object> info) {
|
PomData data = (PomData) info.get("pomData");
|
jenkinsci/plugin-compat-tester
|
plugins-compat-tester/src/test/java/org/jenkins/tools/test/VersionComparatorTest.java
|
// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/comparators/VersionComparator.java
// public class VersionComparator implements Comparator<String>, Serializable {
// @Override
// public int compare(String o1, String o2) {
//
// String[] splitO1Version = o1.split("\\.|-");
// String[] splitO2Version = o2.split("\\.|-");
//
// for(int i=0; i<splitO1Version.length; i++){
// if(i >= splitO2Version.length){
// return 1;
// }
//
// Comparable chunk1;
// try {
// chunk1 = Integer.valueOf(splitO1Version[i]);
// }catch(NumberFormatException e){
// chunk1 = splitO1Version[i];
// }
//
// Comparable chunk2;
// try {
// chunk2 = Integer.valueOf(splitO2Version[i]);
// }catch(NumberFormatException e){
// chunk2 = splitO2Version[i];
// }
//
// if (chunk1.getClass() != chunk2.getClass()) {
// throw new IllegalArgumentException("Comparing different types in chunk " + i +
// ". Version 1 = " + o1 + ", version 2 = " + o2);
// }
//
// if(!splitO1Version[i].equals(splitO2Version[i])){
// return chunk1.compareTo(chunk2);
// }
// }
//
// if(splitO1Version.length == splitO2Version.length){
// return 0;
// } else {
// return -1;
// }
// }
// }
|
import org.jenkins.tools.test.model.comparators.VersionComparator;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import com.google.common.collect.ImmutableMap;
|
/*
* The MIT License
*
* Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi,
* Erik Ramfelt, Koichi Fujikawa, Red Hat, Inc., Seiji Sogabe,
* Stephen Connolly, Tom Huybrechts, Yahoo! Inc., Alan Harder, CloudBees, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.jenkins.tools.test;
/**
* Tests for plugin version comparisons
*
* @author Frederic Camblor
*/
public class VersionComparatorTest {
private static final ImmutableMap<String, Integer> OPERAND_CONVERSION = ImmutableMap.of(
"<", -1,
"=", 0,
">", 1
);
private void test(String v1, String operator, String v2){
test(v1, OPERAND_CONVERSION.get(operator), v2);
}
private void test(String v1, int compResult, String v2){
|
// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/comparators/VersionComparator.java
// public class VersionComparator implements Comparator<String>, Serializable {
// @Override
// public int compare(String o1, String o2) {
//
// String[] splitO1Version = o1.split("\\.|-");
// String[] splitO2Version = o2.split("\\.|-");
//
// for(int i=0; i<splitO1Version.length; i++){
// if(i >= splitO2Version.length){
// return 1;
// }
//
// Comparable chunk1;
// try {
// chunk1 = Integer.valueOf(splitO1Version[i]);
// }catch(NumberFormatException e){
// chunk1 = splitO1Version[i];
// }
//
// Comparable chunk2;
// try {
// chunk2 = Integer.valueOf(splitO2Version[i]);
// }catch(NumberFormatException e){
// chunk2 = splitO2Version[i];
// }
//
// if (chunk1.getClass() != chunk2.getClass()) {
// throw new IllegalArgumentException("Comparing different types in chunk " + i +
// ". Version 1 = " + o1 + ", version 2 = " + o2);
// }
//
// if(!splitO1Version[i].equals(splitO2Version[i])){
// return chunk1.compareTo(chunk2);
// }
// }
//
// if(splitO1Version.length == splitO2Version.length){
// return 0;
// } else {
// return -1;
// }
// }
// }
// Path: plugins-compat-tester/src/test/java/org/jenkins/tools/test/VersionComparatorTest.java
import org.jenkins.tools.test.model.comparators.VersionComparator;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import com.google.common.collect.ImmutableMap;
/*
* The MIT License
*
* Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi,
* Erik Ramfelt, Koichi Fujikawa, Red Hat, Inc., Seiji Sogabe,
* Stephen Connolly, Tom Huybrechts, Yahoo! Inc., Alan Harder, CloudBees, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.jenkins.tools.test;
/**
* Tests for plugin version comparisons
*
* @author Frederic Camblor
*/
public class VersionComparatorTest {
private static final ImmutableMap<String, Integer> OPERAND_CONVERSION = ImmutableMap.of(
"<", -1,
"=", 0,
">", 1
);
private void test(String v1, String operator, String v2){
test(v1, OPERAND_CONVERSION.get(operator), v2);
}
private void test(String v1, int compResult, String v2){
|
assertThat(new VersionComparator().compare(v1, v2), is(equalTo(compResult)));
|
jenkinsci/plugin-compat-tester
|
plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/MavenCoordinates.java
|
// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/comparators/VersionComparator.java
// public class VersionComparator implements Comparator<String>, Serializable {
// @Override
// public int compare(String o1, String o2) {
//
// String[] splitO1Version = o1.split("\\.|-");
// String[] splitO2Version = o2.split("\\.|-");
//
// for(int i=0; i<splitO1Version.length; i++){
// if(i >= splitO2Version.length){
// return 1;
// }
//
// Comparable chunk1;
// try {
// chunk1 = Integer.valueOf(splitO1Version[i]);
// }catch(NumberFormatException e){
// chunk1 = splitO1Version[i];
// }
//
// Comparable chunk2;
// try {
// chunk2 = Integer.valueOf(splitO2Version[i]);
// }catch(NumberFormatException e){
// chunk2 = splitO2Version[i];
// }
//
// if (chunk1.getClass() != chunk2.getClass()) {
// throw new IllegalArgumentException("Comparing different types in chunk " + i +
// ". Version 1 = " + o1 + ", version 2 = " + o2);
// }
//
// if(!splitO1Version[i].equals(splitO2Version[i])){
// return chunk1.compareTo(chunk2);
// }
// }
//
// if(splitO1Version.length == splitO2Version.length){
// return 0;
// } else {
// return -1;
// }
// }
// }
|
import javax.annotation.Nonnull;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.jenkins.tools.test.model.comparators.VersionComparator;
|
}
@Override
public String toString(){
return "MavenCoordinates[groupId="+groupId+", artifactId="+artifactId+", version="+version+"]";
}
public String toGAV(){
return groupId+":"+artifactId+":"+version;
}
public static MavenCoordinates fromGAV(String gav){
String[] chunks = gav.split(":");
return new MavenCoordinates(chunks[0], chunks[1], chunks[2]);
}
@Override
public int compareTo(MavenCoordinates o) {
if((groupId+":"+artifactId).equals(o.groupId+":"+o.artifactId)){
return compareVersionTo(o.version);
} else {
return (groupId+":"+artifactId).compareTo(o.groupId+":"+o.artifactId);
}
}
public boolean matches(String groupId, String artifactId) {
return this.groupId.equals(groupId) && this.artifactId.equals(artifactId);
}
public int compareVersionTo(String version) {
|
// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/comparators/VersionComparator.java
// public class VersionComparator implements Comparator<String>, Serializable {
// @Override
// public int compare(String o1, String o2) {
//
// String[] splitO1Version = o1.split("\\.|-");
// String[] splitO2Version = o2.split("\\.|-");
//
// for(int i=0; i<splitO1Version.length; i++){
// if(i >= splitO2Version.length){
// return 1;
// }
//
// Comparable chunk1;
// try {
// chunk1 = Integer.valueOf(splitO1Version[i]);
// }catch(NumberFormatException e){
// chunk1 = splitO1Version[i];
// }
//
// Comparable chunk2;
// try {
// chunk2 = Integer.valueOf(splitO2Version[i]);
// }catch(NumberFormatException e){
// chunk2 = splitO2Version[i];
// }
//
// if (chunk1.getClass() != chunk2.getClass()) {
// throw new IllegalArgumentException("Comparing different types in chunk " + i +
// ". Version 1 = " + o1 + ", version 2 = " + o2);
// }
//
// if(!splitO1Version[i].equals(splitO2Version[i])){
// return chunk1.compareTo(chunk2);
// }
// }
//
// if(splitO1Version.length == splitO2Version.length){
// return 0;
// } else {
// return -1;
// }
// }
// }
// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/MavenCoordinates.java
import javax.annotation.Nonnull;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.jenkins.tools.test.model.comparators.VersionComparator;
}
@Override
public String toString(){
return "MavenCoordinates[groupId="+groupId+", artifactId="+artifactId+", version="+version+"]";
}
public String toGAV(){
return groupId+":"+artifactId+":"+version;
}
public static MavenCoordinates fromGAV(String gav){
String[] chunks = gav.split(":");
return new MavenCoordinates(chunks[0], chunks[1], chunks[2]);
}
@Override
public int compareTo(MavenCoordinates o) {
if((groupId+":"+artifactId).equals(o.groupId+":"+o.artifactId)){
return compareVersionTo(o.version);
} else {
return (groupId+":"+artifactId).compareTo(o.groupId+":"+o.artifactId);
}
}
public boolean matches(String groupId, String artifactId) {
return this.groupId.equals(groupId) && this.artifactId.equals(artifactId);
}
public int compareVersionTo(String version) {
|
return new VersionComparator().compare(this.version, version);
|
jenkinsci/plugin-compat-tester
|
plugins-compat-tester/src/main/java/org/jenkins/tools/test/hook/ConfigurationAsCodeHook.java
|
// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/PomData.java
// public class PomData {
// public final String artifactId;
// public final String groupId;
//
// @Nonnull
// private final String packaging;
//
// @CheckForNull
// public final MavenCoordinates parent;
// private String connectionUrl;
// private String scmTag;
// private List<String> warningMessages = new ArrayList<>();
//
// public PomData(String artifactId, @CheckForNull String packaging, String connectionUrl, String scmTag, @CheckForNull MavenCoordinates parent, String groupId){
// this.artifactId = artifactId;
// this.groupId = groupId;
// this.packaging = packaging != null ? packaging : "jar";
// this.setConnectionUrl(connectionUrl);
// this.scmTag = scmTag;
// this.parent = parent;
// }
//
// public String getConnectionUrl() {
// return connectionUrl;
// }
//
// public void setConnectionUrl(String connectionUrl) {
// this.connectionUrl = connectionUrl;
// }
//
// @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "Deliberately mutable")
// public List<String> getWarningMessages() {
// return warningMessages;
// }
//
// @Nonnull
// public String getPackaging() {
// return packaging;
// }
//
// public String getScmTag() {
// return scmTag;
// }
//
// public boolean isPluginPOM() {
// if (parent != null) {
// return parent.matches("org.jenkins-ci.plugins", "plugin");
// } else { // Interpolate by packaging
// return "hpi".equalsIgnoreCase(packaging);
// }
// }
// }
|
import hudson.model.UpdateSite;
import java.util.Map;
import org.jenkins.tools.test.model.PomData;
|
package org.jenkins.tools.test.hook;
public class ConfigurationAsCodeHook extends AbstractMultiParentHook {
@Override
protected String getParentFolder() {
return "configuration-as-code-plugin";
}
@Override
protected String getParentProjectName() {
return "configuration-as-code";
}
@Override
public boolean check(Map<String, Object> info) {
return isCascPlugin(info);
}
@Override
protected String getPluginFolderName(UpdateSite.Plugin currentPlugin) {
return "plugin";
}
private boolean isCascPlugin(Map<String, Object> moreInfo) {
|
// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/PomData.java
// public class PomData {
// public final String artifactId;
// public final String groupId;
//
// @Nonnull
// private final String packaging;
//
// @CheckForNull
// public final MavenCoordinates parent;
// private String connectionUrl;
// private String scmTag;
// private List<String> warningMessages = new ArrayList<>();
//
// public PomData(String artifactId, @CheckForNull String packaging, String connectionUrl, String scmTag, @CheckForNull MavenCoordinates parent, String groupId){
// this.artifactId = artifactId;
// this.groupId = groupId;
// this.packaging = packaging != null ? packaging : "jar";
// this.setConnectionUrl(connectionUrl);
// this.scmTag = scmTag;
// this.parent = parent;
// }
//
// public String getConnectionUrl() {
// return connectionUrl;
// }
//
// public void setConnectionUrl(String connectionUrl) {
// this.connectionUrl = connectionUrl;
// }
//
// @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "Deliberately mutable")
// public List<String> getWarningMessages() {
// return warningMessages;
// }
//
// @Nonnull
// public String getPackaging() {
// return packaging;
// }
//
// public String getScmTag() {
// return scmTag;
// }
//
// public boolean isPluginPOM() {
// if (parent != null) {
// return parent.matches("org.jenkins-ci.plugins", "plugin");
// } else { // Interpolate by packaging
// return "hpi".equalsIgnoreCase(packaging);
// }
// }
// }
// Path: plugins-compat-tester/src/main/java/org/jenkins/tools/test/hook/ConfigurationAsCodeHook.java
import hudson.model.UpdateSite;
import java.util.Map;
import org.jenkins.tools.test.model.PomData;
package org.jenkins.tools.test.hook;
public class ConfigurationAsCodeHook extends AbstractMultiParentHook {
@Override
protected String getParentFolder() {
return "configuration-as-code-plugin";
}
@Override
protected String getParentProjectName() {
return "configuration-as-code";
}
@Override
public boolean check(Map<String, Object> info) {
return isCascPlugin(info);
}
@Override
protected String getPluginFolderName(UpdateSite.Plugin currentPlugin) {
return "plugin";
}
private boolean isCascPlugin(Map<String, Object> moreInfo) {
|
PomData data = (PomData) moreInfo.get("pomData");
|
jenkinsci/plugin-compat-tester
|
plugins-compat-tester/src/main/java/org/jenkins/tools/test/exception/PomExecutionException.java
|
// Path: plugins-compat-tester/src/main/java/org/jenkins/tools/test/util/ExecutedTestNamesDetails.java
// public class ExecutedTestNamesDetails {
//
// private static final String FAILED = "FAILED";
//
// private static final String EXECUTED = "EXECUTED";
//
// private Map<String, Set<String>> tests;
//
// public ExecutedTestNamesDetails() {
// this.tests = new HashMap<>();
// }
//
// public void addFailedTest(String test) {
// add(FAILED, test);
// }
//
// public void addExecutedTest(String test) {
// add(EXECUTED, test);
// }
//
// public Set<String> getAll() {
// Set<String> result = new TreeSet<>();
// if (this.tests.containsKey(EXECUTED)) {
// result.addAll(this.tests.get(EXECUTED));
// }
// if (this.tests.containsKey(FAILED)) {
// result.addAll(this.tests.get(FAILED));
// }
// return Collections.unmodifiableSet(result);
// }
//
// public Set<String> getFailed() {
// return get(FAILED);
// }
//
// public Set<String> getExecuted() {
// return get(EXECUTED);
// }
//
// private Set<String> get(String key) {
// return this.tests.containsKey(key) ? Collections.unmodifiableSet(new TreeSet<>(this.tests.get(key))) : null;
// }
//
// private void add(String key, String test) {
// if (this.tests.get(key) == null) {
// this.tests.put(key, new TreeSet<String>());
// }
// this.tests.get(key).add(test);
// }
//
// public boolean hasBeenExecuted() {
// return getExecuted() != null || getFailed() != null;
// }
//
// public boolean isSuccess() {
// return getExecuted() != null && getFailed() == null;
// }
//
// public boolean hasFailures() {
// return getFailed() != null && !getFailed().isEmpty();
// }
// }
|
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import org.jenkins.tools.test.util.ExecutedTestNamesDetails;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.util.ArrayList;
|
/*
* The MIT License
*
* Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi,
* Erik Ramfelt, Koichi Fujikawa, Red Hat, Inc., Seiji Sogabe,
* Stephen Connolly, Tom Huybrechts, Yahoo! Inc., Alan Harder, CloudBees, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.jenkins.tools.test.exception;
/**
* Exception thrown during a plugin's Maven execution
*
* @author Frederic Camblor
*/
public class PomExecutionException extends Exception {
private final List<Throwable> exceptionsThrown;
public final List<String> succeededPluginArtifactIds;
private final List<String> pomWarningMessages;
|
// Path: plugins-compat-tester/src/main/java/org/jenkins/tools/test/util/ExecutedTestNamesDetails.java
// public class ExecutedTestNamesDetails {
//
// private static final String FAILED = "FAILED";
//
// private static final String EXECUTED = "EXECUTED";
//
// private Map<String, Set<String>> tests;
//
// public ExecutedTestNamesDetails() {
// this.tests = new HashMap<>();
// }
//
// public void addFailedTest(String test) {
// add(FAILED, test);
// }
//
// public void addExecutedTest(String test) {
// add(EXECUTED, test);
// }
//
// public Set<String> getAll() {
// Set<String> result = new TreeSet<>();
// if (this.tests.containsKey(EXECUTED)) {
// result.addAll(this.tests.get(EXECUTED));
// }
// if (this.tests.containsKey(FAILED)) {
// result.addAll(this.tests.get(FAILED));
// }
// return Collections.unmodifiableSet(result);
// }
//
// public Set<String> getFailed() {
// return get(FAILED);
// }
//
// public Set<String> getExecuted() {
// return get(EXECUTED);
// }
//
// private Set<String> get(String key) {
// return this.tests.containsKey(key) ? Collections.unmodifiableSet(new TreeSet<>(this.tests.get(key))) : null;
// }
//
// private void add(String key, String test) {
// if (this.tests.get(key) == null) {
// this.tests.put(key, new TreeSet<String>());
// }
// this.tests.get(key).add(test);
// }
//
// public boolean hasBeenExecuted() {
// return getExecuted() != null || getFailed() != null;
// }
//
// public boolean isSuccess() {
// return getExecuted() != null && getFailed() == null;
// }
//
// public boolean hasFailures() {
// return getFailed() != null && !getFailed().isEmpty();
// }
// }
// Path: plugins-compat-tester/src/main/java/org/jenkins/tools/test/exception/PomExecutionException.java
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import org.jenkins.tools.test.util.ExecutedTestNamesDetails;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.util.ArrayList;
/*
* The MIT License
*
* Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi,
* Erik Ramfelt, Koichi Fujikawa, Red Hat, Inc., Seiji Sogabe,
* Stephen Connolly, Tom Huybrechts, Yahoo! Inc., Alan Harder, CloudBees, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.jenkins.tools.test.exception;
/**
* Exception thrown during a plugin's Maven execution
*
* @author Frederic Camblor
*/
public class PomExecutionException extends Exception {
private final List<Throwable> exceptionsThrown;
public final List<String> succeededPluginArtifactIds;
private final List<String> pomWarningMessages;
|
private final ExecutedTestNamesDetails testDetails;
|
jenkinsci/plugin-compat-tester
|
plugins-compat-tester/src/test/java/org/jenkins/tools/test/hook/WarningsNGExecutionHookTest.java
|
// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/MavenCoordinates.java
// public class MavenCoordinates implements Comparable<MavenCoordinates> {
// public final String groupId;
// public final String artifactId;
// public final String version;
// // No classifier/type for the moment...
//
// /**
// * Constructor.
// *
// * @throws IllegalArgumentException one of the parameters is invalid.
// */
// public MavenCoordinates(@Nonnull String groupId, @Nonnull String artifactId, @Nonnull String version){
// this.groupId = verifyInput( groupId, artifactId, version,"groupId", groupId);
// this.artifactId = verifyInput( groupId, artifactId, version,"artifactId", artifactId);
// this.version = verifyInput( groupId, artifactId, version,"version", version);
// }
//
// private static String verifyInput(String groupId, String artifactId, String version,
// String fieldName, String value) throws IllegalArgumentException {
// if (value == null || StringUtils.isBlank(value)) {
// throw new IllegalArgumentException(
// String.format("Invalid parameter passed for %s:%s:%s: Field %s; %s",
// groupId, artifactId, version, fieldName, value));
// }
// return value.trim();
// }
//
// @Override
// public boolean equals(Object o){
// if (!(o instanceof MavenCoordinates)) {
// return false;
// }
// MavenCoordinates c2 = (MavenCoordinates)o;
// return new EqualsBuilder().append(groupId, c2.groupId).append(artifactId, c2.artifactId).append(version, c2.version).isEquals();
// }
//
// @Override
// public int hashCode(){
// return new HashCodeBuilder().append(groupId).append(artifactId).append(version).toHashCode();
// }
//
// @Override
// public String toString(){
// return "MavenCoordinates[groupId="+groupId+", artifactId="+artifactId+", version="+version+"]";
// }
//
// public String toGAV(){
// return groupId+":"+artifactId+":"+version;
// }
//
// public static MavenCoordinates fromGAV(String gav){
// String[] chunks = gav.split(":");
// return new MavenCoordinates(chunks[0], chunks[1], chunks[2]);
// }
//
// @Override
// public int compareTo(MavenCoordinates o) {
// if((groupId+":"+artifactId).equals(o.groupId+":"+o.artifactId)){
// return compareVersionTo(o.version);
// } else {
// return (groupId+":"+artifactId).compareTo(o.groupId+":"+o.artifactId);
// }
// }
//
// public boolean matches(String groupId, String artifactId) {
// return this.groupId.equals(groupId) && this.artifactId.equals(artifactId);
// }
//
// public int compareVersionTo(String version) {
// return new VersionComparator().compare(this.version, version);
// }
// }
//
// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/PomData.java
// public class PomData {
// public final String artifactId;
// public final String groupId;
//
// @Nonnull
// private final String packaging;
//
// @CheckForNull
// public final MavenCoordinates parent;
// private String connectionUrl;
// private String scmTag;
// private List<String> warningMessages = new ArrayList<>();
//
// public PomData(String artifactId, @CheckForNull String packaging, String connectionUrl, String scmTag, @CheckForNull MavenCoordinates parent, String groupId){
// this.artifactId = artifactId;
// this.groupId = groupId;
// this.packaging = packaging != null ? packaging : "jar";
// this.setConnectionUrl(connectionUrl);
// this.scmTag = scmTag;
// this.parent = parent;
// }
//
// public String getConnectionUrl() {
// return connectionUrl;
// }
//
// public void setConnectionUrl(String connectionUrl) {
// this.connectionUrl = connectionUrl;
// }
//
// @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "Deliberately mutable")
// public List<String> getWarningMessages() {
// return warningMessages;
// }
//
// @Nonnull
// public String getPackaging() {
// return packaging;
// }
//
// public String getScmTag() {
// return scmTag;
// }
//
// public boolean isPluginPOM() {
// if (parent != null) {
// return parent.matches("org.jenkins-ci.plugins", "plugin");
// } else { // Interpolate by packaging
// return "hpi".equalsIgnoreCase(packaging);
// }
// }
// }
|
import com.google.common.collect.Lists;
import org.jenkins.tools.test.model.MavenCoordinates;
import org.jenkins.tools.test.model.PomData;
import org.junit.Test;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
|
package org.jenkins.tools.test.hook;
public class WarningsNGExecutionHookTest {
@Test
public void testCheckMethod() {
final WarningsNGExecutionHook hook = new WarningsNGExecutionHook();
|
// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/MavenCoordinates.java
// public class MavenCoordinates implements Comparable<MavenCoordinates> {
// public final String groupId;
// public final String artifactId;
// public final String version;
// // No classifier/type for the moment...
//
// /**
// * Constructor.
// *
// * @throws IllegalArgumentException one of the parameters is invalid.
// */
// public MavenCoordinates(@Nonnull String groupId, @Nonnull String artifactId, @Nonnull String version){
// this.groupId = verifyInput( groupId, artifactId, version,"groupId", groupId);
// this.artifactId = verifyInput( groupId, artifactId, version,"artifactId", artifactId);
// this.version = verifyInput( groupId, artifactId, version,"version", version);
// }
//
// private static String verifyInput(String groupId, String artifactId, String version,
// String fieldName, String value) throws IllegalArgumentException {
// if (value == null || StringUtils.isBlank(value)) {
// throw new IllegalArgumentException(
// String.format("Invalid parameter passed for %s:%s:%s: Field %s; %s",
// groupId, artifactId, version, fieldName, value));
// }
// return value.trim();
// }
//
// @Override
// public boolean equals(Object o){
// if (!(o instanceof MavenCoordinates)) {
// return false;
// }
// MavenCoordinates c2 = (MavenCoordinates)o;
// return new EqualsBuilder().append(groupId, c2.groupId).append(artifactId, c2.artifactId).append(version, c2.version).isEquals();
// }
//
// @Override
// public int hashCode(){
// return new HashCodeBuilder().append(groupId).append(artifactId).append(version).toHashCode();
// }
//
// @Override
// public String toString(){
// return "MavenCoordinates[groupId="+groupId+", artifactId="+artifactId+", version="+version+"]";
// }
//
// public String toGAV(){
// return groupId+":"+artifactId+":"+version;
// }
//
// public static MavenCoordinates fromGAV(String gav){
// String[] chunks = gav.split(":");
// return new MavenCoordinates(chunks[0], chunks[1], chunks[2]);
// }
//
// @Override
// public int compareTo(MavenCoordinates o) {
// if((groupId+":"+artifactId).equals(o.groupId+":"+o.artifactId)){
// return compareVersionTo(o.version);
// } else {
// return (groupId+":"+artifactId).compareTo(o.groupId+":"+o.artifactId);
// }
// }
//
// public boolean matches(String groupId, String artifactId) {
// return this.groupId.equals(groupId) && this.artifactId.equals(artifactId);
// }
//
// public int compareVersionTo(String version) {
// return new VersionComparator().compare(this.version, version);
// }
// }
//
// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/PomData.java
// public class PomData {
// public final String artifactId;
// public final String groupId;
//
// @Nonnull
// private final String packaging;
//
// @CheckForNull
// public final MavenCoordinates parent;
// private String connectionUrl;
// private String scmTag;
// private List<String> warningMessages = new ArrayList<>();
//
// public PomData(String artifactId, @CheckForNull String packaging, String connectionUrl, String scmTag, @CheckForNull MavenCoordinates parent, String groupId){
// this.artifactId = artifactId;
// this.groupId = groupId;
// this.packaging = packaging != null ? packaging : "jar";
// this.setConnectionUrl(connectionUrl);
// this.scmTag = scmTag;
// this.parent = parent;
// }
//
// public String getConnectionUrl() {
// return connectionUrl;
// }
//
// public void setConnectionUrl(String connectionUrl) {
// this.connectionUrl = connectionUrl;
// }
//
// @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "Deliberately mutable")
// public List<String> getWarningMessages() {
// return warningMessages;
// }
//
// @Nonnull
// public String getPackaging() {
// return packaging;
// }
//
// public String getScmTag() {
// return scmTag;
// }
//
// public boolean isPluginPOM() {
// if (parent != null) {
// return parent.matches("org.jenkins-ci.plugins", "plugin");
// } else { // Interpolate by packaging
// return "hpi".equalsIgnoreCase(packaging);
// }
// }
// }
// Path: plugins-compat-tester/src/test/java/org/jenkins/tools/test/hook/WarningsNGExecutionHookTest.java
import com.google.common.collect.Lists;
import org.jenkins.tools.test.model.MavenCoordinates;
import org.jenkins.tools.test.model.PomData;
import org.junit.Test;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
package org.jenkins.tools.test.hook;
public class WarningsNGExecutionHookTest {
@Test
public void testCheckMethod() {
final WarningsNGExecutionHook hook = new WarningsNGExecutionHook();
|
final MavenCoordinates parent = new MavenCoordinates("org.jenkins-ci.plugins", "plugin", "3.57");
|
jenkinsci/plugin-compat-tester
|
plugins-compat-tester/src/test/java/org/jenkins/tools/test/hook/WarningsNGExecutionHookTest.java
|
// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/MavenCoordinates.java
// public class MavenCoordinates implements Comparable<MavenCoordinates> {
// public final String groupId;
// public final String artifactId;
// public final String version;
// // No classifier/type for the moment...
//
// /**
// * Constructor.
// *
// * @throws IllegalArgumentException one of the parameters is invalid.
// */
// public MavenCoordinates(@Nonnull String groupId, @Nonnull String artifactId, @Nonnull String version){
// this.groupId = verifyInput( groupId, artifactId, version,"groupId", groupId);
// this.artifactId = verifyInput( groupId, artifactId, version,"artifactId", artifactId);
// this.version = verifyInput( groupId, artifactId, version,"version", version);
// }
//
// private static String verifyInput(String groupId, String artifactId, String version,
// String fieldName, String value) throws IllegalArgumentException {
// if (value == null || StringUtils.isBlank(value)) {
// throw new IllegalArgumentException(
// String.format("Invalid parameter passed for %s:%s:%s: Field %s; %s",
// groupId, artifactId, version, fieldName, value));
// }
// return value.trim();
// }
//
// @Override
// public boolean equals(Object o){
// if (!(o instanceof MavenCoordinates)) {
// return false;
// }
// MavenCoordinates c2 = (MavenCoordinates)o;
// return new EqualsBuilder().append(groupId, c2.groupId).append(artifactId, c2.artifactId).append(version, c2.version).isEquals();
// }
//
// @Override
// public int hashCode(){
// return new HashCodeBuilder().append(groupId).append(artifactId).append(version).toHashCode();
// }
//
// @Override
// public String toString(){
// return "MavenCoordinates[groupId="+groupId+", artifactId="+artifactId+", version="+version+"]";
// }
//
// public String toGAV(){
// return groupId+":"+artifactId+":"+version;
// }
//
// public static MavenCoordinates fromGAV(String gav){
// String[] chunks = gav.split(":");
// return new MavenCoordinates(chunks[0], chunks[1], chunks[2]);
// }
//
// @Override
// public int compareTo(MavenCoordinates o) {
// if((groupId+":"+artifactId).equals(o.groupId+":"+o.artifactId)){
// return compareVersionTo(o.version);
// } else {
// return (groupId+":"+artifactId).compareTo(o.groupId+":"+o.artifactId);
// }
// }
//
// public boolean matches(String groupId, String artifactId) {
// return this.groupId.equals(groupId) && this.artifactId.equals(artifactId);
// }
//
// public int compareVersionTo(String version) {
// return new VersionComparator().compare(this.version, version);
// }
// }
//
// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/PomData.java
// public class PomData {
// public final String artifactId;
// public final String groupId;
//
// @Nonnull
// private final String packaging;
//
// @CheckForNull
// public final MavenCoordinates parent;
// private String connectionUrl;
// private String scmTag;
// private List<String> warningMessages = new ArrayList<>();
//
// public PomData(String artifactId, @CheckForNull String packaging, String connectionUrl, String scmTag, @CheckForNull MavenCoordinates parent, String groupId){
// this.artifactId = artifactId;
// this.groupId = groupId;
// this.packaging = packaging != null ? packaging : "jar";
// this.setConnectionUrl(connectionUrl);
// this.scmTag = scmTag;
// this.parent = parent;
// }
//
// public String getConnectionUrl() {
// return connectionUrl;
// }
//
// public void setConnectionUrl(String connectionUrl) {
// this.connectionUrl = connectionUrl;
// }
//
// @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "Deliberately mutable")
// public List<String> getWarningMessages() {
// return warningMessages;
// }
//
// @Nonnull
// public String getPackaging() {
// return packaging;
// }
//
// public String getScmTag() {
// return scmTag;
// }
//
// public boolean isPluginPOM() {
// if (parent != null) {
// return parent.matches("org.jenkins-ci.plugins", "plugin");
// } else { // Interpolate by packaging
// return "hpi".equalsIgnoreCase(packaging);
// }
// }
// }
|
import com.google.common.collect.Lists;
import org.jenkins.tools.test.model.MavenCoordinates;
import org.jenkins.tools.test.model.PomData;
import org.junit.Test;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
|
package org.jenkins.tools.test.hook;
public class WarningsNGExecutionHookTest {
@Test
public void testCheckMethod() {
final WarningsNGExecutionHook hook = new WarningsNGExecutionHook();
final MavenCoordinates parent = new MavenCoordinates("org.jenkins-ci.plugins", "plugin", "3.57");
|
// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/MavenCoordinates.java
// public class MavenCoordinates implements Comparable<MavenCoordinates> {
// public final String groupId;
// public final String artifactId;
// public final String version;
// // No classifier/type for the moment...
//
// /**
// * Constructor.
// *
// * @throws IllegalArgumentException one of the parameters is invalid.
// */
// public MavenCoordinates(@Nonnull String groupId, @Nonnull String artifactId, @Nonnull String version){
// this.groupId = verifyInput( groupId, artifactId, version,"groupId", groupId);
// this.artifactId = verifyInput( groupId, artifactId, version,"artifactId", artifactId);
// this.version = verifyInput( groupId, artifactId, version,"version", version);
// }
//
// private static String verifyInput(String groupId, String artifactId, String version,
// String fieldName, String value) throws IllegalArgumentException {
// if (value == null || StringUtils.isBlank(value)) {
// throw new IllegalArgumentException(
// String.format("Invalid parameter passed for %s:%s:%s: Field %s; %s",
// groupId, artifactId, version, fieldName, value));
// }
// return value.trim();
// }
//
// @Override
// public boolean equals(Object o){
// if (!(o instanceof MavenCoordinates)) {
// return false;
// }
// MavenCoordinates c2 = (MavenCoordinates)o;
// return new EqualsBuilder().append(groupId, c2.groupId).append(artifactId, c2.artifactId).append(version, c2.version).isEquals();
// }
//
// @Override
// public int hashCode(){
// return new HashCodeBuilder().append(groupId).append(artifactId).append(version).toHashCode();
// }
//
// @Override
// public String toString(){
// return "MavenCoordinates[groupId="+groupId+", artifactId="+artifactId+", version="+version+"]";
// }
//
// public String toGAV(){
// return groupId+":"+artifactId+":"+version;
// }
//
// public static MavenCoordinates fromGAV(String gav){
// String[] chunks = gav.split(":");
// return new MavenCoordinates(chunks[0], chunks[1], chunks[2]);
// }
//
// @Override
// public int compareTo(MavenCoordinates o) {
// if((groupId+":"+artifactId).equals(o.groupId+":"+o.artifactId)){
// return compareVersionTo(o.version);
// } else {
// return (groupId+":"+artifactId).compareTo(o.groupId+":"+o.artifactId);
// }
// }
//
// public boolean matches(String groupId, String artifactId) {
// return this.groupId.equals(groupId) && this.artifactId.equals(artifactId);
// }
//
// public int compareVersionTo(String version) {
// return new VersionComparator().compare(this.version, version);
// }
// }
//
// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/PomData.java
// public class PomData {
// public final String artifactId;
// public final String groupId;
//
// @Nonnull
// private final String packaging;
//
// @CheckForNull
// public final MavenCoordinates parent;
// private String connectionUrl;
// private String scmTag;
// private List<String> warningMessages = new ArrayList<>();
//
// public PomData(String artifactId, @CheckForNull String packaging, String connectionUrl, String scmTag, @CheckForNull MavenCoordinates parent, String groupId){
// this.artifactId = artifactId;
// this.groupId = groupId;
// this.packaging = packaging != null ? packaging : "jar";
// this.setConnectionUrl(connectionUrl);
// this.scmTag = scmTag;
// this.parent = parent;
// }
//
// public String getConnectionUrl() {
// return connectionUrl;
// }
//
// public void setConnectionUrl(String connectionUrl) {
// this.connectionUrl = connectionUrl;
// }
//
// @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "Deliberately mutable")
// public List<String> getWarningMessages() {
// return warningMessages;
// }
//
// @Nonnull
// public String getPackaging() {
// return packaging;
// }
//
// public String getScmTag() {
// return scmTag;
// }
//
// public boolean isPluginPOM() {
// if (parent != null) {
// return parent.matches("org.jenkins-ci.plugins", "plugin");
// } else { // Interpolate by packaging
// return "hpi".equalsIgnoreCase(packaging);
// }
// }
// }
// Path: plugins-compat-tester/src/test/java/org/jenkins/tools/test/hook/WarningsNGExecutionHookTest.java
import com.google.common.collect.Lists;
import org.jenkins.tools.test.model.MavenCoordinates;
import org.jenkins.tools.test.model.PomData;
import org.junit.Test;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
package org.jenkins.tools.test.hook;
public class WarningsNGExecutionHookTest {
@Test
public void testCheckMethod() {
final WarningsNGExecutionHook hook = new WarningsNGExecutionHook();
final MavenCoordinates parent = new MavenCoordinates("org.jenkins-ci.plugins", "plugin", "3.57");
|
PomData pomData = new PomData("warnings-ng", "hpi", "it-does-not-matter", "whatever", parent, "org.jenkins-ci.plugins");
|
jenkinsci/plugin-compat-tester
|
plugins-compat-tester/src/main/java/org/jenkins/tools/test/hook/WarningsNGExecutionHook.java
|
// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/PomData.java
// public class PomData {
// public final String artifactId;
// public final String groupId;
//
// @Nonnull
// private final String packaging;
//
// @CheckForNull
// public final MavenCoordinates parent;
// private String connectionUrl;
// private String scmTag;
// private List<String> warningMessages = new ArrayList<>();
//
// public PomData(String artifactId, @CheckForNull String packaging, String connectionUrl, String scmTag, @CheckForNull MavenCoordinates parent, String groupId){
// this.artifactId = artifactId;
// this.groupId = groupId;
// this.packaging = packaging != null ? packaging : "jar";
// this.setConnectionUrl(connectionUrl);
// this.scmTag = scmTag;
// this.parent = parent;
// }
//
// public String getConnectionUrl() {
// return connectionUrl;
// }
//
// public void setConnectionUrl(String connectionUrl) {
// this.connectionUrl = connectionUrl;
// }
//
// @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "Deliberately mutable")
// public List<String> getWarningMessages() {
// return warningMessages;
// }
//
// @Nonnull
// public String getPackaging() {
// return packaging;
// }
//
// public String getScmTag() {
// return scmTag;
// }
//
// public boolean isPluginPOM() {
// if (parent != null) {
// return parent.matches("org.jenkins-ci.plugins", "plugin");
// } else { // Interpolate by packaging
// return "hpi".equalsIgnoreCase(packaging);
// }
// }
// }
|
import org.jenkins.tools.test.model.PomData;
import java.util.Map;
|
package org.jenkins.tools.test.hook;
/**
* Workaround for Warnings NG plugin since it needs execute integration tests.
*/
public class WarningsNGExecutionHook extends PluginWithFailsafeIntegrationTestsHook {
@Override
public boolean check(Map<String, Object> info) {
|
// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/PomData.java
// public class PomData {
// public final String artifactId;
// public final String groupId;
//
// @Nonnull
// private final String packaging;
//
// @CheckForNull
// public final MavenCoordinates parent;
// private String connectionUrl;
// private String scmTag;
// private List<String> warningMessages = new ArrayList<>();
//
// public PomData(String artifactId, @CheckForNull String packaging, String connectionUrl, String scmTag, @CheckForNull MavenCoordinates parent, String groupId){
// this.artifactId = artifactId;
// this.groupId = groupId;
// this.packaging = packaging != null ? packaging : "jar";
// this.setConnectionUrl(connectionUrl);
// this.scmTag = scmTag;
// this.parent = parent;
// }
//
// public String getConnectionUrl() {
// return connectionUrl;
// }
//
// public void setConnectionUrl(String connectionUrl) {
// this.connectionUrl = connectionUrl;
// }
//
// @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "Deliberately mutable")
// public List<String> getWarningMessages() {
// return warningMessages;
// }
//
// @Nonnull
// public String getPackaging() {
// return packaging;
// }
//
// public String getScmTag() {
// return scmTag;
// }
//
// public boolean isPluginPOM() {
// if (parent != null) {
// return parent.matches("org.jenkins-ci.plugins", "plugin");
// } else { // Interpolate by packaging
// return "hpi".equalsIgnoreCase(packaging);
// }
// }
// }
// Path: plugins-compat-tester/src/main/java/org/jenkins/tools/test/hook/WarningsNGExecutionHook.java
import org.jenkins.tools.test.model.PomData;
import java.util.Map;
package org.jenkins.tools.test.hook;
/**
* Workaround for Warnings NG plugin since it needs execute integration tests.
*/
public class WarningsNGExecutionHook extends PluginWithFailsafeIntegrationTestsHook {
@Override
public boolean check(Map<String, Object> info) {
|
PomData data = (PomData) info.get("pomData");
|
advantageous/reakt
|
src/main/java/io/advantageous/reakt/CallbackHandler.java
|
// Path: src/main/java/io/advantageous/reakt/exception/RejectedPromiseException.java
// public class RejectedPromiseException extends RuntimeException {
//
// public RejectedPromiseException(String s) {
// super(s);
// }
//
// public RejectedPromiseException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public RejectedPromiseException(Throwable cause) {
// super(cause);
// }
// }
//
// Path: src/main/java/io/advantageous/reakt/impl/ResultImpl.java
// public class ResultImpl<T> implements Result<T> {
//
// private final Object object;
//
// public ResultImpl(final Object object) {
// this.object = object;
// }
//
// @Override
// public Result<T> thenExpect(final Consumer<Expected<T>> consumer) {
// if (success()) consumer.accept(expect());
// return this;
// }
//
// @Override
// public Result<T> then(final Consumer<T> consumer) {
// if (success()) consumer.accept(get());
// return this;
// }
//
// @Override
// public Result<T> catchError(final Consumer<Throwable> handler) {
// if (failure()) handler.accept(cause());
// return this;
// }
//
// public boolean success() {
// return !(this.object instanceof Throwable);
// }
//
// @Override
// public boolean complete() {
// return true;
// }
//
// public boolean failure() {
// return this.object instanceof Throwable;
// }
//
// @Override
// public Throwable cause() {
// return this.object instanceof Throwable ? (Throwable) this.object : null;
// }
//
// @SuppressWarnings("unchecked")
// public Expected<T> expect() {
// if (failure()) throw new IllegalStateException(cause());
// return Expected.ofNullable((T) this.object);
// }
//
// @SuppressWarnings("unchecked")
// public T get() {
// if (failure()) {
// if (cause() instanceof RuntimeException) {
// throw (RuntimeException) cause();
// } else {
// throw new ResultFailedException(cause());
// }
// }
// return (T) this.object;
// }
//
// @Override
// @SuppressWarnings("unchecked")
// public T orElse(final T other) {
// return success() ? (T) this.object : other;
// }
//
// }
//
// Path: src/main/java/io/advantageous/reakt/Result.java
// static Result<Void> doneResult() {
// return DONE;
// }
|
import static io.advantageous.reakt.Result.doneResult;
import io.advantageous.reakt.exception.RejectedPromiseException;
import io.advantageous.reakt.impl.ResultImpl;
import java.util.function.Consumer;
|
/*
*
* Copyright (c) 2016. Rick Hightower, Geoff Chandler
*
* Licensed 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 io.advantageous.reakt;
/**
* A generic event handler which can be thought of as a callback handler.
* <p>
* This is like an async future or promise.
* <p>
* This was modeled after QBit's callback, and JavaScripts callbacks.
* The {@link Result} result represents the result or error from an async operation.
* <p>
* A {@code CallbackHandler} is a {@code Consumer} and can be used anywhere a consumer is used.
* This is for easy integration with non-Reakt libs and code bases.
* <p>
*
* @param <T> type of result returned from callback
* @author Rick Hightower
* @author Geoff Chandler
*/
public interface CallbackHandler<T> extends Consumer<T>, Callback<T> {
/**
* (Client view)
* A result was returned so handle it.
* <p>
* This is registered from the callers (or event receivers perspective).
* A client of a service would override {@code onResult}.
*
* @param result to handle
*/
void onResult(Result<T> result);
/**
* (Service view)
* This allows services to send back a failed result easily to the client/handler.
* <p>
* This is a helper methods for producers (services that produce results) to send a failed result.
*
* @param error error
*/
default void reject(final Throwable error) {
|
// Path: src/main/java/io/advantageous/reakt/exception/RejectedPromiseException.java
// public class RejectedPromiseException extends RuntimeException {
//
// public RejectedPromiseException(String s) {
// super(s);
// }
//
// public RejectedPromiseException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public RejectedPromiseException(Throwable cause) {
// super(cause);
// }
// }
//
// Path: src/main/java/io/advantageous/reakt/impl/ResultImpl.java
// public class ResultImpl<T> implements Result<T> {
//
// private final Object object;
//
// public ResultImpl(final Object object) {
// this.object = object;
// }
//
// @Override
// public Result<T> thenExpect(final Consumer<Expected<T>> consumer) {
// if (success()) consumer.accept(expect());
// return this;
// }
//
// @Override
// public Result<T> then(final Consumer<T> consumer) {
// if (success()) consumer.accept(get());
// return this;
// }
//
// @Override
// public Result<T> catchError(final Consumer<Throwable> handler) {
// if (failure()) handler.accept(cause());
// return this;
// }
//
// public boolean success() {
// return !(this.object instanceof Throwable);
// }
//
// @Override
// public boolean complete() {
// return true;
// }
//
// public boolean failure() {
// return this.object instanceof Throwable;
// }
//
// @Override
// public Throwable cause() {
// return this.object instanceof Throwable ? (Throwable) this.object : null;
// }
//
// @SuppressWarnings("unchecked")
// public Expected<T> expect() {
// if (failure()) throw new IllegalStateException(cause());
// return Expected.ofNullable((T) this.object);
// }
//
// @SuppressWarnings("unchecked")
// public T get() {
// if (failure()) {
// if (cause() instanceof RuntimeException) {
// throw (RuntimeException) cause();
// } else {
// throw new ResultFailedException(cause());
// }
// }
// return (T) this.object;
// }
//
// @Override
// @SuppressWarnings("unchecked")
// public T orElse(final T other) {
// return success() ? (T) this.object : other;
// }
//
// }
//
// Path: src/main/java/io/advantageous/reakt/Result.java
// static Result<Void> doneResult() {
// return DONE;
// }
// Path: src/main/java/io/advantageous/reakt/CallbackHandler.java
import static io.advantageous.reakt.Result.doneResult;
import io.advantageous.reakt.exception.RejectedPromiseException;
import io.advantageous.reakt.impl.ResultImpl;
import java.util.function.Consumer;
/*
*
* Copyright (c) 2016. Rick Hightower, Geoff Chandler
*
* Licensed 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 io.advantageous.reakt;
/**
* A generic event handler which can be thought of as a callback handler.
* <p>
* This is like an async future or promise.
* <p>
* This was modeled after QBit's callback, and JavaScripts callbacks.
* The {@link Result} result represents the result or error from an async operation.
* <p>
* A {@code CallbackHandler} is a {@code Consumer} and can be used anywhere a consumer is used.
* This is for easy integration with non-Reakt libs and code bases.
* <p>
*
* @param <T> type of result returned from callback
* @author Rick Hightower
* @author Geoff Chandler
*/
public interface CallbackHandler<T> extends Consumer<T>, Callback<T> {
/**
* (Client view)
* A result was returned so handle it.
* <p>
* This is registered from the callers (or event receivers perspective).
* A client of a service would override {@code onResult}.
*
* @param result to handle
*/
void onResult(Result<T> result);
/**
* (Service view)
* This allows services to send back a failed result easily to the client/handler.
* <p>
* This is a helper methods for producers (services that produce results) to send a failed result.
*
* @param error error
*/
default void reject(final Throwable error) {
|
onResult(new ResultImpl<>(error));
|
advantageous/reakt
|
src/main/java/io/advantageous/reakt/CallbackHandler.java
|
// Path: src/main/java/io/advantageous/reakt/exception/RejectedPromiseException.java
// public class RejectedPromiseException extends RuntimeException {
//
// public RejectedPromiseException(String s) {
// super(s);
// }
//
// public RejectedPromiseException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public RejectedPromiseException(Throwable cause) {
// super(cause);
// }
// }
//
// Path: src/main/java/io/advantageous/reakt/impl/ResultImpl.java
// public class ResultImpl<T> implements Result<T> {
//
// private final Object object;
//
// public ResultImpl(final Object object) {
// this.object = object;
// }
//
// @Override
// public Result<T> thenExpect(final Consumer<Expected<T>> consumer) {
// if (success()) consumer.accept(expect());
// return this;
// }
//
// @Override
// public Result<T> then(final Consumer<T> consumer) {
// if (success()) consumer.accept(get());
// return this;
// }
//
// @Override
// public Result<T> catchError(final Consumer<Throwable> handler) {
// if (failure()) handler.accept(cause());
// return this;
// }
//
// public boolean success() {
// return !(this.object instanceof Throwable);
// }
//
// @Override
// public boolean complete() {
// return true;
// }
//
// public boolean failure() {
// return this.object instanceof Throwable;
// }
//
// @Override
// public Throwable cause() {
// return this.object instanceof Throwable ? (Throwable) this.object : null;
// }
//
// @SuppressWarnings("unchecked")
// public Expected<T> expect() {
// if (failure()) throw new IllegalStateException(cause());
// return Expected.ofNullable((T) this.object);
// }
//
// @SuppressWarnings("unchecked")
// public T get() {
// if (failure()) {
// if (cause() instanceof RuntimeException) {
// throw (RuntimeException) cause();
// } else {
// throw new ResultFailedException(cause());
// }
// }
// return (T) this.object;
// }
//
// @Override
// @SuppressWarnings("unchecked")
// public T orElse(final T other) {
// return success() ? (T) this.object : other;
// }
//
// }
//
// Path: src/main/java/io/advantageous/reakt/Result.java
// static Result<Void> doneResult() {
// return DONE;
// }
|
import static io.advantageous.reakt.Result.doneResult;
import io.advantageous.reakt.exception.RejectedPromiseException;
import io.advantageous.reakt.impl.ResultImpl;
import java.util.function.Consumer;
|
/*
*
* Copyright (c) 2016. Rick Hightower, Geoff Chandler
*
* Licensed 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 io.advantageous.reakt;
/**
* A generic event handler which can be thought of as a callback handler.
* <p>
* This is like an async future or promise.
* <p>
* This was modeled after QBit's callback, and JavaScripts callbacks.
* The {@link Result} result represents the result or error from an async operation.
* <p>
* A {@code CallbackHandler} is a {@code Consumer} and can be used anywhere a consumer is used.
* This is for easy integration with non-Reakt libs and code bases.
* <p>
*
* @param <T> type of result returned from callback
* @author Rick Hightower
* @author Geoff Chandler
*/
public interface CallbackHandler<T> extends Consumer<T>, Callback<T> {
/**
* (Client view)
* A result was returned so handle it.
* <p>
* This is registered from the callers (or event receivers perspective).
* A client of a service would override {@code onResult}.
*
* @param result to handle
*/
void onResult(Result<T> result);
/**
* (Service view)
* This allows services to send back a failed result easily to the client/handler.
* <p>
* This is a helper methods for producers (services that produce results) to send a failed result.
*
* @param error error
*/
default void reject(final Throwable error) {
onResult(new ResultImpl<>(error));
}
/**
* (Service view)
* This allows services to send back a failed result easily to the client/handler.
* <p>
* This is a helper methods for producers (services that produce results) to send a failed result.
*
* @param errorMessage error message
*/
default void reject(final String errorMessage) {
|
// Path: src/main/java/io/advantageous/reakt/exception/RejectedPromiseException.java
// public class RejectedPromiseException extends RuntimeException {
//
// public RejectedPromiseException(String s) {
// super(s);
// }
//
// public RejectedPromiseException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public RejectedPromiseException(Throwable cause) {
// super(cause);
// }
// }
//
// Path: src/main/java/io/advantageous/reakt/impl/ResultImpl.java
// public class ResultImpl<T> implements Result<T> {
//
// private final Object object;
//
// public ResultImpl(final Object object) {
// this.object = object;
// }
//
// @Override
// public Result<T> thenExpect(final Consumer<Expected<T>> consumer) {
// if (success()) consumer.accept(expect());
// return this;
// }
//
// @Override
// public Result<T> then(final Consumer<T> consumer) {
// if (success()) consumer.accept(get());
// return this;
// }
//
// @Override
// public Result<T> catchError(final Consumer<Throwable> handler) {
// if (failure()) handler.accept(cause());
// return this;
// }
//
// public boolean success() {
// return !(this.object instanceof Throwable);
// }
//
// @Override
// public boolean complete() {
// return true;
// }
//
// public boolean failure() {
// return this.object instanceof Throwable;
// }
//
// @Override
// public Throwable cause() {
// return this.object instanceof Throwable ? (Throwable) this.object : null;
// }
//
// @SuppressWarnings("unchecked")
// public Expected<T> expect() {
// if (failure()) throw new IllegalStateException(cause());
// return Expected.ofNullable((T) this.object);
// }
//
// @SuppressWarnings("unchecked")
// public T get() {
// if (failure()) {
// if (cause() instanceof RuntimeException) {
// throw (RuntimeException) cause();
// } else {
// throw new ResultFailedException(cause());
// }
// }
// return (T) this.object;
// }
//
// @Override
// @SuppressWarnings("unchecked")
// public T orElse(final T other) {
// return success() ? (T) this.object : other;
// }
//
// }
//
// Path: src/main/java/io/advantageous/reakt/Result.java
// static Result<Void> doneResult() {
// return DONE;
// }
// Path: src/main/java/io/advantageous/reakt/CallbackHandler.java
import static io.advantageous.reakt.Result.doneResult;
import io.advantageous.reakt.exception.RejectedPromiseException;
import io.advantageous.reakt.impl.ResultImpl;
import java.util.function.Consumer;
/*
*
* Copyright (c) 2016. Rick Hightower, Geoff Chandler
*
* Licensed 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 io.advantageous.reakt;
/**
* A generic event handler which can be thought of as a callback handler.
* <p>
* This is like an async future or promise.
* <p>
* This was modeled after QBit's callback, and JavaScripts callbacks.
* The {@link Result} result represents the result or error from an async operation.
* <p>
* A {@code CallbackHandler} is a {@code Consumer} and can be used anywhere a consumer is used.
* This is for easy integration with non-Reakt libs and code bases.
* <p>
*
* @param <T> type of result returned from callback
* @author Rick Hightower
* @author Geoff Chandler
*/
public interface CallbackHandler<T> extends Consumer<T>, Callback<T> {
/**
* (Client view)
* A result was returned so handle it.
* <p>
* This is registered from the callers (or event receivers perspective).
* A client of a service would override {@code onResult}.
*
* @param result to handle
*/
void onResult(Result<T> result);
/**
* (Service view)
* This allows services to send back a failed result easily to the client/handler.
* <p>
* This is a helper methods for producers (services that produce results) to send a failed result.
*
* @param error error
*/
default void reject(final Throwable error) {
onResult(new ResultImpl<>(error));
}
/**
* (Service view)
* This allows services to send back a failed result easily to the client/handler.
* <p>
* This is a helper methods for producers (services that produce results) to send a failed result.
*
* @param errorMessage error message
*/
default void reject(final String errorMessage) {
|
reject(new RejectedPromiseException(errorMessage));
|
advantageous/reakt
|
src/main/java/io/advantageous/reakt/CallbackHandler.java
|
// Path: src/main/java/io/advantageous/reakt/exception/RejectedPromiseException.java
// public class RejectedPromiseException extends RuntimeException {
//
// public RejectedPromiseException(String s) {
// super(s);
// }
//
// public RejectedPromiseException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public RejectedPromiseException(Throwable cause) {
// super(cause);
// }
// }
//
// Path: src/main/java/io/advantageous/reakt/impl/ResultImpl.java
// public class ResultImpl<T> implements Result<T> {
//
// private final Object object;
//
// public ResultImpl(final Object object) {
// this.object = object;
// }
//
// @Override
// public Result<T> thenExpect(final Consumer<Expected<T>> consumer) {
// if (success()) consumer.accept(expect());
// return this;
// }
//
// @Override
// public Result<T> then(final Consumer<T> consumer) {
// if (success()) consumer.accept(get());
// return this;
// }
//
// @Override
// public Result<T> catchError(final Consumer<Throwable> handler) {
// if (failure()) handler.accept(cause());
// return this;
// }
//
// public boolean success() {
// return !(this.object instanceof Throwable);
// }
//
// @Override
// public boolean complete() {
// return true;
// }
//
// public boolean failure() {
// return this.object instanceof Throwable;
// }
//
// @Override
// public Throwable cause() {
// return this.object instanceof Throwable ? (Throwable) this.object : null;
// }
//
// @SuppressWarnings("unchecked")
// public Expected<T> expect() {
// if (failure()) throw new IllegalStateException(cause());
// return Expected.ofNullable((T) this.object);
// }
//
// @SuppressWarnings("unchecked")
// public T get() {
// if (failure()) {
// if (cause() instanceof RuntimeException) {
// throw (RuntimeException) cause();
// } else {
// throw new ResultFailedException(cause());
// }
// }
// return (T) this.object;
// }
//
// @Override
// @SuppressWarnings("unchecked")
// public T orElse(final T other) {
// return success() ? (T) this.object : other;
// }
//
// }
//
// Path: src/main/java/io/advantageous/reakt/Result.java
// static Result<Void> doneResult() {
// return DONE;
// }
|
import static io.advantageous.reakt.Result.doneResult;
import io.advantageous.reakt.exception.RejectedPromiseException;
import io.advantageous.reakt.impl.ResultImpl;
import java.util.function.Consumer;
|
/*
*
* Copyright (c) 2016. Rick Hightower, Geoff Chandler
*
* Licensed 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 io.advantageous.reakt;
/**
* A generic event handler which can be thought of as a callback handler.
* <p>
* This is like an async future or promise.
* <p>
* This was modeled after QBit's callback, and JavaScripts callbacks.
* The {@link Result} result represents the result or error from an async operation.
* <p>
* A {@code CallbackHandler} is a {@code Consumer} and can be used anywhere a consumer is used.
* This is for easy integration with non-Reakt libs and code bases.
* <p>
*
* @param <T> type of result returned from callback
* @author Rick Hightower
* @author Geoff Chandler
*/
public interface CallbackHandler<T> extends Consumer<T>, Callback<T> {
/**
* (Client view)
* A result was returned so handle it.
* <p>
* This is registered from the callers (or event receivers perspective).
* A client of a service would override {@code onResult}.
*
* @param result to handle
*/
void onResult(Result<T> result);
/**
* (Service view)
* This allows services to send back a failed result easily to the client/handler.
* <p>
* This is a helper methods for producers (services that produce results) to send a failed result.
*
* @param error error
*/
default void reject(final Throwable error) {
onResult(new ResultImpl<>(error));
}
/**
* (Service view)
* This allows services to send back a failed result easily to the client/handler.
* <p>
* This is a helper methods for producers (services that produce results) to send a failed result.
*
* @param errorMessage error message
*/
default void reject(final String errorMessage) {
reject(new RejectedPromiseException(errorMessage));
}
/**
* (Service view)
* This allows services to send back a failed result easily to the client/handler.
* <p>
* This is a helper methods for producers (services that produce results) to send a failed result.
*
* @param errorMessage error message
* @param error exception
*/
default void reject(final String errorMessage, final Throwable error) {
reject(new RejectedPromiseException(errorMessage, error));
}
/**
* Calls replayDone, for VOID callback only. ES6 promise style.
*/
@SuppressWarnings("unused")
default void resolve() {
|
// Path: src/main/java/io/advantageous/reakt/exception/RejectedPromiseException.java
// public class RejectedPromiseException extends RuntimeException {
//
// public RejectedPromiseException(String s) {
// super(s);
// }
//
// public RejectedPromiseException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public RejectedPromiseException(Throwable cause) {
// super(cause);
// }
// }
//
// Path: src/main/java/io/advantageous/reakt/impl/ResultImpl.java
// public class ResultImpl<T> implements Result<T> {
//
// private final Object object;
//
// public ResultImpl(final Object object) {
// this.object = object;
// }
//
// @Override
// public Result<T> thenExpect(final Consumer<Expected<T>> consumer) {
// if (success()) consumer.accept(expect());
// return this;
// }
//
// @Override
// public Result<T> then(final Consumer<T> consumer) {
// if (success()) consumer.accept(get());
// return this;
// }
//
// @Override
// public Result<T> catchError(final Consumer<Throwable> handler) {
// if (failure()) handler.accept(cause());
// return this;
// }
//
// public boolean success() {
// return !(this.object instanceof Throwable);
// }
//
// @Override
// public boolean complete() {
// return true;
// }
//
// public boolean failure() {
// return this.object instanceof Throwable;
// }
//
// @Override
// public Throwable cause() {
// return this.object instanceof Throwable ? (Throwable) this.object : null;
// }
//
// @SuppressWarnings("unchecked")
// public Expected<T> expect() {
// if (failure()) throw new IllegalStateException(cause());
// return Expected.ofNullable((T) this.object);
// }
//
// @SuppressWarnings("unchecked")
// public T get() {
// if (failure()) {
// if (cause() instanceof RuntimeException) {
// throw (RuntimeException) cause();
// } else {
// throw new ResultFailedException(cause());
// }
// }
// return (T) this.object;
// }
//
// @Override
// @SuppressWarnings("unchecked")
// public T orElse(final T other) {
// return success() ? (T) this.object : other;
// }
//
// }
//
// Path: src/main/java/io/advantageous/reakt/Result.java
// static Result<Void> doneResult() {
// return DONE;
// }
// Path: src/main/java/io/advantageous/reakt/CallbackHandler.java
import static io.advantageous.reakt.Result.doneResult;
import io.advantageous.reakt.exception.RejectedPromiseException;
import io.advantageous.reakt.impl.ResultImpl;
import java.util.function.Consumer;
/*
*
* Copyright (c) 2016. Rick Hightower, Geoff Chandler
*
* Licensed 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 io.advantageous.reakt;
/**
* A generic event handler which can be thought of as a callback handler.
* <p>
* This is like an async future or promise.
* <p>
* This was modeled after QBit's callback, and JavaScripts callbacks.
* The {@link Result} result represents the result or error from an async operation.
* <p>
* A {@code CallbackHandler} is a {@code Consumer} and can be used anywhere a consumer is used.
* This is for easy integration with non-Reakt libs and code bases.
* <p>
*
* @param <T> type of result returned from callback
* @author Rick Hightower
* @author Geoff Chandler
*/
public interface CallbackHandler<T> extends Consumer<T>, Callback<T> {
/**
* (Client view)
* A result was returned so handle it.
* <p>
* This is registered from the callers (or event receivers perspective).
* A client of a service would override {@code onResult}.
*
* @param result to handle
*/
void onResult(Result<T> result);
/**
* (Service view)
* This allows services to send back a failed result easily to the client/handler.
* <p>
* This is a helper methods for producers (services that produce results) to send a failed result.
*
* @param error error
*/
default void reject(final Throwable error) {
onResult(new ResultImpl<>(error));
}
/**
* (Service view)
* This allows services to send back a failed result easily to the client/handler.
* <p>
* This is a helper methods for producers (services that produce results) to send a failed result.
*
* @param errorMessage error message
*/
default void reject(final String errorMessage) {
reject(new RejectedPromiseException(errorMessage));
}
/**
* (Service view)
* This allows services to send back a failed result easily to the client/handler.
* <p>
* This is a helper methods for producers (services that produce results) to send a failed result.
*
* @param errorMessage error message
* @param error exception
*/
default void reject(final String errorMessage, final Throwable error) {
reject(new RejectedPromiseException(errorMessage, error));
}
/**
* Calls replayDone, for VOID callback only. ES6 promise style.
*/
@SuppressWarnings("unused")
default void resolve() {
|
onResult((Result<T>) doneResult());
|
advantageous/reakt
|
src/main/java/io/advantageous/reakt/promise/Promises.java
|
// Path: src/main/java/io/advantageous/reakt/Callback.java
// public interface Callback<T> {
//
// /**
// * (Service view)
// * This allows services to send back a failed result easily to the client/handler.
// * <p>
// * This is a helper methods for producers (services that produce results) to send a failed result.
// *
// * @param error error
// */
// void reject(final Throwable error);
//
//
// /**
// * (Service view)
// * This allows services to send back a failed result easily to the client/handler.
// * <p>
// * This is a helper methods for producers (services that produce results) to send a failed result.
// *
// * @param errorMessage error message
// */
// void reject(final String errorMessage);
//
//
// /**
// * (Service view)
// * This allows services to send back a failed result easily to the client/handler.
// * <p>
// * This is a helper methods for producers (services that produce results) to send a failed result.
// *
// * @param errorMessage error message
// * @param error exception
// */
// void reject(final String errorMessage, final Throwable error);
//
//
// /**
// * Calls replayDone, for VOID callback only. ES6 promise style.
// */
// void resolve();
//
// /**
// * Resolve resolves a promise.
// *
// * @param result makes it more compatible with ES6 style promises
// */
// void resolve(final T result);
//
//
// }
|
import io.advantageous.reakt.Callback;
import io.advantageous.reakt.promise.impl.*;
import java.time.Duration;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;
|
static <K, V> Promise<Map<K, V>> blockingPromiseMap(final Class<K> keyType,
final Class<V> valueType) {
return new BlockingPromise<>();
}
/**
* Generic set promise.
* Added to make static imports possible.
* Create a blocking promise.
* NOTE BLOCKING PROMISES ARE FOR LEGACY INTEGRATION AND TESTING ONLY!!!
*
* @param componentType component type of set
* @param <T> promise a set of type T
* @return new PromiseHandler for a set of type T
*/
@SuppressWarnings("unused")
static <T> Promise<Set<T>> blockingPromiseSet(Class<T> componentType) {
return new BlockingPromise<>();
}
/**
* Create an invokable promise.
* After you create a promise you register its then(...) and catchError(...) and then you use it to
* handle a callback.
*
* @param <T> type of result
* @param callbackConsumer promise consumer so you can call reject or resolve on the service side
* @return new promise
*/
|
// Path: src/main/java/io/advantageous/reakt/Callback.java
// public interface Callback<T> {
//
// /**
// * (Service view)
// * This allows services to send back a failed result easily to the client/handler.
// * <p>
// * This is a helper methods for producers (services that produce results) to send a failed result.
// *
// * @param error error
// */
// void reject(final Throwable error);
//
//
// /**
// * (Service view)
// * This allows services to send back a failed result easily to the client/handler.
// * <p>
// * This is a helper methods for producers (services that produce results) to send a failed result.
// *
// * @param errorMessage error message
// */
// void reject(final String errorMessage);
//
//
// /**
// * (Service view)
// * This allows services to send back a failed result easily to the client/handler.
// * <p>
// * This is a helper methods for producers (services that produce results) to send a failed result.
// *
// * @param errorMessage error message
// * @param error exception
// */
// void reject(final String errorMessage, final Throwable error);
//
//
// /**
// * Calls replayDone, for VOID callback only. ES6 promise style.
// */
// void resolve();
//
// /**
// * Resolve resolves a promise.
// *
// * @param result makes it more compatible with ES6 style promises
// */
// void resolve(final T result);
//
//
// }
// Path: src/main/java/io/advantageous/reakt/promise/Promises.java
import io.advantageous.reakt.Callback;
import io.advantageous.reakt.promise.impl.*;
import java.time.Duration;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;
static <K, V> Promise<Map<K, V>> blockingPromiseMap(final Class<K> keyType,
final Class<V> valueType) {
return new BlockingPromise<>();
}
/**
* Generic set promise.
* Added to make static imports possible.
* Create a blocking promise.
* NOTE BLOCKING PROMISES ARE FOR LEGACY INTEGRATION AND TESTING ONLY!!!
*
* @param componentType component type of set
* @param <T> promise a set of type T
* @return new PromiseHandler for a set of type T
*/
@SuppressWarnings("unused")
static <T> Promise<Set<T>> blockingPromiseSet(Class<T> componentType) {
return new BlockingPromise<>();
}
/**
* Create an invokable promise.
* After you create a promise you register its then(...) and catchError(...) and then you use it to
* handle a callback.
*
* @param <T> type of result
* @param callbackConsumer promise consumer so you can call reject or resolve on the service side
* @return new promise
*/
|
static <T> Promise<T> invokablePromise(Consumer<Callback<T>> callbackConsumer) {
|
advantageous/reakt
|
src/main/java/io/advantageous/reakt/Stream.java
|
// Path: src/main/java/io/advantageous/reakt/exception/RejectedStreamException.java
// public class RejectedStreamException extends RuntimeException {
//
// public RejectedStreamException() {
// super();
// }
//
// public RejectedStreamException(String message) {
// super(message);
// }
//
// public RejectedStreamException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public RejectedStreamException(Throwable cause) {
// super(cause);
// }
//
// protected RejectedStreamException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
// }
//
// Path: src/main/java/io/advantageous/reakt/impl/StreamResultImpl.java
// public class StreamResultImpl<T> extends ResultImpl<T> implements StreamResult<T> {
// private final boolean done;
// private final Expected<Runnable> cancelCallback;
// private final Expected<Consumer<Long>> requestMore;
//
// public StreamResultImpl(final Object object,
// final boolean done,
// final Expected<Runnable> cancelCallback,
// final Expected<Consumer<Long>> requestMore) {
// super(object);
// this.done = done;
// this.cancelCallback = cancelCallback;
// this.requestMore = requestMore;
// }
//
// @Override
// public boolean complete() {
// return done;
// }
//
// @Override
// public void cancel() {
// cancelCallback.ifPresent(Runnable::run);
// }
//
// @Override
// public void request(long n) {
// requestMore.ifPresent(longConsumer -> longConsumer.accept(n));
// }
// }
|
import io.advantageous.reakt.exception.RejectedStreamException;
import io.advantageous.reakt.impl.StreamResultImpl;
import java.util.function.Consumer;
|
/*
*
* Copyright (c) 2016. Rick Hightower, Geoff Chandler
*
* Licensed 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 io.advantageous.reakt;
/**
* A generic event handler for N results, i.e., a stream of results.
*
* This is a like a type of {@link CallbackHandler} for streaming results.
* While {@code CallbackHandler} can be considered for scalar results, a
* {@code Stream} is more appropriate for non-scalar results, i.e., {@code Stream#onNext}
* will get called many times which can be thought of as a callback handler.
* This is like an async future or promise.
*
* @param <T> type of result returned from callback
* @author Rick Hightower
*/
public interface Stream<T> extends Callback<T> {
/**
* (Client view)
* A result was returned so handle it.
* This is registered from the callers (or event receivers perspective).
* A client of a service would override {@code onResult}.
*
* @param result to handle
*/
void onNext(final StreamResult<T> result);
/**
* (Service view)
* This allows services to send back a last result easily to the client/handler.
* This is a helper methods for producers (services that produce results) to send a result.
*
* @param result result value to send.
*/
default void complete(final T result) {
|
// Path: src/main/java/io/advantageous/reakt/exception/RejectedStreamException.java
// public class RejectedStreamException extends RuntimeException {
//
// public RejectedStreamException() {
// super();
// }
//
// public RejectedStreamException(String message) {
// super(message);
// }
//
// public RejectedStreamException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public RejectedStreamException(Throwable cause) {
// super(cause);
// }
//
// protected RejectedStreamException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
// }
//
// Path: src/main/java/io/advantageous/reakt/impl/StreamResultImpl.java
// public class StreamResultImpl<T> extends ResultImpl<T> implements StreamResult<T> {
// private final boolean done;
// private final Expected<Runnable> cancelCallback;
// private final Expected<Consumer<Long>> requestMore;
//
// public StreamResultImpl(final Object object,
// final boolean done,
// final Expected<Runnable> cancelCallback,
// final Expected<Consumer<Long>> requestMore) {
// super(object);
// this.done = done;
// this.cancelCallback = cancelCallback;
// this.requestMore = requestMore;
// }
//
// @Override
// public boolean complete() {
// return done;
// }
//
// @Override
// public void cancel() {
// cancelCallback.ifPresent(Runnable::run);
// }
//
// @Override
// public void request(long n) {
// requestMore.ifPresent(longConsumer -> longConsumer.accept(n));
// }
// }
// Path: src/main/java/io/advantageous/reakt/Stream.java
import io.advantageous.reakt.exception.RejectedStreamException;
import io.advantageous.reakt.impl.StreamResultImpl;
import java.util.function.Consumer;
/*
*
* Copyright (c) 2016. Rick Hightower, Geoff Chandler
*
* Licensed 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 io.advantageous.reakt;
/**
* A generic event handler for N results, i.e., a stream of results.
*
* This is a like a type of {@link CallbackHandler} for streaming results.
* While {@code CallbackHandler} can be considered for scalar results, a
* {@code Stream} is more appropriate for non-scalar results, i.e., {@code Stream#onNext}
* will get called many times which can be thought of as a callback handler.
* This is like an async future or promise.
*
* @param <T> type of result returned from callback
* @author Rick Hightower
*/
public interface Stream<T> extends Callback<T> {
/**
* (Client view)
* A result was returned so handle it.
* This is registered from the callers (or event receivers perspective).
* A client of a service would override {@code onResult}.
*
* @param result to handle
*/
void onNext(final StreamResult<T> result);
/**
* (Service view)
* This allows services to send back a last result easily to the client/handler.
* This is a helper methods for producers (services that produce results) to send a result.
*
* @param result result value to send.
*/
default void complete(final T result) {
|
this.onNext(new StreamResultImpl<>(result, true, Expected.empty(), Expected.empty()));
|
advantageous/reakt
|
src/main/java/io/advantageous/reakt/Stream.java
|
// Path: src/main/java/io/advantageous/reakt/exception/RejectedStreamException.java
// public class RejectedStreamException extends RuntimeException {
//
// public RejectedStreamException() {
// super();
// }
//
// public RejectedStreamException(String message) {
// super(message);
// }
//
// public RejectedStreamException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public RejectedStreamException(Throwable cause) {
// super(cause);
// }
//
// protected RejectedStreamException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
// }
//
// Path: src/main/java/io/advantageous/reakt/impl/StreamResultImpl.java
// public class StreamResultImpl<T> extends ResultImpl<T> implements StreamResult<T> {
// private final boolean done;
// private final Expected<Runnable> cancelCallback;
// private final Expected<Consumer<Long>> requestMore;
//
// public StreamResultImpl(final Object object,
// final boolean done,
// final Expected<Runnable> cancelCallback,
// final Expected<Consumer<Long>> requestMore) {
// super(object);
// this.done = done;
// this.cancelCallback = cancelCallback;
// this.requestMore = requestMore;
// }
//
// @Override
// public boolean complete() {
// return done;
// }
//
// @Override
// public void cancel() {
// cancelCallback.ifPresent(Runnable::run);
// }
//
// @Override
// public void request(long n) {
// requestMore.ifPresent(longConsumer -> longConsumer.accept(n));
// }
// }
|
import io.advantageous.reakt.exception.RejectedStreamException;
import io.advantageous.reakt.impl.StreamResultImpl;
import java.util.function.Consumer;
|
* This is a helper methods for producers (services that produce results) to send a failed result.
*
* @param errorMessage error message
*/
default void fail(final String errorMessage) {
this.onNext(new StreamResultImpl<>(
new IllegalStateException(errorMessage), true, Expected.empty(), Expected.empty()));
}
/**
* (Service view)
* This allows services to send back a failed result easily to the client/handler.
* This is a helper methods for producers (services that produce results) to send a failed result.
*
* @param error error
*/
default void reject(final Throwable error) {
this.onNext(new StreamResultImpl<>(error, true, Expected.empty(), Expected.empty()));
}
/**
* (Service view)
* This allows services to send back a failed result easily to the client/handler.
* This is a helper methods for producers (services that produce results) to send a failed result.
*
* @param errorMessage error message
*/
default void reject(final String errorMessage) {
this.onNext(new StreamResultImpl<>(
|
// Path: src/main/java/io/advantageous/reakt/exception/RejectedStreamException.java
// public class RejectedStreamException extends RuntimeException {
//
// public RejectedStreamException() {
// super();
// }
//
// public RejectedStreamException(String message) {
// super(message);
// }
//
// public RejectedStreamException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public RejectedStreamException(Throwable cause) {
// super(cause);
// }
//
// protected RejectedStreamException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
// }
//
// Path: src/main/java/io/advantageous/reakt/impl/StreamResultImpl.java
// public class StreamResultImpl<T> extends ResultImpl<T> implements StreamResult<T> {
// private final boolean done;
// private final Expected<Runnable> cancelCallback;
// private final Expected<Consumer<Long>> requestMore;
//
// public StreamResultImpl(final Object object,
// final boolean done,
// final Expected<Runnable> cancelCallback,
// final Expected<Consumer<Long>> requestMore) {
// super(object);
// this.done = done;
// this.cancelCallback = cancelCallback;
// this.requestMore = requestMore;
// }
//
// @Override
// public boolean complete() {
// return done;
// }
//
// @Override
// public void cancel() {
// cancelCallback.ifPresent(Runnable::run);
// }
//
// @Override
// public void request(long n) {
// requestMore.ifPresent(longConsumer -> longConsumer.accept(n));
// }
// }
// Path: src/main/java/io/advantageous/reakt/Stream.java
import io.advantageous.reakt.exception.RejectedStreamException;
import io.advantageous.reakt.impl.StreamResultImpl;
import java.util.function.Consumer;
* This is a helper methods for producers (services that produce results) to send a failed result.
*
* @param errorMessage error message
*/
default void fail(final String errorMessage) {
this.onNext(new StreamResultImpl<>(
new IllegalStateException(errorMessage), true, Expected.empty(), Expected.empty()));
}
/**
* (Service view)
* This allows services to send back a failed result easily to the client/handler.
* This is a helper methods for producers (services that produce results) to send a failed result.
*
* @param error error
*/
default void reject(final Throwable error) {
this.onNext(new StreamResultImpl<>(error, true, Expected.empty(), Expected.empty()));
}
/**
* (Service view)
* This allows services to send back a failed result easily to the client/handler.
* This is a helper methods for producers (services that produce results) to send a failed result.
*
* @param errorMessage error message
*/
default void reject(final String errorMessage) {
this.onNext(new StreamResultImpl<>(
|
new RejectedStreamException(errorMessage), true, Expected.empty(), Expected.empty()));
|
bitstorm/Wicket-rest-annotations
|
restannotations/src/main/java/org/wicketstuff/rest/annotations/MethodMapping.java
|
// Path: restannotations/src/main/java/org/wicketstuff/rest/contenthandling/RestMimeTypes.java
// public class RestMimeTypes {
// public static final String APPLICATION_RSS_XML = "application/rss+xml";
//
// public static final String TEXT_CSS = "text/css";
//
// public static final String TEXT_CSV = "text/csv";
//
// public static final String TEXT_PLAIN = "text/plain";
//
// public static final String TEXT_HTML = "text/html";
//
// public static final String APPLICATION_XML = "application/xml";
//
// public static final String TEXT_XML = "text/xml";
//
// public static final String APPLICATION_JSON = "application/json";
//
// public static final String IMAGE_GIF = "image/gif";
//
// public static final String IMAGE_JPEG = "image/jpeg";
//
// public static final String IMAGE_PNG = "image/png";
//
// public static final String OCTET_STREAM = "application/octet-stream";
// }
//
// Path: restannotations/src/main/java/org/wicketstuff/rest/utils/http/HttpMethod.java
// public enum HttpMethod {
// GET("GET"), POST("POST"), HEAD("HEAD"), OPTIONS("OPTIONS"), PUT("PUT"), PATCH("PATCH"), DELETE(
// "DELETE"), TRACE("TRACE");
//
// private String method;
//
// private HttpMethod(String method) {
// this.method = method;
// }
//
// /**
// * Converts a string (like "put", "get", "post", etc...) to the
// * corresponding HTTP method.
// *
// * @param httpMethod
// * the string value we want to convert. The conversion mechanism
// * is case-insensitive.
// * @return
// */
// public static HttpMethod toHttpMethod(String httpMethod) {
// HttpMethod[] values = HttpMethod.values();
// httpMethod = httpMethod.toUpperCase();
//
// for (int i = 0; i < values.length; i++) {
// if (values[i].method.equals(httpMethod))
// return values[i];
// }
//
// throw new RuntimeException("The string value '" + httpMethod
// + "' does not correspond to any valid HTTP request method");
// }
//
// public String getMethod() {
// return method;
// }
// }
|
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.wicketstuff.rest.contenthandling.RestMimeTypes;
import org.wicketstuff.rest.utils.http.HttpMethod;
|
/**
* 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.wicketstuff.rest.annotations;
/**
* Annotation used to map a resource method to a given URL.
* The specified URL can contain parameter segment (for example '{id}') and we can
* specify also the request method that must be used.
*
* @author andrea del bene
* @see HttpMethod
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface MethodMapping {
String value();
|
// Path: restannotations/src/main/java/org/wicketstuff/rest/contenthandling/RestMimeTypes.java
// public class RestMimeTypes {
// public static final String APPLICATION_RSS_XML = "application/rss+xml";
//
// public static final String TEXT_CSS = "text/css";
//
// public static final String TEXT_CSV = "text/csv";
//
// public static final String TEXT_PLAIN = "text/plain";
//
// public static final String TEXT_HTML = "text/html";
//
// public static final String APPLICATION_XML = "application/xml";
//
// public static final String TEXT_XML = "text/xml";
//
// public static final String APPLICATION_JSON = "application/json";
//
// public static final String IMAGE_GIF = "image/gif";
//
// public static final String IMAGE_JPEG = "image/jpeg";
//
// public static final String IMAGE_PNG = "image/png";
//
// public static final String OCTET_STREAM = "application/octet-stream";
// }
//
// Path: restannotations/src/main/java/org/wicketstuff/rest/utils/http/HttpMethod.java
// public enum HttpMethod {
// GET("GET"), POST("POST"), HEAD("HEAD"), OPTIONS("OPTIONS"), PUT("PUT"), PATCH("PATCH"), DELETE(
// "DELETE"), TRACE("TRACE");
//
// private String method;
//
// private HttpMethod(String method) {
// this.method = method;
// }
//
// /**
// * Converts a string (like "put", "get", "post", etc...) to the
// * corresponding HTTP method.
// *
// * @param httpMethod
// * the string value we want to convert. The conversion mechanism
// * is case-insensitive.
// * @return
// */
// public static HttpMethod toHttpMethod(String httpMethod) {
// HttpMethod[] values = HttpMethod.values();
// httpMethod = httpMethod.toUpperCase();
//
// for (int i = 0; i < values.length; i++) {
// if (values[i].method.equals(httpMethod))
// return values[i];
// }
//
// throw new RuntimeException("The string value '" + httpMethod
// + "' does not correspond to any valid HTTP request method");
// }
//
// public String getMethod() {
// return method;
// }
// }
// Path: restannotations/src/main/java/org/wicketstuff/rest/annotations/MethodMapping.java
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.wicketstuff.rest.contenthandling.RestMimeTypes;
import org.wicketstuff.rest.utils.http.HttpMethod;
/**
* 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.wicketstuff.rest.annotations;
/**
* Annotation used to map a resource method to a given URL.
* The specified URL can contain parameter segment (for example '{id}') and we can
* specify also the request method that must be used.
*
* @author andrea del bene
* @see HttpMethod
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface MethodMapping {
String value();
|
HttpMethod httpMethod() default HttpMethod.GET;
|
bitstorm/Wicket-rest-annotations
|
restannotations/src/main/java/org/wicketstuff/rest/annotations/MethodMapping.java
|
// Path: restannotations/src/main/java/org/wicketstuff/rest/contenthandling/RestMimeTypes.java
// public class RestMimeTypes {
// public static final String APPLICATION_RSS_XML = "application/rss+xml";
//
// public static final String TEXT_CSS = "text/css";
//
// public static final String TEXT_CSV = "text/csv";
//
// public static final String TEXT_PLAIN = "text/plain";
//
// public static final String TEXT_HTML = "text/html";
//
// public static final String APPLICATION_XML = "application/xml";
//
// public static final String TEXT_XML = "text/xml";
//
// public static final String APPLICATION_JSON = "application/json";
//
// public static final String IMAGE_GIF = "image/gif";
//
// public static final String IMAGE_JPEG = "image/jpeg";
//
// public static final String IMAGE_PNG = "image/png";
//
// public static final String OCTET_STREAM = "application/octet-stream";
// }
//
// Path: restannotations/src/main/java/org/wicketstuff/rest/utils/http/HttpMethod.java
// public enum HttpMethod {
// GET("GET"), POST("POST"), HEAD("HEAD"), OPTIONS("OPTIONS"), PUT("PUT"), PATCH("PATCH"), DELETE(
// "DELETE"), TRACE("TRACE");
//
// private String method;
//
// private HttpMethod(String method) {
// this.method = method;
// }
//
// /**
// * Converts a string (like "put", "get", "post", etc...) to the
// * corresponding HTTP method.
// *
// * @param httpMethod
// * the string value we want to convert. The conversion mechanism
// * is case-insensitive.
// * @return
// */
// public static HttpMethod toHttpMethod(String httpMethod) {
// HttpMethod[] values = HttpMethod.values();
// httpMethod = httpMethod.toUpperCase();
//
// for (int i = 0; i < values.length; i++) {
// if (values[i].method.equals(httpMethod))
// return values[i];
// }
//
// throw new RuntimeException("The string value '" + httpMethod
// + "' does not correspond to any valid HTTP request method");
// }
//
// public String getMethod() {
// return method;
// }
// }
|
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.wicketstuff.rest.contenthandling.RestMimeTypes;
import org.wicketstuff.rest.utils.http.HttpMethod;
|
/**
* 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.wicketstuff.rest.annotations;
/**
* Annotation used to map a resource method to a given URL.
* The specified URL can contain parameter segment (for example '{id}') and we can
* specify also the request method that must be used.
*
* @author andrea del bene
* @see HttpMethod
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface MethodMapping {
String value();
HttpMethod httpMethod() default HttpMethod.GET;
|
// Path: restannotations/src/main/java/org/wicketstuff/rest/contenthandling/RestMimeTypes.java
// public class RestMimeTypes {
// public static final String APPLICATION_RSS_XML = "application/rss+xml";
//
// public static final String TEXT_CSS = "text/css";
//
// public static final String TEXT_CSV = "text/csv";
//
// public static final String TEXT_PLAIN = "text/plain";
//
// public static final String TEXT_HTML = "text/html";
//
// public static final String APPLICATION_XML = "application/xml";
//
// public static final String TEXT_XML = "text/xml";
//
// public static final String APPLICATION_JSON = "application/json";
//
// public static final String IMAGE_GIF = "image/gif";
//
// public static final String IMAGE_JPEG = "image/jpeg";
//
// public static final String IMAGE_PNG = "image/png";
//
// public static final String OCTET_STREAM = "application/octet-stream";
// }
//
// Path: restannotations/src/main/java/org/wicketstuff/rest/utils/http/HttpMethod.java
// public enum HttpMethod {
// GET("GET"), POST("POST"), HEAD("HEAD"), OPTIONS("OPTIONS"), PUT("PUT"), PATCH("PATCH"), DELETE(
// "DELETE"), TRACE("TRACE");
//
// private String method;
//
// private HttpMethod(String method) {
// this.method = method;
// }
//
// /**
// * Converts a string (like "put", "get", "post", etc...) to the
// * corresponding HTTP method.
// *
// * @param httpMethod
// * the string value we want to convert. The conversion mechanism
// * is case-insensitive.
// * @return
// */
// public static HttpMethod toHttpMethod(String httpMethod) {
// HttpMethod[] values = HttpMethod.values();
// httpMethod = httpMethod.toUpperCase();
//
// for (int i = 0; i < values.length; i++) {
// if (values[i].method.equals(httpMethod))
// return values[i];
// }
//
// throw new RuntimeException("The string value '" + httpMethod
// + "' does not correspond to any valid HTTP request method");
// }
//
// public String getMethod() {
// return method;
// }
// }
// Path: restannotations/src/main/java/org/wicketstuff/rest/annotations/MethodMapping.java
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.wicketstuff.rest.contenthandling.RestMimeTypes;
import org.wicketstuff.rest.utils.http.HttpMethod;
/**
* 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.wicketstuff.rest.annotations;
/**
* Annotation used to map a resource method to a given URL.
* The specified URL can contain parameter segment (for example '{id}') and we can
* specify also the request method that must be used.
*
* @author andrea del bene
* @see HttpMethod
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface MethodMapping {
String value();
HttpMethod httpMethod() default HttpMethod.GET;
|
String consumes() default RestMimeTypes.APPLICATION_JSON;
|
bitstorm/Wicket-rest-annotations
|
restannotations/src/test/java/org/wicketstuff/rest/contenthandling/serialdeserial/XmlSerialDeser.java
|
// Path: restannotations/src/main/java/org/wicketstuff/rest/contenthandling/RestMimeTypes.java
// public class RestMimeTypes {
// public static final String APPLICATION_RSS_XML = "application/rss+xml";
//
// public static final String TEXT_CSS = "text/css";
//
// public static final String TEXT_CSV = "text/csv";
//
// public static final String TEXT_PLAIN = "text/plain";
//
// public static final String TEXT_HTML = "text/html";
//
// public static final String APPLICATION_XML = "application/xml";
//
// public static final String TEXT_XML = "text/xml";
//
// public static final String APPLICATION_JSON = "application/json";
//
// public static final String IMAGE_GIF = "image/gif";
//
// public static final String IMAGE_JPEG = "image/jpeg";
//
// public static final String IMAGE_PNG = "image/png";
//
// public static final String OCTET_STREAM = "application/octet-stream";
// }
|
import java.io.StringWriter;
import javax.xml.bind.JAXB;
import org.apache.wicket.request.cycle.RequestCycle;
import org.apache.wicket.request.http.WebResponse;
import org.wicketstuff.rest.contenthandling.RestMimeTypes;
|
/**
* 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.wicketstuff.rest.contenthandling.serialdeserial;
public class XmlSerialDeser extends TextualObjectSerialDeserial {
public XmlSerialDeser() {
|
// Path: restannotations/src/main/java/org/wicketstuff/rest/contenthandling/RestMimeTypes.java
// public class RestMimeTypes {
// public static final String APPLICATION_RSS_XML = "application/rss+xml";
//
// public static final String TEXT_CSS = "text/css";
//
// public static final String TEXT_CSV = "text/csv";
//
// public static final String TEXT_PLAIN = "text/plain";
//
// public static final String TEXT_HTML = "text/html";
//
// public static final String APPLICATION_XML = "application/xml";
//
// public static final String TEXT_XML = "text/xml";
//
// public static final String APPLICATION_JSON = "application/json";
//
// public static final String IMAGE_GIF = "image/gif";
//
// public static final String IMAGE_JPEG = "image/jpeg";
//
// public static final String IMAGE_PNG = "image/png";
//
// public static final String OCTET_STREAM = "application/octet-stream";
// }
// Path: restannotations/src/test/java/org/wicketstuff/rest/contenthandling/serialdeserial/XmlSerialDeser.java
import java.io.StringWriter;
import javax.xml.bind.JAXB;
import org.apache.wicket.request.cycle.RequestCycle;
import org.apache.wicket.request.http.WebResponse;
import org.wicketstuff.rest.contenthandling.RestMimeTypes;
/**
* 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.wicketstuff.rest.contenthandling.serialdeserial;
public class XmlSerialDeser extends TextualObjectSerialDeserial {
public XmlSerialDeser() {
|
super("UTF-8", RestMimeTypes.APPLICATION_XML);
|
bitstorm/Wicket-rest-annotations
|
restannotations-examples/src/main/java/org/wicketstuff/rest/resource/PersonsRestResource.java
|
// Path: restannotations-examples/src/main/java/org/wicketstuff/rest/domain/PersonPojo.java
// public class PersonPojo {
// private String name;
// private String email;
// private String password;
//
// public PersonPojo(String name, String email, String password) {
// this.name = name;
// this.email = email;
// this.password = password;
// }
// }
//
// Path: restannotations-json/src/main/java/org/wicketstuff/rest/resource/gson/GsonRestResource.java
// public class GsonRestResource extends AbstractRestResource<GsonSerialDeserial>{
//
// public GsonRestResource() {
// this(new GsonSerialDeserial());
// }
//
// public GsonRestResource(GsonSerialDeserial gsonSerialDeserial) {
// super(gsonSerialDeserial);
// }
//
// public GsonRestResource(GsonSerialDeserial gsonSerialDeserial, IRoleCheckingStrategy roleCheckingStrategy) {
// super(gsonSerialDeserial, roleCheckingStrategy);
// }
// }
//
// Path: restannotations/src/main/java/org/wicketstuff/rest/utils/http/HttpMethod.java
// public enum HttpMethod {
// GET("GET"), POST("POST"), HEAD("HEAD"), OPTIONS("OPTIONS"), PUT("PUT"), PATCH("PATCH"), DELETE(
// "DELETE"), TRACE("TRACE");
//
// private String method;
//
// private HttpMethod(String method) {
// this.method = method;
// }
//
// /**
// * Converts a string (like "put", "get", "post", etc...) to the
// * corresponding HTTP method.
// *
// * @param httpMethod
// * the string value we want to convert. The conversion mechanism
// * is case-insensitive.
// * @return
// */
// public static HttpMethod toHttpMethod(String httpMethod) {
// HttpMethod[] values = HttpMethod.values();
// httpMethod = httpMethod.toUpperCase();
//
// for (int i = 0; i < values.length; i++) {
// if (values[i].method.equals(httpMethod))
// return values[i];
// }
//
// throw new RuntimeException("The string value '" + httpMethod
// + "' does not correspond to any valid HTTP request method");
// }
//
// public String getMethod() {
// return method;
// }
// }
|
import java.util.ArrayList;
import java.util.List;
import org.wicketstuff.rest.annotations.MethodMapping;
import org.wicketstuff.rest.annotations.parameters.RequestBody;
import org.wicketstuff.rest.domain.PersonPojo;
import org.wicketstuff.rest.resource.gson.GsonRestResource;
import org.wicketstuff.rest.utils.http.HttpMethod;
|
/**
* 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.wicketstuff.rest.resource;
public class PersonsRestResource extends GsonRestResource {
private final List<PersonPojo> persons = new ArrayList<PersonPojo>();
public PersonsRestResource(){
persons.add(new PersonPojo("Freddie Mercury", "fmercury@queen.com", "Eeehooo!"));
persons.add(new PersonPojo("John Deacon", "jdeacon@queen.com", "bass"));
persons.add(new PersonPojo("Brian May", "bmay@queen.com", "guitar"));
persons.add(new PersonPojo("Roger Taylor", "rtaylor@queen.com", "drum"));
}
@MethodMapping("/persons")
public List<PersonPojo> getAllPersons() {
return persons;
}
|
// Path: restannotations-examples/src/main/java/org/wicketstuff/rest/domain/PersonPojo.java
// public class PersonPojo {
// private String name;
// private String email;
// private String password;
//
// public PersonPojo(String name, String email, String password) {
// this.name = name;
// this.email = email;
// this.password = password;
// }
// }
//
// Path: restannotations-json/src/main/java/org/wicketstuff/rest/resource/gson/GsonRestResource.java
// public class GsonRestResource extends AbstractRestResource<GsonSerialDeserial>{
//
// public GsonRestResource() {
// this(new GsonSerialDeserial());
// }
//
// public GsonRestResource(GsonSerialDeserial gsonSerialDeserial) {
// super(gsonSerialDeserial);
// }
//
// public GsonRestResource(GsonSerialDeserial gsonSerialDeserial, IRoleCheckingStrategy roleCheckingStrategy) {
// super(gsonSerialDeserial, roleCheckingStrategy);
// }
// }
//
// Path: restannotations/src/main/java/org/wicketstuff/rest/utils/http/HttpMethod.java
// public enum HttpMethod {
// GET("GET"), POST("POST"), HEAD("HEAD"), OPTIONS("OPTIONS"), PUT("PUT"), PATCH("PATCH"), DELETE(
// "DELETE"), TRACE("TRACE");
//
// private String method;
//
// private HttpMethod(String method) {
// this.method = method;
// }
//
// /**
// * Converts a string (like "put", "get", "post", etc...) to the
// * corresponding HTTP method.
// *
// * @param httpMethod
// * the string value we want to convert. The conversion mechanism
// * is case-insensitive.
// * @return
// */
// public static HttpMethod toHttpMethod(String httpMethod) {
// HttpMethod[] values = HttpMethod.values();
// httpMethod = httpMethod.toUpperCase();
//
// for (int i = 0; i < values.length; i++) {
// if (values[i].method.equals(httpMethod))
// return values[i];
// }
//
// throw new RuntimeException("The string value '" + httpMethod
// + "' does not correspond to any valid HTTP request method");
// }
//
// public String getMethod() {
// return method;
// }
// }
// Path: restannotations-examples/src/main/java/org/wicketstuff/rest/resource/PersonsRestResource.java
import java.util.ArrayList;
import java.util.List;
import org.wicketstuff.rest.annotations.MethodMapping;
import org.wicketstuff.rest.annotations.parameters.RequestBody;
import org.wicketstuff.rest.domain.PersonPojo;
import org.wicketstuff.rest.resource.gson.GsonRestResource;
import org.wicketstuff.rest.utils.http.HttpMethod;
/**
* 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.wicketstuff.rest.resource;
public class PersonsRestResource extends GsonRestResource {
private final List<PersonPojo> persons = new ArrayList<PersonPojo>();
public PersonsRestResource(){
persons.add(new PersonPojo("Freddie Mercury", "fmercury@queen.com", "Eeehooo!"));
persons.add(new PersonPojo("John Deacon", "jdeacon@queen.com", "bass"));
persons.add(new PersonPojo("Brian May", "bmay@queen.com", "guitar"));
persons.add(new PersonPojo("Roger Taylor", "rtaylor@queen.com", "drum"));
}
@MethodMapping("/persons")
public List<PersonPojo> getAllPersons() {
return persons;
}
|
@MethodMapping(value = "/persons/{personIndex}", httpMethod = HttpMethod.DELETE)
|
bitstorm/Wicket-rest-annotations
|
restannotations-examples/src/test/java/org/wicketstuff/rest/TestPersonResource.java
|
// Path: restannotations-examples/src/main/java/org/wicketstuff/rest/domain/PersonPojo.java
// public class PersonPojo {
// private String name;
// private String email;
// private String password;
//
// public PersonPojo(String name, String email, String password) {
// this.name = name;
// this.email = email;
// this.password = password;
// }
// }
//
// Path: restannotations/src/main/java/org/wicketstuff/rest/utils/test/BufferedMockRequest.java
// public class BufferedMockRequest extends MockHttpServletRequest {
// BufferedReader reader;
//
// public BufferedMockRequest(Application application, HttpSession session, ServletContext context, String httpMethod) {
// super(application, session, context);
// setMethod(httpMethod);
// }
//
// @Override
// public BufferedReader getReader() throws IOException {
// if(reader != null)
// return reader;
//
// return super.getReader();
// }
//
// public void setReader(BufferedReader reader) {
// this.reader = reader;
// }
//
// public void setTextAsRequestBody(String requestBody) {
// this.reader = new BufferedReader(new StringReader(requestBody));
// }
// }
|
import org.apache.wicket.util.tester.WicketTester;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.wicketstuff.rest.domain.PersonPojo;
import org.wicketstuff.rest.utils.test.BufferedMockRequest;
import com.google.gson.Gson;
|
/**
* 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.wicketstuff.rest;
/**
* Simple test using the WicketTester
*/
public class TestPersonResource extends Assert
{
private WicketTester tester;
final private Gson gson = new Gson();
@Before
public void setUp()
{
tester = new WicketTester(new WicketApplication());
}
@Test
public void testCreatePerson()
{
|
// Path: restannotations-examples/src/main/java/org/wicketstuff/rest/domain/PersonPojo.java
// public class PersonPojo {
// private String name;
// private String email;
// private String password;
//
// public PersonPojo(String name, String email, String password) {
// this.name = name;
// this.email = email;
// this.password = password;
// }
// }
//
// Path: restannotations/src/main/java/org/wicketstuff/rest/utils/test/BufferedMockRequest.java
// public class BufferedMockRequest extends MockHttpServletRequest {
// BufferedReader reader;
//
// public BufferedMockRequest(Application application, HttpSession session, ServletContext context, String httpMethod) {
// super(application, session, context);
// setMethod(httpMethod);
// }
//
// @Override
// public BufferedReader getReader() throws IOException {
// if(reader != null)
// return reader;
//
// return super.getReader();
// }
//
// public void setReader(BufferedReader reader) {
// this.reader = reader;
// }
//
// public void setTextAsRequestBody(String requestBody) {
// this.reader = new BufferedReader(new StringReader(requestBody));
// }
// }
// Path: restannotations-examples/src/test/java/org/wicketstuff/rest/TestPersonResource.java
import org.apache.wicket.util.tester.WicketTester;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.wicketstuff.rest.domain.PersonPojo;
import org.wicketstuff.rest.utils.test.BufferedMockRequest;
import com.google.gson.Gson;
/**
* 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.wicketstuff.rest;
/**
* Simple test using the WicketTester
*/
public class TestPersonResource extends Assert
{
private WicketTester tester;
final private Gson gson = new Gson();
@Before
public void setUp()
{
tester = new WicketTester(new WicketApplication());
}
@Test
public void testCreatePerson()
{
|
BufferedMockRequest mockRequest =new BufferedMockRequest(tester.getApplication(), tester.getHttpSession(),
|
bitstorm/Wicket-rest-annotations
|
restannotations-examples/src/test/java/org/wicketstuff/rest/TestPersonResource.java
|
// Path: restannotations-examples/src/main/java/org/wicketstuff/rest/domain/PersonPojo.java
// public class PersonPojo {
// private String name;
// private String email;
// private String password;
//
// public PersonPojo(String name, String email, String password) {
// this.name = name;
// this.email = email;
// this.password = password;
// }
// }
//
// Path: restannotations/src/main/java/org/wicketstuff/rest/utils/test/BufferedMockRequest.java
// public class BufferedMockRequest extends MockHttpServletRequest {
// BufferedReader reader;
//
// public BufferedMockRequest(Application application, HttpSession session, ServletContext context, String httpMethod) {
// super(application, session, context);
// setMethod(httpMethod);
// }
//
// @Override
// public BufferedReader getReader() throws IOException {
// if(reader != null)
// return reader;
//
// return super.getReader();
// }
//
// public void setReader(BufferedReader reader) {
// this.reader = reader;
// }
//
// public void setTextAsRequestBody(String requestBody) {
// this.reader = new BufferedReader(new StringReader(requestBody));
// }
// }
|
import org.apache.wicket.util.tester.WicketTester;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.wicketstuff.rest.domain.PersonPojo;
import org.wicketstuff.rest.utils.test.BufferedMockRequest;
import com.google.gson.Gson;
|
/**
* 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.wicketstuff.rest;
/**
* Simple test using the WicketTester
*/
public class TestPersonResource extends Assert
{
private WicketTester tester;
final private Gson gson = new Gson();
@Before
public void setUp()
{
tester = new WicketTester(new WicketApplication());
}
@Test
public void testCreatePerson()
{
BufferedMockRequest mockRequest =new BufferedMockRequest(tester.getApplication(), tester.getHttpSession(),
tester.getServletContext(), "POST");
|
// Path: restannotations-examples/src/main/java/org/wicketstuff/rest/domain/PersonPojo.java
// public class PersonPojo {
// private String name;
// private String email;
// private String password;
//
// public PersonPojo(String name, String email, String password) {
// this.name = name;
// this.email = email;
// this.password = password;
// }
// }
//
// Path: restannotations/src/main/java/org/wicketstuff/rest/utils/test/BufferedMockRequest.java
// public class BufferedMockRequest extends MockHttpServletRequest {
// BufferedReader reader;
//
// public BufferedMockRequest(Application application, HttpSession session, ServletContext context, String httpMethod) {
// super(application, session, context);
// setMethod(httpMethod);
// }
//
// @Override
// public BufferedReader getReader() throws IOException {
// if(reader != null)
// return reader;
//
// return super.getReader();
// }
//
// public void setReader(BufferedReader reader) {
// this.reader = reader;
// }
//
// public void setTextAsRequestBody(String requestBody) {
// this.reader = new BufferedReader(new StringReader(requestBody));
// }
// }
// Path: restannotations-examples/src/test/java/org/wicketstuff/rest/TestPersonResource.java
import org.apache.wicket.util.tester.WicketTester;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.wicketstuff.rest.domain.PersonPojo;
import org.wicketstuff.rest.utils.test.BufferedMockRequest;
import com.google.gson.Gson;
/**
* 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.wicketstuff.rest;
/**
* Simple test using the WicketTester
*/
public class TestPersonResource extends Assert
{
private WicketTester tester;
final private Gson gson = new Gson();
@Before
public void setUp()
{
tester = new WicketTester(new WicketApplication());
}
@Test
public void testCreatePerson()
{
BufferedMockRequest mockRequest =new BufferedMockRequest(tester.getApplication(), tester.getHttpSession(),
tester.getServletContext(), "POST");
|
String jsonObj = gson.toJson(new PersonPojo("James", "Smith", "changeit"));
|
bitstorm/Wicket-rest-annotations
|
restannotations/src/main/java/org/wicketstuff/rest/contenthandling/serialdeserial/TextualObjectSerialDeserial.java
|
// Path: restannotations/src/main/java/org/wicketstuff/rest/contenthandling/IObjectSerialDeserial.java
// public interface IObjectSerialDeserial {
// /**
// * Write the object in input to the response converting it to a given MIME type.
// *
// * @param targetObject
// * the object instance to serialize to string.
// * @param response
// * the response object.
// * @param mimeType
// * the MIME type of the response.
// * @throws Exception
// */
// public void objectToResponse(Object targetObject, WebResponse response, String mimeType) throws Exception;
//
// /**
// * Extract an instance of argClass form the request.
// *
// * @param request
// * the request object.
// * @param argClass
// * the type of the object we want to extract.
// * @param mimeType
// * the MIME type of the request.
// *
// * @return the object extracted from the request.
// */
// public <T> T requestToObject(WebRequest request, Class<T> argClass, String mimeType) throws Exception;
//
// /**
// * Check if a given MIME type is handled.
// *
// * @param mimeType
// * the MIME type we want to check.
// * @return true if the MIME type is supported, false otherwise.
// */
// public boolean isMimeTypeSupported(String mimeType);
// }
//
// Path: restannotations/src/main/java/org/wicketstuff/rest/contenthandling/RestMimeTypes.java
// public class RestMimeTypes {
// public static final String APPLICATION_RSS_XML = "application/rss+xml";
//
// public static final String TEXT_CSS = "text/css";
//
// public static final String TEXT_CSV = "text/csv";
//
// public static final String TEXT_PLAIN = "text/plain";
//
// public static final String TEXT_HTML = "text/html";
//
// public static final String APPLICATION_XML = "application/xml";
//
// public static final String TEXT_XML = "text/xml";
//
// public static final String APPLICATION_JSON = "application/json";
//
// public static final String IMAGE_GIF = "image/gif";
//
// public static final String IMAGE_JPEG = "image/jpeg";
//
// public static final String IMAGE_PNG = "image/png";
//
// public static final String OCTET_STREAM = "application/octet-stream";
// }
//
// Path: restannotations/src/main/java/org/wicketstuff/rest/utils/http/HttpUtils.java
// public class HttpUtils {
// /**
// * Read the string content of the current request.
// *
// * @param request
// * the current request
// * @return
// * the string inside body request.
// * @throws IOException
// */
// public static String readStringFromRequest(WebRequest request) throws IOException{
// HttpServletRequest httpRequest = (HttpServletRequest) request.getContainerRequest();
// BufferedReader bufReader = httpRequest.getReader();
// StringBuilder builder = new StringBuilder();
// String stringLine;
//
// while ((stringLine = bufReader.readLine()) != null)
// builder.append(stringLine);
//
// return builder.toString();
// }
//
// /**
// * Utility method to extract the HTTP request method.
// *
// * @param request
// * the current request object
// * @return the HTTP method used for this request
// * @see HttpMethod
// */
// public static HttpMethod getHttpMethod(WebRequest request) {
// HttpServletRequest httpRequest = (HttpServletRequest) request.getContainerRequest();
// return HttpMethod.toHttpMethod((httpRequest.getMethod()));
// }
// }
|
import javax.servlet.ServletResponse;
import org.apache.wicket.request.http.WebRequest;
import org.apache.wicket.request.http.WebResponse;
import org.wicketstuff.rest.contenthandling.IObjectSerialDeserial;
import org.wicketstuff.rest.contenthandling.RestMimeTypes;
import org.wicketstuff.rest.utils.http.HttpUtils;
|
/**
* 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.wicketstuff.rest.contenthandling.serialdeserial;
// TODO: Auto-generated Javadoc
/**
* Abstract object serializer/deserializer that works with textual formats.
*
* @author andrea del bene
*
*/
public abstract class TextualObjectSerialDeserial implements IObjectSerialDeserial {
/** the supported charset. */
private final String charset;
/** the supported MIME type. */
private final String mimeType;
/**
* Instantiates a new textual object serial deserial.
*
* @param charset the charset
* @param mimeType the mime type
*/
public TextualObjectSerialDeserial(String charset, String mimeType) {
this.charset = charset;
this.mimeType = mimeType;
}
/* (non-Javadoc)
* @see org.wicketstuff.rest.contenthandling.IObjectSerialDeserial#objectToResponse(java.lang.Object, org.apache.wicket.request.http.WebResponse, java.lang.String)
*/
@Override
public void objectToResponse(Object targetObject, WebResponse response, String mimeType)
throws Exception {
setCharsetResponse(response);
String strOutput;
|
// Path: restannotations/src/main/java/org/wicketstuff/rest/contenthandling/IObjectSerialDeserial.java
// public interface IObjectSerialDeserial {
// /**
// * Write the object in input to the response converting it to a given MIME type.
// *
// * @param targetObject
// * the object instance to serialize to string.
// * @param response
// * the response object.
// * @param mimeType
// * the MIME type of the response.
// * @throws Exception
// */
// public void objectToResponse(Object targetObject, WebResponse response, String mimeType) throws Exception;
//
// /**
// * Extract an instance of argClass form the request.
// *
// * @param request
// * the request object.
// * @param argClass
// * the type of the object we want to extract.
// * @param mimeType
// * the MIME type of the request.
// *
// * @return the object extracted from the request.
// */
// public <T> T requestToObject(WebRequest request, Class<T> argClass, String mimeType) throws Exception;
//
// /**
// * Check if a given MIME type is handled.
// *
// * @param mimeType
// * the MIME type we want to check.
// * @return true if the MIME type is supported, false otherwise.
// */
// public boolean isMimeTypeSupported(String mimeType);
// }
//
// Path: restannotations/src/main/java/org/wicketstuff/rest/contenthandling/RestMimeTypes.java
// public class RestMimeTypes {
// public static final String APPLICATION_RSS_XML = "application/rss+xml";
//
// public static final String TEXT_CSS = "text/css";
//
// public static final String TEXT_CSV = "text/csv";
//
// public static final String TEXT_PLAIN = "text/plain";
//
// public static final String TEXT_HTML = "text/html";
//
// public static final String APPLICATION_XML = "application/xml";
//
// public static final String TEXT_XML = "text/xml";
//
// public static final String APPLICATION_JSON = "application/json";
//
// public static final String IMAGE_GIF = "image/gif";
//
// public static final String IMAGE_JPEG = "image/jpeg";
//
// public static final String IMAGE_PNG = "image/png";
//
// public static final String OCTET_STREAM = "application/octet-stream";
// }
//
// Path: restannotations/src/main/java/org/wicketstuff/rest/utils/http/HttpUtils.java
// public class HttpUtils {
// /**
// * Read the string content of the current request.
// *
// * @param request
// * the current request
// * @return
// * the string inside body request.
// * @throws IOException
// */
// public static String readStringFromRequest(WebRequest request) throws IOException{
// HttpServletRequest httpRequest = (HttpServletRequest) request.getContainerRequest();
// BufferedReader bufReader = httpRequest.getReader();
// StringBuilder builder = new StringBuilder();
// String stringLine;
//
// while ((stringLine = bufReader.readLine()) != null)
// builder.append(stringLine);
//
// return builder.toString();
// }
//
// /**
// * Utility method to extract the HTTP request method.
// *
// * @param request
// * the current request object
// * @return the HTTP method used for this request
// * @see HttpMethod
// */
// public static HttpMethod getHttpMethod(WebRequest request) {
// HttpServletRequest httpRequest = (HttpServletRequest) request.getContainerRequest();
// return HttpMethod.toHttpMethod((httpRequest.getMethod()));
// }
// }
// Path: restannotations/src/main/java/org/wicketstuff/rest/contenthandling/serialdeserial/TextualObjectSerialDeserial.java
import javax.servlet.ServletResponse;
import org.apache.wicket.request.http.WebRequest;
import org.apache.wicket.request.http.WebResponse;
import org.wicketstuff.rest.contenthandling.IObjectSerialDeserial;
import org.wicketstuff.rest.contenthandling.RestMimeTypes;
import org.wicketstuff.rest.utils.http.HttpUtils;
/**
* 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.wicketstuff.rest.contenthandling.serialdeserial;
// TODO: Auto-generated Javadoc
/**
* Abstract object serializer/deserializer that works with textual formats.
*
* @author andrea del bene
*
*/
public abstract class TextualObjectSerialDeserial implements IObjectSerialDeserial {
/** the supported charset. */
private final String charset;
/** the supported MIME type. */
private final String mimeType;
/**
* Instantiates a new textual object serial deserial.
*
* @param charset the charset
* @param mimeType the mime type
*/
public TextualObjectSerialDeserial(String charset, String mimeType) {
this.charset = charset;
this.mimeType = mimeType;
}
/* (non-Javadoc)
* @see org.wicketstuff.rest.contenthandling.IObjectSerialDeserial#objectToResponse(java.lang.Object, org.apache.wicket.request.http.WebResponse, java.lang.String)
*/
@Override
public void objectToResponse(Object targetObject, WebResponse response, String mimeType)
throws Exception {
setCharsetResponse(response);
String strOutput;
|
if(RestMimeTypes.TEXT_PLAIN.equals(mimeType))
|
bitstorm/Wicket-rest-annotations
|
restannotations-examples/src/main/java/org/wicketstuff/rest/WicketApplication.java
|
// Path: restannotations-examples/src/main/java/org/wicketstuff/rest/resource/PersonsRestResource.java
// public class PersonsRestResource extends GsonRestResource {
// private final List<PersonPojo> persons = new ArrayList<PersonPojo>();
//
// public PersonsRestResource(){
// persons.add(new PersonPojo("Freddie Mercury", "fmercury@queen.com", "Eeehooo!"));
// persons.add(new PersonPojo("John Deacon", "jdeacon@queen.com", "bass"));
// persons.add(new PersonPojo("Brian May", "bmay@queen.com", "guitar"));
// persons.add(new PersonPojo("Roger Taylor", "rtaylor@queen.com", "drum"));
// }
//
// @MethodMapping("/persons")
// public List<PersonPojo> getAllPersons() {
// return persons;
// }
//
// @MethodMapping(value = "/persons/{personIndex}", httpMethod = HttpMethod.DELETE)
// public void deletePerson(int personIndex) {
// persons.remove(personIndex);
// }
//
// @MethodMapping(value = "/persons", httpMethod = HttpMethod.POST)
// public void createPerson(@RequestBody PersonPojo personPojo) {
// persons.add(personPojo);
// }
// }
|
import java.nio.charset.Charset;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.request.resource.IResource;
import org.apache.wicket.request.resource.ResourceReference;
import org.wicketstuff.rest.resource.PersonsRestResource;
|
/**
* 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.wicketstuff.rest;
/**
* Application object for your web application. If you want to run this
* application without deploying, run the Start class.
*
* @see org.wicketstuff.rest.Start#main(String[])
*/
public class WicketApplication extends WebApplication{
/**
* @see org.apache.wicket.Application#getHomePage()
*/
@Override
public Class<? extends WebPage> getHomePage() {
return Index.class;
}
@Override
public void init() {
super.init();
mountResource("/personsmanager", new ResourceReference("restReference") {
|
// Path: restannotations-examples/src/main/java/org/wicketstuff/rest/resource/PersonsRestResource.java
// public class PersonsRestResource extends GsonRestResource {
// private final List<PersonPojo> persons = new ArrayList<PersonPojo>();
//
// public PersonsRestResource(){
// persons.add(new PersonPojo("Freddie Mercury", "fmercury@queen.com", "Eeehooo!"));
// persons.add(new PersonPojo("John Deacon", "jdeacon@queen.com", "bass"));
// persons.add(new PersonPojo("Brian May", "bmay@queen.com", "guitar"));
// persons.add(new PersonPojo("Roger Taylor", "rtaylor@queen.com", "drum"));
// }
//
// @MethodMapping("/persons")
// public List<PersonPojo> getAllPersons() {
// return persons;
// }
//
// @MethodMapping(value = "/persons/{personIndex}", httpMethod = HttpMethod.DELETE)
// public void deletePerson(int personIndex) {
// persons.remove(personIndex);
// }
//
// @MethodMapping(value = "/persons", httpMethod = HttpMethod.POST)
// public void createPerson(@RequestBody PersonPojo personPojo) {
// persons.add(personPojo);
// }
// }
// Path: restannotations-examples/src/main/java/org/wicketstuff/rest/WicketApplication.java
import java.nio.charset.Charset;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.request.resource.IResource;
import org.apache.wicket.request.resource.ResourceReference;
import org.wicketstuff.rest.resource.PersonsRestResource;
/**
* 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.wicketstuff.rest;
/**
* Application object for your web application. If you want to run this
* application without deploying, run the Start class.
*
* @see org.wicketstuff.rest.Start#main(String[])
*/
public class WicketApplication extends WebApplication{
/**
* @see org.apache.wicket.Application#getHomePage()
*/
@Override
public Class<? extends WebPage> getHomePage() {
return Index.class;
}
@Override
public void init() {
super.init();
mountResource("/personsmanager", new ResourceReference("restReference") {
|
PersonsRestResource resource = new PersonsRestResource();
|
Derek-Ashmore/moneta
|
moneta-contract-tests/src/test/java/org/moneta/ContractTestSuite.java
|
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
// public class SearchResult extends BaseType {
//
// private Integer errorCode;
// private String errorMessage;
//
// @JsonProperty("records")
// private Record[] resultData;
//
// public Integer getErrorCode() {
// return errorCode;
// }
//
// public void setErrorCode(Integer errorCode) {
// this.errorCode = errorCode;
// }
//
// public String getErrorMessage() {
// return errorMessage;
// }
//
// public void setErrorMessage(String errorMessage) {
// this.errorMessage = errorMessage;
// }
//
// public Record[] getResultData() {
// return resultData;
// }
//
// public void setResultData(Record[] resultData) {
// this.resultData = resultData;
// }
//
// }
//
// Path: moneta-contract-tests/src/test/java/org/moneta/utils/RestTestingUtils.java
// public class RestTestingUtils {
//
// public static HttpResponse simpleRESTGet(String requestUri) {
// Validate.notEmpty(requestUri, "Null or blank requestUri not allowed.");
// CloseableHttpClient httpclient = HttpClients.createDefault();
// HttpGet httpGet = new HttpGet(requestUri);
// try {
// return httpclient.execute(httpGet);
// } catch (Exception e) {
// throw new ContextedRuntimeException(e)
// .addContextValue("requestUri", requestUri);
// }
// }
//
// // public static HttpResponse simpleRESTPost(String requestUri, String postData) {
// // Validate.notEmpty(requestUri, "Null or blank requestUri not allowed.");
// // CloseableHttpClient httpclient = HttpClients.createDefault();
// // HttpPost httpPost = new HttpPost(requestUri);
// // httpPost.set
// // try {
// // return httpclient.execute(httpPost);
// // } catch (Exception e) {
// // throw new ContextedRuntimeException(e)
// // .addContextValue("requestUri", requestUri);
// // }
// // }
//
// }
|
import net.admin4j.deps.commons.lang3.Validate;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse;
import org.junit.Assert;
import org.junit.Test;
import org.moneta.types.search.SearchResult;
import org.moneta.utils.RestTestingUtils;
import com.fasterxml.jackson.databind.ObjectMapper;
|
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta;
public abstract class ContractTestSuite {
private String appUrlPrefix;
private String serviceUrlPrefix;
private String healthCheckEndpoint;
private String metricsEndpoint;
|
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
// public class SearchResult extends BaseType {
//
// private Integer errorCode;
// private String errorMessage;
//
// @JsonProperty("records")
// private Record[] resultData;
//
// public Integer getErrorCode() {
// return errorCode;
// }
//
// public void setErrorCode(Integer errorCode) {
// this.errorCode = errorCode;
// }
//
// public String getErrorMessage() {
// return errorMessage;
// }
//
// public void setErrorMessage(String errorMessage) {
// this.errorMessage = errorMessage;
// }
//
// public Record[] getResultData() {
// return resultData;
// }
//
// public void setResultData(Record[] resultData) {
// this.resultData = resultData;
// }
//
// }
//
// Path: moneta-contract-tests/src/test/java/org/moneta/utils/RestTestingUtils.java
// public class RestTestingUtils {
//
// public static HttpResponse simpleRESTGet(String requestUri) {
// Validate.notEmpty(requestUri, "Null or blank requestUri not allowed.");
// CloseableHttpClient httpclient = HttpClients.createDefault();
// HttpGet httpGet = new HttpGet(requestUri);
// try {
// return httpclient.execute(httpGet);
// } catch (Exception e) {
// throw new ContextedRuntimeException(e)
// .addContextValue("requestUri", requestUri);
// }
// }
//
// // public static HttpResponse simpleRESTPost(String requestUri, String postData) {
// // Validate.notEmpty(requestUri, "Null or blank requestUri not allowed.");
// // CloseableHttpClient httpclient = HttpClients.createDefault();
// // HttpPost httpPost = new HttpPost(requestUri);
// // httpPost.set
// // try {
// // return httpclient.execute(httpPost);
// // } catch (Exception e) {
// // throw new ContextedRuntimeException(e)
// // .addContextValue("requestUri", requestUri);
// // }
// // }
//
// }
// Path: moneta-contract-tests/src/test/java/org/moneta/ContractTestSuite.java
import net.admin4j.deps.commons.lang3.Validate;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse;
import org.junit.Assert;
import org.junit.Test;
import org.moneta.types.search.SearchResult;
import org.moneta.utils.RestTestingUtils;
import com.fasterxml.jackson.databind.ObjectMapper;
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta;
public abstract class ContractTestSuite {
private String appUrlPrefix;
private String serviceUrlPrefix;
private String healthCheckEndpoint;
private String metricsEndpoint;
|
private SearchResult result;
|
Derek-Ashmore/moneta
|
moneta-contract-tests/src/test/java/org/moneta/ContractTestSuite.java
|
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
// public class SearchResult extends BaseType {
//
// private Integer errorCode;
// private String errorMessage;
//
// @JsonProperty("records")
// private Record[] resultData;
//
// public Integer getErrorCode() {
// return errorCode;
// }
//
// public void setErrorCode(Integer errorCode) {
// this.errorCode = errorCode;
// }
//
// public String getErrorMessage() {
// return errorMessage;
// }
//
// public void setErrorMessage(String errorMessage) {
// this.errorMessage = errorMessage;
// }
//
// public Record[] getResultData() {
// return resultData;
// }
//
// public void setResultData(Record[] resultData) {
// this.resultData = resultData;
// }
//
// }
//
// Path: moneta-contract-tests/src/test/java/org/moneta/utils/RestTestingUtils.java
// public class RestTestingUtils {
//
// public static HttpResponse simpleRESTGet(String requestUri) {
// Validate.notEmpty(requestUri, "Null or blank requestUri not allowed.");
// CloseableHttpClient httpclient = HttpClients.createDefault();
// HttpGet httpGet = new HttpGet(requestUri);
// try {
// return httpclient.execute(httpGet);
// } catch (Exception e) {
// throw new ContextedRuntimeException(e)
// .addContextValue("requestUri", requestUri);
// }
// }
//
// // public static HttpResponse simpleRESTPost(String requestUri, String postData) {
// // Validate.notEmpty(requestUri, "Null or blank requestUri not allowed.");
// // CloseableHttpClient httpclient = HttpClients.createDefault();
// // HttpPost httpPost = new HttpPost(requestUri);
// // httpPost.set
// // try {
// // return httpclient.execute(httpPost);
// // } catch (Exception e) {
// // throw new ContextedRuntimeException(e)
// // .addContextValue("requestUri", requestUri);
// // }
// // }
//
// }
|
import net.admin4j.deps.commons.lang3.Validate;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse;
import org.junit.Assert;
import org.junit.Test;
import org.moneta.types.search.SearchResult;
import org.moneta.utils.RestTestingUtils;
import com.fasterxml.jackson.databind.ObjectMapper;
|
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta;
public abstract class ContractTestSuite {
private String appUrlPrefix;
private String serviceUrlPrefix;
private String healthCheckEndpoint;
private String metricsEndpoint;
private SearchResult result;
private String jsonContent;
public ContractTestSuite(String appUrlPrefix, String servicePrefix, String healthCheckEndpoint, String metricsEndpoint) {
this.setAppUrlPrefix(appUrlPrefix);
this.setServiceUrlPrefix(servicePrefix);
this.setHealthCheckEndpoint(healthCheckEndpoint);
this.setMetricsEndpoint(metricsEndpoint);
}
public static String getProjectVersion() {
String projectVersion = System.getProperty("projectVersion");
Validate.notEmpty(projectVersion, "Environment property projectVersion not set");
return projectVersion;
}
public String getAppUrlPrefix() {
return appUrlPrefix;
}
public void setAppUrlPrefix(String urlPrefix) {
this.appUrlPrefix = urlPrefix;
}
@Test
public void testTopicsBasic() throws Exception {
|
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
// public class SearchResult extends BaseType {
//
// private Integer errorCode;
// private String errorMessage;
//
// @JsonProperty("records")
// private Record[] resultData;
//
// public Integer getErrorCode() {
// return errorCode;
// }
//
// public void setErrorCode(Integer errorCode) {
// this.errorCode = errorCode;
// }
//
// public String getErrorMessage() {
// return errorMessage;
// }
//
// public void setErrorMessage(String errorMessage) {
// this.errorMessage = errorMessage;
// }
//
// public Record[] getResultData() {
// return resultData;
// }
//
// public void setResultData(Record[] resultData) {
// this.resultData = resultData;
// }
//
// }
//
// Path: moneta-contract-tests/src/test/java/org/moneta/utils/RestTestingUtils.java
// public class RestTestingUtils {
//
// public static HttpResponse simpleRESTGet(String requestUri) {
// Validate.notEmpty(requestUri, "Null or blank requestUri not allowed.");
// CloseableHttpClient httpclient = HttpClients.createDefault();
// HttpGet httpGet = new HttpGet(requestUri);
// try {
// return httpclient.execute(httpGet);
// } catch (Exception e) {
// throw new ContextedRuntimeException(e)
// .addContextValue("requestUri", requestUri);
// }
// }
//
// // public static HttpResponse simpleRESTPost(String requestUri, String postData) {
// // Validate.notEmpty(requestUri, "Null or blank requestUri not allowed.");
// // CloseableHttpClient httpclient = HttpClients.createDefault();
// // HttpPost httpPost = new HttpPost(requestUri);
// // httpPost.set
// // try {
// // return httpclient.execute(httpPost);
// // } catch (Exception e) {
// // throw new ContextedRuntimeException(e)
// // .addContextValue("requestUri", requestUri);
// // }
// // }
//
// }
// Path: moneta-contract-tests/src/test/java/org/moneta/ContractTestSuite.java
import net.admin4j.deps.commons.lang3.Validate;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse;
import org.junit.Assert;
import org.junit.Test;
import org.moneta.types.search.SearchResult;
import org.moneta.utils.RestTestingUtils;
import com.fasterxml.jackson.databind.ObjectMapper;
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta;
public abstract class ContractTestSuite {
private String appUrlPrefix;
private String serviceUrlPrefix;
private String healthCheckEndpoint;
private String metricsEndpoint;
private SearchResult result;
private String jsonContent;
public ContractTestSuite(String appUrlPrefix, String servicePrefix, String healthCheckEndpoint, String metricsEndpoint) {
this.setAppUrlPrefix(appUrlPrefix);
this.setServiceUrlPrefix(servicePrefix);
this.setHealthCheckEndpoint(healthCheckEndpoint);
this.setMetricsEndpoint(metricsEndpoint);
}
public static String getProjectVersion() {
String projectVersion = System.getProperty("projectVersion");
Validate.notEmpty(projectVersion, "Environment property projectVersion not set");
return projectVersion;
}
public String getAppUrlPrefix() {
return appUrlPrefix;
}
public void setAppUrlPrefix(String urlPrefix) {
this.appUrlPrefix = urlPrefix;
}
@Test
public void testTopicsBasic() throws Exception {
|
HttpResponse response = RestTestingUtils.simpleRESTGet(this.appUrlPrefix+"topics");
|
Derek-Ashmore/moneta
|
moneta-core/src/main/java/org/moneta/config/ConnectionPoolFactory.java
|
// Path: moneta-core/src/main/java/org/moneta/error/MonetaException.java
// public class MonetaException extends ContextedRuntimeException {
//
// private static final long serialVersionUID = -682655095144383360L;
//
// public MonetaException(String message) {
// super(message);
// }
//
// // public MonetaException(Throwable cause) {
// // super(cause);
// // }
//
// public MonetaException(String message, Throwable cause) {
// super(message, cause);
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/topic/MonetaDataSource.java
// public class MonetaDataSource extends BaseType {
//
// private String dataSourceName;
// private Class<? extends Driver> driver;
// private String connectionUrl;
// private Dialect dialect = Dialect.ANSI;
//
// private Map<String,String> jdbcConnectionProperties = new HashMap<String,String>();
// private Map<String,String> connectionPoolProperties = new HashMap<String,String>();
//
// public String getDataSourceName() {
// return dataSourceName;
// }
//
// public void setDataSourceName(String dataSourceName) {
// this.dataSourceName = dataSourceName;
// }
//
// public Class<? extends Driver> getDriver() {
// return driver;
// }
//
// public void setDriver(Class<? extends Driver> driver) {
// this.driver = driver;
// }
//
// public String getConnectionUrl() {
// return connectionUrl;
// }
//
// public void setConnectionUrl(String connectionUrl) {
// this.connectionUrl = connectionUrl;
// }
//
// public Map<String, String> getJdbcConnectionProperties() {
// return jdbcConnectionProperties;
// }
//
// public Map<String, String> getConnectionPoolProperties() {
// return connectionPoolProperties;
// }
//
// public Dialect getDialect() {
// return dialect;
// }
//
// public void setDialect(Dialect dialect) {
// this.dialect = dialect;
// }
//
//
// }
|
import org.apache.commons.pool2.impl.GenericObjectPool;
import org.moneta.error.MonetaException;
import org.moneta.types.topic.MonetaDataSource;
import java.beans.PropertyDescriptor;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.dbcp2.ConnectionFactory;
import org.apache.commons.dbcp2.DriverManagerConnectionFactory;
import org.apache.commons.dbcp2.PoolableConnection;
import org.apache.commons.dbcp2.PoolableConnectionFactory;
import org.apache.commons.lang.Validate;
import org.apache.commons.pool2.ObjectPool;
|
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.config;
/**
* Is able to convert a JDBC connect pool specification into a connection pool
* @author D. Ashmore
*
*/
class ConnectionPoolFactory {
public static ObjectPool<PoolableConnection> createConnectionPool(MonetaDataSource dataSourceType) {
Validate.notNull(dataSourceType, "Null MonetaDataSource not allowed.");
Validate.notEmpty(dataSourceType.getDataSourceName(), "Null or blank name not allowed");
Validate.notEmpty(dataSourceType.getConnectionUrl(), "Null or blank url not allowed");
Validate.notNull(dataSourceType.getDriver(), "Null driver not allowed");
try {
dataSourceType.getDriver().newInstance();
} catch (Exception e) {
|
// Path: moneta-core/src/main/java/org/moneta/error/MonetaException.java
// public class MonetaException extends ContextedRuntimeException {
//
// private static final long serialVersionUID = -682655095144383360L;
//
// public MonetaException(String message) {
// super(message);
// }
//
// // public MonetaException(Throwable cause) {
// // super(cause);
// // }
//
// public MonetaException(String message, Throwable cause) {
// super(message, cause);
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/topic/MonetaDataSource.java
// public class MonetaDataSource extends BaseType {
//
// private String dataSourceName;
// private Class<? extends Driver> driver;
// private String connectionUrl;
// private Dialect dialect = Dialect.ANSI;
//
// private Map<String,String> jdbcConnectionProperties = new HashMap<String,String>();
// private Map<String,String> connectionPoolProperties = new HashMap<String,String>();
//
// public String getDataSourceName() {
// return dataSourceName;
// }
//
// public void setDataSourceName(String dataSourceName) {
// this.dataSourceName = dataSourceName;
// }
//
// public Class<? extends Driver> getDriver() {
// return driver;
// }
//
// public void setDriver(Class<? extends Driver> driver) {
// this.driver = driver;
// }
//
// public String getConnectionUrl() {
// return connectionUrl;
// }
//
// public void setConnectionUrl(String connectionUrl) {
// this.connectionUrl = connectionUrl;
// }
//
// public Map<String, String> getJdbcConnectionProperties() {
// return jdbcConnectionProperties;
// }
//
// public Map<String, String> getConnectionPoolProperties() {
// return connectionPoolProperties;
// }
//
// public Dialect getDialect() {
// return dialect;
// }
//
// public void setDialect(Dialect dialect) {
// this.dialect = dialect;
// }
//
//
// }
// Path: moneta-core/src/main/java/org/moneta/config/ConnectionPoolFactory.java
import org.apache.commons.pool2.impl.GenericObjectPool;
import org.moneta.error.MonetaException;
import org.moneta.types.topic.MonetaDataSource;
import java.beans.PropertyDescriptor;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.dbcp2.ConnectionFactory;
import org.apache.commons.dbcp2.DriverManagerConnectionFactory;
import org.apache.commons.dbcp2.PoolableConnection;
import org.apache.commons.dbcp2.PoolableConnectionFactory;
import org.apache.commons.lang.Validate;
import org.apache.commons.pool2.ObjectPool;
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.config;
/**
* Is able to convert a JDBC connect pool specification into a connection pool
* @author D. Ashmore
*
*/
class ConnectionPoolFactory {
public static ObjectPool<PoolableConnection> createConnectionPool(MonetaDataSource dataSourceType) {
Validate.notNull(dataSourceType, "Null MonetaDataSource not allowed.");
Validate.notEmpty(dataSourceType.getDataSourceName(), "Null or blank name not allowed");
Validate.notEmpty(dataSourceType.getConnectionUrl(), "Null or blank url not allowed");
Validate.notNull(dataSourceType.getDriver(), "Null driver not allowed");
try {
dataSourceType.getDriver().newInstance();
} catch (Exception e) {
|
throw new MonetaException("Data source JDBC driver can't be instantiated", e)
|
Derek-Ashmore/moneta
|
moneta-core/src/test/java/org/moneta/dao/MonetaSearchDAOTest.java
|
// Path: moneta-core/src/test/java/org/moneta/MonetaTestBase.java
// public class MonetaTestBase extends HSqlTestBase {
//
// @Before
// public void setUp() throws Exception {
// super.setUp();
// MonetaEnvironment.setConfiguration(
// new MonetaConfiguration(
// new FileInputStream(MonetaConfigurationTest.CONFIG_TEST_FILE_NAME)));
// }
//
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchRequest.java
// public class SearchRequest extends BaseType {
//
// private String topic;
// private String[] fieldNames;
// private CompositeCriteria searchCriteria;
// private Long maxRows;
// private Long startRow;
//
// public String[] getFieldNames() {
// return fieldNames;
// }
//
// public void setFieldNames(String[] fieldNames) {
// this.fieldNames = fieldNames;
// }
//
// public CompositeCriteria getSearchCriteria() {
// return searchCriteria;
// }
//
// public void setSearchCriteria(CompositeCriteria searchCriteria) {
// this.searchCriteria = searchCriteria;
// }
//
// public Long getMaxRows() {
// return maxRows;
// }
//
// public void setMaxRows(Long maxRows) {
// this.maxRows = maxRows;
// }
//
// public String getTopic() {
// return topic;
// }
//
// public void setTopic(String topic) {
// this.topic = topic;
// }
//
// public Long getStartRow() {
// return startRow;
// }
//
// public void setStartRow(Long startRow) {
// this.startRow = startRow;
// }
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
// public class SearchResult extends BaseType {
//
// private Integer errorCode;
// private String errorMessage;
//
// @JsonProperty("records")
// private Record[] resultData;
//
// public Integer getErrorCode() {
// return errorCode;
// }
//
// public void setErrorCode(Integer errorCode) {
// this.errorCode = errorCode;
// }
//
// public String getErrorMessage() {
// return errorMessage;
// }
//
// public void setErrorMessage(String errorMessage) {
// this.errorMessage = errorMessage;
// }
//
// public Record[] getResultData() {
// return resultData;
// }
//
// public void setResultData(Record[] resultData) {
// this.resultData = resultData;
// }
//
// }
|
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.moneta.MonetaTestBase;
import org.moneta.types.search.SearchRequest;
import org.moneta.types.search.SearchResult;
|
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.dao;
public class MonetaSearchDAOTest extends MonetaTestBase {
MonetaSearchDAO dao;
|
// Path: moneta-core/src/test/java/org/moneta/MonetaTestBase.java
// public class MonetaTestBase extends HSqlTestBase {
//
// @Before
// public void setUp() throws Exception {
// super.setUp();
// MonetaEnvironment.setConfiguration(
// new MonetaConfiguration(
// new FileInputStream(MonetaConfigurationTest.CONFIG_TEST_FILE_NAME)));
// }
//
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchRequest.java
// public class SearchRequest extends BaseType {
//
// private String topic;
// private String[] fieldNames;
// private CompositeCriteria searchCriteria;
// private Long maxRows;
// private Long startRow;
//
// public String[] getFieldNames() {
// return fieldNames;
// }
//
// public void setFieldNames(String[] fieldNames) {
// this.fieldNames = fieldNames;
// }
//
// public CompositeCriteria getSearchCriteria() {
// return searchCriteria;
// }
//
// public void setSearchCriteria(CompositeCriteria searchCriteria) {
// this.searchCriteria = searchCriteria;
// }
//
// public Long getMaxRows() {
// return maxRows;
// }
//
// public void setMaxRows(Long maxRows) {
// this.maxRows = maxRows;
// }
//
// public String getTopic() {
// return topic;
// }
//
// public void setTopic(String topic) {
// this.topic = topic;
// }
//
// public Long getStartRow() {
// return startRow;
// }
//
// public void setStartRow(Long startRow) {
// this.startRow = startRow;
// }
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
// public class SearchResult extends BaseType {
//
// private Integer errorCode;
// private String errorMessage;
//
// @JsonProperty("records")
// private Record[] resultData;
//
// public Integer getErrorCode() {
// return errorCode;
// }
//
// public void setErrorCode(Integer errorCode) {
// this.errorCode = errorCode;
// }
//
// public String getErrorMessage() {
// return errorMessage;
// }
//
// public void setErrorMessage(String errorMessage) {
// this.errorMessage = errorMessage;
// }
//
// public Record[] getResultData() {
// return resultData;
// }
//
// public void setResultData(Record[] resultData) {
// this.resultData = resultData;
// }
//
// }
// Path: moneta-core/src/test/java/org/moneta/dao/MonetaSearchDAOTest.java
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.moneta.MonetaTestBase;
import org.moneta.types.search.SearchRequest;
import org.moneta.types.search.SearchResult;
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.dao;
public class MonetaSearchDAOTest extends MonetaTestBase {
MonetaSearchDAO dao;
|
SearchRequest searchRequest;
|
Derek-Ashmore/moneta
|
moneta-core/src/test/java/org/moneta/dao/MonetaSearchDAOTest.java
|
// Path: moneta-core/src/test/java/org/moneta/MonetaTestBase.java
// public class MonetaTestBase extends HSqlTestBase {
//
// @Before
// public void setUp() throws Exception {
// super.setUp();
// MonetaEnvironment.setConfiguration(
// new MonetaConfiguration(
// new FileInputStream(MonetaConfigurationTest.CONFIG_TEST_FILE_NAME)));
// }
//
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchRequest.java
// public class SearchRequest extends BaseType {
//
// private String topic;
// private String[] fieldNames;
// private CompositeCriteria searchCriteria;
// private Long maxRows;
// private Long startRow;
//
// public String[] getFieldNames() {
// return fieldNames;
// }
//
// public void setFieldNames(String[] fieldNames) {
// this.fieldNames = fieldNames;
// }
//
// public CompositeCriteria getSearchCriteria() {
// return searchCriteria;
// }
//
// public void setSearchCriteria(CompositeCriteria searchCriteria) {
// this.searchCriteria = searchCriteria;
// }
//
// public Long getMaxRows() {
// return maxRows;
// }
//
// public void setMaxRows(Long maxRows) {
// this.maxRows = maxRows;
// }
//
// public String getTopic() {
// return topic;
// }
//
// public void setTopic(String topic) {
// this.topic = topic;
// }
//
// public Long getStartRow() {
// return startRow;
// }
//
// public void setStartRow(Long startRow) {
// this.startRow = startRow;
// }
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
// public class SearchResult extends BaseType {
//
// private Integer errorCode;
// private String errorMessage;
//
// @JsonProperty("records")
// private Record[] resultData;
//
// public Integer getErrorCode() {
// return errorCode;
// }
//
// public void setErrorCode(Integer errorCode) {
// this.errorCode = errorCode;
// }
//
// public String getErrorMessage() {
// return errorMessage;
// }
//
// public void setErrorMessage(String errorMessage) {
// this.errorMessage = errorMessage;
// }
//
// public Record[] getResultData() {
// return resultData;
// }
//
// public void setResultData(Record[] resultData) {
// this.resultData = resultData;
// }
//
// }
|
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.moneta.MonetaTestBase;
import org.moneta.types.search.SearchRequest;
import org.moneta.types.search.SearchResult;
|
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.dao;
public class MonetaSearchDAOTest extends MonetaTestBase {
MonetaSearchDAO dao;
SearchRequest searchRequest;
@Before
public void setUp() throws Exception {
super.setUp();
dao = new MonetaSearchDAO();
searchRequest = new SearchRequest();
searchRequest.setTopic("Environment");
}
@Test
public void testBasic() throws Exception {
|
// Path: moneta-core/src/test/java/org/moneta/MonetaTestBase.java
// public class MonetaTestBase extends HSqlTestBase {
//
// @Before
// public void setUp() throws Exception {
// super.setUp();
// MonetaEnvironment.setConfiguration(
// new MonetaConfiguration(
// new FileInputStream(MonetaConfigurationTest.CONFIG_TEST_FILE_NAME)));
// }
//
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchRequest.java
// public class SearchRequest extends BaseType {
//
// private String topic;
// private String[] fieldNames;
// private CompositeCriteria searchCriteria;
// private Long maxRows;
// private Long startRow;
//
// public String[] getFieldNames() {
// return fieldNames;
// }
//
// public void setFieldNames(String[] fieldNames) {
// this.fieldNames = fieldNames;
// }
//
// public CompositeCriteria getSearchCriteria() {
// return searchCriteria;
// }
//
// public void setSearchCriteria(CompositeCriteria searchCriteria) {
// this.searchCriteria = searchCriteria;
// }
//
// public Long getMaxRows() {
// return maxRows;
// }
//
// public void setMaxRows(Long maxRows) {
// this.maxRows = maxRows;
// }
//
// public String getTopic() {
// return topic;
// }
//
// public void setTopic(String topic) {
// this.topic = topic;
// }
//
// public Long getStartRow() {
// return startRow;
// }
//
// public void setStartRow(Long startRow) {
// this.startRow = startRow;
// }
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
// public class SearchResult extends BaseType {
//
// private Integer errorCode;
// private String errorMessage;
//
// @JsonProperty("records")
// private Record[] resultData;
//
// public Integer getErrorCode() {
// return errorCode;
// }
//
// public void setErrorCode(Integer errorCode) {
// this.errorCode = errorCode;
// }
//
// public String getErrorMessage() {
// return errorMessage;
// }
//
// public void setErrorMessage(String errorMessage) {
// this.errorMessage = errorMessage;
// }
//
// public Record[] getResultData() {
// return resultData;
// }
//
// public void setResultData(Record[] resultData) {
// this.resultData = resultData;
// }
//
// }
// Path: moneta-core/src/test/java/org/moneta/dao/MonetaSearchDAOTest.java
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.moneta.MonetaTestBase;
import org.moneta.types.search.SearchRequest;
import org.moneta.types.search.SearchResult;
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.dao;
public class MonetaSearchDAOTest extends MonetaTestBase {
MonetaSearchDAO dao;
SearchRequest searchRequest;
@Before
public void setUp() throws Exception {
super.setUp();
dao = new MonetaSearchDAO();
searchRequest = new SearchRequest();
searchRequest.setTopic("Environment");
}
@Test
public void testBasic() throws Exception {
|
SearchResult result = dao.find(searchRequest);
|
Derek-Ashmore/moneta
|
moneta-core/src/main/java/org/moneta/MonetaTopicListServlet.java
|
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
// public class SearchResult extends BaseType {
//
// private Integer errorCode;
// private String errorMessage;
//
// @JsonProperty("records")
// private Record[] resultData;
//
// public Integer getErrorCode() {
// return errorCode;
// }
//
// public void setErrorCode(Integer errorCode) {
// this.errorCode = errorCode;
// }
//
// public String getErrorMessage() {
// return errorMessage;
// }
//
// public void setErrorMessage(String errorMessage) {
// this.errorMessage = errorMessage;
// }
//
// public Record[] getResultData() {
// return resultData;
// }
//
// public void setResultData(Record[] resultData) {
// this.resultData = resultData;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/utils/ServletUtils.java
// public class ServletUtils {
//
// public static void writeResult(SearchResult result, OutputStream out) {
// try {
// IOUtils.write(JsonUtils.serialize(result), out);
// out.flush();
// } catch (Exception e) {
// throw new MonetaException("Error writing result output.", e)
// .addContextValue("result", result);
// }
// }
//
// public static void writeError(Integer errorCode, Exception error, OutputStream out) {
// SearchResult result = new SearchResult();
// result.setErrorCode(errorCode);
// result.setErrorMessage(ExceptionUtils.getStackTrace(error));
// writeResult(result, out);
// }
//
// }
|
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.IOUtils;
import org.moneta.types.search.SearchResult;
import org.moneta.utils.ServletUtils;
|
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta;
/**
* List information about configured topics for Moneta
* @author D. Ashmore
*
*/
public class MonetaTopicListServlet extends HttpServlet {
private static final long serialVersionUID = 4405159464697763008L;
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Implement security check
|
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
// public class SearchResult extends BaseType {
//
// private Integer errorCode;
// private String errorMessage;
//
// @JsonProperty("records")
// private Record[] resultData;
//
// public Integer getErrorCode() {
// return errorCode;
// }
//
// public void setErrorCode(Integer errorCode) {
// this.errorCode = errorCode;
// }
//
// public String getErrorMessage() {
// return errorMessage;
// }
//
// public void setErrorMessage(String errorMessage) {
// this.errorMessage = errorMessage;
// }
//
// public Record[] getResultData() {
// return resultData;
// }
//
// public void setResultData(Record[] resultData) {
// this.resultData = resultData;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/utils/ServletUtils.java
// public class ServletUtils {
//
// public static void writeResult(SearchResult result, OutputStream out) {
// try {
// IOUtils.write(JsonUtils.serialize(result), out);
// out.flush();
// } catch (Exception e) {
// throw new MonetaException("Error writing result output.", e)
// .addContextValue("result", result);
// }
// }
//
// public static void writeError(Integer errorCode, Exception error, OutputStream out) {
// SearchResult result = new SearchResult();
// result.setErrorCode(errorCode);
// result.setErrorMessage(ExceptionUtils.getStackTrace(error));
// writeResult(result, out);
// }
//
// }
// Path: moneta-core/src/main/java/org/moneta/MonetaTopicListServlet.java
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.IOUtils;
import org.moneta.types.search.SearchResult;
import org.moneta.utils.ServletUtils;
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta;
/**
* List information about configured topics for Moneta
* @author D. Ashmore
*
*/
public class MonetaTopicListServlet extends HttpServlet {
private static final long serialVersionUID = 4405159464697763008L;
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Implement security check
|
SearchResult searchResult = null;
|
Derek-Ashmore/moneta
|
moneta-core/src/main/java/org/moneta/MonetaTopicListServlet.java
|
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
// public class SearchResult extends BaseType {
//
// private Integer errorCode;
// private String errorMessage;
//
// @JsonProperty("records")
// private Record[] resultData;
//
// public Integer getErrorCode() {
// return errorCode;
// }
//
// public void setErrorCode(Integer errorCode) {
// this.errorCode = errorCode;
// }
//
// public String getErrorMessage() {
// return errorMessage;
// }
//
// public void setErrorMessage(String errorMessage) {
// this.errorMessage = errorMessage;
// }
//
// public Record[] getResultData() {
// return resultData;
// }
//
// public void setResultData(Record[] resultData) {
// this.resultData = resultData;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/utils/ServletUtils.java
// public class ServletUtils {
//
// public static void writeResult(SearchResult result, OutputStream out) {
// try {
// IOUtils.write(JsonUtils.serialize(result), out);
// out.flush();
// } catch (Exception e) {
// throw new MonetaException("Error writing result output.", e)
// .addContextValue("result", result);
// }
// }
//
// public static void writeError(Integer errorCode, Exception error, OutputStream out) {
// SearchResult result = new SearchResult();
// result.setErrorCode(errorCode);
// result.setErrorMessage(ExceptionUtils.getStackTrace(error));
// writeResult(result, out);
// }
//
// }
|
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.IOUtils;
import org.moneta.types.search.SearchResult;
import org.moneta.utils.ServletUtils;
|
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta;
/**
* List information about configured topics for Moneta
* @author D. Ashmore
*
*/
public class MonetaTopicListServlet extends HttpServlet {
private static final long serialVersionUID = 4405159464697763008L;
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Implement security check
SearchResult searchResult = null;
response.setContentType("text/json");
try{
searchResult = new Moneta().findAllTopics();
|
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
// public class SearchResult extends BaseType {
//
// private Integer errorCode;
// private String errorMessage;
//
// @JsonProperty("records")
// private Record[] resultData;
//
// public Integer getErrorCode() {
// return errorCode;
// }
//
// public void setErrorCode(Integer errorCode) {
// this.errorCode = errorCode;
// }
//
// public String getErrorMessage() {
// return errorMessage;
// }
//
// public void setErrorMessage(String errorMessage) {
// this.errorMessage = errorMessage;
// }
//
// public Record[] getResultData() {
// return resultData;
// }
//
// public void setResultData(Record[] resultData) {
// this.resultData = resultData;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/utils/ServletUtils.java
// public class ServletUtils {
//
// public static void writeResult(SearchResult result, OutputStream out) {
// try {
// IOUtils.write(JsonUtils.serialize(result), out);
// out.flush();
// } catch (Exception e) {
// throw new MonetaException("Error writing result output.", e)
// .addContextValue("result", result);
// }
// }
//
// public static void writeError(Integer errorCode, Exception error, OutputStream out) {
// SearchResult result = new SearchResult();
// result.setErrorCode(errorCode);
// result.setErrorMessage(ExceptionUtils.getStackTrace(error));
// writeResult(result, out);
// }
//
// }
// Path: moneta-core/src/main/java/org/moneta/MonetaTopicListServlet.java
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.IOUtils;
import org.moneta.types.search.SearchResult;
import org.moneta.utils.ServletUtils;
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta;
/**
* List information about configured topics for Moneta
* @author D. Ashmore
*
*/
public class MonetaTopicListServlet extends HttpServlet {
private static final long serialVersionUID = 4405159464697763008L;
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Implement security check
SearchResult searchResult = null;
response.setContentType("text/json");
try{
searchResult = new Moneta().findAllTopics();
|
ServletUtils.writeResult(searchResult, response.getOutputStream());
|
Derek-Ashmore/moneta
|
moneta-core/src/main/java/org/moneta/config/ValueNormalizationUtil.java
|
// Path: moneta-core/src/main/java/org/moneta/error/MonetaException.java
// public class MonetaException extends ContextedRuntimeException {
//
// private static final long serialVersionUID = -682655095144383360L;
//
// public MonetaException(String message) {
// super(message);
// }
//
// // public MonetaException(Throwable cause) {
// // super(cause);
// // }
//
// public MonetaException(String message, Throwable cause) {
// super(message, cause);
// }
//
// }
|
import org.apache.commons.lang.Validate;
import org.apache.commons.lang3.BooleanUtils;
import org.moneta.error.MonetaException;
import org.apache.commons.lang.ClassUtils;
|
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.config;
/**
* Converter utility for Strings
* @author D. Ashmore
*
*/
class ValueNormalizationUtil {
/**
* Will convert a String into the specified property type. Integer, Long, Boolean, and String supported.
* @param targetType
* @param value
* @return convertedValue
*/
public static Object convertString(Class targetType, String value) {
Validate.notNull(targetType, "Null targetType not allowed.");
if (value == null) {
return value;
}
if (ClassUtils.isAssignable(targetType, String.class)) {
return value;
}
if (ClassUtils.isAssignable(targetType, Integer.class)) {
return Integer.valueOf(value);
}
if (ClassUtils.isAssignable(targetType, int.class)) {
return Integer.valueOf(value);
}
if (ClassUtils.isAssignable(targetType, Long.class)) {
return Long.valueOf(value);
}
if (ClassUtils.isAssignable(targetType, long.class)) {
return Long.valueOf(value);
}
Boolean bValue = BooleanUtils.toBooleanObject(value);
if (bValue != null) {
return bValue;
}
|
// Path: moneta-core/src/main/java/org/moneta/error/MonetaException.java
// public class MonetaException extends ContextedRuntimeException {
//
// private static final long serialVersionUID = -682655095144383360L;
//
// public MonetaException(String message) {
// super(message);
// }
//
// // public MonetaException(Throwable cause) {
// // super(cause);
// // }
//
// public MonetaException(String message, Throwable cause) {
// super(message, cause);
// }
//
// }
// Path: moneta-core/src/main/java/org/moneta/config/ValueNormalizationUtil.java
import org.apache.commons.lang.Validate;
import org.apache.commons.lang3.BooleanUtils;
import org.moneta.error.MonetaException;
import org.apache.commons.lang.ClassUtils;
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.config;
/**
* Converter utility for Strings
* @author D. Ashmore
*
*/
class ValueNormalizationUtil {
/**
* Will convert a String into the specified property type. Integer, Long, Boolean, and String supported.
* @param targetType
* @param value
* @return convertedValue
*/
public static Object convertString(Class targetType, String value) {
Validate.notNull(targetType, "Null targetType not allowed.");
if (value == null) {
return value;
}
if (ClassUtils.isAssignable(targetType, String.class)) {
return value;
}
if (ClassUtils.isAssignable(targetType, Integer.class)) {
return Integer.valueOf(value);
}
if (ClassUtils.isAssignable(targetType, int.class)) {
return Integer.valueOf(value);
}
if (ClassUtils.isAssignable(targetType, Long.class)) {
return Long.valueOf(value);
}
if (ClassUtils.isAssignable(targetType, long.class)) {
return Long.valueOf(value);
}
Boolean bValue = BooleanUtils.toBooleanObject(value);
if (bValue != null) {
return bValue;
}
|
throw new MonetaException("Property type not supported")
|
Derek-Ashmore/moneta
|
moneta-core/src/main/java/org/moneta/MonetaPerformanceFilter.java
|
// Path: moneta-core/src/main/java/org/moneta/error/MonetaException.java
// public class MonetaException extends ContextedRuntimeException {
//
// private static final long serialVersionUID = -682655095144383360L;
//
// public MonetaException(String message) {
// super(message);
// }
//
// // public MonetaException(Throwable cause) {
// // super(cause);
// // }
//
// public MonetaException(String message, Throwable cause) {
// super(message, cause);
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/topic/Topic.java
// public class Topic extends BaseType implements Comparable<Topic> {
//
// private String topicName;
// private String pluralName;
// private String dataSourceName;
// private String schemaName;
// private String catalogName;
// private String tableName;
// private Boolean readOnly = Boolean.FALSE;
//
// private Map<String,String> aliasMap = new HashMap<String,String>();
// private List<TopicKeyField> keyFieldList = new ArrayList<TopicKeyField>();
//
// public String getTopicName() {
// return topicName;
// }
//
// public void setTopicName(String topicName) {
// this.topicName = topicName;
// }
//
// public String getTableName() {
// return tableName;
// }
//
// public void setTableName(String tableName) {
// this.tableName = tableName;
// }
//
// public String getSchemaName() {
// return schemaName;
// }
//
// public void setSchemaName(String schemaName) {
// this.schemaName = schemaName;
// }
//
// public Boolean getReadOnly() {
// return readOnly;
// }
//
// public void setReadOnly(Boolean readOnly) {
// this.readOnly = readOnly;
// }
//
// public String getDataSourceName() {
// return dataSourceName;
// }
//
// public void setDataSourceName(String dataSourceName) {
// this.dataSourceName = dataSourceName;
// }
//
// public String getCatalogName() {
// return catalogName;
// }
//
// public void setCatalogName(String catalogName) {
// this.catalogName = catalogName;
// }
//
// public Map<String, String> getAliasMap() {
// return aliasMap;
// }
//
// public List<TopicKeyField> getKeyFieldList() {
// return keyFieldList;
// }
//
// public int compareTo(Topic other) {
// return new CompareToBuilder()
// .append(this.topicName, other.getTopicName())
// .toComparison();
// }
//
// public String getPluralName() {
// return pluralName;
// }
//
// public void setPluralName(String pluralName) {
// this.pluralName = pluralName;
// }
//
// }
|
import org.moneta.types.topic.Topic;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import net.admin4j.timer.TaskTimer;
import net.admin4j.timer.TaskTimerFactory;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.apache.commons.lang3.StringUtils;
import org.moneta.error.MonetaException;
|
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta;
/**
* Monitors performance for
* @author D. Ashmore
*
*/
public class MonetaPerformanceFilter implements Filter {
public static final String PARM_MAX_TRNASACTION_TIME_THRESHOLD_IN_MILLIS="max.transaction.time.millis";
private Long transactionTimeThreshold = null;
private static Logger perfLogger = LoggerFactory.getLogger("Performance");
private static Logger logger = LoggerFactory.getLogger(MonetaPerformanceFilter.class);
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
TaskTimer perfMonitor = null;
SearchRequestFactory searchRequestFactory = null;
|
// Path: moneta-core/src/main/java/org/moneta/error/MonetaException.java
// public class MonetaException extends ContextedRuntimeException {
//
// private static final long serialVersionUID = -682655095144383360L;
//
// public MonetaException(String message) {
// super(message);
// }
//
// // public MonetaException(Throwable cause) {
// // super(cause);
// // }
//
// public MonetaException(String message, Throwable cause) {
// super(message, cause);
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/topic/Topic.java
// public class Topic extends BaseType implements Comparable<Topic> {
//
// private String topicName;
// private String pluralName;
// private String dataSourceName;
// private String schemaName;
// private String catalogName;
// private String tableName;
// private Boolean readOnly = Boolean.FALSE;
//
// private Map<String,String> aliasMap = new HashMap<String,String>();
// private List<TopicKeyField> keyFieldList = new ArrayList<TopicKeyField>();
//
// public String getTopicName() {
// return topicName;
// }
//
// public void setTopicName(String topicName) {
// this.topicName = topicName;
// }
//
// public String getTableName() {
// return tableName;
// }
//
// public void setTableName(String tableName) {
// this.tableName = tableName;
// }
//
// public String getSchemaName() {
// return schemaName;
// }
//
// public void setSchemaName(String schemaName) {
// this.schemaName = schemaName;
// }
//
// public Boolean getReadOnly() {
// return readOnly;
// }
//
// public void setReadOnly(Boolean readOnly) {
// this.readOnly = readOnly;
// }
//
// public String getDataSourceName() {
// return dataSourceName;
// }
//
// public void setDataSourceName(String dataSourceName) {
// this.dataSourceName = dataSourceName;
// }
//
// public String getCatalogName() {
// return catalogName;
// }
//
// public void setCatalogName(String catalogName) {
// this.catalogName = catalogName;
// }
//
// public Map<String, String> getAliasMap() {
// return aliasMap;
// }
//
// public List<TopicKeyField> getKeyFieldList() {
// return keyFieldList;
// }
//
// public int compareTo(Topic other) {
// return new CompareToBuilder()
// .append(this.topicName, other.getTopicName())
// .toComparison();
// }
//
// public String getPluralName() {
// return pluralName;
// }
//
// public void setPluralName(String pluralName) {
// this.pluralName = pluralName;
// }
//
// }
// Path: moneta-core/src/main/java/org/moneta/MonetaPerformanceFilter.java
import org.moneta.types.topic.Topic;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import net.admin4j.timer.TaskTimer;
import net.admin4j.timer.TaskTimerFactory;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.apache.commons.lang3.StringUtils;
import org.moneta.error.MonetaException;
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta;
/**
* Monitors performance for
* @author D. Ashmore
*
*/
public class MonetaPerformanceFilter implements Filter {
public static final String PARM_MAX_TRNASACTION_TIME_THRESHOLD_IN_MILLIS="max.transaction.time.millis";
private Long transactionTimeThreshold = null;
private static Logger perfLogger = LoggerFactory.getLogger("Performance");
private static Logger logger = LoggerFactory.getLogger(MonetaPerformanceFilter.class);
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
TaskTimer perfMonitor = null;
SearchRequestFactory searchRequestFactory = null;
|
Topic searchTopic = null;
|
Derek-Ashmore/moneta
|
moneta-core/src/main/java/org/moneta/MonetaPerformanceFilter.java
|
// Path: moneta-core/src/main/java/org/moneta/error/MonetaException.java
// public class MonetaException extends ContextedRuntimeException {
//
// private static final long serialVersionUID = -682655095144383360L;
//
// public MonetaException(String message) {
// super(message);
// }
//
// // public MonetaException(Throwable cause) {
// // super(cause);
// // }
//
// public MonetaException(String message, Throwable cause) {
// super(message, cause);
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/topic/Topic.java
// public class Topic extends BaseType implements Comparable<Topic> {
//
// private String topicName;
// private String pluralName;
// private String dataSourceName;
// private String schemaName;
// private String catalogName;
// private String tableName;
// private Boolean readOnly = Boolean.FALSE;
//
// private Map<String,String> aliasMap = new HashMap<String,String>();
// private List<TopicKeyField> keyFieldList = new ArrayList<TopicKeyField>();
//
// public String getTopicName() {
// return topicName;
// }
//
// public void setTopicName(String topicName) {
// this.topicName = topicName;
// }
//
// public String getTableName() {
// return tableName;
// }
//
// public void setTableName(String tableName) {
// this.tableName = tableName;
// }
//
// public String getSchemaName() {
// return schemaName;
// }
//
// public void setSchemaName(String schemaName) {
// this.schemaName = schemaName;
// }
//
// public Boolean getReadOnly() {
// return readOnly;
// }
//
// public void setReadOnly(Boolean readOnly) {
// this.readOnly = readOnly;
// }
//
// public String getDataSourceName() {
// return dataSourceName;
// }
//
// public void setDataSourceName(String dataSourceName) {
// this.dataSourceName = dataSourceName;
// }
//
// public String getCatalogName() {
// return catalogName;
// }
//
// public void setCatalogName(String catalogName) {
// this.catalogName = catalogName;
// }
//
// public Map<String, String> getAliasMap() {
// return aliasMap;
// }
//
// public List<TopicKeyField> getKeyFieldList() {
// return keyFieldList;
// }
//
// public int compareTo(Topic other) {
// return new CompareToBuilder()
// .append(this.topicName, other.getTopicName())
// .toComparison();
// }
//
// public String getPluralName() {
// return pluralName;
// }
//
// public void setPluralName(String pluralName) {
// this.pluralName = pluralName;
// }
//
// }
|
import org.moneta.types.topic.Topic;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import net.admin4j.timer.TaskTimer;
import net.admin4j.timer.TaskTimerFactory;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.apache.commons.lang3.StringUtils;
import org.moneta.error.MonetaException;
|
}
}
chain.doFilter(request, response);
}
finally {
if (perfMonitor != null) perfMonitor.stop();
long elapsedTime = System.currentTimeMillis() - startTimeMillis;
if (transactionTimeThreshold != null && elapsedTime > transactionTimeThreshold) {
perfLogger.warn("Transaction longer than threshold. ElapsedMillis={} contextPath={} request={}",
new Object[]{elapsedTime, ((HttpServletRequest)request).getContextPath(),
((HttpServletRequest)request).getPathInfo()});
}
}
}
public void destroy() {
// NoOp
}
public void init(FilterConfig filterConfig) throws ServletException {
String transTimeStr = filterConfig.getInitParameter(PARM_MAX_TRNASACTION_TIME_THRESHOLD_IN_MILLIS);
if (StringUtils.isNotBlank(transTimeStr)) {
try {
transactionTimeThreshold = Long.valueOf(transTimeStr);
}
catch (Exception e) {
|
// Path: moneta-core/src/main/java/org/moneta/error/MonetaException.java
// public class MonetaException extends ContextedRuntimeException {
//
// private static final long serialVersionUID = -682655095144383360L;
//
// public MonetaException(String message) {
// super(message);
// }
//
// // public MonetaException(Throwable cause) {
// // super(cause);
// // }
//
// public MonetaException(String message, Throwable cause) {
// super(message, cause);
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/topic/Topic.java
// public class Topic extends BaseType implements Comparable<Topic> {
//
// private String topicName;
// private String pluralName;
// private String dataSourceName;
// private String schemaName;
// private String catalogName;
// private String tableName;
// private Boolean readOnly = Boolean.FALSE;
//
// private Map<String,String> aliasMap = new HashMap<String,String>();
// private List<TopicKeyField> keyFieldList = new ArrayList<TopicKeyField>();
//
// public String getTopicName() {
// return topicName;
// }
//
// public void setTopicName(String topicName) {
// this.topicName = topicName;
// }
//
// public String getTableName() {
// return tableName;
// }
//
// public void setTableName(String tableName) {
// this.tableName = tableName;
// }
//
// public String getSchemaName() {
// return schemaName;
// }
//
// public void setSchemaName(String schemaName) {
// this.schemaName = schemaName;
// }
//
// public Boolean getReadOnly() {
// return readOnly;
// }
//
// public void setReadOnly(Boolean readOnly) {
// this.readOnly = readOnly;
// }
//
// public String getDataSourceName() {
// return dataSourceName;
// }
//
// public void setDataSourceName(String dataSourceName) {
// this.dataSourceName = dataSourceName;
// }
//
// public String getCatalogName() {
// return catalogName;
// }
//
// public void setCatalogName(String catalogName) {
// this.catalogName = catalogName;
// }
//
// public Map<String, String> getAliasMap() {
// return aliasMap;
// }
//
// public List<TopicKeyField> getKeyFieldList() {
// return keyFieldList;
// }
//
// public int compareTo(Topic other) {
// return new CompareToBuilder()
// .append(this.topicName, other.getTopicName())
// .toComparison();
// }
//
// public String getPluralName() {
// return pluralName;
// }
//
// public void setPluralName(String pluralName) {
// this.pluralName = pluralName;
// }
//
// }
// Path: moneta-core/src/main/java/org/moneta/MonetaPerformanceFilter.java
import org.moneta.types.topic.Topic;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import net.admin4j.timer.TaskTimer;
import net.admin4j.timer.TaskTimerFactory;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.apache.commons.lang3.StringUtils;
import org.moneta.error.MonetaException;
}
}
chain.doFilter(request, response);
}
finally {
if (perfMonitor != null) perfMonitor.stop();
long elapsedTime = System.currentTimeMillis() - startTimeMillis;
if (transactionTimeThreshold != null && elapsedTime > transactionTimeThreshold) {
perfLogger.warn("Transaction longer than threshold. ElapsedMillis={} contextPath={} request={}",
new Object[]{elapsedTime, ((HttpServletRequest)request).getContextPath(),
((HttpServletRequest)request).getPathInfo()});
}
}
}
public void destroy() {
// NoOp
}
public void init(FilterConfig filterConfig) throws ServletException {
String transTimeStr = filterConfig.getInitParameter(PARM_MAX_TRNASACTION_TIME_THRESHOLD_IN_MILLIS);
if (StringUtils.isNotBlank(transTimeStr)) {
try {
transactionTimeThreshold = Long.valueOf(transTimeStr);
}
catch (Exception e) {
|
MonetaException ex = (MonetaException)
|
Derek-Ashmore/moneta
|
moneta-core/src/main/java/org/moneta/utils/JsonUtils.java
|
// Path: moneta-core/src/main/java/org/moneta/error/MonetaException.java
// public class MonetaException extends ContextedRuntimeException {
//
// private static final long serialVersionUID = -682655095144383360L;
//
// public MonetaException(String message) {
// super(message);
// }
//
// // public MonetaException(Throwable cause) {
// // super(cause);
// // }
//
// public MonetaException(String message, Throwable cause) {
// super(message, cause);
// }
//
// }
|
import org.moneta.error.MonetaException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.lang3.Validate;
|
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.utils;
/**
* Generic Json utilities
* @author D. Ashmore
*
*/
public class JsonUtils {
/**
* Will convert the given object to Json format.
*/
public static String serialize(Object jsonObject) {
Validate.notNull(jsonObject, "Null object cannot be converted to Json");
ObjectMapper mapper = new ObjectMapper();
try {
return mapper.writeValueAsString(jsonObject);
} catch (Exception e) {
|
// Path: moneta-core/src/main/java/org/moneta/error/MonetaException.java
// public class MonetaException extends ContextedRuntimeException {
//
// private static final long serialVersionUID = -682655095144383360L;
//
// public MonetaException(String message) {
// super(message);
// }
//
// // public MonetaException(Throwable cause) {
// // super(cause);
// // }
//
// public MonetaException(String message, Throwable cause) {
// super(message, cause);
// }
//
// }
// Path: moneta-core/src/main/java/org/moneta/utils/JsonUtils.java
import org.moneta.error.MonetaException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.lang3.Validate;
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.utils;
/**
* Generic Json utilities
* @author D. Ashmore
*
*/
public class JsonUtils {
/**
* Will convert the given object to Json format.
*/
public static String serialize(Object jsonObject) {
Validate.notNull(jsonObject, "Null object cannot be converted to Json");
ObjectMapper mapper = new ObjectMapper();
try {
return mapper.writeValueAsString(jsonObject);
} catch (Exception e) {
|
throw new MonetaException("Error converting object to Json", e)
|
Derek-Ashmore/moneta
|
moneta-core/src/test/java/org/moneta/utils/ServletUtilsTest.java
|
// Path: moneta-core/src/main/java/org/moneta/error/MonetaException.java
// public class MonetaException extends ContextedRuntimeException {
//
// private static final long serialVersionUID = -682655095144383360L;
//
// public MonetaException(String message) {
// super(message);
// }
//
// // public MonetaException(Throwable cause) {
// // super(cause);
// // }
//
// public MonetaException(String message, Throwable cause) {
// super(message, cause);
// }
//
// }
|
import org.junit.Assert;
import org.junit.Test;
import org.moneta.error.MonetaException;
import java.io.ByteArrayOutputStream;
|
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.utils;
public class ServletUtilsTest {
@Test
public void testWriteResult() throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
Throwable exceptionThrown = null;
try {ServletUtils.writeResult(null, out);}
catch (Exception e) {
exceptionThrown=e;
}
Assert.assertTrue(exceptionThrown != null);
Assert.assertTrue(exceptionThrown.getMessage() != null);
}
@Test
public void testWriteError() throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
// Path: moneta-core/src/main/java/org/moneta/error/MonetaException.java
// public class MonetaException extends ContextedRuntimeException {
//
// private static final long serialVersionUID = -682655095144383360L;
//
// public MonetaException(String message) {
// super(message);
// }
//
// // public MonetaException(Throwable cause) {
// // super(cause);
// // }
//
// public MonetaException(String message, Throwable cause) {
// super(message, cause);
// }
//
// }
// Path: moneta-core/src/test/java/org/moneta/utils/ServletUtilsTest.java
import org.junit.Assert;
import org.junit.Test;
import org.moneta.error.MonetaException;
import java.io.ByteArrayOutputStream;
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.utils;
public class ServletUtilsTest {
@Test
public void testWriteResult() throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
Throwable exceptionThrown = null;
try {ServletUtils.writeResult(null, out);}
catch (Exception e) {
exceptionThrown=e;
}
Assert.assertTrue(exceptionThrown != null);
Assert.assertTrue(exceptionThrown.getMessage() != null);
}
@Test
public void testWriteError() throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
Exception error = new MonetaException("Outer exception message", new IllegalArgumentException("Inner exception message"))
|
Derek-Ashmore/moneta
|
moneta-core/src/main/java/org/moneta/utils/ServletUtils.java
|
// Path: moneta-core/src/main/java/org/moneta/error/MonetaException.java
// public class MonetaException extends ContextedRuntimeException {
//
// private static final long serialVersionUID = -682655095144383360L;
//
// public MonetaException(String message) {
// super(message);
// }
//
// // public MonetaException(Throwable cause) {
// // super(cause);
// // }
//
// public MonetaException(String message, Throwable cause) {
// super(message, cause);
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
// public class SearchResult extends BaseType {
//
// private Integer errorCode;
// private String errorMessage;
//
// @JsonProperty("records")
// private Record[] resultData;
//
// public Integer getErrorCode() {
// return errorCode;
// }
//
// public void setErrorCode(Integer errorCode) {
// this.errorCode = errorCode;
// }
//
// public String getErrorMessage() {
// return errorMessage;
// }
//
// public void setErrorMessage(String errorMessage) {
// this.errorMessage = errorMessage;
// }
//
// public Record[] getResultData() {
// return resultData;
// }
//
// public void setResultData(Record[] resultData) {
// this.resultData = resultData;
// }
//
// }
|
import java.io.OutputStream;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.moneta.error.MonetaException;
import org.moneta.types.search.SearchResult;
|
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.utils;
/**
* Generic utilities for Moneta Servlets
* @author D. Ashmore
*
*/
public class ServletUtils {
public static void writeResult(SearchResult result, OutputStream out) {
try {
IOUtils.write(JsonUtils.serialize(result), out);
out.flush();
} catch (Exception e) {
|
// Path: moneta-core/src/main/java/org/moneta/error/MonetaException.java
// public class MonetaException extends ContextedRuntimeException {
//
// private static final long serialVersionUID = -682655095144383360L;
//
// public MonetaException(String message) {
// super(message);
// }
//
// // public MonetaException(Throwable cause) {
// // super(cause);
// // }
//
// public MonetaException(String message, Throwable cause) {
// super(message, cause);
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
// public class SearchResult extends BaseType {
//
// private Integer errorCode;
// private String errorMessage;
//
// @JsonProperty("records")
// private Record[] resultData;
//
// public Integer getErrorCode() {
// return errorCode;
// }
//
// public void setErrorCode(Integer errorCode) {
// this.errorCode = errorCode;
// }
//
// public String getErrorMessage() {
// return errorMessage;
// }
//
// public void setErrorMessage(String errorMessage) {
// this.errorMessage = errorMessage;
// }
//
// public Record[] getResultData() {
// return resultData;
// }
//
// public void setResultData(Record[] resultData) {
// this.resultData = resultData;
// }
//
// }
// Path: moneta-core/src/main/java/org/moneta/utils/ServletUtils.java
import java.io.OutputStream;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.moneta.error.MonetaException;
import org.moneta.types.search.SearchResult;
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.utils;
/**
* Generic utilities for Moneta Servlets
* @author D. Ashmore
*
*/
public class ServletUtils {
public static void writeResult(SearchResult result, OutputStream out) {
try {
IOUtils.write(JsonUtils.serialize(result), out);
out.flush();
} catch (Exception e) {
|
throw new MonetaException("Error writing result output.", e)
|
Derek-Ashmore/moneta
|
moneta-core/src/test/java/org/moneta/dao/SqlSelectExecutorTest.java
|
// Path: moneta-core/src/test/java/org/moneta/MonetaTestBase.java
// public class MonetaTestBase extends HSqlTestBase {
//
// @Before
// public void setUp() throws Exception {
// super.setUp();
// MonetaEnvironment.setConfiguration(
// new MonetaConfiguration(
// new FileInputStream(MonetaConfigurationTest.CONFIG_TEST_FILE_NAME)));
// }
//
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/dao/types/SqlStatement.java
// public class SqlStatement extends BaseType {
//
// public SqlStatement() {}
// public SqlStatement(String sqlText) {
// this.setSqlText(sqlText);
// }
//
// private String sqlText;
// private List<Object> hostVariableValueList = new ArrayList<Object>();
//
// public String getSqlText() {
// return sqlText;
// }
//
// public void setSqlText(String sqlText) {
// this.sqlText = sqlText;
// }
//
// public List<Object> getHostVariableValueList() {
// return hostVariableValueList;
// }
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
// public class SearchResult extends BaseType {
//
// private Integer errorCode;
// private String errorMessage;
//
// @JsonProperty("records")
// private Record[] resultData;
//
// public Integer getErrorCode() {
// return errorCode;
// }
//
// public void setErrorCode(Integer errorCode) {
// this.errorCode = errorCode;
// }
//
// public String getErrorMessage() {
// return errorMessage;
// }
//
// public void setErrorMessage(String errorMessage) {
// this.errorMessage = errorMessage;
// }
//
// public Record[] getResultData() {
// return resultData;
// }
//
// public void setResultData(Record[] resultData) {
// this.resultData = resultData;
// }
//
// }
|
import org.junit.Assert;
import org.junit.Test;
import org.moneta.MonetaTestBase;
import org.moneta.dao.types.SqlStatement;
import org.moneta.types.search.SearchResult;
|
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.dao;
public class SqlSelectExecutorTest extends MonetaTestBase {
@Test
public void testBasic() throws Exception {
SqlSelectExecutor exec = new SqlSelectExecutor("Environment",
|
// Path: moneta-core/src/test/java/org/moneta/MonetaTestBase.java
// public class MonetaTestBase extends HSqlTestBase {
//
// @Before
// public void setUp() throws Exception {
// super.setUp();
// MonetaEnvironment.setConfiguration(
// new MonetaConfiguration(
// new FileInputStream(MonetaConfigurationTest.CONFIG_TEST_FILE_NAME)));
// }
//
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/dao/types/SqlStatement.java
// public class SqlStatement extends BaseType {
//
// public SqlStatement() {}
// public SqlStatement(String sqlText) {
// this.setSqlText(sqlText);
// }
//
// private String sqlText;
// private List<Object> hostVariableValueList = new ArrayList<Object>();
//
// public String getSqlText() {
// return sqlText;
// }
//
// public void setSqlText(String sqlText) {
// this.sqlText = sqlText;
// }
//
// public List<Object> getHostVariableValueList() {
// return hostVariableValueList;
// }
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
// public class SearchResult extends BaseType {
//
// private Integer errorCode;
// private String errorMessage;
//
// @JsonProperty("records")
// private Record[] resultData;
//
// public Integer getErrorCode() {
// return errorCode;
// }
//
// public void setErrorCode(Integer errorCode) {
// this.errorCode = errorCode;
// }
//
// public String getErrorMessage() {
// return errorMessage;
// }
//
// public void setErrorMessage(String errorMessage) {
// this.errorMessage = errorMessage;
// }
//
// public Record[] getResultData() {
// return resultData;
// }
//
// public void setResultData(Record[] resultData) {
// this.resultData = resultData;
// }
//
// }
// Path: moneta-core/src/test/java/org/moneta/dao/SqlSelectExecutorTest.java
import org.junit.Assert;
import org.junit.Test;
import org.moneta.MonetaTestBase;
import org.moneta.dao.types.SqlStatement;
import org.moneta.types.search.SearchResult;
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.dao;
public class SqlSelectExecutorTest extends MonetaTestBase {
@Test
public void testBasic() throws Exception {
SqlSelectExecutor exec = new SqlSelectExecutor("Environment",
|
new SqlStatement("select * from INFORMATION_SCHEMA.SYSTEM_TABLES"));
|
Derek-Ashmore/moneta
|
moneta-core/src/test/java/org/moneta/dao/SqlSelectExecutorTest.java
|
// Path: moneta-core/src/test/java/org/moneta/MonetaTestBase.java
// public class MonetaTestBase extends HSqlTestBase {
//
// @Before
// public void setUp() throws Exception {
// super.setUp();
// MonetaEnvironment.setConfiguration(
// new MonetaConfiguration(
// new FileInputStream(MonetaConfigurationTest.CONFIG_TEST_FILE_NAME)));
// }
//
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/dao/types/SqlStatement.java
// public class SqlStatement extends BaseType {
//
// public SqlStatement() {}
// public SqlStatement(String sqlText) {
// this.setSqlText(sqlText);
// }
//
// private String sqlText;
// private List<Object> hostVariableValueList = new ArrayList<Object>();
//
// public String getSqlText() {
// return sqlText;
// }
//
// public void setSqlText(String sqlText) {
// this.sqlText = sqlText;
// }
//
// public List<Object> getHostVariableValueList() {
// return hostVariableValueList;
// }
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
// public class SearchResult extends BaseType {
//
// private Integer errorCode;
// private String errorMessage;
//
// @JsonProperty("records")
// private Record[] resultData;
//
// public Integer getErrorCode() {
// return errorCode;
// }
//
// public void setErrorCode(Integer errorCode) {
// this.errorCode = errorCode;
// }
//
// public String getErrorMessage() {
// return errorMessage;
// }
//
// public void setErrorMessage(String errorMessage) {
// this.errorMessage = errorMessage;
// }
//
// public Record[] getResultData() {
// return resultData;
// }
//
// public void setResultData(Record[] resultData) {
// this.resultData = resultData;
// }
//
// }
|
import org.junit.Assert;
import org.junit.Test;
import org.moneta.MonetaTestBase;
import org.moneta.dao.types.SqlStatement;
import org.moneta.types.search.SearchResult;
|
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.dao;
public class SqlSelectExecutorTest extends MonetaTestBase {
@Test
public void testBasic() throws Exception {
SqlSelectExecutor exec = new SqlSelectExecutor("Environment",
new SqlStatement("select * from INFORMATION_SCHEMA.SYSTEM_TABLES"));
|
// Path: moneta-core/src/test/java/org/moneta/MonetaTestBase.java
// public class MonetaTestBase extends HSqlTestBase {
//
// @Before
// public void setUp() throws Exception {
// super.setUp();
// MonetaEnvironment.setConfiguration(
// new MonetaConfiguration(
// new FileInputStream(MonetaConfigurationTest.CONFIG_TEST_FILE_NAME)));
// }
//
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/dao/types/SqlStatement.java
// public class SqlStatement extends BaseType {
//
// public SqlStatement() {}
// public SqlStatement(String sqlText) {
// this.setSqlText(sqlText);
// }
//
// private String sqlText;
// private List<Object> hostVariableValueList = new ArrayList<Object>();
//
// public String getSqlText() {
// return sqlText;
// }
//
// public void setSqlText(String sqlText) {
// this.sqlText = sqlText;
// }
//
// public List<Object> getHostVariableValueList() {
// return hostVariableValueList;
// }
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
// public class SearchResult extends BaseType {
//
// private Integer errorCode;
// private String errorMessage;
//
// @JsonProperty("records")
// private Record[] resultData;
//
// public Integer getErrorCode() {
// return errorCode;
// }
//
// public void setErrorCode(Integer errorCode) {
// this.errorCode = errorCode;
// }
//
// public String getErrorMessage() {
// return errorMessage;
// }
//
// public void setErrorMessage(String errorMessage) {
// this.errorMessage = errorMessage;
// }
//
// public Record[] getResultData() {
// return resultData;
// }
//
// public void setResultData(Record[] resultData) {
// this.resultData = resultData;
// }
//
// }
// Path: moneta-core/src/test/java/org/moneta/dao/SqlSelectExecutorTest.java
import org.junit.Assert;
import org.junit.Test;
import org.moneta.MonetaTestBase;
import org.moneta.dao.types.SqlStatement;
import org.moneta.types.search.SearchResult;
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.dao;
public class SqlSelectExecutorTest extends MonetaTestBase {
@Test
public void testBasic() throws Exception {
SqlSelectExecutor exec = new SqlSelectExecutor("Environment",
new SqlStatement("select * from INFORMATION_SCHEMA.SYSTEM_TABLES"));
|
SearchResult result = exec.call();
|
Derek-Ashmore/moneta
|
moneta-core/src/test/java/org/moneta/MonetaServletTest.java
|
// Path: moneta-core/src/main/java/org/moneta/config/MonetaEnvironment.java
// public class MonetaEnvironment extends BaseType {
//
// private static MonetaConfiguration configuration;
//
// public static MonetaConfiguration getConfiguration() {
// return configuration;
// }
//
// public static void setConfiguration(MonetaConfiguration configuration) {
// MonetaEnvironment.configuration = configuration;
// }
//
// }
|
import org.force66.mock.servletapi.MockRequest;
import org.force66.mock.servletapi.MockResponse;
import org.force66.mock.servletapi.MockServletConfig;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.moneta.config.MonetaEnvironment;
|
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta;
public class MonetaServletTest extends MonetaTestBase {
private MonetaServlet servlet;
private MockRequest request;
private MockResponse response;
@Before
public void setUp() throws Exception {
super.setUp();
servlet = new MonetaServlet();
request = new MockRequest();
response = new MockResponse();
}
@Test
public void testInit() throws Exception {
MockServletConfig config = new MockServletConfig();
servlet.init(config);
|
// Path: moneta-core/src/main/java/org/moneta/config/MonetaEnvironment.java
// public class MonetaEnvironment extends BaseType {
//
// private static MonetaConfiguration configuration;
//
// public static MonetaConfiguration getConfiguration() {
// return configuration;
// }
//
// public static void setConfiguration(MonetaConfiguration configuration) {
// MonetaEnvironment.configuration = configuration;
// }
//
// }
// Path: moneta-core/src/test/java/org/moneta/MonetaServletTest.java
import org.force66.mock.servletapi.MockRequest;
import org.force66.mock.servletapi.MockResponse;
import org.force66.mock.servletapi.MockServletConfig;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.moneta.config.MonetaEnvironment;
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta;
public class MonetaServletTest extends MonetaTestBase {
private MonetaServlet servlet;
private MockRequest request;
private MockResponse response;
@Before
public void setUp() throws Exception {
super.setUp();
servlet = new MonetaServlet();
request = new MockRequest();
response = new MockResponse();
}
@Test
public void testInit() throws Exception {
MockServletConfig config = new MockServletConfig();
servlet.init(config);
|
Assert.assertTrue(MonetaEnvironment.getConfiguration().getIgnoredContextPathNodes()==null);
|
Derek-Ashmore/moneta
|
moneta-dropwizard/src/main/java/org/moneta/config/dropwizard/MonetaConfigurationSourceProvider.java
|
// Path: moneta-core/src/main/java/org/moneta/error/MonetaException.java
// public class MonetaException extends ContextedRuntimeException {
//
// private static final long serialVersionUID = -682655095144383360L;
//
// public MonetaException(String message) {
// super(message);
// }
//
// // public MonetaException(Throwable cause) {
// // super(cause);
// // }
//
// public MonetaException(String message, Throwable cause) {
// super(message, cause);
// }
//
// }
|
import io.dropwizard.configuration.ConfigurationSourceProvider;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import org.apache.commons.lang3.Validate;
import org.moneta.error.MonetaException;
|
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.config.dropwizard;
/**
* Allows application configuration via the classpath as well as file reference.
*
* @author D. Ashmore
*
*/
public class MonetaConfigurationSourceProvider implements
ConfigurationSourceProvider {
public InputStream open(String path) throws IOException {
Validate.notBlank(path,
"Null or blank configuration file reference not allowed");
InputStream configStream = MonetaConfigurationSourceProvider.class.getResourceAsStream(path);
if (configStream == null) {
final File file = new File(path);
if (!file.exists()) {
|
// Path: moneta-core/src/main/java/org/moneta/error/MonetaException.java
// public class MonetaException extends ContextedRuntimeException {
//
// private static final long serialVersionUID = -682655095144383360L;
//
// public MonetaException(String message) {
// super(message);
// }
//
// // public MonetaException(Throwable cause) {
// // super(cause);
// // }
//
// public MonetaException(String message, Throwable cause) {
// super(message, cause);
// }
//
// }
// Path: moneta-dropwizard/src/main/java/org/moneta/config/dropwizard/MonetaConfigurationSourceProvider.java
import io.dropwizard.configuration.ConfigurationSourceProvider;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import org.apache.commons.lang3.Validate;
import org.moneta.error.MonetaException;
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.config.dropwizard;
/**
* Allows application configuration via the classpath as well as file reference.
*
* @author D. Ashmore
*
*/
public class MonetaConfigurationSourceProvider implements
ConfigurationSourceProvider {
public InputStream open(String path) throws IOException {
Validate.notBlank(path,
"Null or blank configuration file reference not allowed");
InputStream configStream = MonetaConfigurationSourceProvider.class.getResourceAsStream(path);
if (configStream == null) {
final File file = new File(path);
if (!file.exists()) {
|
throw new MonetaException(
|
Derek-Ashmore/moneta
|
moneta-core/src/test/java/org/moneta/utils/JsonUtilsTest.java
|
// Path: moneta-core/src/main/java/org/moneta/types/Record.java
// public class Record extends BaseType {
//
// @JsonProperty("record")
// private Value[] values;
//
// public Value[] getValues() {
// return values;
// }
//
// public void setValues(Value[] values) {
// this.values = values;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/Value.java
// public class Value extends BaseType {
//
// private String name;
// private Object value;
//
// public Value() {}
// public Value(String name, Object value) {
// this.setName(name);
// this.setValue(value);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Object getValue() {
// return value;
// }
//
// public void setValue(Object value) {
// this.value = value;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
// public class SearchResult extends BaseType {
//
// private Integer errorCode;
// private String errorMessage;
//
// @JsonProperty("records")
// private Record[] resultData;
//
// public Integer getErrorCode() {
// return errorCode;
// }
//
// public void setErrorCode(Integer errorCode) {
// this.errorCode = errorCode;
// }
//
// public String getErrorMessage() {
// return errorMessage;
// }
//
// public void setErrorMessage(String errorMessage) {
// this.errorMessage = errorMessage;
// }
//
// public Record[] getResultData() {
// return resultData;
// }
//
// public void setResultData(Record[] resultData) {
// this.resultData = resultData;
// }
//
// }
|
import static org.junit.Assert.fail;
import org.apache.commons.lang3.StringUtils;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.moneta.types.Record;
import org.moneta.types.Value;
import org.moneta.types.search.SearchResult;
|
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.utils;
public class JsonUtilsTest {
SearchResult testResult;
@Before
public void setUp() throws Exception {
testResult = new SearchResult();
testResult.setErrorCode(0);
testResult.setErrorMessage("hi there");
|
// Path: moneta-core/src/main/java/org/moneta/types/Record.java
// public class Record extends BaseType {
//
// @JsonProperty("record")
// private Value[] values;
//
// public Value[] getValues() {
// return values;
// }
//
// public void setValues(Value[] values) {
// this.values = values;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/Value.java
// public class Value extends BaseType {
//
// private String name;
// private Object value;
//
// public Value() {}
// public Value(String name, Object value) {
// this.setName(name);
// this.setValue(value);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Object getValue() {
// return value;
// }
//
// public void setValue(Object value) {
// this.value = value;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
// public class SearchResult extends BaseType {
//
// private Integer errorCode;
// private String errorMessage;
//
// @JsonProperty("records")
// private Record[] resultData;
//
// public Integer getErrorCode() {
// return errorCode;
// }
//
// public void setErrorCode(Integer errorCode) {
// this.errorCode = errorCode;
// }
//
// public String getErrorMessage() {
// return errorMessage;
// }
//
// public void setErrorMessage(String errorMessage) {
// this.errorMessage = errorMessage;
// }
//
// public Record[] getResultData() {
// return resultData;
// }
//
// public void setResultData(Record[] resultData) {
// this.resultData = resultData;
// }
//
// }
// Path: moneta-core/src/test/java/org/moneta/utils/JsonUtilsTest.java
import static org.junit.Assert.fail;
import org.apache.commons.lang3.StringUtils;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.moneta.types.Record;
import org.moneta.types.Value;
import org.moneta.types.search.SearchResult;
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.utils;
public class JsonUtilsTest {
SearchResult testResult;
@Before
public void setUp() throws Exception {
testResult = new SearchResult();
testResult.setErrorCode(0);
testResult.setErrorMessage("hi there");
|
Record[] records = new Record[2];
|
Derek-Ashmore/moneta
|
moneta-core/src/test/java/org/moneta/utils/JsonUtilsTest.java
|
// Path: moneta-core/src/main/java/org/moneta/types/Record.java
// public class Record extends BaseType {
//
// @JsonProperty("record")
// private Value[] values;
//
// public Value[] getValues() {
// return values;
// }
//
// public void setValues(Value[] values) {
// this.values = values;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/Value.java
// public class Value extends BaseType {
//
// private String name;
// private Object value;
//
// public Value() {}
// public Value(String name, Object value) {
// this.setName(name);
// this.setValue(value);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Object getValue() {
// return value;
// }
//
// public void setValue(Object value) {
// this.value = value;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
// public class SearchResult extends BaseType {
//
// private Integer errorCode;
// private String errorMessage;
//
// @JsonProperty("records")
// private Record[] resultData;
//
// public Integer getErrorCode() {
// return errorCode;
// }
//
// public void setErrorCode(Integer errorCode) {
// this.errorCode = errorCode;
// }
//
// public String getErrorMessage() {
// return errorMessage;
// }
//
// public void setErrorMessage(String errorMessage) {
// this.errorMessage = errorMessage;
// }
//
// public Record[] getResultData() {
// return resultData;
// }
//
// public void setResultData(Record[] resultData) {
// this.resultData = resultData;
// }
//
// }
|
import static org.junit.Assert.fail;
import org.apache.commons.lang3.StringUtils;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.moneta.types.Record;
import org.moneta.types.Value;
import org.moneta.types.search.SearchResult;
|
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.utils;
public class JsonUtilsTest {
SearchResult testResult;
@Before
public void setUp() throws Exception {
testResult = new SearchResult();
testResult.setErrorCode(0);
testResult.setErrorMessage("hi there");
Record[] records = new Record[2];
testResult.setResultData(records);
for (int i = 0; i < 2; i++) {
records[i] = new Record();
|
// Path: moneta-core/src/main/java/org/moneta/types/Record.java
// public class Record extends BaseType {
//
// @JsonProperty("record")
// private Value[] values;
//
// public Value[] getValues() {
// return values;
// }
//
// public void setValues(Value[] values) {
// this.values = values;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/Value.java
// public class Value extends BaseType {
//
// private String name;
// private Object value;
//
// public Value() {}
// public Value(String name, Object value) {
// this.setName(name);
// this.setValue(value);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Object getValue() {
// return value;
// }
//
// public void setValue(Object value) {
// this.value = value;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
// public class SearchResult extends BaseType {
//
// private Integer errorCode;
// private String errorMessage;
//
// @JsonProperty("records")
// private Record[] resultData;
//
// public Integer getErrorCode() {
// return errorCode;
// }
//
// public void setErrorCode(Integer errorCode) {
// this.errorCode = errorCode;
// }
//
// public String getErrorMessage() {
// return errorMessage;
// }
//
// public void setErrorMessage(String errorMessage) {
// this.errorMessage = errorMessage;
// }
//
// public Record[] getResultData() {
// return resultData;
// }
//
// public void setResultData(Record[] resultData) {
// this.resultData = resultData;
// }
//
// }
// Path: moneta-core/src/test/java/org/moneta/utils/JsonUtilsTest.java
import static org.junit.Assert.fail;
import org.apache.commons.lang3.StringUtils;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.moneta.types.Record;
import org.moneta.types.Value;
import org.moneta.types.search.SearchResult;
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.utils;
public class JsonUtilsTest {
SearchResult testResult;
@Before
public void setUp() throws Exception {
testResult = new SearchResult();
testResult.setErrorCode(0);
testResult.setErrorMessage("hi there");
Record[] records = new Record[2];
testResult.setResultData(records);
for (int i = 0; i < 2; i++) {
records[i] = new Record();
|
records[i].setValues(new Value[]{new Value("fi", "fi"), new Value("fo", "fum")});
|
Derek-Ashmore/moneta
|
moneta-core/src/test/java/org/moneta/dao/RecordResultSetHandlerTest.java
|
// Path: moneta-core/src/test/java/org/moneta/HSqlTestBase.java
// public class HSqlTestBase {
//
// protected Connection nativeConnection;
//
// @Before
// public void setUp() throws Exception {
// org.hsqldb.jdbcDriver nativeDriver = new org.hsqldb.jdbcDriver();
// nativeConnection = nativeDriver.connect("jdbc:hsqldb:mem:TestDb", new Properties());
// }
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/Record.java
// public class Record extends BaseType {
//
// @JsonProperty("record")
// private Value[] values;
//
// public Value[] getValues() {
// return values;
// }
//
// public void setValues(Value[] values) {
// this.values = values;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/Value.java
// public class Value extends BaseType {
//
// private String name;
// private Object value;
//
// public Value() {}
// public Value(String name, Object value) {
// this.setName(name);
// this.setValue(value);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Object getValue() {
// return value;
// }
//
// public void setValue(Object value) {
// this.value = value;
// }
//
// }
|
import org.apache.commons.dbutils.QueryRunner;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.moneta.HSqlTestBase;
import org.moneta.types.Record;
import org.moneta.types.Value;
|
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.dao;
public class RecordResultSetHandlerTest extends HSqlTestBase {
RecordResultSetHandler handler;
@Before
public void setUp() throws Exception {
super.setUp();
handler = new RecordResultSetHandler();
handler.getAliasMap().put("TABLE_CAT", "Catalog");
}
@Test
public void testBasicHappyPath() throws Exception {
QueryRunner runner = new QueryRunner();
|
// Path: moneta-core/src/test/java/org/moneta/HSqlTestBase.java
// public class HSqlTestBase {
//
// protected Connection nativeConnection;
//
// @Before
// public void setUp() throws Exception {
// org.hsqldb.jdbcDriver nativeDriver = new org.hsqldb.jdbcDriver();
// nativeConnection = nativeDriver.connect("jdbc:hsqldb:mem:TestDb", new Properties());
// }
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/Record.java
// public class Record extends BaseType {
//
// @JsonProperty("record")
// private Value[] values;
//
// public Value[] getValues() {
// return values;
// }
//
// public void setValues(Value[] values) {
// this.values = values;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/Value.java
// public class Value extends BaseType {
//
// private String name;
// private Object value;
//
// public Value() {}
// public Value(String name, Object value) {
// this.setName(name);
// this.setValue(value);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Object getValue() {
// return value;
// }
//
// public void setValue(Object value) {
// this.value = value;
// }
//
// }
// Path: moneta-core/src/test/java/org/moneta/dao/RecordResultSetHandlerTest.java
import org.apache.commons.dbutils.QueryRunner;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.moneta.HSqlTestBase;
import org.moneta.types.Record;
import org.moneta.types.Value;
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.dao;
public class RecordResultSetHandlerTest extends HSqlTestBase {
RecordResultSetHandler handler;
@Before
public void setUp() throws Exception {
super.setUp();
handler = new RecordResultSetHandler();
handler.getAliasMap().put("TABLE_CAT", "Catalog");
}
@Test
public void testBasicHappyPath() throws Exception {
QueryRunner runner = new QueryRunner();
|
Record[] recArray = runner.query(nativeConnection,
|
Derek-Ashmore/moneta
|
moneta-core/src/test/java/org/moneta/dao/RecordResultSetHandlerTest.java
|
// Path: moneta-core/src/test/java/org/moneta/HSqlTestBase.java
// public class HSqlTestBase {
//
// protected Connection nativeConnection;
//
// @Before
// public void setUp() throws Exception {
// org.hsqldb.jdbcDriver nativeDriver = new org.hsqldb.jdbcDriver();
// nativeConnection = nativeDriver.connect("jdbc:hsqldb:mem:TestDb", new Properties());
// }
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/Record.java
// public class Record extends BaseType {
//
// @JsonProperty("record")
// private Value[] values;
//
// public Value[] getValues() {
// return values;
// }
//
// public void setValues(Value[] values) {
// this.values = values;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/Value.java
// public class Value extends BaseType {
//
// private String name;
// private Object value;
//
// public Value() {}
// public Value(String name, Object value) {
// this.setName(name);
// this.setValue(value);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Object getValue() {
// return value;
// }
//
// public void setValue(Object value) {
// this.value = value;
// }
//
// }
|
import org.apache.commons.dbutils.QueryRunner;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.moneta.HSqlTestBase;
import org.moneta.types.Record;
import org.moneta.types.Value;
|
handler.getAliasMap().put("TABLE_CAT", "Catalog");
}
@Test
public void testBasicHappyPath() throws Exception {
QueryRunner runner = new QueryRunner();
Record[] recArray = runner.query(nativeConnection,
"select * from INFORMATION_SCHEMA.SYSTEM_TABLES", handler);
Assert.assertTrue(recArray != null);
Assert.assertTrue(recArray.length == 92);
Assert.assertTrue(searchForColumn(recArray, "Catalog"));
Assert.assertTrue(!searchForColumn(recArray, "TABLE_CAT"));
Assert.assertTrue(searchForColumn(recArray, "TABLE_TYPE"));
handler.setStartRow(90L);
recArray = runner.query(nativeConnection,
"select * from INFORMATION_SCHEMA.SYSTEM_TABLES", handler);
Assert.assertTrue(recArray != null);
Assert.assertTrue(recArray.length == 3);
handler.setStartRow(null);
handler.setMaxRows(10L);
recArray = runner.query(nativeConnection,
"select * from INFORMATION_SCHEMA.SYSTEM_TABLES", handler);
Assert.assertTrue(recArray != null);
Assert.assertTrue(recArray.length == 10);
}
private boolean searchForColumn(Record[] recArray, String testColumn) {
boolean testColumnFound=false;
|
// Path: moneta-core/src/test/java/org/moneta/HSqlTestBase.java
// public class HSqlTestBase {
//
// protected Connection nativeConnection;
//
// @Before
// public void setUp() throws Exception {
// org.hsqldb.jdbcDriver nativeDriver = new org.hsqldb.jdbcDriver();
// nativeConnection = nativeDriver.connect("jdbc:hsqldb:mem:TestDb", new Properties());
// }
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/Record.java
// public class Record extends BaseType {
//
// @JsonProperty("record")
// private Value[] values;
//
// public Value[] getValues() {
// return values;
// }
//
// public void setValues(Value[] values) {
// this.values = values;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/Value.java
// public class Value extends BaseType {
//
// private String name;
// private Object value;
//
// public Value() {}
// public Value(String name, Object value) {
// this.setName(name);
// this.setValue(value);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Object getValue() {
// return value;
// }
//
// public void setValue(Object value) {
// this.value = value;
// }
//
// }
// Path: moneta-core/src/test/java/org/moneta/dao/RecordResultSetHandlerTest.java
import org.apache.commons.dbutils.QueryRunner;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.moneta.HSqlTestBase;
import org.moneta.types.Record;
import org.moneta.types.Value;
handler.getAliasMap().put("TABLE_CAT", "Catalog");
}
@Test
public void testBasicHappyPath() throws Exception {
QueryRunner runner = new QueryRunner();
Record[] recArray = runner.query(nativeConnection,
"select * from INFORMATION_SCHEMA.SYSTEM_TABLES", handler);
Assert.assertTrue(recArray != null);
Assert.assertTrue(recArray.length == 92);
Assert.assertTrue(searchForColumn(recArray, "Catalog"));
Assert.assertTrue(!searchForColumn(recArray, "TABLE_CAT"));
Assert.assertTrue(searchForColumn(recArray, "TABLE_TYPE"));
handler.setStartRow(90L);
recArray = runner.query(nativeConnection,
"select * from INFORMATION_SCHEMA.SYSTEM_TABLES", handler);
Assert.assertTrue(recArray != null);
Assert.assertTrue(recArray.length == 3);
handler.setStartRow(null);
handler.setMaxRows(10L);
recArray = runner.query(nativeConnection,
"select * from INFORMATION_SCHEMA.SYSTEM_TABLES", handler);
Assert.assertTrue(recArray != null);
Assert.assertTrue(recArray.length == 10);
}
private boolean searchForColumn(Record[] recArray, String testColumn) {
boolean testColumnFound=false;
|
for (Value value: recArray[0].getValues()) {
|
Derek-Ashmore/moneta
|
moneta-core/src/test/java/org/moneta/SearchRequestFactoryTest.java
|
// Path: moneta-core/src/main/java/org/moneta/config/MonetaEnvironment.java
// public class MonetaEnvironment extends BaseType {
//
// private static MonetaConfiguration configuration;
//
// public static MonetaConfiguration getConfiguration() {
// return configuration;
// }
//
// public static void setConfiguration(MonetaConfiguration configuration) {
// MonetaEnvironment.configuration = configuration;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/CompositeCriteria.java
// public class CompositeCriteria extends BaseType implements Criteria {
//
// public static enum Operator {AND, OR};
//
// private Operator operator;
// private Criteria[] searchCriteria;
//
// public Operator getOperator() {
// return operator;
// }
//
// public void setOperator(Operator operator) {
// this.operator = operator;
// }
//
// public Criteria[] getSearchCriteria() {
// return searchCriteria;
// }
//
// public void setSearchCriteria(Criteria[] searchCriteria) {
// this.searchCriteria = searchCriteria;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/Criteria.java
// public interface Criteria {
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/FilterCriteria.java
// public class FilterCriteria extends BaseType implements Criteria {
//
// public static enum Operation {EQUAL, NOT_EQUAL, GREATER_THAN, LESS_THAN, IS_NULL, IS_NOT_NULL, LIKE};
//
// private String fieldName;
// private Operation operation;
// private Object value;
//
// public String getFieldName() {
// return fieldName;
// }
//
// public void setFieldName(String fieldName) {
// this.fieldName = fieldName;
// }
//
// public Operation getOperation() {
// return operation;
// }
//
// public void setOperation(Operation operation) {
// this.operation = operation;
// }
//
// public Object getValue() {
// return value;
// }
//
// public void setValue(Object value) {
// this.value = value;
// }
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchRequest.java
// public class SearchRequest extends BaseType {
//
// private String topic;
// private String[] fieldNames;
// private CompositeCriteria searchCriteria;
// private Long maxRows;
// private Long startRow;
//
// public String[] getFieldNames() {
// return fieldNames;
// }
//
// public void setFieldNames(String[] fieldNames) {
// this.fieldNames = fieldNames;
// }
//
// public CompositeCriteria getSearchCriteria() {
// return searchCriteria;
// }
//
// public void setSearchCriteria(CompositeCriteria searchCriteria) {
// this.searchCriteria = searchCriteria;
// }
//
// public Long getMaxRows() {
// return maxRows;
// }
//
// public void setMaxRows(Long maxRows) {
// this.maxRows = maxRows;
// }
//
// public String getTopic() {
// return topic;
// }
//
// public void setTopic(String topic) {
// this.topic = topic;
// }
//
// public Long getStartRow() {
// return startRow;
// }
//
// public void setStartRow(Long startRow) {
// this.startRow = startRow;
// }
//
//
// }
|
import java.util.Arrays;
import org.apache.commons.lang3.StringUtils;
import org.force66.mock.servletapi.MockRequest;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.moneta.config.MonetaEnvironment;
import org.moneta.types.search.CompositeCriteria;
import org.moneta.types.search.Criteria;
import org.moneta.types.search.FilterCriteria;
import org.moneta.types.search.SearchRequest;
|
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta;
public class SearchRequestFactoryTest extends MonetaTestBase {
private SearchRequestFactory factory;
private MockRequest request;
@Before
public void setUp() throws Exception {
super.setUp();
factory = new SearchRequestFactory();
request = new MockRequest();
}
@Test
public void testDeriveSearchRequest() throws Exception {
request.setUri("/myapp", null);
testException("Search topic not provided");
request.setUri("/myapp", "/crap");
testException("Topic not configured");
testException("crap");
request.setUri("/myapp", "/Environment/one/too/too/many");
testException("Search key in request uri not configured");
testException("many");
request.setUri("/myapp", "/Environment/one/two/three");
|
// Path: moneta-core/src/main/java/org/moneta/config/MonetaEnvironment.java
// public class MonetaEnvironment extends BaseType {
//
// private static MonetaConfiguration configuration;
//
// public static MonetaConfiguration getConfiguration() {
// return configuration;
// }
//
// public static void setConfiguration(MonetaConfiguration configuration) {
// MonetaEnvironment.configuration = configuration;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/CompositeCriteria.java
// public class CompositeCriteria extends BaseType implements Criteria {
//
// public static enum Operator {AND, OR};
//
// private Operator operator;
// private Criteria[] searchCriteria;
//
// public Operator getOperator() {
// return operator;
// }
//
// public void setOperator(Operator operator) {
// this.operator = operator;
// }
//
// public Criteria[] getSearchCriteria() {
// return searchCriteria;
// }
//
// public void setSearchCriteria(Criteria[] searchCriteria) {
// this.searchCriteria = searchCriteria;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/Criteria.java
// public interface Criteria {
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/FilterCriteria.java
// public class FilterCriteria extends BaseType implements Criteria {
//
// public static enum Operation {EQUAL, NOT_EQUAL, GREATER_THAN, LESS_THAN, IS_NULL, IS_NOT_NULL, LIKE};
//
// private String fieldName;
// private Operation operation;
// private Object value;
//
// public String getFieldName() {
// return fieldName;
// }
//
// public void setFieldName(String fieldName) {
// this.fieldName = fieldName;
// }
//
// public Operation getOperation() {
// return operation;
// }
//
// public void setOperation(Operation operation) {
// this.operation = operation;
// }
//
// public Object getValue() {
// return value;
// }
//
// public void setValue(Object value) {
// this.value = value;
// }
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchRequest.java
// public class SearchRequest extends BaseType {
//
// private String topic;
// private String[] fieldNames;
// private CompositeCriteria searchCriteria;
// private Long maxRows;
// private Long startRow;
//
// public String[] getFieldNames() {
// return fieldNames;
// }
//
// public void setFieldNames(String[] fieldNames) {
// this.fieldNames = fieldNames;
// }
//
// public CompositeCriteria getSearchCriteria() {
// return searchCriteria;
// }
//
// public void setSearchCriteria(CompositeCriteria searchCriteria) {
// this.searchCriteria = searchCriteria;
// }
//
// public Long getMaxRows() {
// return maxRows;
// }
//
// public void setMaxRows(Long maxRows) {
// this.maxRows = maxRows;
// }
//
// public String getTopic() {
// return topic;
// }
//
// public void setTopic(String topic) {
// this.topic = topic;
// }
//
// public Long getStartRow() {
// return startRow;
// }
//
// public void setStartRow(Long startRow) {
// this.startRow = startRow;
// }
//
//
// }
// Path: moneta-core/src/test/java/org/moneta/SearchRequestFactoryTest.java
import java.util.Arrays;
import org.apache.commons.lang3.StringUtils;
import org.force66.mock.servletapi.MockRequest;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.moneta.config.MonetaEnvironment;
import org.moneta.types.search.CompositeCriteria;
import org.moneta.types.search.Criteria;
import org.moneta.types.search.FilterCriteria;
import org.moneta.types.search.SearchRequest;
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta;
public class SearchRequestFactoryTest extends MonetaTestBase {
private SearchRequestFactory factory;
private MockRequest request;
@Before
public void setUp() throws Exception {
super.setUp();
factory = new SearchRequestFactory();
request = new MockRequest();
}
@Test
public void testDeriveSearchRequest() throws Exception {
request.setUri("/myapp", null);
testException("Search topic not provided");
request.setUri("/myapp", "/crap");
testException("Topic not configured");
testException("crap");
request.setUri("/myapp", "/Environment/one/too/too/many");
testException("Search key in request uri not configured");
testException("many");
request.setUri("/myapp", "/Environment/one/two/three");
|
SearchRequest searchRequest = factory.deriveSearchRequest(request);
|
Derek-Ashmore/moneta
|
moneta-core/src/test/java/org/moneta/SearchRequestFactoryTest.java
|
// Path: moneta-core/src/main/java/org/moneta/config/MonetaEnvironment.java
// public class MonetaEnvironment extends BaseType {
//
// private static MonetaConfiguration configuration;
//
// public static MonetaConfiguration getConfiguration() {
// return configuration;
// }
//
// public static void setConfiguration(MonetaConfiguration configuration) {
// MonetaEnvironment.configuration = configuration;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/CompositeCriteria.java
// public class CompositeCriteria extends BaseType implements Criteria {
//
// public static enum Operator {AND, OR};
//
// private Operator operator;
// private Criteria[] searchCriteria;
//
// public Operator getOperator() {
// return operator;
// }
//
// public void setOperator(Operator operator) {
// this.operator = operator;
// }
//
// public Criteria[] getSearchCriteria() {
// return searchCriteria;
// }
//
// public void setSearchCriteria(Criteria[] searchCriteria) {
// this.searchCriteria = searchCriteria;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/Criteria.java
// public interface Criteria {
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/FilterCriteria.java
// public class FilterCriteria extends BaseType implements Criteria {
//
// public static enum Operation {EQUAL, NOT_EQUAL, GREATER_THAN, LESS_THAN, IS_NULL, IS_NOT_NULL, LIKE};
//
// private String fieldName;
// private Operation operation;
// private Object value;
//
// public String getFieldName() {
// return fieldName;
// }
//
// public void setFieldName(String fieldName) {
// this.fieldName = fieldName;
// }
//
// public Operation getOperation() {
// return operation;
// }
//
// public void setOperation(Operation operation) {
// this.operation = operation;
// }
//
// public Object getValue() {
// return value;
// }
//
// public void setValue(Object value) {
// this.value = value;
// }
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchRequest.java
// public class SearchRequest extends BaseType {
//
// private String topic;
// private String[] fieldNames;
// private CompositeCriteria searchCriteria;
// private Long maxRows;
// private Long startRow;
//
// public String[] getFieldNames() {
// return fieldNames;
// }
//
// public void setFieldNames(String[] fieldNames) {
// this.fieldNames = fieldNames;
// }
//
// public CompositeCriteria getSearchCriteria() {
// return searchCriteria;
// }
//
// public void setSearchCriteria(CompositeCriteria searchCriteria) {
// this.searchCriteria = searchCriteria;
// }
//
// public Long getMaxRows() {
// return maxRows;
// }
//
// public void setMaxRows(Long maxRows) {
// this.maxRows = maxRows;
// }
//
// public String getTopic() {
// return topic;
// }
//
// public void setTopic(String topic) {
// this.topic = topic;
// }
//
// public Long getStartRow() {
// return startRow;
// }
//
// public void setStartRow(Long startRow) {
// this.startRow = startRow;
// }
//
//
// }
|
import java.util.Arrays;
import org.apache.commons.lang3.StringUtils;
import org.force66.mock.servletapi.MockRequest;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.moneta.config.MonetaEnvironment;
import org.moneta.types.search.CompositeCriteria;
import org.moneta.types.search.Criteria;
import org.moneta.types.search.FilterCriteria;
import org.moneta.types.search.SearchRequest;
|
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta;
public class SearchRequestFactoryTest extends MonetaTestBase {
private SearchRequestFactory factory;
private MockRequest request;
@Before
public void setUp() throws Exception {
super.setUp();
factory = new SearchRequestFactory();
request = new MockRequest();
}
@Test
public void testDeriveSearchRequest() throws Exception {
request.setUri("/myapp", null);
testException("Search topic not provided");
request.setUri("/myapp", "/crap");
testException("Topic not configured");
testException("crap");
request.setUri("/myapp", "/Environment/one/too/too/many");
testException("Search key in request uri not configured");
testException("many");
request.setUri("/myapp", "/Environment/one/two/three");
SearchRequest searchRequest = factory.deriveSearchRequest(request);
Assert.assertTrue(searchRequest != null);
Assert.assertTrue("Environment".equals(searchRequest.getTopic()));
|
// Path: moneta-core/src/main/java/org/moneta/config/MonetaEnvironment.java
// public class MonetaEnvironment extends BaseType {
//
// private static MonetaConfiguration configuration;
//
// public static MonetaConfiguration getConfiguration() {
// return configuration;
// }
//
// public static void setConfiguration(MonetaConfiguration configuration) {
// MonetaEnvironment.configuration = configuration;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/CompositeCriteria.java
// public class CompositeCriteria extends BaseType implements Criteria {
//
// public static enum Operator {AND, OR};
//
// private Operator operator;
// private Criteria[] searchCriteria;
//
// public Operator getOperator() {
// return operator;
// }
//
// public void setOperator(Operator operator) {
// this.operator = operator;
// }
//
// public Criteria[] getSearchCriteria() {
// return searchCriteria;
// }
//
// public void setSearchCriteria(Criteria[] searchCriteria) {
// this.searchCriteria = searchCriteria;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/Criteria.java
// public interface Criteria {
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/FilterCriteria.java
// public class FilterCriteria extends BaseType implements Criteria {
//
// public static enum Operation {EQUAL, NOT_EQUAL, GREATER_THAN, LESS_THAN, IS_NULL, IS_NOT_NULL, LIKE};
//
// private String fieldName;
// private Operation operation;
// private Object value;
//
// public String getFieldName() {
// return fieldName;
// }
//
// public void setFieldName(String fieldName) {
// this.fieldName = fieldName;
// }
//
// public Operation getOperation() {
// return operation;
// }
//
// public void setOperation(Operation operation) {
// this.operation = operation;
// }
//
// public Object getValue() {
// return value;
// }
//
// public void setValue(Object value) {
// this.value = value;
// }
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchRequest.java
// public class SearchRequest extends BaseType {
//
// private String topic;
// private String[] fieldNames;
// private CompositeCriteria searchCriteria;
// private Long maxRows;
// private Long startRow;
//
// public String[] getFieldNames() {
// return fieldNames;
// }
//
// public void setFieldNames(String[] fieldNames) {
// this.fieldNames = fieldNames;
// }
//
// public CompositeCriteria getSearchCriteria() {
// return searchCriteria;
// }
//
// public void setSearchCriteria(CompositeCriteria searchCriteria) {
// this.searchCriteria = searchCriteria;
// }
//
// public Long getMaxRows() {
// return maxRows;
// }
//
// public void setMaxRows(Long maxRows) {
// this.maxRows = maxRows;
// }
//
// public String getTopic() {
// return topic;
// }
//
// public void setTopic(String topic) {
// this.topic = topic;
// }
//
// public Long getStartRow() {
// return startRow;
// }
//
// public void setStartRow(Long startRow) {
// this.startRow = startRow;
// }
//
//
// }
// Path: moneta-core/src/test/java/org/moneta/SearchRequestFactoryTest.java
import java.util.Arrays;
import org.apache.commons.lang3.StringUtils;
import org.force66.mock.servletapi.MockRequest;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.moneta.config.MonetaEnvironment;
import org.moneta.types.search.CompositeCriteria;
import org.moneta.types.search.Criteria;
import org.moneta.types.search.FilterCriteria;
import org.moneta.types.search.SearchRequest;
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta;
public class SearchRequestFactoryTest extends MonetaTestBase {
private SearchRequestFactory factory;
private MockRequest request;
@Before
public void setUp() throws Exception {
super.setUp();
factory = new SearchRequestFactory();
request = new MockRequest();
}
@Test
public void testDeriveSearchRequest() throws Exception {
request.setUri("/myapp", null);
testException("Search topic not provided");
request.setUri("/myapp", "/crap");
testException("Topic not configured");
testException("crap");
request.setUri("/myapp", "/Environment/one/too/too/many");
testException("Search key in request uri not configured");
testException("many");
request.setUri("/myapp", "/Environment/one/two/three");
SearchRequest searchRequest = factory.deriveSearchRequest(request);
Assert.assertTrue(searchRequest != null);
Assert.assertTrue("Environment".equals(searchRequest.getTopic()));
|
CompositeCriteria searchCriteria = searchRequest.getSearchCriteria();
|
Derek-Ashmore/moneta
|
moneta-core/src/test/java/org/moneta/SearchRequestFactoryTest.java
|
// Path: moneta-core/src/main/java/org/moneta/config/MonetaEnvironment.java
// public class MonetaEnvironment extends BaseType {
//
// private static MonetaConfiguration configuration;
//
// public static MonetaConfiguration getConfiguration() {
// return configuration;
// }
//
// public static void setConfiguration(MonetaConfiguration configuration) {
// MonetaEnvironment.configuration = configuration;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/CompositeCriteria.java
// public class CompositeCriteria extends BaseType implements Criteria {
//
// public static enum Operator {AND, OR};
//
// private Operator operator;
// private Criteria[] searchCriteria;
//
// public Operator getOperator() {
// return operator;
// }
//
// public void setOperator(Operator operator) {
// this.operator = operator;
// }
//
// public Criteria[] getSearchCriteria() {
// return searchCriteria;
// }
//
// public void setSearchCriteria(Criteria[] searchCriteria) {
// this.searchCriteria = searchCriteria;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/Criteria.java
// public interface Criteria {
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/FilterCriteria.java
// public class FilterCriteria extends BaseType implements Criteria {
//
// public static enum Operation {EQUAL, NOT_EQUAL, GREATER_THAN, LESS_THAN, IS_NULL, IS_NOT_NULL, LIKE};
//
// private String fieldName;
// private Operation operation;
// private Object value;
//
// public String getFieldName() {
// return fieldName;
// }
//
// public void setFieldName(String fieldName) {
// this.fieldName = fieldName;
// }
//
// public Operation getOperation() {
// return operation;
// }
//
// public void setOperation(Operation operation) {
// this.operation = operation;
// }
//
// public Object getValue() {
// return value;
// }
//
// public void setValue(Object value) {
// this.value = value;
// }
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchRequest.java
// public class SearchRequest extends BaseType {
//
// private String topic;
// private String[] fieldNames;
// private CompositeCriteria searchCriteria;
// private Long maxRows;
// private Long startRow;
//
// public String[] getFieldNames() {
// return fieldNames;
// }
//
// public void setFieldNames(String[] fieldNames) {
// this.fieldNames = fieldNames;
// }
//
// public CompositeCriteria getSearchCriteria() {
// return searchCriteria;
// }
//
// public void setSearchCriteria(CompositeCriteria searchCriteria) {
// this.searchCriteria = searchCriteria;
// }
//
// public Long getMaxRows() {
// return maxRows;
// }
//
// public void setMaxRows(Long maxRows) {
// this.maxRows = maxRows;
// }
//
// public String getTopic() {
// return topic;
// }
//
// public void setTopic(String topic) {
// this.topic = topic;
// }
//
// public Long getStartRow() {
// return startRow;
// }
//
// public void setStartRow(Long startRow) {
// this.startRow = startRow;
// }
//
//
// }
|
import java.util.Arrays;
import org.apache.commons.lang3.StringUtils;
import org.force66.mock.servletapi.MockRequest;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.moneta.config.MonetaEnvironment;
import org.moneta.types.search.CompositeCriteria;
import org.moneta.types.search.Criteria;
import org.moneta.types.search.FilterCriteria;
import org.moneta.types.search.SearchRequest;
|
private void testCriteria(Criteria criteria, String fieldName, FilterCriteria.Operation operator, Object value) {
Assert.assertTrue(criteria instanceof FilterCriteria);
FilterCriteria filterCriteria = (FilterCriteria)criteria;
Assert.assertTrue(fieldName.equals(filterCriteria.getFieldName()));
Assert.assertTrue(operator.equals(filterCriteria.getOperation()));
Assert.assertTrue(value.equals(filterCriteria.getValue()));
}
private void testException(String testMessage) {
Throwable exceptionThrown=null;
try {factory.deriveSearchRequest(request);}
catch (Exception e) {
exceptionThrown=e;
}
Assert.assertTrue(exceptionThrown != null);
Assert.assertTrue(exceptionThrown.getMessage() != null);
Assert.assertTrue(exceptionThrown.getMessage().contains(testMessage));
}
@Test
public void testDeriveSearachNodes() throws Exception {
request.setUri("/myapp", "/Environment/one/two/three");
Assert.assertTrue(Arrays.deepEquals(factory.deriveSearchNodes(request),
StringUtils.split("/Environment/one/two/three", '/')));
request.setUri("", "/moneta/Environment");
Assert.assertTrue(Arrays.deepEquals(factory.deriveSearchNodes(request),
StringUtils.split("/moneta/Environment", '/')));
|
// Path: moneta-core/src/main/java/org/moneta/config/MonetaEnvironment.java
// public class MonetaEnvironment extends BaseType {
//
// private static MonetaConfiguration configuration;
//
// public static MonetaConfiguration getConfiguration() {
// return configuration;
// }
//
// public static void setConfiguration(MonetaConfiguration configuration) {
// MonetaEnvironment.configuration = configuration;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/CompositeCriteria.java
// public class CompositeCriteria extends BaseType implements Criteria {
//
// public static enum Operator {AND, OR};
//
// private Operator operator;
// private Criteria[] searchCriteria;
//
// public Operator getOperator() {
// return operator;
// }
//
// public void setOperator(Operator operator) {
// this.operator = operator;
// }
//
// public Criteria[] getSearchCriteria() {
// return searchCriteria;
// }
//
// public void setSearchCriteria(Criteria[] searchCriteria) {
// this.searchCriteria = searchCriteria;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/Criteria.java
// public interface Criteria {
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/FilterCriteria.java
// public class FilterCriteria extends BaseType implements Criteria {
//
// public static enum Operation {EQUAL, NOT_EQUAL, GREATER_THAN, LESS_THAN, IS_NULL, IS_NOT_NULL, LIKE};
//
// private String fieldName;
// private Operation operation;
// private Object value;
//
// public String getFieldName() {
// return fieldName;
// }
//
// public void setFieldName(String fieldName) {
// this.fieldName = fieldName;
// }
//
// public Operation getOperation() {
// return operation;
// }
//
// public void setOperation(Operation operation) {
// this.operation = operation;
// }
//
// public Object getValue() {
// return value;
// }
//
// public void setValue(Object value) {
// this.value = value;
// }
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchRequest.java
// public class SearchRequest extends BaseType {
//
// private String topic;
// private String[] fieldNames;
// private CompositeCriteria searchCriteria;
// private Long maxRows;
// private Long startRow;
//
// public String[] getFieldNames() {
// return fieldNames;
// }
//
// public void setFieldNames(String[] fieldNames) {
// this.fieldNames = fieldNames;
// }
//
// public CompositeCriteria getSearchCriteria() {
// return searchCriteria;
// }
//
// public void setSearchCriteria(CompositeCriteria searchCriteria) {
// this.searchCriteria = searchCriteria;
// }
//
// public Long getMaxRows() {
// return maxRows;
// }
//
// public void setMaxRows(Long maxRows) {
// this.maxRows = maxRows;
// }
//
// public String getTopic() {
// return topic;
// }
//
// public void setTopic(String topic) {
// this.topic = topic;
// }
//
// public Long getStartRow() {
// return startRow;
// }
//
// public void setStartRow(Long startRow) {
// this.startRow = startRow;
// }
//
//
// }
// Path: moneta-core/src/test/java/org/moneta/SearchRequestFactoryTest.java
import java.util.Arrays;
import org.apache.commons.lang3.StringUtils;
import org.force66.mock.servletapi.MockRequest;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.moneta.config.MonetaEnvironment;
import org.moneta.types.search.CompositeCriteria;
import org.moneta.types.search.Criteria;
import org.moneta.types.search.FilterCriteria;
import org.moneta.types.search.SearchRequest;
private void testCriteria(Criteria criteria, String fieldName, FilterCriteria.Operation operator, Object value) {
Assert.assertTrue(criteria instanceof FilterCriteria);
FilterCriteria filterCriteria = (FilterCriteria)criteria;
Assert.assertTrue(fieldName.equals(filterCriteria.getFieldName()));
Assert.assertTrue(operator.equals(filterCriteria.getOperation()));
Assert.assertTrue(value.equals(filterCriteria.getValue()));
}
private void testException(String testMessage) {
Throwable exceptionThrown=null;
try {factory.deriveSearchRequest(request);}
catch (Exception e) {
exceptionThrown=e;
}
Assert.assertTrue(exceptionThrown != null);
Assert.assertTrue(exceptionThrown.getMessage() != null);
Assert.assertTrue(exceptionThrown.getMessage().contains(testMessage));
}
@Test
public void testDeriveSearachNodes() throws Exception {
request.setUri("/myapp", "/Environment/one/two/three");
Assert.assertTrue(Arrays.deepEquals(factory.deriveSearchNodes(request),
StringUtils.split("/Environment/one/two/three", '/')));
request.setUri("", "/moneta/Environment");
Assert.assertTrue(Arrays.deepEquals(factory.deriveSearchNodes(request),
StringUtils.split("/moneta/Environment", '/')));
|
MonetaEnvironment.getConfiguration().setIgnoredContextPathNodes(new String[]{"moneta"});
|
Derek-Ashmore/moneta
|
moneta-core/src/test/java/org/moneta/MonetaTest.java
|
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchRequest.java
// public class SearchRequest extends BaseType {
//
// private String topic;
// private String[] fieldNames;
// private CompositeCriteria searchCriteria;
// private Long maxRows;
// private Long startRow;
//
// public String[] getFieldNames() {
// return fieldNames;
// }
//
// public void setFieldNames(String[] fieldNames) {
// this.fieldNames = fieldNames;
// }
//
// public CompositeCriteria getSearchCriteria() {
// return searchCriteria;
// }
//
// public void setSearchCriteria(CompositeCriteria searchCriteria) {
// this.searchCriteria = searchCriteria;
// }
//
// public Long getMaxRows() {
// return maxRows;
// }
//
// public void setMaxRows(Long maxRows) {
// this.maxRows = maxRows;
// }
//
// public String getTopic() {
// return topic;
// }
//
// public void setTopic(String topic) {
// this.topic = topic;
// }
//
// public Long getStartRow() {
// return startRow;
// }
//
// public void setStartRow(Long startRow) {
// this.startRow = startRow;
// }
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
// public class SearchResult extends BaseType {
//
// private Integer errorCode;
// private String errorMessage;
//
// @JsonProperty("records")
// private Record[] resultData;
//
// public Integer getErrorCode() {
// return errorCode;
// }
//
// public void setErrorCode(Integer errorCode) {
// this.errorCode = errorCode;
// }
//
// public String getErrorMessage() {
// return errorMessage;
// }
//
// public void setErrorMessage(String errorMessage) {
// this.errorMessage = errorMessage;
// }
//
// public Record[] getResultData() {
// return resultData;
// }
//
// public void setResultData(Record[] resultData) {
// this.resultData = resultData;
// }
//
// }
|
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.moneta.types.search.SearchRequest;
import org.moneta.types.search.SearchResult;
|
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta;
public class MonetaTest extends MonetaTestBase {
SearchRequest searchRequest;
Moneta moneta;
@Before
public void setUp() throws Exception {
super.setUp();
moneta = new Moneta();
searchRequest = new SearchRequest();
searchRequest.setTopic("Environment");
}
@Test
public void testBasic() throws Exception {
|
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchRequest.java
// public class SearchRequest extends BaseType {
//
// private String topic;
// private String[] fieldNames;
// private CompositeCriteria searchCriteria;
// private Long maxRows;
// private Long startRow;
//
// public String[] getFieldNames() {
// return fieldNames;
// }
//
// public void setFieldNames(String[] fieldNames) {
// this.fieldNames = fieldNames;
// }
//
// public CompositeCriteria getSearchCriteria() {
// return searchCriteria;
// }
//
// public void setSearchCriteria(CompositeCriteria searchCriteria) {
// this.searchCriteria = searchCriteria;
// }
//
// public Long getMaxRows() {
// return maxRows;
// }
//
// public void setMaxRows(Long maxRows) {
// this.maxRows = maxRows;
// }
//
// public String getTopic() {
// return topic;
// }
//
// public void setTopic(String topic) {
// this.topic = topic;
// }
//
// public Long getStartRow() {
// return startRow;
// }
//
// public void setStartRow(Long startRow) {
// this.startRow = startRow;
// }
//
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
// public class SearchResult extends BaseType {
//
// private Integer errorCode;
// private String errorMessage;
//
// @JsonProperty("records")
// private Record[] resultData;
//
// public Integer getErrorCode() {
// return errorCode;
// }
//
// public void setErrorCode(Integer errorCode) {
// this.errorCode = errorCode;
// }
//
// public String getErrorMessage() {
// return errorMessage;
// }
//
// public void setErrorMessage(String errorMessage) {
// this.errorMessage = errorMessage;
// }
//
// public Record[] getResultData() {
// return resultData;
// }
//
// public void setResultData(Record[] resultData) {
// this.resultData = resultData;
// }
//
// }
// Path: moneta-core/src/test/java/org/moneta/MonetaTest.java
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.moneta.types.search.SearchRequest;
import org.moneta.types.search.SearchResult;
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta;
public class MonetaTest extends MonetaTestBase {
SearchRequest searchRequest;
Moneta moneta;
@Before
public void setUp() throws Exception {
super.setUp();
moneta = new Moneta();
searchRequest = new SearchRequest();
searchRequest.setTopic("Environment");
}
@Test
public void testBasic() throws Exception {
|
SearchResult result = moneta.find(searchRequest);
|
Derek-Ashmore/moneta
|
moneta-core/src/main/java/org/moneta/dao/RecordResultSetHandler.java
|
// Path: moneta-core/src/main/java/org/moneta/types/Record.java
// public class Record extends BaseType {
//
// @JsonProperty("record")
// private Value[] values;
//
// public Value[] getValues() {
// return values;
// }
//
// public void setValues(Value[] values) {
// this.values = values;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/Value.java
// public class Value extends BaseType {
//
// private String name;
// private Object value;
//
// public Value() {}
// public Value(String name, Object value) {
// this.setName(name);
// this.setValue(value);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Object getValue() {
// return value;
// }
//
// public void setValue(Object value) {
// this.value = value;
// }
//
// }
|
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections4.map.CaseInsensitiveMap;
import org.apache.commons.dbutils.ResultSetHandler;
import org.moneta.types.Record;
import org.moneta.types.Value;
|
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.dao;
class RecordResultSetHandler implements ResultSetHandler<Record[]> {
private Long maxRows=null;
private Long startRow=null;
private Map<String,String> aliasMap = new CaseInsensitiveMap<String,String>();
public RecordResultSetHandler() {}
public Record[] handle(ResultSet rSet) throws SQLException {
ResultSetMetaData meta = rSet.getMetaData();
List<Record> recordList = new ArrayList<Record>();
Record record = null;
|
// Path: moneta-core/src/main/java/org/moneta/types/Record.java
// public class Record extends BaseType {
//
// @JsonProperty("record")
// private Value[] values;
//
// public Value[] getValues() {
// return values;
// }
//
// public void setValues(Value[] values) {
// this.values = values;
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/Value.java
// public class Value extends BaseType {
//
// private String name;
// private Object value;
//
// public Value() {}
// public Value(String name, Object value) {
// this.setName(name);
// this.setValue(value);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Object getValue() {
// return value;
// }
//
// public void setValue(Object value) {
// this.value = value;
// }
//
// }
// Path: moneta-core/src/main/java/org/moneta/dao/RecordResultSetHandler.java
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections4.map.CaseInsensitiveMap;
import org.apache.commons.dbutils.ResultSetHandler;
import org.moneta.types.Record;
import org.moneta.types.Value;
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.dao;
class RecordResultSetHandler implements ResultSetHandler<Record[]> {
private Long maxRows=null;
private Long startRow=null;
private Map<String,String> aliasMap = new CaseInsensitiveMap<String,String>();
public RecordResultSetHandler() {}
public Record[] handle(ResultSet rSet) throws SQLException {
ResultSetMetaData meta = rSet.getMetaData();
List<Record> recordList = new ArrayList<Record>();
Record record = null;
|
List<Value> valueList = null;
|
Derek-Ashmore/moneta
|
moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
|
// Path: moneta-core/src/main/java/org/moneta/types/BaseType.java
// public abstract class BaseType {
//
// private static final boolean TEST_TRANSIENTS = false;
//
// @Override
// public int hashCode() {
// return HashCodeBuilder.reflectionHashCode(this, TEST_TRANSIENTS);
// }
//
// @Override
// public boolean equals(Object obj) {
// return EqualsBuilder.reflectionEquals(this, obj, TEST_TRANSIENTS);
// }
//
// @Override
// public String toString() {
// return ToStringBuilder.reflectionToString(this);
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/Record.java
// public class Record extends BaseType {
//
// @JsonProperty("record")
// private Value[] values;
//
// public Value[] getValues() {
// return values;
// }
//
// public void setValues(Value[] values) {
// this.values = values;
// }
//
// }
|
import org.moneta.types.Record;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.moneta.types.BaseType;
|
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.types.search;
/**
* Contains the results of a topic search;
* @author D. Ashmore
*
*/
public class SearchResult extends BaseType {
private Integer errorCode;
private String errorMessage;
@JsonProperty("records")
|
// Path: moneta-core/src/main/java/org/moneta/types/BaseType.java
// public abstract class BaseType {
//
// private static final boolean TEST_TRANSIENTS = false;
//
// @Override
// public int hashCode() {
// return HashCodeBuilder.reflectionHashCode(this, TEST_TRANSIENTS);
// }
//
// @Override
// public boolean equals(Object obj) {
// return EqualsBuilder.reflectionEquals(this, obj, TEST_TRANSIENTS);
// }
//
// @Override
// public String toString() {
// return ToStringBuilder.reflectionToString(this);
// }
//
// }
//
// Path: moneta-core/src/main/java/org/moneta/types/Record.java
// public class Record extends BaseType {
//
// @JsonProperty("record")
// private Value[] values;
//
// public Value[] getValues() {
// return values;
// }
//
// public void setValues(Value[] values) {
// this.values = values;
// }
//
// }
// Path: moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
import org.moneta.types.Record;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.moneta.types.BaseType;
/*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.types.search;
/**
* Contains the results of a topic search;
* @author D. Ashmore
*
*/
public class SearchResult extends BaseType {
private Integer errorCode;
private String errorMessage;
@JsonProperty("records")
|
private Record[] resultData;
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/ConnectorConfigurationPlugin.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
|
import org.eclipse.jetty.server.*;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
public class ConnectorConfigurationPlugin extends JettyConsolePluginBase {
public static final int DEFAULT_PORT = 8080;
private int port = DEFAULT_PORT;
private String bindAddress = null;
private boolean forwarded = false;
private int requestHeaderSize = -1;
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/ConnectorConfigurationPlugin.java
import org.eclipse.jetty.server.*;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
public class ConnectorConfigurationPlugin extends JettyConsolePluginBase {
public static final int DEFAULT_PORT = 8080;
private int port = DEFAULT_PORT;
private String bindAddress = null;
private boolean forwarded = false;
private int requestHeaderSize = -1;
|
private StartOption portOption = new DefaultStartOption("port") {
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/ConnectorConfigurationPlugin.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
|
import org.eclipse.jetty.server.*;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
public class ConnectorConfigurationPlugin extends JettyConsolePluginBase {
public static final int DEFAULT_PORT = 8080;
private int port = DEFAULT_PORT;
private String bindAddress = null;
private boolean forwarded = false;
private int requestHeaderSize = -1;
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/ConnectorConfigurationPlugin.java
import org.eclipse.jetty.server.*;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
public class ConnectorConfigurationPlugin extends JettyConsolePluginBase {
public static final int DEFAULT_PORT = 8080;
private int port = DEFAULT_PORT;
private String bindAddress = null;
private boolean forwarded = false;
private int requestHeaderSize = -1;
|
private StartOption portOption = new DefaultStartOption("port") {
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleStarter.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePlugin.java
// public interface JettyConsolePlugin {
//
// List<StartOption> getStartOptions();
// void beforeStart(WebAppContext context);
// void beforeStop(WebAppContext context);
//
// void customizeServer(Server server);
//
// void customizeConnector(ServerConnector connector);
//
// void bootstrap();
//
// void configureConsole(Configuration configuration);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Settings.java
// public interface Settings {
// String getProperty(String name);
// Collection<String> getPropertyNames();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/MultiOutputStream.java
// public class MultiOutputStream extends OutputStream {
//
// private List outputStreams = new ArrayList();
//
// public MultiOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void addOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void write(int i) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(i);
// }
// }
//
// public void write(byte[] bytes) throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.write(bytes);
// }
// }
//
// public void write(byte[] bytes, int i, int i1) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(bytes, i, i1);
// }
// }
//
// public void flush() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.flush();
// }
// }
//
// public void close() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.close();
// }
// }
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleBootstrapMainClass.java
// public static void usage() {
// usage(null);
// }
|
import org.eclipse.jetty.util.IO;
import org.kantega.jexmec.ServiceKey;
import org.kantega.jexmec.ctor.ConstructorInjectionPluginLoader;
import org.kantega.jexmec.manager.DefaultPluginManager;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.JettyConsolePlugin;
import org.simplericity.jettyconsole.api.Settings;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.io.MultiOutputStream;
import org.simplericity.macify.eawt.Application;
import org.simplericity.macify.eawt.ApplicationAdapter;
import org.simplericity.macify.eawt.ApplicationEvent;
import org.simplericity.macify.eawt.DefaultApplication;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;
import static org.simplericity.jettyconsole.JettyConsoleBootstrapMainClass.usage;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole;
/**
* Wrapper for the JettyConsole that:
* <ul>
* <li>makes sure System.out and System are redirected before any output/logging is done</li>
* <li>sets up capturing of the quit callbacks on Apply by way of reflection</li>
* </ul>
*/
public class JettyConsoleStarter extends ApplicationAdapter {
private JettyConsole console;
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePlugin.java
// public interface JettyConsolePlugin {
//
// List<StartOption> getStartOptions();
// void beforeStart(WebAppContext context);
// void beforeStop(WebAppContext context);
//
// void customizeServer(Server server);
//
// void customizeConnector(ServerConnector connector);
//
// void bootstrap();
//
// void configureConsole(Configuration configuration);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Settings.java
// public interface Settings {
// String getProperty(String name);
// Collection<String> getPropertyNames();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/MultiOutputStream.java
// public class MultiOutputStream extends OutputStream {
//
// private List outputStreams = new ArrayList();
//
// public MultiOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void addOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void write(int i) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(i);
// }
// }
//
// public void write(byte[] bytes) throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.write(bytes);
// }
// }
//
// public void write(byte[] bytes, int i, int i1) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(bytes, i, i1);
// }
// }
//
// public void flush() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.flush();
// }
// }
//
// public void close() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.close();
// }
// }
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleBootstrapMainClass.java
// public static void usage() {
// usage(null);
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleStarter.java
import org.eclipse.jetty.util.IO;
import org.kantega.jexmec.ServiceKey;
import org.kantega.jexmec.ctor.ConstructorInjectionPluginLoader;
import org.kantega.jexmec.manager.DefaultPluginManager;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.JettyConsolePlugin;
import org.simplericity.jettyconsole.api.Settings;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.io.MultiOutputStream;
import org.simplericity.macify.eawt.Application;
import org.simplericity.macify.eawt.ApplicationAdapter;
import org.simplericity.macify.eawt.ApplicationEvent;
import org.simplericity.macify.eawt.DefaultApplication;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;
import static org.simplericity.jettyconsole.JettyConsoleBootstrapMainClass.usage;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole;
/**
* Wrapper for the JettyConsole that:
* <ul>
* <li>makes sure System.out and System are redirected before any output/logging is done</li>
* <li>sets up capturing of the quit callbacks on Apply by way of reflection</li>
* </ul>
*/
public class JettyConsoleStarter extends ApplicationAdapter {
private JettyConsole console;
|
private DefaultPluginManager<JettyConsolePlugin> pluginManager;
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleStarter.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePlugin.java
// public interface JettyConsolePlugin {
//
// List<StartOption> getStartOptions();
// void beforeStart(WebAppContext context);
// void beforeStop(WebAppContext context);
//
// void customizeServer(Server server);
//
// void customizeConnector(ServerConnector connector);
//
// void bootstrap();
//
// void configureConsole(Configuration configuration);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Settings.java
// public interface Settings {
// String getProperty(String name);
// Collection<String> getPropertyNames();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/MultiOutputStream.java
// public class MultiOutputStream extends OutputStream {
//
// private List outputStreams = new ArrayList();
//
// public MultiOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void addOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void write(int i) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(i);
// }
// }
//
// public void write(byte[] bytes) throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.write(bytes);
// }
// }
//
// public void write(byte[] bytes, int i, int i1) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(bytes, i, i1);
// }
// }
//
// public void flush() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.flush();
// }
// }
//
// public void close() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.close();
// }
// }
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleBootstrapMainClass.java
// public static void usage() {
// usage(null);
// }
|
import org.eclipse.jetty.util.IO;
import org.kantega.jexmec.ServiceKey;
import org.kantega.jexmec.ctor.ConstructorInjectionPluginLoader;
import org.kantega.jexmec.manager.DefaultPluginManager;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.JettyConsolePlugin;
import org.simplericity.jettyconsole.api.Settings;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.io.MultiOutputStream;
import org.simplericity.macify.eawt.Application;
import org.simplericity.macify.eawt.ApplicationAdapter;
import org.simplericity.macify.eawt.ApplicationEvent;
import org.simplericity.macify.eawt.DefaultApplication;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;
import static org.simplericity.jettyconsole.JettyConsoleBootstrapMainClass.usage;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole;
/**
* Wrapper for the JettyConsole that:
* <ul>
* <li>makes sure System.out and System are redirected before any output/logging is done</li>
* <li>sets up capturing of the quit callbacks on Apply by way of reflection</li>
* </ul>
*/
public class JettyConsoleStarter extends ApplicationAdapter {
private JettyConsole console;
private DefaultPluginManager<JettyConsolePlugin> pluginManager;
private PrintStream origOut = System.out;
private PrintStream origErr = System.err;
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePlugin.java
// public interface JettyConsolePlugin {
//
// List<StartOption> getStartOptions();
// void beforeStart(WebAppContext context);
// void beforeStop(WebAppContext context);
//
// void customizeServer(Server server);
//
// void customizeConnector(ServerConnector connector);
//
// void bootstrap();
//
// void configureConsole(Configuration configuration);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Settings.java
// public interface Settings {
// String getProperty(String name);
// Collection<String> getPropertyNames();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/MultiOutputStream.java
// public class MultiOutputStream extends OutputStream {
//
// private List outputStreams = new ArrayList();
//
// public MultiOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void addOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void write(int i) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(i);
// }
// }
//
// public void write(byte[] bytes) throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.write(bytes);
// }
// }
//
// public void write(byte[] bytes, int i, int i1) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(bytes, i, i1);
// }
// }
//
// public void flush() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.flush();
// }
// }
//
// public void close() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.close();
// }
// }
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleBootstrapMainClass.java
// public static void usage() {
// usage(null);
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleStarter.java
import org.eclipse.jetty.util.IO;
import org.kantega.jexmec.ServiceKey;
import org.kantega.jexmec.ctor.ConstructorInjectionPluginLoader;
import org.kantega.jexmec.manager.DefaultPluginManager;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.JettyConsolePlugin;
import org.simplericity.jettyconsole.api.Settings;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.io.MultiOutputStream;
import org.simplericity.macify.eawt.Application;
import org.simplericity.macify.eawt.ApplicationAdapter;
import org.simplericity.macify.eawt.ApplicationEvent;
import org.simplericity.macify.eawt.DefaultApplication;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;
import static org.simplericity.jettyconsole.JettyConsoleBootstrapMainClass.usage;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole;
/**
* Wrapper for the JettyConsole that:
* <ul>
* <li>makes sure System.out and System are redirected before any output/logging is done</li>
* <li>sets up capturing of the quit callbacks on Apply by way of reflection</li>
* </ul>
*/
public class JettyConsoleStarter extends ApplicationAdapter {
private JettyConsole console;
private DefaultPluginManager<JettyConsolePlugin> pluginManager;
private PrintStream origOut = System.out;
private PrintStream origErr = System.err;
|
private MultiOutputStream multiErr;
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleStarter.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePlugin.java
// public interface JettyConsolePlugin {
//
// List<StartOption> getStartOptions();
// void beforeStart(WebAppContext context);
// void beforeStop(WebAppContext context);
//
// void customizeServer(Server server);
//
// void customizeConnector(ServerConnector connector);
//
// void bootstrap();
//
// void configureConsole(Configuration configuration);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Settings.java
// public interface Settings {
// String getProperty(String name);
// Collection<String> getPropertyNames();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/MultiOutputStream.java
// public class MultiOutputStream extends OutputStream {
//
// private List outputStreams = new ArrayList();
//
// public MultiOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void addOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void write(int i) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(i);
// }
// }
//
// public void write(byte[] bytes) throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.write(bytes);
// }
// }
//
// public void write(byte[] bytes, int i, int i1) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(bytes, i, i1);
// }
// }
//
// public void flush() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.flush();
// }
// }
//
// public void close() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.close();
// }
// }
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleBootstrapMainClass.java
// public static void usage() {
// usage(null);
// }
|
import org.eclipse.jetty.util.IO;
import org.kantega.jexmec.ServiceKey;
import org.kantega.jexmec.ctor.ConstructorInjectionPluginLoader;
import org.kantega.jexmec.manager.DefaultPluginManager;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.JettyConsolePlugin;
import org.simplericity.jettyconsole.api.Settings;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.io.MultiOutputStream;
import org.simplericity.macify.eawt.Application;
import org.simplericity.macify.eawt.ApplicationAdapter;
import org.simplericity.macify.eawt.ApplicationEvent;
import org.simplericity.macify.eawt.DefaultApplication;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;
import static org.simplericity.jettyconsole.JettyConsoleBootstrapMainClass.usage;
|
public static File jettyWorkDirectory;
public static void main(String[] args) throws Exception {
starter = new JettyConsoleStarter();
starter.startPluginManager();
starter.run(starter.readConfiguration(args));
}
public static void stop() {
starter.shutdown();
}
private void shutdown() {
if(jettyManager != null) {
jettyManager.shutdown();
}
if(jettyWorkDirectory != null) {
IO.delete(jettyWorkDirectory);
}
}
private void startPluginManager() {
pluginManager = createPluginManager(getSettings());
pluginManager.start();
}
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePlugin.java
// public interface JettyConsolePlugin {
//
// List<StartOption> getStartOptions();
// void beforeStart(WebAppContext context);
// void beforeStop(WebAppContext context);
//
// void customizeServer(Server server);
//
// void customizeConnector(ServerConnector connector);
//
// void bootstrap();
//
// void configureConsole(Configuration configuration);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Settings.java
// public interface Settings {
// String getProperty(String name);
// Collection<String> getPropertyNames();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/MultiOutputStream.java
// public class MultiOutputStream extends OutputStream {
//
// private List outputStreams = new ArrayList();
//
// public MultiOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void addOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void write(int i) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(i);
// }
// }
//
// public void write(byte[] bytes) throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.write(bytes);
// }
// }
//
// public void write(byte[] bytes, int i, int i1) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(bytes, i, i1);
// }
// }
//
// public void flush() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.flush();
// }
// }
//
// public void close() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.close();
// }
// }
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleBootstrapMainClass.java
// public static void usage() {
// usage(null);
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleStarter.java
import org.eclipse.jetty.util.IO;
import org.kantega.jexmec.ServiceKey;
import org.kantega.jexmec.ctor.ConstructorInjectionPluginLoader;
import org.kantega.jexmec.manager.DefaultPluginManager;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.JettyConsolePlugin;
import org.simplericity.jettyconsole.api.Settings;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.io.MultiOutputStream;
import org.simplericity.macify.eawt.Application;
import org.simplericity.macify.eawt.ApplicationAdapter;
import org.simplericity.macify.eawt.ApplicationEvent;
import org.simplericity.macify.eawt.DefaultApplication;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;
import static org.simplericity.jettyconsole.JettyConsoleBootstrapMainClass.usage;
public static File jettyWorkDirectory;
public static void main(String[] args) throws Exception {
starter = new JettyConsoleStarter();
starter.startPluginManager();
starter.run(starter.readConfiguration(args));
}
public static void stop() {
starter.shutdown();
}
private void shutdown() {
if(jettyManager != null) {
jettyManager.shutdown();
}
if(jettyWorkDirectory != null) {
IO.delete(jettyWorkDirectory);
}
}
private void startPluginManager() {
pluginManager = createPluginManager(getSettings());
pluginManager.start();
}
|
private Configuration readConfiguration(String[] args) {
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleStarter.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePlugin.java
// public interface JettyConsolePlugin {
//
// List<StartOption> getStartOptions();
// void beforeStart(WebAppContext context);
// void beforeStop(WebAppContext context);
//
// void customizeServer(Server server);
//
// void customizeConnector(ServerConnector connector);
//
// void bootstrap();
//
// void configureConsole(Configuration configuration);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Settings.java
// public interface Settings {
// String getProperty(String name);
// Collection<String> getPropertyNames();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/MultiOutputStream.java
// public class MultiOutputStream extends OutputStream {
//
// private List outputStreams = new ArrayList();
//
// public MultiOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void addOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void write(int i) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(i);
// }
// }
//
// public void write(byte[] bytes) throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.write(bytes);
// }
// }
//
// public void write(byte[] bytes, int i, int i1) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(bytes, i, i1);
// }
// }
//
// public void flush() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.flush();
// }
// }
//
// public void close() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.close();
// }
// }
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleBootstrapMainClass.java
// public static void usage() {
// usage(null);
// }
|
import org.eclipse.jetty.util.IO;
import org.kantega.jexmec.ServiceKey;
import org.kantega.jexmec.ctor.ConstructorInjectionPluginLoader;
import org.kantega.jexmec.manager.DefaultPluginManager;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.JettyConsolePlugin;
import org.simplericity.jettyconsole.api.Settings;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.io.MultiOutputStream;
import org.simplericity.macify.eawt.Application;
import org.simplericity.macify.eawt.ApplicationAdapter;
import org.simplericity.macify.eawt.ApplicationEvent;
import org.simplericity.macify.eawt.DefaultApplication;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;
import static org.simplericity.jettyconsole.JettyConsoleBootstrapMainClass.usage;
|
starter = new JettyConsoleStarter();
starter.startPluginManager();
starter.run(starter.readConfiguration(args));
}
public static void stop() {
starter.shutdown();
}
private void shutdown() {
if(jettyManager != null) {
jettyManager.shutdown();
}
if(jettyWorkDirectory != null) {
IO.delete(jettyWorkDirectory);
}
}
private void startPluginManager() {
pluginManager = createPluginManager(getSettings());
pluginManager.start();
}
private Configuration readConfiguration(String[] args) {
return parseCommandLine(args, new DefaultConfiguration());
}
private Configuration parseCommandLine(String[] args, Configuration configuration) {
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePlugin.java
// public interface JettyConsolePlugin {
//
// List<StartOption> getStartOptions();
// void beforeStart(WebAppContext context);
// void beforeStop(WebAppContext context);
//
// void customizeServer(Server server);
//
// void customizeConnector(ServerConnector connector);
//
// void bootstrap();
//
// void configureConsole(Configuration configuration);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Settings.java
// public interface Settings {
// String getProperty(String name);
// Collection<String> getPropertyNames();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/MultiOutputStream.java
// public class MultiOutputStream extends OutputStream {
//
// private List outputStreams = new ArrayList();
//
// public MultiOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void addOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void write(int i) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(i);
// }
// }
//
// public void write(byte[] bytes) throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.write(bytes);
// }
// }
//
// public void write(byte[] bytes, int i, int i1) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(bytes, i, i1);
// }
// }
//
// public void flush() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.flush();
// }
// }
//
// public void close() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.close();
// }
// }
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleBootstrapMainClass.java
// public static void usage() {
// usage(null);
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleStarter.java
import org.eclipse.jetty.util.IO;
import org.kantega.jexmec.ServiceKey;
import org.kantega.jexmec.ctor.ConstructorInjectionPluginLoader;
import org.kantega.jexmec.manager.DefaultPluginManager;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.JettyConsolePlugin;
import org.simplericity.jettyconsole.api.Settings;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.io.MultiOutputStream;
import org.simplericity.macify.eawt.Application;
import org.simplericity.macify.eawt.ApplicationAdapter;
import org.simplericity.macify.eawt.ApplicationEvent;
import org.simplericity.macify.eawt.DefaultApplication;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;
import static org.simplericity.jettyconsole.JettyConsoleBootstrapMainClass.usage;
starter = new JettyConsoleStarter();
starter.startPluginManager();
starter.run(starter.readConfiguration(args));
}
public static void stop() {
starter.shutdown();
}
private void shutdown() {
if(jettyManager != null) {
jettyManager.shutdown();
}
if(jettyWorkDirectory != null) {
IO.delete(jettyWorkDirectory);
}
}
private void startPluginManager() {
pluginManager = createPluginManager(getSettings());
pluginManager.start();
}
private Configuration readConfiguration(String[] args) {
return parseCommandLine(args, new DefaultConfiguration());
}
private Configuration parseCommandLine(String[] args, Configuration configuration) {
|
Map<String, StartOption> pluginOptions = createOptionByNameMap();
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleStarter.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePlugin.java
// public interface JettyConsolePlugin {
//
// List<StartOption> getStartOptions();
// void beforeStart(WebAppContext context);
// void beforeStop(WebAppContext context);
//
// void customizeServer(Server server);
//
// void customizeConnector(ServerConnector connector);
//
// void bootstrap();
//
// void configureConsole(Configuration configuration);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Settings.java
// public interface Settings {
// String getProperty(String name);
// Collection<String> getPropertyNames();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/MultiOutputStream.java
// public class MultiOutputStream extends OutputStream {
//
// private List outputStreams = new ArrayList();
//
// public MultiOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void addOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void write(int i) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(i);
// }
// }
//
// public void write(byte[] bytes) throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.write(bytes);
// }
// }
//
// public void write(byte[] bytes, int i, int i1) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(bytes, i, i1);
// }
// }
//
// public void flush() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.flush();
// }
// }
//
// public void close() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.close();
// }
// }
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleBootstrapMainClass.java
// public static void usage() {
// usage(null);
// }
|
import org.eclipse.jetty.util.IO;
import org.kantega.jexmec.ServiceKey;
import org.kantega.jexmec.ctor.ConstructorInjectionPluginLoader;
import org.kantega.jexmec.manager.DefaultPluginManager;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.JettyConsolePlugin;
import org.simplericity.jettyconsole.api.Settings;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.io.MultiOutputStream;
import org.simplericity.macify.eawt.Application;
import org.simplericity.macify.eawt.ApplicationAdapter;
import org.simplericity.macify.eawt.ApplicationEvent;
import org.simplericity.macify.eawt.DefaultApplication;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;
import static org.simplericity.jettyconsole.JettyConsoleBootstrapMainClass.usage;
|
public static void stop() {
starter.shutdown();
}
private void shutdown() {
if(jettyManager != null) {
jettyManager.shutdown();
}
if(jettyWorkDirectory != null) {
IO.delete(jettyWorkDirectory);
}
}
private void startPluginManager() {
pluginManager = createPluginManager(getSettings());
pluginManager.start();
}
private Configuration readConfiguration(String[] args) {
return parseCommandLine(args, new DefaultConfiguration());
}
private Configuration parseCommandLine(String[] args, Configuration configuration) {
Map<String, StartOption> pluginOptions = createOptionByNameMap();
Map<String, JettyConsoleBootstrapMainClass.Option> declaredOptions = JettyConsoleBootstrapMainClass.getOptionsByName();
for (int i = 0; i < args.length; i++) {
String arg = args[i].trim();
if (!arg.startsWith("--")) {
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePlugin.java
// public interface JettyConsolePlugin {
//
// List<StartOption> getStartOptions();
// void beforeStart(WebAppContext context);
// void beforeStop(WebAppContext context);
//
// void customizeServer(Server server);
//
// void customizeConnector(ServerConnector connector);
//
// void bootstrap();
//
// void configureConsole(Configuration configuration);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Settings.java
// public interface Settings {
// String getProperty(String name);
// Collection<String> getPropertyNames();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/MultiOutputStream.java
// public class MultiOutputStream extends OutputStream {
//
// private List outputStreams = new ArrayList();
//
// public MultiOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void addOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void write(int i) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(i);
// }
// }
//
// public void write(byte[] bytes) throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.write(bytes);
// }
// }
//
// public void write(byte[] bytes, int i, int i1) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(bytes, i, i1);
// }
// }
//
// public void flush() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.flush();
// }
// }
//
// public void close() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.close();
// }
// }
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleBootstrapMainClass.java
// public static void usage() {
// usage(null);
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleStarter.java
import org.eclipse.jetty.util.IO;
import org.kantega.jexmec.ServiceKey;
import org.kantega.jexmec.ctor.ConstructorInjectionPluginLoader;
import org.kantega.jexmec.manager.DefaultPluginManager;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.JettyConsolePlugin;
import org.simplericity.jettyconsole.api.Settings;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.io.MultiOutputStream;
import org.simplericity.macify.eawt.Application;
import org.simplericity.macify.eawt.ApplicationAdapter;
import org.simplericity.macify.eawt.ApplicationEvent;
import org.simplericity.macify.eawt.DefaultApplication;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;
import static org.simplericity.jettyconsole.JettyConsoleBootstrapMainClass.usage;
public static void stop() {
starter.shutdown();
}
private void shutdown() {
if(jettyManager != null) {
jettyManager.shutdown();
}
if(jettyWorkDirectory != null) {
IO.delete(jettyWorkDirectory);
}
}
private void startPluginManager() {
pluginManager = createPluginManager(getSettings());
pluginManager.start();
}
private Configuration readConfiguration(String[] args) {
return parseCommandLine(args, new DefaultConfiguration());
}
private Configuration parseCommandLine(String[] args, Configuration configuration) {
Map<String, StartOption> pluginOptions = createOptionByNameMap();
Map<String, JettyConsoleBootstrapMainClass.Option> declaredOptions = JettyConsoleBootstrapMainClass.getOptionsByName();
for (int i = 0; i < args.length; i++) {
String arg = args[i].trim();
if (!arg.startsWith("--")) {
|
usage("Options must start with '--': " + arg);
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleStarter.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePlugin.java
// public interface JettyConsolePlugin {
//
// List<StartOption> getStartOptions();
// void beforeStart(WebAppContext context);
// void beforeStop(WebAppContext context);
//
// void customizeServer(Server server);
//
// void customizeConnector(ServerConnector connector);
//
// void bootstrap();
//
// void configureConsole(Configuration configuration);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Settings.java
// public interface Settings {
// String getProperty(String name);
// Collection<String> getPropertyNames();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/MultiOutputStream.java
// public class MultiOutputStream extends OutputStream {
//
// private List outputStreams = new ArrayList();
//
// public MultiOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void addOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void write(int i) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(i);
// }
// }
//
// public void write(byte[] bytes) throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.write(bytes);
// }
// }
//
// public void write(byte[] bytes, int i, int i1) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(bytes, i, i1);
// }
// }
//
// public void flush() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.flush();
// }
// }
//
// public void close() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.close();
// }
// }
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleBootstrapMainClass.java
// public static void usage() {
// usage(null);
// }
|
import org.eclipse.jetty.util.IO;
import org.kantega.jexmec.ServiceKey;
import org.kantega.jexmec.ctor.ConstructorInjectionPluginLoader;
import org.kantega.jexmec.manager.DefaultPluginManager;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.JettyConsolePlugin;
import org.simplericity.jettyconsole.api.Settings;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.io.MultiOutputStream;
import org.simplericity.macify.eawt.Application;
import org.simplericity.macify.eawt.ApplicationAdapter;
import org.simplericity.macify.eawt.ApplicationEvent;
import org.simplericity.macify.eawt.DefaultApplication;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;
import static org.simplericity.jettyconsole.JettyConsoleBootstrapMainClass.usage;
|
options.put(option.getName().toLowerCase(), option);
}
}
return options;
}
private void run(Configuration configuration) throws Exception {
setupStreams();
for (JettyConsolePlugin plugin : pluginManager.getPlugins()) {
plugin.configureConsole(configuration);
}
for (JettyConsolePlugin plugin : pluginManager.getPlugins()) {
plugin.bootstrap();
}
jettyManager = new DefaultJettyManager(getSettings(), pluginManager, jettyWorkDirectory);
if (configuration.isHeadless() || GraphicsEnvironment.isHeadless()) {
initConsoleApp(configuration, jettyManager);
} else {
initSwingApp(configuration, jettyManager);
}
}
private DefaultPluginManager<JettyConsolePlugin> createPluginManager(Properties settings) {
DefaultPluginManager<JettyConsolePlugin> manager = new DefaultPluginManager<>(JettyConsolePlugin.class);
manager.addPluginClassLoader(getClass().getClassLoader());
manager.addPluginLoader(new ConstructorInjectionPluginLoader<JettyConsolePlugin>());
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePlugin.java
// public interface JettyConsolePlugin {
//
// List<StartOption> getStartOptions();
// void beforeStart(WebAppContext context);
// void beforeStop(WebAppContext context);
//
// void customizeServer(Server server);
//
// void customizeConnector(ServerConnector connector);
//
// void bootstrap();
//
// void configureConsole(Configuration configuration);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Settings.java
// public interface Settings {
// String getProperty(String name);
// Collection<String> getPropertyNames();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/MultiOutputStream.java
// public class MultiOutputStream extends OutputStream {
//
// private List outputStreams = new ArrayList();
//
// public MultiOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void addOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void write(int i) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(i);
// }
// }
//
// public void write(byte[] bytes) throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.write(bytes);
// }
// }
//
// public void write(byte[] bytes, int i, int i1) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(bytes, i, i1);
// }
// }
//
// public void flush() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.flush();
// }
// }
//
// public void close() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.close();
// }
// }
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleBootstrapMainClass.java
// public static void usage() {
// usage(null);
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleStarter.java
import org.eclipse.jetty.util.IO;
import org.kantega.jexmec.ServiceKey;
import org.kantega.jexmec.ctor.ConstructorInjectionPluginLoader;
import org.kantega.jexmec.manager.DefaultPluginManager;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.JettyConsolePlugin;
import org.simplericity.jettyconsole.api.Settings;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.io.MultiOutputStream;
import org.simplericity.macify.eawt.Application;
import org.simplericity.macify.eawt.ApplicationAdapter;
import org.simplericity.macify.eawt.ApplicationEvent;
import org.simplericity.macify.eawt.DefaultApplication;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;
import static org.simplericity.jettyconsole.JettyConsoleBootstrapMainClass.usage;
options.put(option.getName().toLowerCase(), option);
}
}
return options;
}
private void run(Configuration configuration) throws Exception {
setupStreams();
for (JettyConsolePlugin plugin : pluginManager.getPlugins()) {
plugin.configureConsole(configuration);
}
for (JettyConsolePlugin plugin : pluginManager.getPlugins()) {
plugin.bootstrap();
}
jettyManager = new DefaultJettyManager(getSettings(), pluginManager, jettyWorkDirectory);
if (configuration.isHeadless() || GraphicsEnvironment.isHeadless()) {
initConsoleApp(configuration, jettyManager);
} else {
initSwingApp(configuration, jettyManager);
}
}
private DefaultPluginManager<JettyConsolePlugin> createPluginManager(Properties settings) {
DefaultPluginManager<JettyConsolePlugin> manager = new DefaultPluginManager<>(JettyConsolePlugin.class);
manager.addPluginClassLoader(getClass().getClassLoader());
manager.addPluginLoader(new ConstructorInjectionPluginLoader<JettyConsolePlugin>());
|
manager.addService(ServiceKey.by(Settings.class), new DefaultSettings(settings));
|
eirbjo/jetty-console
|
jetty-console-plugins/jetty-console-requestlog-plugin/src/main/java/org/simplericity/jettyconsole/requestlog/RequestLogPlugin.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
|
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.NCSARequestLog;
import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.server.handler.RequestLogHandler;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
import java.io.File;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.requestlog;
/**
*/
public class RequestLogPlugin extends JettyConsolePluginBase {
private File logFile;
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
// Path: jetty-console-plugins/jetty-console-requestlog-plugin/src/main/java/org/simplericity/jettyconsole/requestlog/RequestLogPlugin.java
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.NCSARequestLog;
import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.server.handler.RequestLogHandler;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
import java.io.File;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.requestlog;
/**
*/
public class RequestLogPlugin extends JettyConsolePluginBase {
private File logFile;
|
private StartOption requestLogOption = new DefaultStartOption("requestLog") {
|
eirbjo/jetty-console
|
jetty-console-plugins/jetty-console-requestlog-plugin/src/main/java/org/simplericity/jettyconsole/requestlog/RequestLogPlugin.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
|
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.NCSARequestLog;
import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.server.handler.RequestLogHandler;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
import java.io.File;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.requestlog;
/**
*/
public class RequestLogPlugin extends JettyConsolePluginBase {
private File logFile;
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
// Path: jetty-console-plugins/jetty-console-requestlog-plugin/src/main/java/org/simplericity/jettyconsole/requestlog/RequestLogPlugin.java
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.NCSARequestLog;
import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.server.handler.RequestLogHandler;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
import java.io.File;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.requestlog;
/**
*/
public class RequestLogPlugin extends JettyConsolePluginBase {
private File logFile;
|
private StartOption requestLogOption = new DefaultStartOption("requestLog") {
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/HeadlessConfigurationPlugin.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
|
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class HeadlessConfigurationPlugin extends JettyConsolePluginBase {
private boolean headless;
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/HeadlessConfigurationPlugin.java
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class HeadlessConfigurationPlugin extends JettyConsolePluginBase {
private boolean headless;
|
private StartOption headLessOption = new DefaultStartOption("headless") {
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/HeadlessConfigurationPlugin.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
|
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class HeadlessConfigurationPlugin extends JettyConsolePluginBase {
private boolean headless;
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/HeadlessConfigurationPlugin.java
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class HeadlessConfigurationPlugin extends JettyConsolePluginBase {
private boolean headless;
|
private StartOption headLessOption = new DefaultStartOption("headless") {
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/HeadlessConfigurationPlugin.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
|
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class HeadlessConfigurationPlugin extends JettyConsolePluginBase {
private boolean headless;
private StartOption headLessOption = new DefaultStartOption("headless") {
@Override
public String validate() {
headless = true;
return null;
}
};
public HeadlessConfigurationPlugin() {
super(HeadlessConfigurationPlugin.class);
addStartOptions(headLessOption);
}
@Override
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/HeadlessConfigurationPlugin.java
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class HeadlessConfigurationPlugin extends JettyConsolePluginBase {
private boolean headless;
private StartOption headLessOption = new DefaultStartOption("headless") {
@Override
public String validate() {
headless = true;
return null;
}
};
public HeadlessConfigurationPlugin() {
super(HeadlessConfigurationPlugin.class);
addStartOptions(headLessOption);
}
@Override
|
public void configureConsole(Configuration configuration) {
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleBootstrapMainClass.java
|
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/ConnectorConfigurationPlugin.java
// public class ConnectorConfigurationPlugin extends JettyConsolePluginBase {
//
// public static final int DEFAULT_PORT = 8080;
// private int port = DEFAULT_PORT;
// private String bindAddress = null;
// private boolean forwarded = false;
//
// private int requestHeaderSize = -1;
//
// private StartOption portOption = new DefaultStartOption("port") {
// @Override
// public String validate(String value) {
// final String msg = "--port option requires a numerical value between 1 and 65535";
// try {
// int port = Integer.parseInt(value);
// if(port < 1 || port > 65535) {
// return msg;
// }
// ConnectorConfigurationPlugin.this.port = port;
//
// } catch (NumberFormatException e) {
// return msg;
// }
// return null;
// }
// };
//
// private StartOption bindAddressOption = new DefaultStartOption("bindAddress") {
// @Override
// public String validate(String value) {
// bindAddress = value;
// return null;
// }
// };
//
// private StartOption forwardedOption = new DefaultStartOption("forwarded") {
// @Override
// public String validate() {
// forwarded = true;
// return null;
// }
// };
//
//
// private StartOption requestHeaderSizeOption = new RequestHeaderStartOption();
//
// public ConnectorConfigurationPlugin() {
// super(ConnectorConfigurationPlugin.class);
// addStartOptions(portOption, bindAddressOption, forwardedOption, requestHeaderSizeOption);
// }
//
// @Override
// public void customizeConnector(ServerConnector connector) {
// connector.setPort(port);
// if(bindAddress != null) {
// connector.setHost(bindAddress);
// }
// HttpConfiguration config = connector.getConnectionFactory(HttpConnectionFactory.class).getHttpConfiguration();
// if(forwarded) {
// config.addCustomizer(new ForwardedRequestCustomizer());
// }
//
// if(requestHeaderSize != -1){
// config.setRequestHeaderSize(requestHeaderSize);
// }
// }
//
//
// private class RequestHeaderStartOption extends DefaultStartOption {
// private RequestHeaderStartOption() {
// super("requestHeaderSize");
// }
//
// public String validate(String value) {
// final String illegalRequestHeaderSize = "--requestHeaderSize option requires a numerical value larger than 1";
//
// try {
// requestHeaderSize = Integer.parseInt(value);
// } catch (NumberFormatException e){
// return illegalRequestHeaderSize;
// }
// if(requestHeaderSize < 1){
// return illegalRequestHeaderSize;
// }
// return null;
// }
//
// }
// }
|
import org.simplericity.jettyconsole.plugins.ConnectorConfigurationPlugin;
import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.net.URLDecoder;
import java.util.*;
import java.util.jar.JarEntry;
import java.util.jar.JarInputStream;
|
return optionsByName;
}
private File createTempDirectory(String name, int port) {
File javaTemp = new File(System.getProperty("java.io.tmpdir"));
File temp = new File(javaTemp, name +"_" + port);
temp.deleteOnExit();
temp.mkdirs();
return temp;
}
private int getPort(String[] arguments) {
for (int i = 0; i < arguments.length; i++) {
String argument = arguments[i];
if("--port".equals(argument)) {
if(i +1 == arguments.length ){
err("--port option requires a value");
}
try {
return Integer.parseInt(arguments[i + 1]);
} catch (NumberFormatException e) {
err("--port value must be an integer");
}
i+=2;
}
}
|
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/ConnectorConfigurationPlugin.java
// public class ConnectorConfigurationPlugin extends JettyConsolePluginBase {
//
// public static final int DEFAULT_PORT = 8080;
// private int port = DEFAULT_PORT;
// private String bindAddress = null;
// private boolean forwarded = false;
//
// private int requestHeaderSize = -1;
//
// private StartOption portOption = new DefaultStartOption("port") {
// @Override
// public String validate(String value) {
// final String msg = "--port option requires a numerical value between 1 and 65535";
// try {
// int port = Integer.parseInt(value);
// if(port < 1 || port > 65535) {
// return msg;
// }
// ConnectorConfigurationPlugin.this.port = port;
//
// } catch (NumberFormatException e) {
// return msg;
// }
// return null;
// }
// };
//
// private StartOption bindAddressOption = new DefaultStartOption("bindAddress") {
// @Override
// public String validate(String value) {
// bindAddress = value;
// return null;
// }
// };
//
// private StartOption forwardedOption = new DefaultStartOption("forwarded") {
// @Override
// public String validate() {
// forwarded = true;
// return null;
// }
// };
//
//
// private StartOption requestHeaderSizeOption = new RequestHeaderStartOption();
//
// public ConnectorConfigurationPlugin() {
// super(ConnectorConfigurationPlugin.class);
// addStartOptions(portOption, bindAddressOption, forwardedOption, requestHeaderSizeOption);
// }
//
// @Override
// public void customizeConnector(ServerConnector connector) {
// connector.setPort(port);
// if(bindAddress != null) {
// connector.setHost(bindAddress);
// }
// HttpConfiguration config = connector.getConnectionFactory(HttpConnectionFactory.class).getHttpConfiguration();
// if(forwarded) {
// config.addCustomizer(new ForwardedRequestCustomizer());
// }
//
// if(requestHeaderSize != -1){
// config.setRequestHeaderSize(requestHeaderSize);
// }
// }
//
//
// private class RequestHeaderStartOption extends DefaultStartOption {
// private RequestHeaderStartOption() {
// super("requestHeaderSize");
// }
//
// public String validate(String value) {
// final String illegalRequestHeaderSize = "--requestHeaderSize option requires a numerical value larger than 1";
//
// try {
// requestHeaderSize = Integer.parseInt(value);
// } catch (NumberFormatException e){
// return illegalRequestHeaderSize;
// }
// if(requestHeaderSize < 1){
// return illegalRequestHeaderSize;
// }
// return null;
// }
//
// }
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleBootstrapMainClass.java
import org.simplericity.jettyconsole.plugins.ConnectorConfigurationPlugin;
import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.net.URLDecoder;
import java.util.*;
import java.util.jar.JarEntry;
import java.util.jar.JarInputStream;
return optionsByName;
}
private File createTempDirectory(String name, int port) {
File javaTemp = new File(System.getProperty("java.io.tmpdir"));
File temp = new File(javaTemp, name +"_" + port);
temp.deleteOnExit();
temp.mkdirs();
return temp;
}
private int getPort(String[] arguments) {
for (int i = 0; i < arguments.length; i++) {
String argument = arguments[i];
if("--port".equals(argument)) {
if(i +1 == arguments.length ){
err("--port option requires a value");
}
try {
return Integer.parseInt(arguments[i + 1]);
} catch (NumberFormatException e) {
err("--port value must be an integer");
}
i+=2;
}
}
|
return ConnectorConfigurationPlugin.DEFAULT_PORT;
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/InitParamConfigurationPlugin.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
|
import org.eclipse.jetty.webapp.WebAppContext;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import java.util.HashMap;
import java.util.Map;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class InitParamConfigurationPlugin extends JettyConsolePluginBase {
private Map<String, String> initParams = new HashMap<String, String>();
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/InitParamConfigurationPlugin.java
import org.eclipse.jetty.webapp.WebAppContext;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import java.util.HashMap;
import java.util.Map;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class InitParamConfigurationPlugin extends JettyConsolePluginBase {
private Map<String, String> initParams = new HashMap<String, String>();
|
private StartOption initParamOption = new DefaultStartOption("initParam") {
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/InitParamConfigurationPlugin.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
|
import org.eclipse.jetty.webapp.WebAppContext;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import java.util.HashMap;
import java.util.Map;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class InitParamConfigurationPlugin extends JettyConsolePluginBase {
private Map<String, String> initParams = new HashMap<String, String>();
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/InitParamConfigurationPlugin.java
import org.eclipse.jetty.webapp.WebAppContext;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import java.util.HashMap;
import java.util.Map;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class InitParamConfigurationPlugin extends JettyConsolePluginBase {
private Map<String, String> initParams = new HashMap<String, String>();
|
private StartOption initParamOption = new DefaultStartOption("initParam") {
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/DirAllowedPlugin.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
|
import org.eclipse.jetty.webapp.WebAppContext;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class DirAllowedPlugin extends JettyConsolePluginBase {
private boolean dirAllowed = false;
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/DirAllowedPlugin.java
import org.eclipse.jetty.webapp.WebAppContext;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class DirAllowedPlugin extends JettyConsolePluginBase {
private boolean dirAllowed = false;
|
private StartOption dirAllowedOption = new DefaultStartOption("dirAllowed") {
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/DirAllowedPlugin.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
|
import org.eclipse.jetty.webapp.WebAppContext;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class DirAllowedPlugin extends JettyConsolePluginBase {
private boolean dirAllowed = false;
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/DirAllowedPlugin.java
import org.eclipse.jetty.webapp.WebAppContext;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class DirAllowedPlugin extends JettyConsolePluginBase {
private boolean dirAllowed = false;
|
private StartOption dirAllowedOption = new DefaultStartOption("dirAllowed") {
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/SSLProxyPlugin.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
|
import org.eclipse.jetty.server.*;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.util.URIUtil;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class SSLProxyPlugin extends JettyConsolePluginBase {
private boolean sslProxy = false;
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/SSLProxyPlugin.java
import org.eclipse.jetty.server.*;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.util.URIUtil;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class SSLProxyPlugin extends JettyConsolePluginBase {
private boolean sslProxy = false;
|
private StartOption sslOption = new DefaultStartOption("sslProxied") {
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/SSLProxyPlugin.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
|
import org.eclipse.jetty.server.*;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.util.URIUtil;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class SSLProxyPlugin extends JettyConsolePluginBase {
private boolean sslProxy = false;
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/SSLProxyPlugin.java
import org.eclipse.jetty.server.*;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.util.URIUtil;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class SSLProxyPlugin extends JettyConsolePluginBase {
private boolean sslProxy = false;
|
private StartOption sslOption = new DefaultStartOption("sslProxied") {
|
eirbjo/jetty-console
|
jetty-console-plugins/jetty-console-log4j-plugin/src/main/java/org/simplericity/jettyconsole/log4j/Log4jPlugin.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
|
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.apache.log4j.PropertyConfigurator;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;
import org.apache.log4j.Level;
import org.eclipse.jetty.webapp.WebAppContext;
import java.io.File;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.log4j;
/**
*/
public class Log4jPlugin extends JettyConsolePluginBase {
private File logFile;
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
// Path: jetty-console-plugins/jetty-console-log4j-plugin/src/main/java/org/simplericity/jettyconsole/log4j/Log4jPlugin.java
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.apache.log4j.PropertyConfigurator;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;
import org.apache.log4j.Level;
import org.eclipse.jetty.webapp.WebAppContext;
import java.io.File;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.log4j;
/**
*/
public class Log4jPlugin extends JettyConsolePluginBase {
private File logFile;
|
private StartOption logFileOption = new DefaultStartOption("logConfig") {
|
eirbjo/jetty-console
|
jetty-console-plugins/jetty-console-log4j-plugin/src/main/java/org/simplericity/jettyconsole/log4j/Log4jPlugin.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
|
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.apache.log4j.PropertyConfigurator;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;
import org.apache.log4j.Level;
import org.eclipse.jetty.webapp.WebAppContext;
import java.io.File;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.log4j;
/**
*/
public class Log4jPlugin extends JettyConsolePluginBase {
private File logFile;
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
// Path: jetty-console-plugins/jetty-console-log4j-plugin/src/main/java/org/simplericity/jettyconsole/log4j/Log4jPlugin.java
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.apache.log4j.PropertyConfigurator;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;
import org.apache.log4j.Level;
import org.eclipse.jetty.webapp.WebAppContext;
import java.io.File;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.log4j;
/**
*/
public class Log4jPlugin extends JettyConsolePluginBase {
private File logFile;
|
private StartOption logFileOption = new DefaultStartOption("logConfig") {
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/ExtractWarPlugin.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
|
import org.eclipse.jetty.webapp.WebAppContext;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class ExtractWarPlugin extends JettyConsolePluginBase {
private boolean extractWar = true;
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/ExtractWarPlugin.java
import org.eclipse.jetty.webapp.WebAppContext;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class ExtractWarPlugin extends JettyConsolePluginBase {
private boolean extractWar = true;
|
private StartOption extractWarPlugin = new DefaultStartOption("extractWar") {
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/ExtractWarPlugin.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
|
import org.eclipse.jetty.webapp.WebAppContext;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class ExtractWarPlugin extends JettyConsolePluginBase {
private boolean extractWar = true;
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/ExtractWarPlugin.java
import org.eclipse.jetty.webapp.WebAppContext;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class ExtractWarPlugin extends JettyConsolePluginBase {
private boolean extractWar = true;
|
private StartOption extractWarPlugin = new DefaultStartOption("extractWar") {
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsole.java
|
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/JTextAreaOutputStream.java
// public class JTextAreaOutputStream extends OutputStream {
//
// private JTextArea text;
//
// public JTextAreaOutputStream(JTextArea text) {
// this.text = text;
// }
//
// public void write(int i) throws IOException {
// write(new byte[] {(byte)i}, 0,1);
// }
//
// public void write(byte[] bytes) throws IOException {
// write(bytes, 0, bytes.length);
// }
//
// public void write(final byte[] bytes, final int i, final int i1) throws IOException {
//
// if(bytes != null && i1 != 0) {
// final String s = new String(bytes, i, i1);
//
// SwingUtilities.invokeLater(new Runnable() {
// public void run() {
// text.append(s);
// text.setCaretPosition(text.getDocument().getLength());
// int size = 100000;
// int maxOverflow= 500;
// int overflow = text.getDocument().getLength() - size;
// if (overflow >= maxOverflow) {
// text.replaceRange("", 0, overflow);
// }
// }
// });
// }
// }
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/MultiOutputStream.java
// public class MultiOutputStream extends OutputStream {
//
// private List outputStreams = new ArrayList();
//
// public MultiOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void addOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void write(int i) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(i);
// }
// }
//
// public void write(byte[] bytes) throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.write(bytes);
// }
// }
//
// public void write(byte[] bytes, int i, int i1) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(bytes, i, i1);
// }
// }
//
// public void flush() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.flush();
// }
// }
//
// public void close() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.close();
// }
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePlugin.java
// public interface JettyConsolePlugin {
//
// List<StartOption> getStartOptions();
// void beforeStart(WebAppContext context);
// void beforeStop(WebAppContext context);
//
// void customizeServer(Server server);
//
// void customizeConnector(ServerConnector connector);
//
// void bootstrap();
//
// void configureConsole(Configuration configuration);
// }
|
import org.simplericity.jettyconsole.io.JTextAreaOutputStream;
import org.simplericity.jettyconsole.io.MultiOutputStream;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.JettyConsolePlugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.kantega.jexmec.PluginManager;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Method;
import java.net.ServerSocket;
import java.util.Properties;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole;
/**
* A graphical console for starting and stopping a webapp in Jetty.
*/
public class JettyConsole {
private AbstractAction stopAction;
private AbstractAction startAction;
private JScrollPane scroll;
|
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/JTextAreaOutputStream.java
// public class JTextAreaOutputStream extends OutputStream {
//
// private JTextArea text;
//
// public JTextAreaOutputStream(JTextArea text) {
// this.text = text;
// }
//
// public void write(int i) throws IOException {
// write(new byte[] {(byte)i}, 0,1);
// }
//
// public void write(byte[] bytes) throws IOException {
// write(bytes, 0, bytes.length);
// }
//
// public void write(final byte[] bytes, final int i, final int i1) throws IOException {
//
// if(bytes != null && i1 != 0) {
// final String s = new String(bytes, i, i1);
//
// SwingUtilities.invokeLater(new Runnable() {
// public void run() {
// text.append(s);
// text.setCaretPosition(text.getDocument().getLength());
// int size = 100000;
// int maxOverflow= 500;
// int overflow = text.getDocument().getLength() - size;
// if (overflow >= maxOverflow) {
// text.replaceRange("", 0, overflow);
// }
// }
// });
// }
// }
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/MultiOutputStream.java
// public class MultiOutputStream extends OutputStream {
//
// private List outputStreams = new ArrayList();
//
// public MultiOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void addOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void write(int i) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(i);
// }
// }
//
// public void write(byte[] bytes) throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.write(bytes);
// }
// }
//
// public void write(byte[] bytes, int i, int i1) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(bytes, i, i1);
// }
// }
//
// public void flush() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.flush();
// }
// }
//
// public void close() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.close();
// }
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePlugin.java
// public interface JettyConsolePlugin {
//
// List<StartOption> getStartOptions();
// void beforeStart(WebAppContext context);
// void beforeStop(WebAppContext context);
//
// void customizeServer(Server server);
//
// void customizeConnector(ServerConnector connector);
//
// void bootstrap();
//
// void configureConsole(Configuration configuration);
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsole.java
import org.simplericity.jettyconsole.io.JTextAreaOutputStream;
import org.simplericity.jettyconsole.io.MultiOutputStream;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.JettyConsolePlugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.kantega.jexmec.PluginManager;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Method;
import java.net.ServerSocket;
import java.util.Properties;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole;
/**
* A graphical console for starting and stopping a webapp in Jetty.
*/
public class JettyConsole {
private AbstractAction stopAction;
private AbstractAction startAction;
private JScrollPane scroll;
|
private MultiOutputStream multiOut;
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsole.java
|
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/JTextAreaOutputStream.java
// public class JTextAreaOutputStream extends OutputStream {
//
// private JTextArea text;
//
// public JTextAreaOutputStream(JTextArea text) {
// this.text = text;
// }
//
// public void write(int i) throws IOException {
// write(new byte[] {(byte)i}, 0,1);
// }
//
// public void write(byte[] bytes) throws IOException {
// write(bytes, 0, bytes.length);
// }
//
// public void write(final byte[] bytes, final int i, final int i1) throws IOException {
//
// if(bytes != null && i1 != 0) {
// final String s = new String(bytes, i, i1);
//
// SwingUtilities.invokeLater(new Runnable() {
// public void run() {
// text.append(s);
// text.setCaretPosition(text.getDocument().getLength());
// int size = 100000;
// int maxOverflow= 500;
// int overflow = text.getDocument().getLength() - size;
// if (overflow >= maxOverflow) {
// text.replaceRange("", 0, overflow);
// }
// }
// });
// }
// }
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/MultiOutputStream.java
// public class MultiOutputStream extends OutputStream {
//
// private List outputStreams = new ArrayList();
//
// public MultiOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void addOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void write(int i) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(i);
// }
// }
//
// public void write(byte[] bytes) throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.write(bytes);
// }
// }
//
// public void write(byte[] bytes, int i, int i1) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(bytes, i, i1);
// }
// }
//
// public void flush() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.flush();
// }
// }
//
// public void close() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.close();
// }
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePlugin.java
// public interface JettyConsolePlugin {
//
// List<StartOption> getStartOptions();
// void beforeStart(WebAppContext context);
// void beforeStop(WebAppContext context);
//
// void customizeServer(Server server);
//
// void customizeConnector(ServerConnector connector);
//
// void bootstrap();
//
// void configureConsole(Configuration configuration);
// }
|
import org.simplericity.jettyconsole.io.JTextAreaOutputStream;
import org.simplericity.jettyconsole.io.MultiOutputStream;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.JettyConsolePlugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.kantega.jexmec.PluginManager;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Method;
import java.net.ServerSocket;
import java.util.Properties;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole;
/**
* A graphical console for starting and stopping a webapp in Jetty.
*/
public class JettyConsole {
private AbstractAction stopAction;
private AbstractAction startAction;
private JScrollPane scroll;
private MultiOutputStream multiOut;
private MultiOutputStream multiErr;
private JButton startStop;
private Logger log = LoggerFactory.getLogger(getClass());
private JFrame frame;
private String name;
private final Properties settings;
private final JettyManager jettyManager;
|
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/JTextAreaOutputStream.java
// public class JTextAreaOutputStream extends OutputStream {
//
// private JTextArea text;
//
// public JTextAreaOutputStream(JTextArea text) {
// this.text = text;
// }
//
// public void write(int i) throws IOException {
// write(new byte[] {(byte)i}, 0,1);
// }
//
// public void write(byte[] bytes) throws IOException {
// write(bytes, 0, bytes.length);
// }
//
// public void write(final byte[] bytes, final int i, final int i1) throws IOException {
//
// if(bytes != null && i1 != 0) {
// final String s = new String(bytes, i, i1);
//
// SwingUtilities.invokeLater(new Runnable() {
// public void run() {
// text.append(s);
// text.setCaretPosition(text.getDocument().getLength());
// int size = 100000;
// int maxOverflow= 500;
// int overflow = text.getDocument().getLength() - size;
// if (overflow >= maxOverflow) {
// text.replaceRange("", 0, overflow);
// }
// }
// });
// }
// }
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/MultiOutputStream.java
// public class MultiOutputStream extends OutputStream {
//
// private List outputStreams = new ArrayList();
//
// public MultiOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void addOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void write(int i) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(i);
// }
// }
//
// public void write(byte[] bytes) throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.write(bytes);
// }
// }
//
// public void write(byte[] bytes, int i, int i1) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(bytes, i, i1);
// }
// }
//
// public void flush() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.flush();
// }
// }
//
// public void close() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.close();
// }
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePlugin.java
// public interface JettyConsolePlugin {
//
// List<StartOption> getStartOptions();
// void beforeStart(WebAppContext context);
// void beforeStop(WebAppContext context);
//
// void customizeServer(Server server);
//
// void customizeConnector(ServerConnector connector);
//
// void bootstrap();
//
// void configureConsole(Configuration configuration);
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsole.java
import org.simplericity.jettyconsole.io.JTextAreaOutputStream;
import org.simplericity.jettyconsole.io.MultiOutputStream;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.JettyConsolePlugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.kantega.jexmec.PluginManager;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Method;
import java.net.ServerSocket;
import java.util.Properties;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole;
/**
* A graphical console for starting and stopping a webapp in Jetty.
*/
public class JettyConsole {
private AbstractAction stopAction;
private AbstractAction startAction;
private JScrollPane scroll;
private MultiOutputStream multiOut;
private MultiOutputStream multiErr;
private JButton startStop;
private Logger log = LoggerFactory.getLogger(getClass());
private JFrame frame;
private String name;
private final Properties settings;
private final JettyManager jettyManager;
|
private final PluginManager<JettyConsolePlugin> pluginManager;
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsole.java
|
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/JTextAreaOutputStream.java
// public class JTextAreaOutputStream extends OutputStream {
//
// private JTextArea text;
//
// public JTextAreaOutputStream(JTextArea text) {
// this.text = text;
// }
//
// public void write(int i) throws IOException {
// write(new byte[] {(byte)i}, 0,1);
// }
//
// public void write(byte[] bytes) throws IOException {
// write(bytes, 0, bytes.length);
// }
//
// public void write(final byte[] bytes, final int i, final int i1) throws IOException {
//
// if(bytes != null && i1 != 0) {
// final String s = new String(bytes, i, i1);
//
// SwingUtilities.invokeLater(new Runnable() {
// public void run() {
// text.append(s);
// text.setCaretPosition(text.getDocument().getLength());
// int size = 100000;
// int maxOverflow= 500;
// int overflow = text.getDocument().getLength() - size;
// if (overflow >= maxOverflow) {
// text.replaceRange("", 0, overflow);
// }
// }
// });
// }
// }
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/MultiOutputStream.java
// public class MultiOutputStream extends OutputStream {
//
// private List outputStreams = new ArrayList();
//
// public MultiOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void addOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void write(int i) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(i);
// }
// }
//
// public void write(byte[] bytes) throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.write(bytes);
// }
// }
//
// public void write(byte[] bytes, int i, int i1) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(bytes, i, i1);
// }
// }
//
// public void flush() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.flush();
// }
// }
//
// public void close() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.close();
// }
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePlugin.java
// public interface JettyConsolePlugin {
//
// List<StartOption> getStartOptions();
// void beforeStart(WebAppContext context);
// void beforeStop(WebAppContext context);
//
// void customizeServer(Server server);
//
// void customizeConnector(ServerConnector connector);
//
// void bootstrap();
//
// void configureConsole(Configuration configuration);
// }
|
import org.simplericity.jettyconsole.io.JTextAreaOutputStream;
import org.simplericity.jettyconsole.io.MultiOutputStream;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.JettyConsolePlugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.kantega.jexmec.PluginManager;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Method;
import java.net.ServerSocket;
import java.util.Properties;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole;
/**
* A graphical console for starting and stopping a webapp in Jetty.
*/
public class JettyConsole {
private AbstractAction stopAction;
private AbstractAction startAction;
private JScrollPane scroll;
private MultiOutputStream multiOut;
private MultiOutputStream multiErr;
private JButton startStop;
private Logger log = LoggerFactory.getLogger(getClass());
private JFrame frame;
private String name;
private final Properties settings;
private final JettyManager jettyManager;
private final PluginManager<JettyConsolePlugin> pluginManager;
public JettyConsole(Properties settings, JettyManager jettyManager, PluginManager<JettyConsolePlugin> pluginManager) {
this.settings = settings;
this.jettyManager = jettyManager;
this.pluginManager = pluginManager;
}
|
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/JTextAreaOutputStream.java
// public class JTextAreaOutputStream extends OutputStream {
//
// private JTextArea text;
//
// public JTextAreaOutputStream(JTextArea text) {
// this.text = text;
// }
//
// public void write(int i) throws IOException {
// write(new byte[] {(byte)i}, 0,1);
// }
//
// public void write(byte[] bytes) throws IOException {
// write(bytes, 0, bytes.length);
// }
//
// public void write(final byte[] bytes, final int i, final int i1) throws IOException {
//
// if(bytes != null && i1 != 0) {
// final String s = new String(bytes, i, i1);
//
// SwingUtilities.invokeLater(new Runnable() {
// public void run() {
// text.append(s);
// text.setCaretPosition(text.getDocument().getLength());
// int size = 100000;
// int maxOverflow= 500;
// int overflow = text.getDocument().getLength() - size;
// if (overflow >= maxOverflow) {
// text.replaceRange("", 0, overflow);
// }
// }
// });
// }
// }
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/MultiOutputStream.java
// public class MultiOutputStream extends OutputStream {
//
// private List outputStreams = new ArrayList();
//
// public MultiOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void addOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void write(int i) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(i);
// }
// }
//
// public void write(byte[] bytes) throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.write(bytes);
// }
// }
//
// public void write(byte[] bytes, int i, int i1) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(bytes, i, i1);
// }
// }
//
// public void flush() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.flush();
// }
// }
//
// public void close() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.close();
// }
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePlugin.java
// public interface JettyConsolePlugin {
//
// List<StartOption> getStartOptions();
// void beforeStart(WebAppContext context);
// void beforeStop(WebAppContext context);
//
// void customizeServer(Server server);
//
// void customizeConnector(ServerConnector connector);
//
// void bootstrap();
//
// void configureConsole(Configuration configuration);
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsole.java
import org.simplericity.jettyconsole.io.JTextAreaOutputStream;
import org.simplericity.jettyconsole.io.MultiOutputStream;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.JettyConsolePlugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.kantega.jexmec.PluginManager;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Method;
import java.net.ServerSocket;
import java.util.Properties;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole;
/**
* A graphical console for starting and stopping a webapp in Jetty.
*/
public class JettyConsole {
private AbstractAction stopAction;
private AbstractAction startAction;
private JScrollPane scroll;
private MultiOutputStream multiOut;
private MultiOutputStream multiErr;
private JButton startStop;
private Logger log = LoggerFactory.getLogger(getClass());
private JFrame frame;
private String name;
private final Properties settings;
private final JettyManager jettyManager;
private final PluginManager<JettyConsolePlugin> pluginManager;
public JettyConsole(Properties settings, JettyManager jettyManager, PluginManager<JettyConsolePlugin> pluginManager) {
this.settings = settings;
this.jettyManager = jettyManager;
this.pluginManager = pluginManager;
}
|
public void init(final Configuration configuration) throws Exception {
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsole.java
|
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/JTextAreaOutputStream.java
// public class JTextAreaOutputStream extends OutputStream {
//
// private JTextArea text;
//
// public JTextAreaOutputStream(JTextArea text) {
// this.text = text;
// }
//
// public void write(int i) throws IOException {
// write(new byte[] {(byte)i}, 0,1);
// }
//
// public void write(byte[] bytes) throws IOException {
// write(bytes, 0, bytes.length);
// }
//
// public void write(final byte[] bytes, final int i, final int i1) throws IOException {
//
// if(bytes != null && i1 != 0) {
// final String s = new String(bytes, i, i1);
//
// SwingUtilities.invokeLater(new Runnable() {
// public void run() {
// text.append(s);
// text.setCaretPosition(text.getDocument().getLength());
// int size = 100000;
// int maxOverflow= 500;
// int overflow = text.getDocument().getLength() - size;
// if (overflow >= maxOverflow) {
// text.replaceRange("", 0, overflow);
// }
// }
// });
// }
// }
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/MultiOutputStream.java
// public class MultiOutputStream extends OutputStream {
//
// private List outputStreams = new ArrayList();
//
// public MultiOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void addOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void write(int i) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(i);
// }
// }
//
// public void write(byte[] bytes) throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.write(bytes);
// }
// }
//
// public void write(byte[] bytes, int i, int i1) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(bytes, i, i1);
// }
// }
//
// public void flush() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.flush();
// }
// }
//
// public void close() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.close();
// }
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePlugin.java
// public interface JettyConsolePlugin {
//
// List<StartOption> getStartOptions();
// void beforeStart(WebAppContext context);
// void beforeStop(WebAppContext context);
//
// void customizeServer(Server server);
//
// void customizeConnector(ServerConnector connector);
//
// void bootstrap();
//
// void configureConsole(Configuration configuration);
// }
|
import org.simplericity.jettyconsole.io.JTextAreaOutputStream;
import org.simplericity.jettyconsole.io.MultiOutputStream;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.JettyConsolePlugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.kantega.jexmec.PluginManager;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Method;
import java.net.ServerSocket;
import java.util.Properties;
|
g2.fillRect(0, 0, getWidth(), getHeight());
g2.setComposite(comp);
g2.setColor(c);
}
};
controls.setOpaque(false);
final JTextArea text = new JTextArea(10, 7) {
protected void paintComponent(Graphics graphics) {
Graphics2D g2 = (Graphics2D) graphics;
Composite comp = g2.getComposite();
Color c = g2.getColor();
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3F));
g2.setColor(Color.BLACK);
g2.fillRect(0, 0, getWidth(), getHeight());
g2.setComposite(comp);
g2.setColor(c);
super.paintComponent(graphics);
}
};
|
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/JTextAreaOutputStream.java
// public class JTextAreaOutputStream extends OutputStream {
//
// private JTextArea text;
//
// public JTextAreaOutputStream(JTextArea text) {
// this.text = text;
// }
//
// public void write(int i) throws IOException {
// write(new byte[] {(byte)i}, 0,1);
// }
//
// public void write(byte[] bytes) throws IOException {
// write(bytes, 0, bytes.length);
// }
//
// public void write(final byte[] bytes, final int i, final int i1) throws IOException {
//
// if(bytes != null && i1 != 0) {
// final String s = new String(bytes, i, i1);
//
// SwingUtilities.invokeLater(new Runnable() {
// public void run() {
// text.append(s);
// text.setCaretPosition(text.getDocument().getLength());
// int size = 100000;
// int maxOverflow= 500;
// int overflow = text.getDocument().getLength() - size;
// if (overflow >= maxOverflow) {
// text.replaceRange("", 0, overflow);
// }
// }
// });
// }
// }
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/MultiOutputStream.java
// public class MultiOutputStream extends OutputStream {
//
// private List outputStreams = new ArrayList();
//
// public MultiOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void addOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void write(int i) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(i);
// }
// }
//
// public void write(byte[] bytes) throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.write(bytes);
// }
// }
//
// public void write(byte[] bytes, int i, int i1) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(bytes, i, i1);
// }
// }
//
// public void flush() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.flush();
// }
// }
//
// public void close() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.close();
// }
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePlugin.java
// public interface JettyConsolePlugin {
//
// List<StartOption> getStartOptions();
// void beforeStart(WebAppContext context);
// void beforeStop(WebAppContext context);
//
// void customizeServer(Server server);
//
// void customizeConnector(ServerConnector connector);
//
// void bootstrap();
//
// void configureConsole(Configuration configuration);
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsole.java
import org.simplericity.jettyconsole.io.JTextAreaOutputStream;
import org.simplericity.jettyconsole.io.MultiOutputStream;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.JettyConsolePlugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.kantega.jexmec.PluginManager;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Method;
import java.net.ServerSocket;
import java.util.Properties;
g2.fillRect(0, 0, getWidth(), getHeight());
g2.setComposite(comp);
g2.setColor(c);
}
};
controls.setOpaque(false);
final JTextArea text = new JTextArea(10, 7) {
protected void paintComponent(Graphics graphics) {
Graphics2D g2 = (Graphics2D) graphics;
Composite comp = g2.getComposite();
Color c = g2.getColor();
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3F));
g2.setColor(Color.BLACK);
g2.fillRect(0, 0, getWidth(), getHeight());
g2.setComposite(comp);
g2.setColor(c);
super.paintComponent(graphics);
}
};
|
OutputStream os = new JTextAreaOutputStream(text);
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsole.java
|
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/JTextAreaOutputStream.java
// public class JTextAreaOutputStream extends OutputStream {
//
// private JTextArea text;
//
// public JTextAreaOutputStream(JTextArea text) {
// this.text = text;
// }
//
// public void write(int i) throws IOException {
// write(new byte[] {(byte)i}, 0,1);
// }
//
// public void write(byte[] bytes) throws IOException {
// write(bytes, 0, bytes.length);
// }
//
// public void write(final byte[] bytes, final int i, final int i1) throws IOException {
//
// if(bytes != null && i1 != 0) {
// final String s = new String(bytes, i, i1);
//
// SwingUtilities.invokeLater(new Runnable() {
// public void run() {
// text.append(s);
// text.setCaretPosition(text.getDocument().getLength());
// int size = 100000;
// int maxOverflow= 500;
// int overflow = text.getDocument().getLength() - size;
// if (overflow >= maxOverflow) {
// text.replaceRange("", 0, overflow);
// }
// }
// });
// }
// }
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/MultiOutputStream.java
// public class MultiOutputStream extends OutputStream {
//
// private List outputStreams = new ArrayList();
//
// public MultiOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void addOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void write(int i) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(i);
// }
// }
//
// public void write(byte[] bytes) throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.write(bytes);
// }
// }
//
// public void write(byte[] bytes, int i, int i1) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(bytes, i, i1);
// }
// }
//
// public void flush() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.flush();
// }
// }
//
// public void close() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.close();
// }
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePlugin.java
// public interface JettyConsolePlugin {
//
// List<StartOption> getStartOptions();
// void beforeStart(WebAppContext context);
// void beforeStop(WebAppContext context);
//
// void customizeServer(Server server);
//
// void customizeConnector(ServerConnector connector);
//
// void bootstrap();
//
// void configureConsole(Configuration configuration);
// }
|
import org.simplericity.jettyconsole.io.JTextAreaOutputStream;
import org.simplericity.jettyconsole.io.MultiOutputStream;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.JettyConsolePlugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.kantega.jexmec.PluginManager;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Method;
import java.net.ServerSocket;
import java.util.Properties;
|
}
b.add(controls);
back.add(b, BorderLayout.SOUTH);
final JTextField portField = new JTextField();
portField.setText("8080");
portField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
if (startAction.isEnabled()) {
startAction.actionPerformed(actionEvent);
}
}
});
startAction = new AbstractAction("Start") {
public void actionPerformed(ActionEvent actionEvent) {
final int port = Integer.parseInt(portField.getText());
try (ServerSocket socket = new ServerSocket(port)){
// success, port is not in use
} catch (IOException e) {
JOptionPane.showMessageDialog(null, "Port " + port +" is already in use. Please select another port.");
return;
}
for(JettyConsolePlugin plugin : pluginManager.getPlugins()) {
|
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/JTextAreaOutputStream.java
// public class JTextAreaOutputStream extends OutputStream {
//
// private JTextArea text;
//
// public JTextAreaOutputStream(JTextArea text) {
// this.text = text;
// }
//
// public void write(int i) throws IOException {
// write(new byte[] {(byte)i}, 0,1);
// }
//
// public void write(byte[] bytes) throws IOException {
// write(bytes, 0, bytes.length);
// }
//
// public void write(final byte[] bytes, final int i, final int i1) throws IOException {
//
// if(bytes != null && i1 != 0) {
// final String s = new String(bytes, i, i1);
//
// SwingUtilities.invokeLater(new Runnable() {
// public void run() {
// text.append(s);
// text.setCaretPosition(text.getDocument().getLength());
// int size = 100000;
// int maxOverflow= 500;
// int overflow = text.getDocument().getLength() - size;
// if (overflow >= maxOverflow) {
// text.replaceRange("", 0, overflow);
// }
// }
// });
// }
// }
// }
//
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/io/MultiOutputStream.java
// public class MultiOutputStream extends OutputStream {
//
// private List outputStreams = new ArrayList();
//
// public MultiOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void addOutputStream(OutputStream stream) {
// outputStreams.add(stream);
// }
//
// public void write(int i) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(i);
// }
// }
//
// public void write(byte[] bytes) throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.write(bytes);
// }
// }
//
// public void write(byte[] bytes, int i, int i1) throws IOException {
// for (int j = 0; j < outputStreams.size(); j++) {
// OutputStream stream = (OutputStream) outputStreams.get(j);
// stream.write(bytes, i, i1);
// }
// }
//
// public void flush() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.flush();
// }
// }
//
// public void close() throws IOException {
// for (int i = 0; i < outputStreams.size(); i++) {
// OutputStream stream = (OutputStream) outputStreams.get(i);
// stream.close();
// }
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePlugin.java
// public interface JettyConsolePlugin {
//
// List<StartOption> getStartOptions();
// void beforeStart(WebAppContext context);
// void beforeStop(WebAppContext context);
//
// void customizeServer(Server server);
//
// void customizeConnector(ServerConnector connector);
//
// void bootstrap();
//
// void configureConsole(Configuration configuration);
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsole.java
import org.simplericity.jettyconsole.io.JTextAreaOutputStream;
import org.simplericity.jettyconsole.io.MultiOutputStream;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.JettyConsolePlugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.kantega.jexmec.PluginManager;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Method;
import java.net.ServerSocket;
import java.util.Properties;
}
b.add(controls);
back.add(b, BorderLayout.SOUTH);
final JTextField portField = new JTextField();
portField.setText("8080");
portField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
if (startAction.isEnabled()) {
startAction.actionPerformed(actionEvent);
}
}
});
startAction = new AbstractAction("Start") {
public void actionPerformed(ActionEvent actionEvent) {
final int port = Integer.parseInt(portField.getText());
try (ServerSocket socket = new ServerSocket(port)){
// success, port is not in use
} catch (IOException e) {
JOptionPane.showMessageDialog(null, "Port " + port +" is already in use. Please select another port.");
return;
}
for(JettyConsolePlugin plugin : pluginManager.getPlugins()) {
|
for(StartOption option : plugin.getStartOptions()) {
|
eirbjo/jetty-console
|
jetty-console-plugins/jetty-console-jettyxml-plugin/src/main/java/org/simplericity/jettyconsole/jettyxml/JettyXmlPlugin.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
|
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.xml.sax.SAXException;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.xml.XmlConfiguration;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.ArrayList;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.jettyxml;
/**
*/
public class JettyXmlPlugin extends JettyConsolePluginBase {
private List<File> jettyXmlFiles = new ArrayList<File>();
private List<File> jettyWebXmlFiles = new ArrayList<File>();
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
// Path: jetty-console-plugins/jetty-console-jettyxml-plugin/src/main/java/org/simplericity/jettyconsole/jettyxml/JettyXmlPlugin.java
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.xml.sax.SAXException;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.xml.XmlConfiguration;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.ArrayList;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.jettyxml;
/**
*/
public class JettyXmlPlugin extends JettyConsolePluginBase {
private List<File> jettyXmlFiles = new ArrayList<File>();
private List<File> jettyWebXmlFiles = new ArrayList<File>();
|
private StartOption jettyXmlOption = new JettyXmlFileOption("jettyXml", jettyXmlFiles);
|
eirbjo/jetty-console
|
jetty-console-plugins/jetty-console-jettyxml-plugin/src/main/java/org/simplericity/jettyconsole/jettyxml/JettyXmlPlugin.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
|
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.xml.sax.SAXException;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.xml.XmlConfiguration;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.ArrayList;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.jettyxml;
/**
*/
public class JettyXmlPlugin extends JettyConsolePluginBase {
private List<File> jettyXmlFiles = new ArrayList<File>();
private List<File> jettyWebXmlFiles = new ArrayList<File>();
private StartOption jettyXmlOption = new JettyXmlFileOption("jettyXml", jettyXmlFiles);
private StartOption jettyWebXmlOption = new JettyXmlFileOption("jettyWebXml", jettyWebXmlFiles);
public JettyXmlPlugin() {
super(JettyXmlPlugin.class);
addStartOptions(jettyXmlOption, jettyWebXmlOption);
}
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
// Path: jetty-console-plugins/jetty-console-jettyxml-plugin/src/main/java/org/simplericity/jettyconsole/jettyxml/JettyXmlPlugin.java
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.xml.sax.SAXException;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.xml.XmlConfiguration;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.ArrayList;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.jettyxml;
/**
*/
public class JettyXmlPlugin extends JettyConsolePluginBase {
private List<File> jettyXmlFiles = new ArrayList<File>();
private List<File> jettyWebXmlFiles = new ArrayList<File>();
private StartOption jettyXmlOption = new JettyXmlFileOption("jettyXml", jettyXmlFiles);
private StartOption jettyWebXmlOption = new JettyXmlFileOption("jettyWebXml", jettyWebXmlFiles);
public JettyXmlPlugin() {
super(JettyXmlPlugin.class);
addStartOptions(jettyXmlOption, jettyWebXmlOption);
}
|
class JettyXmlFileOption extends DefaultStartOption {
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/ContextPathConfigurationPlugin.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
|
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class ContextPathConfigurationPlugin extends JettyConsolePluginBase {
private String contextPath;
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/ContextPathConfigurationPlugin.java
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class ContextPathConfigurationPlugin extends JettyConsolePluginBase {
private String contextPath;
|
private StartOption contextPathOption = new DefaultStartOption("contextPath") {
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/ContextPathConfigurationPlugin.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
|
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class ContextPathConfigurationPlugin extends JettyConsolePluginBase {
private String contextPath;
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/ContextPathConfigurationPlugin.java
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class ContextPathConfigurationPlugin extends JettyConsolePluginBase {
private String contextPath;
|
private StartOption contextPathOption = new DefaultStartOption("contextPath") {
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/ContextPathConfigurationPlugin.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
|
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class ContextPathConfigurationPlugin extends JettyConsolePluginBase {
private String contextPath;
private StartOption contextPathOption = new DefaultStartOption("contextPath") {
@Override
public String validate(String value) {
contextPath = value;
return null;
}
};
public ContextPathConfigurationPlugin() {
super(ContextPathConfigurationPlugin.class);
addStartOptions(contextPathOption);
}
@Override
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/ContextPathConfigurationPlugin.java
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class ContextPathConfigurationPlugin extends JettyConsolePluginBase {
private String contextPath;
private StartOption contextPathOption = new DefaultStartOption("contextPath") {
@Override
public String validate(String value) {
contextPath = value;
return null;
}
};
public ContextPathConfigurationPlugin() {
super(ContextPathConfigurationPlugin.class);
addStartOptions(contextPathOption);
}
@Override
|
public void configureConsole(Configuration configuration) {
|
eirbjo/jetty-console
|
jetty-console-plugins/jetty-console-startstop-plugin/src/main/java/org/simplericity/jettyconsole/startstop/StartStopScriptPlugin.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
|
import org.eclipse.jetty.util.IO;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import java.io.*;
import java.net.URL;
import java.net.URLDecoder;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.startstop;
public class StartStopScriptPlugin extends JettyConsolePluginBase {
public StartStopScriptPlugin() {
super(StartStopScriptPlugin.class);
if(new File("/bin/sh").exists()) {
addStartOptions(createStartStopScript, showStartStopScript);
}
}
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
// Path: jetty-console-plugins/jetty-console-startstop-plugin/src/main/java/org/simplericity/jettyconsole/startstop/StartStopScriptPlugin.java
import org.eclipse.jetty.util.IO;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import java.io.*;
import java.net.URL;
import java.net.URLDecoder;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.startstop;
public class StartStopScriptPlugin extends JettyConsolePluginBase {
public StartStopScriptPlugin() {
super(StartStopScriptPlugin.class);
if(new File("/bin/sh").exists()) {
addStartOptions(createStartStopScript, showStartStopScript);
}
}
|
private StartOption createStartStopScript = new DefaultStartOption("createStartScript") {
|
eirbjo/jetty-console
|
jetty-console-plugins/jetty-console-startstop-plugin/src/main/java/org/simplericity/jettyconsole/startstop/StartStopScriptPlugin.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
|
import org.eclipse.jetty.util.IO;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import java.io.*;
import java.net.URL;
import java.net.URLDecoder;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.startstop;
public class StartStopScriptPlugin extends JettyConsolePluginBase {
public StartStopScriptPlugin() {
super(StartStopScriptPlugin.class);
if(new File("/bin/sh").exists()) {
addStartOptions(createStartStopScript, showStartStopScript);
}
}
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
// Path: jetty-console-plugins/jetty-console-startstop-plugin/src/main/java/org/simplericity/jettyconsole/startstop/StartStopScriptPlugin.java
import org.eclipse.jetty.util.IO;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.StartOption;
import java.io.*;
import java.net.URL;
import java.net.URLDecoder;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.startstop;
public class StartStopScriptPlugin extends JettyConsolePluginBase {
public StartStopScriptPlugin() {
super(StartStopScriptPlugin.class);
if(new File("/bin/sh").exists()) {
addStartOptions(createStartStopScript, showStartStopScript);
}
}
|
private StartOption createStartStopScript = new DefaultStartOption("createStartScript") {
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/DefaultJettyManager.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePlugin.java
// public interface JettyConsolePlugin {
//
// List<StartOption> getStartOptions();
// void beforeStart(WebAppContext context);
// void beforeStop(WebAppContext context);
//
// void customizeServer(Server server);
//
// void customizeConnector(ServerConnector connector);
//
// void bootstrap();
//
// void configureConsole(Configuration configuration);
// }
|
import org.eclipse.jetty.annotations.AnnotationConfiguration;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.plus.webapp.EnvConfiguration;
import org.eclipse.jetty.server.*;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.webapp.*;
import org.kantega.jexmec.PluginManager;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.JettyConsolePlugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole;
public class DefaultJettyManager implements JettyManager {
private Server server;
private Logger log = LoggerFactory.getLogger(getClass());
private Properties settings;
private String name;
private Runnable shutdownHook;
private List<JettyListener> listenerList = new ArrayList<JettyListener>();
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePlugin.java
// public interface JettyConsolePlugin {
//
// List<StartOption> getStartOptions();
// void beforeStart(WebAppContext context);
// void beforeStop(WebAppContext context);
//
// void customizeServer(Server server);
//
// void customizeConnector(ServerConnector connector);
//
// void bootstrap();
//
// void configureConsole(Configuration configuration);
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/DefaultJettyManager.java
import org.eclipse.jetty.annotations.AnnotationConfiguration;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.plus.webapp.EnvConfiguration;
import org.eclipse.jetty.server.*;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.webapp.*;
import org.kantega.jexmec.PluginManager;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.JettyConsolePlugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole;
public class DefaultJettyManager implements JettyManager {
private Server server;
private Logger log = LoggerFactory.getLogger(getClass());
private Properties settings;
private String name;
private Runnable shutdownHook;
private List<JettyListener> listenerList = new ArrayList<JettyListener>();
|
private PluginManager<JettyConsolePlugin> pluginManager;
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/DefaultJettyManager.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePlugin.java
// public interface JettyConsolePlugin {
//
// List<StartOption> getStartOptions();
// void beforeStart(WebAppContext context);
// void beforeStop(WebAppContext context);
//
// void customizeServer(Server server);
//
// void customizeConnector(ServerConnector connector);
//
// void bootstrap();
//
// void configureConsole(Configuration configuration);
// }
|
import org.eclipse.jetty.annotations.AnnotationConfiguration;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.plus.webapp.EnvConfiguration;
import org.eclipse.jetty.server.*;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.webapp.*;
import org.kantega.jexmec.PluginManager;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.JettyConsolePlugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
|
public DefaultJettyManager(Properties settings, PluginManager<JettyConsolePlugin> pluginManager, File jettyWorkDirectory) {
this.settings = settings;
this.pluginManager = pluginManager;
this.jettyWorkDirectory = jettyWorkDirectory;
this.name = DefaultJettyManager.this.settings.getProperty("name");
shutdownHook = new Runnable() {
public void run() {
shutdown();
}
};
}
public void shutdown() {
log.info("Shutting down " + name + "..");
try {
if (server != null && (server.isStarted() || server.isStarting())) {
server.stop();
log.info("Shutdown of " + name + " complete.");
for (JettyListener listener : listenerList) {
listener.serverStopped();
}
}
} catch (Exception e) {
log.info("Exception shutting down " + name + ": " + e.getMessage(), e);
}
}
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Configuration.java
// public interface Configuration {
//
// boolean isHeadless();
//
// void setHeadless(boolean headless);
//
// String getContextPath();
//
// void setContextPath(String contextPath);
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePlugin.java
// public interface JettyConsolePlugin {
//
// List<StartOption> getStartOptions();
// void beforeStart(WebAppContext context);
// void beforeStop(WebAppContext context);
//
// void customizeServer(Server server);
//
// void customizeConnector(ServerConnector connector);
//
// void bootstrap();
//
// void configureConsole(Configuration configuration);
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/DefaultJettyManager.java
import org.eclipse.jetty.annotations.AnnotationConfiguration;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.plus.webapp.EnvConfiguration;
import org.eclipse.jetty.server.*;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.webapp.*;
import org.kantega.jexmec.PluginManager;
import org.simplericity.jettyconsole.api.Configuration;
import org.simplericity.jettyconsole.api.JettyConsolePlugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
public DefaultJettyManager(Properties settings, PluginManager<JettyConsolePlugin> pluginManager, File jettyWorkDirectory) {
this.settings = settings;
this.pluginManager = pluginManager;
this.jettyWorkDirectory = jettyWorkDirectory;
this.name = DefaultJettyManager.this.settings.getProperty("name");
shutdownHook = new Runnable() {
public void run() {
shutdown();
}
};
}
public void shutdown() {
log.info("Shutting down " + name + "..");
try {
if (server != null && (server.isStarted() || server.isStarting())) {
server.stop();
log.info("Shutdown of " + name + " complete.");
for (JettyListener listener : listenerList) {
listener.serverStopped();
}
}
} catch (Exception e) {
log.info("Exception shutting down " + name + ": " + e.getMessage(), e);
}
}
|
public void startServer(Configuration configuration) {
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/TmpDirPlugin.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Settings.java
// public interface Settings {
// String getProperty(String name);
// Collection<String> getPropertyNames();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
|
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.Settings;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class TmpDirPlugin extends JettyConsolePluginBase {
private Settings settings;
private File tmpDir;
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Settings.java
// public interface Settings {
// String getProperty(String name);
// Collection<String> getPropertyNames();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/TmpDirPlugin.java
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.Settings;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class TmpDirPlugin extends JettyConsolePluginBase {
private Settings settings;
private File tmpDir;
|
private StartOption tmpDirOption = new DefaultStartOption("tmpDir") {
|
eirbjo/jetty-console
|
jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/TmpDirPlugin.java
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Settings.java
// public interface Settings {
// String getProperty(String name);
// Collection<String> getPropertyNames();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
|
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.Settings;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
|
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class TmpDirPlugin extends JettyConsolePluginBase {
private Settings settings;
private File tmpDir;
|
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/JettyConsolePluginBase.java
// public abstract class JettyConsolePluginBase implements JettyConsolePlugin {
//
// private List<StartOption> startOptions = new ArrayList<StartOption>();
// private String pluginUid;
//
// public JettyConsolePluginBase(String pluginUid) {
// this.pluginUid = pluginUid;
// }
//
// protected JettyConsolePluginBase(Class<? extends JettyConsolePluginBase> pluginClass) {
// this(pluginClass.getName());
// }
//
// protected void addStartOptions(StartOption... startOptions) {
// this.startOptions.addAll(Arrays.asList(startOptions));
// }
// public void beforeStart(WebAppContext context) {
//
// }
//
// public void configureConsole(Configuration configuration) {
//
// }
//
// public void bootstrap() {
//
// }
//
// public void customizeConnector(ServerConnector connector) {
//
// }
//
// public void customizeServer(Server server) {
//
// }
//
// public void beforeStop(WebAppContext context) {
//
// }
//
// public List<StartOption> getStartOptions() {
// return startOptions;
// }
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/Settings.java
// public interface Settings {
// String getProperty(String name);
// Collection<String> getPropertyNames();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/StartOption.java
// public interface StartOption {
//
// String getName();
//
// String validate(String arg);
//
// String validate();
// }
//
// Path: jetty-console-api/src/main/java/org/simplericity/jettyconsole/api/DefaultStartOption.java
// public class DefaultStartOption implements StartOption {
// private String name;
//
// public DefaultStartOption(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public String validate() {
// return null;
// }
//
// public String validate(String value) {
// return null;
// }
//
// }
// Path: jetty-console-core/src/main/java/org/simplericity/jettyconsole/plugins/TmpDirPlugin.java
import org.simplericity.jettyconsole.api.JettyConsolePluginBase;
import org.simplericity.jettyconsole.api.Settings;
import org.simplericity.jettyconsole.api.StartOption;
import org.simplericity.jettyconsole.api.DefaultStartOption;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
/*
* Copyright 2015 Eirik Bjørsnøs
*
* Licensed 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.simplericity.jettyconsole.plugins;
/**
*/
public class TmpDirPlugin extends JettyConsolePluginBase {
private Settings settings;
private File tmpDir;
|
private StartOption tmpDirOption = new DefaultStartOption("tmpDir") {
|
leosilvadev/simplebank
|
src/main/java/br/fatea/simplebank/config/WebServiceConfig.java
|
// Path: src/main/java/br/fatea/simplebank/interceptors/SOAPValidationInterceptor.java
// public class SOAPValidationInterceptor extends PayloadValidatingInterceptor {
// protected Source getValidationRequestSource(WebServiceMessage request) {
// Source source = request.getPayloadSource();
// validateSchema(source);
// return source;
// }
//
// private void validateSchema(Source source) {
// SchemaFactory schemaFactory = SchemaFactory.newInstance(getSchemaLanguage());
// try {
// Schema schema = schemaFactory.newSchema(getSchemas()[0].getFile());
// Validator validator = schema.newValidator();
// DOMResult result = new DOMResult();
// try {
// validator.validate(source, result);
// } catch (SAXException ex) {
// logger.error(ex);
// throw new InvalidClientArgumentsException(ex.getMessage());
// }
// } catch (SAXException | IOException ex) {
// logger.error(ex);
// }
// }
// }
|
import java.util.List;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.ws.config.annotation.EnableWs;
import org.springframework.ws.config.annotation.WsConfigurerAdapter;
import org.springframework.ws.server.EndpointInterceptor;
import org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition;
import org.springframework.xml.xsd.SimpleXsdSchema;
import org.springframework.xml.xsd.XsdSchema;
import br.fatea.simplebank.interceptors.SOAPValidationInterceptor;
|
package br.fatea.simplebank.config;
@EnableWs
@Configuration
public class WebServiceConfig extends WsConfigurerAdapter {
@Override
public void addInterceptors(List<EndpointInterceptor> interceptors) {
super.addInterceptors(interceptors);
interceptors.add(soapValidationInterceptor());
}
@Bean
|
// Path: src/main/java/br/fatea/simplebank/interceptors/SOAPValidationInterceptor.java
// public class SOAPValidationInterceptor extends PayloadValidatingInterceptor {
// protected Source getValidationRequestSource(WebServiceMessage request) {
// Source source = request.getPayloadSource();
// validateSchema(source);
// return source;
// }
//
// private void validateSchema(Source source) {
// SchemaFactory schemaFactory = SchemaFactory.newInstance(getSchemaLanguage());
// try {
// Schema schema = schemaFactory.newSchema(getSchemas()[0].getFile());
// Validator validator = schema.newValidator();
// DOMResult result = new DOMResult();
// try {
// validator.validate(source, result);
// } catch (SAXException ex) {
// logger.error(ex);
// throw new InvalidClientArgumentsException(ex.getMessage());
// }
// } catch (SAXException | IOException ex) {
// logger.error(ex);
// }
// }
// }
// Path: src/main/java/br/fatea/simplebank/config/WebServiceConfig.java
import java.util.List;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.ws.config.annotation.EnableWs;
import org.springframework.ws.config.annotation.WsConfigurerAdapter;
import org.springframework.ws.server.EndpointInterceptor;
import org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition;
import org.springframework.xml.xsd.SimpleXsdSchema;
import org.springframework.xml.xsd.XsdSchema;
import br.fatea.simplebank.interceptors.SOAPValidationInterceptor;
package br.fatea.simplebank.config;
@EnableWs
@Configuration
public class WebServiceConfig extends WsConfigurerAdapter {
@Override
public void addInterceptors(List<EndpointInterceptor> interceptors) {
super.addInterceptors(interceptors);
interceptors.add(soapValidationInterceptor());
}
@Bean
|
public SOAPValidationInterceptor soapValidationInterceptor() {
|
leosilvadev/simplebank
|
src/main/java/br/fatea/simplebank/config/SecurityConfig.java
|
// Path: src/main/java/br/fatea/simplebank/model/domains/SystemUser.java
// @Entity
// @Table(name = "TBL_SYSTEM_USER")
// public class SystemUser {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// @Column(name = "SUS_ID")
// private Long id;
//
// @NotNull
// @NotEmpty
// @Column(name = "SUS_USERNAME", unique=true)
// private String username;
//
// @NotNull
// @NotEmpty
// @Column(name = "SUS_PASSWORD")
// private String password;
//
// @Version
// @Column(name = "SUS_VERSION")
// private Integer version;
//
// @ManyToMany(fetch = FetchType.EAGER)
// @JoinTable(name = "TBL_SYSTEM_USER_ROLES", joinColumns = @JoinColumn(name = "SYSTEM_USER", referencedColumnName = "SUS_ID"), inverseJoinColumns = @JoinColumn(name = "SYSTEM_ROLE", referencedColumnName = "SRO_ID"))
// private Set<SystemRole> roles;
//
// @Embedded
// private IntegrationConfig integrationConfig;
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public Integer getVersion() {
// return version;
// }
//
// public void setVersion(Integer version) {
// this.version = version;
// }
//
// public Set<SystemRole> getRoles() {
// return roles;
// }
//
// public void setRoles(Set<SystemRole> roles) {
// this.roles = roles;
// }
//
// public IntegrationConfig getIntegrationConfig() {
// return integrationConfig;
// }
//
// public void setIntegrationConfig(IntegrationConfig integrationConfig) {
// this.integrationConfig = integrationConfig;
// }
//
// public void encodePassword(BCryptPasswordEncoder encoder) {
// if(this.password!=null)
// this.password = encoder.encode(password);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result
// + ((username == null) ? 0 : username.hashCode());
// return result;
// }
//
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// SystemUser other = (SystemUser) obj;
// if (username == null) {
// if (other.username != null)
// return false;
// } else if (!username.equals(other.username))
// return false;
// return true;
// }
//
// }
//
// Path: src/main/java/br/fatea/simplebank/model/repositories/SystemUserRepository.java
// @Repository
// public interface SystemUserRepository extends CrudRepository<SystemUser, Long> {
//
// SystemUser findOneByUsername(String username);
//
// }
//
// Path: src/main/java/br/fatea/simplebank/model/security/SystemUserDetail.java
// public class SystemUserDetail implements UserDetails {
//
// private static final long serialVersionUID = -5028285189159361408L;
// private SystemUser systemUser;
//
// public SystemUserDetail(SystemUser systemUser) {
// this.systemUser = systemUser;
// }
//
// public Collection<? extends GrantedAuthority> getAuthorities() {
// List<SimpleGrantedAuthority> authorities = systemUser.getRoles()
// .stream()
// .map((role) -> new SimpleGrantedAuthority(role.getName()))
// .collect(Collectors.toList());
// return authorities;
// }
//
// public String getPassword() {
// return systemUser.getPassword();
// }
//
// public String getUsername() {
// return systemUser.getUsername();
// }
//
// public boolean isAccountNonExpired() {
// return true;
// }
//
// public boolean isAccountNonLocked() {
// return true;
// }
//
// public boolean isCredentialsNonExpired() {
// return true;
// }
//
// public boolean isEnabled() {
// return true;
// }
//
// }
|
import java.util.LinkedHashMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.security.web.authentication.DelegatingAuthenticationEntryPoint;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import org.springframework.security.web.util.matcher.RequestMatcher;
import br.fatea.simplebank.model.domains.SystemUser;
import br.fatea.simplebank.model.repositories.SystemUserRepository;
import br.fatea.simplebank.model.security.SystemUserDetail;
|
package br.fatea.simplebank.config;
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
|
// Path: src/main/java/br/fatea/simplebank/model/domains/SystemUser.java
// @Entity
// @Table(name = "TBL_SYSTEM_USER")
// public class SystemUser {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// @Column(name = "SUS_ID")
// private Long id;
//
// @NotNull
// @NotEmpty
// @Column(name = "SUS_USERNAME", unique=true)
// private String username;
//
// @NotNull
// @NotEmpty
// @Column(name = "SUS_PASSWORD")
// private String password;
//
// @Version
// @Column(name = "SUS_VERSION")
// private Integer version;
//
// @ManyToMany(fetch = FetchType.EAGER)
// @JoinTable(name = "TBL_SYSTEM_USER_ROLES", joinColumns = @JoinColumn(name = "SYSTEM_USER", referencedColumnName = "SUS_ID"), inverseJoinColumns = @JoinColumn(name = "SYSTEM_ROLE", referencedColumnName = "SRO_ID"))
// private Set<SystemRole> roles;
//
// @Embedded
// private IntegrationConfig integrationConfig;
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public Integer getVersion() {
// return version;
// }
//
// public void setVersion(Integer version) {
// this.version = version;
// }
//
// public Set<SystemRole> getRoles() {
// return roles;
// }
//
// public void setRoles(Set<SystemRole> roles) {
// this.roles = roles;
// }
//
// public IntegrationConfig getIntegrationConfig() {
// return integrationConfig;
// }
//
// public void setIntegrationConfig(IntegrationConfig integrationConfig) {
// this.integrationConfig = integrationConfig;
// }
//
// public void encodePassword(BCryptPasswordEncoder encoder) {
// if(this.password!=null)
// this.password = encoder.encode(password);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result
// + ((username == null) ? 0 : username.hashCode());
// return result;
// }
//
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// SystemUser other = (SystemUser) obj;
// if (username == null) {
// if (other.username != null)
// return false;
// } else if (!username.equals(other.username))
// return false;
// return true;
// }
//
// }
//
// Path: src/main/java/br/fatea/simplebank/model/repositories/SystemUserRepository.java
// @Repository
// public interface SystemUserRepository extends CrudRepository<SystemUser, Long> {
//
// SystemUser findOneByUsername(String username);
//
// }
//
// Path: src/main/java/br/fatea/simplebank/model/security/SystemUserDetail.java
// public class SystemUserDetail implements UserDetails {
//
// private static final long serialVersionUID = -5028285189159361408L;
// private SystemUser systemUser;
//
// public SystemUserDetail(SystemUser systemUser) {
// this.systemUser = systemUser;
// }
//
// public Collection<? extends GrantedAuthority> getAuthorities() {
// List<SimpleGrantedAuthority> authorities = systemUser.getRoles()
// .stream()
// .map((role) -> new SimpleGrantedAuthority(role.getName()))
// .collect(Collectors.toList());
// return authorities;
// }
//
// public String getPassword() {
// return systemUser.getPassword();
// }
//
// public String getUsername() {
// return systemUser.getUsername();
// }
//
// public boolean isAccountNonExpired() {
// return true;
// }
//
// public boolean isAccountNonLocked() {
// return true;
// }
//
// public boolean isCredentialsNonExpired() {
// return true;
// }
//
// public boolean isEnabled() {
// return true;
// }
//
// }
// Path: src/main/java/br/fatea/simplebank/config/SecurityConfig.java
import java.util.LinkedHashMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.security.web.authentication.DelegatingAuthenticationEntryPoint;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import org.springframework.security.web.util.matcher.RequestMatcher;
import br.fatea.simplebank.model.domains.SystemUser;
import br.fatea.simplebank.model.repositories.SystemUserRepository;
import br.fatea.simplebank.model.security.SystemUserDetail;
package br.fatea.simplebank.config;
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
|
private SystemUserRepository systemUserRepository;
|
leosilvadev/simplebank
|
src/main/java/br/fatea/simplebank/model/services/SystemUserService.java
|
// Path: src/main/java/br/fatea/simplebank/model/domains/SystemUser.java
// @Entity
// @Table(name = "TBL_SYSTEM_USER")
// public class SystemUser {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// @Column(name = "SUS_ID")
// private Long id;
//
// @NotNull
// @NotEmpty
// @Column(name = "SUS_USERNAME", unique=true)
// private String username;
//
// @NotNull
// @NotEmpty
// @Column(name = "SUS_PASSWORD")
// private String password;
//
// @Version
// @Column(name = "SUS_VERSION")
// private Integer version;
//
// @ManyToMany(fetch = FetchType.EAGER)
// @JoinTable(name = "TBL_SYSTEM_USER_ROLES", joinColumns = @JoinColumn(name = "SYSTEM_USER", referencedColumnName = "SUS_ID"), inverseJoinColumns = @JoinColumn(name = "SYSTEM_ROLE", referencedColumnName = "SRO_ID"))
// private Set<SystemRole> roles;
//
// @Embedded
// private IntegrationConfig integrationConfig;
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public Integer getVersion() {
// return version;
// }
//
// public void setVersion(Integer version) {
// this.version = version;
// }
//
// public Set<SystemRole> getRoles() {
// return roles;
// }
//
// public void setRoles(Set<SystemRole> roles) {
// this.roles = roles;
// }
//
// public IntegrationConfig getIntegrationConfig() {
// return integrationConfig;
// }
//
// public void setIntegrationConfig(IntegrationConfig integrationConfig) {
// this.integrationConfig = integrationConfig;
// }
//
// public void encodePassword(BCryptPasswordEncoder encoder) {
// if(this.password!=null)
// this.password = encoder.encode(password);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result
// + ((username == null) ? 0 : username.hashCode());
// return result;
// }
//
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// SystemUser other = (SystemUser) obj;
// if (username == null) {
// if (other.username != null)
// return false;
// } else if (!username.equals(other.username))
// return false;
// return true;
// }
//
// }
//
// Path: src/main/java/br/fatea/simplebank/model/repositories/SystemUserRepository.java
// @Repository
// public interface SystemUserRepository extends CrudRepository<SystemUser, Long> {
//
// SystemUser findOneByUsername(String username);
//
// }
|
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import br.fatea.simplebank.model.domains.SystemUser;
import br.fatea.simplebank.model.repositories.SystemUserRepository;
|
package br.fatea.simplebank.model.services;
@Service
@Transactional
public class SystemUserService {
@Autowired private BCryptPasswordEncoder encoder;
|
// Path: src/main/java/br/fatea/simplebank/model/domains/SystemUser.java
// @Entity
// @Table(name = "TBL_SYSTEM_USER")
// public class SystemUser {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// @Column(name = "SUS_ID")
// private Long id;
//
// @NotNull
// @NotEmpty
// @Column(name = "SUS_USERNAME", unique=true)
// private String username;
//
// @NotNull
// @NotEmpty
// @Column(name = "SUS_PASSWORD")
// private String password;
//
// @Version
// @Column(name = "SUS_VERSION")
// private Integer version;
//
// @ManyToMany(fetch = FetchType.EAGER)
// @JoinTable(name = "TBL_SYSTEM_USER_ROLES", joinColumns = @JoinColumn(name = "SYSTEM_USER", referencedColumnName = "SUS_ID"), inverseJoinColumns = @JoinColumn(name = "SYSTEM_ROLE", referencedColumnName = "SRO_ID"))
// private Set<SystemRole> roles;
//
// @Embedded
// private IntegrationConfig integrationConfig;
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public Integer getVersion() {
// return version;
// }
//
// public void setVersion(Integer version) {
// this.version = version;
// }
//
// public Set<SystemRole> getRoles() {
// return roles;
// }
//
// public void setRoles(Set<SystemRole> roles) {
// this.roles = roles;
// }
//
// public IntegrationConfig getIntegrationConfig() {
// return integrationConfig;
// }
//
// public void setIntegrationConfig(IntegrationConfig integrationConfig) {
// this.integrationConfig = integrationConfig;
// }
//
// public void encodePassword(BCryptPasswordEncoder encoder) {
// if(this.password!=null)
// this.password = encoder.encode(password);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result
// + ((username == null) ? 0 : username.hashCode());
// return result;
// }
//
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// SystemUser other = (SystemUser) obj;
// if (username == null) {
// if (other.username != null)
// return false;
// } else if (!username.equals(other.username))
// return false;
// return true;
// }
//
// }
//
// Path: src/main/java/br/fatea/simplebank/model/repositories/SystemUserRepository.java
// @Repository
// public interface SystemUserRepository extends CrudRepository<SystemUser, Long> {
//
// SystemUser findOneByUsername(String username);
//
// }
// Path: src/main/java/br/fatea/simplebank/model/services/SystemUserService.java
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import br.fatea.simplebank.model.domains.SystemUser;
import br.fatea.simplebank.model.repositories.SystemUserRepository;
package br.fatea.simplebank.model.services;
@Service
@Transactional
public class SystemUserService {
@Autowired private BCryptPasswordEncoder encoder;
|
@Autowired private SystemUserRepository systemUserRepository;
|
leosilvadev/simplebank
|
src/main/java/br/fatea/simplebank/model/services/SystemUserService.java
|
// Path: src/main/java/br/fatea/simplebank/model/domains/SystemUser.java
// @Entity
// @Table(name = "TBL_SYSTEM_USER")
// public class SystemUser {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// @Column(name = "SUS_ID")
// private Long id;
//
// @NotNull
// @NotEmpty
// @Column(name = "SUS_USERNAME", unique=true)
// private String username;
//
// @NotNull
// @NotEmpty
// @Column(name = "SUS_PASSWORD")
// private String password;
//
// @Version
// @Column(name = "SUS_VERSION")
// private Integer version;
//
// @ManyToMany(fetch = FetchType.EAGER)
// @JoinTable(name = "TBL_SYSTEM_USER_ROLES", joinColumns = @JoinColumn(name = "SYSTEM_USER", referencedColumnName = "SUS_ID"), inverseJoinColumns = @JoinColumn(name = "SYSTEM_ROLE", referencedColumnName = "SRO_ID"))
// private Set<SystemRole> roles;
//
// @Embedded
// private IntegrationConfig integrationConfig;
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public Integer getVersion() {
// return version;
// }
//
// public void setVersion(Integer version) {
// this.version = version;
// }
//
// public Set<SystemRole> getRoles() {
// return roles;
// }
//
// public void setRoles(Set<SystemRole> roles) {
// this.roles = roles;
// }
//
// public IntegrationConfig getIntegrationConfig() {
// return integrationConfig;
// }
//
// public void setIntegrationConfig(IntegrationConfig integrationConfig) {
// this.integrationConfig = integrationConfig;
// }
//
// public void encodePassword(BCryptPasswordEncoder encoder) {
// if(this.password!=null)
// this.password = encoder.encode(password);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result
// + ((username == null) ? 0 : username.hashCode());
// return result;
// }
//
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// SystemUser other = (SystemUser) obj;
// if (username == null) {
// if (other.username != null)
// return false;
// } else if (!username.equals(other.username))
// return false;
// return true;
// }
//
// }
//
// Path: src/main/java/br/fatea/simplebank/model/repositories/SystemUserRepository.java
// @Repository
// public interface SystemUserRepository extends CrudRepository<SystemUser, Long> {
//
// SystemUser findOneByUsername(String username);
//
// }
|
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import br.fatea.simplebank.model.domains.SystemUser;
import br.fatea.simplebank.model.repositories.SystemUserRepository;
|
package br.fatea.simplebank.model.services;
@Service
@Transactional
public class SystemUserService {
@Autowired private BCryptPasswordEncoder encoder;
@Autowired private SystemUserRepository systemUserRepository;
|
// Path: src/main/java/br/fatea/simplebank/model/domains/SystemUser.java
// @Entity
// @Table(name = "TBL_SYSTEM_USER")
// public class SystemUser {
//
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// @Column(name = "SUS_ID")
// private Long id;
//
// @NotNull
// @NotEmpty
// @Column(name = "SUS_USERNAME", unique=true)
// private String username;
//
// @NotNull
// @NotEmpty
// @Column(name = "SUS_PASSWORD")
// private String password;
//
// @Version
// @Column(name = "SUS_VERSION")
// private Integer version;
//
// @ManyToMany(fetch = FetchType.EAGER)
// @JoinTable(name = "TBL_SYSTEM_USER_ROLES", joinColumns = @JoinColumn(name = "SYSTEM_USER", referencedColumnName = "SUS_ID"), inverseJoinColumns = @JoinColumn(name = "SYSTEM_ROLE", referencedColumnName = "SRO_ID"))
// private Set<SystemRole> roles;
//
// @Embedded
// private IntegrationConfig integrationConfig;
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public Integer getVersion() {
// return version;
// }
//
// public void setVersion(Integer version) {
// this.version = version;
// }
//
// public Set<SystemRole> getRoles() {
// return roles;
// }
//
// public void setRoles(Set<SystemRole> roles) {
// this.roles = roles;
// }
//
// public IntegrationConfig getIntegrationConfig() {
// return integrationConfig;
// }
//
// public void setIntegrationConfig(IntegrationConfig integrationConfig) {
// this.integrationConfig = integrationConfig;
// }
//
// public void encodePassword(BCryptPasswordEncoder encoder) {
// if(this.password!=null)
// this.password = encoder.encode(password);
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result
// + ((username == null) ? 0 : username.hashCode());
// return result;
// }
//
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// SystemUser other = (SystemUser) obj;
// if (username == null) {
// if (other.username != null)
// return false;
// } else if (!username.equals(other.username))
// return false;
// return true;
// }
//
// }
//
// Path: src/main/java/br/fatea/simplebank/model/repositories/SystemUserRepository.java
// @Repository
// public interface SystemUserRepository extends CrudRepository<SystemUser, Long> {
//
// SystemUser findOneByUsername(String username);
//
// }
// Path: src/main/java/br/fatea/simplebank/model/services/SystemUserService.java
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import br.fatea.simplebank.model.domains.SystemUser;
import br.fatea.simplebank.model.repositories.SystemUserRepository;
package br.fatea.simplebank.model.services;
@Service
@Transactional
public class SystemUserService {
@Autowired private BCryptPasswordEncoder encoder;
@Autowired private SystemUserRepository systemUserRepository;
|
public void save(SystemUser systemUser){
|
leosilvadev/simplebank
|
src/main/java/br/fatea/simplebank/model/services/PaymentMessageService.java
|
// Path: src/main/java/br/fatea/simplebank/model/jms/messages/PaymentMessage.java
// @JsonTypeName("payment_message")
// public class PaymentMessage {
//
// @JsonProperty(required = true)
// private String order;
//
// @JsonProperty(required = true)
// private PaymentStatus status;
//
// @JsonProperty(required = true, value = "generated_datetime")
// private String generatedDatetime;
//
// @JsonProperty(required = false, value = "detail")
// private String detail;
//
// public PaymentMessage() {
// }
//
// public PaymentMessage(String order, PaymentStatus status, String detail) {
// super();
// this.order = order;
// this.status = status;
// this.generatedDatetime = detail;
// this.generatedDatetime = DatetimeUtil.now(DatetimeUtil.PATTERN_SOAP_DATETIME);
// }
//
// public String getOrder() {
// return order;
// }
//
// public void setOrder(String order) {
// this.order = order;
// }
//
// public PaymentStatus getStatus() {
// return status;
// }
//
// public void setStatus(PaymentStatus status) {
// this.status = status;
// }
//
// public String getGeneratedDatetime() {
// return generatedDatetime;
// }
//
// public void setGeneratedDatetime(String generatedDatetime) {
// this.generatedDatetime = generatedDatetime;
// }
//
// public String getDetail() {
// return detail;
// }
//
// public void setDetail(String detail) {
// this.detail = detail;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((order == null) ? 0 : order.hashCode());
// result = prime * result + ((status == null) ? 0 : status.hashCode());
// return result;
// }
//
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// PaymentMessage other = (PaymentMessage) obj;
// if (order == null) {
// if (other.order != null)
// return false;
// } else if (!order.equals(other.order))
// return false;
// if (status != other.status)
// return false;
// return true;
// }
//
// }
//
// Path: src/main/java/br/fatea/simplebank/model/templates/PaymentJMSTemplate.java
// @Component
// public class PaymentJMSTemplate {
//
// @Autowired private JmsTemplate jmsTemplate;
//
// private Map<String, ActiveMQQueue> queues;
//
// public PaymentJMSTemplate() {
// this.queues = new HashMap<>();
// }
//
// public void send(PaymentMessage message, String queueName) {
// ActiveMQQueue queue;
// if (!queues.containsKey(queueName)) {
// queues.put(queueName, new ActiveMQQueue(queueName));
// }
// queue = queues.get(queueName);
// jmsTemplate.convertAndSend(queue, message);
// }
// }
|
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import br.fatea.simplebank.model.jms.messages.PaymentMessage;
import br.fatea.simplebank.model.templates.PaymentJMSTemplate;
|
package br.fatea.simplebank.model.services;
@Service
public class PaymentMessageService {
|
// Path: src/main/java/br/fatea/simplebank/model/jms/messages/PaymentMessage.java
// @JsonTypeName("payment_message")
// public class PaymentMessage {
//
// @JsonProperty(required = true)
// private String order;
//
// @JsonProperty(required = true)
// private PaymentStatus status;
//
// @JsonProperty(required = true, value = "generated_datetime")
// private String generatedDatetime;
//
// @JsonProperty(required = false, value = "detail")
// private String detail;
//
// public PaymentMessage() {
// }
//
// public PaymentMessage(String order, PaymentStatus status, String detail) {
// super();
// this.order = order;
// this.status = status;
// this.generatedDatetime = detail;
// this.generatedDatetime = DatetimeUtil.now(DatetimeUtil.PATTERN_SOAP_DATETIME);
// }
//
// public String getOrder() {
// return order;
// }
//
// public void setOrder(String order) {
// this.order = order;
// }
//
// public PaymentStatus getStatus() {
// return status;
// }
//
// public void setStatus(PaymentStatus status) {
// this.status = status;
// }
//
// public String getGeneratedDatetime() {
// return generatedDatetime;
// }
//
// public void setGeneratedDatetime(String generatedDatetime) {
// this.generatedDatetime = generatedDatetime;
// }
//
// public String getDetail() {
// return detail;
// }
//
// public void setDetail(String detail) {
// this.detail = detail;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((order == null) ? 0 : order.hashCode());
// result = prime * result + ((status == null) ? 0 : status.hashCode());
// return result;
// }
//
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// PaymentMessage other = (PaymentMessage) obj;
// if (order == null) {
// if (other.order != null)
// return false;
// } else if (!order.equals(other.order))
// return false;
// if (status != other.status)
// return false;
// return true;
// }
//
// }
//
// Path: src/main/java/br/fatea/simplebank/model/templates/PaymentJMSTemplate.java
// @Component
// public class PaymentJMSTemplate {
//
// @Autowired private JmsTemplate jmsTemplate;
//
// private Map<String, ActiveMQQueue> queues;
//
// public PaymentJMSTemplate() {
// this.queues = new HashMap<>();
// }
//
// public void send(PaymentMessage message, String queueName) {
// ActiveMQQueue queue;
// if (!queues.containsKey(queueName)) {
// queues.put(queueName, new ActiveMQQueue(queueName));
// }
// queue = queues.get(queueName);
// jmsTemplate.convertAndSend(queue, message);
// }
// }
// Path: src/main/java/br/fatea/simplebank/model/services/PaymentMessageService.java
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import br.fatea.simplebank.model.jms.messages.PaymentMessage;
import br.fatea.simplebank.model.templates.PaymentJMSTemplate;
package br.fatea.simplebank.model.services;
@Service
public class PaymentMessageService {
|
@Autowired private PaymentJMSTemplate paymentJMSTemplate;
|
leosilvadev/simplebank
|
src/main/java/br/fatea/simplebank/model/services/PaymentMessageService.java
|
// Path: src/main/java/br/fatea/simplebank/model/jms/messages/PaymentMessage.java
// @JsonTypeName("payment_message")
// public class PaymentMessage {
//
// @JsonProperty(required = true)
// private String order;
//
// @JsonProperty(required = true)
// private PaymentStatus status;
//
// @JsonProperty(required = true, value = "generated_datetime")
// private String generatedDatetime;
//
// @JsonProperty(required = false, value = "detail")
// private String detail;
//
// public PaymentMessage() {
// }
//
// public PaymentMessage(String order, PaymentStatus status, String detail) {
// super();
// this.order = order;
// this.status = status;
// this.generatedDatetime = detail;
// this.generatedDatetime = DatetimeUtil.now(DatetimeUtil.PATTERN_SOAP_DATETIME);
// }
//
// public String getOrder() {
// return order;
// }
//
// public void setOrder(String order) {
// this.order = order;
// }
//
// public PaymentStatus getStatus() {
// return status;
// }
//
// public void setStatus(PaymentStatus status) {
// this.status = status;
// }
//
// public String getGeneratedDatetime() {
// return generatedDatetime;
// }
//
// public void setGeneratedDatetime(String generatedDatetime) {
// this.generatedDatetime = generatedDatetime;
// }
//
// public String getDetail() {
// return detail;
// }
//
// public void setDetail(String detail) {
// this.detail = detail;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((order == null) ? 0 : order.hashCode());
// result = prime * result + ((status == null) ? 0 : status.hashCode());
// return result;
// }
//
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// PaymentMessage other = (PaymentMessage) obj;
// if (order == null) {
// if (other.order != null)
// return false;
// } else if (!order.equals(other.order))
// return false;
// if (status != other.status)
// return false;
// return true;
// }
//
// }
//
// Path: src/main/java/br/fatea/simplebank/model/templates/PaymentJMSTemplate.java
// @Component
// public class PaymentJMSTemplate {
//
// @Autowired private JmsTemplate jmsTemplate;
//
// private Map<String, ActiveMQQueue> queues;
//
// public PaymentJMSTemplate() {
// this.queues = new HashMap<>();
// }
//
// public void send(PaymentMessage message, String queueName) {
// ActiveMQQueue queue;
// if (!queues.containsKey(queueName)) {
// queues.put(queueName, new ActiveMQQueue(queueName));
// }
// queue = queues.get(queueName);
// jmsTemplate.convertAndSend(queue, message);
// }
// }
|
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import br.fatea.simplebank.model.jms.messages.PaymentMessage;
import br.fatea.simplebank.model.templates.PaymentJMSTemplate;
|
package br.fatea.simplebank.model.services;
@Service
public class PaymentMessageService {
@Autowired private PaymentJMSTemplate paymentJMSTemplate;
|
// Path: src/main/java/br/fatea/simplebank/model/jms/messages/PaymentMessage.java
// @JsonTypeName("payment_message")
// public class PaymentMessage {
//
// @JsonProperty(required = true)
// private String order;
//
// @JsonProperty(required = true)
// private PaymentStatus status;
//
// @JsonProperty(required = true, value = "generated_datetime")
// private String generatedDatetime;
//
// @JsonProperty(required = false, value = "detail")
// private String detail;
//
// public PaymentMessage() {
// }
//
// public PaymentMessage(String order, PaymentStatus status, String detail) {
// super();
// this.order = order;
// this.status = status;
// this.generatedDatetime = detail;
// this.generatedDatetime = DatetimeUtil.now(DatetimeUtil.PATTERN_SOAP_DATETIME);
// }
//
// public String getOrder() {
// return order;
// }
//
// public void setOrder(String order) {
// this.order = order;
// }
//
// public PaymentStatus getStatus() {
// return status;
// }
//
// public void setStatus(PaymentStatus status) {
// this.status = status;
// }
//
// public String getGeneratedDatetime() {
// return generatedDatetime;
// }
//
// public void setGeneratedDatetime(String generatedDatetime) {
// this.generatedDatetime = generatedDatetime;
// }
//
// public String getDetail() {
// return detail;
// }
//
// public void setDetail(String detail) {
// this.detail = detail;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((order == null) ? 0 : order.hashCode());
// result = prime * result + ((status == null) ? 0 : status.hashCode());
// return result;
// }
//
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// PaymentMessage other = (PaymentMessage) obj;
// if (order == null) {
// if (other.order != null)
// return false;
// } else if (!order.equals(other.order))
// return false;
// if (status != other.status)
// return false;
// return true;
// }
//
// }
//
// Path: src/main/java/br/fatea/simplebank/model/templates/PaymentJMSTemplate.java
// @Component
// public class PaymentJMSTemplate {
//
// @Autowired private JmsTemplate jmsTemplate;
//
// private Map<String, ActiveMQQueue> queues;
//
// public PaymentJMSTemplate() {
// this.queues = new HashMap<>();
// }
//
// public void send(PaymentMessage message, String queueName) {
// ActiveMQQueue queue;
// if (!queues.containsKey(queueName)) {
// queues.put(queueName, new ActiveMQQueue(queueName));
// }
// queue = queues.get(queueName);
// jmsTemplate.convertAndSend(queue, message);
// }
// }
// Path: src/main/java/br/fatea/simplebank/model/services/PaymentMessageService.java
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import br.fatea.simplebank.model.jms.messages.PaymentMessage;
import br.fatea.simplebank.model.templates.PaymentJMSTemplate;
package br.fatea.simplebank.model.services;
@Service
public class PaymentMessageService {
@Autowired private PaymentJMSTemplate paymentJMSTemplate;
|
public void send(PaymentMessage message, String queueName) {
|
leosilvadev/simplebank
|
src/main/java/br/fatea/simplebank/interceptors/SOAPValidationInterceptor.java
|
// Path: src/main/java/br/fatea/simplebank/exceptions/InvalidClientArgumentsException.java
// @SoapFault(faultCode = FaultCode.CLIENT, faultStringOrReason = "Invalid Request Parameters")
// public class InvalidClientArgumentsException extends RuntimeException {
// private static final long serialVersionUID = -2188675525576989114L;
//
// public InvalidClientArgumentsException(String details) {
// super(details);
// }
// }
|
import java.io.IOException;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMResult;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.springframework.ws.WebServiceMessage;
import org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor;
import org.xml.sax.SAXException;
import br.fatea.simplebank.exceptions.InvalidClientArgumentsException;
|
package br.fatea.simplebank.interceptors;
public class SOAPValidationInterceptor extends PayloadValidatingInterceptor {
protected Source getValidationRequestSource(WebServiceMessage request) {
Source source = request.getPayloadSource();
validateSchema(source);
return source;
}
private void validateSchema(Source source) {
SchemaFactory schemaFactory = SchemaFactory.newInstance(getSchemaLanguage());
try {
Schema schema = schemaFactory.newSchema(getSchemas()[0].getFile());
Validator validator = schema.newValidator();
DOMResult result = new DOMResult();
try {
validator.validate(source, result);
} catch (SAXException ex) {
logger.error(ex);
|
// Path: src/main/java/br/fatea/simplebank/exceptions/InvalidClientArgumentsException.java
// @SoapFault(faultCode = FaultCode.CLIENT, faultStringOrReason = "Invalid Request Parameters")
// public class InvalidClientArgumentsException extends RuntimeException {
// private static final long serialVersionUID = -2188675525576989114L;
//
// public InvalidClientArgumentsException(String details) {
// super(details);
// }
// }
// Path: src/main/java/br/fatea/simplebank/interceptors/SOAPValidationInterceptor.java
import java.io.IOException;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMResult;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.springframework.ws.WebServiceMessage;
import org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor;
import org.xml.sax.SAXException;
import br.fatea.simplebank.exceptions.InvalidClientArgumentsException;
package br.fatea.simplebank.interceptors;
public class SOAPValidationInterceptor extends PayloadValidatingInterceptor {
protected Source getValidationRequestSource(WebServiceMessage request) {
Source source = request.getPayloadSource();
validateSchema(source);
return source;
}
private void validateSchema(Source source) {
SchemaFactory schemaFactory = SchemaFactory.newInstance(getSchemaLanguage());
try {
Schema schema = schemaFactory.newSchema(getSchemas()[0].getFile());
Validator validator = schema.newValidator();
DOMResult result = new DOMResult();
try {
validator.validate(source, result);
} catch (SAXException ex) {
logger.error(ex);
|
throw new InvalidClientArgumentsException(ex.getMessage());
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.