1 /* 2 * File : PluginConfig.java 3 * Created : 17 nov. 2003 4 * By : Olivier 5 * 6 * Azureus - a Java Bittorrent client 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 2 of the License, or 11 * (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details ( see the LICENSE file ). 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 */ 22 23 package org.gudy.azureus2.plugins; 24 25 /** 26 * @author Olivier 27 * 28 */ 29 30 import java.io.File; 31 import java.net.NetworkInterface; 32 import java.util.List; 33 import java.util.Map; 34 35 import org.gudy.azureus2.plugins.config.*; 36 37 /** 38 * This class provides a way for a plugin to get and set configuration settings - both for the plugin 39 * itself and for core settings as well. 40 * 41 * <p> 42 * 43 * This class interface contains four different variations of <tt>get</tt> and <tt>set</tt> parameter methods: 44 * <ul> 45 * <li>get<i>type</i>Parameter</li> 46 * <li>getCore<i>type</i>Parameter</li> 47 * <li>getUnsafe<i>type</i>Parameter</li> 48 * <li>getPlugin<i>type</i>Parameter</li> 49 * </ul> 50 * 51 * The first set of methods are deprecated and should not be used in general - this is because the method names were 52 * ambiguous and it wasn't always obvious what data you were trying to get or set. 53 * <p> 54 * The second set of methods do what the first set of methods were primarily intended for - you can use these 55 * methods to get or set some core parameters. You should use the parameter names defined as constants in this interface 56 * (the ones labelled <tt>CORE_PARAM</tt>). These parameters will be properly supported by Azureus, even if the way these 57 * values are stored or handled differently in the Azureus core itself.<br /> 58 * <br> 59 * Attempting to set or get parameters not mentioned here should raise an error (in some cases in the past, this wasn't 60 * always enforced by the first set of methods. 61 * <p> 62 * The third set of methods allow you to modify configuration settings which are stored directly inside Azureus. These 63 * settings may change (without warning) between versions, so there is no guarantee that plugins that use these values 64 * will behave properly in different versions of Azureus. 65 * <p> 66 * The last set of methods are used to store and retrieve data intended exclusively for the use of the plugin itself, 67 * which is what you will be using most of the time. 68 */ 69 public interface 70 PluginConfig 71 { 72 public static final String CORE_PARAM_INT_MAX_UPLOAD_SPEED_KBYTES_PER_SEC = "Max Upload Speed KBs"; 73 public static final String CORE_PARAM_INT_MAX_UPLOAD_SPEED_SEEDING_KBYTES_PER_SEC = "Max Upload Speed When Only Seeding KBs"; 74 public static final String CORE_PARAM_INT_MAX_DOWNLOAD_SPEED_KBYTES_PER_SEC = "Max Download Speed KBs"; 75 public static final String CORE_PARAM_INT_MAX_CONNECTIONS_PER_TORRENT = "Max Connections Per Torrent"; 76 public static final String CORE_PARAM_INT_MAX_CONNECTIONS_GLOBAL = "Max Connections Global"; 77 public static final String CORE_PARAM_INT_MAX_DOWNLOADS = "Max Downloads"; 78 public static final String CORE_PARAM_INT_MAX_ACTIVE = "Max Active Torrents"; 79 public static final String CORE_PARAM_INT_MAX_ACTIVE_SEEDING = "Max Active Torrents When Only Seeding"; 80 public static final String CORE_PARAM_INT_MAX_UPLOADS = "Max Uploads"; 81 public static final String CORE_PARAM_INT_MAX_UPLOADS_SEEDING = "Max Uploads Seeding"; 82 public static final String CORE_PARAM_BOOLEAN_AUTO_SPEED_ON = "Auto Upload Speed Enabled"; 83 public static final String CORE_PARAM_BOOLEAN_AUTO_SPEED_SEEDING_ON = "Auto Upload Speed Seeding Enabled"; 84 public static final String CORE_PARAM_BOOLEAN_MAX_UPLOAD_SPEED_SEEDING = "Max Upload Speed When Only Seeding Enabled"; 85 public static final String CORE_PARAM_BOOLEAN_MAX_ACTIVE_SEEDING = "Max Active Torrents When Only Seeding Enabled"; 86 public static final String CORE_PARAM_BOOLEAN_SOCKS_PROXY_NO_INWARD_CONNECTION = "SOCKS Proxy No Inward Connection"; 87 public static final String CORE_PARAM_BOOLEAN_NEW_SEEDS_START_AT_TOP = "Newly Seeding Torrents Get First Priority"; 88 89 /** 90 * Semicolon seperated list containing: 91 * IP<br> 92 * {@link NetworkInterface} name (ex. eth10) <br> 93 * NetworkInterface name with IP index in square brackets (ex. eth6[0]) 94 * 95 * @since 2.3.0.5 96 */ 97 public static final String CORE_PARAM_STRING_LOCAL_BIND_IP = "CORE_PARAM_STRING_LOCAL_BIND_IP"; 98 public static final String CORE_PARAM_BOOLEAN_FRIENDLY_HASH_CHECKING = "CORE_PARAM_BOOLEAN_FRIENDLY_HASH_CHECKING"; 99 100 /** 101 * @since 3.0.4.3 102 */ 103 public static final String GUI_PARAM_INT_SWT_REFRESH_IN_MS = "GUI_PARAM_INT_SWT_REFRESH_IN_MS"; 104 105 /** 106 * @since 3.0.4.3 107 */ 108 public static final String CORE_PARAM_BOOLEAN_NEW_TORRENTS_START_AS_STOPPED = "CORE_PARAM_BOOLEAN_NEW_TORRENTS_START_AS_STOPPED"; 109 110 /** 111 * @since 3.0.5.3 112 */ 113 public static final String CORE_PARAM_INT_INCOMING_TCP_PORT = "Incoming TCP Port"; 114 115 /** 116 * @since 3.0.5.3 117 */ 118 public static final String CORE_PARAM_INT_INCOMING_UDP_PORT = "Incoming UDP Port"; 119 120 /** 121 * @since 3.1.1.1 122 */ 123 public static final String CORE_PARAM_STRING_DEFAULT_SAVE_PATH = "Default save path"; 124 125 126 /** 127 * Returns the value of a core boolean parameter. 128 * 129 * @param key The parameter name. 130 * @return The value of the parameter. 131 * 132 * @deprecated Use {@link #getUnsafeBooleanParameter(String)} for internal core parameters, or {@link #getCoreBooleanParameter(String)} for core parameters defined here. 133 * @since 2.0.4.2 134 */ getBooleanParameter(String key)135 public boolean getBooleanParameter(String key); 136 137 /** 138 * Returns the value of a core boolean parameter. 139 * 140 * @param key The parameter name. 141 * @param default_value The default value to return if one is not defined. 142 * @return The value of the parameter. 143 * 144 * @deprecated Use {@link #getUnsafeBooleanParameter(String, boolean)} for internal core parameters, or {@link #getCoreBooleanParameter(String, boolean)} for core parameters defined here. 145 * @since 2.0.6.0 146 */ getBooleanParameter(String key, boolean default_value)147 public boolean getBooleanParameter(String key, boolean default_value); 148 149 /** 150 * Returns the value of a core byte array parameter. 151 * 152 * @param key The parameter name. 153 * @return The value of the parameter. 154 * 155 * @deprecated Use {@link #getUnsafeByteParameter(String)} for internal core parameters, or {@link #getCoreByteParameter(String)} for core parameters defined here. 156 * @since 3.0.0.7 157 */ getByteParameter(String key)158 public byte[] getByteParameter(String key); 159 160 /** 161 * Returns the value of a core byte array parameter. 162 * 163 * @param key The parameter name. 164 * @param default_value The default value to return if one is not defined. 165 * @return The value of the parameter. 166 * 167 * @deprecated Use {@link #getUnsafeByteParameter(String, byte[])} for internal core parameters, or {@link #getCoreByteParameter(String, byte[])} for core parameters defined here. 168 * @since 2.1.0.2 169 */ getByteParameter(String key, byte[] default_value)170 public byte[] getByteParameter(String key, byte[] default_value); 171 172 /** 173 * Returns the value of a core float parameter. 174 * 175 * @param key The parameter name. 176 * @return The value of the parameter. 177 * 178 * @deprecated Use {@link #getUnsafeFloatParameter(String)} for internal core parameters, or {@link #getCoreFloatParameter(String)} for core parameters defined here. 179 * @since 2.1.0.0 180 */ getFloatParameter(String key)181 public float getFloatParameter(String key); 182 183 /** 184 * Returns the value of a core float parameter. 185 * 186 * @param key The parameter name. 187 * @param default_value The default value to return if one is not defined. 188 * @return The value of the parameter. 189 * 190 * @deprecated Use {@link #getUnsafeFloatParameter(String, float)} for internal core parameters, or {@link #getCoreFloatParameter(String, float)} for core parameters defined here. 191 * @since 3.0.0.7 192 */ getFloatParameter(String key, float default_value)193 public float getFloatParameter(String key, float default_value); 194 195 /** 196 * Returns the value of a core int parameter. 197 * 198 * @param key The parameter name. 199 * @return The value of the parameter. 200 * 201 * @deprecated Use {@link #getUnsafeIntParameter(String)} for internal core parameters, or {@link #getCoreIntParameter(String)} for core parameters defined here. 202 * @since 2.0.4.2 203 */ getIntParameter(String key)204 public int getIntParameter(String key); 205 206 /** 207 * Returns the value of a core int parameter. 208 * 209 * @param key The parameter name. 210 * @param default_value The default value to return if one is not defined. 211 * @return The value of the parameter. 212 * 213 * @deprecated Use {@link #getUnsafeIntParameter(String, int)} for internal core parameters, or {@link #getCoreIntParameter(String, int)} for core parameters defined here. 214 * @since 2.0.7.0 215 */ getIntParameter(String key, int default_value)216 public int getIntParameter(String key, int default_value); 217 218 /** 219 * Returns the value of a core long parameter. 220 * 221 * @param key The parameter name. 222 * @return The value of the parameter. 223 * 224 * @deprecated Use {@link #getUnsafeLongParameter(String)} for internal core parameters, or {@link #getCoreLongParameter(String)} for core parameters defined here. 225 * @since 3.0.0.7 226 */ getLongParameter(String key)227 public long getLongParameter(String key); 228 229 /** 230 * Returns the value of a core long parameter. 231 * 232 * @param key The parameter name. 233 * @param default_value The default value to return if one is not defined. 234 * @return The value of the parameter. 235 * 236 * @deprecated Use {@link #getUnsafeLongParameter(String, long)} for internal core parameters, or {@link #getCoreLongParameter(String, long)} for core parameters defined here. 237 * @since 3.0.0.7 238 */ getLongParameter(String key, long default_value)239 public long getLongParameter(String key, long default_value); 240 241 /** 242 * Returns the value of a core string parameter. 243 * 244 * @param key The parameter name. 245 * @return The value of the parameter. 246 * 247 * @deprecated Use {@link #getUnsafeStringParameter(String)} for internal core parameters, or {@link #getCoreStringParameter(String)} for core parameters defined here. 248 * @since 2.0.4.2 249 */ getStringParameter(String key)250 public String getStringParameter(String key); 251 252 /** 253 * Returns the value of a core string parameter. 254 * 255 * @param key The parameter name. 256 * @param default_value The default value to return if one is not defined. 257 * @return The value of the parameter. 258 * 259 * @deprecated Use {@link #getUnsafeStringParameter(String, String)} for internal core parameters, or {@link #getCoreStringParameter(String, String)} for core parameters defined here. 260 * @since 2.1.0.0 261 */ getStringParameter(String key, String default_value)262 public String getStringParameter(String key, String default_value); 263 264 /** 265 * Sets the value of a core boolean parameter. 266 * 267 * @param key The parameter name, which must be one defined from the above core constants. 268 * @param value The new value for the parameter. 269 * 270 * @deprecated Use {@link #setUnsafeBooleanParameter(String, boolean)} for internal core parameters, or {@link #setCoreBooleanParameter(String, boolean)} for core parameters defined here. 271 */ setBooleanParameter(String key, boolean value)272 public void setBooleanParameter(String key, boolean value); 273 274 /** 275 * Sets the value of a core byte array parameter. 276 * 277 * @param key The parameter name, which must be one defined from the above core constants. 278 * @param value The new value for the parameter. 279 * 280 * @deprecated Use {@link #setUnsafeByteParameter(String, byte[])} for internal core parameters, or {@link #setCoreByteParameter(String, byte[])} for core parameters defined here. 281 * @since 3.0.0.7 282 */ setByteParameter(String key, byte[] value)283 public void setByteParameter(String key, byte[] value); 284 285 286 /** 287 * Sets the value of a core float parameter. 288 * 289 * @param key The parameter name, which must be one defined from the above core constants. 290 * @param value The new value for the parameter. 291 * 292 * @deprecated Use {@link #setUnsafeFloatParameter(String, float)} for internal core parameters, or {@link #setCoreFloatParameter(String, float)} for core parameters defined here. 293 * @since 3.0.0.7 294 */ setFloatParameter(String key, float value)295 public void setFloatParameter(String key, float value); 296 297 /** 298 * Sets the value of a core int parameter. 299 * 300 * @param key The parameter name, which must be one defined from the above core constants. 301 * @param value The new value for the parameter. 302 * 303 * @deprecated Use {@link #setUnsafeIntParameter(String, int)} for internal core parameters, or {@link #setCoreIntParameter(String, int)} for core parameters defined here. 304 * @since 2.0.8.0 305 */ setIntParameter(String key, int value)306 public void setIntParameter(String key, int value); 307 308 /** 309 * Sets the value of a core long parameter. 310 * 311 * @param key The parameter name, which must be one defined from the above core constants. 312 * @param value The new value for the parameter. 313 * 314 * @deprecated Use {@link #setUnsafeLongParameter(String, long)} for internal core parameters, or {@link #setCoreLongParameter(String, long)} for core parameters defined here. 315 * @since 3.0.0.7 316 */ setLongParameter(String key, long value)317 public void setLongParameter(String key, long value); 318 319 /** 320 * Sets the value of a core string parameter. 321 * 322 * @param key The parameter name, which must be one defined from the above core constants. 323 * @param value The new value for the parameter. 324 * 325 * @deprecated Use {@link #setUnsafeStringParameter(String, String)} for internal core parameters, or {@link #setCoreStringParameter(String, String)} for core parameters defined here. 326 * @since 3.0.0.7 327 */ setStringParameter(String key, String value)328 public void setStringParameter(String key, String value); 329 330 /** 331 * Returns the value of a core boolean parameter. 332 * 333 * @param key The parameter name. 334 * @return The value of the parameter. 335 * 336 * @since 3.0.4.3 337 */ getCoreBooleanParameter(String key)338 public boolean getCoreBooleanParameter(String key); 339 340 /** 341 * Returns the value of a core boolean parameter. 342 * 343 * @param key The parameter name. 344 * @param default_value The default value to return if one is not defined. 345 * @return The value of the parameter. 346 * 347 * @since 3.0.4.3 348 */ getCoreBooleanParameter(String key, boolean default_value)349 public boolean getCoreBooleanParameter(String key, boolean default_value); 350 351 /** 352 * Returns the value of a core byte array parameter. 353 * 354 * @param key The parameter name. 355 * @return The value of the parameter. 356 * 357 * @since 3.0.4.3 358 */ getCoreByteParameter(String key)359 public byte[] getCoreByteParameter(String key); 360 361 /** 362 * Returns the value of a core byte array parameter. 363 * 364 * @param key The parameter name. 365 * @param default_value The default value to return if one is not defined. 366 * @return The value of the parameter. 367 * 368 * @since 3.0.5.3 369 */ getCoreByteParameter(String key, byte[] default_value)370 public byte[] getCoreByteParameter(String key, byte[] default_value); 371 372 /** 373 * Returns the value of a core color parameter. 374 * 375 * <p> 376 * 377 * It will return <tt>null</tt> if no color parameter is stored, or an 378 * integer array of size 4 representing the red, green and blue values, 379 * and a flag indicating if the color is an override of the default or 380 * not (<tt>0</tt> indicates no override, <tt>1</tt> means it is overridden). 381 * 382 * <p> 383 * 384 * In many cases, the override flag can just be ignored. 385 * 386 * @param key The parameter name. 387 * @return The value of the parameter. 388 * 389 * @since 3.0.5.3 390 */ getCoreColorParameter(String key)391 public int[] getCoreColorParameter(String key); 392 393 /** 394 * Returns the value of a core color parameter. 395 * 396 * <p> 397 * 398 * It will return <tt>null</tt> if no color parameter is stored, or an 399 * integer array of size 4 representing the red, green and blue values, 400 * and a flag indicating if the color is an override of the default or 401 * not (<tt>0</tt> indicates no override, <tt>1</tt> means it is overridden). 402 * 403 * <p> 404 * 405 * In many cases, the override flag can just be ignored. 406 * 407 * @param key The parameter name. 408 * @param default_value The default value to return if one is not defined. 409 * @return The value of the parameter. 410 * 411 * @since 3.0.5.3 412 */ getCoreColorParameter(String key, int[] default_value)413 public int[] getCoreColorParameter(String key, int[] default_value); 414 415 /** 416 * Returns the value of a core float parameter. 417 * 418 * @param key The parameter name. 419 * @return The value of the parameter. 420 * 421 * @since 3.0.4.3 422 */ getCoreFloatParameter(String key)423 public float getCoreFloatParameter(String key); 424 425 /** 426 * Returns the value of a core float parameter. 427 * 428 * @param key The parameter name. 429 * @param default_value The default value to return if one is not defined. 430 * @return The value of the parameter. 431 * 432 * @since 3.0.4.3 433 */ getCoreFloatParameter(String key, float default_value)434 public float getCoreFloatParameter(String key, float default_value); 435 436 /** 437 * Returns the value of a core int parameter. 438 * 439 * @param key The parameter name. 440 * @return The value of the parameter. 441 * 442 * @since 3.0.4.3 443 */ getCoreIntParameter(String key)444 public int getCoreIntParameter(String key); 445 446 /** 447 * Returns the value of a core int parameter. 448 * 449 * @param key The parameter name. 450 * @param default_value The default value to return if one is not defined. 451 * @return The value of the parameter. 452 * 453 * @since 3.0.4.3 454 */ getCoreIntParameter(String key, int default_value)455 public int getCoreIntParameter(String key, int default_value); 456 457 /** 458 * Returns the value of a core long parameter. 459 * 460 * @param key The parameter name. 461 * @return The value of the parameter. 462 * 463 * @since 3.0.4.3 464 */ getCoreLongParameter(String key)465 public long getCoreLongParameter(String key); 466 467 /** 468 * Returns the value of a core long parameter. 469 * 470 * @param key The parameter name. 471 * @param default_value The default value to return if one is not defined. 472 * @return The value of the parameter. 473 * 474 * @since 3.0.4.3 475 */ getCoreLongParameter(String key, long default_value)476 public long getCoreLongParameter(String key, long default_value); 477 478 /** 479 * Returns the value of a core string parameter. 480 * 481 * @param key The parameter name. 482 * @return The value of the parameter. 483 * 484 * @since 3.0.4.3 485 */ getCoreStringParameter(String key)486 public String getCoreStringParameter(String key); 487 488 /** 489 * Returns the value of a core string parameter. 490 * 491 * @param key The parameter name. 492 * @param default_value The default value to return if one is not defined. 493 * @return The value of the parameter. 494 * 495 * @since 3.0.4.3 496 */ getCoreStringParameter(String key, String default_value)497 public String getCoreStringParameter(String key, String default_value); 498 499 /** 500 * Sets the value of a core boolean parameter. 501 * 502 * @param key The parameter name, which must be one defined from the above core constants. 503 * @param value The new value for the parameter. 504 * 505 * @since 3.0.4.2 506 */ setCoreBooleanParameter(String key, boolean value)507 public void setCoreBooleanParameter(String key, boolean value); 508 509 /** 510 * Sets the value of a core byte array parameter. 511 * 512 * @param key The parameter name, which must be one defined from the above core constants. 513 * @param value The new value for the parameter. 514 * 515 * @since 3.0.4.2 516 */ setCoreByteParameter(String key, byte[] value)517 public void setCoreByteParameter(String key, byte[] value); 518 519 /** 520 * Sets the value of a core byte array parameter. 521 * 522 * <p> 523 * 524 * The value should be an integer array of size 3 representing 525 * the red, green and blue values - or <tt>null</tt> to disable it. 526 * 527 * @param key The parameter name, which must be one defined from the above core constants. 528 * @param value The new value for the parameter. 529 * 530 * @since 3.0.5.3 531 */ setCoreColorParameter(String key, int[] value)532 public void setCoreColorParameter(String key, int[] value); 533 534 /** 535 * Sets the value of a core byte array parameter. 536 * 537 * <p> 538 * 539 * The value should be an integer array of size 3 representing 540 * the red, green and blue values - or <tt>null</tt> to disable it. 541 * 542 * <p> 543 * 544 * The override flag is used to indicate if the value being set is overriding 545 * the default value. This is mainly used for interface purposes. 546 * 547 * @param key The parameter name, which must be one defined from the above core constants. 548 * @param value The new value for the parameter. 549 * @param override <tt>true</tt> if the value is overridden from the default. 550 * 551 * @since 3.0.5.3 552 */ setCoreColorParameter(String key, int[] value, boolean override)553 public void setCoreColorParameter(String key, int[] value, boolean override); 554 555 556 /** 557 * Sets the value of a core float parameter. 558 * 559 * @param key The parameter name, which must be one defined from the above core constants. 560 * @param value The new value for the parameter. 561 * 562 * @since 3.0.4.2 563 */ setCoreFloatParameter(String key, float value)564 public void setCoreFloatParameter(String key, float value); 565 566 /** 567 * Sets the value of a core int parameter. 568 * 569 * @param key The parameter name, which must be one defined from the above core constants. 570 * @param value The new value for the parameter. 571 * 572 * @since 3.0.4.2 573 */ setCoreIntParameter(String key, int value)574 public void setCoreIntParameter(String key, int value); 575 576 /** 577 * Sets the value of a core long parameter. 578 * 579 * @param key The parameter name, which must be one defined from the above core constants. 580 * @param value The new value for the parameter. 581 * 582 * @since 3.0.4.2 583 */ setCoreLongParameter(String key, long value)584 public void setCoreLongParameter(String key, long value); 585 586 /** 587 * Sets the value of a core string parameter. 588 * 589 * @param key The parameter name, which must be one defined from the above core constants. 590 * @param value The new value for the parameter. 591 * 592 * @since 3.0.4.2 593 */ setCoreStringParameter(String key, String value)594 public void setCoreStringParameter(String key, String value); 595 596 597 /** 598 * Returns the value of a plugin boolean parameter. 599 * 600 * @param key The parameter name. 601 * @return The value of the parameter. 602 * 603 * @since 2.0.4.2 604 */ getPluginBooleanParameter(String key)605 public boolean getPluginBooleanParameter(String key); 606 607 /** 608 * Returns the value of a plugin boolean parameter. 609 * 610 * @param key The parameter name. 611 * @param default_value The default value to return if one is not defined. 612 * @return The value of the parameter. 613 * 614 * @since 2.0.4.2 615 */ getPluginBooleanParameter(String key, boolean default_value)616 public boolean getPluginBooleanParameter(String key, boolean default_value); 617 618 /** 619 * Returns the value of a plugin byte array parameter. 620 * 621 * @param key The parameter name. 622 * @return The value of the parameter. 623 * 624 * @since 3.0.0.7 625 */ getPluginByteParameter(String key)626 public byte[] getPluginByteParameter(String key); 627 628 /** 629 * Returns the value of a plugin byte array parameter. 630 * 631 * @param key The parameter name. 632 * @param default_value The default value to return if one is not defined. 633 * @return The value of the parameter. 634 * 635 * @since 2.2.0.3 636 */ getPluginByteParameter(String key, byte[] default_value)637 public byte[] getPluginByteParameter(String key, byte[] default_value); 638 639 /** 640 * Returns the value of a plugin color parameter. 641 * 642 * <p> 643 * 644 * It will return <tt>null</tt> if no color parameter is stored, or an 645 * integer array of size 4 representing the red, green and blue values, 646 * and a flag indicating if the color is an override of the default or 647 * not (<tt>0</tt> indicates no override, <tt>1</tt> means it is overridden). 648 * 649 * <p> 650 * 651 * In many cases, the override flag can just be ignored. 652 * 653 * @param key The parameter name. 654 * @return The value of the parameter. 655 * 656 * @since 3.0.5.3 657 */ getPluginColorParameter(String key)658 public int[] getPluginColorParameter(String key); 659 660 /** 661 * Returns the value of a plugin color parameter. 662 * 663 * <p> 664 * 665 * It will return <tt>null</tt> if no color parameter is stored, or an 666 * integer array of size 4 representing the red, green and blue values, 667 * and a flag indicating if the color is an override of the default or 668 * not (<tt>0</tt> indicates no override, <tt>1</tt> means it is overridden). 669 * 670 * <p> 671 * 672 * In many cases, the override flag can just be ignored. 673 * 674 * @param key The parameter name. 675 * @param default_value The default value to return if one is not defined. 676 * @return The value of the parameter. 677 * 678 * @since 3.0.5.3 679 */ getPluginColorParameter(String key, int[] default_value)680 public int[] getPluginColorParameter(String key, int[] default_value); 681 682 683 /** 684 * Returns the value of a plugin float parameter. 685 * 686 * @param key The parameter name. 687 * @return The value of the parameter. 688 * 689 * @since 3.0.0.7 690 */ getPluginFloatParameter(String key)691 public float getPluginFloatParameter(String key); 692 693 /** 694 * Returns the value of a plugin float parameter. 695 * 696 * @param key The parameter name. 697 * @param default_value The default value to return if one is not defined. 698 * @return The value of the parameter. 699 * 700 * @since 3.0.0.7 701 */ getPluginFloatParameter(String key, float default_value)702 public float getPluginFloatParameter(String key, float default_value); 703 704 /** 705 * Returns the value of a plugin int parameter. 706 * 707 * @param key The parameter name. 708 * @return The value of the parameter. 709 * 710 * @since 2.0.4.2 711 */ getPluginIntParameter(String key)712 public int getPluginIntParameter(String key); 713 714 /** 715 * Returns the value of a plugin int parameter. 716 * 717 * @param key The parameter name. 718 * @param default_value The default value to return if one is not defined. 719 * @return The value of the parameter. 720 * 721 * @since 2.0.4.2 722 */ getPluginIntParameter(String key, int default_value)723 public int getPluginIntParameter(String key, int default_value); 724 725 /** 726 * Returns the value of a plugin list parameter. The contents of the list must conform 727 * to <i>bencodable</i> rules (e.g. <tt>Map</tt>, <tt>Long</tt>, <tt>byte[]</tt>, <tt>List</tt>) 728 * 729 * @param key The parameter name. 730 * @param default_value The default value to return if one is not defined. 731 * @return The value of the parameter. 732 * 733 * @since 2.3.0.1 734 */ getPluginListParameter(String key, List default_value)735 public List getPluginListParameter(String key, List default_value); 736 737 /** 738 * Returns the value of a plugin long parameter. 739 * 740 * @param key The parameter name. 741 * @return The value of the parameter. 742 * 743 * @since 3.0.0.7 744 */ getPluginLongParameter(String key)745 public long getPluginLongParameter(String key); 746 747 /** 748 * Returns the value of a plugin long parameter. 749 * 750 * @param key The parameter name. 751 * @param default_value The default value to return if one is not defined. 752 * @return The value of the parameter. 753 * 754 * @since 3.0.0.7 755 */ getPluginLongParameter(String key, long default_value)756 public long getPluginLongParameter(String key, long default_value); 757 758 /** 759 * Returns the value of a plugin map parameter. The contents of the map must conform 760 * to <i>bencodable</i> rules (e.g. <tt>Map</tt>, <tt>Long</tt>, <tt>byte[]</tt>, <tt>List</tt>) 761 * 762 * @param key The parameter name. 763 * @param default_value The default value to return if one is not defined. 764 * @return The value of the parameter. 765 * 766 * @since 2.3.0.1 767 */ getPluginMapParameter(String key, Map default_value)768 public Map getPluginMapParameter(String key, Map default_value); 769 770 771 /** 772 * Returns the value of a plugin string parameter. 773 * 774 * @param key The parameter name. 775 * @return The value of the parameter. 776 * 777 * @since 2.0.4.2 778 */ getPluginStringParameter(String key)779 public String getPluginStringParameter(String key); 780 781 /** 782 * Returns the value of a plugin string parameter. 783 * 784 * @param key The parameter name. 785 * @param default_value The default value to return if one is not defined. 786 * @return The value of the parameter. 787 * 788 * @since 2.0.4.2 789 */ getPluginStringParameter(String key, String default_value)790 public String getPluginStringParameter(String key, String default_value); 791 792 /** 793 * Returns the value of a plugin string-list parameter. If no value is set, 794 * an empty string array will be returned. 795 * 796 * @param key The parameter name. 797 * @return The value of the parameter. 798 * @since 3.0.5.3 799 */ getPluginStringListParameter(String key)800 public String[] getPluginStringListParameter(String key); 801 802 /** 803 * Sets the value of a plugin boolean parameter. 804 * 805 * @param key The parameter name. 806 * @param value The new value for the parameter. 807 * 808 * @since 2.0.4.2 809 */ setPluginParameter(String key, boolean value)810 public void setPluginParameter(String key, boolean value); 811 812 /** 813 * Sets the value of a plugin byte array parameter. 814 * 815 * @param key The parameter name. 816 * @param value The new value for the parameter. 817 * 818 * @since 2.1.0.2 819 */ setPluginParameter(String key, byte[] value)820 public void setPluginParameter(String key, byte[] value); 821 822 823 /** 824 * Sets the value of a plugin float parameter. 825 * 826 * @param key The parameter name. 827 * @param value The new value for the parameter. 828 * 829 * @since 3.0.0.7 830 */ setPluginParameter(String key, float value)831 public void setPluginParameter(String key, float value); 832 833 /** 834 * Sets the value of a plugin int parameter. 835 * 836 * @param key The parameter name. 837 * @param value The new value for the parameter. 838 * 839 * @since 2.0.4.2 840 */ setPluginParameter(String key, int value)841 public void setPluginParameter(String key, int value); 842 843 /** 844 * Sets the value of a plugin int parameter. 845 * 846 * @param key The parameter name. 847 * @param value The new value for the parameter. 848 * @param global Whether or not this parameter should be made externally accessible. 849 * 850 * @since 2.5.0.1 851 */ setPluginParameter(String key, int value, boolean global)852 public void setPluginParameter(String key, int value, boolean global); 853 854 855 /** 856 * Sets the value of a plugin long parameter. 857 * 858 * @param key The parameter name. 859 * @param value The new value for the parameter. 860 * 861 * @since 3.0.0.7 862 */ setPluginParameter(String key, long value)863 public void setPluginParameter(String key, long value); 864 865 /** 866 * Sets the value of a plugin string parameter. 867 * 868 * @param key The parameter name. 869 * @param value The new value for the parameter. 870 * 871 * @since 2.0.4.2 872 */ setPluginParameter(String key, String value)873 public void setPluginParameter(String key, String value); 874 875 /** 876 * Sets the value of a plugin string-list parameter. 877 * 878 * @param key The parameter name. 879 * @param value The new value of the parameter. 880 * @since 3.0.5.3 881 */ setPluginStringListParameter(String key, String[] value)882 public void setPluginStringListParameter(String key, String[] value); 883 884 /** 885 * Sets the value of a plugin color parameter. 886 * 887 * <p> 888 * 889 * The value should be an integer array of size 3 representing 890 * the red, green and blue values - or <tt>null</tt> to disable it. 891 * 892 * @param key The parameter name. 893 * @param value The new value for the parameter. 894 * @return The value of the parameter. 895 * 896 * @since 3.0.5.3 897 */ setPluginColorParameter(String key, int[] value)898 public void setPluginColorParameter(String key, int[] value); 899 900 /** 901 * Sets the value of a plugin color parameter. 902 * 903 * <p> 904 * 905 * The value should be an integer array of size 3 representing 906 * the red, green and blue values - or <tt>null</tt> to disable it. 907 * 908 * <p> 909 * 910 * The override flag is used to indicate if the value being set is overriding 911 * the default value. This is mainly used for interface purposes. 912 * 913 * @param key The parameter name. 914 * @param value The new value for the parameter. 915 * @param override <tt>true</tt> if the value is overridden from the default. 916 * @return The value of the parameter. 917 * 918 * @since 3.0.5.3 919 */ setPluginColorParameter(String key, int[] value, boolean override)920 public void setPluginColorParameter(String key, int[] value, boolean override); 921 922 923 /** 924 * Sets the value of a plugin list parameter. The contents of the list must conform 925 * to <i>bencodable</i> rules (e.g. <tt>Map</tt>, <tt>Long</tt>, <tt>byte[]</tt>, <tt>List</tt>) 926 * 927 * @param key The parameter name. 928 * @param value The new value for the parameter. 929 * 930 * @since 2.3.0.1 931 */ setPluginListParameter(String key, List value)932 public void setPluginListParameter(String key, List value); 933 934 /** 935 * Sets the value of a plugin map parameter. The contents of the map must conform 936 * to <i>bencodable</i> rules (e.g. <tt>Map</tt>, <tt>Long</tt>, <tt>byte[]</tt>, <tt>List</tt>) 937 * 938 * @param key The parameter name. 939 * @param value The new value for the parameter. 940 * 941 * @since 2.3.0.1 942 */ setPluginMapParameter(String key, Map value)943 public void setPluginMapParameter(String key, Map value); 944 945 /** 946 * Returns the value of a core boolean parameter. Note: the semantics of this 947 * method will not be guaranteed - core parameter names may change in the future, 948 * and this method will not do any parameter name mapping for you, so take care when 949 * using this method. 950 * 951 * @param key The parameter name. 952 * @param default_value The default value to return if one is not defined. 953 * @return The value of the parameter. 954 * 955 * @since 3.0.0.7 956 */ getUnsafeBooleanParameter(String key)957 public boolean getUnsafeBooleanParameter(String key); 958 959 /** 960 * Returns the value of a core boolean parameter. Note: the semantics of this 961 * method will not be guaranteed - core parameter names may change in the future, 962 * and this method will not do any parameter name mapping for you, so take care when 963 * using this method. 964 * 965 * @param key The parameter name. 966 * @param default_value The default value to return if one is not defined. 967 * @return The value of the parameter. 968 * 969 * @since 3.0.0.5 970 */ getUnsafeBooleanParameter(String key, boolean default_value)971 public boolean getUnsafeBooleanParameter(String key, boolean default_value); 972 973 /** 974 * Returns the value of a core byte array parameter. Note: the semantics of this 975 * method will not be guaranteed - core parameter names may change in the future, 976 * and this method will not do any parameter name mapping for you, so take care when 977 * using this method. 978 * 979 * @param key The parameter name. 980 * @return The value of the parameter. 981 * 982 * @since 3.0.0.7 983 */ getUnsafeByteParameter(String key)984 public byte[] getUnsafeByteParameter(String key); 985 986 /** 987 * Returns the value of a core byte array parameter. Note: the semantics of this 988 * method will not be guaranteed - core parameter names may change in the future, 989 * and this method will not do any parameter name mapping for you, so take care when 990 * using this method. 991 * 992 * @param key The parameter name. 993 * @param default_value The default value to return if one is not defined. 994 * @return The value of the parameter. 995 * 996 * @since 3.0.0.7 997 */ getUnsafeByteParameter(String key, byte[] default_value)998 public byte[] getUnsafeByteParameter(String key, byte[] default_value); 999 1000 /** 1001 * Returns the value of a core color parameter. Note: the semantics of this 1002 * method will not be guaranteed - core parameter names may change in the future, 1003 * and this method will not do any parameter name mapping for you, so take care when 1004 * using this method. 1005 * 1006 * <p> 1007 * 1008 * It will return <tt>null</tt> if no color parameter is stored, or an 1009 * integer array of size 4 representing the red, green and blue values, 1010 * and a flag indicating if the color is an override of the default or 1011 * not (<tt>0</tt> indicates no override, <tt>1</tt> means it is overridden). 1012 * 1013 * <p> 1014 * 1015 * In many cases, the override flag can just be ignored. 1016 * 1017 * @param key The parameter name. 1018 * @return The value of the parameter. 1019 * 1020 * @since 3.0.5.3 1021 */ getUnsafeColorParameter(String key)1022 public int[] getUnsafeColorParameter(String key); 1023 1024 /** 1025 * Returns the value of a core color parameter. Note: the semantics of this 1026 * method will not be guaranteed - core parameter names may change in the future, 1027 * and this method will not do any parameter name mapping for you, so take care when 1028 * using this method. 1029 * 1030 * <p> 1031 * 1032 * It will return <tt>null</tt> if no color parameter is stored, or an 1033 * integer array of size 4 representing the red, green and blue values, 1034 * and a flag indicating if the color is an override of the default or 1035 * not (<tt>0</tt> indicates no override, <tt>1</tt> means it is overridden). 1036 * 1037 * <p> 1038 * 1039 * In many cases, the override flag can just be ignored. 1040 * 1041 * @param key The parameter name. 1042 * @param default_value The default value to return if one is not defined. 1043 * @return The value of the parameter. 1044 * 1045 * @since 3.0.5.3 1046 */ getUnsafeColorParameter(String key, int[] default_value)1047 public int[] getUnsafeColorParameter(String key, int[] default_value); 1048 1049 /** 1050 * Returns the value of a core float parameter. Note: the semantics of this 1051 * method will not be guaranteed - core parameter names may change in the future, 1052 * and this method will not do any parameter name mapping for you, so take care when 1053 * using this method. 1054 * 1055 * @param key The parameter name. 1056 * @return The value of the parameter. 1057 * 1058 * @since 3.0.0.7 1059 */ getUnsafeFloatParameter(String key)1060 public float getUnsafeFloatParameter(String key); 1061 1062 /** 1063 * Returns the value of a core float parameter. Note: the semantics of this 1064 * method will not be guaranteed - core parameter names may change in the future, 1065 * and this method will not do any parameter name mapping for you, so take care when 1066 * using this method. 1067 * 1068 * @param key The parameter name. 1069 * @param default_value The default value to return if one is not defined. 1070 * @return The value of the parameter. 1071 * 1072 * @since 3.0.0.5 1073 */ getUnsafeFloatParameter(String key, float default_value)1074 public float getUnsafeFloatParameter(String key, float default_value); 1075 1076 /** 1077 * Returns the value of a core int parameter. Note: the semantics of this 1078 * method will not be guaranteed - core parameter names may change in the future, 1079 * and this method will not do any parameter name mapping for you, so take care when 1080 * using this method. 1081 * 1082 * @param key The parameter name. 1083 * @return The value of the parameter. 1084 * 1085 * @since 3.0.0.7 1086 */ getUnsafeIntParameter(String key)1087 public int getUnsafeIntParameter(String key); 1088 1089 /** 1090 * Returns the value of a core int parameter. Note: the semantics of this 1091 * method will not be guaranteed - core parameter names may change in the future, 1092 * and this method will not do any parameter name mapping for you, so take care when 1093 * using this method. 1094 * 1095 * @param key The parameter name. 1096 * @param default_value The default value to return if one is not defined. 1097 * @return The value of the parameter. 1098 * 1099 * @since 3.0.0.5 1100 */ getUnsafeIntParameter(String key, int default_value)1101 public int getUnsafeIntParameter(String key, int default_value); 1102 1103 /** 1104 * Returns the value of a core long parameter. Note: the semantics of this 1105 * method will not be guaranteed - core parameter names may change in the future, 1106 * and this method will not do any parameter name mapping for you, so take care when 1107 * using this method. 1108 * 1109 * @param key The parameter name. 1110 * @return The value of the parameter. 1111 * 1112 * @since 3.0.0.7 1113 */ getUnsafeLongParameter(String key)1114 public long getUnsafeLongParameter(String key); 1115 1116 /** 1117 * Returns the value of a core long parameter. Note: the semantics of this 1118 * method will not be guaranteed - core parameter names may change in the future, 1119 * and this method will not do any parameter name mapping for you, so take care when 1120 * using this method. 1121 * 1122 * @param key The parameter name. 1123 * @param default_value The default value to return if one is not defined. 1124 * @return The value of the parameter. 1125 * 1126 * @since 3.0.0.5 1127 */ getUnsafeLongParameter(String key, long default_value)1128 public long getUnsafeLongParameter(String key, long default_value); 1129 1130 /** 1131 * Returns the value of a core string parameter. Note: the semantics of this 1132 * method will not be guaranteed - core parameter names may change in the future, 1133 * and this method will not do any parameter name mapping for you, so take care when 1134 * using this method. 1135 * 1136 * @param key The parameter name. 1137 * @return The value of the parameter. 1138 * 1139 * @since 3.0.0.7 1140 */ getUnsafeStringParameter(String key)1141 public String getUnsafeStringParameter(String key); 1142 1143 /** 1144 * Returns the value of a core string parameter. Note: the semantics of this 1145 * method will not be guaranteed - core parameter names may change in the future, 1146 * and this method will not do any parameter name mapping for you, so take care when 1147 * using this method. 1148 * 1149 * @param key The parameter name. 1150 * @param default_value The default value to return if one is not defined. 1151 * @return The value of the parameter. 1152 * 1153 * @since 3.0.0.5 1154 */ getUnsafeStringParameter(String key, String default_value)1155 public String getUnsafeStringParameter(String key, String default_value); 1156 1157 /** 1158 * Sets the value of a core boolean parameter. Note: the semantics of this 1159 * method will not be guaranteed - core parameter names may change in the future, 1160 * and this method will not do any parameter name mapping for you, so take care when 1161 * using this method. 1162 * 1163 * @param key The parameter name, which must be one defined from the above core constants. 1164 * @param value The new value for the parameter. 1165 * 1166 * @since 3.0.0.5 1167 */ setUnsafeBooleanParameter(String key, boolean value)1168 public void setUnsafeBooleanParameter(String key, boolean value); 1169 1170 /** 1171 * Sets the value of a core byte array parameter. Note: the semantics of this 1172 * method will not be guaranteed - core parameter names may change in the future, 1173 * and this method will not do any parameter name mapping for you, so take care when 1174 * using this method. 1175 * 1176 * @param key The parameter name, which must be one defined from the above core constants. 1177 * @param value The new value for the parameter. 1178 * 1179 * @since 3.0.0.7 1180 */ setUnsafeByteParameter(String key, byte[] value)1181 public void setUnsafeByteParameter(String key, byte[] value); 1182 1183 /** 1184 * Returns the value of a core color parameter. Note: the semantics of this 1185 * method will not be guaranteed - core parameter names may change in the future, 1186 * and this method will not do any parameter name mapping for you, so take care when 1187 * using this method. 1188 * 1189 * <p> 1190 * 1191 * The value should be an integer array of size 3 representing 1192 * the red, green and blue values - or <tt>null</tt> to disable it. 1193 * 1194 * @param key The parameter name. 1195 * @param value The new value for the parameter. 1196 * 1197 * @since 3.0.5.3 1198 */ setUnsafeColorParameter(String key, int[] value)1199 public void setUnsafeColorParameter(String key, int[] value); 1200 1201 /** 1202 * Returns the value of a core color parameter. Note: the semantics of this 1203 * method will not be guaranteed - core parameter names may change in the future, 1204 * and this method will not do any parameter name mapping for you, so take care when 1205 * using this method. 1206 * 1207 * <p> 1208 * 1209 * The value should be an integer array of size 3 representing 1210 * the red, green and blue values - or <tt>null</tt> to disable it. 1211 * 1212 * <p> 1213 * 1214 * The override flag is used to indicate if the value being set is overriding 1215 * the default value. This is mainly used for interface purposes. 1216 * 1217 * @param key The parameter name. 1218 * @param value The default value to return if one is not defined. 1219 * @param override <tt>true</tt> if the value is overridden from the default. 1220 * 1221 * @since 3.0.5.3 1222 */ setUnsafeColorParameter(String key, int[] value, boolean override)1223 public void setUnsafeColorParameter(String key, int[] value, boolean override); 1224 1225 /** 1226 * Sets the value of a core float parameter. Note: the semantics of this 1227 * method will not be guaranteed - core parameter names may change in the future, 1228 * and this method will not do any parameter name mapping for you, so take care when 1229 * using this method. 1230 * 1231 * @param key The parameter name, which must be one defined from the above core constants. 1232 * @param value The new value for the parameter. 1233 * 1234 * @since 3.0.0.5 1235 */ setUnsafeFloatParameter(String key, float value)1236 public void setUnsafeFloatParameter(String key, float value); 1237 1238 /** 1239 * Sets the value of a core int parameter. Note: the semantics of this 1240 * method will not be guaranteed - core parameter names may change in the future, 1241 * and this method will not do any parameter name mapping for you, so take care when 1242 * using this method. 1243 * 1244 * @param key The parameter name, which must be one defined from the above core constants. 1245 * @param value The new value for the parameter. 1246 * 1247 * @since 3.0.0.5 1248 */ setUnsafeIntParameter(String key, int value)1249 public void setUnsafeIntParameter(String key, int value); 1250 1251 /** 1252 * Sets the value of a core long parameter. Note: the semantics of this 1253 * method will not be guaranteed - core parameter names may change in the future, 1254 * and this method will not do any parameter name mapping for you, so take care when 1255 * using this method. 1256 * 1257 * @param key The parameter name, which must be one defined from the above core constants. 1258 * @param value The new value for the parameter. 1259 * 1260 * @since 3.0.0.5 1261 */ setUnsafeLongParameter(String key, long value)1262 public void setUnsafeLongParameter(String key, long value); 1263 1264 /** 1265 * Sets the value of a core string parameter. Note: the semantics of this 1266 * method will not be guaranteed - core parameter names may change in the future, 1267 * and this method will not do any parameter name mapping for you, so take care when 1268 * using this method. 1269 * 1270 * @param key The parameter name, which must be one defined from the above core constants. 1271 * @param value The new value for the parameter. 1272 * 1273 * @since 3.0.0.5 1274 */ setUnsafeStringParameter(String key, String value)1275 public void setUnsafeStringParameter(String key, String value); 1276 1277 /** 1278 * Removes the plugin parameter with the given name. 1279 * 1280 * @param key Name of the parameter. 1281 * @return <tt>true</tt> if the parameter was found and removed. 1282 */ removePluginParameter(String key)1283 public boolean removePluginParameter(String key); 1284 1285 /** 1286 * Removes the plugin color parameter with the given name. 1287 * 1288 * @param key Name of the parameter. 1289 * @return <tt>true</tt> if the parameter was found and removed. 1290 * 1291 * @since 3.0.5.3 1292 */ removePluginColorParameter(String key)1293 public boolean removePluginColorParameter(String key); 1294 1295 /** 1296 * @return the prefix used when storing configuration values in the config file for 1297 * this plugin's config parameters 1298 * 1299 * @since 2.1.0.0 1300 */ 1301 1302 public String getPluginConfigKeyPrefix()1303 getPluginConfigKeyPrefix(); 1304 1305 public ConfigParameter getParameter( String key )1306 getParameter( 1307 String key ); 1308 1309 public ConfigParameter getPluginParameter( String key )1310 getPluginParameter( 1311 String key ); 1312 1313 public boolean isNewInstall()1314 isNewInstall(); 1315 1316 1317 1318 /** 1319 * Returns a map<String,Object> giving parameter names -> parameter values. Value can be Long or String 1320 * as the type is actually not known by the core (might fix one day). Therefore, float values are actually 1321 * represented by their String format: 1322 * 1323 * boolean - Long 0 or 1 1324 * int - Long.intValue 1325 * float - String value 1326 * String - String 1327 * 1328 * Unsafe methods - existence/semantics of parameters not guaranteed to be maintained across versions 1329 * If something changes and breaks your plugin, don't come complaining to me 1330 * @since 2.5.0.3 1331 */ 1332 1333 public Map getUnsafeParameterList()1334 getUnsafeParameterList(); 1335 1336 /** 1337 * make sure you save it after making changes! 1338 * 1339 * @since 2.0.8.0 1340 */ save()1341 public void save() throws PluginException; 1342 1343 /** 1344 * Returns a file that can be used by the plugin to save user-specific state. 1345 * <p> 1346 * 1347 * This will be <tt>azureus-user-dir/plugins/plugin-name/name</tt>. 1348 * @param name 1349 * @return 1350 */ 1351 1352 public File getPluginUserFile( String name )1353 getPluginUserFile( 1354 String name ); 1355 1356 /** 1357 * Returns true if a core parameter with the given name exists. 1358 * @param key The name of the parameter to check. 1359 * @since 2.5.0.2 1360 */ hasParameter(String param_name)1361 public boolean hasParameter(String param_name); 1362 1363 /** 1364 * Returns true if a plugin parameter with the given name exists. 1365 * @param key The name of the parameter to check. 1366 * @since 2.5.0.2 1367 */ hasPluginParameter(String param_name)1368 public boolean hasPluginParameter(String param_name); 1369 1370 public void addListener( PluginConfigListener l )1371 addListener( 1372 PluginConfigListener l ); 1373 1374 /** 1375 * @param _key 1376 * 1377 * @since 2.5.0.1 1378 */ setPluginConfigKeyPrefix(String _key)1379 public void setPluginConfigKeyPrefix(String _key); 1380 1381 /** 1382 * Enable the plugin to store configuration parameters into a separate 1383 * external configuration file. <b>Note:</b> once this method is called, 1384 * you need to invoke {@link PluginConfigSource#initialize()} for the 1385 * external configuration file to be properly integrated with Azureus. 1386 * 1387 * <p> 1388 * 1389 * When a plugin is first initialised, it should call this method as 1390 * soon as possible during the initialization stage. This then configures 1391 * the PluginConfig object to store any parameter values into an external 1392 * configuration file (rather than storing it directly with the main 1393 * configuration file used by Azureus). 1394 * 1395 * <p> 1396 * 1397 * When this method is invoked, it will return an object which allows 1398 * the filename to be chosen - it allows a limited amount of manipulation 1399 * of the configuration file. This method only needs to be invoked once. 1400 * 1401 * <p> 1402 * 1403 * All methods which get and set plugin parameters on this object will store 1404 * data in the external configuration file. The use of classes like 1405 * {@link org.gudy.azureus2.plugins.ui.model.BasicPluginConfigModel BasicPluginConfigModel} 1406 * will automatically integrate parameters to the external configuration 1407 * source. 1408 * 1409 * <p> 1410 * 1411 * However, if you use any other mechanism to store parameter data, you may need to call 1412 * the {@link org.gudy.azureus2.plugins.ui.config.PluginConfigSource#registerParameter registerParameter} 1413 * to integrate the parameter properly. 1414 * 1415 * @since 3.0.5.3 1416 * @return The <tt>PluginConfigSource</tt> object representing the external configuration file. 1417 */ enableExternalConfigSource()1418 public PluginConfigSource enableExternalConfigSource(); 1419 1420 /** 1421 * Returns the <tt>PluginConfigSource</tt> object used for this plugin configuration (or 1422 * <tt>null</tt> if an external configuration object isn't used). 1423 * 1424 * @since 3.0.5.3 1425 * @return The PluginConfigSource object. 1426 */ getPluginConfigSource()1427 public PluginConfigSource getPluginConfigSource(); 1428 1429 /** 1430 * Sets the plugin configuration source object to use for storing parameters for this 1431 * plugin config object. 1432 * 1433 * <p> 1434 * 1435 * This method should only be used as an alternative to {@link #enableExternalConfigSource()}. 1436 * You will only need to use this method if you use the 1437 * {@link PluginInterface#getLocalPluginInterface(Class, String) getLocalPluginInterface} 1438 * method to store data in a separate namespace, but want to use the same configuration file to 1439 * store data in. 1440 * 1441 * @param source The PluginConfigSource object to use. 1442 * @since 3.0.5.3 1443 */ setPluginConfigSource(PluginConfigSource source)1444 public void setPluginConfigSource(PluginConfigSource source); 1445 } 1446