| 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.gudy.azureus2.pluginsimpl.local.utils.UtilitiesImpl
public class UtilitiesImpl
| Nested Class Summary | |
|---|---|
static class | 
UtilitiesImpl.PluginLimitedRateGroup
 | 
static interface | 
UtilitiesImpl.PluginLimitedRateGroupListener
 | 
static interface | 
UtilitiesImpl.PluginSubscription
 | 
static interface | 
UtilitiesImpl.PluginSubscriptionManager
 | 
static interface | 
UtilitiesImpl.PluginSubscriptionResult
 | 
static interface | 
UtilitiesImpl.runnableWithException<T extends java.lang.Exception>
 | 
static interface | 
UtilitiesImpl.runnableWithReturn<T>
 | 
static interface | 
UtilitiesImpl.runnableWithReturnAndException<T,S extends java.lang.Exception>
 | 
static interface | 
UtilitiesImpl.searchManager
 | 
| Nested classes/interfaces inherited from interface org.gudy.azureus2.plugins.utils.Utilities | 
|---|
Utilities.JSONClient, Utilities.JSONServer | 
| Nested classes/interfaces inherited from interface org.gudy.azureus2.plugins.utils.FeatureManager | 
|---|
FeatureManager.FeatureDetails, FeatureManager.FeatureEnabler, FeatureManager.FeatureManagerListener, FeatureManager.Licence | 
| Constructor Summary | |
|---|---|
UtilitiesImpl(AzureusCore _core,
              PluginInterface _pi)
 | 
|
| Method Summary | ||
|---|---|---|
static DelayedTask | 
addDelayedTask(java.lang.String name,
               java.lang.Runnable r)
 | 
|
 FeatureManager.Licence | 
addLicence(java.lang.String licence_key)
 | 
|
 void | 
addListener(FeatureManager.FeatureManagerListener listener)
 | 
|
 void | 
addLocationProvider(LocationProvider provider)
 | 
|
 void | 
addLocationProviderListener(LocationProviderListener listener)
 | 
|
 void | 
addPowerManagementListener(PowerManagementListener listener)
 | 
|
 void | 
addScriptProviderListener(ScriptProvider.ScriptProviderListener listener)
 | 
|
static void | 
addSearchManager(UtilitiesImpl.searchManager manager)
 | 
|
 java.nio.ByteBuffer | 
allocateDirectByteBuffer(int size)
 | 
|
 PooledByteBuffer | 
allocatePooledByteBuffer(byte[] data)
 | 
|
 PooledByteBuffer | 
allocatePooledByteBuffer(int length)
 | 
|
 PooledByteBuffer | 
allocatePooledByteBuffer(java.util.Map map)
 | 
|
static void | 
callWithPluginThreadContext(PluginInterface pi,
                            java.lang.Runnable target)
 | 
|
static
 | 
callWithPluginThreadContext(PluginInterface pi,
                            UtilitiesImpl.runnableWithException<T> target)
 | 
|
static
 | 
callWithPluginThreadContext(PluginInterface pi,
                            UtilitiesImpl.runnableWithReturn<T> target)
 | 
|
static
 | 
callWithPluginThreadContext(PluginInterface pi,
                            UtilitiesImpl.runnableWithReturnAndException<T,S> target)
 | 
|
 int | 
compareVersions(java.lang.String v1,
                java.lang.String v2)
Compares two version strings for order.  | 
|
 AggregatedDispatcher | 
createAggregatedDispatcher(long idle_dispatch_time,
                           long max_queue_size)
create a dispatcher that will queue runnable items until either the limit is reached or the dispatcher hasn't had an entry added for the defined idle time  | 
|
 AggregatedList | 
createAggregatedList(AggregatedListAcceptor acceptor,
                     long idle_dispatch_time,
                     long max_queue_size)
 | 
|
 DelayedTask | 
