Skip to content

Commit

Permalink
GEODE-2267: add validation to the arguments and include export stats …
Browse files Browse the repository at this point in the history
…in the command

  * use the config to determine where the logs and stats are
  • Loading branch information
jinmeiliao committed Mar 4, 2017
1 parent 92582fb commit bf78817
Show file tree
Hide file tree
Showing 43 changed files with 1,434 additions and 943 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@
*/
package org.apache.geode.internal.logging;

import java.util.logging.Level;

import org.apache.geode.i18n.LogWriterI18n;
import org.apache.geode.internal.i18n.LocalizedStrings;

import java.util.logging.Level;

/**
* Extension that adds ERROR to the standard JDK logging level class.
*
* @deprecated use log4j level
*/
public class GemFireLevel extends Level {
private static final long serialVersionUID = -8123818329485173242L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@
* <li>{@link #SEVERE_LEVEL}
* <li>{@link #NONE_LEVEL}
* </ol>
*
* @deprecated use log4j api instead
*/
@Deprecated
public interface InternalLogWriter extends LogWriter, LogWriterI18n {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
*/
package org.apache.geode.internal.logging;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;

import org.apache.geode.internal.logging.log4j.AppenderContext;
import org.apache.geode.internal.logging.log4j.ConfigLocator;
import org.apache.geode.internal.logging.log4j.Configurator;
import org.apache.geode.internal.logging.log4j.FastLogger;
import org.apache.geode.internal.logging.log4j.LogWriterLogger;
import org.apache.geode.internal.logging.log4j.message.GemFireParameterizedMessageFactory;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand All @@ -29,12 +31,9 @@
import org.apache.logging.log4j.core.lookup.StrSubstitutor;
import org.apache.logging.log4j.status.StatusLogger;

import org.apache.geode.internal.logging.log4j.AppenderContext;
import org.apache.geode.internal.logging.log4j.ConfigLocator;
import org.apache.geode.internal.logging.log4j.Configurator;
import org.apache.geode.internal.logging.log4j.FastLogger;
import org.apache.geode.internal.logging.log4j.LogWriterLogger;
import org.apache.geode.internal.logging.log4j.message.GemFireParameterizedMessageFactory;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;

/**
* Centralizes log configuration and initialization.
Expand All @@ -47,6 +46,7 @@ public class LogService extends LogManager {
public static final String BASE_LOGGER_NAME = "org.apache.geode";
public static final String MAIN_LOGGER_NAME = "org.apache.geode";
public static final String SECURITY_LOGGER_NAME = "org.apache.geode.security";
public static final String DEFAULT_LOG_LEVEL = "INFO";

public static final String GEODE_VERBOSE_FILTER = "{GEODE_VERBOSE}";
public static final String GEMFIRE_VERBOSE_FILTER = "{GEMFIRE_VERBOSE}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ private void changeArchiveFile(File newFile, boolean resetHandler, long nanosTim
}
try {
StatArchiveDescriptor archiveDescriptor = new StatArchiveDescriptor.Builder()
.setArchiveName(newFile.getPath()).setSystemId(this.config.getSystemId())
.setArchiveName(newFile.getAbsolutePath()).setSystemId(this.config.getSystemId())
.setSystemStartTime(this.config.getSystemStartTime())
.setSystemDirectoryPath(this.config.getSystemDirectoryPath())
.setProductDescription(this.config.getProductDescription()).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,18 @@ public interface CliAroundInterceptor {
/**
* called by the OperationInvoker before the command is executed
*/
default public Result preExecution(GfshParseResult parseResult) {
default Result preExecution(GfshParseResult parseResult) {
return ResultBuilder.createInfoResult("");
}

@Deprecated
default public Result postExecution(GfshParseResult parseResult, Result commandResult) {
return commandResult;
}

/**
* called by the OperationInvoker after the command is executed
*
* @param tempFile: if the command's isFileDownloadOverHttp is true, the is the File downloaded
* after the http response is processed.
*/
default public Result postExecution(GfshParseResult parseResult, Result commandResult,
Path tempFile) {
return postExecution(parseResult, commandResult);
default Result postExecution(GfshParseResult parseResult, Result commandResult, Path tempFile) {
return commandResult;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,22 @@ public class CommandRequest {

private final Map<String, String> customParameters = new HashMap<String, String>();
private final Map<String, String> env;
private boolean downloadFile = false;
private final boolean downloadFile;

private String customInput;

public CommandRequest(final Map<String, String> env) {
this.env = env;
this.fileData = null;
this.parseResult = null;
downloadFile = false;
}

public CommandRequest(final Map<String, String> env, final byte[][] fileData) {
this.env = env;
this.fileData = fileData;
this.parseResult = null;
downloadFile = false;
}

public CommandRequest(final GfshParseResult parseResult, final Map<String, String> env) {
Expand All @@ -69,9 +71,7 @@ public CommandRequest(final GfshParseResult parseResult, final Map<String, Strin
this.parseResult = parseResult;

CliMetaData metaData = parseResult.getMethod().getDeclaredAnnotation(CliMetaData.class);
if (metaData != null && metaData.isFileDownloadOverHttp()) {
downloadFile = true;
}
this.downloadFile = (metaData != null && metaData.isFileDownloadOverHttp());
}

public String getName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@

import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
Expand Down Expand Up @@ -500,7 +501,7 @@ public Result preExecution(GfshParseResult parseResult) {
}

@Override
public Result postExecution(GfshParseResult parseResult, Result commandResult) {
public Result postExecution(GfshParseResult parseResult, Result commandResult, Path tempFile) {
if (commandResult.hasIncomingFiles()) {
try {
commandResult.saveIncomingFiles(saveDirString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,5 @@ public Result preExecution(GfshParseResult parseResult) {

return fileResult;
}

@Override
public Result postExecution(GfshParseResult parseResult, Result commandResult) {
return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public Result preExecution(GfshParseResult parseResult) {
}

@Override
public Result postExecution(GfshParseResult parseResult, Result commandResult) {
public Result postExecution(GfshParseResult parseResult, Result commandResult, Path tempFile) {
if (commandResult.hasIncomingFiles()) {
try {
commandResult.saveIncomingFiles(System.getProperty("user.dir"));
Expand Down Expand Up @@ -293,11 +293,6 @@ public Result preExecution(GfshParseResult parseResult) {

return fileResult;
}

@Override
public Result postExecution(GfshParseResult parseResult, Result commandResult) {
return null;
}
}

}
Loading

0 comments on commit bf78817

Please sign in to comment.