/** * Returns the name of the file. * * @return the name, never null. */ public String getName() { return backend.getPublicURIString(); }
public String[] getUrlStrings() { String[] fileStrings = new String[ files.size() ]; for ( int i = 0; i < fileStrings.length; i++ ) { fileStrings[ i ] = files.get( i ).getPublicURIString(); } return fileStrings; }
@Override public void dispose( StepMetaInterface smi, StepDataInterface sdi ) { meta = (ExcelOutputMeta) smi; data = (ExcelOutputData) sdi; if ( data.oneFileOpened ) { closeFile(); } if ( data.file != null ) { try { data.file.close(); data.file = null; } catch ( Exception e ) { logDetailed( BaseMessages.getString( PKG, "ExcelOutput.Log.UnableToCloseFileDuringDispose", data.file.getPublicURIString() ), e ); } } data.fieldsWidth = null; data.headerImage = null; data.writableFont = null; data.ws = null; super.dispose( smi, sdi ); }
/** * Lists all content entities stored in this content-location. This method filters out all files that have an invalid * name (according to the repository rules). * * @return the content entities for this location. * @throws ContentIOException if an repository error occured. */ public ContentEntity[] listContents() throws ContentIOException { try { final FileObject file = getBackend(); final FileObject[] files = file.getChildren(); final ContentEntity[] entities = new ContentEntity[files.length]; for ( int i = 0; i < files.length; i++ ) { final FileObject child = files[i]; if ( RepositoryUtilities.isInvalidPathName( child.getPublicURIString() ) ) { continue; } if ( child.isFolder() ) { entities[i] = new FileObjectContentLocation( this, child ); } else if ( child.isFile() ) { entities[i] = new FileObjectContentLocation( this, child ); } } return entities; } catch ( FileSystemException e ) { throw new RuntimeException( e ); } }
@Test public void testEnforceProtPOnPut() throws Exception { FileObject file = KettleVFS.createTempFile( "FTPSConnectionTest_testEnforceProtPOnPut", KettleVFS.Suffix.TMP); file.createFile(); try { FTPSTestConnection connection = spy( new FTPSTestConnection( FTPSConnection.CONNECTION_TYPE_FTP_IMPLICIT_TLS_WITH_CRYPTED, "the.perfect.host", 2010, "warwickw", "julia", null ) ); connection.replies.put( "PWD", new Reply( Arrays.asList( "257 \"/la\" is current directory" ) ) ); connection.connect(); connection.uploadFile( file.getPublicURIString(), "uploaded-file" ); assertEquals( "buffer not set", "PBSZ 0\r\n", connection.commands.get( 0 ).toString() ); assertEquals( "data privacy not set", "PROT P\r\n", connection.commands.get( 1 ).toString() ); } finally { file.delete(); } }
@Override public String getPublicURIString() { return decoratedFileObject.getPublicURIString(); }
@Override public String getPublicURIString() { return decoratedFileObject.getPublicURIString(); }
@Override public String getPublicURIString() { return decoratedFileObject.getPublicURIString(); }
@Override public String getPublicURIString() { return decoratedFileObject.getPublicURIString(); }
/** * Handles a destination for which there is no corresponding source file. */ @Override protected void handleMissingSourceFile(final FileObject destFile) throws Exception { log("deleting " + destFile.getPublicURIString()); // destFile.delete( Selectors.SELECT_SELF ); }
/** * Handles a destination for which there is no corresponding source file. */ @Override protected void handleMissingSourceFile(final FileObject destFile) throws Exception { log("deleting " + destFile.getPublicURIString()); // destFile.delete( Selectors.SELECT_SELF ); }
/** * Handles a destination for which there is no corresponding source file. */ @Override protected void handleMissingSourceFile(final FileObject destFile) throws Exception { log("deleting " + destFile.getPublicURIString()); // destFile.delete( Selectors.SELECT_SELF ); }
/** * Executes the task. * * @throws BuildException if any exception is thrown. */ @Override public void execute() throws BuildException { try { final FileObject file = resolveFile(url); log("Details of " + file.getPublicURIString()); showFile(file, INDENT); } catch (final Exception e) { throw new BuildException(e); } }
/** * Executes the task. * * @throws BuildException if any exception is thrown. */ @Override public void execute() throws BuildException { try { final FileObject file = resolveFile(url); log("Details of " + file.getPublicURIString()); showFile(file, INDENT); } catch (final Exception e) { throw new BuildException(e); } }
/** * Executes the task. * * @throws BuildException if any exception is thrown. */ @Override public void execute() throws BuildException { try { final FileObject file = resolveFile(url); log("Details of " + file.getPublicURIString()); showFile(file, INDENT); } catch (final Exception e) { throw new BuildException(e); } }
@Override public String getClusterName( final String url ) { String clusterName = null; try { clusterName = getClusterNameBy( KettleVFS.getFileObject( url ).getParent().getPublicURIString() ); } catch ( final KettleFileException | FileSystemException e ) { // no-op } return clusterName; }
@Override public JavaFileObject getJavaFileForInput(Location location, String className, JavaFileObject.Kind kind) throws IOException { if(kind == JavaFileObject.Kind.SOURCE) { FileObject source = root.resolveFile(classNameToPath(className) + ".java"); return new VFSJavaFileObject(URI.create(source.getPublicURIString()), kind, source, className); } else { return super.getJavaFileForInput(location, className, kind); } }
/** * Handles an out-of-date file. * * @param srcFile The source FileObject. * @param destFile The destination FileObject. */ @Override protected void handleOutOfDateFile(final FileObject srcFile, final FileObject destFile) throws FileSystemException { log("Copying " + srcFile.getPublicURIString() + " to " + destFile.getPublicURIString()); destFile.copyFrom(srcFile, Selectors.SELECT_SELF); if (preserveLastModified && srcFile.getFileSystem().hasCapability(Capability.GET_LAST_MODIFIED) && destFile.getFileSystem().hasCapability(Capability.SET_LAST_MODIFIED_FILE)) { final long lastModTime = srcFile.getContent().getLastModifiedTime(); destFile.getContent().setLastModifiedTime(lastModTime); } }
/** * Handles an out-of-date file. * * @param srcFile The source FileObject. * @param destFile The destination FileObject. */ @Override protected void handleOutOfDateFile(final FileObject srcFile, final FileObject destFile) throws FileSystemException { log("Copying " + srcFile.getPublicURIString() + " to " + destFile.getPublicURIString()); destFile.copyFrom(srcFile, Selectors.SELECT_SELF); if (preserveLastModified && srcFile.getFileSystem().hasCapability(Capability.GET_LAST_MODIFIED) && destFile.getFileSystem().hasCapability(Capability.SET_LAST_MODIFIED_FILE)) { final long lastModTime = srcFile.getContent().getLastModifiedTime(); destFile.getContent().setLastModifiedTime(lastModTime); } }
/** * Handles an out-of-date file. * * @param srcFile The source FileObject. * @param destFile The destination FileObject. */ @Override protected void handleOutOfDateFile(final FileObject srcFile, final FileObject destFile) throws FileSystemException { log("Copying " + srcFile.getPublicURIString() + " to " + destFile.getPublicURIString()); destFile.copyFrom(srcFile, Selectors.SELECT_SELF); if (preserveLastModified && srcFile.getFileSystem().hasCapability(Capability.GET_LAST_MODIFIED) && destFile.getFileSystem().hasCapability(Capability.SET_LAST_MODIFIED_FILE)) { final long lastModTime = srcFile.getContent().getLastModifiedTime(); destFile.getContent().setLastModifiedTime(lastModTime); } }