• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java GridFTPClient类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.globus.ftp.GridFTPClient的典型用法代码示例。如果您正苦于以下问题:Java GridFTPClient类的具体用法?Java GridFTPClient怎么用?Java GridFTPClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

GridFTPClient类属于org.globus.ftp包,在下文中一共展示了GridFTPClient类的40个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createClient

点赞 3

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
/**
 * Creates the client.
 * 
 * @return the grid ftp client
 * 
 * @throws FileSystemException the file system exception
 */
protected GridFTPClient createClient() throws FileSystemException {
    final GenericFileName rootName = getRoot();

    UserAuthenticationData authData = null;
    try {
        authData = UserAuthenticatorUtils.authenticate(fileSystemOptions, GsiFtpFileProvider.AUTHENTICATOR_TYPES);

        String username = UserAuthenticatorUtils
                .getData(authData, UserAuthenticationData.USERNAME, UserAuthenticatorUtils.toChar(rootName.getUserName())).toString();
        String password = UserAuthenticatorUtils
                .getData(authData, UserAuthenticationData.PASSWORD, UserAuthenticatorUtils.toChar(rootName.getPassword())).toString();
        return GsiFtpClientFactory.createConnection(rootName.getHostName(), rootName.getPort(), username, password, getFileSystemOptions());
    } finally {
        UserAuthenticatorUtils.cleanup(authData);
    }
}
 

开发者ID:clstoulouse,
项目名称:motu,
代码行数:24,
代码来源:GridFTPClientWrapper.java

示例2: doRename

点赞 3

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
/**
 * Renames the file.
 * 
 * @param newfile the newfile
 * 
 * @throws Exception the exception
 */
@Override
protected void doRename(FileObject newfile) throws Exception {
    boolean ok = true;
    final GridFTPClient ftpClient = ftpFs.getClient();
    try {
        String oldName = getName().getPath();
        String newName = newfile.getName().getPath();
        ftpClient.rename(oldName, newName);
    } catch (IOException ioe) {
        ok = false;
    } catch (ServerException e) {
        ok = false;
    } finally {
        ftpFs.putClient(ftpClient);
    }

    if (!ok) {
        throw new FileSystemException("vfs.provider.gsiftp/rename-file.error", new Object[] { getName().toString(), newfile });
    }
    this.fileInfo = null;
    children = EMPTY_FTP_FILE_MAP;
}
 

开发者ID:clstoulouse,
项目名称:motu,
代码行数:30,
代码来源:GsiFtpFileObject.java

示例3: doCreateFolder

点赞 3

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
/**
 * Creates this file as a folder.
 * 
 * @throws Exception the exception
 */
@Override
protected void doCreateFolder() throws Exception {
    boolean ok = true;
    final GridFTPClient client = ftpFs.getClient();
    try {
        client.makeDir(getName().getPath());
    } catch (IOException ioe) {
        ok = false;
    } catch (ServerException se) {
        ok = false;
    } finally {
        ftpFs.putClient(client);
    }

    if (!ok) {
        throw new FileSystemException("vfs.provider.gsiftp/create-folder.error", getName());
    }
}
 

开发者ID:clstoulouse,
项目名称:motu,
代码行数:24,
代码来源:GsiFtpFileObject.java

示例4: closeConnection

点赞 3

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
/**
 * Cleans up the connection to the server.
 * 
 * @param client the client
 */
private void closeConnection(final GridFTPClient client) {
    try {
        // Clean up
        // if (client.isConnected())
        // {
        client.close(); // disconnect();
        // }
    } catch (final IOException ioe) {
        // getLogger().warn("vfs.provider.ftp/close-connection.error", e);
        // VfsLog.warn(getLogger(), log,
        // "vfs.provider.ftp/close-connection.error", ioe);
        LOG.warn("vfs.provider.ftp/close-connection.error", ioe);
    } catch (final ServerException e) {
        // getLogger().warn("vfs.provider.ftp/close-connection.error", e);
        // VfsLog.warn(getLogger(), log,
        // "vfs.provider.ftp/close-connection.error", e);
        LOG.warn("vfs.provider.ftp/close-connection.error", e);
    }
}
 

开发者ID:clstoulouse,
项目名称:motu,
代码行数:25,
代码来源:GsiFtpFileSystem.java

