Xj3D VRML/X3D Code API

org.web3d.net.resolve
Class Web3DURNResolver

java.lang.Object
  extended byorg.web3d.net.resolve.Web3DURNResolver
All Implemented Interfaces:
org.ietf.uri.URIResolverService, org.ietf.uri.URNResolverService

public class Web3DURNResolver
extends java.lang.Object
implements org.ietf.uri.URNResolverService

A URN resolver to allow the integration of URNs that use the web3d Namespace ID.

Version:
$Revision: 1.4 $
Author:
Justin Couch

Field Summary
 
Fields inherited from interface org.ietf.uri.URIResolverService
I2C, I2Cs, I2L, I2Ls, I2N, I2Ns, I2R, I2Rs, II
 
Constructor Summary
Web3DURNResolver()
          Create an instance of the resolver.
 
Method Summary
 boolean canResolve(java.lang.String nid)
          Check to see what NIDs can be resolved by this service implementation.
 boolean checkService(int type)
          Check to see if the service type is one that we can resolve given the namespace ID.
 java.lang.Object decode(org.ietf.uri.URN urn, int service)
          Decode this URN using the given service type in the singular.
 java.lang.Object[] decodeList(org.ietf.uri.URN urn, int service)
          Decode this URN using the given service type that gives a list of return values.
 void init()
          Initialise any internal information.
 void registerPrefixLocation(java.lang.String prefix, java.lang.String directory)
          Set the directory used to locate a particular subspace of the Web3D URN namespace ID.
 void setErrorReporter(ErrorReporter reporter)
          Register an error reporter with the engine so that any errors generated by the loading of script code can be reported in a nice, pretty fashion.
 void setResourceFactory(org.ietf.uri.URIResourceFactory fac)
          Set the resource factory to be used to fetch streams for.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Web3DURNResolver

public Web3DURNResolver()
Create an instance of the resolver. This will not be able to resolve anything until the appropriate directories are set.

Method Detail

canResolve

public boolean canResolve(java.lang.String nid)
Check to see what NIDs can be resolved by this service implementation.

Specified by:
canResolve in interface org.ietf.uri.URNResolverService
Parameters:
nid - The NID to check
Returns:
true if we can resolve it

decode

public java.lang.Object decode(org.ietf.uri.URN urn,
                               int service)
                        throws org.ietf.uri.UnsupportedServiceException
Decode this URN using the given service type in the singular.

Specified by:
decode in interface org.ietf.uri.URNResolverService
Parameters:
urn - The urn that was requested to be resolved
service - The service type of the resolution
Throws:
org.ietf.uri.UnsupportedServiceException - We don't handle this service

decodeList

public java.lang.Object[] decodeList(org.ietf.uri.URN urn,
                                     int service)
                              throws org.ietf.uri.UnsupportedServiceException
Decode this URN using the given service type that gives a list of return values.

Specified by:
decodeList in interface org.ietf.uri.URNResolverService
Parameters:
urn - The urn that was requested to be resolved
service - The service type of the resolution
Throws:
org.ietf.uri.UnsupportedServiceException - We don't handle this service

checkService

public boolean checkService(int type)
Check to see if the service type is one that we can resolve given the namespace ID.

Specified by:
checkService in interface org.ietf.uri.URIResolverService
Parameters:
type - The service type to check if it works
Returns:
true if the service type is supported by this implementation

init

public void init()
Initialise any internal information. Ignored in this implementation

Specified by:
init in interface org.ietf.uri.URIResolverService

setResourceFactory

public void setResourceFactory(org.ietf.uri.URIResourceFactory fac)
Set the resource factory to be used to fetch streams for. Should never be called by end-user code. Is internal to the URI library.

Specified by:
setResourceFactory in interface org.ietf.uri.URIResolverService
Parameters:
fac - The factory to be used

setErrorReporter

public void setErrorReporter(ErrorReporter reporter)
Register an error reporter with the engine so that any errors generated by the loading of script code can be reported in a nice, pretty fashion. Setting a value of null will clear the currently set reporter. If one is already set, the new value replaces the old.

Parameters:
reporter - The instance to use or null

registerPrefixLocation

public void registerPrefixLocation(java.lang.String prefix,
                                   java.lang.String directory)
                            throws java.lang.IllegalArgumentException
Set the directory used to locate a particular subspace of the Web3D URN namespace ID. A check is made to make sure the passed string represents a valid directory. If it does not, an exception is thrown. If null is passed as the directory, it removes the current mapping.

Parameters:
prefix - The subspace prefix to use
directory - The directory that GeoVRML is installed in
Throws:
java.lang.IllegalArgumentException - The directory is not valid

Xj3D VRML/X3D Code API

Copyright © 2001 - 2005 Web3D Consortium