Java源码示例:com.sun.jmx.examples.scandir.config.DirectoryScannerConfig.Action
示例1
private boolean logResult(File file,Action[] actions) {
try {
logManager.log(new ResultRecord(config, actions,file));
return true;
} catch (Exception x) {
LOG.fine("Failed to log: "+file.getAbsolutePath());
}
return false;
}
示例2
/**
* Creates a new instance of ResultRecord.
* @param scan The DirectoryScannerConfig for which this result was
* obtained.
* @param actions The list of actions that were successfully carried out.
* @param f The file for which these actions were successfully carried out.
*/
public ResultRecord(DirectoryScannerConfig scan, Action[] actions,
File f) {
directoryScanner = scan.getName();
this.actions = actions;
date = new Date();
filename = f.getAbsolutePath();
}
示例3
private boolean logResult(File file,Action[] actions) {
try {
logManager.log(new ResultRecord(config, actions,file));
return true;
} catch (Exception x) {
LOG.fine("Failed to log: "+file.getAbsolutePath());
}
return false;
}
示例4
/**
* Creates a new instance of ResultRecord.
* @param scan The DirectoryScannerConfig for which this result was
* obtained.
* @param actions The list of actions that were successfully carried out.
* @param f The file for which these actions were successfully carried out.
*/
public ResultRecord(DirectoryScannerConfig scan, Action[] actions,
File f) {
directoryScanner = scan.getName();
this.actions = actions;
date = new Date();
filename = f.getAbsolutePath();
}
示例5
private boolean logResult(File file,Action[] actions) {
try {
logManager.log(new ResultRecord(config, actions,file));
return true;
} catch (Exception x) {
LOG.fine("Failed to log: "+file.getAbsolutePath());
}
return false;
}
示例6
/**
* Creates a new instance of ResultRecord.
* @param scan The DirectoryScannerConfig for which this result was
* obtained.
* @param actions The list of actions that were successfully carried out.
* @param f The file for which these actions were successfully carried out.
*/
public ResultRecord(DirectoryScannerConfig scan, Action[] actions,
File f) {
directoryScanner = scan.getName();
this.actions = actions;
date = new Date();
filename = f.getAbsolutePath();
}
示例7
private boolean logResult(File file,Action[] actions) {
try {
logManager.log(new ResultRecord(config, actions,file));
return true;
} catch (Exception x) {
LOG.fine("Failed to log: "+file.getAbsolutePath());
}
return false;
}
示例8
/**
* Creates a new instance of ResultRecord.
* @param scan The DirectoryScannerConfig for which this result was
* obtained.
* @param actions The list of actions that were successfully carried out.
* @param f The file for which these actions were successfully carried out.
*/
public ResultRecord(DirectoryScannerConfig scan, Action[] actions,
File f) {
directoryScanner = scan.getName();
this.actions = actions;
date = new Date();
filename = f.getAbsolutePath();
}
示例9
private boolean logResult(File file,Action[] actions) {
try {
logManager.log(new ResultRecord(config, actions,file));
return true;
} catch (Exception x) {
LOG.fine("Failed to log: "+file.getAbsolutePath());
}
return false;
}
示例10
/**
* Creates a new instance of ResultRecord.
* @param scan The DirectoryScannerConfig for which this result was
* obtained.
* @param actions The list of actions that were successfully carried out.
* @param f The file for which these actions were successfully carried out.
*/
public ResultRecord(DirectoryScannerConfig scan, Action[] actions,
File f) {
directoryScanner = scan.getName();
this.actions = actions;
date = new Date();
filename = f.getAbsolutePath();
}
示例11
private boolean logResult(File file,Action[] actions) {
try {
logManager.log(new ResultRecord(config, actions,file));
return true;
} catch (Exception x) {
LOG.fine("Failed to log: "+file.getAbsolutePath());
}
return false;
}
示例12
/**
* Creates a new instance of ResultRecord.
* @param scan The DirectoryScannerConfig for which this result was
* obtained.
* @param actions The list of actions that were successfully carried out.
* @param f The file for which these actions were successfully carried out.
*/
public ResultRecord(DirectoryScannerConfig scan, Action[] actions,
File f) {
directoryScanner = scan.getName();
this.actions = actions;
date = new Date();
filename = f.getAbsolutePath();
}
示例13
private boolean logResult(File file,Action[] actions) {
try {
logManager.log(new ResultRecord(config, actions,file));
return true;
} catch (Exception x) {
LOG.fine("Failed to log: "+file.getAbsolutePath());
}
return false;
}
示例14
/**
* Creates a new instance of ResultRecord.
* @param scan The DirectoryScannerConfig for which this result was
* obtained.
* @param actions The list of actions that were successfully carried out.
* @param f The file for which these actions were successfully carried out.
*/
public ResultRecord(DirectoryScannerConfig scan, Action[] actions,
File f) {
directoryScanner = scan.getName();
this.actions = actions;
date = new Date();
filename = f.getAbsolutePath();
}
示例15
private boolean logResult(File file,Action[] actions) {
try {
logManager.log(new ResultRecord(config, actions,file));
return true;
} catch (Exception x) {
LOG.fine("Failed to log: "+file.getAbsolutePath());
}
return false;
}
示例16
/**
* Creates a new instance of ResultRecord.
* @param scan The DirectoryScannerConfig for which this result was
* obtained.
* @param actions The list of actions that were successfully carried out.
* @param f The file for which these actions were successfully carried out.
*/
public ResultRecord(DirectoryScannerConfig scan, Action[] actions,
File f) {
directoryScanner = scan.getName();
this.actions = actions;
date = new Date();
filename = f.getAbsolutePath();
}
示例17
private boolean logResult(File file,Action[] actions) {
try {
logManager.log(new ResultRecord(config, actions,file));
return true;
} catch (Exception x) {
LOG.fine("Failed to log: "+file.getAbsolutePath());
}
return false;
}
示例18
/**
* Creates a new instance of ResultRecord.
* @param scan The DirectoryScannerConfig for which this result was
* obtained.
* @param actions The list of actions that were successfully carried out.
* @param f The file for which these actions were successfully carried out.
*/
public ResultRecord(DirectoryScannerConfig scan, Action[] actions,
File f) {
directoryScanner = scan.getName();
this.actions = actions;
date = new Date();
filename = f.getAbsolutePath();
}
示例19
private boolean logResult(File file,Action[] actions) {
try {
logManager.log(new ResultRecord(config, actions,file));
return true;
} catch (Exception x) {
LOG.fine("Failed to log: "+file.getAbsolutePath());
}
return false;
}
示例20
/**
* Creates a new instance of ResultRecord.
* @param scan The DirectoryScannerConfig for which this result was
* obtained.
* @param actions The list of actions that were successfully carried out.
* @param f The file for which these actions were successfully carried out.
*/
public ResultRecord(DirectoryScannerConfig scan, Action[] actions,
File f) {
directoryScanner = scan.getName();
this.actions = actions;
date = new Date();
filename = f.getAbsolutePath();
}
示例21
private boolean logResult(File file,Action[] actions) {
try {
logManager.log(new ResultRecord(config, actions,file));
return true;
} catch (Exception x) {
LOG.fine("Failed to log: "+file.getAbsolutePath());
}
return false;
}
示例22
/**
* Creates a new instance of ResultRecord.
* @param scan The DirectoryScannerConfig for which this result was
* obtained.
* @param actions The list of actions that were successfully carried out.
* @param f The file for which these actions were successfully carried out.
*/
public ResultRecord(DirectoryScannerConfig scan, Action[] actions,
File f) {
directoryScanner = scan.getName();
this.actions = actions;
date = new Date();
filename = f.getAbsolutePath();
}
示例23
private boolean logResult(File file,Action[] actions) {
try {
logManager.log(new ResultRecord(config, actions,file));
return true;
} catch (Exception x) {
LOG.fine("Failed to log: "+file.getAbsolutePath());
}
return false;
}
示例24
/**
* Creates a new instance of ResultRecord.
* @param scan The DirectoryScannerConfig for which this result was
* obtained.
* @param actions The list of actions that were successfully carried out.
* @param f The file for which these actions were successfully carried out.
*/
public ResultRecord(DirectoryScannerConfig scan, Action[] actions,
File f) {
directoryScanner = scan.getName();
this.actions = actions;
date = new Date();
filename = f.getAbsolutePath();
}
示例25
void actOn(File file) {
// Which action were actually taken
//
final Set<Action> taken = new HashSet<Action>();
boolean logresult = false;
// Check out which actions are configured and carry them out.
//
for (Action action : actions) {
switch (action) {
case DELETE:
if (deleteFile(file)) {
// Delete succeeded: add DELETE to the set of
// actions carried out.
taken.add(DELETE);
}
break;
case NOTIFY:
if (notifyMatch(file)) {
// Notify succeeded: add NOTIFY to the set of
// actions carried out.
taken.add(NOTIFY);
}
break;
case LOGRESULT:
// LOGRESULT was configured - log actions carried out.
// => we must execute this action as the last action.
// simply set logresult=true for now. We will do
// the logging later
logresult = true;
break;
default:
LOG.fine("Failed to execute action: " +action +
" - action not supported");
break;
}
}
// Now is time for logging:
if (logresult) {
taken.add(LOGRESULT);
if (!logResult(file,taken.toArray(new Action[taken.size()])))
taken.remove(LOGRESULT); // just for the last trace below...
}
LOG.finest("File processed: "+taken+" - "+file.getAbsolutePath());
}
示例26
/**
* Gets the list of actions that were successfully carried out.
* @return the list of actions that were successfully carried out.
*/
@XmlElement(name="Actions",namespace=XmlConfigUtils.NAMESPACE)
@XmlList
public Action[] getActions() {
return (actions == null)?null:actions.clone();
}
示例27
void actOn(File file) {
// Which action were actually taken
//
final Set<Action> taken = new HashSet<Action>();
boolean logresult = false;
// Check out which actions are configured and carry them out.
//
for (Action action : actions) {
switch (action) {
case DELETE:
if (deleteFile(file)) {
// Delete succeeded: add DELETE to the set of
// actions carried out.
taken.add(DELETE);
}
break;
case NOTIFY:
if (notifyMatch(file)) {
// Notify succeeded: add NOTIFY to the set of
// actions carried out.
taken.add(NOTIFY);
}
break;
case LOGRESULT:
// LOGRESULT was configured - log actions carried out.
// => we must execute this action as the last action.
// simply set logresult=true for now. We will do
// the logging later
logresult = true;
break;
default:
LOG.fine("Failed to execute action: " +action +
" - action not supported");
break;
}
}
// Now is time for logging:
if (logresult) {
taken.add(LOGRESULT);
if (!logResult(file,taken.toArray(new Action[taken.size()])))
taken.remove(LOGRESULT); // just for the last trace below...
}
LOG.finest("File processed: "+taken+" - "+file.getAbsolutePath());
}
示例28
/**
* Gets the list of actions that were successfully carried out.
* @return the list of actions that were successfully carried out.
*/
@XmlElement(name="Actions",namespace=XmlConfigUtils.NAMESPACE)
@XmlList
public Action[] getActions() {
return (actions == null)?null:actions.clone();
}
示例29
void actOn(File file) {
// Which action were actually taken
//
final Set<Action> taken = new HashSet<Action>();
boolean logresult = false;
// Check out which actions are configured and carry them out.
//
for (Action action : actions) {
switch (action) {
case DELETE:
if (deleteFile(file)) {
// Delete succeeded: add DELETE to the set of
// actions carried out.
taken.add(DELETE);
}
break;
case NOTIFY:
if (notifyMatch(file)) {
// Notify succeeded: add NOTIFY to the set of
// actions carried out.
taken.add(NOTIFY);
}
break;
case LOGRESULT:
// LOGRESULT was configured - log actions carried out.
// => we must execute this action as the last action.
// simply set logresult=true for now. We will do
// the logging later
logresult = true;
break;
default:
LOG.fine("Failed to execute action: " +action +
" - action not supported");
break;
}
}
// Now is time for logging:
if (logresult) {
taken.add(LOGRESULT);
if (!logResult(file,taken.toArray(new Action[taken.size()])))
taken.remove(LOGRESULT); // just for the last trace below...
}
LOG.finest("File processed: "+taken+" - "+file.getAbsolutePath());
}
示例30
/**
* Gets the list of actions that were successfully carried out.
* @return the list of actions that were successfully carried out.
*/
@XmlElement(name="Actions",namespace=XmlConfigUtils.NAMESPACE)
@XmlList
public Action[] getActions() {
return (actions == null)?null:actions.clone();
}