Package com.sun.appserv.management.deploy

Examples of com.sun.appserv.management.deploy.DeploymentMgr


 
    public Object
  uploadFile( final String name, final InputStream is  )
    throws IOException
  {
    final DeploymentMgr  mgr  = getDeploymentMgr();
    assert( mgr != null );
    //mgr.setTrace( true );
   
    final int  totalSize  = is.available();
    final int  chunkSize  = 1 + 32 * 1024// a screwball size
   
    final Object  uploadID  = mgr.initiateFileUpload( name, totalSize );
    int remaining  = totalSize;
    boolean  done  = false;
    while ( remaining != 0 )
    {
      final int  actual  = remaining < chunkSize ? remaining : chunkSize;
     
      final byte[]  bytes  = new byte[ actual ];
      is.read( bytes );
      done  = mgr.uploadBytes( uploadID, bytes );
      remaining  -= actual;
    }
    assert( done );
   
    return( uploadID );
View Full Code Here


      final String  moduleID,
      final String  filename,
      final int     chunkSize )
    throws IOException
  {
    final DeploymentMgr  mgr  =
        getDomainRoot().getDeploymentMgr();
   
    final Object  id  = mgr.initiateFileDownload( moduleID, filename );
   
    //trace( "downloading for: " + id );
   
    final int  actualChunkSize  = chunkSize < mgr.MAX_DOWNLOAD_CHUNK_SIZE ?
      chunkSize : mgr.MAX_DOWNLOAD_CHUNK_SIZE;
     
    final long  length  = mgr.getDownloadLength( id );
    long  doneSoFar  = 0;
    while ( doneSoFar < length  )
    {
      final byte[]  bytes  = mgr.downloadBytes( id, actualChunkSize );
     
      doneSoFar  += bytes.length;
    }
  }
