Example usage for org.apache.commons.vfs FileObject getName

List of usage examples for org.apache.commons.vfs FileObject getName

Introduction

In this page you can find the example usage for org.apache.commons.vfs FileObject getName.

Prototype

public FileName getName();

Source Link

Document

Returns the name of this file.

Usage

From source file:org.openbi.kettle.plugins.parquetoutput.ParquetOutput.java

private void createParentFolder(String filename) throws Exception {
    // Check for parent folder
    FileObject parentfolder = null;
    FileObject schemaParentFolder = null;
    try {// www  .  j a  v a  2 s. co  m
        // Get parent folder
        parentfolder = getFileObject(filename).getParent();
        if (parentfolder.exists()) {
            if (isDetailed()) {
                logDetailed(BaseMessages.getString(PKG, "AvroOutput.Log.ParentFolderExist",
                        parentfolder.getName()));
            }
        } else {
            if (isDetailed()) {
                logDetailed(BaseMessages.getString(PKG, "AvroOutput.Log.ParentFolderNotExist",
                        parentfolder.getName()));
            }
            if (meta.isCreateParentFolder()) {
                parentfolder.createFolder();
                if (isDetailed()) {
                    logDetailed(BaseMessages.getString(PKG, "AvroOutput.Log.ParentFolderCreated",
                            parentfolder.getName()));
                }
            } else {
                throw new KettleException(BaseMessages.getString(PKG,
                        "AvroOutput.Log.ParentFolderNotExistCreateIt", parentfolder.getName(), filename));
            }
        }

    } finally {
        if (parentfolder != null) {
            try {
                parentfolder.close();
            } catch (Exception ex) {
                // Ignore
            }
        }

    }
}

From source file:org.openbi.kettle.plugins.refreshtableauextract.RefreshTableauExtract.java