createDelayedTask(java.lang.Runnable target)
Adds a low priority task that will be scheduled at some point after existing tasks have completed.  | 
|
 FeatureManager.Licence[] | 
createLicences(java.lang.String[] feature_ids)
 | 
|
 void | 
createProcess(java.lang.String command_line)
create a child process and executes the supplied command line.  | 
|
 void | 
createThread(java.lang.String name,
             java.lang.Runnable target)
create and run a thread for the target.  | 
|
 UTTimer | 
createTimer(java.lang.String name)
Creates a UTTimer instance. | 
|
 UTTimer | 
createTimer(java.lang.String name,
            boolean lightweight)
Creates a UTTimer instance. | 
|
 UTTimer | 
createTimer(java.lang.String name,
            int priority)
Creates a UTTimer instance. | 
|
 ByteArrayWrapper | 
createWrapper(byte[] data)
 | 
|
 void | 
deleteResilientBEncodedFile(java.io.File parent_dir,
                            java.lang.String file_name,
                            boolean use_backup)
 | 
|
 void | 
freeDirectByteBuffer(java.nio.ByteBuffer buffer)
 | 
|
 java.lang.String | 
getAzureusProgramDir()
 | 
|
 java.lang.String | 
getAzureusUserDir()
 | 
|
 long | 
getCurrentSystemTime()
Get the current system time, like System.currentTimeMillis(), only the time lookup is cached for performance reasons.  | 
|
 java.util.List<DistributedDatabase> | 
getDistributedDatabases(java.lang.String[] networks)
 | 
|
 java.util.List<DistributedDatabase> | 
getDistributedDatabases(java.lang.String[] networks,
                        java.util.Map<java.lang.String,java.lang.Object> options)
 | 
|
 FeatureManager.FeatureDetails[] | 
getFeatureDetails(java.lang.String feature_id)
 | 
|
 FeatureManager | 
getFeatureManager()
 | 
|
static java.util.Set<java.lang.String> | 
getFeaturesInstalled()
 | 
|
 Formatters | 
getFormatters()
 | 
|
 java.io.InputStream | 
getImageAsStream(java.lang.String image_name)
 | 
|
 FeatureManager.Licence[] | 
getLicences()
 | 
|
 LocaleUtilities | 
getLocaleUtilities()
 | 
|
 java.util.List<LocationProvider> | 
getLocationProviders()
 | 
|
 Monitor | 
getMonitor()
 | 
|
static PluginInterface | 
getPluginThreadContext()
 | 
|
 java.net.InetAddress | 
getPublicAddress()
Returns a public IP address of the machine or null if it can't be determined  | 
|
 java.net.InetAddress | 
getPublicAddress(boolean v6)
 | 
|
 ResourceDownloaderFactory | 
getResourceDownloaderFactory()
 | 
|
 ResourceUploaderFactory | 
getResourceUploaderFactory()
 | 
|
 RSSFeed | 
getRSSFeed(java.io.InputStream is)
 | 
|
 RSSFeed | 
getRSSFeed(ResourceDownloader feed_location)
 | 
|
 RSSFeed | 
getRSSFeed(java.net.URL feed_location)
 | 
|
 RSSFeed | 
getRSSFeed(java.net.URL source_url,
           java.io.InputStream is)
 | 
|
 RSSFeed | 
getRSSFeed(java.net.URL source_url,
           ResourceDownloader feed_location)
 | 
|
 java.util.List<ScriptProvider> | 
getScriptProviders()
 | 
|
 SearchInitiator | 
getSearchInitiator()
 | 
|
 SESecurityManager | 
getSecurityManager()
 | 
|
 Semaphore | 
getSemaphore()
 | 
|
 SimpleXMLParserDocumentFactory | 
getSimpleXMLParserDocumentFactory()
 | 
|
 SubscriptionManager | 
getSubscriptionManager()
 | 
|
 TagManager | 
getTagManager()
 | 
|
 boolean | 
