com.ibm.datapower.wamt.clientAPI
Class URLSource

java.lang.Object
  extended by com.ibm.datapower.wamt.clientAPI.URLSource

public class URLSource
extends java.lang.Object

A URLSource is a convenience class to access blob objects from various schemes e.g. http, file, device.

Usage:

To reference a file
--> new URLSource("file:///C:/DataPowerData/my-config-source.zip");

To reference a resource via http
--> new URLSource("http://host:port/my-config-source.zip");

To reference domain on a device
--> new URLSource("device://device-host/myDomain");

To reference a domain version in the repository
--> new URLSource("repos://device-host/myDomain/domain-version/2");

To reference a deployment policy version in the repository
--> new URLSource("repos://device-host/myDomain/policy-version/2");

Note: Using the 'device' scheme or 'repos' scheme requires that a corresponding Device object be created in the Manager. The device-host must be identical to the hostname parameter used in Device.createDevice(String, String, String, String, int). Host names must be valid host names per RFC 952 and RFC 1123.

See Also:
Blob

Field Summary
static java.lang.String COPYRIGHT_2009_2013
           
static java.lang.String SCHEME_DEVICE
           
static java.lang.String SCHEME_FILE
           
static java.lang.String SCHEME_HTTP
           
static java.lang.String SCHEME_HTTPS
           
static java.lang.String SCHEME_REPOS
           
static java.lang.String URI_PATH_DEPPOL_VER
           
static java.lang.String URI_PATH_DOMAINVER
           
 
Constructor Summary
URLSource(java.lang.String specs)
          Create a new URLSource object with the provided spec (URL).
 
Method Summary
 Blob getBlob()
          This method returns a Blob object from the spec sent to the constructor (e.g.
 Blob getFirmwareBlob()
          This method returns a Blob object from the spec sent to the constructor (e.g.
 long getLastModified()
          Use this method to determine the "last modified" time of the source referenced by this object.
 java.lang.String getScheme()
          Use this method to determine the scheme of the URL referenced by this object.
 java.lang.String getURL()
          Use this method to determine the URL referenced by this object.
 int getVersion()
          Use this method to determine the version referred to by this URLSource
 boolean hasVersionPath()
          Use this method to determine if the URLSource refers to a version
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCHEME_HTTP

public static final java.lang.String SCHEME_HTTP
See Also:
Constant Field Values

SCHEME_HTTPS

public static final java.lang.String SCHEME_HTTPS
See Also:
Constant Field Values

SCHEME_FILE

public static final java.lang.String SCHEME_FILE
See Also:
Constant Field Values

SCHEME_DEVICE

public static final java.lang.String SCHEME_DEVICE
See Also:
Constant Field Values

SCHEME_REPOS

public static final java.lang.String SCHEME_REPOS
See Also:
Constant Field Values

URI_PATH_DOMAINVER

public static final java.lang.String URI_PATH_DOMAINVER
See Also:
Constant Field Values

URI_PATH_DEPPOL_VER

public static final java.lang.String URI_PATH_DEPPOL_VER
See Also:
Constant Field Values

COPYRIGHT_2009_2013

public static final java.lang.String COPYRIGHT_2009_2013
See Also:
Constant Field Values
Constructor Detail

URLSource

public URLSource(java.lang.String specs)
          throws java.net.URISyntaxException
Create a new URLSource object with the provided spec (URL).

Parameters:
spec - - the URL of the resource to be addressed by this URLSource
See Also:
Blob
Method Detail

getURL

public java.lang.String getURL()
Use this method to determine the URL referenced by this object.


getScheme

public java.lang.String getScheme()
Use this method to determine the scheme of the URL referenced by this object.

Returns:
the scheme (e.g. http, file, etc of the URL)
See Also:
Blob

hasVersionPath

public boolean hasVersionPath()
Use this method to determine if the URLSource refers to a version

Returns:
boolean indication that this URLSource points to a version
See Also:
Blob

getVersion

public int getVersion()
Use this method to determine the version referred to by this URLSource

Returns:
int version
See Also:
Blob

getLastModified

public long getLastModified()
                     throws java.io.IOException
Use this method to determine the "last modified" time of the source referenced by this object. This is useful to compare persisted time stamps to see if the blob should be retrieved again

Returns:
long - can be used to build a Date object
See Also:
Blob, Date

getBlob

public Blob getBlob()
             throws java.io.IOException,
                    DeletedException,
                    NotExistException,
                    InUseException,
                    InvalidParameterException,
                    AMPException
This method returns a Blob object from the spec sent to the constructor (e.g. URL source). This method will B64 encode the source if a file:, http: or https: scheme is specified in the URL. It will not encode if the URL scheme is device: or repos: since these are already encoded.

Returns:
the Blob constructed from the source.
See Also:
Blob

getFirmwareBlob

public Blob getFirmwareBlob()
                     throws java.net.MalformedURLException,
                            InvalidParameterException
This method returns a Blob object from the spec sent to the constructor (e.g. URL source). A separate method was needed because getBlob() will B64 encode the file, http and https schemes and firmware images should not be encoded.

Returns:
the Blob constructed from the source
See Also:
Blob


© Copyright IBM Corp. 2006, 2010 All Rights Reserved.