Example usage for org.apache.commons.vfs FileSystemException printStackTrace

List of usage examples for org.apache.commons.vfs FileSystemException printStackTrace

Introduction

In this page you can find the example usage for org.apache.commons.vfs FileSystemException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:org.gatherdata.archiver.dao.vfs.internal.VfsArchiverDao.java

public List<GatherArchive> getAll() {
    List<GatherArchive> allEnvelopes = new ArrayList<GatherArchive>();
    try {// w ww . j a v  a2s  .  c o  m
        for (FileObject envelopeFile : fsBase.getChildren()) {
            allEnvelopes.add(
                    (GatherArchive) SerializationUtils.deserialize(envelopeFile.getContent().getInputStream()));
        }
    } catch (FileSystemException e) {
        e.printStackTrace();
    }
    return allEnvelopes;
}

From source file:org.gatherdata.archiver.dao.vfs.internal.VfsArchiverDao.java

public int getCount() {
    try {//from   w w w .ja  v a2s .  c o  m
        return fsBase.getChildren().length;
    } catch (FileSystemException e) {
        e.printStackTrace();
    }
    return -1;
}

From source file:org.gatherdata.archiver.dao.vfs.internal.VfsArchiverDao.java

public void remove(URI uid) {
    try {/* w  ww  .jav  a  2 s. c  o  m*/
        FileObject envelopeFile = fsManager.resolveFile(fsBase, uid.toASCIIString());
        if (envelopeFile.exists()) {
            envelopeFile.delete();
        }
    } catch (FileSystemException e) {
        e.printStackTrace();
    }
}

From source file:org.gatherdata.archiver.dao.vfs.internal.VfsArchiverDao.java

public GatherArchive save(GatherArchive envelopeToSave) {
    try {//from   ww w . j  av a2  s  . c o  m
        FileObject envelopeFile = fsManager.resolveFile(fsBase, envelopeToSave.getUid().toASCIIString());
        if (envelopeFile.exists()) {
            envelopeFile.delete();
        }
        envelopeFile.createFile();
        SerializationUtils.serialize(envelopeToSave, envelopeFile.getContent().getOutputStream());
    } catch (FileSystemException e) {
        e.printStackTrace();
    }

    return envelopeToSave;
}

From source file:org.geoserver.importer.VFSWorker.java

/**
 * // w  w w.  j a  va2 s  . co m
 * @param archiveFile
 * @param filter
 * 
 * @return
 */
public List<String> listFiles(final File archiveFile, final FilenameFilter filter) {
    FileSystemManager fsManager;
    try {
        fsManager = VFS.getManager();
        String absolutePath = resolveArchiveURI(archiveFile);
        FileObject resolvedFile = fsManager.resolveFile(absolutePath);

        FileSelector fileSelector = new FileSelector() {
            /**
             * @see org.apache.commons.vfs.FileSelector#traverseDescendents(org.apache.commons.vfs.FileSelectInfo)
             */
            public boolean traverseDescendents(FileSelectInfo folderInfo) throws Exception {
                return true;
            }

            /**
             * @see org.apache.commons.vfs.FileSelector#includeFile(org.apache.commons.vfs.FileSelectInfo)
             */
            public boolean includeFile(FileSelectInfo fileInfo) throws Exception {
                File folder = archiveFile.getParentFile();
                String name = fileInfo.getFile().getName().getFriendlyURI();
                return filter.accept(folder, name);
            }
        };

        FileObject fileSystem;
        if (fsManager.canCreateFileSystem(resolvedFile)) {
            fileSystem = fsManager.createFileSystem(resolvedFile);
        } else {
            fileSystem = resolvedFile;
        }
        LOGGER.fine("Listing spatial data files archived in " + archiveFile.getName());
        FileObject[] containedFiles = fileSystem.findFiles(fileSelector);
        List<String> names = new ArrayList<String>(containedFiles.length);
        for (FileObject fo : containedFiles) {
            // path relative to its filesystem (ie, to the archive file)
            String pathDecoded = fo.getName().getPathDecoded();
            names.add(pathDecoded);
        }
        LOGGER.fine("Found " + names.size() + " spatial data files in " + archiveFile.getName() + ": " + names);
        return names;
    } catch (FileSystemException e) {
        e.printStackTrace();
    } finally {
        // fsManager.closeFileSystem(fileSystem.getFileSystem());
    }
    return Collections.emptyList();
}

From source file:org.jahia.services.content.impl.vfs.VFSNodeImpl.java

public VFSNodeImpl(FileObject fileObject, VFSSessionImpl session) {
    this.fileObject = fileObject;
    this.session = session;
    this.properties = new HashMap<String, VFSPropertyImpl>();
    try {/*from w ww  .  j a  v  a 2s.c  o  m*/
        if (fileObject.exists() && (fileObject.getContent() != null)) {
            long lastModifiedTime = fileObject.getContent().getLastModifiedTime();
            if (lastModifiedTime > 0) {
                ValueFactory valueFactory = session.getValueFactory();
                Calendar calendar = Calendar.getInstance();
                calendar.setTimeInMillis(lastModifiedTime);
                properties.put(Constants.JCR_CREATED,
                        new VFSPropertyImpl(
                                new Name("created", org.apache.jackrabbit.spi.Name.NS_JCR_PREFIX,
                                        org.apache.jackrabbit.spi.Name.NS_JCR_URI),
                                this, session, valueFactory.createValue(calendar)));
                properties.put(Constants.JCR_LASTMODIFIED,
                        new VFSPropertyImpl(
                                new Name("lastModified", org.apache.jackrabbit.spi.Name.NS_JCR_PREFIX,
                                        org.apache.jackrabbit.spi.Name.NS_JCR_URI),
                                this, session, valueFactory.createValue(calendar)));
            }
        }
    } catch (FileSystemException e) {
        e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
    } catch (UnsupportedRepositoryOperationException e) {
        e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
    } catch (RepositoryException e) {
        e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
    }
}

From source file:org.kalypso.dwd.servlet.dwdfilecopy.DWDCopyTask.java

@Override
public void run() {
    FileObject newFile = null;/*w w w  .  jav  a  2  s. c  o  m*/

    try {
        /* Check for the file or the base file (this could be a directory). */
        m_fo = m_fsManager.resolveFile(m_URI);

        if (m_fo.getType() != FileType.FOLDER) {
            System.out.println("The URI " + m_URI + " is no folder.");
            return;
        }

        /* Get all elements in this directory. */
        m_list = m_fo.getChildren();

        if (m_list.length == 0) {
            DWDFileCopyServlet.LOG.warning("There are no files in the Source:" + m_fo.getName().toString());
            return;
        }

        /* Find the newest file. */
        newFile = getNewestFile();

        if (newFile == null)
            return;

        DWDFileCopyServlet.LOG.info("Newest file: " + newFile.getName().getBaseName().toString());
    } catch (FileSystemException e) {
        DWDFileCopyServlet.LOG.warning("Error resolving the URI: " + e.getLocalizedMessage());
        return;
    } finally {
    }

    // looping twice over this code in the case an exception
    // occurs, we try it again...
    for (int i = 0; i < 2; i++) {
        FileOutputStream os = null;
        InputStream is = null;

        try {
            final Date newestDate = getDateFromRaster(newFile, m_dateFormat);
            final Date destFileDate = getDateFromRasterContent(m_destFile);

            DWDFileCopyServlet.LOG.info("Date of newest file: " + newestDate);
            DWDFileCopyServlet.LOG.info("Date of destination file: " + destFileDate);

            // if dest file either does not exist or is not up to date, overwrite with current DWD forecast
            if (destFileDate == null || newestDate.after(destFileDate)) {
                /* Copy the newest file. */
                DWDFileCopyServlet.LOG.info("Copying ...");

                final File dwdDest;

                if (m_destUpdate)
                    dwdDest = new File(m_destFile.getParentFile(), newFile.getName().getBaseName());
                else
                    dwdDest = m_destFile;

                DWDFileCopyServlet.LOG.info("Copying DWD-File \"" + newFile.getName().getBaseName() + "\" to: "
                        + dwdDest.getAbsolutePath());

                os = new FileOutputStream(dwdDest);
                is = newFile.getContent().getInputStream();

                /* The copy operation. */
                IOUtils.copy(is, os);

                os.close();
                is.close();

                // update file contents
                if (m_destUpdate) {
                    DWDFileCopyServlet.LOG.info("Updating " + m_destFile.getName() + " from " + dwdDest);
                    DWDRasterHelper.updateDWDFileContents(dwdDest, m_destFile, m_dateFormat);

                    m_destFile.setLastModified(newFile.getContent().getLastModifiedTime());

                    final boolean deleted = dwdDest.delete();

                    if (!deleted)
                        DWDFileCopyServlet.LOG
                                .warning("Could not delete temp DWD-File \"" + dwdDest.getName() + "\"");
                }
            }

            // delete source file if flag is set
            if (m_srcDel) {
                try {
                    /* Delete the old files. */
                    DWDFileCopyServlet.LOG.info("Deleting " + newFile.getName().getBaseName());

                    final boolean deleted = newFile.delete();
                    if (!deleted)
                        DWDFileCopyServlet.LOG.warning(
                                "Could not delete DWD-File \"" + newFile.getName().getBaseName() + "\"");
                } catch (final IOException e) {
                    DWDFileCopyServlet.LOG
                            .warning("Could not delete DWD-File \"" + newFile.getName().getBaseName() + "\"");

                    if (m_debug)
                        e.printStackTrace();
                }
            }

            // no exception, so end loop here
            return;
        } catch (final IOException e) {
            DWDFileCopyServlet.LOG.warning("Could not copy DWD-File \"" + newFile.getName().getBaseName()
                    + "\" to folder: " + m_destFile.getAbsolutePath() + " due to: " + e.getLocalizedMessage());

            if (m_debug)
                e.printStackTrace();
        } catch (final DWDException e) {
            DWDFileCopyServlet.LOG.warning("DWD-File could not be updated: " + e.getLocalizedMessage());
        } finally {
            IOUtils.closeQuietly(is);
            IOUtils.closeQuietly(os);
        }

        try {
            // make some pause before continuing
            Thread.sleep(500);
        } catch (final InterruptedException ignored) {
            // empty
        }
    }
}

