com.ibm.portal.spa.data
Class SpaURI

java.lang.Object
  extended by com.ibm.portal.resolver.uri.BaseURI
      extended by com.ibm.portal.spa.data.SpaURI
All Implemented Interfaces:
Identifiable, Constants, java.lang.Cloneable

public class SpaURI
extends BaseURI
implements Constants, Identifiable, java.lang.Cloneable

URI that allows to address static resources inside a ZIP file that is associated to a static page

spa:OID
URI that references the static page itself
spa:OID/MARKUP
URI that references the markup of the static page, but not a file or folder inside the page
spa:OID/MARKUP/
URI that references the root folder inside the static page
spa:OID/MARKUP/FILE
URI that references a file inside the root folder
spa:OID/MARKUP/FOLDER/FILE
URI that references a file inside a subfolder
spa:OID/MARKUP/FOLDER/
URI that references a subfolder
spa:theme-OID/FILE
URI that references a file inside a theme
spa:skin-OID/FILE
URI that references a file inside a skin

Since:
6.1.0

Field Summary
 
Fields inherited from class com.ibm.portal.resolver.uri.BaseURI
LOG_LEVEL, NULL_FACTORY
 
Fields inherited from interface com.ibm.portal.spa.data.Constants
KEY_DEVICE_CLASS, KEY_LOCALE, SCHEME_SPA_URI, SCHEME_ZIP_URI, SPA_HTTP_EQUIV_URI
 
Fields inherited from interface com.ibm.portal.resolver.uri.Constants
ESCAPE_CHAR, ESCAPE_STRG
 
Constructor Summary
SpaURI(java.lang.String uri, Identification idSvc, PocURIFactory uriFct)
          Parses the URI based on a string representation
SpaURI(java.net.URI uri, Identification idSvc)
          Parses the URI and provides the parts of this URI as objects
 
Method Summary
 SpaURI clone()
           
 boolean equals(java.lang.Object obj)
           
 java.lang.String getFileName()
          Filename of the file inside the ZIP that is addressed by this URI.
 java.lang.String getMarkup()
          The markup identifier.
 ObjectID getObjectID()
          Returns the object ID of the resource that implements the Identifiable interface.
 java.lang.String getPathName()
          Returns the path portion after the page ID, this path name will start with a slash character if it exists
 int hashCode()
           
 boolean isDirectory()
          Checks if the addressed file is a folder.
 boolean isFile()
          Checks if the addressed file is a file.
 boolean isPath()
          Checks if the resource either specifies a file or directory
static java.net.URI newInstance(ObjectID pageID, Identification idSvc, PocURIFactory pocService)
          Creates a URI that only addresses the static page, but not a resource inside this page
static java.net.URI newInstance(ObjectID pageID, java.lang.String markup, Identification idSvc)
          Deprecated. use newInstance(ObjectID, String, Identification, PocService) instead
static java.net.URI newInstance(ObjectID pageID, java.lang.String markup, Identification idSvc, PocService pocService)
          Deprecated. 
static java.net.URI newInstance(ObjectID pageID, java.lang.String markup, Identification idSvc, PocURIFactory pocService)
          Creates a URI that only addresses the static page, but not a resource inside this page
static java.net.URI newInstance(ObjectID pageID, java.lang.String markup, java.lang.String fileName, Identification idSvc)
          Deprecated. use newInstance(ObjectID, String, String, Identification, PocService) instead
static java.net.URI newInstance(ObjectID pageID, java.lang.String markup, java.lang.String fileName, Identification idSvc, PocService pocService)
          Deprecated. 
static java.net.URI newInstance(ObjectID pageID, java.lang.String markup, java.lang.String fileName, Identification idSvc, PocURIFactory pocService)
          Constructs a new URI based on the pageID and the filename inside the ZIP file.
static java.net.URI newInstance(java.lang.String pageName, java.lang.String markup)
          Deprecated. use newInstance(String, String, PocService) instead
static java.net.URI newInstance(java.lang.String pageName, java.lang.String markup, PocService pocService)
          Deprecated. 
static java.net.URI newInstance(java.lang.String pageName, java.lang.String markup, PocURIFactory pocService)
          Creates a URI that only addresses the static page, but not a resource inside this page
static java.net.URI newInstance(java.lang.String pageName, java.lang.String markup, java.lang.String fileName)
          Deprecated. use #newInstance(String, String, String, PocService) instead
