|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 Utilities
public java.lang.String getAzureusProgramDir()
getAzureusProgramDir
in interface Utilities
public boolean isWindows()
isWindows
in interface Utilities
public boolean isLinux()
isLinux
in interface Utilities
public boolean isUnix()
isUnix
in interface Utilities
public boolean isFreeBSD()
isFreeBSD
in interface Utilities
public boolean isSolaris()
isSolaris
in interface Utilities
public boolean isOSX()
isOSX
in interface Utilities
public boolean isCVSVersion()
isCVSVersion
in interface Utilities
public java.io.InputStream getImageAsStream(java.lang.String image_name)
getImageAsStream
in interface Utilities
public Semaphore getSemaphore()
getSemaphore
in interface Utilities
public Monitor getMonitor()
getMonitor
in interface Utilities
public java.nio.ByteBuffer allocateDirectByteBuffer(int size)
allocateDirectByteBuffer
in interface Utilities
public void freeDirectByteBuffer(java.nio.ByteBuffer buffer)
freeDirectByteBuffer
in interface Utilities
public PooledByteBuffer allocatePooledByteBuffer(int length)
allocatePooledByteBuffer
in interface Utilities
public PooledByteBuffer allocatePooledByteBuffer(byte[] data)
allocatePooledByteBuffer
in interface Utilities
public PooledByteBuffer allocatePooledByteBuffer(java.util.Map map) throws java.io.IOException
allocatePooledByteBuffer
in interface Utilities
map
- must be b-encodable
java.io.IOException
public Formatters getFormatters()
getFormatters
in interface Utilities
public LocaleUtilities getLocaleUtilities()
getLocaleUtilities
in interface Utilities
public UTTimer createTimer(java.lang.String name)
Utilities
UTTimer
instance. It will be configured for non-lightweight
tasks by default.
createTimer
in interface Utilities
name
- Name for the UTTimer object.
public UTTimer createTimer(java.lang.String name, boolean lightweight)
Utilities
UTTimer
instance.
createTimer
in interface Utilities
name
- 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)
Utilities
UTTimer
instance.
createTimer
in interface Utilities
name
- 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 Utilities
PluginException
public ResourceDownloaderFactory getResourceDownloaderFactory()
getResourceDownloaderFactory
in interface Utilities
public ResourceUploaderFactory getResourceUploaderFactory()
getResourceUploaderFactory
in interface Utilities
public SESecurityManager getSecurityManager()
getSecurityManager
in interface Utilities
public SimpleXMLParserDocumentFactory getSimpleXMLParserDocumentFactory()
getSimpleXMLParserDocumentFactory
in interface Utilities
public RSSFeed getRSSFeed(java.io.InputStream is) throws SimpleXMLParserDocumentException
getRSSFeed
in interface Utilities
SimpleXMLParserDocumentException
public RSSFeed getRSSFeed(java.net.URL source_url, java.io.InputStream is) throws SimpleXMLParserDocumentException
getRSSFeed
in interface Utilities
SimpleXMLParserDocumentException
public RSSFeed getRSSFeed(java.net.URL feed_location) throws ResourceDownloaderException, SimpleXMLParserDocumentException
getRSSFeed
in interface Utilities
ResourceDownloaderException
SimpleXMLParserDocumentException
public RSSFeed getRSSFeed(ResourceDownloader feed_location) throws ResourceDownloaderException, SimpleXMLParserDocumentException
getRSSFeed
in interface Utilities
ResourceDownloaderException
SimpleXMLParserDocumentException
public RSSFeed getRSSFeed(java.net.URL source_url, ResourceDownloader feed_location) throws ResourceDownloaderException, SimpleXMLParserDocumentException
getRSSFeed
in interface Utilities
ResourceDownloaderException
SimpleXMLParserDocumentException
public java.net.InetAddress getPublicAddress(boolean v6)
getPublicAddress
in interface Utilities
public java.net.InetAddress getPublicAddress()
Utilities
getPublicAddress
in interface Utilities
public java.lang.String reverseDNSLookup(java.net.InetAddress address)
Utilities
reverseDNSLookup
in interface Utilities
public long getCurrentSystemTime()
Utilities
getCurrentSystemTime
in interface Utilities
public ByteArrayWrapper createWrapper(byte[] data)
createWrapper
in interface Utilities
public AggregatedDispatcher createAggregatedDispatcher(long idle_dispatch_time, long max_queue_size)
Utilities
createAggregatedDispatcher
in interface Utilities
idle_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.Exception
public 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)
Utilities
Example:
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 Utilities
v1
- the first version string to be comparedv2
- the second version string to be compared
public java.lang.String normaliseFileName(java.lang.String f_name)
Utilities
Note - this is only intended for file names, rather than file paths.
normaliseFileName
in interface Utilities
f_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 Utilities
SearchException
public void unregisterSearchProvider(SearchProvider provider) throws SearchException
unregisterSearchProvider
in interface Utilities
SearchException
public SearchInitiator getSearchInitiator() throws SearchException
getSearchInitiator
in interface Utilities
SearchException
public 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 FeatureManager
PluginException
public FeatureManager.Licence addLicence(java.lang.String licence_key) throws PluginException
addLicence
in interface FeatureManager
PluginException
public FeatureManager.Licence[] getLicences()
getLicences
in interface FeatureManager
public void refreshLicences()
refreshLicences
in interface FeatureManager
public FeatureManager.FeatureDetails[] getFeatureDetails(java.lang.String feature_id)
getFeatureDetails
in interface FeatureManager
public boolean isFeatureInstalled(java.lang.String feature_id)
isFeatureInstalled
in interface FeatureManager
public void addListener(FeatureManager.FeatureManagerListener listener)
addListener
in interface FeatureManager
public void removeListener(FeatureManager.FeatureManagerListener listener)
removeListener
in interface FeatureManager
public void registerFeatureEnabler(FeatureManager.FeatureEnabler enabler)
registerFeatureEnabler
in interface FeatureManager
public void unregisterFeatureEnabler(FeatureManager.FeatureEnabler enabler)
unregisterFeatureEnabler
in interface FeatureManager
public SubscriptionManager getSubscriptionManager() throws SubscriptionException
getSubscriptionManager
in interface Utilities
SubscriptionException
public boolean supportsPowerStateControl(int state)
supportsPowerStateControl
in interface Utilities
public void addPowerManagementListener(PowerManagementListener listener)
addPowerManagementListener
in interface Utilities
public void removePowerManagementListener(PowerManagementListener listener)
removePowerManagementListener
in interface Utilities
public java.util.List<LocationProvider> getLocationProviders()
getLocationProviders
in interface Utilities
public void addLocationProvider(LocationProvider provider)
addLocationProvider
in interface Utilities
public void removeLocationProvider(LocationProvider provider)
removeLocationProvider
in interface Utilities
public void addLocationProviderListener(LocationProviderListener listener)
addLocationProviderListener
in interface Utilities
public void removeLocationProviderListener(LocationProviderListener listener)
removeLocationProviderListener
in interface Utilities
public java.util.List<ScriptProvider> getScriptProviders()
getScriptProviders
in interface Utilities
public void registerScriptProvider(ScriptProvider provider)
registerScriptProvider
in interface Utilities
public void unregisterScriptProvider(ScriptProvider provider)
unregisterScriptProvider
in interface Utilities
public void addScriptProviderListener(ScriptProvider.ScriptProviderListener listener)
addScriptProviderListener
in interface Utilities
public void removeScriptProviderListener(ScriptProvider.ScriptProviderListener listener)
removeScriptProviderListener
in interface Utilities
public Tag lookupTag(java.lang.String name)
lookupTag
in interface Utilities
public 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 Utilities
public void registerJSONRPCServer(Utilities.JSONServer server)
registerJSONRPCServer
in interface Utilities
public void unregisterJSONRPCServer(Utilities.JSONServer server)
unregisterJSONRPCServer
in interface Utilities
public void registerJSONRPCClient(Utilities.JSONClient client)
registerJSONRPCClient
in interface Utilities
public void unregisterJSONRPCClient(Utilities.JSONClient client)
unregisterJSONRPCClient
in interface Utilities
public TagManager getTagManager()
getTagManager
in interface Utilities
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |