Package com.sun.appserv.management.base

Examples of com.sun.appserv.management.base.UploadDownloadMgr


 
    public Object
  upload( final String name, final int totalSize )
    throws IOException
  {
    final UploadDownloadMgr  mgr  = getUploadDownloadMgr();
    //mgr.setTrace( true );
   
    final int  chunkSize  = 32 * 1024;
   
    final long  start  = now();
   
    final Object  uploadID  = mgr.initiateUpload( name, totalSize );
    int remaining  = totalSize;
    boolean  done  = false;
    while ( remaining != 0 )
    {
      final int  actual  = remaining < chunkSize ? remaining : chunkSize;
     
      final byte[]  bytes  = new byte[ actual ];
      done  = mgr.uploadBytes( uploadID, bytes );
      remaining  -= actual;
      //trace( "uploaded: " + (totalSize - remaining) );
    }
    assert( done );
   
View Full Code Here


  testDownloadFile(
    final int testSize,
    final int chunkSize )
    throws IOException
  {
    final UploadDownloadMgr  mgr  =
        getDomainRoot().getUploadDownloadMgr();
   
    final File  testFile  = createTempFile( testSize );
   
    final long  start  = now();
    final Object  id  = mgr.initiateDownload( testFile, true );
   
    //trace( "initated download for: " + id + " file = " + testFile.toString() );
    final int  maxChunkSize  = mgr.getMaxDownloadChunkSize();
    final int  actualChunkSize  = chunkSize < maxChunkSize ?
                    chunkSize : maxChunkSize;
     
    final long  length  = mgr.getDownloadLength( id );
    long  doneSoFar  = 0;
    while ( doneSoFar < length  )
    {
      final byte[]  bytes  = mgr.downloadBytes( id, actualChunkSize );
      doneSoFar  += bytes.length;
    }
   
    printElapsed( "UploadDownloadMgr.testDownloadFile: " +
        testSize + " bytes" + " chunksize = " + actualChunkSize, start );
View Full Code Here

    final Object  planUploadID,
    final Map<String,String>    options)
  {
    staleDeployCheck();
   
    final UploadDownloadMgr  mgr  = getUploadDownloadMgr();
   
    final File  deployFile  = mgr.takeUpload( uploadID );
    final File  planFile  = planUploadID == null ? null : mgr.takeUpload( planUploadID );
   
    final DeployThreadParams  params  =
      new DeployThreadParams(
        getQueryMgr(),
        options,
View Full Code Here

            //@@@ i18n
            throw new IOException(
                "Problem accessing directory " + destDir.getPath());
        }

        UploadDownloadMgr downloadMgr =
            ProxyFactory.getInstance(dasConnection).getDomainRoot().getUploadDownloadMgr();
        int chunkSize = 32 * 1024;
        FileOutputStream fos = null;
        try {
            Object downloadID = downloadMgr.initiateDownload(srcFile, false);
            fos = new FileOutputStream(destFile);
            boolean done = false;
            while (!done)
            {
                byte[] bytes = downloadMgr.downloadBytes(downloadID, chunkSize);
                fos.write(bytes, 0, bytes.length);
                if (bytes.length < chunkSize) { done = true; }
            }
        } finally {
            if (fos != null) {
View Full Code Here

TOP

Related Classes of com.sun.appserv.management.base.UploadDownloadMgr

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.