Package tethys.dbxml
Class DBXMLConnect
java.lang.Object
tethys.dbxml.DBXMLConnect
Class containing functions for managing the database connection. Opening, closing,
writing, keeping track of performance, etc.
- Author:
- Doug Gillespie, Katie O'Laughlin
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGet a temp folder to hold xml output.void
createTempXMLDocument
(Object nilusObject) Create a temporary nilus file.createXMLDocument
(Object nilusObject, File file) Convert a nilus Object into a fileboolean
deleteDeployment
(String deploymentId) Delete a Deploymnet and any contained Detections document.boolean
deleteDocument
(Object nilusDocument) Delete a nilus document from the database.static String
getDocumentId
(Object nilusObject) Get a document Id string.dbxml.JerseyClient
Get the client.dbxml.Queries
Get the Queries object.boolean
Get the server state via a ping ?boolean
postAndLog
(Object nilusObject) boolean
postAndLog
(Object nilusObject, String documentName) I don't think this should ever be used since everything goes a bit pear shaped if the documentName isn't the same as the Id.boolean
removeDocument
(String collectionName, String documentName) Remove a document based on a collection name and a document namw.boolean
removeDocument
(Collection collection, String documentName) Remove a document based on a collection name and a cdocument Id.boolean
updateDocument
(Object nilusDocument) Update a document within Tethys.
-
Constructor Details
-
DBXMLConnect
-
-
Method Details
-
getJerseyClient
public dbxml.JerseyClient getJerseyClient()Get the client. The client will only be recreated if the url changes- Returns:
- Jersy client
-
getTethysQueries
public dbxml.Queries getTethysQueries()Get the Queries object. This will only be recreated if the client changes.- Returns:
-
createXMLDocument
Convert a nilus Object into a file- Parameters:
nilusObject
- nilus objectfile
- file (should not exist)- Returns:
- file (will be the same as input file)
- Throws:
TethysException
-
createTempXMLDocument
Create a temporary nilus file.- Parameters:
nilusObject
-- Returns:
- Throws:
TethysException
-
postAndLog
- Throws:
TethysException
-
postAndLog
I don't think this should ever be used since everything goes a bit pear shaped if the documentName isn't the same as the Id. However, for Calibration documents this is no longer the case, since a Calibration can have multiple entries on different dates, so allow it !- Parameters:
nilusObject
-documentName
-- Returns:
- Throws:
TethysException
-
updateDocument
Update a document within Tethys. We're assuming that a document with the same name in the same collection already exists. If it doesn't / has a different name, then use the removedocument function- Parameters:
nilusDocument
-- Returns:
- Throws:
TethysException
-
deleteDocument
Delete a nilus document from the database. The only field which needs to be populated here is the Id. The code also uses the object class to identify the correct collection.- Parameters:
nilusDocument
-- Returns:
- Throws:
TethysException
-
deleteDeployment
Delete a Deploymnet and any contained Detections document. Doesn't work !- Parameters:
deploymentId
-- Returns:
- Throws:
TethysException
-
removeDocument
Remove a document based on a collection name and a cdocument Id.- Parameters:
collection
- collection name.documentName
- document name (not the internal Document Id)- Returns:
- Throws:
TethysException
-
removeDocument
Remove a document based on a collection name and a document namw.- Parameters:
collectionName
- collection name.documentName
- document name (not the internal Document Id)- Returns:
- Throws:
TethysException
-
checkTempFolder
Get a temp folder to hold xml output. This will be the standard temp folder + /PAMGuardTethys. Files will be left here until PAMGUard exits then should delete automatically -
getDocumentId
Get a document Id string. All Document objects should have a getId() function however they do not have a type hierarchy, so it can't be accessed directly. instead go via the class.getDeclaredMethod function and it should be possible to find it.- Parameters:
nilusObject
-- Returns:
- document Id for any type of document, or null if the document doesn't have a getID function
-
openConnections
public boolean openConnections() -
closeConnections
public void closeConnections() -
pingServer
Get the server state via a ping ?- Returns:
- Server state ?
-