示例5: getClient

点赞 3

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
/**
 * Creates an FTP client to use.
 * 
 * @return the client
 * 
 * @throws FileSystemException the file system exception
 */
public GridFTPClient getClient() throws FileSystemException {
    synchronized (idleClientSync) {
        if (idleClient == null) {
            final GenericFileName rootName = (GenericFileName) getRoot().getName();

            LOG.debug("Creating connection to GSIFTP Host: " + rootName.getHostName() + " Port:" + rootName.getPort() + " User:"
                    + rootName.getUserName() + " Path: " + rootName.getPath());

            return GsiFtpClientFactory.createConnection(rootName.getHostName(),
                                                        rootName.getPort(),
                                                        rootName.getUserName(),
                                                        rootName.getPassword(),
                                                        // rootName.getPath(),
                                                        getFileSystemOptions());
        } else {
            final GridFTPClient client = idleClient;
            idleClient = null;
            return client;
        }
    }
}
 

开发者ID:clstoulouse,
项目名称:motu,
代码行数:29,
代码来源:GsiFtpFileSystem.java

示例6: testMlst

点赞 3

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
public void testMlst() throws Exception {
logger.info("test MLST");
GridFTPClient src = new GridFTPClient(TestEnv.serverAHost, TestEnv.serverAPort);
src.setAuthorization(TestEnv.getAuthorization(TestEnv.serverASubject));
src.authenticate(null); // use default creds

src.setType(Session.TYPE_ASCII);
src.changeDir(TestEnv.serverADir);

MlsxEntry entry = src.mlst(TestEnv.serverAFile);
logger.debug(entry.toString());	

       assertEquals(MlsxEntry.TYPE_FILE, entry.get(MlsxEntry.TYPE));
       assertEquals(String.valueOf(TestEnv.serverAFileSize), 
                    entry.get(MlsxEntry.SIZE));
       assertEquals(TestEnv.serverAFile, entry.getFileName());

src.close();
   }
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:20,
代码来源:MlsxTest.java

示例7: test3

点赞 3

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
public void test3() throws Exception {
logger.info("show mlsd output using GridFTPClient");

GridFTPClient src = new GridFTPClient(TestEnv.serverAHost, TestEnv.serverAPort);
src.setAuthorization(TestEnv.getAuthorization(TestEnv.serverASubject));
src.authenticate(null); // use default creds

src.setType(Session.TYPE_ASCII);
src.changeDir(TestEnv.serverADir);

Vector v = src.mlsd();
logger.debug("mlsd received");
while (!v.isEmpty()) {
    MlsxEntry f = (MlsxEntry) v.remove(0);
    logger.info(f.toString());
}

src.close();
   }
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:20,
代码来源:MlsxTest.java

示例8: testDir

点赞 3

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
public void testDir() throws Exception {
    logger.info("makeDir()");
    
    GridFTPClient client = connect();
    String tmpDir = "abcdef";
    String baseDir = client.getCurrentDir();
    client.makeDir(tmpDir);
    client.changeDir(tmpDir);
    assertEquals(baseDir + "/" + tmpDir, client.getCurrentDir());
    client.goUpDir();
    assertEquals(baseDir, client.getCurrentDir());
    client.deleteDir(tmpDir);
    try {
        client.changeDir(tmpDir);
        fail("directory should have been removed");
    } catch (Exception e) {
    }
    client.close();
}
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:20,
代码来源:GridFTPClientTest.java

示例9: GridFTPInputStream

点赞 3

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
public GridFTPInputStream(GSSCredential cred,
		      Authorization auth,
		      String host, 
		      int port, 
		      String file,
		      boolean passive,
		      int type,
		      boolean reqDCAU) 
throws IOException, FTPException {
GridFTPClient gridFtp = new GridFTPClient(host, port);
gridFtp.setAuthorization(auth);
gridFtp.authenticate(cred);

if (gridFtp.isFeatureSupported("DCAU")) {
    if (!reqDCAU) {
	gridFtp.setDataChannelAuthentication(DataChannelAuthentication.NONE);
    }
} else {
    gridFtp.setLocalNoDataChannelAuthentication();
}

ftp = gridFtp;

get(passive, type, file);
   }
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:26,
代码来源:GridFTPInputStream.java

示例10: GridFTPOutputStream

点赞 3

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
public GridFTPOutputStream(GSSCredential cred, 
		       Authorization auth,
		       String host,
		       int port,
		       String file,
		       boolean append,
		       boolean passive,
		       int type,
		       boolean reqDCAU)
throws IOException, FTPException {
GridFTPClient gridFtp = new GridFTPClient(host, port);
gridFtp.setAuthorization(auth);
gridFtp.authenticate(cred);

if (gridFtp.isFeatureSupported("DCAU")) {
    if (!reqDCAU) {
	gridFtp.setDataChannelAuthentication(DataChannelAuthentication.NONE);
    }
} else {
           gridFtp.setLocalNoDataChannelAuthentication();
}

ftp = gridFtp;

put(passive, type, file, append);
   }
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:27,
代码来源:GridFTPOutputStream.java

示例11: getGridFtpClient

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
/**
 * Gets the grid ftp client.
 * 
 * @return the grid ftp client
 * 
 * @throws FileSystemException the file system exception
 */
protected GridFTPClient getGridFtpClient() throws FileSystemException {
    if (gridFtpClient == null) {
        gridFtpClient = createClient();
    }

    return gridFtpClient;
}
 

开发者ID:clstoulouse,
项目名称:motu,
代码行数:15,
代码来源:GridFTPClientWrapper.java

示例12: doDelete

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
/**
 * Deletes the file.
 * 
 * @throws Exception the exception
 */
@Override
protected void doDelete() throws Exception {
    boolean ok = true;
    final GridFTPClient ftpClient = ftpFs.getClient();
    try {
        // String Path = relPath;

        // if ( ! relPath.startsWith("/")) {
        // Path = "/" + Path;
        // log.warn("relative path " + relPath + " doesn't start with (/). Using:" + Path + " instead");
        // }

        if (this.fileInfo.isDirectory()) {
            ftpClient.deleteDir(getName().getPath());
        } else {
            ftpClient.deleteFile(getName().getPath());
        }
    } catch (IOException ioe) {
        ok = false;
    } catch (ServerException e) {
        ok = false;
    } finally {
        ftpFs.putClient(ftpClient);
    }

    if (!ok) {
        throw new FileSystemException("vfs.provider.gsiftp/delete-file.error", getName());
    }
    this.fileInfo = null;
    children = EMPTY_FTP_FILE_MAP;
}
 

开发者ID:clstoulouse,
项目名称:motu,
代码行数:37,
代码来源:GsiFtpFileObject.java

示例13: putClient

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
/**
 * Returns an FTP client after use.
 * 
 * @param client the client
 */
public void putClient(final GridFTPClient client) {
    synchronized (idleClientSync) {
        if (idleClient == null) {
            // Hang on to client for later
            idleClient = client;
        } else {
            // Close the client
            closeConnection(client);
        }
    }
}
 

开发者ID:clstoulouse,
项目名称:motu,
代码行数:17,
代码来源:GsiFtpFileSystem.java

示例14: setSecurityOptions

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
protected void setSecurityOptions(GridFTPClient client)
        throws ServerException, IOException {
    DataChannelAuthenticationType dcau = GridFTPSecurityContext
        .getDataChannelAuthentication(getSecurityContext());
    if (dcau != null) {
        if (dcau.equals(DataChannelAuthenticationType.NONE)) {
            client
                .setDataChannelAuthentication(DataChannelAuthentication.NONE);
        }
        else if (dcau.equals(DataChannelAuthenticationType.SELF)) {
            client
                .setDataChannelAuthentication(DataChannelAuthentication.SELF);
        }
    }
    DataChannelProtectionType prot = GridFTPSecurityContext
        .getDataChannelProtection(getSecurityContext());
    if (prot != null) {
        if (prot.equals(DataChannelProtectionType.CLEAR)) {
            client
                .setDataChannelProtection(GridFTPSession.PROTECTION_CLEAR);
        }
        else if (prot.equals(DataChannelProtectionType.CONFIDENTIAL)) {
            client
                .setDataChannelProtection(GridFTPSession.PROTECTION_CONFIDENTIAL);
        }
        else if (prot.equals(DataChannelProtectionType.PRIVATE)) {
            client
                .setDataChannelProtection(GridFTPSession.PROTECTION_PRIVATE);
        }
        else if (prot.equals(DataChannelProtectionType.SAFE)) {
            client.setDataChannelProtection(GridFTPSession.PROTECTION_SAFE);
        }
    }
}
 

