com.sun.jmx.examples.scandir.config.DirectoryScannerConfig.Action Java Examples

The following examples show how to use com.sun.jmx.examples.scandir.config.DirectoryScannerConfig.Action. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DirectoryScanner.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #2
Source File: DirectoryScanner.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #3
Source File: ResultRecord.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #4
Source File: DirectoryScanner.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #5
Source File: ResultRecord.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #6
Source File: ResultRecord.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #7
Source File: DirectoryScanner.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #8
Source File: DirectoryScanner.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #9
Source File: ResultRecord.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #10
Source File: ResultRecord.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #11
Source File: DirectoryScanner.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #12
Source File: DirectoryScanner.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #13
Source File: ResultRecord.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #14
Source File: ResultRecord.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #15
Source File: DirectoryScanner.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #16
Source File: DirectoryScanner.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #17
Source File: ResultRecord.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #18
Source File: DirectoryScanner.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #19
Source File: ResultRecord.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #20
Source File: ResultRecord.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #21
Source File: ResultRecord.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #22
Source File: ResultRecord.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #23
Source File: DirectoryScanner.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #24
Source File: DirectoryScanner.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #25
Source File: DirectoryScanner.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
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());
    }
 
Example #26
Source File: ResultRecord.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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();
}
 
Example #27
Source File: DirectoryScanner.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
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());
    }
 
Example #28
Source File: ResultRecord.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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();
}
 
Example #29
Source File: ResultRecord.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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();
}
 
Example #30
Source File: DirectoryScanner.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
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());
    }