Package com.iizix.urn
Class URNFactory
- java.lang.Object
- com.iizix.urn.URNFactory
public final class URNFactory extends java.lang.Object
Factory used to keep track of various URL mapper's possible for the iizi Server and Designer, e.g. for global, user, or session private URL's. These URL's can be used e.g. to map a very large (images) stored on file or in a database so that the client gets a short URL to use, and still have to download the contents to get it (but can be kept in cache by that device). It can also used to store an image (ImageBuffer or byte data) into the server for temporary or permanent use (either as file or in database).
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description URN
from(java.lang.String urnString)
Creates aURN
from a String.static URNFactory
getInstance()
Gets the instance to the URL factory.IURNProvider
getProvider(NID nid)
Gets the service provider for the specified name.boolean
register(IURNProvider provider)
Registers a URN provider.
Method Detail
getInstance
public static URNFactory getInstance()
Gets the instance to the URL factory.
register
public boolean register(IURNProvider provider)
Registers a URN provider.- Parameters:
provider
- The provider.- Returns:
- true if successfully registered, false if already registered. Failures will also be logged in the server.
- Throws:
java.lang.RuntimeException
- If this method is called twice for the same URN provider.
getProvider
public IURNProvider getProvider(NID nid)
Gets the service provider for the specified name.- Parameters:
nid
- The NID.- Returns:
- The provider, or
null
if not found.
from
public URN from(java.lang.String urnString) throws URNException
Creates aURN
from a String.- Parameters:
urnString
- The String to resolve to an URN resource.- Returns:
- The URN instance.
- Throws:
URNException
- For illegal URN's.NIDException
- For exceptions with Naming ID's.UnknownNIDException
- For unknown Naming ID's.java.lang.IllegalArgumentException
- If the implementation encounters illegal characters.