Package com.aelitis.azureus.core.custom

Examples of com.aelitis.azureus.core.custom.Customization


       
        checked_customization = true;
       
        CustomizationManager cust_man = CustomizationManagerFactory.getSingleton();
       
        Customization cust = cust_man.getActiveCustomization();
       
        if ( cust != null ){
         
          String cust_name   = COConfigurationManager.getStringParameter( "metasearch.custom.name", "" );
          String cust_version = COConfigurationManager.getStringParameter( "metasearch.custom.version", "0" );
         
          boolean  new_name   = !cust_name.equals( cust.getName());
          boolean  new_version = org.gudy.azureus2.core3.util.Constants.compareVersions( cust_version, cust.getVersion() ) < 0;
         
          if ( new_name || new_version ){

            log( "Customization: checking templates for " + cust.getName() + "/" + cust.getVersion());
           
            try{
              InputStream[] streams = cust.getResources( Customization.RT_META_SEARCH_TEMPLATES );
             
              if ( streams.length > 0 && new_name ){
               
                  // reset engines
               
                log( "    setting auto-mode to false" );
               
                setAutoMode( false );
               
                /*
                Engine[]  engines = meta_search.getEngines( false, false );

                for (int i=0;i<engines.length;i++){
                 
                  Engine engine = engines[i];
                 
                  if ( engine.getSelectionState()) == Engine.SEL_STATE_MANUAL_SELECTED ){
                   
                  }
                }
                */
              }
              for (int i=0;i<streams.length;i++){
               
                InputStream is = streams[i];
               
                try{
                  VuzeFile vf = VuzeFileHandler.getSingleton().loadVuzeFile(is);
                 
                  if ( vf != null ){
                   
                    VuzeFileComponent[] comps = vf.getComponents();
                   
                    for (int j=0;j<comps.length;j++){
                     
                      VuzeFileComponent comp = comps[j];
                     
                      if ( comp.getType() == VuzeFileComponent.COMP_TYPE_METASEARCH_TEMPLATE ){
                       
                        try{
                          Engine e =
                            getSingleton().importEngine( comp.getContent(), false );
                         
                          log( "    updated " + e.getName());
                         
                          e.setSelectionState( Engine.SEL_STATE_MANUAL_SELECTED );
                         
                        }catch( Throwable e ){
                         
                          Debug.printStackTrace(e);
                        }
                      }
                    }
                  }
                }finally{
                 
                  try{
                    is.close();
                   
                  }catch( Throwable e ){
                  }
                }
              }
            }finally{
             
              COConfigurationManager.setParameter( "metasearch.custom.name", cust.getName());
              COConfigurationManager.setParameter( "metasearch.custom.version", cust.getVersion());
            }
          }
        }
      }
     
View Full Code Here


 
      AEDiagnostics.addEvidenceGenerator( this );
     
      CustomizationManager cust_man = CustomizationManagerFactory.getSingleton();
     
      Customization cust = cust_man.getActiveCustomization();
     
      if ( cust != null ){
       
        String cust_name   = COConfigurationManager.getStringParameter( "subscriptions.custom.name", "" );
        String cust_version = COConfigurationManager.getStringParameter( "subscriptions.custom.version", "0" );
       
        boolean  new_name   = !cust_name.equals( cust.getName());
        boolean  new_version = org.gudy.azureus2.core3.util.Constants.compareVersions( cust_version, cust.getVersion() ) < 0;
       
        if ( new_name || new_version ){

          log( "Customization: checking templates for " + cust.getName() + "/" + cust.getVersion());
         
          try{
            InputStream[] streams = cust.getResources( Customization.RT_SUBSCRIPTIONS );
           
            for (int i=0;i<streams.length;i++){
             
              InputStream is = streams[i];
             
              try{
                VuzeFile vf = VuzeFileHandler.getSingleton().loadVuzeFile(is);
               
                if ( vf != null ){
                 
                  VuzeFileComponent[] comps = vf.getComponents();
                 
                  for (int j=0;j<comps.length;j++){
                   
                    VuzeFileComponent comp = comps[j];
                   
                    int type = comp.getType();
                   
                    if (   type == VuzeFileComponent.COMP_TYPE_SUBSCRIPTION ||
                        type == VuzeFileComponent.COMP_TYPE_SUBSCRIPTION_SINGLETON  ){
                     
                      try{
                        importSubscription(
                            type,
                            comp.getContent(),
                            false );
                       
                        comp.setProcessed();
                       
                      }catch( Throwable e ){
                       
                        Debug.printStackTrace(e);
                      }
                    }
                  }
                }
              }finally{
               
                try{
                  is.close();
                 
                }catch( Throwable e ){
                }
              }
            }
          }finally{
           
            COConfigurationManager.setParameter( "subscriptions.custom.name", cust.getName());
            COConfigurationManager.setParameter( "subscriptions.custom.version", cust.getVersion());
          }
        }
      }
     
      scheduler = new SubscriptionSchedulerImpl( this );
View Full Code Here

   
    AEDiagnostics.addEvidenceGenerator( this );
   
    CustomizationManager cust_man = CustomizationManagerFactory.getSingleton();
   
    Customization cust = cust_man.getActiveCustomization();
   
    if ( cust != null ){
     
      String cust_name   = COConfigurationManager.getStringParameter( "cnetworks.custom.name", "" );
      String cust_version = COConfigurationManager.getStringParameter( "cnetworks.custom.version", "0" );
     
      boolean  new_name   = !cust_name.equals( cust.getName());
      boolean  new_version = Constants.compareVersions( cust_version, cust.getVersion() ) < 0;
     
      if ( new_name || new_version ){
       
        try{
          InputStream[] streams = cust.getResources( Customization.RT_CNETWORKS );
         
          for (int i=0;i<streams.length;i++){
           
            InputStream is = streams[i];
           
            try{
              VuzeFile vf = VuzeFileHandler.getSingleton().loadVuzeFile(is);
             
              if ( vf != null ){
               
                VuzeFileComponent[] comps = vf.getComponents();
               
                for (int j=0;j<comps.length;j++){
                 
                  VuzeFileComponent comp = comps[j];
                 
                  int type = comp.getType();
                 
                  if ( type == VuzeFileComponent.COMP_TYPE_CONTENT_NETWORK ){
                   
                    try{
                        // change here as we always add all networks upfront so
                        // we always set the customisation flag regardless of
                        // whether existing or not
                     
                      ContentNetwork imported = importNetwork( comp.getContent());
                     
                      imported.setPersistentProperty( ContentNetwork.PP_IS_CUSTOMIZATION, true );
                     
                      comp.setProcessed();
                     
                    }catch( Throwable e ){
                     
                      log( "Failed to import customisation network", e );
                    }
                  }
                }
              }
            }finally{
             
              try{
                is.close();
               
              }catch( Throwable e ){
              }
            }
          }
        }finally{
         
          COConfigurationManager.setParameter( "cnetworks.custom.name", cust.getName());
          COConfigurationManager.setParameter( "cnetworks.custom.version", cust.getVersion());
        }
      }
    }
   
   
View Full Code Here

TOP

Related Classes of com.aelitis.azureus.core.custom.Customization

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.