com.xmatters.ibm.tivoli.util
Class SyncUtil

java.lang.Object
  extended by com.xmatters.ibm.tivoli.util.BaseUtil
      extended by com.xmatters.ibm.tivoli.util.SyncUtil

public class SyncUtil
extends BaseUtil

Utility class that holds the configuration information for locating and updating Tivoli SRM Persons/Groups into AlarmPoint

Author:
bneate

Nested Class Summary
 
Nested classes/interfaces inherited from class com.xmatters.ibm.tivoli.util.BaseUtil
BaseUtil.ResourceResolver, BaseUtil.TransformerErrorListener
 
Field Summary
 java.lang.String DELETABLE_XPATH
           
 java.lang.String SEED_ONLY_XPATH
           
 
Fields inherited from class com.xmatters.ibm.tivoli.util.BaseUtil
CONFIGURATION_PATH, configured, logger, PROPERTIES_FILE
 
Constructor Summary
SyncUtil()
           
 
Method Summary
 java.lang.String getApUrl()
           
 java.lang.String getApWSCompany()
           
 java.lang.String getApWSPass()
           
 java.lang.String getApWSUrl()
           
 java.lang.String getApWSUser()
           
 java.lang.String getDeviceTrigger()
           
 java.lang.String getElementValue(org.dom4j.Node document, java.lang.String xpath)
          Get the value of the element matched by the XPath expression
 java.lang.String getGroupDeleteXPath()
           
 java.lang.String getGroupObjectStructure()
           
 java.lang.String getMaximoWSPass()
           
 java.lang.String getMaximoWSUrl()
           
 java.lang.String getMaximoWSUser()
           
 java.lang.String getPersonDeleteXPath()
           
 java.lang.String getPersonObjectStructure()
           
 java.lang.String getPersonRootNode()
           
 java.lang.String getPhoneNumXpath()
           
 SyncAction getSyncAction(org.dom4j.Document seedOnlyDeletableDocument, org.dom4j.Document deleteDocument, java.lang.String deleteXPath, boolean existsInAlarmPoint)
          Used to determine the action that needs to be taken to sync this object with AlarmPoint.
 java.lang.String getTeamGroupNameXPath()
           
 java.lang.String getUserRootNode()
           
 boolean isDeletable(org.dom4j.Document document)
          Checks for a deletable attribute on the root element of the Document
 boolean isDeleteAction(org.dom4j.Document document, java.lang.String deleteXPath)
          Uses the specified XPath expression to determine if the AlarmPoint object should be deleted or not.
 boolean isSeedOnly(org.dom4j.Document document)
          Checks for a seedOnly attribute on the root element of the Document
static java.lang.String regex(java.lang.String string, java.lang.String regex)
          Applies a regular expression to a string and returns the first match
static java.lang.String regex(java.lang.String string, java.lang.String regex, int index)
          Applies a regular expression to a string and returns the result at a specified index
 void setApUrl(java.lang.String apUrl)
           
 void setApWSCompany(java.lang.String apWSCompany)
           
 void setApWSPass(java.lang.String apWSPass)
           
 void setApWSUrl(java.lang.String apWSUrl)
           
 void setApWSUser(java.lang.String apWSUser)
           
 void setDeviceTrigger(java.lang.String deviceTrigger)
           
 void setGroupDeleteXPath(java.lang.String groupDeleteXPath)
           
 void setGroupObjectStructure(java.lang.String groupObjectStructure)
           
 void setMaximoWSPass(java.lang.String maximoWSPass)
           
 void setMaximoWSUrl(java.lang.String maximoWSUrl)
           
 void setMaximoWSUser(java.lang.String maximoWSUser)
           
 void setPersonDeleteXPath(java.lang.String personDeleteXPath)
           
 void setPersonObjectStructure(java.lang.String personObjectStructure)
           
 void setPersonRootNode(java.lang.String personRootNode)
           
 void setPhoneNumXpath(java.lang.String phoneNumXpath)
           
 void setTeamGroupNameXPath(java.lang.String teamGroupNameXPath)
           
 void setUserRootNode(java.lang.String userRootNode)
           
 
Methods inherited from class com.xmatters.ibm.tivoli.util.BaseUtil
addElement, addElement, getConfPath, getJavaClientUrl, getWorkflowAssignmentTimeout, getWorkflowAssignmentWaitTime, isConfigured, loadPropertiesFile, moveFile, postToJavaClient, setConfPath, setJavaClientUrl, setWorkflowAssignmentTimeout, setWorkflowAssignmentWaitTime, transformDocument
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SEED_ONLY_XPATH

public final java.lang.String SEED_ONLY_XPATH
See Also:
Constant Field Values

DELETABLE_XPATH

public final java.lang.String DELETABLE_XPATH
See Also:
Constant Field Values
Constructor Detail

SyncUtil

public SyncUtil()
Method Detail

regex

public static java.lang.String regex(java.lang.String string,
                                     java.lang.String regex)
Applies a regular expression to a string and returns the first match

Parameters:
string - The string to apply the regex to
regex - The regex
Returns:
The first string matching the regex. An empty string if there is no match

