Package com.ibm.sbt.services.client.connections.files

Examples of com.ibm.sbt.services.client.connections.files.FileService


    }
    if (StringUtil.isEmpty(ext)) {
        throw new FacesExceptionEx(new NullPointerException(), "Extension of file being uploaded may not be null");
    }
   
    FileService svc = new FileService();
   
    FileCreationParameters p = new FileCreationParameters();
        p.visibility = FileCreationParameters.Visibility.PUBLIC;
        InputStream is;

       try {
       
          is = new FileInputStream(serverFile);
      com.ibm.sbt.services.client.connections.files.File entry = svc.uploadFile(is,name, serverFile.length(),p.buildParameters());
        
    }catch (ClientServicesException e) {
            throw new FacesExceptionEx(e);
        } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
View Full Code Here


    FileUrls.USERLIBRARY_DOCUMENT_FEED.format(service, FileUrlParts.userId.get(userId), FileUrlParts.fileId.get(fileId));
  }

  @Test
  public void testGenerateURLExtraParameters() {
    FileService service = new FileService();
    String userId = "abcde";
    String fileId = "1234";
    String commentId = "a1b2c3";
    //This would be the url with all the needed parameters
    //String url = FileUrls.SINGLE_COMMENT_USER_FILE.format(getApiVersion(), getAuthTypeBasic(), AccessType.PUBLIC.get(), FileUrlParts.userId.get(userId), FileUrlParts.fileId.get(fileId), FileUrlParts.commentId.get(commentId));
View Full Code Here

    super(url, user, password);
  }
 
    public FileService getFileService() {
      if (fileService == null) {
        fileService = new FileService(getBasicEndpoint());
      }
      return fileService;
    }
View Full Code Here

   
    FileServiceApp fsa = null;
    try {
      fsa = new FileServiceApp(url, user, password);
     
      FileService fileService = fsa.getFileService();
      File file = fileService.getFile("087ad154-df65-43c2-8c4e-383c68337724", "6097b4ce-39dc-4db1-9d4f-4d89ff125c69", null);
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      long size = fileService.downloadFile(baos, file, null);
     
      System.out.println(DOMUtil.getXMLString(file.getDataHandler().getData()));
      System.out.println("Downloaded: "+size);
     
    } catch (Exception e) {
View Full Code Here

  public DownloadFileApp(String endpointName, boolean initEnvironment)
      throws AuthenticationException {
    if (initEnvironment)
      this.initEnvironment();

    this.fileService = new FileService();
    this.communityService = new CommunityService();
    this.setEndpoint((BasicEndpoint) EndpointFactory
        .getEndpoint(endpointName));
  }
View Full Code Here

  public static void main(String[] args) {
    DownloadFileApp app = null;

    try {
      app = new DownloadFileApp();
      FileService fileService = app.getFileService();
      Collection<File> files = fileService.getPublicFiles();
      for (File file : files) {
        if (file.getTitle().contains(".txt")) {

          fileService.downloadFile(System.out, file.getFileId(),
              file.getLibraryId(), true);
        }
      }
    } catch (ClientServicesException e) {
      e.printStackTrace();
View Full Code Here

   * @param params
   * @return FileList
   * @throws ClientServicesException
   */
  public EntityList<File> getCommunityFiles(String communityId, HashMap<String, String> params) throws ClientServicesException {
    FileService fileService = new FileService(endpoint);
    return fileService.getCommunityFiles(communityId, params);
  }
View Full Code Here

   * @param params
   * @return long
   * @throws ClientServicesException
   */
  public long downloadCommunityFile(OutputStream ostream, final String fileId, final String libraryId, Map<String, String> params) throws ClientServicesException {
    FileService svc = new FileService(endpoint);
    return svc.downloadCommunityFile(ostream, fileId, libraryId, params);
  }
View Full Code Here

   * @param title
   * @param length
   * @throws ClientServicesException
   */
  public File uploadFile(InputStream iStream, String communityId, final String title, long length) throws ClientServicesException {
    FileService svc = new FileService(endpoint);
    return svc.uploadCommunityFile(iStream, communityId, title, length);
  }
View Full Code Here

      return null;
    }
   

    if (fileService == null) {
      fileService = new FileService(getEndpointName());
    }
    return fileService;
  }
View Full Code Here

TOP

Related Classes of com.ibm.sbt.services.client.connections.files.FileService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.