Package org.gudy.azureus2.pluginsimpl.local.update

Examples of org.gudy.azureus2.pluginsimpl.local.update.UpdateCheckInstanceImpl


   *
   * @since 3.0.0.7
   */
  private boolean nextUpdate() {
    if (iterDownloaders.hasNext()) {
      ResourceDownloader downloader = (ResourceDownloader) iterDownloaders.next();
      downloader.addListener(this);
      downloader.asyncDownload();
      return true;
    }
    return false;
  }
View Full Code Here


              }
             
              setProgress( 0 );
             
              downloader.addListener(
                new ResourceDownloaderAdapter()
                {
                  public void
                  reportPercentComplete(
                    ResourceDownloader  downloader,
                    int          percentage )
View Full Code Here

    props         = new propertyWrapper(_props );
    pluginDir       = _pluginDir;
    config         = new PluginConfigImpl(this,pluginConfigKey);
    given_plugin_id      = _plugin_id;
    plugin_version    = _plugin_version;
    ipc_interface      = new IPCInterfaceImpl( initialiser, plugin );
    state                 = new PluginStateImpl(this, initialiser);
   
    boolean verified   = false;
    boolean bad    = false;
   
View Full Code Here

  }
 
  public IPFilter
  getIPFilter()
  {
    return( new IPFilterImpl());
  }
View Full Code Here

 
  public Logger getLogger()
  {
    if ( logger == null ){
     
      logger = new LoggerImpl( this );
    }
   
    return( logger );
  }
View Full Code Here

    else {
      plug_msg = new MessageAdapter( message )//core created
    }
   
    RawMessage raw_plug = plug_encoder.encodeMessage( plug_msg );
    return new com.aelitis.azureus.core.networkmanager.RawMessage[]{ new RawMessageAdapter( raw_plug )};
  }
View Full Code Here

    return config;
  }


  public PluginConfigUIFactory getPluginConfigUIFactory() {
    return new PluginConfigUIFactoryImpl(config,pluginConfigKey);
  }
View Full Code Here

   
    PluginUpdatePlugin  pup = (PluginUpdatePlugin)pup_pi.getPlugin();
   
    UpdateManagerImpl  uman = (UpdateManagerImpl)manager.getDefaultPluginInterface().getUpdateManager();
   
    UpdateCheckInstanceImpl  inst =
      uman.createEmptyUpdateCheckInstance(
          UpdateCheckInstance.UCI_INSTALL,
          "update.instance.install",
          low_noise );
   
    if ( properties != null ){
     
      for ( Map.Entry<Integer,Object> entry: properties.entrySet()){
       
        inst.setProperty( entry.getKey(), entry.getValue());
      }
    }
   
    if ( listener != null ){
     
      inst.addListener(
        new UpdateCheckInstanceListener()
        {
          public void
          cancelled(
            UpdateCheckInstance    instance )
          {
            listener.cancelled();
          }
         
          public void
          complete(
            UpdateCheckInstance    instance )
          {
            final Update[] updates = instance.getUpdates();
           
            if ( updates.length == 0 ){
                           
              listener.failed( new PluginException( "No updates were added during check process" ));
             
            }else{
             
              for (int i=0;i<updates.length;i++){
               
                updates[i].addListener(
                  new UpdateListener()
                  {
                    private boolean  cancelled;
                   
                    public void
                    cancelled(
                      Update update)
                    {
                      cancelled = true;
                     
                      check();
                    }
                   
                    public void
                    complete(
                      Update update )
                    {
                      check();
                    }
                   
                    protected void
                    check()
                    {
                      Update failed_update = null;
                     
                      for ( Update update: updates ){
                       
                        if ( !update.isCancelled() && !update.isComplete()){
                         
                          return;
                        }
                       
                        if ( !update.wasSuccessful()){
                         
                          failed_update = update;
                        }
                      }
                     
                      if ( cancelled ){
                       
                        listener.cancelled();
                       
                      }else{
                       
                        if ( failed_update == null ){
                         
                            // flush plugin events through before reporting complete
                         
                          PluginInitializer.waitForPluginEvents();
                         
                          listener.completed();
                         
                        }else{
                       
                          listener.failed(
                            new PluginException(
                              "Install of " + failed_update.getName() + " failed" ));
                        }
                      }
                    }
                  });
              }
            }
          }
        });
    }
   
    try{
     
      for (int i=0;i<plugins.length;i++){
       
        InstallablePlugin  plugin  = plugins[i];
       
        final String  plugin_id = plugin.getId();
       
        PluginInterface  existing_plugin_interface = manager.getPluginInterfaceByID( plugin_id, false );
       
        Plugin      existing_plugin  = null;
       
        if ( existing_plugin_interface != null ){
         
          existing_plugin  = existing_plugin_interface.getPlugin();
         
            // try to check that the new version is higher than the old one!
         
          String  old_version = existing_plugin_interface.getPluginVersion();
         
          if ( old_version != null ){
           
            int  res = Constants.compareVersions( plugin.getVersion(), old_version );
           
            if ( res < 0 ){
             
              throw( new PluginException( "A higher version (" + old_version + ") of Plugin '" + plugin_id + "' is already installed" ));
             
            }else if ( res == 0 ){
             
              throw( new PluginException( "Version (" + old_version + ") of Plugin '" + plugin_id + "' is already installed" ));
            }
          }
        }
       
        String  target_dir;
       
        if ( shared ){
                 
          target_dir   = FileUtil.getApplicationFile( "plugins" ).toString();
         
        }else{
         
          target_dir   = FileUtil.getUserFile( "plugins" ).toString();
        }
       
        target_dir += File.separator + plugin_id;
   
          // this may fail on Vista but it doesn't matter as we recover this later
          // on. So *don't* check for success here
       
        new File( target_dir ).mkdir();
       
        if ( existing_plugin == null ){
         
            // create a dummy plugin at version 0.0 to trigger the "upgrade" to the new
            // installed version
         
          FailedPlugin  dummy_plugin = new FailedPlugin( plugin_id, target_dir );
         
          PluginManager.registerPlugin( dummy_plugin, plugin_id );
       
          final PluginInterface dummy_plugin_interface = manager.getPluginInterfaceByID( plugin_id, false );
         
          ((InstallablePluginImpl)plugin).addUpdate( inst, pup, dummy_plugin, dummy_plugin_interface );
             
          inst.addListener(
            new UpdateCheckInstanceListener()
            {
              public void
              cancelled(
                UpdateCheckInstance    instance )
              {
                try{
               
                  dummy_plugin_interface.getPluginState().unload();
                 
                }catch( Throwable e ){
                 
                  Debug.out( "Failed to unload plugin", e );
                }
              }
             
              public void
              complete(
                UpdateCheckInstance    instance )
              {
                PluginInterface pi = manager.getPluginInterfaceByID( plugin_id, false );
               
                if ( pi != null && pi.getPlugin() instanceof FailedPlugin ){
                 
                  try{
                    pi.getPluginState().unload();
                   
                  }catch( Throwable e ){
                   
                    Debug.out( "Failed to unload plugin", e );
                  }
                }

              }
            });
        }else{
         
          ((InstallablePluginImpl)plugin).addUpdate( inst, pup, existing_plugin, existing_plugin_interface );
        }
      }
   
      inst.start();
     
      return( inst );
     
    }catch( Throwable e ){
     
      inst.cancel();
     
      if ( e instanceof PluginException ){
       
        throw((PluginException)e);
      }else{
View Full Code Here

  {
    boolean  handled = false;
   
    for (int i=0;i<listeners.size();i++){
     
      PooledByteBuffer  buffer = new PooledByteBufferImpl(message.getPayload());
     
      try{
        ((GenericMessageConnectionListener)listeners.get(i)).receive( this, buffer );
       
        handled = true;
       
      }catch( Throwable f ){
       
        buffer.returnToPool();
       
        if ( !( f instanceof MessageException )){
       
          Debug.printStackTrace(f);
        }
View Full Code Here

    warningIcon = imageLoader.getImage("image.sidebar.vitality.alert");
    infoIcon   = imageLoader.getImage("image.sidebar.vitality.info");
    updateStatusWarnings();
    Messages.setLanguageText(statusWarnings,
        "MainWindow.status.warning.tooltip");
    Alerts.addMessageHistoryListener(new AlertHistoryListener() {
      public void alertHistoryAdded(LogAlert params) {
        updateStatusWarnings();
      }
      public void alertHistoryRemoved(LogAlert alert) {
        updateStatusWarnings();
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.pluginsimpl.local.update.UpdateCheckInstanceImpl

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.