public Result execute(Result previousResult, int nr) throws KettleException {
    Result result = previousResult;
    result.setResult(validate());//from w  ww .  j a va 2s. c om
    if (!result.getResult()) {
        return result;
    }
    String[] commands;
    String tableauCommand = getRealValue(getTableauClient()).trim();
    if (tableauCommand.toLowerCase().endsWith(".exe")) {
        tableauCommand = tableauCommand.substring(0, tableauCommand.length() - 4);
    }
    tableauCommand = "\"" + tableauCommand + "\"";
    if (getRefreshType() == 0 || getRefreshType() == 1) {
        tableauCommand += " refreshextract";
    } else if (getRefreshType() == 2) {
        tableauCommand += " addfiletoextract";
    } else {
        logError(BaseMessages.getString(PKG, "RefreshTableauExtract.Error.InvalidRefreshType"));
        result.setResult(false);
        return result;
    }

    tableauCommand += " --server " + protocolList[getProtocol()] + "://" + getRealValue(getServer());
    if (getRealValue(getServerPort()) != null && !getRealValue(getServerPort()).isEmpty()) {
        tableauCommand += ":" + getRealValue(getServerPort());
    }

    tableauCommand += " --username " + getRealValue(getServerUser());
    tableauCommand += " --password " + getRealValue(getServerPassword());
    tableauCommand += " --datasource \"" + getRealValue(getDataSource()) + "\"";

    if (getRealValue(getSiteName()) != null && !getRealValue(getSiteName()).isEmpty()) {
        tableauCommand += " --site \"" + getRealValue(getSiteName()) + "\"";
    }
    if (getRealValue(getProject()) != null && !getRealValue(getProject()).isEmpty()) {
        tableauCommand += " --project \"" + getRealValue(getProject()) + "\"";
    }
    if (getRealValue(getProxyUser()) != null && !getRealValue(getProxyUser()).isEmpty()) {
        tableauCommand += " --proxy-username " + getRealValue(getProxyUser());
    }
    if (getRealValue(getProxyPassword()) != null && !getRealValue(getProxyPassword()).isEmpty()) {
        tableauCommand += " --proxy-password " + getRealValue(getProxyPassword());
    }

    if (getRefreshType() == 0) {
        commands = new String[1];
        tableauCommand += " --original-file \"" + getRealValue(getExtractFile()) + "\"";
        commands[0] = new String(tableauCommand);
    } else if (getRefreshType() == 1) {
        commands = new String[1];
        if (getFullRefresh()) {
            tableauCommand += " --force-full-refresh";
        }
        if (getRealValue(getSourceUser()) != null && !getRealValue(getSourceUser()).isEmpty()) {
            tableauCommand += " --source-username " + getRealValue(getSourceUser());
        }
        if (getRealValue(getSourcePassword()) != null & !getRealValue(getSourcePassword()).isEmpty()) {
            tableauCommand += " --source-password " + getRealValue(getSourcePassword());
        }
        commands[0] = new String(tableauCommand);
    } else {
        String[] fileStrings = null;
        if (processResultFiles) {
            if (result != null && previousResult.getResultFiles().size() > 0) {

                int size = previousResult.getResultFiles().size();
                if (log.isBasic()) {
                    logBasic(BaseMessages.getString(PKG, "RefreshTableauExtract.FilesFound", "" + size));
                }
                try {
                    List<ResultFile> resultFiles = previousResult.getResultFilesList();
                    List<String> files = new ArrayList<String>();
                    Iterator<ResultFile> it = resultFiles.iterator();
                    while (it.hasNext()) {
                        ResultFile f = it.next();
                        FileObject o = f.getFile();
                        if (o.getType().equals(FileType.FILE)) {
                            if (o.exists()) {
                                files.add(o.getName().toString().startsWith("file:///")
                                        ? o.getName().toString().substring(8)
                                        : o.getName().toString());
                            } else {
                                logBasic(BaseMessages.getString(PKG, "RefreshTableauExtract.FileNotExist",
                                        "" + o.getName()));
                            }
                        } else {
                            logBasic(BaseMessages.getString(PKG, "RefreshTableauExtract.ResultNotFile",
                                    "" + o.getName()));
                        }
                    }
                    if (files.size() > 0) {
                        Iterator<String> ite = files.iterator();
                        fileStrings = new String[files.size()];
                        int i = 0;
                        while (ite.hasNext()) {
                            fileStrings[i] = ite.next();
                            i++;
                        }

                    } else {
                        logBasic(BaseMessages.getString(PKG, "RefreshTableauExtract.NoFilesOnResult"));
                        result.setResult(true);
                        return result;
                    }
                } catch (Exception ex) {
                    logError(ex.toString());
                    result.setResult(false);
                    return result;
                }
            } else {
                logBasic(BaseMessages.getString(PKG, "RefreshTableauExtract.NoFilesOnResult"));
                result.setResult(true);
                return result;
            }
        } else {
            // Get source and destination files, also wildcard
            String[] vFilePaths = filePaths;
            String[] vWildcards = wildcards;
            boolean[] includeSubfolders = new boolean[vFilePaths.length];
            String[] fileRequired = new String[vFilePaths.length];

            for (int i = 0; i < includeSubfolders.length; i++) {
                includeSubfolders[i] = false;
            }
            FileInputList files = FileInputList.createFileList(this, vFilePaths, vWildcards, fileRequired,
                    includeSubfolders);
            fileStrings = new String[files.getFileStrings().length];
            fileStrings = files.getFileStrings();
        }
        commands = new String[fileStrings.length];
        for (int i = 0; i < fileStrings.length; i++) {
            commands[i] = new String(tableauCommand + " --file \"" + fileStrings[i] + "\"");
        }
    }

    FileObject fileObject = null;
    String realScript = "";
    FileObject tempFile = null;

    for (int i = 0; i < commands.length; i++) {
        //    realScript+="echo Running: "+commands[i]+"\n";
        realScript += commands[i] + "\n";
        if (log.isDetailed()) {
            logDetailed(BaseMessages.getString(PKG, "RefreshTableauExtract.Commands", commands[i]));
        }
    }
    try {
        // What's the exact command?
        String[] command;

        if (log.isBasic()) {
            logBasic(BaseMessages.getString(PKG, "RefreshTableuaExtract.RunningOn", Const.getOS()));
        }

        if (Const.getOS().equals("Windows 95")) {
            //base = new String[] { "command.com", "/C" };
            tempFile = KettleVFS.createTempFile("kettle", "shell.bat", null, this);
            fileObject = createTemporaryShellFile(tempFile, realScript);
            command = new String[] { "command.com", "/C",
                    "\"" + Const.optionallyQuoteStringByOS(KettleVFS.getFilename(fileObject)) + "\"" };
        } else if (Const.getOS().startsWith("Windows")) {
            //base = new String[] { "cmd.exe", "/C" };
            tempFile = KettleVFS.createTempFile("kettle", "shell.bat", null, this);
            fileObject = createTemporaryShellFile(tempFile, realScript);
            command = new String[] { "cmd.exe", "/C",
                    "\"" + Const.optionallyQuoteStringByOS(KettleVFS.getFilename(fileObject)) + "\"" };
        } else {
            tempFile = KettleVFS.createTempFile("kettle", "shell", null, this);
            fileObject = createTemporaryShellFile(tempFile, realScript);
            command = new String[] { Const.optionallyQuoteStringByOS(KettleVFS.getFilename(fileObject)) };
        }

        ProcessBuilder pb = new ProcessBuilder(command);

        Map<String, String> env = pb.environment();
        String[] variables = listVariables();
        for (int i = 0; i < variables.length; i++) {
            env.put(variables[i], getVariable(variables[i]));
        }

        if (getWorkingDirectory() != null && !Const.isEmpty(Const.rtrim(getRealValue(getWorkingDirectory())))) {
            String vfsFilename = environmentSubstitute(getRealValue(getWorkingDirectory()));
            File file = new File(KettleVFS.getFilename(KettleVFS.getFileObject(vfsFilename, this)));
            pb.directory(file);
        }

        if (log.isDetailed()) {
            logDetailed(BaseMessages.getString(PKG, "RefreshTableauExtract.CommandStarted"));
        }
        Process proc = pb.start();
        // any error message?
        StreamLogger errorLogger = new StreamLogger(log, proc.getErrorStream(), "(stderr)");

        // any output?
        StreamLogger outputLogger = new StreamLogger(log, proc.getInputStream(), "(stdout)");

        // kick them off
        new Thread(errorLogger).start();
        new Thread(outputLogger).start();

        proc.waitFor();

        if (log.isDetailed()) {
            logDetailed(BaseMessages.getString(PKG, "RefreshTableauExtract.CommandFinished"));
        }
        // What's the exit status?
        result.setExitStatus(proc.exitValue());
        if (result.getExitStatus() != 0) {
            logError(BaseMessages.getString(PKG, "RefreshTableauExtract.ExitStatus",
                    "" + result.getExitStatus()));
            result.setResult(false);
        }

        // close the streams
        // otherwise you get "Too many open files, java.io.IOException" after a lot of iterations
        proc.getErrorStream().close();
        proc.getOutputStream().close();

    } catch (Exception ex) {
        logError(ex.toString());
        result.setResult(false);
    } finally {
        // If we created a temporary file, remove it...
        //
        if (tempFile != null) {
            try {
                tempFile.delete();
            } catch (Exception e) {
                BaseMessages.getString(PKG, "RefreshTableauExtract.UnexpectedError", tempFile.toString(),
                        e.toString());
            }
        }
    }

    return result;

}