开发者ID:swift-lang,
项目名称:swift-k,
代码行数:35,
代码来源:FileResourceImpl.java

示例15: handleFileTransferFTPClientConfigurations

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
public void handleFileTransferFTPClientConfigurations(GridFTPClient source, GridFTPClient destination) throws GridConfigurationHandlerException {
      try {
	if (source!=null && PhoebusUtils.isPhoebusDriverConfigurationsDefined(source.getHost())) {
	    source.setDataChannelAuthentication(DataChannelAuthentication.NONE);
	    source.site("SITE SETNETSTACK phoebus:" + PhoebusUtils.getPhoebusDataChannelXIODriverParameters(source.getHost()));
	}
} catch (Exception e) {
	throw new GridConfigurationHandlerException("Error configuring for Phoebus handler: "+e.getLocalizedMessage(),e);
}
  }
 

开发者ID:apache,
项目名称:airavata,
代码行数:11,
代码来源:PhoebusGridConfigurationHandler.java

示例16: setParams

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
private void setParams(GridFTPClient client, final TransferParams params)
throws IOException,
       ServerException{
client.authenticate(params.credential); //okay if null

if (params.transferType != params.SERVER_DEFAULT) {
    client.setType(params.transferType);
}

if (params.transferMode != params.SERVER_DEFAULT) {
    client.setMode(params.transferMode);
}

if (params.parallel != params.SERVER_DEFAULT) {
    client.setOptions(new RetrieveOptions(params.parallel));
}

if (params.protectionBufferSize != params.SERVER_DEFAULT) {
    client.setProtectionBufferSize(
        params.protectionBufferSize);
}

if (params.dataChannelAuthentication != null) {
    client.setDataChannelAuthentication(
        params.dataChannelAuthentication);
}

if (params.dataChannelProtection != params.SERVER_DEFAULT) {
    client.setDataChannelProtection(
        params.dataChannelProtection);
}

if (params.TCPBufferSize != params.SERVER_DEFAULT) {
    client.setTCPBufferSize(params.TCPBufferSize);
}
   }
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:37,
代码来源:Transfer.java

示例17: test2PartyMultipleTransfers

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
public void test2PartyMultipleTransfers() 
throws Exception {
logger.info("GridFTP client - client-server - multiple files - stream mode");

GridFTPClient client = new GridFTPClient(TestEnv.serverAHost, TestEnv.serverAPort);
client.setAuthorization(TestEnv.getAuthorization(TestEnv.serverASubject));

String srcFile1 = TestEnv.serverADir + "/" + TestEnv.serverAFile;
String srcFile2 = TestEnv.serverADir + "/" + TestEnv.serverAFile;
String srcFile3 = TestEnv.serverADir + "/" + TestEnv.serverAFile;

File destFile1 = new File(TestEnv.localDestDir + "/" + TestEnv.serverAFile);
File destFile2 = new File(TestEnv.localDestDir + "/" + TestEnv.serverAFile);
File destFile3 = new File(TestEnv.localDestDir + "/" + TestEnv.serverAFile);


setParamsModeS(client, null); /* use default cred */

client.setPassive();
client.setLocalActive();
client.get(srcFile1, destFile1);

client.setPassive();
client.setLocalActive();
client.get(srcFile2, destFile2);

client.setPassive();
client.setLocalActive();
client.get(srcFile3, destFile3);

client.close();
   }
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:33,
代码来源:MultipleTransfersTest.java

