Package com.tailf.navu
Class PreparedXMLStatement
Object
com.tailf.navu.PreparedXMLStatement
This class represents a parsed XML-string, optionally with parameterized
values. The string "?" denotes a value that is unknown at the
time when the XML-string is parsed. The "?"-strings
can be replaced by actual values at a later time.
The put()
method is used to replace a "?" parameter
with its actual ConfValue
. The parameter index is zero-based.
When all "?" parameters have been replaced,
setValues()
can be issued which will insert or replace
(if values already exist) the configuration tree specified by the
XML-string at the location where prepareXMLCall
was
called.
If a parameter is not replaced by a value before a setValues()
occurs, the value is treated as a ConfDefault
.
No validation of data types occurs when put()
is called, but
setValues()
will fail if a parameter is set to a type other
than the one mandated by the YANG-model.
module mtest { namespace "http://tail-f.com/test/mtest/1.0"; prefix mtest; import ietf-inet-types { prefix inet; } container mtest { container servers { list server { key name; max-elements 64; leaf name { type string; } leaf ip { type inet:host; mandatory true; } leaf port { type inet:port-number; default 80; } list interface { key name; max-elements 8; leaf name { type string; } leaf mtu { type int64; default 1500; } } } } } }PreparedXMLStatement xmlst = serversNavuNode.prepareXMLCall("<server>" + "<name>?</name>" + "<ip>?</ip>" + "<port>?</port>" + "</server>"); xmlst.put(0, "www1"); xmlst.put(1, new ConfIPv4("192.168.10.12")); xmlst.put(2, new ConfUInt16(80)); xmlst.setValues();
-
Constructor Summary
ConstructorsConstructorDescriptionPreparedXMLStatement
(ConfXMLParam[] params, Map<Integer, Object[]> paramInfoMap, NavuNode node) -
Method Summary
Modifier and TypeMethodDescriptionvoid
put
(int index, ConfObject val) Populate the parameterized value at positionindex
with the valueval
.void
Populate the parameterized value at positionindex
with the valuestrval
.void
reset()
void
When all of the parameterized values have been filled in, this method is intended to be invoked for a final set operation with the given values.void
setValues
(NavuContext context) When all of the parameterized values have been filled in, this method is intended to be invoked for a final set operation with the given values.void
Similar tosetValues(NavuContext)
but uses the context of the supplied node.void
Variant ofsetValues()
with FastMap support.void
sharedSetValues
(NavuContext context) Variant ofsetValues(NavuContext)
with FastMap support.void
sharedSetValues
(NavuNode node) Variant ofsetValues(NavuNode)
with FastMap support.
-
Constructor Details
-
Method Details
-
put
Populate the parameterized value at positionindex
with the valueval
. The first parameter has index 0.- Parameters:
index
- zero-based index of the parameterval
- the value to give to the parameter
-
put
Populate the parameterized value at positionindex
with the valuestrval
. The first parameter has index 0. The input string is converted to the appropriate data type as specified by the current schema.- Parameters:
index
- zero-based index of the parameterstrval
- string representation of the value to give to the parameter
-
reset
public void reset() -
setValues
When all of the parameterized values have been filled in, this method is intended to be invoked for a final set operation with the given values.- Throws:
NavuException
-