Class TemplateVirtualizationMethod

  • All Implemented Interfaces:
    VirtualizationMethod
    Direct Known Subclasses:
    AspectVirtualizationMethod, TypeVirtualizationMethod

    public abstract class TemplateVirtualizationMethod
    extends java.lang.Object
    implements VirtualizationMethod
    Base implementation for virtualization rules defined using template located in the content repository or in a system path.
    System paths are custom string references of a resource that can be located either in the repository or in the java classpath - system paths are deprecated and they will be replaced by Encodings.PLAIN encoded Reference strings.
    Templates are programmatic or declarative definitions of the rules implemented by this virtualization method.
    Supported template formats include JavaScript defined templates and JSON defined templates (JSON templates are also referred as vanilla templates). The extension present in the name of the template is used to determine the nature of the template (*.js for JavaScript and *.json for JSON).
    JSON templates processing is done using a configurable JavaScriot processor script (actually a JavaScript template that gets an extra parameter containing the JSON template) that resides in the Java class path.
    Templates are processed in order to virtualize NodeRefs using NewVirtualReferenceMethod protocol reference constructor visitor.
    Author:
    Bogdan Horje
    • Field Detail

    • Constructor Detail

      • TemplateVirtualizationMethod

        public TemplateVirtualizationMethod()
    • Method Detail

      • setVanillaProcessor

        public void setVanillaProcessor​(java.lang.String vanillaProcessorClasspath)
      • newVirtualReference

        protected Reference newVirtualReference​(ActualEnvironment env,
                                                org.alfresco.service.cmr.repository.NodeRef actualNodeRef,
                                                java.lang.String templateSystemPath)
                                         throws VirtualizationException
        Deprecated.
        all template system path functionality should be replaced by plain encoded references
        Parameters:
        env - the environment in which the virtualization takes place
        actualNodeRef - the node that is virtualized using the given template
        templateSystemPath - system path string of the template used in virtualizing the given NodeRef
        Returns:
        a Reference correspondent of the given NodeRef according to the rules defined by the given template
        Throws:
        VirtualizationException
      • newVirtualReference

        protected Reference newVirtualReference​(ActualEnvironment env,
                                                org.alfresco.service.cmr.repository.NodeRef actualNodeRef,
                                                org.alfresco.service.cmr.repository.NodeRef templateRef)
                                         throws VirtualizationException
        Parameters:
        env - the environment in which the virtualization takes place
        actualNodeRef - the node that is virtualized using the given template
        templateRef - NodeRef of the template used in virtualizing the given NodeRef
        Returns:
        a Reference correspondent of the given NodeRef according to the rules defined by the given template
        Throws:
        VirtualizationException
      • newVirtualReference

        protected Reference newVirtualReference​(Protocol protocol,
                                                org.alfresco.service.cmr.repository.NodeRef templateRef,
                                                org.alfresco.service.cmr.repository.NodeRef actualNodeRef)
                                         throws ProtocolMethodException
        Parameters:
        protocol - Protocol to be used in virtualizing the given actulalNodeRef
        templateRef - NodeRef of the template used in virtualizing the given NodeRef
        actualNodeRef - the node that is virtualized using the given template
        Returns:
        a Reference correspondent of the given NodeRef according to the rules defined by the given template
        Throws:
        ProtocolMethodException