|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Thread
chemaxon.jchem.db.Importer
public class Importer
Tool for importing molecules to database tables from a File or InputStream object. Example of usage: File Import/Export Tools.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary |
|---|
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Fields inherited from interface chemaxon.jchem.db.Transfer |
|---|
CXSMARTS, CXSMILES, INCHI, JTF, MOL2FILE, MOLFILE, MRV, RDFILE, RXNFILE, SDFILE, SMARTS, SMILES, VMN |
| Constructor Summary | |
|---|---|
Importer()
Constructor. |
|
| Method Summary | |
|---|---|
void |
cancel()
Stops the importing progress. |
ConnectionHandler |
getConnectionHandler()
Getter for property connectionHandler. |
java.lang.String |
getConnections()
Deprecated. since 2.2 replaced by getFieldConnections(). |
java.util.ArrayList<java.lang.Integer> |
getDuplicateIDs()
Returns the IDs (cd_id column in database table) of duplicate structures. |
int |
getDuplicates()
Returns the number of molecules that were not imported, because they are duplicates. |
int |
getEmptyStructures()
Returns the number of molecules that were not imported, because they are empty strucures. |
boolean |
getEmptyStructuresAllowed()
Gets whether empty structures are allowed. |
java.lang.Throwable |
getErrorCause()
Retrieves Throwable caught in run() method. |
java.lang.String |
getErrorMessage()
If error occures this function returns the error message. |
java.lang.String |
getFieldConnections()
Returns the specified table field - file field pairs. |
java.util.Vector<java.lang.String> |
getFieldNames()
Returns field names in an SDfile. |
static java.util.Vector<java.lang.String> |
getFieldNames(java.io.InputStream is,
int linesToCheck)
Returns field names in an SDfile. |
IntArray |
getImportedIDs()
Returns the IDs (cd_id column in database table) of imported structures. |
int |
getImportedNumber()
Returns the number of imported molecules. |
java.lang.Object |
getInput()
Gets the source object. |
int |
getLinesToCheck()
Gets the number of lines to check for file format. |
java.lang.String |
getNameFieldInDB()
|
java.lang.String |
getNote()
Returns the note of the progresswriter. |
long |
getProgress()
Gets the status of the importing progress. |
ProgressWriter |
getProgressWriter()
Gets the ProgressWriter object used for monitoring. |
boolean |
getSetChiralFlag()
Gets whether chiral flag is set on import. |
int |
getSkip()
Gets the number of molecules to skip from the beginning ogf file. |
int |
getStructCount()
Returns the current count of structures which were examined by the import process. |
java.lang.String |
getTableName()
Gets the name of the table to import into. |
int |
importMols()
Imports molecules. |
void |
init()
Initialization, checking given number of lines for file format and fields. |
boolean |
isDuplicateImportAllowed()
Gets whether duplicate structures are allowed. |
boolean |
isFinished()
Returns true if importing has finished, else returns false. |
boolean |
isHaltOnError()
Gets if import should stop when an error occures. |
void |
run()
Starts execution as a thread. |
void |
setConnectionHandler(ConnectionHandler conh)
Setter for property connectionHandler. |
void |
setConnections(java.lang.String connections)
Deprecated. since 2.2 replaced by setFieldConnections(String). |
void |
setDuplicateImportAllowed(boolean b)
Deprecated. since JChem 5.4. This import option has been table option, instead of this use setDuplicateImportAllowed(int) method |
void |
setDuplicateImportAllowed(int duplicateFilteringOption)
Sets the duplicate filtering option on import. |
void |
setEmptyStructuresAllowed(boolean b)
If set to false does not import empty molecules. |
void |
setFieldConnections(java.lang.String connections)
Specifies which data fields correspond to which table fieds. |
void |
setHaltOnError(boolean b)
Sets if import should stop when an error occures. |
void |
setInfoStream(java.io.PrintStream st)
Sets the stream where information about the import prorcess will be written (e.g. skipped duplicates and empty structures). |
void |
setInput(java.io.File inputFile)
Sets the source object as a file. |
void |
setInput(java.io.InputStream is)
Sets the source object as a stream. |
void |
setInput(java.lang.String fileName)
Sets the source object as a file, specifying the name of the file. |
void |
setLinesToCheck(int linesToCheck)
Sets the number of lines to check for file format. |
void |
setNameFieldInDB(java.lang.String fieldName)
Set a DB field to contain the structure name. |
void |
setOutputOptions(boolean printDuplicates,
boolean printNonDuplicates,
java.io.OutputStream os,
boolean doNotImport)
With this option one can print duplicate or non-duplicate molecules to a stream. |
void |
setProgressWriter(ProgressWriter pwriter)
Sets the ProgressWriter
object to track the progress the actual importing. |
void |
setSetChiralFlag(boolean setChiralFlag)
Sets if chiral flag should be set to true during import. |
void |
setSkip(int skip)
Sets the number of molecules to skip from the beginning ogf file. |
void |
setStoreDuplicates(boolean value)
Specifies whether the ID's of duplicate structures should be stored. |
void |
setStoreImportedIDs(boolean value)
Specifies whether the ID's of imported structures should be stored. |
void |
setTableName(java.lang.String tname)
Sets the name of the table to import into. |
void |
skip(int offset)
Skips the given number of molecules. |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Importer()
| Method Detail |
|---|
public void setConnectionHandler(ConnectionHandler conh)
conh - the connection handlerpublic ConnectionHandler getConnectionHandler()
public void setInput(java.io.File inputFile)
inputFile - the source filepublic void setInput(java.io.InputStream is)
is - the source streampublic void setInput(java.lang.String fileName)
fileName - the source file namepublic java.lang.Object getInput()
File or InputStream.
public void setTableName(java.lang.String tname)
tname - the table namepublic java.lang.String getTableName()
@Deprecated public void setConnections(java.lang.String connections)
setFieldConnections(String).
The fields are given in pair in the following format: "databaseField1=dataField1;databaseField2=dataField2"
null, the fields are automatically connected by
equal names (default).
connections - the connection stringpublic void setFieldConnections(java.lang.String connections)
The fields are given in pair in the following format: "databaseField1=dataField1;databaseField2=dataField2"
null, the fields are automatically connected by
equal names (default).
connections - the connection string@Deprecated public java.lang.String getConnections()
getFieldConnections().
public java.lang.String getFieldConnections()
public void setLinesToCheck(int linesToCheck)
linesToCheck - the number of lines to check for file formatpublic int getLinesToCheck()
public void setProgressWriter(ProgressWriter pwriter)
ProgressWriter
object to track the progress the actual importing.
(Format checking and skipping not monitored by this object.)
null if no
monitoring is necessary.
pwriter - the progress writerpublic ProgressWriter getProgressWriter()
public void setHaltOnError(boolean b)
b - true if halt on errorpublic boolean isHaltOnError()
true if halt on error@Deprecated public void setDuplicateImportAllowed(boolean b)
setDuplicateImportAllowed(int) method
false does not import molecules
that already exist in the table with the same topology. This checking
may slow down the import progress.
DatabaseProperties.setDuplicateFilteringOption(String, boolean),
StructureTableOptions.duplicateFilteringpublic void setDuplicateImportAllowed(int duplicateFilteringOption)
duplicateFilteringOption - DUPLICATE_FILTERING_ON does not
import molecules that already exist in the table with the same topology.
Forces switching ON duplicate filtering regardless of table setting.
This checking
may slow down the import progress. DUPLICATE_FILTERING_OFF duplicates are allowed.
Forces switching OFF duplicate filtering regardless of table setting. DUPLICATE_FILTERING_TABLE_OPTION the value of the table
option (StructureTableOptions.duplicateFiltering) controls the filtering of duplicates.UpdateHandler.DUPLICATE_FILTERING_ON,
UpdateHandler.DUPLICATE_FILTERING_OFF,
UpdateHandler.DUPLICATE_FILTERING_TABLE_OPTION,
StructureTableOptions.duplicateFilteringpublic boolean isDuplicateImportAllowed()
java.lang.IllegalArgumentException - if duplicate filtering option of the table cannot be determined.public void setEmptyStructuresAllowed(boolean b)
false does not import empty molecules.
public boolean getEmptyStructuresAllowed()
public void setSetChiralFlag(boolean setChiralFlag)
true during import.
setChiralFlag - if set to true, chiral flag is
set to true for imported molecules.
The default setting is false.
since 2.3public boolean getSetChiralFlag()
public void setNameFieldInDB(java.lang.String fieldName)
fieldName - public java.lang.String getNameFieldInDB()
public boolean isFinished()
true if importing has finished, else returns false.
public java.lang.String getErrorMessage()
public java.lang.Throwable getErrorCause()
run() method.
WARNING This mechanism is expected to be revised in
the near future, use with extreme caution!
nullpublic int getStructCount()
public int getImportedNumber()
public int getDuplicates()
public int getEmptyStructures()
public java.lang.String getNote()
public void setSkip(int skip)
public int getSkip()
public long getProgress()
public void run()
run in interface java.lang.Runnablerun in class java.lang.Threadpublic void setInfoStream(java.io.PrintStream st)
st - the stream.
The default is null (no info is written).
public void setOutputOptions(boolean printDuplicates,
boolean printNonDuplicates,
java.io.OutputStream os,
boolean doNotImport)
public void setStoreDuplicates(boolean value)
public void setStoreImportedIDs(boolean value)
getImportedIDs()public java.util.ArrayList<java.lang.Integer> getDuplicateIDs()
public IntArray getImportedIDs()
setStoreImportedIDs(boolean)
public int importMols()
throws TransferException
TransferExceptionpublic void cancel()
public void skip(int offset)
throws TransferException
offset - the number of molecules to be skipped
TransferException
public void init()
throws TransferException
skip or importMols if necessary.
TransferException
public java.util.Vector<java.lang.String> getFieldNames()
throws TransferException,
java.io.IOException
int if initialization is necessary.
TransferException
java.io.IOException
public static java.util.Vector<java.lang.String> getFieldNames(java.io.InputStream is,
int linesToCheck)
throws java.io.IOException,
MRecordParseException
java.io.IOException
MRecordParseException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||