regex

public static java.lang.String regex(java.lang.String string,
                                     java.lang.String regex,
                                     int index)
Applies a regular expression to a string and returns the result at a specified index

Parameters:
string - The string to apply the regex to
regex - The regex
index - The index of the desired result
Returns:
A string matching the regex at the specified index. An empty string if there is no match

isSeedOnly

public boolean isSeedOnly(org.dom4j.Document document)
Checks for a seedOnly attribute on the root element of the Document

Parameters:
document - The document to check
Returns:
True if the seedOnly attribute is found and false otherwise

isDeletable

public boolean isDeletable(org.dom4j.Document document)
Checks for a deletable attribute on the root element of the Document

Parameters:
document - The document to check
Returns:
True if the deletable attribute is found and false otherwise

isDeleteAction

public boolean isDeleteAction(org.dom4j.Document document,
                              java.lang.String deleteXPath)
Uses the specified XPath expression to determine if the AlarmPoint object should be deleted or not. If the XPath expression finds a match the object should be deleted.

Parameters:
document - The Document used to apply the XPath expression to
deleteXPath - The XPath expression used to determine if a object should be deleted or not
Returns:
If the object should be deleted or not

getElementValue

public java.lang.String getElementValue(org.dom4j.Node document,
                                        java.lang.String xpath)
Get the value of the element matched by the XPath expression

Parameters:
document - The Document containing the value
xpath - The XPath expression of the element to find
Returns:
The value of the matched element or an empty string if that element cannot be found

getSyncAction

public SyncAction getSyncAction(org.dom4j.Document seedOnlyDeletableDocument,
                                org.dom4j.Document deleteDocument,
                                java.lang.String deleteXPath,
                                boolean existsInAlarmPoint)
Used to determine the action that needs to be taken to sync this object with AlarmPoint.

Parameters:
seedOnlyDeletableDocument - The Document that has been transformed into the AlarmPoint format. This is used to determine if the object is deletable or seed only based on attributes added to the root element
deleteDocument - The Document to apply the deleteXPath to so we can determine if this object needs to be deleted from AP or not
deleteXPath - The XPath expression used to determine if this object need to be deleted or not. If the XPath matches any node that object should be deleted.
existsInAlarmPoint - Should be true if the object already exists in AP and false otherwise.
Returns:
The SyncAction that should take place.

getApWSUrl

public java.lang.String getApWSUrl()

setApWSUrl

public void setApWSUrl(java.lang.String apWSUrl)

getApWSUser

public java.lang.String getApWSUser()

setApWSUser

public void setApWSUser(java.lang.String apWSUser)

getApWSPass

public java.lang.String getApWSPass()

setApWSPass

public void setApWSPass(java.lang.String apWSPass)

getApWSCompany

public java.lang.String getApWSCompany()

setApWSCompany

public void setApWSCompany(java.lang.String apWSCompany)

getMaximoWSUrl

public java.lang.String getMaximoWSUrl()

setMaximoWSUrl

public void setMaximoWSUrl(java.lang.String maximoWSUrl)

getMaximoWSUser

public java.lang.String getMaximoWSUser()

setMaximoWSUser

public void setMaximoWSUser(java.lang.String maximoWSUser)

getMaximoWSPass

public java.lang.String getMaximoWSPass()

setMaximoWSPass

public void setMaximoWSPass(java.lang.String maximoWSPass)

getPersonDeleteXPath

public java.lang.String getPersonDeleteXPath()

setPersonDeleteXPath

public void setPersonDeleteXPath(java.lang.String personDeleteXPath)

getGroupDeleteXPath

public java.lang.String getGroupDeleteXPath()

setGroupDeleteXPath

public void setGroupDeleteXPath(java.lang.String groupDeleteXPath)

getTeamGroupNameXPath

public java.lang.String getTeamGroupNameXPath()

setTeamGroupNameXPath

public void setTeamGroupNameXPath(java.lang.String teamGroupNameXPath)

getPersonObjectStructure

public java.lang.String getPersonObjectStructure()

setPersonObjectStructure

public void setPersonObjectStructure(java.lang.String personObjectStructure)

getGroupObjectStructure

public java.lang.String getGroupObjectStructure()

setGroupObjectStructure

public void setGroupObjectStructure(java.lang.String groupObjectStructure)

setUserRootNode

public void setUserRootNode(java.lang.String userRootNode)

getUserRootNode

public java.lang.String getUserRootNode()

setPersonRootNode

public void setPersonRootNode(java.lang.String personRootNode)

getPersonRootNode

public java.lang.String getPersonRootNode()

setPhoneNumXpath

public void setPhoneNumXpath(java.lang.String phoneNumXpath)

getPhoneNumXpath

public java.lang.String getPhoneNumXpath()

setDeviceTrigger

public void setDeviceTrigger(java.lang.String deviceTrigger)

getDeviceTrigger

public java.lang.String getDeviceTrigger()

setApUrl

public void setApUrl(java.lang.String apUrl)

getApUrl

public java.lang.String getApUrl()