Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.collabnet.ce.webservices;
 
 import  com.collabnet.ce.soap50.webservices.ClientSoapStubFactory;
 
 import  com.collabnet.ce.soap50.webservices.filestorage.IFileStorageAppSoap;
 
 import java.io.File;
 
Class to hold the file-related methods. Wraps a CollabNetApp.
public class FileStorageApp {
    private CollabNetApp collabNetApp;
    private IFileStorageAppSoap ifsa;

    
Construct a new FileStorageApp.

Parameters:
collabNetApp a valid (logged-in) collabNetApp.
    public FileStorageApp(CollabNetApp collabNetApp) {
        this. = collabNetApp;
        this. = this.getIFileStorageAppSoap();
    }

    

Returns:
a Client Soap stub for the SimpleFileStorageApp.
    private IFileStorageAppSoap getIFileStorageAppSoap() {
        String soapURL = this.getUrl() + . +
            "FileStorageApp?wsdl";
        return (IFileStorageAppSoap) ClientSoapStubFactory.
            getSoapStub(IFileStorageAppSoap.classsoapURL);
    }

    
Upload a file to the server.

Parameters:
file to upload.
Returns:
the fileId associatd with the uploaded file.
Throws:
RemoteException.
    public String uploadFile(File filethrows RemoteException {
        String fileId = null;
        FileDataSource fds = new FileDataSource(file);
        DataHandler dh = new DataHandler(fds);
        fileId = this..uploadFile(this.getSessionId(), dh);
        return fileId;
    }

    
Below are wrapping functions, to make the code neater and in case, something changes. /
    private void checkValidSessionId() {
        this..checkValidSessionId();
    }
    
    private String getSessionId() {
        return this..getSessionId();
    }
    
    private String getUrl() {
        return this..getServerUrl();
    }
New to GrepCode? Check out our FAQ X