From source file:org.pentaho.di.core.vfs.KettleVFS.java

private KettleVFS() {
    fsm = new StandardFileSystemManager();
    try {//from www.  ja va 2s  . co m
        fsm.setFilesCache(new WeakRefFilesCache());
        fsm.init();
    } catch (FileSystemException e) {
        e.printStackTrace();
    }

    // Install a shutdown hook to make sure that the file system manager is closed
    // This will clean up temporary files in vfs_cache
    Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
        @Override
        public void run() {
            if (fsm != null) {
                fsm.close();
            }
        }
    }));
}

From source file:org.pentaho.di.ui.job.entries.fileexists.JobEntryFileExistsDialog.java

public JobEntryInterface open() {
    Shell parent = getParent();/*  w w  w . j ava 2s.  c o m*/
    Display display = parent.getDisplay();

    shell = new Shell(parent, props.getJobsDialogStyle());
    props.setLook(shell);
    JobDialog.setShellImage(shell, jobEntry);

    ModifyListener lsMod = new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            jobEntry.setChanged();
        }
    };
    changed = jobEntry.hasChanged();

    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;

    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "JobFileExists.Title"));

    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;

    // Filename line
    wlName = new Label(shell, SWT.RIGHT);
    wlName.setText(BaseMessages.getString(PKG, "JobFileExists.Name.Label"));
    props.setLook(wlName);
    fdlName = new FormData();
    fdlName.left = new FormAttachment(0, 0);
    fdlName.right = new FormAttachment(middle, -margin);
    fdlName.top = new FormAttachment(0, margin);
    wlName.setLayoutData(fdlName);
    wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wName);
    wName.addModifyListener(lsMod);
    fdName = new FormData();
    fdName.left = new FormAttachment(middle, 0);
    fdName.top = new FormAttachment(0, margin);
    fdName.right = new FormAttachment(100, 0);
    wName.setLayoutData(fdName);

    // Filename line
    wlFilename = new Label(shell, SWT.RIGHT);
    wlFilename.setText(BaseMessages.getString(PKG, "JobFileExists.Filename.Label"));
    props.setLook(wlFilename);
    fdlFilename = new FormData();
    fdlFilename.left = new FormAttachment(0, 0);
    fdlFilename.top = new FormAttachment(wName, margin);
    fdlFilename.right = new FormAttachment(middle, -margin);
    wlFilename.setLayoutData(fdlFilename);

    wbFilename = new Button(shell, SWT.PUSH | SWT.CENTER);
    props.setLook(wbFilename);
    wbFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    fdbFilename = new FormData();
    fdbFilename.right = new FormAttachment(100, 0);
    fdbFilename.top = new FormAttachment(wName, 0);
    // fdbFilename.height = 22;
    wbFilename.setLayoutData(fdbFilename);

    wFilename = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFilename);
    wFilename.addModifyListener(lsMod);
    fdFilename = new FormData();
    fdFilename.left = new FormAttachment(middle, 0);
    fdFilename.top = new FormAttachment(wName, margin);
    fdFilename.right = new FormAttachment(wbFilename, -margin);
    wFilename.setLayoutData(fdFilename);

    // Whenever something changes, set the tooltip to the expanded version:
    wFilename.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            wFilename.setToolTipText(jobMeta.environmentSubstitute(wFilename.getText()));
        }
    });

    wbFilename.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            try {
                FileObject fileName = null;

                try {
                    String curFile = wFilename.getText();

                    if (curFile.trim().length() > 0) {
                        fileName = KettleVFS.getInstance().getFileSystemManager()
                                .resolveFile(jobMeta.environmentSubstitute(wFilename.getText()));
                    } else {
                        fileName = KettleVFS.getInstance().getFileSystemManager()
                                .resolveFile(Const.getUserHomeDirectory());
                    }

                } catch (FileSystemException ex) {
                    fileName = KettleVFS.getInstance().getFileSystemManager()
                            .resolveFile(Const.getUserHomeDirectory());
                }

                VfsFileChooserDialog vfsFileChooser = Spoon.getInstance()
                        .getVfsFileChooserDialog(fileName.getParent(), fileName);

                FileObject selected = vfsFileChooser.open(shell, null, EXTENSIONS, FILETYPES,
                        VfsFileChooserDialog.VFS_DIALOG_OPEN_FILE);
                wFilename.setText(selected != null ? selected.getURL().toString() : Const.EMPTY_STRING);
            } catch (FileSystemException ex) {
                ex.printStackTrace();
            }
        }
    });

    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    FormData fd = new FormData();
    fd.right = new FormAttachment(50, -10);
    fd.bottom = new FormAttachment(100, 0);
    fd.width = 100;
    wOK.setLayoutData(fd);

    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    fd = new FormData();
    fd.left = new FormAttachment(50, 10);
    fd.bottom = new FormAttachment(100, 0);
    fd.width = 100;
    wCancel.setLayoutData(fd);

    BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wFilename);
    // Add listeners
    lsCancel = new Listener() {
        public void handleEvent(Event e) {
            cancel();
        }
    };
    lsOK = new Listener() {
        public void handleEvent(Event e) {
            ok();
        }
    };

    wCancel.addListener(SWT.Selection, lsCancel);
    wOK.addListener(SWT.Selection, lsOK);

    lsDef = new SelectionAdapter() {
        public void widgetDefaultSelected(SelectionEvent e) {
            ok();
        }
    };

    wName.addSelectionListener(lsDef);
    wFilename.addSelectionListener(lsDef);

    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(new ShellAdapter() {
        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });

    getData();

    BaseStepDialog.setSize(shell);

    shell.open();
    props.setDialogSize(shell, "JobFileExistsDialogSize");
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return jobEntry;
}

From source file:org.pentaho.di.ui.job.entries.pgpverify.JobEntryPGPVerifyDialog.java

public JobEntryInterface open() {
    Shell parent = getParent();/* w ww  . j a  va2s  . c o m*/
    Display display = parent.getDisplay();

    shell = new Shell(parent, props.getJobsDialogStyle());
    props.setLook(shell);
    JobDialog.setShellImage(shell, jobEntry);

    ModifyListener lsMod = new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            jobEntry.setChanged();
        }
    };
    changed = jobEntry.hasChanged();

    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;

    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "JobPGPVerify.Title"));

    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;

    // GPGLocation line
    wlName = new Label(shell, SWT.RIGHT);
    wlName.setText(BaseMessages.getString(PKG, "JobPGPVerify.Name.Label"));
    props.setLook(wlName);
    fdlName = new FormData();
    fdlName.left = new FormAttachment(0, 0);
    fdlName.right = new FormAttachment(middle, -margin);
    fdlName.top = new FormAttachment(0, margin);
    wlName.setLayoutData(fdlName);
    wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wName);
    wName.addModifyListener(lsMod);
    fdName = new FormData();
    fdName.left = new FormAttachment(middle, 0);
    fdName.top = new FormAttachment(0, margin);
    fdName.right = new FormAttachment(100, 0);
    wName.setLayoutData(fdName);

    // ////////////////////////
    // START OF SERVER SETTINGS GROUP///
    // /
    wSettings = new Group(shell, SWT.SHADOW_NONE);
    props.setLook(wSettings);
    wSettings.setText(BaseMessages.getString(PKG, "JobPGPVerify.Settings.Group.Label"));

    FormLayout SettingsgroupLayout = new FormLayout();
    SettingsgroupLayout.marginWidth = 10;
    SettingsgroupLayout.marginHeight = 10;

    wSettings.setLayout(SettingsgroupLayout);

    // GPGLocation line
    wlGPGLocation = new Label(wSettings, SWT.RIGHT);
    wlGPGLocation.setText(BaseMessages.getString(PKG, "JobPGPVerify.GPGLocation.Label"));
    props.setLook(wlGPGLocation);
    fdlGPGLocation = new FormData();
    fdlGPGLocation.left = new FormAttachment(0, 0);
    fdlGPGLocation.top = new FormAttachment(wName, margin);
    fdlGPGLocation.right = new FormAttachment(middle, -margin);
    wlGPGLocation.setLayoutData(fdlGPGLocation);

    wbGPGLocation = new Button(wSettings, SWT.PUSH | SWT.CENTER);
    props.setLook(wbGPGLocation);
    wbGPGLocation.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    fdbGPGLocation = new FormData();
    fdbGPGLocation.right = new FormAttachment(100, 0);
    fdbGPGLocation.top = new FormAttachment(wName, 0);
    wbGPGLocation.setLayoutData(fdbGPGLocation);

    wGPGLocation = new TextVar(jobMeta, wSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wGPGLocation);
    wGPGLocation.addModifyListener(lsMod);
    fdGPGLocation = new FormData();
    fdGPGLocation.left = new FormAttachment(middle, 0);
    fdGPGLocation.top = new FormAttachment(wName, margin);
    fdGPGLocation.right = new FormAttachment(wbGPGLocation, -margin);
    wGPGLocation.setLayoutData(fdGPGLocation);

    // Filename line
    wlFilename = new Label(wSettings, SWT.RIGHT);
    wlFilename.setText(BaseMessages.getString(PKG, "JobPGPVerify.Filename.Label"));
    props.setLook(wlFilename);
    fdlFilename = new FormData();
    fdlFilename.left = new FormAttachment(0, 0);
    fdlFilename.top = new FormAttachment(wGPGLocation, margin);
    fdlFilename.right = new FormAttachment(middle, -margin);
    wlFilename.setLayoutData(fdlFilename);

    wbFilename = new Button(wSettings, SWT.PUSH | SWT.CENTER);
    props.setLook(wbFilename);
    wbFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    fdbFilename = new FormData();
    fdbFilename.right = new FormAttachment(100, 0);
    fdbFilename.top = new FormAttachment(wGPGLocation, 0);
    wbFilename.setLayoutData(fdbFilename);

    wFilename = new TextVar(jobMeta, wSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFilename);
    wFilename.addModifyListener(lsMod);
    fdFilename = new FormData();
    fdFilename.left = new FormAttachment(middle, 0);
    fdFilename.top = new FormAttachment(wGPGLocation, margin);
    fdFilename.right = new FormAttachment(wbFilename, -margin);
    wFilename.setLayoutData(fdFilename);

    wluseDetachedSignature = new Label(wSettings, SWT.RIGHT);
    wluseDetachedSignature.setText(BaseMessages.getString(PKG, "JobPGPVerify.useDetachedSignature.Label"));
    props.setLook(wluseDetachedSignature);
    fdluseDetachedSignature = new FormData();
    fdluseDetachedSignature.left = new FormAttachment(0, 0);
    fdluseDetachedSignature.top = new FormAttachment(wFilename, margin);
    fdluseDetachedSignature.right = new FormAttachment(middle, -margin);
    wluseDetachedSignature.setLayoutData(fdluseDetachedSignature);
    wuseDetachedSignature = new Button(wSettings, SWT.CHECK);
    props.setLook(wuseDetachedSignature);
    wuseDetachedSignature
            .setToolTipText(BaseMessages.getString(PKG, "JobPGPVerify.useDetachedSignature.Tooltip"));
    fduseDetachedSignature = new FormData();
    fduseDetachedSignature.left = new FormAttachment(middle, 0);
    fduseDetachedSignature.top = new FormAttachment(wFilename, margin);
    fduseDetachedSignature.right = new FormAttachment(100, -margin);
    wuseDetachedSignature.setLayoutData(fduseDetachedSignature);
    wuseDetachedSignature.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {

            enableDetachedSignature();

        }
    });

    // DetachedFilename line
    wlDetachedFilename = new Label(wSettings, SWT.RIGHT);
    wlDetachedFilename.setText(BaseMessages.getString(PKG, "JobPGPVerify.DetachedFilename.Label"));
    props.setLook(wlDetachedFilename);
    fdlDetachedFilename = new FormData();
    fdlDetachedFilename.left = new FormAttachment(0, 0);
    fdlDetachedFilename.top = new FormAttachment(wuseDetachedSignature, margin);
    fdlDetachedFilename.right = new FormAttachment(middle, -margin);
    wlDetachedFilename.setLayoutData(fdlDetachedFilename);

    wbDetachedFilename = new Button(wSettings, SWT.PUSH | SWT.CENTER);
    props.setLook(wbDetachedFilename);
    wbDetachedFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    fdbDetachedFilename = new FormData();
    fdbDetachedFilename.right = new FormAttachment(100, 0);
    fdbDetachedFilename.top = new FormAttachment(wuseDetachedSignature, 0);
    wbDetachedFilename.setLayoutData(fdbDetachedFilename);

    wDetachedFilename = new TextVar(jobMeta, wSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wDetachedFilename);
    wDetachedFilename.addModifyListener(lsMod);
    fdDetachedFilename = new FormData();
    fdDetachedFilename.left = new FormAttachment(middle, 0);
    fdDetachedFilename.top = new FormAttachment(wuseDetachedSignature, margin);
    fdDetachedFilename.right = new FormAttachment(wbDetachedFilename, -margin);
    wDetachedFilename.setLayoutData(fdDetachedFilename);

    // Whenever something changes, set the tooltip to the expanded version:
    wDetachedFilename.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            wDetachedFilename.setToolTipText(jobMeta.environmentSubstitute(wDetachedFilename.getText()));
        }
    });

    wbDetachedFilename.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            try {
                FileObject DetachedFilename = null;

                try {
                    String curFile = wDetachedFilename.getText();

                    if (curFile.trim().length() > 0) {
                        DetachedFilename = KettleVFS.getInstance().getFileSystemManager()
                                .resolveFile(jobMeta.environmentSubstitute(wDetachedFilename.getText()));
                    } else {
                        DetachedFilename = KettleVFS.getInstance().getFileSystemManager()
                                .resolveFile(Const.getUserHomeDirectory());
                    }

                } catch (FileSystemException ex) {
                    DetachedFilename = KettleVFS.getInstance().getFileSystemManager()
                            .resolveFile(Const.getUserHomeDirectory());
                }

                VfsFileChooserDialog vfsFileChooser = Spoon.getInstance()
                        .getVfsFileChooserDialog(DetachedFilename.getParent(), DetachedFilename);

                FileObject selected = vfsFileChooser.open(shell, null, EXTENSIONS, FILETYPES,
                        VfsFileChooserDialog.VFS_DIALOG_OPEN_FILE);
                wDetachedFilename.setText(selected != null ? selected.getURL().toString() : Const.EMPTY_STRING);
            } catch (FileSystemException ex) {
                ex.printStackTrace();
            }
        }
    });

    // Whenever something changes, set the tooltip to the expanded version:
    wFilename.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            wFilename.setToolTipText(jobMeta.environmentSubstitute(wFilename.getText()));
        }
    });

    wbFilename.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            try {
                FileObject fileName = null;

                try {
                    String curFile = wFilename.getText();

                    if (curFile.trim().length() > 0) {
                        fileName = KettleVFS.getInstance().getFileSystemManager()
                                .resolveFile(jobMeta.environmentSubstitute(wFilename.getText()));
                    } else {
                        fileName = KettleVFS.getInstance().getFileSystemManager()
                                .resolveFile(Const.getUserHomeDirectory());
                    }

                } catch (FileSystemException ex) {
                    fileName = KettleVFS.getInstance().getFileSystemManager()
                            .resolveFile(Const.getUserHomeDirectory());
                }

                VfsFileChooserDialog vfsFileChooser = Spoon.getInstance()
                        .getVfsFileChooserDialog(fileName.getParent(), fileName);

                FileObject selected = vfsFileChooser.open(shell, null, EXTENSIONS, FILETYPES,
                        VfsFileChooserDialog.VFS_DIALOG_OPEN_FILE);
                wFilename.setText(selected != null ? selected.getURL().toString() : Const.EMPTY_STRING);
            } catch (FileSystemException ex) {
                ex.printStackTrace();
            }
        }
    });
    // Whenever something changes, set the tooltip to the expanded version:
    wGPGLocation.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            wGPGLocation.setToolTipText(jobMeta.environmentSubstitute(wGPGLocation.getText()));
        }
    });

    wbGPGLocation.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            try {
                FileObject fileName = null;

                try {
                    String curFile = wGPGLocation.getText();

                    if (curFile.trim().length() > 0) {
                        fileName = KettleVFS.getInstance().getFileSystemManager()
                                .resolveFile(jobMeta.environmentSubstitute(wGPGLocation.getText()));
                    } else {
                        fileName = KettleVFS.getInstance().getFileSystemManager()
                                .resolveFile(Const.getUserHomeDirectory());
                    }

                } catch (FileSystemException ex) {
                    fileName = KettleVFS.getInstance().getFileSystemManager()
                            .resolveFile(Const.getUserHomeDirectory());
                }

                VfsFileChooserDialog vfsFileChooser = Spoon.getInstance()
                        .getVfsFileChooserDialog(fileName.getParent(), fileName);

                FileObject selected = vfsFileChooser.open(shell, null, EXTENSIONS, FILETYPES,
                        VfsFileChooserDialog.VFS_DIALOG_OPEN_FILE);
                wGPGLocation.setText(selected != null ? selected.getURL().toString() : Const.EMPTY_STRING);
            } catch (FileSystemException ex) {
                ex.printStackTrace();
            }
        }
    });
    fdSettings = new FormData();
    fdSettings.left = new FormAttachment(0, margin);
    fdSettings.top = new FormAttachment(wName, margin);
    fdSettings.right = new FormAttachment(100, -margin);
    wSettings.setLayoutData(fdSettings);
    // ///////////////////////////////////////////////////////////
    // / END OF Advanced SETTINGS GROUP
    // ///////////////////////////////////////////////////////////

    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    FormData fd = new FormData();
    fd.right = new FormAttachment(50, -10);
    fd.bottom = new FormAttachment(100, 0);
    fd.width = 100;
    wOK.setLayoutData(fd);

    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    fd = new FormData();
    fd.left = new FormAttachment(50, 10);
    fd.bottom = new FormAttachment(100, 0);
    fd.width = 100;
    wCancel.setLayoutData(fd);

    BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wSettings);
    // Add listeners
    lsCancel = new Listener() {
        public void handleEvent(Event e) {
            cancel();
        }
    };
    lsOK = new Listener() {
        public void handleEvent(Event e) {
            ok();
        }
    };

    wCancel.addListener(SWT.Selection, lsCancel);
    wOK.addListener(SWT.Selection, lsOK);

    lsDef = new SelectionAdapter() {
        public void widgetDefaultSelected(SelectionEvent e) {
            ok();
        }
    };

    wName.addSelectionListener(lsDef);
    wGPGLocation.addSelectionListener(lsDef);

    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(new ShellAdapter() {
        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });

    getData();
    enableDetachedSignature();
    BaseStepDialog.setSize(shell);

    shell.open();
    props.setDialogSize(shell, "JobPGPVerifyDialogSize");
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return jobEntry;
}