|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.rational.rpe.common.utils.URLDataProvider
public class URLDataProvider
This class is a utility class for accessing remote resources. When instantiated, the URL and credentials of the Central Management component specified automatically for users in the preferences. Users can replace the values by using setter methods. This class includes common functions to set up a connection
Constructor Summary | |
---|---|
URLDataProvider()
WARNING: For use during RRDG document generations. |
Method Summary | |
---|---|
long |
addRequestTime(long time)
Registers the time spent for a data request outside of this instance |
java.lang.String |
cacheResource(java.lang.String url,
Credential credential)
Returns the path to a cached copy of the resource identified by the URL with the default connection parameters. |
java.lang.String |
cacheResource(java.lang.String url,
Credential credential,
ConnectionArguments connectionArgs)
Returns the path to a cached copy of the resource referred by the URL with ConnectionArguments ConnectionArguments . |
void |
cleanup()
Clears all cached data. |
static java.io.InputStream |
doNone(java.lang.String url,
ConnectionArguments connectionArgs)
Downloads the content from the specified URL in the given path with the provided connection arguments |
static java.lang.String |
downloadFile(java.net.URL url)
Downloads the file from the URL specified and returns the local path where it was download to |
static void |
downloadFile(java.net.URL url,
java.lang.String localPath,
ConnectionArguments connectionArgs)
Downloads the content from the specified URL in the given path with the provided connection arguments |
java.lang.String |
expandLibraryURL(java.lang.String url)
Returns the absolute URL for the relative URL passed |
IConnectionConfigurator |
getConnectionConfigurator()
Returns the IConnectionConfigurator that is set. |
long |
getTotalRequestTime()
Returns the total time taken by the request from complete. |
boolean |
isCached(java.lang.String url)
Returns true if the URL is already cached locally |
java.io.InputStream |
openDataStream(java.lang.String url,
Credential credential)
Returns a stream to the desired resource with no caching. |
java.io.InputStream |
openDataStream(java.lang.String url,
Credential credential,
ConnectionArguments connectionArgs)
Returns a stream to the desired resource with no caching. |
void |
registerFile(java.lang.String file)
Adds the file to the cache |
void |
setConnectionConfigurator(IConnectionConfigurator connectionConfigurator)
Sets the IConnectionConfigurator |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public URLDataProvider()
Method Detail |
---|
public void setConnectionConfigurator(IConnectionConfigurator connectionConfigurator)
public IConnectionConfigurator getConnectionConfigurator()
public boolean isCached(java.lang.String url) throws AuthenticationException, ConnectionException
AuthenticationException
ConnectionException
public long getTotalRequestTime()
public long addRequestTime(long time)
time
- (in milliseconds) to be added
public java.lang.String cacheResource(java.lang.String url, Credential credential, ConnectionArguments connectionArgs) throws AuthenticationException, ConnectionException
ConnectionArguments
.
If the resource was not cached, it is cached before it is returned.
url
- Path of the resource
- cannot be emptycredential
- Credentials to access the resource, if any
- cannot be nullacceptHeader
- - the accept header to use
AuthenticationException
ConnectionException
public java.lang.String cacheResource(java.lang.String url, Credential credential) throws AuthenticationException, ConnectionException
url
- Path of the resource
- cannot be emptycredential
- Credentials to access the resource, if any
- cannot be null
AuthenticationException
ConnectionException
public java.io.InputStream openDataStream(java.lang.String url, Credential credential) throws AuthenticationException, ConnectionException
url
- Path of the resource
- cannot be emptycredential
- Credentials to access the resource, if any
- cannot be null
AuthenticationException
ConnectionException
public java.io.InputStream openDataStream(java.lang.String url, Credential credential, ConnectionArguments connectionArgs) throws AuthenticationException, ConnectionException
url
- Path of the resource
- cannot be emptycredential
- Credentials to access the resource.
- cannot be nullacceptHeader
- - the accept header to use
AuthenticationException
ConnectionException
public static java.io.InputStream doNone(java.lang.String url, ConnectionArguments connectionArgs) throws AuthenticationException, ConnectionException
url
- - cannot be NULLlocalPath
- - cannot be NULLconnectionArgs
- - cannot be NULL
AuthenticationException
ConnectionException
public void cleanup()
public static java.lang.String downloadFile(java.net.URL url) throws AuthenticationException, ConnectionException
URL
- to download from
AuthenticationException
ConnectionException
public static void downloadFile(java.net.URL url, java.lang.String localPath, ConnectionArguments connectionArgs) throws AuthenticationException, ConnectionException
URL
- to download fromlocal
- path to which the file should be download toconnectionArgs
- - cannot be NULL
AuthenticationException
ConnectionException
public void registerFile(java.lang.String file)
File
- to be added to the cachepublic java.lang.String expandLibraryURL(java.lang.String url)
URL
- to be converted to absolute URL
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |