Methods Summary |
---|
public void | addListener(UpdateManagerListener l)
listeners.add(l);
|
public void | addVerificationListener(UpdateManagerVerificationListener l)
verification_listeners.add( l );
|
public void | applyUpdates(boolean restart_after)
try{
if ( restart_after ){
azureus_core.requestRestart();
}else{
azureus_core.requestStop();
}
}catch( Throwable e ){
throw( new UpdateException( "UpdateManager:applyUpdates fails", e ));
}
|
public UpdateCheckInstance | createEmptyUpdateCheckInstance(int type, java.lang.String name)
try{
this_mon.enter();
UpdatableComponentImpl[] comps = new UpdatableComponentImpl[0];
UpdateCheckInstance res = new UpdateCheckInstanceImpl( this, type, name, comps );
for (int i=0;i<listeners.size();i++){
((UpdateManagerListener)listeners.get(i)).checkInstanceCreated( res );
}
return( res );
}finally{
this_mon.exit();
}
|
public UpdateInstaller | createInstaller()
UpdateInstaller installer = new UpdateInstallerImpl( this );
installers.add( installer );
return( installer );
|
public UpdateCheckInstance | createUpdateCheckInstance()
return( createUpdateCheckInstance( UpdateCheckInstance.UCI_UPDATE, "" ));
|
public UpdateCheckInstance | createUpdateCheckInstance(int type, java.lang.String name)
try{
this_mon.enter();
UpdatableComponentImpl[] comps = new UpdatableComponentImpl[components.size()];
components.toArray( comps );
UpdateCheckInstance res = new UpdateCheckInstanceImpl( this, type, name, comps );
for (int i=0;i<listeners.size();i++){
((UpdateManagerListener)listeners.get(i)).checkInstanceCreated( res );
}
return( res );
}finally{
this_mon.exit();
}
|
public java.lang.String | getInstallDir()
String str = SystemProperties.getApplicationPath();
if ( str.endsWith(File.separator)){
str = str.substring(0,str.length()-1);
}
return( str );
|
public UpdateInstaller[] | getInstallers()
UpdateInstaller[] res = new UpdateInstaller[installers.size()];
installers.toArray( res );
return( res );
|
public static UpdateManager | getSingleton(com.aelitis.azureus.core.AzureusCore core)
if ( singleton == null ){
singleton = new UpdateManagerImpl( core );
}
return( singleton );
|
public java.lang.String | getUserDir()
String str = SystemProperties.getUserPath();
if ( str.endsWith(File.separator)){
str = str.substring(0,str.length()-1);
}
return( str );
|
public void | registerUpdatableComponent(UpdatableComponent component, boolean mandatory)
try{
this_mon.enter();
components.add( new UpdatableComponentImpl( component, mandatory ));
}finally{
this_mon.exit();
}
|
public void | removeListener(UpdateManagerListener l)
listeners.remove(l);
|
public void | removeVerificationListener(UpdateManagerVerificationListener l)
verification_listeners.add( l );
|
public void | restart()
applyUpdates( true );
|
public java.io.InputStream | verifyData(Update update, java.io.InputStream is, boolean force)
boolean queried = false;
boolean ok = false;
Throwable failure = null;
try{
File temp = AETemporaryFileHandler.createTempFile();
FileUtil.copyFile( is, temp );
try{
AEVerifier.verifyData( temp );
ok = true;
return( new FileInputStream( temp ));
}catch( AEVerifierException e ){
if ( (!force) && e.getFailureType() == AEVerifierException.FT_SIGNATURE_MISSING ){
for (int i=0;i<verification_listeners.size();i++){
try{
queried = true;
if ( ((UpdateManagerVerificationListener)verification_listeners.get(i)).acceptUnVerifiedUpdate(
update )){
ok = true;
return( new FileInputStream( temp ));
}
}catch( Throwable f ){
Debug.printStackTrace(f);
}
}
}
failure = e;
throw( e );
}
}catch( UpdateException e ){
failure = e;
throw( e );
}catch( Throwable e ){
failure = e;
throw( new UpdateException( "Verification failed", e ));
}finally{
if ( !( queried || ok )){
if ( failure == null ){
failure = new UpdateException( "Verification failed" );
}
for (int i=0;i<verification_listeners.size();i++){
try{
((UpdateManagerVerificationListener)verification_listeners.get(i)).verificationFailed( update, failure );
}catch( Throwable f ){
Debug.printStackTrace(f);
}
}
}
}
|