public final class TemplateManager extends Object
| Constructor and Description |
|---|
TemplateManager()
Constructs a new template manager and loads the default templates.
|
| Modifier and Type | Method and Description |
|---|---|
Node |
doRequest(org.onosproject.netconf.NetconfSession session,
String templateName)
Execute the named NETCONF template against the specified session returning
the
/rpc-reply/data section of the response document as a
Node. |
Node |
doRequest(org.onosproject.netconf.NetconfSession session,
String templateName,
Map<String,Object> templateContext)
Execute the named NETCONF template with the given template context against
the specified session returning the
/rpc-reply/data section of the
response document as a Node. |
Object |
doRequest(org.onosproject.netconf.NetconfSession session,
String templateName,
Map<String,Object> templateContext,
String baseXPath,
QName returnType)
Executes the named NETCONF template against the specified session, returning
the referenced XML node as the specified type.
|
String |
get(String templateName)
Returns the named template.
|
void |
load(Class<? extends Object> reference,
String pattern,
String... templateNames)
Loads the named templates into the template manager.
|
void |
load(String... templateMNames)
Loads the named templates into the template manager using the default
reference class and resource path pattern.
|
void |
load(String pattern,
String... templateMNames)
Loads the named templates into the template manager using the default
reference class.
|
String |
render(String template,
Map<String,Object> context)
Performs simple variable substitution into a string in likely the most
inefficient way possible.
|
void |
setRequestDriver(TemplateRequestDriver driver)
Sets the request driver for the template manager.
|
public TemplateManager()
public void setRequestDriver(TemplateRequestDriver driver)
driver - the driver to usepublic void load(Class<? extends Object> reference, String pattern, String... templateNames)
reference - the class reference from which to load resourcespattern - pattern to convert template name to resource pathtemplateNames - list of template to loadpublic void load(String... templateMNames)
templateMNames - list of template to loadpublic void load(String pattern, String... templateMNames)
pattern - pattern to convert template name to resource pathtemplateMNames - list of template to loadpublic String get(String templateName)
templateName - name of template to returnpublic String render(String template, Map<String,Object> context)
template - template into which to substitute variablescontext - variable substitution mappublic Object doRequest(org.onosproject.netconf.NetconfSession session, String templateName, Map<String,Object> templateContext, String baseXPath, QName returnType) throws org.onosproject.netconf.NetconfException
session - NETCONF serssiontemplateName - name of NETCONF request template to executetemplateContext - variable to values substitutions to be used against templatesbaseXPath - XPath expression to specify the returned document nodereturnType - expected return type of the referenced nodebaseXPathorg.onosproject.netconf.NetconfException - if any IO, XPath, or NETCONF exception occurspublic Node doRequest(org.onosproject.netconf.NetconfSession session, String templateName) throws org.onosproject.netconf.NetconfException
/rpc-reply/data section of the response document as a
Node.session - NETCONF sessiontemplateName - name of NETCONF request template to executeorg.onosproject.netconf.NetconfException - if any IO, XPath, or NETCONF exception occurspublic Node doRequest(org.onosproject.netconf.NetconfSession session, String templateName, Map<String,Object> templateContext) throws org.onosproject.netconf.NetconfException
/rpc-reply/data section of the
response document as a Node.session - NETCONF sessiontemplateName - name of NETCONF request template to executetemplateContext - variables to substitute into the templateorg.onosproject.netconf.NetconfException - if any IO, XPath, or NETCONF exception occurs