static java.net.URI newInstance(java.lang.String pageName, java.lang.String markup, java.lang.String fileName, PocURIFactory pocService)
          Constructs a new URI based on the serialized form of the page and the filename inside the ZIP file.
 java.lang.String toString()
           
 java.net.URI toURI()
          Returns the URI object this SPA URI was constructed from
 
Methods inherited from class com.ibm.portal.resolver.uri.BaseURI
createURI, createURI, createURI, createURI, decode, decode, decode, decode, encode, encode, normalizeRawSchemeSpecificPart, normalizeRawSchemeSpecificPart
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SpaURI

public SpaURI(java.lang.String uri,
              Identification idSvc,
              PocURIFactory uriFct)
       throws SerializationException,
              java.net.URISyntaxException,
              java.io.IOException
Parses the URI based on a string representation

Parameters:
uri - the SPA URI
idSvc - the identification service
Throws:
java.net.MalformedURLException
SerializationException
java.net.URISyntaxException
java.io.IOException

SpaURI

public SpaURI(java.net.URI uri,
              Identification idSvc)
       throws java.net.MalformedURLException,
              SerializationException
Parses the URI and provides the parts of this URI as objects

Parameters:
uri - the SPA URI
idSvc - the identification service
Throws:
java.net.MalformedURLException
SerializationException
Method Detail

newInstance

public static java.net.URI newInstance(ObjectID pageID,
                                       Identification idSvc,
                                       PocURIFactory pocService)
                                throws SerializationException,
                                       java.net.URISyntaxException
Creates a URI that only addresses the static page, but not a resource inside this page

Parameters:
pageID - the ObjectID of the page
idSvc - the identification service used to serialize the ID
Returns:
the SPA URI
Throws:
SerializationException
java.net.URISyntaxException

newInstance

@Deprecated
public static java.net.URI newInstance(ObjectID pageID,
                                                  java.lang.String markup,
                                                  Identification idSvc)
                                throws SerializationException
Deprecated. use newInstance(ObjectID, String, Identification, PocService) instead

Creates a URI that only addresses the static page, but not a resource inside this page

Parameters:
pageID - the ObjectID of the page
markup - the markup name
idSvc - the identification service used to serialize the ID
Returns:
the SPA URI
Throws:
SerializationException

newInstance

@Deprecated
public static java.net.URI newInstance(ObjectID pageID,
                                                  java.lang.String markup,
                                                  Identification idSvc,
                                                  PocService pocService)
                                throws SerializationException,
                                       java.net.URISyntaxException
Deprecated. 

Creates a URI that only addresses the static page, but not a resource inside this page

Parameters:
pageID - the ObjectID of the page
markup - the markup name
idSvc - the identification service used to serialize the ID
Returns:
the SPA URI
Throws:
SerializationException
java.net.URISyntaxException

newInstance

public static java.net.URI newInstance(ObjectID pageID,
                                       java.lang.String markup,
                                       Identification idSvc,
                                       PocURIFactory pocService)
                                throws SerializationException,
                                       java.net.URISyntaxException
Creates a URI that only addresses the static page, but not a resource inside this page

Parameters:
pageID - the ObjectID of the page
markup - the markup name
idSvc - the identification service used to serialize the ID
Returns:
the SPA URI
Throws:
SerializationException
java.net.URISyntaxException

newInstance

@Deprecated
public static java.net.URI newInstance(ObjectID pageID,
                                                  java.lang.String markup,
                                                  java.lang.String fileName,
                                                  Identification idSvc)
                                throws SerializationException
Deprecated. use newInstance(ObjectID, String, String, Identification, PocService) instead

Constructs a new URI based on the pageID and the filename inside the ZIP file.

Parameters:
pageID - the ObjectID of the page
markup - the markup name
fileName - the filename inside the ZIP
idSvc - the identification service used to serialize the ID
Returns:
the SPA URI
Throws:
SerializationException

newInstance

@Deprecated
public static java.net.URI newInstance(ObjectID pageID,
                                                  java.lang.String markup,
                                                  java.lang.String fileName,
                                                  Identification idSvc,
                                                  PocService pocService)
                                throws SerializationException,
                                       java.net.URISyntaxException
Deprecated. 

Constructs a new URI based on the pageID and the filename inside the ZIP file.

Parameters:
pageID - the ObjectID of the page
markup - the markup name
fileName - the filename inside the ZIP
idSvc - the identification service used to serialize the ID
Returns:
the SPA URI
Throws:
SerializationException
java.net.URISyntaxException

