Search in sources :

Example 1 with Proxifier

use of org.fagu.fmv.soft.utils.Proxifier in project fmv by f-agu.

the class SoftSearch method createAndfireEventFound.

/**
 * @param founds
 * @param softLocator
 * @return
 */
private Soft createAndfireEventFound(Founds founds, SoftLocator softLocator) {
    Soft soft = getProvider().createSoft(founds);
    Proxifier<SoftFindListener> proxifier = new Proxifier<>(SoftFindListener.class);
    proxifier.addAll(softFindListeners);
    ServiceLoader.load(SoftFindListener.class).forEach(proxifier::add);
    SoftFindListener softFindListener = proxifier.proxify();
    softFindListener.eventFound(softLocator, soft);
    return soft;
}
Also used : Proxifier(org.fagu.fmv.soft.utils.Proxifier) SoftFindListener(org.fagu.fmv.soft.find.SoftFindListener)

Example 2 with Proxifier

use of org.fagu.fmv.soft.utils.Proxifier in project fmv by f-agu.

the class SoftExecutor method execute.

// -------------------------------------------------------------
/**
 * @param executorService
 * @return
 * @throws IOException
 */
private <R> R execute(SoftExecutor.ForExec<R> forExec) throws IOException {
    ExecListener execListener = new Proxifier<>(ExecListener.class).addAll(execListeners).proxify();
    CommandLine commandLine = getCommandLine();
    String cmdLineStr = CommandLineUtils.toLine(commandLine);
    execListener.eventPrepare(cmdLineStr);
    List<String> readLineList = new ArrayList<>();
    ReadLine bufferedReadLine = new BufferedReadLine(readLineList);
    FMVExecutor fmvExecutor = createFMVExecutor(execFile.getParentFile(), bufferedReadLine);
    applyCustomizeExecutor(fmvExecutor);
    return forExec.exec(fmvExecutor, commandLine, execListener, readLineList);
}
Also used : BufferedReadLine(org.fagu.fmv.soft.exec.BufferedReadLine) FMVCommandLine(org.fagu.fmv.soft.exec.FMVCommandLine) CommandLine(org.apache.commons.exec.CommandLine) Proxifier(org.fagu.fmv.soft.utils.Proxifier) ArrayList(java.util.ArrayList) ReadLine(org.fagu.fmv.soft.exec.ReadLine) BufferedReadLine(org.fagu.fmv.soft.exec.BufferedReadLine) FMVExecutor(org.fagu.fmv.soft.exec.FMVExecutor)

Aggregations

Proxifier (org.fagu.fmv.soft.utils.Proxifier)2 ArrayList (java.util.ArrayList)1 CommandLine (org.apache.commons.exec.CommandLine)1 BufferedReadLine (org.fagu.fmv.soft.exec.BufferedReadLine)1 FMVCommandLine (org.fagu.fmv.soft.exec.FMVCommandLine)1 FMVExecutor (org.fagu.fmv.soft.exec.FMVExecutor)1 ReadLine (org.fagu.fmv.soft.exec.ReadLine)1 SoftFindListener (org.fagu.fmv.soft.find.SoftFindListener)1