示例18: test2PartyMultipleTransfersModeE

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
public void test2PartyMultipleTransfersModeE() 
throws Exception {
logger.info("GridFTP client - client-server - multiple files - stream mode - no d.c. reuse");

GridFTPClient client = new GridFTPClient(TestEnv.serverAHost, TestEnv.serverAPort);
client.setAuthorization(TestEnv.getAuthorization(TestEnv.serverASubject));

String srcFile1 = TestEnv.serverADir + "/" + TestEnv.serverAFile;
String srcFile2 = TestEnv.serverADir + "/" + TestEnv.serverAFile;
String srcFile3 = TestEnv.serverADir + "/" + TestEnv.serverAFile;

String destFile1 = TestEnv.localDestDir + "/" + TestEnv.serverAFile;
String destFile2 = TestEnv.localDestDir + "/" + TestEnv.serverAFile;
String destFile3 = TestEnv.localDestDir + "/" + TestEnv.serverAFile;


setParamsModeE(client, null); /* use default cred */
client.setOptions(new RetrieveOptions(TestEnv.parallelism));


DataSink  sink1 = new FileRandomIO(new RandomAccessFile(destFile1, "rw"));
client.setLocalPassive();
client.setActive();
client.get(srcFile1, sink1, null);

DataSink  sink2 = new FileRandomIO(new RandomAccessFile(destFile2, "rw"));
client.setLocalPassive();
client.setActive();
client.get(srcFile2, sink2, null);

DataSink  sink3 = new FileRandomIO(new RandomAccessFile(destFile3, "rw"));
client.setLocalPassive();
client.setActive();
client.get(srcFile3, sink3, null);

client.close();
   }
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:38,
代码来源:MultipleTransfersTest.java

示例19: setParamsModeS

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
private void setParamsModeS(GridFTPClient client, GSSCredential cred)
throws Exception{
client.authenticate(cred);
client.setProtectionBufferSize(16384);
client.setType(GridFTPSession.TYPE_IMAGE);
client.setMode(GridFTPSession.MODE_STREAM);
   }
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:8,
代码来源:MultipleTransfersTest.java

示例20: setParamsModeE

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
private void setParamsModeE(GridFTPClient client, GSSCredential cred)
throws Exception{
client.authenticate(cred);
client.setProtectionBufferSize(16384);
client.setType(GridFTPSession.TYPE_IMAGE);
client.setMode(GridFTPSession.MODE_EBLOCK);
   }
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:8,
代码来源:MultipleTransfersTest.java

示例21: get

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
/**
      This method performs the actual transfer
    **/
   protected void get(GridFTPClient client, 
	       int localServerMode,
	       int transferType,
	       int transferMode,
	       DataChannelAuthentication dcau,
	       int prot,
	       String fullLocalFile,
	       String fullRemoteFile) 
throws Exception{
client.authenticate(getCredential()); /* use default cred */
client.setProtectionBufferSize(16384);
client.setType(transferType);
client.setMode(transferMode);
client.setDataChannelAuthentication(dcau);
	client.setDataChannelProtection(prot);
if (localServerMode == Session.SERVER_ACTIVE) {
    client.setPassive();
    client.setLocalActive();
} else {
    if (TestEnv.localServerPort == TestEnv.UNDEFINED) {
	client.setLocalPassive(); 
    } else {
	client.setLocalPassive(TestEnv.localServerPort, 
			       FTPServerFacade.DEFAULT_QUEUE);
    }

    client.setActive();
}

DataSink sink = null;
if (transferMode == GridFTPSession.MODE_EBLOCK) {
    sink = new FileRandomIO(new RandomAccessFile(fullLocalFile, 
						 "rw"));
} else {
    sink = new DataSinkStream(new FileOutputStream(fullLocalFile));
}

client.get(fullRemoteFile, sink, null);
   }
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:43,
代码来源:GridFTPClient2PartyTest.java

示例22: get

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
protected void get(GridFTPClient client, 
	       int localServerMode,
	       int transferType,
	       int transferMode,
	       DataChannelAuthentication dcau,
	       int prot,
	       String fullLocalFile,
	       String fullRemoteFile) 
throws Exception{
client.authenticate(null); /* use default cred */
client.setProtectionBufferSize(16384);
client.setType(transferType);
client.setMode(transferMode);
// adding parallelism
logger.info("parallelism: " + parallelism);
client.setOptions(new RetrieveOptions(parallelism));
client.setDataChannelAuthentication(dcau);
	client.setDataChannelProtection(prot);

// in extended block mode, receiving side must be passive
assertTrue(localServerMode == Session.SERVER_PASSIVE);

if (TestEnv.localServerPort == TestEnv.UNDEFINED) {
    client.setLocalPassive(); 
} else {
    client.setLocalPassive(TestEnv.localServerPort, 
			   org.globus.ftp.vanilla.FTPServerFacade.DEFAULT_QUEUE);
}
client.setActive();

assertTrue(transferMode == GridFTPSession.MODE_EBLOCK);

DataSink sink = null;
sink = new FileRandomIO(new RandomAccessFile(fullLocalFile, 
					     "rw"));
client.get(fullRemoteFile, sink, null);
   }
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:38,
代码来源:GridFTPClient2PartyParallelTest.java

