1 /* 2 * Created on 13-Jul-2004 3 * Created by Paul Gardner 4 * Copyright (C) Azureus Software, Inc, All Rights Reserved. 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version 2 9 * of the License, or (at your option) any later version. 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 * 18 */ 19 20 package org.gudy.azureus2.pluginsimpl.local; 21 22 /** 23 * @author parg 24 * 25 */ 26 27 import java.util.*; 28 29 import org.gudy.azureus2.core3.util.SystemProperties; 30 import org.gudy.azureus2.plugins.*; 31 import org.gudy.azureus2.pluginsimpl.local.launch.PluginSingleInstanceHandler; 32 33 public class 34 PluginManagerDefaultsImpl 35 implements PluginManagerDefaults 36 { 37 protected static PluginManagerDefaultsImpl singleton = new PluginManagerDefaultsImpl(); 38 39 public static PluginManagerDefaults getSingleton()40 getSingleton() 41 { 42 return( singleton ); 43 } 44 45 protected List disabled = new ArrayList(); 46 47 public String[] getDefaultPlugins()48 getDefaultPlugins() 49 { 50 return( PLUGIN_IDS ); 51 } 52 53 public void setDefaultPluginEnabled( String plugin_id, boolean enabled )54 setDefaultPluginEnabled( 55 String plugin_id, 56 boolean enabled ) 57 { 58 if ( enabled ){ 59 60 disabled.remove( plugin_id ); 61 62 }else if ( !disabled.contains( plugin_id )){ 63 64 disabled.add( plugin_id ); 65 } 66 } 67 68 public boolean isDefaultPluginEnabled( String plugin_id )69 isDefaultPluginEnabled( 70 String plugin_id ) 71 { 72 return( !disabled.contains( plugin_id)); 73 } 74 75 public void setApplicationName( String name )76 setApplicationName( 77 String name ) 78 { 79 SystemProperties.setApplicationName( name ); 80 } 81 82 public String getApplicationName()83 getApplicationName() 84 { 85 return( SystemProperties.getApplicationName()); 86 } 87 88 public void setApplicationIdentifier( String id )89 setApplicationIdentifier( 90 String id ) 91 { 92 SystemProperties.setApplicationIdentifier( id ); 93 } 94 95 public String getApplicationIdentifier()96 getApplicationIdentifier() 97 { 98 return( SystemProperties.getApplicationIdentifier()); 99 } 100 101 public void setApplicationEntryPoint( String ep )102 setApplicationEntryPoint( 103 String ep ) 104 { 105 SystemProperties.setApplicationEntryPoint( ep ); 106 } 107 108 public String getApplicationEntryPoint()109 getApplicationEntryPoint() 110 { 111 return( SystemProperties.getApplicationEntryPoint()); 112 } 113 114 public void setSingleInstanceHandler( int single_instance_port, PluginManagerArgumentHandler handler )115 setSingleInstanceHandler( 116 int single_instance_port, 117 PluginManagerArgumentHandler handler ) 118 { 119 PluginSingleInstanceHandler.initialise( single_instance_port, handler ); 120 } 121 122 public boolean setSingleInstanceHandlerAndProcess( int single_instance_port, PluginManagerArgumentHandler handler, String[] args )123 setSingleInstanceHandlerAndProcess( 124 int single_instance_port, 125 PluginManagerArgumentHandler handler, 126 String[] args ) 127 { 128 PluginSingleInstanceHandler.initialise( single_instance_port, handler ); 129 130 return( PluginSingleInstanceHandler.initialiseAndProcess( single_instance_port, handler, args )); 131 } 132 } 133