public class TdbXmlRecord extends TdbRecord
Modifier and Type | Class and Description |
---|---|
static class |
TdbXmlRecord.IOMode
The IOMode enum represents various ways that TRIPxml import and export
operations can take place.
|
static class |
TdbXmlRecord.XmlRecordType
For TRIPxml, indicates the type of document that is stored in the record.
|
Constructor and Description |
---|
TdbXmlRecord(TdbSession session)
Constructor, creates a blank TRIPxml record container.
|
TdbXmlRecord(TdbSession session,
java.lang.String name,
boolean createFields)
Constructor, associates the record with thenamed TRIPxml database.
|
TdbXmlRecord(TdbSession session,
TdbDatabaseDesign design,
boolean createFields)
Constructor, associates the record with the provided database design.
|
Modifier and Type | Method and Description |
---|---|
void |
clear(boolean all)
Clear any existing state from the TdbXmlRecord instance.
|
java.lang.String |
getFileName()
Get the name of the exported file.
|
boolean |
getHitMarkup()
Indicates if the exported XML document is to have hit markup applied.
|
TdbXmlRecord.IOMode |
getInputOutputMode()
Get the IO mode to use with this record.
|
int |
getNetworkStreamPort()
The number of the TCP port to use for network streaming based
import and export TRIPxml operations.
|
java.io.OutputStream |
getOutputStream()
Returns the stream that receives data from the XML record.
|
TdbXmlRecord.XmlRecordType |
getRecordType()
Get the type of document this record contains.
|
boolean |
getStoreCopy()
Determines if a binary copy of an imported XML document is to be
stored, or only the parsed version of it.
|
java.lang.String |
getUrlAlias()
Get the URL alias for the document.
|
java.lang.String |
getUrlBase()
Returns the URL base of the document, i.e. the URL without the actual
file name.
|
boolean |
getValidate()
Determines if XML documents are to be validated upon import.
|
boolean |
isXmlRecord()
Indicates if this record is a TRIPxml record.
|
void |
prepareExport()
Prepares to export the contents of the record.
|
void |
prepareExport(java.io.OutputStream os)
Prepares to export the contents of the record to the specified stream.
|
void |
prepareExport(java.lang.String fileOrDir)
Prepares to export the contents of the record to a file.
|
void |
prepareImport(java.io.InputStream stream,
TdbXmlRecord.XmlRecordType type,
java.lang.String fileName)
Prepare to import a document into a TRIPxml database.
|
void |
setHitMarkup(boolean hitMarkup)
Indicates if the exported XML document is to have hit markup applied.
|
void |
setInputOutputMode(TdbXmlRecord.IOMode mode)
Set the IO mode to use with this record.
|
void |
setNetworkStreamPort(int port)
The number of the TCP port to use for network streaming based
import and export TRIPxml operations.
|
void |
setStoreCopy(boolean enable)
Determines if a binary copy of an imported XML document is to be
stored, or only the parsed version of it.
|
void |
setUrlAlias(java.lang.String urlAlias)
Set the URL alias for the document.
|
void |
setValidate(boolean enable)
Determines if XML documents are to be validated upon import.
|
addToTemplate, addToTemplate, addToTemplate, appendComponent, commit, copy, copy, delete, deleteComponent, deleteComponent, get, get, getCategories, getComponent, getComponent, getDatabaseName, getFieldTemplates, getHead, getIndexOnCommit, getNlpInfo, getRank, getRawRank, getRecordId, getRecordName, getTimeStamp, insertAseList, isChanged, isDeleted, isGraphRecord, lock, parts, removeFromTemplate, setDatabaseName, setIndexOnCommit, setPartId, setPartNameField, setRecordId, setRecordName, setRecordNameField, setRecordNumberField, setRetrieveHead, setRetrieveParts, setTemplateMarkup, unlock, updateAseList
codeList, getLastCode, getLastMessage, hasMessages, messageList, resetMessages
cancel, getSession, isCancelable, setCancelable
public TdbXmlRecord(TdbSession session) throws TdbException
session
- Active sessionTdbException
public TdbXmlRecord(TdbSession session, TdbDatabaseDesign design, boolean createFields) throws TdbException
session
- Active sessiondesign
- Database designcreateFields
- If true, the constructor will automatically create a retrieval template using all fields from the database design.TdbException
public TdbXmlRecord(TdbSession session, java.lang.String name, boolean createFields) throws TdbException
session
- Active sessionname
- Name of the TRIPxml database.createFields
- If true, the constructor will automatically create a retrieval template using all fields from the database design.TdbException
public TdbXmlRecord.IOMode getInputOutputMode()
public void setInputOutputMode(TdbXmlRecord.IOMode mode)
public TdbXmlRecord.XmlRecordType getRecordType()
public boolean getHitMarkup()
public void setHitMarkup(boolean hitMarkup)
public int getNetworkStreamPort()
public void setNetworkStreamPort(int port)
port
- Port number to use with network streaming I/O.
If there is a firewall between the client and the server, make
sure that you specify a port number from a range that is enabled
in the firewall.
Remember to set the InputOutputMode property to IOMode.Stream
in order to use network streaming.
Also remember that in multithreaded situations, there
may be multiple TdbXmlRecord exports and imports active simultaneously.
Unless the port number is set to 0 (zero), the application is in such
cases responsble for making sure that only available port numbers are
used.public java.lang.String getFileName()
public boolean getValidate()
public void setValidate(boolean enable)
enable
- Pass true if validation is to take place.public boolean getStoreCopy()
public void setStoreCopy(boolean enable)
enable
- Pass true to store a binary copy.public java.lang.String getUrlAlias()
The URL alias is the "real" URL of the document, i.e. the URL that is used to link two documents together via an XLink, for example. The URL alias is identical to the URL base and filename unless the URL alias has been explicitly specified to be something else during the import process.
public void setUrlAlias(java.lang.String urlAlias)
The URL alias is the "real" URL of the document, i.e. the URL that is used to link two documents together via an XLink, for example. The URL alias is identical to the URL base and filename unless the URL alias has been explicitly specified to be something else during the import process.
public java.lang.String getUrlBase() throws TdbException
If the document was imported from a file (e.g. using the server-side txput tool), then this property will be empty.
TdbException
public java.io.OutputStream getOutputStream()
public void clear(boolean all)
public boolean isXmlRecord()
isXmlRecord
in class TdbRecord
public void prepareImport(java.io.InputStream stream, TdbXmlRecord.XmlRecordType type, java.lang.String fileName) throws TdbException
stream
- The stream from which to load the data to import.type
- The type of the file (if known)fileName
- The name of the file (if known)TdbException
- This method does not perform the actual import operation. This is done when the Commit method is called. This allows for other data to be sent as well (e.g. assigning values to custom TRIPxml database fields).
If the 'type' parameter is XmlRecordType.UNKNOWN, then this method will try to ascertain the type from the provided file name. If the file name is not specified and the type is XmlRecordType.UNKNOWN, this method will throw an exception.
Direct file import is possible if the stream parameter is set to null, the filename refers to an existing local file and the TRIPjxp application is running on the same machine as the TRIP server the current session is connected to. Also remember to call setInputOutputMode with IOMode.File as argument before calling Commit.
public void prepareExport()
This method does not perform the actual export operation. This is done when the get() method is called.
The method getOutputStream() returns a ByteArrayOutputStream with the receieved data when the get() method has completed successfully.
This method is only compatible with the IOMode.Inline I/O mode. Do not try to override this by assigning any other value the InputOutputMode property.
public void prepareExport(java.io.OutputStream os)
os
- Stream to export to.
This method does not perform the actual export operation. This is done when the get() method is called.
This method is not compatible with the file-based I/O. Avoid IOMode.File as argument when calling the setInputOutputMode() method.
public void prepareExport(java.lang.String fileOrDir) throws TdbException
fileOrDir
- Name of file or directory
If the 'fileOrDir' parameter is a directory, the name of the file (minus the path) will be read from the D_DOCNAME field and created in the specified directory. In any other case, the 'fileOrDir' parameter MUST refer to a file (which does not have to exist yet, of course).
TdbException