From source file:org.openbi.kettle.plugins.tableauDataExtract.TDEOutput.java

private void createParentFolder(String filename) throws Exception {
    // Check for parent folder
    FileObject parentfolder = null;
    try {//from   ww w  .  j av  a  2s .  co m
        // Get parent folder
        parentfolder = KettleVFS.getFileObject(filename).getParent();
        if (parentfolder.exists()) {
            if (isDetailed())
                logDetailed(
                        BaseMessages.getString(PKG, "TDEOutput.Log.ParentFolderExist", parentfolder.getName()));
        } else {
            if (isDetailed())
                logDetailed(BaseMessages.getString(PKG, "TDEOutput.Log.ParentFolderNotExist",
                        parentfolder.getName()));
            if (meta.isCreateParentFolder()) {
                parentfolder.createFolder();
                if (isDetailed())
                    logDetailed(BaseMessages.getString(PKG, "TDEOutput.Log.ParentFolderCreated",
                            parentfolder.getName()));
            } else {
                throw new KettleException(BaseMessages.getString(PKG,
                        "TDEOutput.Log.ParentFolderNotExistCreateIt", parentfolder.getName(), filename));
            }
        }
    } finally {
        if (parentfolder != null) {
            try {
                parentfolder.close();
            } catch (Exception ex) {
            }
            ;
        }
    }
}

From source file:org.org.eclipse.core.utils.platform.tools.ArchivesToolBox.java

private static void decompressFileObjectTo(FileObject fileObject, File targetFolder, IWriteHinter writeHinter)
        throws IOException {
    for (FileObject child : fileObject.getChildren()) {
        String childName = child.getName().getBaseName();
        FileType type = child.getType();
        if (type.equals(FileType.FOLDER)) {
            String folderName = writeHinter.alterFolderName(targetFolder, childName);
            File folder = new File(targetFolder, folderName);
            if (!folder.exists()) {
                folder.mkdirs();/* w ww. ja  va 2s .co  m*/
            }
            decompressFileObjectTo(child, folder, writeHinter);
        }
        if (type.equals(FileType.FILE)) {
            String fileName = writeHinter.alterFileName(targetFolder, childName);
            File newFile = new File(targetFolder, fileName);
            newFile.createNewFile();
            WriteMode writeMode = writeHinter.getFileWriteMode(newFile);
            if (writeMode != WriteMode.SKIP) {
                FileOutputStream fileOutputStream = new FileOutputStream(newFile);
                InputStream inputStream = child.getContent().getInputStream();
                try {
                    IOToolBox.inToOut(inputStream, fileOutputStream);
                } finally {
                    inputStream.close();
                    fileOutputStream.close();
                }
            }
        }
    }
}

From source file:org.pentaho.amazon.emr.ui.AmazonElasticMapReduceJobExecutorDialog.java

public AmazonElasticMapReduceJobExecutorDialog(Shell parent, JobEntryInterface jobEntry, Repository rep,
        JobMeta jobMeta) throws XulException, DocumentException {
    super(parent, jobEntry, rep, jobMeta);

    /*//from  www  .j a v a 2 s  .co  m
     * final BindingConvertor<String, Integer> bindingConverter = new BindingConvertor<String, Integer>() {
     * 
     * public Integer sourceToTarget(String value) { return Integer.parseInt(value); }
     * 
     * public String targetToSource(Integer value) { return value.toString(); }
     * 
     * };
     */

    this.jobEntry = (AmazonElasticMapReduceJobExecutor) jobEntry;

    SwtXulLoader swtXulLoader = new SwtXulLoader();
    swtXulLoader.registerClassLoader(getClass().getClassLoader());
    swtXulLoader.register("VARIABLETEXTBOX", "org.pentaho.di.ui.core.database.dialog.tags.ExtTextbox");
    swtXulLoader.setOuterContext(shell);

    container = swtXulLoader.loadXul("org/pentaho/amazon/emr/ui/AmazonElasticMapReduceJobExecutorDialog.xul", //$NON-NLS-1$
            bundle);

    final XulRunner runner = new SwtXulRunner();
    runner.addContainer(container);

    container.addEventHandler(controller);

    bf = new DefaultBindingFactory();
    bf.setDocument(container.getDocumentRoot());
    bf.setBindingType(Type.BI_DIRECTIONAL);

    bf.createBinding("jobentry-name", "value", controller, //$NON-NLS-1$//$NON-NLS-2$
            AmazonElasticMapReduceJobExecutorController.JOB_ENTRY_NAME); //$NON-NLS-3$
    bf.createBinding("jobentry-hadoopjob-name", "value", controller, //$NON-NLS-1$//$NON-NLS-2$
            AmazonElasticMapReduceJobExecutorController.HADOOP_JOB_NAME); //$NON-NLS-3$
    bf.createBinding("jobentry-hadoopjob-flow-id", "value", controller, //$NON-NLS-1$//$NON-NLS-2$
            AmazonElasticMapReduceJobExecutorController.HADOOP_JOB_FLOW_ID); //$NON-NLS-3$
    bf.createBinding("jar-url", "value", controller, AmazonElasticMapReduceJobExecutorController.JAR_URL); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    bf.createBinding("access-key", "value", controller, AmazonElasticMapReduceJobExecutorController.ACCESS_KEY); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    bf.createBinding("secret-key", "value", controller, AmazonElasticMapReduceJobExecutorController.SECRET_KEY); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    BindingConvertor<String, FileObject> stagingDirBinding = new BindingConvertor<String, FileObject>() {

        @Override
        public FileObject sourceToTarget(String s) {
            // resolve the file
            try {
                VariableSpace vs = controller.getVariableSpace();
                FileSystemOptions opts = new FileSystemOptions();
                DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts,
                        new StaticUserAuthenticator(null, controller.getAccessKey(),
                                controller.getSecretKey()));
                FileObject file = KettleVFS.getFileObject(s, vs, opts);
                return file;
            } catch (FileSystemException e) {
                return null;
            } catch (KettleFileException e) {
                return null;
            }
        }

        @Override
        public String targetToSource(FileObject fileObject) {
            return fileObject.getName().getURI();
        }
    };

    bf.createBinding("s3-staging-directory", "value", controller, //$NON-NLS-1$//$NON-NLS-2$
            AmazonElasticMapReduceJobExecutorController.STAGING_DIR); //$NON-NLS-3$

    bf.setBindingType(Type.ONE_WAY);
    bf.createBinding("s3-staging-directory", "value", controller, //$NON-NLS-1$//$NON-NLS-2$
            AmazonElasticMapReduceJobExecutorController.STAGING_DIR_FILE, stagingDirBinding); //$NON-NLS-3$

    bf.setBindingType(Type.BI_DIRECTIONAL);
    //    bf.createBinding("num-instances", "value", controller, AmazonElasticMapReduceJobExecutorController.NUM_INSTANCES, bindingConverter); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    bf.createBinding("num-instances", "value", controller, //$NON-NLS-1$//$NON-NLS-2$
            AmazonElasticMapReduceJobExecutorController.NUM_INSTANCES); //$NON-NLS-3$
    bf.createBinding("master-instance-type", "selectedItem", controller, //$NON-NLS-1$//$NON-NLS-2$
            AmazonElasticMapReduceJobExecutorController.MASTER_INSTANCE_TYPE); //$NON-NLS-3$
    bf.createBinding("slave-instance-type", "selectedItem", controller, //$NON-NLS-1$//$NON-NLS-2$
            AmazonElasticMapReduceJobExecutorController.SLAVE_INSTANCE_TYPE); //$NON-NLS-3$

    bf.createBinding("command-line-arguments", "value", controller, //$NON-NLS-1$//$NON-NLS-2$
            AmazonElasticMapReduceJobExecutorController.CMD_LINE_ARGS); //$NON-NLS-3$

    XulTextbox numInstances = (XulTextbox) container.getDocumentRoot().getElementById("num-instances");
    numInstances.setValue("" + controller.getNumInstances());

    XulMenuList<String> masterInstanceType = (XulMenuList<String>) container.getDocumentRoot()
            .getElementById("master-instance-type");
    masterInstanceType.setSelectedItem("" + controller.getMasterInstanceType());

    XulMenuList<String> slaveInstanceType = (XulMenuList<String>) container.getDocumentRoot()
            .getElementById("slave-instance-type");
    slaveInstanceType.setSelectedItem("" + controller.getSlaveInstanceType());

    bf.createBinding("blocking", "selected", controller, AmazonElasticMapReduceJobExecutorController.BLOCKING); //$NON-NLS-1$ //$NON-NLS-2$ 
    //    bf.createBinding("logging-interval", "value", controller, AmazonElasticMapReduceJobExecutorController.LOGGING_INTERVAL, bindingConverter); //$NON-NLS-1$ //$NON-NLS-2$
    bf.createBinding("logging-interval", "value", controller, //$NON-NLS-1$//$NON-NLS-2$
            AmazonElasticMapReduceJobExecutorController.LOGGING_INTERVAL);

    XulTextbox loggingInterval = (XulTextbox) container.getDocumentRoot().getElementById("logging-interval");
    loggingInterval.setValue("" + controller.getLoggingInterval());

    ExtTextbox tempBox = (ExtTextbox) container.getDocumentRoot().getElementById("access-key");
    tempBox.setVariableSpace(controller.getVariableSpace());
    tempBox = (ExtTextbox) container.getDocumentRoot().getElementById("secret-key");
    tempBox.setVariableSpace(controller.getVariableSpace());
    tempBox = (ExtTextbox) container.getDocumentRoot().getElementById("jobentry-hadoopjob-name");
    tempBox.setVariableSpace(controller.getVariableSpace());
    tempBox = (ExtTextbox) container.getDocumentRoot().getElementById("jobentry-hadoopjob-flow-id");
    tempBox.setVariableSpace(controller.getVariableSpace());
    tempBox = (ExtTextbox) container.getDocumentRoot().getElementById("s3-staging-directory");
    tempBox.setVariableSpace(controller.getVariableSpace());
    tempBox = (ExtTextbox) container.getDocumentRoot().getElementById("jar-url");
    tempBox.setVariableSpace(controller.getVariableSpace());
    tempBox = (ExtTextbox) container.getDocumentRoot().getElementById("command-line-arguments");
    tempBox.setVariableSpace(controller.getVariableSpace());
    tempBox = (ExtTextbox) container.getDocumentRoot().getElementById("num-instances");
    tempBox.setVariableSpace(controller.getVariableSpace());
    tempBox = (ExtTextbox) container.getDocumentRoot().getElementById("logging-interval");
    tempBox.setVariableSpace(controller.getVariableSpace());

    bf.setBindingType(Type.BI_DIRECTIONAL);

    controller.setJobEntry((AmazonElasticMapReduceJobExecutor) jobEntry);
    controller.init();
}

