Package org.javarosa.core.reference
Class PrefixedRootFactory
java.lang.Object
org.javarosa.core.reference.PrefixedRootFactory
- All Implemented Interfaces:
ReferenceFactory
- Direct Known Subclasses:
ResourceReferenceFactory
public abstract class PrefixedRootFactory extends Object implements ReferenceFactory
PrefixedRootFactory provides a clean way to implement
the vast majority of behavior for a reference factory.
A PrefixedRootFactory defines a set of roots which it can provide references for. Roots can either be a full URI root like "http://", or "file://", or can be local roots like "resource" or "file", in which case the assumed protocol parent will be "jr://".
For example: a PrefixedRootFactory with the roots "media" and "resource" will be used by the ReferenceManager to derive any URI with the roots
- jr://media/
- jr://resource/
jr://media/checkmark.pngand a PrefixedRootFactory with roots "file" and "file://" will be used by the ReferenceManager to derive any URI with the roots
- jr://file/
- file://
jr://file/myxform.xhtmlor
file://myxform.xhtml
- Author:
- ctsims
-
Constructor Summary
Constructors Constructor Description PrefixedRootFactory(String[] roots)Construct a PrefixedRootFactory which handles the roots provided. -
Method Summary
-
Constructor Details
-
PrefixedRootFactory
Construct a PrefixedRootFactory which handles the roots provided. Implementing subclasses will actually do the root construction by implementing the "factory()" method.- Parameters:
roots- The roots of URI's which should be derived by this factory.
-
-
Method Details
-
derive
- Specified by:
derivein interfaceReferenceFactory- Throws:
InvalidReferenceException
-
factory
Creates a Reference using the most locally available part of a URI.- Parameters:
terminal- The local part of the URI for this prefixed root (excluding the root itself)URI- The full URI- Returns:
- A reference which describes the URI
-
derive
- Specified by:
derivein interfaceReferenceFactory- Throws:
InvalidReferenceException
-
derives
- Specified by:
derivesin interfaceReferenceFactory
-
toString
-