Examples of UpdateInstaller


Examples of org.gudy.azureus2.plugins.update.UpdateInstaller

          handleEvent(Event event)
          {
            try{
              PluginInterface pi = AzureusCoreFactory.getSingleton().getPluginManager().getDefaultPluginInterface();
             
              UpdateInstaller installer = pi.getUpdateManager().createInstaller();
           
              installer.addMoveAction(
                "C:\\temp\\file1", "C:\\temp\\file2" );
           
              installer.installNow(
                new UpdateInstallerListener()
                {
                  public void
                  reportProgress(
                    String    str )
View Full Code Here

Examples of org.gudy.azureus2.plugins.update.UpdateInstaller

                      }
                    }else{

                        // insufficient perms
                     
                      UpdateInstaller installer = getInstaller( azureus_core );
                     
                        // retry later
                     
                      if ( installer == null ){
                       
                        return;
                      }
                     

                      if ( !informUpdateRequired()){
                       
                        return;
                      }

                      if ( old_shared_options.exists()){

                        installer.addRemoveAction( old_shared_options.getAbsolutePath());
                      }

                      installer.addMoveAction( shared_options.getAbsolutePath(), old_shared_options.getAbsolutePath());
                     
                      if ( !local_options.exists()){

                        installer.addResource( "local_options", new ByteArrayInputStream( options.getBytes( "UTF-8" )));
                       
                        installer.addMoveAction( "local_options", local_options.getAbsolutePath());
                      }                           

                      installer.addResource( "redirect", new ByteArrayInputStream( ( redirect + "\r\n" ).getBytes( "UTF-8" )));
                     
                      installer.addMoveAction( "redirect", shared_options.getAbsolutePath());
                       
                      final AESemaphore sem = new AESemaphore( "vmopt" );
                     
                      final UpdateException[]  error = { null };
                     
                      installer.installNow(
                        new UpdateInstallerListener()
                        {
                          public void
                          reportProgress(
                            String    str )
                          {
                          }
                         
                          public void
                          complete()
                          {                           
                            sem.release();
                          }
                         
                          public void
                          failed(
                            UpdateException  e )
                          {
                            error[0] = e;
                           
                            sem.release();
                          }
                        });
                     
                      sem.reserve();
                     
                      if ( error[0] != null ){
                       
                        throw( error[0] );
                      }
                     
                    }
                  }
                }else{
                    // redirect in place, might be second user so migrate if needed

                  if ( old_shared_options.exists() && !local_options.exists()){

                    if ( !FileUtil.copyFile( old_shared_options, local_options )){

                      Debug.out( "Failed to copy " + old_shared_options + " to " + local_options );
                    }
                  }
                }
              }else{

                  // no options
               
                if ( FileUtil.canReallyWriteToAppDirectory()){
                 
                  if ( !FileUtil.writeStringAsFile( shared_options, redirect + "\r\n" )){
                   
                    Debug.out( "Failed to write to " + shared_options );
                  }
                }else{
                 
                    // insufficient perms
                                   
                  UpdateInstaller installer = getInstaller( azureus_core );
               
                    // retry later
                 
                  if ( installer == null ){
                   
                    return;
                  }
                 
                 
                  if ( !informUpdateRequired()){
                   
                    return;
                  }

                  installer.addResource( "redirect", new ByteArrayInputStream( ( redirect + "\r\n" ).getBytes( "UTF-8" )));
                 
                  installer.addMoveAction( "redirect", shared_options.getAbsolutePath());
                   
                  final AESemaphore sem = new AESemaphore( "vmopt" );
                 
                  final UpdateException[]  error = { null };
                 
                  installer.installNow(
                    new UpdateInstallerListener()
                    {
                      public void
                      reportProgress(
                        String    str )
View Full Code Here

Examples of org.gudy.azureus2.plugins.update.UpdateInstaller

    if ( update_manager.getInstallers().length > 0 ){
     
      return( null );
    }
   
    UpdateInstaller installer = pi.getUpdateManager().createInstaller();
 
    return( installer );
  }
View Full Code Here

Examples of org.gudy.azureus2.plugins.update.UpdateInstaller

     
        try{
 
          UpdateManager  update_man = manager.getDefaultPluginInterface().getUpdateManager();
         
          UpdateInstaller installer = update_man.createInstaller();
         
          File  from_file   = new File( "C:\\temp\\update_from" );
          File  to_file    = new File( "C:\\temp\\update_to" );
         
          PrintWriter pw = new PrintWriter( new FileWriter( from_file ));
         
          pw.println( "hello mum");
         
          pw.close();
         
          to_file.delete();
         
          installer.addMoveAction( from_file.toString(), to_file.toString());
         
          update_man.applyUpdates( false );
         
        }catch( Throwable e ){
         
View Full Code Here

Examples of org.gudy.azureus2.plugins.update.UpdateInstaller

    try {
    data = update.verifyData( data, true );
    
    rd.reportActivity( "Data verified successfully" );
          
      UpdateInstaller installer = checker.createInstaller();
     
      zip = new ZipInputStream(data);
     
      ZipEntry entry = null;
     
      while((entry = zip.getNextEntry()) != null) {
       
        String name = entry.getName();
       
          // all jars
       
        if ( name.endsWith( ".jar" )){
         
          installer.addResource(name,zip,false);
         
          if ( Constants.isOSX ){
           
            installer.addMoveAction(name,installer.getInstallDir() + OSX_APP + "/Contents/Resources/Java/" + name);
           
          }else{
           
            installer.addMoveAction(name,installer.getInstallDir() + File.separator + name);
          }
        }else if ( name.endsWith(".jnilib") && Constants.isOSX ){
         
            //on OS X, any .jnilib
         
          installer.addResource(name,zip,false);
         
          installer.addMoveAction(name,installer.getInstallDir() + OSX_APP + "/Contents/Resources/Java/dll/" + name);
         
        }else if ( name.equals("java_swt")){
         
            //on OS X, java_swt (the launcher to start SWT applications)
            
          installer.addResource(name,zip,false);
         
          installer.addMoveAction(name,installer.getInstallDir() + OSX_APP + "/Contents/MacOS/" + name);
         
          installer.addChangeRightsAction("755",installer.getInstallDir() + OSX_APP + "/Contents/MacOS/" + name);
         
        }else if( name.endsWith( ".dll" ) || name.endsWith( ".so" ) || name.indexOf( ".so." ) != -1 ) {
         
             // native stuff for windows and linux
          
          installer.addResource(name,zip,false);
         
          installer.addMoveAction(name,installer.getInstallDir() + File.separator + name);
 
        }else if ( name.equals("javaw.exe.manifest") || name.equals( "azureus.sig" )){
         
          // silently ignore this one
        }else{
View Full Code Here

Examples of org.gudy.azureus2.plugins.update.UpdateInstaller

           
         
          try
          {
              UpdateManager um = pluginInterface.getUpdateManager();
              UpdateInstaller updateInstaller = um.createInstaller();   
              int i = 0;
              while (!complete_file_from.isEmpty()){
                 
                  File from = new File (complete_file_from.pop());
                  if(!from.isFile())
                  {
                      StatusBoxUtils.mainStatusAdd(" Could not update because " + from.getName() " is not a real file",2);
                  }
                  //System.out.println("From: " + from.getPath() + " To: " + complete_file_to.peek());
                  //System.out.println("addResource: azcvsupdater_" + i);
                  updateInstaller.addResource("azcvsupdater_" + i , new FileInputStream (from));
                  if(!complete_file_to.isEmpty())
                  {
                      updateInstaller.addMoveAction("azcvsupdater_" + i , complete_file_to.pop());
                  }

                    i++;
              }
              //System.out.println("AZCVSUpdater:  Sleeping for 5 seconds to ensure all has completed");
View Full Code Here

Examples of org.gudy.azureus2.plugins.update.UpdateInstaller

           
         
          try
          {
              UpdateManager um = pluginInterface.getUpdateManager();
              UpdateInstaller updateInstaller = um.createInstaller();   
              int i = 0;
              while (!complete_file_from.isEmpty()){
                 
                   
                  File from = new File (complete_file_from.pop());
                  if(!from.isFile())
                  {
                      StatusBoxUtils.mainStatusAdd(" Could not update because " + from.getName() " is not a real file",2);
                  }
                  String file_to = complete_file_to.peek();
                 // System.out.println("From: " + from.getPath() + " To: " + file_to);
                 
                  updateInstaller.addResource("azcvsupdater_" + i , new FileInputStream (from));
                  if(!complete_file_to.isEmpty())
                  {
                      updateInstaller.addMoveAction("azcvsupdater_" + i , complete_file_to.pop());
                       
                  }
                  StatusBoxUtils.mainStatusAdd(" Successfully added " + from.getName() + " for insertion as " + file_to + " on next restart ",1);
        /*          if(from.getName().startsWith("azcvsupdater")){
                        StatusBoxUtils.mainStatusAdd(" Successfully deleted " + from.getName());
View Full Code Here

Examples of org.gudy.azureus2.plugins.update.UpdateInstaller

                   
           
            try
            {
                UpdateManager um = pluginInterface.getUpdateManager();
                UpdateInstaller updateInstaller = um.createInstaller();   
                int i = 0;
                while (!complete_file_from.isEmpty()){
                   
                   
                    //System.out.println("From: " + complete_file_from.peek() + " To: " + complete_file_to.peek());
                    if(!complete_file_to.isEmpty())
                    {
                       updateInstaller.addMoveAction(complete_file_from.pop(),complete_file_to.pop());
                    }

                    i++;
                }
                //System.out.println("AZCVSUpdater:  Sleeping for 5 seconds to ensure all has completed");
View Full Code Here

Examples of org.gudy.azureus2.plugins.update.UpdateInstaller

                    try
                    {
                        LoggerChannel logger =View.getPluginInterface().getLogger().getTimeStampedChannel("AZCVSUpdater");
                       
                        UpdateManager um = View.getPluginInterface().getUpdateManager();
                        UpdateInstaller updateInstaller = um.createInstaller();   
                       
                                                
                            File from = new File (complete_file_from);
                            if(!from.isFile())
                            {
                                StatusBoxUtils.mainStatusAdd(" Could not update because " + from.getName() " is not a real file",2);
                            }
                            //System.out.println("AZCVSUpdater:  One File Restart/Exit Action");
                            //System.out.println("From: " + from.getPath() + " To: " + complete_file_to);
                           
                            //updateInstaller.addResource("azcvsupdater_restart_stream" , new FileInputStream (from));
                            updateInstaller.addMoveAction(complete_file_from , complete_file_to);
                           
       
                                                   
                        //System.out.println("AZCVSUpdater:  Sleeping for 5 seconds to ensure all has completed, because Tim says my plugin is lazy ;)");
                        logger.log("Sleeping for 5 seconds to ensure all has completed");
View Full Code Here

Examples of org.gudy.azureus2.plugins.update.UpdateInstaller

                   
           
                    try
                    {
                        UpdateManager um = View.getPluginInterface().getUpdateManager();
                        UpdateInstaller updateInstaller = um.createInstaller();   
                       
                                                
                            File from = new File (complete_file_from);
                            if(!from.isFile())
                            {
                                StatusBoxUtils.mainStatusAdd(" Could not update because " + from.getName() " is not a real file",2);
                            }
                            //System.out.println("AZCVSUpdater:  One File Insert only Action");
                            //System.out.println("From: " + from.getPath() + " To: " + complete_file_to);
                           
                            //updateInstaller.addResource("azcvsupdater_restart_stream" , new FileInputStream (from));
                            updateInstaller.addMoveAction(complete_file_from , complete_file_to);
                           
                            StatusBoxUtils.mainStatusAdd(" Successfully added " + from.getName() + " for insertion as " + complete_file_to + " on next restart ",1);
                                                   
                        //System.out.println("AZCVSUpdater:  Sleeping for 5 seconds to ensure all has completed, because Tim says my plugin is lazy)");
                        //Thread.sleep(5000);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.