isCVSVersion()
 | 
|
 boolean | 
isFeatureInstalled(java.lang.String feature_id)
 | 
|
 boolean | 
isFreeBSD()
 | 
|
 boolean | 
isLinux()
 | 
|
 boolean | 
isOSX()
 | 
|
 boolean | 
isSolaris()
 | 
|
 boolean | 
isUnix()
 | 
|
 boolean | 
isWindows()
 | 
|
 Tag | 
lookupTag(java.lang.String name)
 | 
|
 java.lang.String | 
normaliseFileName(java.lang.String f_name)
Converts a file name so that all characters in the file name are compatible with the underlying filesystem.  | 
|
 java.util.Map | 
readResilientBEncodedFile(java.io.File parent_dir,
                          java.lang.String file_name,
                          boolean use_backup)
 | 
|
 void | 
refreshLicences()
 | 
|
 void | 
registerFeatureEnabler(FeatureManager.FeatureEnabler enabler)
 | 
|
 void | 
registerJSONRPCClient(Utilities.JSONClient client)
 | 
|
 void | 
registerJSONRPCServer(Utilities.JSONServer server)
 | 
|
 void | 
registerScriptProvider(ScriptProvider provider)
 | 
|
 void | 
registerSearchProvider(SearchProvider provider)
 | 
|
 void | 
removeListener(FeatureManager.FeatureManagerListener listener)
 | 
|
 void | 
removeLocationProvider(LocationProvider provider)
 | 
|
 void | 
removeLocationProviderListener(LocationProviderListener listener)
 | 
|
 void | 
removePowerManagementListener(PowerManagementListener listener)
 | 
|
 void | 
removeScriptProviderListener(ScriptProvider.ScriptProviderListener listener)
 | 
|
 java.lang.String | 
reverseDNSLookup(java.net.InetAddress address)
attempts a reverse DNS lookup of an address, null if it fails  | 
|
 boolean | 
supportsPowerStateControl(int state)
 | 
|
 void | 
unregisterFeatureEnabler(FeatureManager.FeatureEnabler enabler)
 | 
|
 void | 
unregisterJSONRPCClient(Utilities.JSONClient client)
 | 
|
 void | 
unregisterJSONRPCServer(Utilities.JSONServer server)
 | 
|
 void | 
unregisterScriptProvider(ScriptProvider provider)
 | 
|
 void | 
unregisterSearchProvider(SearchProvider provider)
 | 
|
static RateLimiter | 
unwrapLmiter(UtilitiesImpl.PluginLimitedRateGroup l)
 | 
|
static UtilitiesImpl.PluginLimitedRateGroup | 
wrapLimiter(RateLimiter limiter,
            boolean disable_disable)
 | 
|
 void | 
writeResilientBEncodedFile(java.io.File parent_dir,
                           java.lang.String file_name,
                           java.util.Map data,
                           boolean use_backup)
 | 
|
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public UtilitiesImpl(AzureusCore _core,
                     PluginInterface _pi)
| Method Detail | 
|---|
public static UtilitiesImpl.PluginLimitedRateGroup wrapLimiter(RateLimiter limiter,
                                                               boolean disable_disable)
public static RateLimiter unwrapLmiter(UtilitiesImpl.PluginLimitedRateGroup l)
public static java.util.Set<java.lang.String> getFeaturesInstalled()
public java.lang.String getAzureusUserDir()
getAzureusUserDir in interface Utilitiespublic java.lang.String getAzureusProgramDir()
getAzureusProgramDir in interface Utilitiespublic boolean isWindows()
isWindows in interface Utilitiespublic boolean isLinux()
isLinux in interface Utilitiespublic boolean isUnix()
isUnix in interface Utilitiespublic boolean isFreeBSD()
isFreeBSD in interface Utilitiespublic boolean isSolaris()
isSolaris in interface Utilitiespublic boolean isOSX()
isOSX in interface Utilitiespublic boolean isCVSVersion()
isCVSVersion in interface Utilitiespublic java.io.InputStream getImageAsStream(java.lang.String image_name)
getImageAsStream in interface Utilitiespublic Semaphore getSemaphore()
getSemaphore in interface Utilitiespublic Monitor getMonitor()
getMonitor in interface Utilitiespublic java.nio.ByteBuffer allocateDirectByteBuffer(int size)
allocateDirectByteBuffer in interface Utilitiespublic void freeDirectByteBuffer(java.nio.ByteBuffer buffer)
freeDirectByteBuffer in interface Utilitiespublic PooledByteBuffer allocatePooledByteBuffer(int length)
allocatePooledByteBuffer in interface Utilitiespublic PooledByteBuffer allocatePooledByteBuffer(byte[] data)
allocatePooledByteBuffer in interface Utilities
public PooledByteBuffer allocatePooledByteBuffer(java.util.Map map)
                                          throws java.io.IOException
allocatePooledByteBuffer in interface Utilitiesmap - must be b-encodable
java.io.IOExceptionpublic Formatters getFormatters()
getFormatters in interface Utilitiespublic LocaleUtilities getLocaleUtilities()
getLocaleUtilities in interface Utilitiespublic UTTimer createTimer(java.lang.String name)
UtilitiesUTTimer instance. It will be configured for non-lightweight
 tasks by default.
createTimer in interface Utilitiesname - Name for the UTTimer object.
public UTTimer createTimer(java.lang.String name,
                           boolean lightweight)
UtilitiesUTTimer instance.
createTimer in interface Utilitiesname - Name for the UTTimer object.lightweight - If true, it indicates that this timer will be used to
   perform small lightweight tasks. If false, it indicates that
   this timer will be used to perform expensive tasks. This allows Azureus to create
   the appropriate amount of resources to manage this timer.
public UTTimer createTimer(java.lang.String name,
                           int priority)
UtilitiesUTTimer instance.
createTimer in interface Utilitiesname - Name for the UTTimer object.priority - The Thread.XXX_PRIORITY value to use.
public void createThread(java.lang.String name,
                         java.lang.Runnable target)
Utilities
createThread in interface Utilities
public void createProcess(java.lang.String command_line)
                   throws PluginException
Utilities
createProcess in interface UtilitiesPluginExceptionpublic ResourceDownloaderFactory getResourceDownloaderFactory()
getResourceDownloaderFactory in interface Utilitiespublic ResourceUploaderFactory getResourceUploaderFactory()
getResourceUploaderFactory in interface Utilitiespublic SESecurityManager getSecurityManager()
getSecurityManager in interface Utilitiespublic SimpleXMLParserDocumentFactory getSimpleXMLParserDocumentFactory()
getSimpleXMLParserDocumentFactory in interface Utilities
public RSSFeed getRSSFeed(java.io.InputStream is)
                   throws SimpleXMLParserDocumentException
getRSSFeed in interface UtilitiesSimpleXMLParserDocumentException
public RSSFeed getRSSFeed(java.net.URL source_url,
                          java.io.InputStream is)
                   throws SimpleXMLParserDocumentException
getRSSFeed in interface UtilitiesSimpleXMLParserDocumentException
public RSSFeed getRSSFeed(java.net.URL feed_location)
                   throws ResourceDownloaderException,
                          SimpleXMLParserDocumentException
getRSSFeed in interface UtilitiesResourceDownloaderException
SimpleXMLParserDocumentException
public RSSFeed getRSSFeed(ResourceDownloader feed_location)
                   throws ResourceDownloaderException,
                          SimpleXMLParserDocumentException
getRSSFeed in interface UtilitiesResourceDownloaderException
SimpleXMLParserDocumentException
public RSSFeed getRSSFeed(java.net.URL source_url,
                          ResourceDownloader feed_location)
                   throws ResourceDownloaderException,
                          SimpleXMLParserDocumentException
getRSSFeed in interface UtilitiesResourceDownloaderException
SimpleXMLParserDocumentExceptionpublic java.net.InetAddress getPublicAddress(boolean v6)
getPublicAddress in interface Utilitiespublic java.net.InetAddress getPublicAddress()
Utilities
getPublicAddress in interface Utilitiespublic java.lang.String reverseDNSLookup(java.net.InetAddress address)
Utilities
reverseDNSLookup in interface Utilitiespublic long getCurrentSystemTime()
Utilities
getCurrentSystemTime in interface Utilitiespublic ByteArrayWrapper createWrapper(byte[] data)
createWrapper in interface Utilities
public AggregatedDispatcher createAggregatedDispatcher(long idle_dispatch_time,
                                                       long max_queue_size)
Utilities
createAggregatedDispatcher in interface Utilitiesidle_dispatch_time - millisecondsmax_queue_size - 0 -> infinite
public AggregatedList createAggregatedList(AggregatedListAcceptor acceptor,
                                           long idle_dispatch_time,
                                           long max_queue_size)
createAggregatedList in interface Utilities
public static final void callWithPluginThreadContext(PluginInterface pi,
                                                     java.lang.Runnable target)
public static final <T extends java.lang.Exception> void callWithPluginThreadContext(PluginInterface pi,
                                                                                     UtilitiesImpl.runnableWithException<T> target)
                                              throws T extends java.lang.Exception
T extends java.lang.Exception
public static final <T> T callWithPluginThreadContext(PluginInterface pi,
                                                      UtilitiesImpl.runnableWithReturn<T> target)
public static final <T,S extends java.lang.Exception> T callWithPluginThreadContext(PluginInterface pi,
                                                                                    UtilitiesImpl.runnableWithReturnAndException<T,S> target)
                                           throws S extends java.lang.Exception
S extends java.lang.Exceptionpublic static PluginInterface getPluginThreadContext()
public java.util.Map readResilientBEncodedFile(java.io.File parent_dir,
                                               java.lang.String file_name,
                                               boolean use_backup)
readResilientBEncodedFile in interface Utilities
public void writeResilientBEncodedFile(java.io.File parent_dir,
                                       java.lang.String file_name,
                                       java.util.Map data,
                                       boolean use_backup)
writeResilientBEncodedFile in interface Utilities
public void deleteResilientBEncodedFile(java.io.File parent_dir,
                                        java.lang.String file_name,
                                        boolean use_backup)
deleteResilientBEncodedFile in interface Utilities
public int compareVersions(java.lang.String v1,
                           java.lang.String v2)
UtilitiesExample:
 compareVersions("1.1.0.0", "1.1.2.0"); // -
 compareVersions("1.1.0.0", "1.1.0"); // 0
 compareVersions("1.1.1.1", "1.1.1"); // +
 
compareVersions in interface Utilitiesv1 - the first version string to be comparedv2 - the second version string to be compared
public java.lang.String normaliseFileName(java.lang.String f_name)
UtilitiesNote - this is only intended for file names, rather than file paths.
normaliseFileName in interface Utilitiesf_name - File name to convert.
public DelayedTask createDelayedTask(java.lang.Runnable target)
Utilities
createDelayedTask in interface Utilities
public static DelayedTask addDelayedTask(java.lang.String name,
                                         java.lang.Runnable r)
public void registerSearchProvider(SearchProvider provider)
                            throws SearchException
registerSearchProvider in interface UtilitiesSearchException
public void unregisterSearchProvider(SearchProvider provider)
                              throws SearchException
unregisterSearchProvider in interface UtilitiesSearchException
public SearchInitiator getSearchInitiator()
                                   throws SearchException