From source file:org.pentaho.di.core.encryption.TwoWayPasswordEncoderPluginType.java

@Override
protected void registerXmlPlugins() throws KettlePluginException {
    for (PluginFolderInterface folder : pluginFolders) {

        if (folder.isPluginXmlFolder()) {
            List<FileObject> pluginXmlFiles = findPluginXmlFiles(folder.getFolder());
            for (FileObject file : pluginXmlFiles) {

                try {
                    Document document = XMLHandler.loadXMLFile(file);
                    Node pluginNode = XMLHandler.getSubNode(document, "plugin");
                    if (pluginNode != null) {
                        registerPluginFromXmlResource(pluginNode, KettleVFS.getFilename(file.getParent()),
                                this.getClass(), false, file.getParent().getURL());
                    }//from w w  w  .  j ava2  s  . c om
                } catch (Exception e) {
                    // We want to report this plugin.xml error, perhaps an XML typo or something like that...
                    //
                    log.logError("Error found while reading password encoder plugin.xml file: "
                            + file.getName().toString(), e);
                }
            }
        }
    }
}

From source file:org.pentaho.di.core.fileinput.CharsetToolkit.java

public static Charset guessEncoding(FileObject file, int bufferLength)
        throws FileNotFoundException, IOException {
    return guessEncoding(new File(file.getName().getPathDecoded()), bufferLength);
}

From source file:org.pentaho.di.core.fileinput.CharsetToolkit.java

public static String guessEncodingName(FileObject file) throws FileNotFoundException, IOException {
    return guessEncodingName(new File(file.getName().getPathDecoded()));
}

From source file:org.pentaho.di.core.logging.LoggingPluginType.java

@Override
protected void registerXmlPlugins() throws KettlePluginException {
    for (PluginFolderInterface folder : pluginFolders) {

        if (folder.isPluginXmlFolder()) {
            List<FileObject> pluginXmlFiles = findPluginXmlFiles(folder.getFolder());
            for (FileObject file : pluginXmlFiles) {

                try {
                    Document document = XMLHandler.loadXMLFile(file);
                    Node pluginNode = XMLHandler.getSubNode(document, "plugin");
                    if (pluginNode != null) {
                        registerPluginFromXmlResource(pluginNode, KettleVFS.getFilename(file.getParent()),
                                this.getClass(), false, file.getParent().getURL());
                    }//from  www.ja va2 s  .co  m
                } catch (Exception e) {
                    // We want to report this plugin.xml error, perhaps an XML typo or something like that...
                    //
                    log.logError(
                            "Error found while reading logging plugin.xml file: " + file.getName().toString(),
                            e);
                }
            }
        }
    }
}

From source file:org.pentaho.di.core.logging.LogTablePluginType.java

protected void registerXmlPlugins() throws KettlePluginException {
    for (PluginFolderInterface folder : pluginFolders) {

        if (folder.isPluginXmlFolder()) {
            List<FileObject> pluginXmlFiles = findPluginXmlFiles(folder.getFolder());
            for (FileObject file : pluginXmlFiles) {

                try {
                    Document document = XMLHandler.loadXMLFile(file);
                    Node pluginNode = XMLHandler.getSubNode(document, "plugin");
                    if (pluginNode != null) {
                        registerPluginFromXmlResource(pluginNode, KettleVFS.getFilename(file.getParent()),
                                this.getClass(), false, file.getParent().getURL());
                    }/* www .  j av a2  s  .c  o m*/
                } catch (Exception e) {
                    // We want to report this plugin.xml error, perhaps an XML typo or something like that...
                    //
                    log.logError(
                            "Error found while reading logging plugin.xml file: " + file.getName().toString(),
                            e);
                }
            }
        }
    }
}