newInstance

public static java.net.URI newInstance(ObjectID pageID,
                                       java.lang.String markup,
                                       java.lang.String fileName,
                                       Identification idSvc,
                                       PocURIFactory pocService)
                                throws SerializationException,
                                       java.net.URISyntaxException
Constructs a new URI based on the pageID and the filename inside the ZIP file.

Parameters:
pageID - the ObjectID of the page
markup - the markup name
fileName - the filename inside the ZIP
idSvc - the identification service used to serialize the ID
Returns:
the SPA URI
Throws:
SerializationException
java.net.URISyntaxException

newInstance

@Deprecated
public static java.net.URI newInstance(java.lang.String pageName,
                                                  java.lang.String markup)
Deprecated. use newInstance(String, String, PocService) instead

Creates a URI that only addresses the static page, but not a resource inside this page

Parameters:
pageName - the page name (OID or unique name
markup - the markup name
Returns:
the URI

newInstance

@Deprecated
public static java.net.URI newInstance(java.lang.String pageName,
                                                  java.lang.String markup,
                                                  PocService pocService)
                                throws java.net.URISyntaxException
Deprecated. 

Creates a URI that only addresses the static page, but not a resource inside this page

Parameters:
pageName - the page name (OID or unique name
markup - the markup name
Returns:
the URI
Throws:
java.net.URISyntaxException

newInstance

public static java.net.URI newInstance(java.lang.String pageName,
                                       java.lang.String markup,
                                       PocURIFactory pocService)
                                throws java.net.URISyntaxException
Creates a URI that only addresses the static page, but not a resource inside this page

Parameters:
pageName - the page name (OID or unique name
markup - the markup name
Returns:
the URI
Throws:
java.net.URISyntaxException

newInstance

@Deprecated
public static java.net.URI newInstance(java.lang.String pageName,
                                                  java.lang.String markup,
                                                  java.lang.String fileName)
Deprecated. use #newInstance(String, String, String, PocService) instead

Constructs a new URI based on the serialized form of the page and the filename inside the ZIP file.

Parameters:
pageName - serialized form of the page ID
markup - the markup name
fileName - the filename inside the ZIP file
Returns:
the SPA URI

newInstance

public static java.net.URI newInstance(java.lang.String pageName,
                                       java.lang.String markup,
                                       java.lang.String fileName,
                                       PocURIFactory pocService)
                                throws java.net.URISyntaxException
Constructs a new URI based on the serialized form of the page and the filename inside the ZIP file.

Parameters:
pageName - serialized form of the page ID
markup - the markup name
fileName - the filename inside the ZIP file
Returns:
the SPA URI
Throws:
java.net.URISyntaxException

clone

public SpaURI clone()
Overrides:
clone in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getFileName

public java.lang.String getFileName()
Filename of the file inside the ZIP that is addressed by this URI. This is empty if the URI addresses the page or the markup directly (e.g. spa:OID/MARKUP). It is the empty string if the URI addresses the root folder (i.e. spa:OID/MARKUP/). Use isDirectory() or isFile() to distinguish between these cases.

Returns:
the fileName, may be null or the empty string

getMarkup

public java.lang.String getMarkup()
The markup identifier. May be null if the URI only addresses the page (i.e. spa:OID).

Returns:
the markup, may be null

getObjectID

public ObjectID getObjectID()
Description copied from interface: Identifiable
Returns the object ID of the resource that implements the Identifiable interface.

Specified by:
getObjectID in interface Identifiable
Returns:
the ObjectID of this resource, this can never be null

getPathName

public java.lang.String getPathName()
Returns the path portion after the page ID, this path name will start with a slash character if it exists

Returns:
the path portion, may be null

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

isDirectory

public boolean isDirectory()
Checks if the addressed file is a folder. Folders end with a "/" character. The method also returns true, if the root folder is addressed, in this case the filename is the empty string.

Returns:
true if the addressed resource is a folder, else false
Since:
6.1.0.2

isFile

public boolean isFile()
Checks if the addressed file is a file. Files do not end with a "/" character.

Returns:
true if the addressed resource is a file, else false
Since:
6.1.0.2

isPath

public boolean isPath()
Checks if the resource either specifies a file or directory

Returns:
true if either isFile() or isDirectory() return true, else false
Since:
6.1.0.2

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toURI

public java.net.URI toURI()
Returns the URI object this SPA URI was constructed from

Returns:
the original URI
Since:
6.1.0.3