getSearchInitiator in interface UtilitiesSearchExceptionpublic static void addSearchManager(UtilitiesImpl.searchManager manager)
public FeatureManager getFeatureManager()
getFeatureManager in interface Utilities
public FeatureManager.Licence[] createLicences(java.lang.String[] feature_ids)
                                        throws PluginException
createLicences in interface FeatureManagerPluginException
public FeatureManager.Licence addLicence(java.lang.String licence_key)
                                  throws PluginException
addLicence in interface FeatureManagerPluginExceptionpublic FeatureManager.Licence[] getLicences()
getLicences in interface FeatureManagerpublic void refreshLicences()
refreshLicences in interface FeatureManagerpublic FeatureManager.FeatureDetails[] getFeatureDetails(java.lang.String feature_id)
getFeatureDetails in interface FeatureManagerpublic boolean isFeatureInstalled(java.lang.String feature_id)
isFeatureInstalled in interface FeatureManagerpublic void addListener(FeatureManager.FeatureManagerListener listener)
addListener in interface FeatureManagerpublic void removeListener(FeatureManager.FeatureManagerListener listener)
removeListener in interface FeatureManagerpublic void registerFeatureEnabler(FeatureManager.FeatureEnabler enabler)
registerFeatureEnabler in interface FeatureManagerpublic void unregisterFeatureEnabler(FeatureManager.FeatureEnabler enabler)
unregisterFeatureEnabler in interface FeatureManager
public SubscriptionManager getSubscriptionManager()
                                           throws SubscriptionException
getSubscriptionManager in interface UtilitiesSubscriptionExceptionpublic boolean supportsPowerStateControl(int state)
supportsPowerStateControl in interface Utilitiespublic void addPowerManagementListener(PowerManagementListener listener)
addPowerManagementListener in interface Utilitiespublic void removePowerManagementListener(PowerManagementListener listener)
removePowerManagementListener in interface Utilitiespublic java.util.List<LocationProvider> getLocationProviders()
getLocationProviders in interface Utilitiespublic void addLocationProvider(LocationProvider provider)
addLocationProvider in interface Utilitiespublic void removeLocationProvider(LocationProvider provider)
removeLocationProvider in interface Utilitiespublic void addLocationProviderListener(LocationProviderListener listener)
addLocationProviderListener in interface Utilitiespublic void removeLocationProviderListener(LocationProviderListener listener)
removeLocationProviderListener in interface Utilitiespublic java.util.List<ScriptProvider> getScriptProviders()
getScriptProviders in interface Utilitiespublic void registerScriptProvider(ScriptProvider provider)
registerScriptProvider in interface Utilitiespublic void unregisterScriptProvider(ScriptProvider provider)
unregisterScriptProvider in interface Utilitiespublic void addScriptProviderListener(ScriptProvider.ScriptProviderListener listener)
addScriptProviderListener in interface Utilitiespublic void removeScriptProviderListener(ScriptProvider.ScriptProviderListener listener)
removeScriptProviderListener in interface Utilitiespublic Tag lookupTag(java.lang.String name)
lookupTag in interface Utilitiespublic java.util.List<DistributedDatabase> getDistributedDatabases(java.lang.String[] networks)
getDistributedDatabases in interface Utilities
public java.util.List<DistributedDatabase> getDistributedDatabases(java.lang.String[] networks,
                                                                   java.util.Map<java.lang.String,java.lang.Object> options)
getDistributedDatabases in interface Utilitiespublic void registerJSONRPCServer(Utilities.JSONServer server)
registerJSONRPCServer in interface Utilitiespublic void unregisterJSONRPCServer(Utilities.JSONServer server)
unregisterJSONRPCServer in interface Utilitiespublic void registerJSONRPCClient(Utilities.JSONClient client)
registerJSONRPCClient in interface Utilitiespublic void unregisterJSONRPCClient(Utilities.JSONClient client)
unregisterJSONRPCClient in interface Utilitiespublic TagManager getTagManager()
getTagManager in interface Utilities
  | 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||