Package org.alfresco.repo.virtual.ref
Class VirtualProtocol
java.lang.Object
org.alfresco.repo.virtual.ref.Protocol
org.alfresco.repo.virtual.ref.VirtualProtocol
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
VanillaProtocol
A protocol for encoding virtual artefacts.
Virtual artefacts are generated using a virtual folder templateindicated by the main
The virtual folder template defines a hierarchical structure of virtual nodes.
The template path (see
Virtual folders templates can be applied on actual repository nodes (see
The protocol implementation also handles virtual protocol
Virtual artefacts are generated using a virtual folder templateindicated by the main
Reference resource.The virtual folder template defines a hierarchical structure of virtual nodes.
The template path (see
getTemplatePath(Reference)) indicates
a path in this structure.Virtual folders templates can be applied on actual repository nodes (see
getActualNodeLocation(Reference)) which should be passed as
parameters to the virtual folder template.The protocol implementation also handles virtual protocol
Reference
creation and template path navigation.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intActual nodeParameterindex.static final CharacterClasspath system path token.static final CharacterRepository node path system path token.static final intTemplate pathParameterindex.Fields inherited from class org.alfresco.repo.virtual.ref.Protocol
DEFAULT_ENCODING, name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ResourcecreateSystemPathResource(String templateSysPath) Deprecated.In future system paths will be replaced with actual resources or string encoded references<R> Rdispatch(ProtocolMethod<R> method, Reference reference) ProtocolMethoddouble-dispatch/visitor protocol type selector.getActualNodeLocation(Reference reference) getTemplatePath(Reference reference) newReference(String templateSysPath, String templatePath, NodeRef actualNodeRef) Deprecated.In future system paths will be replaced with actual resources or string encoded referencesnewReference(Encoding encoding, Resource templateResource, String templatePath, Resource actualNodeResource, List<Parameter> extraParameters) newReference(Resource templateResource, String templatePath, NodeRef actualNodeRef, List<Parameter> extraParameters) newReference(NodeRef templateNodeRef, String templatePath, NodeRef actualNodeRef) replaceTemplatePath(Reference reference, String path) Methods inherited from class org.alfresco.repo.virtual.ref.Protocol
addParameter, addParameter, getParameter, propagateNodeRefMutations, replaceParameter, replaceParameter, toString
-
Field Details
-
ACTUAL_NODE_LOCATION_PARAM_INDEX
public static final int ACTUAL_NODE_LOCATION_PARAM_INDEXActual nodeParameterindex.- See Also:
-
TEMPLATE_PATH_PARAM_INDEX
public static final int TEMPLATE_PATH_PARAM_INDEXTemplate pathParameterindex.- See Also:
-
NODE_TEMPLATE_PATH_TOKEN
Repository node path system path token. -
CLASS_TEMPLATE_PATH_TOKEN
Classpath system path token.
-
-
Constructor Details
-
VirtualProtocol
public VirtualProtocol() -
VirtualProtocol
-
-
Method Details
-
dispatch
Description copied from class:ProtocolProtocolMethoddouble-dispatch/visitor protocol type selector. Subclasses should override this method to select the appropriate type bound method.
This particular implementation calls the defaultProtocolMethod.execute(Protocol, Reference)default method implementation.- Overrides:
dispatchin classProtocol- Returns:
- the value returned by the type bond method
- Throws:
ProtocolMethodException
-
getTemplatePath
- Parameters:
reference-- Returns:
- the inner template path referenced by the given
Reference - See Also:
-
replaceTemplatePath
- Parameters:
reference-path-- Returns:
- a
Referencecopy of the given reference parameter with the template path set to the given path parameter value - See Also:
-
getActualNodeLocation
- Parameters:
reference-- Returns:
- the repository location of the actual node that the virtual template should be applied on
- See Also:
-
newReference
-
newReference
public Reference newReference(Resource templateResource, String templatePath, NodeRef actualNodeRef, List<Parameter> extraParameters) - Parameters:
templateResource- template content holding resourcetemplatePath-actualNodeRef-- Returns:
- a new virtual protocol
Referencewith the given virtual protocol reference elements
-
newReference
-
newReference
public Reference newReference(String templateSysPath, String templatePath, NodeRef actualNodeRef) throws ProtocolMethodException Deprecated.In future system paths will be replaced with actual resources or string encoded referencesCreates a resource based on the given template system-path that is used in creating a new virtual protocol reference.- Parameters:
templateSysPath- a template-system-path for the template holding content
Template-system-paths are classpaths paths or repository paths prefixed withCLASS_TEMPLATE_PATH_TOKENorNODE_TEMPLATE_PATH_TOKENrespectively.templatePath-actualNodeRef-- Returns:
- a new virtual protocol
Referencewith the given virtual protocol reference elements - Throws:
ProtocolMethodException
-
createSystemPathResource
Deprecated.In future system paths will be replaced with actual resources or string encoded referencesSystem path resource factory method.- Parameters:
templateSysPath- a classpath or a repository path prefixed withCLASS_TEMPLATE_PATH_TOKENorNODE_TEMPLATE_PATH_TOKENrespectively.- Returns:
- a
ClassPathResourceor aRepositoryResourcefor the given system path
-