示例23: put

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
protected void put(GridFTPClient client, 
	       int localServerMode,
	       int transferType,
	       int transferMode,
	       DataChannelAuthentication dcau,
	       int prot,
	       String fullLocalFile,
	       String fullRemoteFile) 
throws Exception{
client.authenticate(null); /* use default cred */
client.setProtectionBufferSize(16384);
client.setType(transferType);
client.setMode(transferMode);
// adding parallelism
logger.info("parallelism: " + parallelism);
client.setOptions(new RetrieveOptions(parallelism));
	client.setDataChannelAuthentication(dcau);
	client.setDataChannelProtection(prot);

assertTrue(localServerMode == Session.SERVER_ACTIVE);

client.setPassive();
client.setLocalActive();

assertTrue(transferMode == GridFTPSession.MODE_EBLOCK);

logger.debug("sending file " + fullLocalFile);
DataSource source = null;
source = new FileRandomIO(new RandomAccessFile(fullLocalFile, 
					       "r"));
client.put(fullRemoteFile, source, null);
   }
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:33,
代码来源:GridFTPClient2PartyParallelTest.java

示例24: setParamsModeE

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
private void setParamsModeE(GridFTPClient client, GSSCredential cred)
throws Exception {
client.authenticate(cred);
client.setProtectionBufferSize(16384);
client.setType(GridFTPSession.TYPE_IMAGE);
client.setMode(GridFTPSession.MODE_EBLOCK);
client.setDataChannelAuthentication(DataChannelAuthentication.SELF);
client.setDataChannelProtection(GridFTPSession.PROTECTION_SAFE);
   }
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:10,
代码来源:DataChannelReuseVaryingParTest.java

示例25: test4

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
public void test4() throws Exception {

	logger.info("get mlsd output using GridFTPClient, EBlock, Image");

	GridFTPClient src = new GridFTPClient(TestEnv.serverAHost, TestEnv.serverAPort);
	src.setAuthorization(TestEnv.getAuthorization(TestEnv.serverASubject));
	src.authenticate(null); // use default creds

	src.setType(Session.TYPE_IMAGE);
	src.setMode(GridFTPSession.MODE_EBLOCK);

	// server sends the listing over data channel.
	// so in EBlock, it must be active
	HostPort hp = src.setLocalPassive();
	src.setActive(hp);

	src.changeDir(TestEnv.serverADir);

	Vector v = src.mlsd();
	logger.debug("mlsd received");
	while (!v.isEmpty()) {
	    MlsxEntry f = (MlsxEntry) v.remove(0);
	    logger.debug(f.toString());
	}
	
	src.close();
    }
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:28,
代码来源:MlsxTest.java

示例26: put

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
/**
      This demonstrates striped file retrieval.
    **/
   protected void put(GridFTPClient client, 
	       int localServerMode,
	       int transferType,
	       int transferMode,
	       DataChannelAuthentication dcau,
	       int prot,
	       String fullLocalFile,
	       String fullRemoteFile) 
throws Exception{
client.authenticate(null); /* use default cred */
client.setProtectionBufferSize(16384);
client.setType(transferType);
client.setMode(transferMode);
// adding parallelism
logger.info("parallelism: " + parallelism);
client.setOptions(new RetrieveOptions(parallelism));
	client.setDataChannelAuthentication(dcau);
	client.setDataChannelProtection(prot);

assertTrue(localServerMode == Session.SERVER_ACTIVE);

client.setStripedPassive();
client.setLocalStripedActive();

logger.debug("sending file " + fullLocalFile);
DataSource source = null;
if (transferMode == GridFTPSession.MODE_EBLOCK) {
    source = new FileRandomIO(new RandomAccessFile(fullLocalFile, 
						   "r"));
} else {
    source = new DataSourceStream(new FileInputStream(fullLocalFile));
}

client.put(fullRemoteFile, source, null);
   }
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:39,
代码来源:GridFTPClient2PartyStripingTest.java

