Package dev.galasa.zosliberty
Interface IZosLibertyServerXml
public interface IZosLibertyServerXml
Represents the server.xml configuration file in a zOS Liberty Server.
NOTE: The IZosLibertyServerXml
object may not be the same as the content of the server.xml
on the
zOS UNIX file system.
Use the loadFromFileSystem()
method to update the object with the content of the server.xml
on the
zOS UNIX file system.
Use the store()
method to update the the server.xml
on the zOS UNIX file system with with the content of the object.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addCommentsBefore
(Element element, String... comments) Add one or more XML comment before the supplied XML elementaddCompoundElement
(String elementName, Map<String, String> elementAttributes, IZosLibertyServerXmlElementList subElements) Add a compound XML element to the Liberty server.xml Document objectaddCompoundElementToParent
(Element parent, String elementName, Map<String, String> elementAttributes, IZosLibertyServerXmlElementList subElements) Add a compound XML element as a child to supplied XML element in the Liberty server.xml Document objectaddElement
(String elementName, Map<String, String> elementAttributes) Add a simple XML element to the Liberty server.xml Document objectAdd a simple XML element as a child to supplied XML element in the Liberty server.xml Document objectaddTextContextElement
(Element parent, String elementName, String elementText) Add a text context XML element as a child to supplied XML element in the Liberty server.xml Document objectGet the Liberty server.xml object as aDocument
Get the Liberty server.xml object as aString
Get the Liberty server.xml as aIZosUNIXFile
getElements
(String elementName) Get an list of XML elements from the Liberty server.xml Document object.
N.B.getElementsById
(String elementName, String id) Get an list of XML elements from the Liberty server.xml Document object.
N.B.void
Update the content of theIZosLibertyServerXml
with the content of the server.xml file from the zOS UNIX file systemmodifyElementAttributes
(Element element, Map<String, String> attributes) Add or replace attributes in supplied XML element.Create anIZosLibertyServerXmlElementList
removeElementAttribute
(Element element, String attribute) Remove an attribute from supplied XML elementvoid
removeElements
(String elementName) Remove all XML elements with specified name from the Liberty server.xml Document objectvoid
removeElementsById
(String elementName, String id) Remove all XML elements with specified name and id from the Liberty server.xml Document objectvoid
removeTextContextElement
(Element parent, String elementName, String elementText) Remove a text context XML element in the Liberty server.xml Document objectvoid
saveToResultsArchive
(String rasPath) Store the content of the Liberty server.xml to the Results Archive Storevoid
setFromDocument
(Document serverXml) Replace the Liberty server.xml object fromDocument
contentvoid
setFromString
(String serverXml) Replace the Liberty server.xml object fromString
contentvoid
setFromZosUNIXFile
(IZosUNIXFile serverXml) Replace the Liberty server.xml object fromIZosUNIXFile
contentvoid
store()
Create or replace the server.xml file on the zOS UNIX file system
-
Method Details
-
setFromDocument
Replace the Liberty server.xml object fromDocument
content- Parameters:
serverXml
- the server.xml content- Throws:
ZosLibertyServerException
-
setFromString
Replace the Liberty server.xml object fromString
content- Parameters:
serverXml
- the server.xml content- Throws:
ZosLibertyServerException
-
setFromZosUNIXFile
Replace the Liberty server.xml object fromIZosUNIXFile
content- Parameters:
serverXml
- the server.xml content- Throws:
ZosLibertyServerException
-
getAsDocument
Get the Liberty server.xml object as aDocument
- Returns:
- the content of the Liberty server.xml
- Throws:
ZosLibertyServerException
-
getAsString
Get the Liberty server.xml object as aString
- Returns:
- the content of the Liberty server.xml
- Throws:
ZosLibertyServerException
-
getAsZosUNIXFile
Get the Liberty server.xml as aIZosUNIXFile
- Returns:
- the Liberty server.xml file
- Throws:
ZosLibertyServerException
-
store
Create or replace the server.xml file on the zOS UNIX file system- Throws:
ZosLibertyServerException
-
loadFromFileSystem
Update the content of theIZosLibertyServerXml
with the content of the server.xml file from the zOS UNIX file system- Throws:
ZosLibertyServerException
-
saveToResultsArchive
Store the content of the Liberty server.xml to the Results Archive Store- Parameters:
rasPath
- path in Results Archive- Throws:
ZosLibertyServerException
-
getElements
Get an list of XML elements from the Liberty server.xml Document object.
N.B. a list is returned because there may be more than on instance of the named XML element in the Document- Parameters:
elementName
- the XML element name- Throws:
ZosLibertyServerException
-
getElementsById
Get an list of XML elements from the Liberty server.xml Document object.
N.B. a list is returned because there may be more than on instance of the named XML element in the Document- Parameters:
elementName
- the XML element nameid
- the id of the named XML element- Throws:
ZosLibertyServerException
-
addElement
Element addElement(String elementName, Map<String, String> elementAttributes) throws ZosLibertyServerExceptionAdd a simple XML element to the Liberty server.xml Document object- Parameters:
elementName
- the XML element nameelementAttributes
- the XML element attributes- Returns:
- the newly added XML element
- Throws:
ZosLibertyServerException
-
addElementToParent
Element addElementToParent(Element parent, String elementName, Map<String, String> elementAttributes) throws ZosLibertyServerExceptionAdd a simple XML element as a child to supplied XML element in the Liberty server.xml Document object- Parameters:
parent
- the parent XML elementelementName
- the XML element nameelementAttributes
- the XML element attributes- Returns:
- the newly added XML element
- Throws:
ZosLibertyServerException
-
addCompoundElement
Element addCompoundElement(String elementName, Map<String, String> elementAttributes, IZosLibertyServerXmlElementList subElements) throws ZosLibertyServerExceptionAdd a compound XML element to the Liberty server.xml Document object- Parameters:
elementName
- the XML element nameelementAttributes
- the XML element attributessubElements
- anIZosLibertyServerXmlElementList
of sub XML elements- Returns:
- the newly added XML element
- Throws:
ZosLibertyServerException
-
addCompoundElementToParent
Element addCompoundElementToParent(Element parent, String elementName, Map<String, String> elementAttributes, IZosLibertyServerXmlElementList subElements) throws ZosLibertyServerExceptionAdd a compound XML element as a child to supplied XML element in the Liberty server.xml Document object- Parameters:
parent
- the parent XML elementelementName
- the XML element nameelementAttributes
- the XML element attributessubElements
- anIZosLibertyServerXmlElementList
of sub XML elements- Returns:
- the newly added XML element
- Throws:
ZosLibertyServerException
-
modifyElementAttributes
Add or replace attributes in supplied XML element. If any of the supplied attributes match an existing attribute, the value will be replaced otherwise the supplied attribute will be added.- Parameters:
element
- the XML elementattributes
- the new XML element attributes- Returns:
- the modified XML element
-
addTextContextElement
Element addTextContextElement(Element parent, String elementName, String elementText) throws ZosLibertyServerException Add a text context XML element as a child to supplied XML element in the Liberty server.xml Document object- Parameters:
parent
- the parent XML elementelementName
- the XML element nameelementText
- the XML element text- Returns:
- the newly added XML element
- Throws:
ZosLibertyServerException
-
addCommentsBefore
Add one or more XML comment before the supplied XML element- Parameters:
element
- the XML elementcomments
- the comments to add- Throws:
ZosLibertyServerException
-
removeElements
Remove all XML elements with specified name from the Liberty server.xml Document object- Parameters:
elementName
- the XML element name- Throws:
ZosLibertyServerException
-
removeElementsById
Remove all XML elements with specified name and id from the Liberty server.xml Document object- Parameters:
elementName
- the XML element nameid
- the XML element id- Throws:
ZosLibertyServerException
-
removeElementAttribute
Remove an attribute from supplied XML element- Parameters:
element
- the XML elementattribute
- the attribute to remove- Returns:
- the modified XML element
-
removeTextContextElement
Remove a text context XML element in the Liberty server.xml Document object- Parameters:
parent
- the parent XML elementelementName
- the XML element nameelementText
- the XML element text- Throws:
ZosLibertyServerException
-
newElementList
IZosLibertyServerXmlElementList newElementList()Create anIZosLibertyServerXmlElementList
- Returns:
IZosLibertyServerXmlElementList
-