View Full Code Here

  deploy( final File theFile )
    throws IOException
  {
    //printVerbose( "Uploading: " + quote( theFile ) );
    final Object    uploadID  = uploadFile( theFile );
    final DeploymentMgr  mgr  = getDeploymentMgr();
   
    final Object  deployID  = mgr.initDeploy( );
    assert( deployID instanceof String );
    final MyNotificationListener myListener  = new MyNotificationListener( deployID);
   
    DeploymentStatus  status  = null;
    mgr.addNotificationListener( myListener, null, null );
    try
    {
      final Map<String,String> options  = new HashMap<String,String>();
      options.put( DeploymentMgr.DEPLOY_OPTION_FORCE_KEY, Boolean.TRUE.toString() );
      options.put( DeploymentMgr.DEPLOY_OPTION_VERIFY_KEY, Boolean.TRUE.toString() );
      options.put( DeploymentMgr.DEPLOY_OPTION_DESCRIPTION_KEY, "test deploy" );
      options.put( DeploymentMgr.DEPLOY_OPTION_AVAILABILITY_ENABLED_KEY, Boolean.FALSE.toString() );
      options.put( DeploymentMgr.DEPLOY_OPTION_ENABLE_KEY, Boolean.TRUE.toString() );
     
      mgr.startDeploy( deployID, uploadID, null, null);
         
      printVerbose( NEWLINE + "Deploying: " + quote( theFile ) +
        ", deploy options: " + MapUtil.toString( options, ", ") );
      while ( ! myListener.isCompleted() )
      {
        try
        {
          //trace( "testDeployFile: sleeping for: " + deployID);
          Thread.sleep( 500 );
        }
        catch( InterruptedException e )
        {
        }
      }
     
      final Map<String,Serializable>  deploymentStatusMap  = mgr.getFinalDeploymentStatus( deployID );
      status  = DeploymentSupport.mapToDeploymentStatus( deploymentStatusMap );
    }
    finally
    {
      try
      {
        mgr.removeNotificationListener( myListener );
      }
      catch( Exception e )
      {
      }
    }
View Full Code Here

    public void
  undeploy( final String moduleID )
  {
      removeAllRefs( moduleID );
     
    final DeploymentMgr  mgr  = getDeploymentMgr();
   
    final long  start  = now();
    final DeploymentStatus  status  = DeploymentSupport.mapToDeploymentStatus( mgr.undeploy( moduleID, null ) );
    assert( status.getStageStatus() == DeploymentStatus.STATUS_CODE_SUCCESS );
   
    printElapsed( "undeploy " + moduleID, start );
  }
View Full Code Here

 
    public Object
  uploadFile( final String name, final InputStream is  )
    throws IOException
  {
    final DeploymentMgr  mgr  = getDeploymentMgr();
    assert( mgr != null );
    //mgr.setTrace( true );
   
    final int  totalSize  = is.available();
    final int  chunkSize  = 1 + 32 * 1024// a screwball size
   
    final Object  uploadID  = mgr.initiateFileUpload( name, totalSize );
    int remaining  = totalSize;
    boolean  done  = false;
    while ( remaining != 0 )
    {
      final int  actual  = remaining < chunkSize ? remaining : chunkSize;
     
      final byte[]  bytes  = new byte[ actual ];
      is.read( bytes );
      done  = mgr.uploadBytes( uploadID, bytes );
      remaining  -= actual;
    }
    assert( done );
   
    return( uploadID );
View Full Code Here

      final String  moduleID,
      final String  filename,
      final int     chunkSize )
    throws IOException
  {
    final DeploymentMgr  mgr  =
        getDomainRoot().getDeploymentMgr();
   
    final Object  id  = mgr.initiateFileDownload( moduleID, filename );
   
    //trace( "downloading for: " + id );
   
    final int  actualChunkSize  = chunkSize < mgr.MAX_DOWNLOAD_CHUNK_SIZE ?
      chunkSize : mgr.MAX_DOWNLOAD_CHUNK_SIZE;
     
    final long  length  = mgr.getDownloadLength( id );
    long  doneSoFar  = 0;
    while ( doneSoFar < length  )
    {
      final byte[]  bytes  = mgr.downloadBytes( id, actualChunkSize );
     
      doneSoFar  += bytes.length;
    }
  }
View Full Code Here

  deploy( final File theFile )
    throws IOException
  {
    //printVerbose( "Uploading: " + quote( theFile ) );
    final Object    uploadID  = uploadFile( theFile );
    final DeploymentMgr  mgr  = getDeploymentMgr();
   
    final Object  deployID  = mgr.initDeploy( );
    assert( deployID instanceof String );
    final MyNotificationListener myListener  = new MyNotificationListener( deployID);
   
    DeploymentStatus  status  = null;
    mgr.addNotificationListener( myListener, null, null );
    try
    {
      final Map<String,String> options  = new HashMap<String,String>();
      options.put( DeploymentMgr.DEPLOY_OPTION_FORCE_KEY, Boolean.TRUE.toString() );
      options.put( DeploymentMgr.DEPLOY_OPTION_VERIFY_KEY, Boolean.TRUE.toString() );
      options.put( DeploymentMgr.DEPLOY_OPTION_DESCRIPTION_KEY, "test deploy" );
      options.put( DeploymentMgr.DEPLOY_OPTION_AVAILABILITY_ENABLED_KEY, Boolean.FALSE.toString() );
      options.put( DeploymentMgr.DEPLOY_OPTION_ENABLE_KEY, Boolean.TRUE.toString() );
     
      mgr.startDeploy( deployID, uploadID, null, null);
         
      printVerbose( NEWLINE + "Deploying: " + quote( theFile ) +
        ", deploy options: " + MapUtil.toString( options, ", ") );
      while ( ! myListener.isCompleted() )
      {
        try
        {
          //trace( "testDeployFile: sleeping for: " + deployID);
          Thread.sleep( 500 );
        }
        catch( InterruptedException e )
        {
        }
      }
     
      final Map<String,Serializable>  deploymentStatusMap  = mgr.getFinalDeploymentStatus( deployID );
      status  = DeploymentSupport.mapToDeploymentStatus( deploymentStatusMap );
    }
    finally
    {
      try
      {
        mgr.removeNotificationListener( myListener );
      }
      catch( Exception e )
      {
      }
    }
View Full Code Here

    public void
  undeploy( final String moduleID )
  {
      removeAllRefs( moduleID );
     
    final DeploymentMgr  mgr  = getDeploymentMgr();
   
    final long  start  = now();
    final DeploymentStatus  status  = DeploymentSupport.mapToDeploymentStatus( mgr.undeploy( moduleID, null ) );
    assert( status.getStageStatus() == DeploymentStatus.STATUS_CODE_SUCCESS );
   
    printElapsed( "undeploy " + moduleID, start );
  }
View Full Code Here

        }
        return retVal;
    }
   
    private boolean undeployModule(ConnectionSource dasConnection, DeploymentStatus rollbackStatus) {
        DeploymentMgr deplMgr = ProxyFactory.getInstance(dasConnection).getDomainRoot().getDeploymentMgr();       
        Map undeployStatus = deplMgr.undeploy(moduleID, options);           
        com.sun.appserv.management.deploy.DeploymentStatus finalStatusFromMBean =
                            DeploymentSupport.mapToDeploymentStatus(undeployStatus);
        DeploymentStatus tmp = DeploymentClientUtils.getDeploymentStatusFromAdminStatus(finalStatusFromMBean);
        rollbackStatus.addSubStage(tmp);
        if (tmp!=null && tmp.getStatus() < DeploymentStatus.WARNING) {
View Full Code Here

TOP

Related Classes of com.sun.appserv.management.deploy.DeploymentMgr

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.