示例27: testExists

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
public void testExists() throws Exception {
    GridFTPClient client = connect();
    assertTrue("file", client.exists(TestEnv.serverADir + "/" + TestEnv.serverAFile));
    assertTrue("dir", client.exists(TestEnv.serverADir));
    assertFalse("file2", client.exists("foobar"));
    client.close();
}
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:8,
代码来源:GridFTPClientTest.java

示例28: testSize

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
public void testSize() throws Exception {
    logger.info("getSize()");
    
    GridFTPClient client = connect();
    client.changeDir(TestEnv.serverADir);
    assertEquals(true, client.exists(TestEnv.serverAFile));
    client.setType(Session.TYPE_IMAGE);

    long size = client.getSize(TestEnv.serverAFile);
    assertEquals(TestEnv.serverAFileSize, size);

    Date d = client.getLastModified(TestEnv.serverAFile);

    client.close();
}
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:16,
代码来源:GridFTPClientTest.java

示例29: testFeature

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
public void testFeature() throws Exception {
    logger.info("getFeatureList()");
    
    GridFTPClient client = connect();
    FeatureList fl = client.getFeatureList();
    assertEquals(true, fl.contains("DcaU"));
    assertEquals(false, fl.contains("MIS"));

    assertTrue(client.isFeatureSupported("DcaU"));
    assertFalse(client.isFeatureSupported("MIS"));

    client.close();
}
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:14,
代码来源:GridFTPClientTest.java

示例30: testQuote

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
public void testQuote() throws Exception {
    GridFTPClient client = connect();
    client.setType(Session.TYPE_IMAGE);
    client.changeDir(TestEnv.serverADir);
    
    Reply r = client.quote("size " + TestEnv.serverAFile);
    
    assertTrue(Reply.isPositiveCompletion(r));
    assertEquals(TestEnv.serverAFileSize, Long.parseLong(r.getMessage()));

    client.close();
}
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:13,
代码来源:GridFTPClientTest.java

示例31: testOptions

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
public void testOptions() throws Exception {
    logger.info("retrieveOptions()");
    
    GridFTPClient client = connect();
    Options opts = new RetrieveOptions(3);
    client.setOptions(opts);
    client.close();
}
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:9,
代码来源:GridFTPClientTest.java

示例32: testRestartMarker

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
public void testRestartMarker() throws Exception {
    logger.info("setRestartMarker()");

    GridFTPClient client = connect();
    StreamModeRestartMarker rm = new StreamModeRestartMarker(12345);
    client.setRestartMarker(rm);
    client.close();
}
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:9,
代码来源:GridFTPClientTest.java

示例33: testChecksum

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
public void testChecksum() throws Exception {
    GridFTPClient client = connect();
    
    String checksum = 
        client.checksum(ChecksumAlgorithm.MD5, 
                        0, TestEnv.serverAFileSize,
                        TestEnv.serverADir + "/" + TestEnv.serverAFile);

    assertEquals(TestEnv.serverAFileChecksum, checksum.trim());
    
    client.close();
}
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:13,
代码来源:GridFTPClientTest.java

示例34: testList

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
private void testList(int mode, int type) throws Exception {
    logger.info("show list output using GridFTPClient");
    
    GridFTPClient client = connect();
    client.setType(type);
    client.setMode(mode);
    client.changeDir(TestEnv.serverADir);
    Vector v = client.list(null, null);
    logger.debug("list received");
    while (! v.isEmpty()) {
        FileInfo f = (FileInfo)v.remove(0); 
        logger.info(f.toString());
    }
    client.close();
}
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:16,
代码来源:GridFTPClientTest.java

示例35: testNList

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
private void testNList(int mode, int type) throws Exception {
    logger.info("show list output using GridFTPClient");
    
    GridFTPClient client = connect();
    client.setType(type);
    client.setMode(mode);
    client.changeDir(TestEnv.serverADir);
    Vector v = client.nlist();
    logger.debug("list received");
    while (! v.isEmpty()) {
        FileInfo f = (FileInfo)v.remove(0); 
        logger.info(f.toString());
    }
    client.close();
}
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:16,
代码来源:GridFTPClientTest.java

示例36: testMList

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
private void testMList(int mode, int type) throws Exception {
    logger.info("show list output using GridFTPClient");
    
    GridFTPClient client = connect();
    client.setType(type);
    client.setMode(mode);
    client.changeDir(TestEnv.serverADir);
    Vector v = client.mlsd(null);
    logger.debug("list received");
    while (! v.isEmpty()) {
        MlsxEntry f = (MlsxEntry)v.remove(0); 
        logger.info(f.toString());
    }
    client.close();
}
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:16,
代码来源:GridFTPClientTest.java

示例37: testConnectionReset1

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
public void testConnectionReset1() throws Exception {
    DataSink sink = (new DataSink() {
            public void write(Buffer buffer) 
                throws IOException{
                logger.debug("received " + buffer.getLength() +
                             " bytes of directory listing");
            }
            public void close() 
                throws IOException{};
        });

    GridFTPClient client = connect();

    String pwd = client.getCurrentDir();

    client.setPassiveMode(false);
    try {
        client.get(TestEnv.serverANoSuchFile, sink, null);
        fail("did not throw expected exception");
    } catch (Exception e) {
        // should fail
        e.printStackTrace();
    }
    client.setPassiveMode(true);
    client.put(new File(TestEnv.localSrcDir + "/" + TestEnv.localSrcFile),
               TestEnv.serverBDir + "/" + TestEnv.serverBFile,
               false);

    assertEquals(pwd, client.getCurrentDir());

    client.close();
}
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:33,
代码来源:GridFTPClientTest.java

示例38: testConnectionReset2

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
public void testConnectionReset2() throws Exception {
    DataSink sink = (new DataSink() {
            public void write(Buffer buffer) 
                throws IOException{
                logger.debug("received " + buffer.getLength() +
                             " bytes of directory listing");
            }
            public void close() 
                throws IOException{};
        });

    GridFTPClient client = connect();

    String pwd = client.getCurrentDir();

    client.setPassiveMode(true);
    try {
        client.get(TestEnv.serverANoSuchFile, sink, null);
        fail("did not throw expected exception");
    } catch (Exception e) {
        // should fail
        e.printStackTrace();
    }
    client.setPassiveMode(true);
    client.nlist();

    assertEquals(pwd, client.getCurrentDir());
    
    client.close();
}
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:31,
代码来源:GridFTPClientTest.java

示例39: testConnectionReset3

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
public void testConnectionReset3() throws Exception {
    DataSink sink = (new DataSink() {
            public void write(Buffer buffer) 
                throws IOException{
                logger.debug("received " + buffer.getLength() +
                             " bytes of directory listing");
            }
            public void close() 
                throws IOException{};
        });

    GridFTPClient client = connect();

    client.setMode(GridFTPSession.MODE_EBLOCK);          
    client.setType(Session.TYPE_IMAGE);       

    String pwd = client.getCurrentDir();

    client.setOptions(new RetrieveOptions(4));
    client.setPassiveMode(false);
    try {
        client.get(TestEnv.serverANoSuchFile, sink, null);
        fail("did not throw expected exception");
    } catch (Exception e) {
        // should fail
        e.printStackTrace();
    }

    DataSource source =
        new FileRandomIO(new RandomAccessFile(
              TestEnv.localSrcDir + "/" + TestEnv.localSrcFile, "r"));
    client.setPassiveMode(true);
    client.put(TestEnv.serverBDir + "/" + TestEnv.serverBFile,
               source, null);

    assertEquals(pwd, client.getCurrentDir());
    
    client.close();
}
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:40,
代码来源:GridFTPClientTest.java

示例40: test3Party_setParams

点赞 2

import org.globus.ftp.GridFTPClient; //导入依赖的package包/类
private void test3Party_setParams(GridFTPClient client, GSSCredential cred)
    throws Exception{
    client.authenticate(cred);
    client.setProtectionBufferSize(16384);
    client.setType(GridFTPSession.TYPE_IMAGE);
    client.setMode(GridFTPSession.MODE_STREAM);
}
 

开发者ID:NCIP,
项目名称:cagrid-general,
代码行数:8,
代码来源:GridFTPClientTest.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)