|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.di.connector.Connector
com.ibm.di.connector.filemanagement.FileManagementConnector
public class FileManagementConnector
Connector which can read or modify files structure and metadata. It can create, find and delete files and directories. It works on Iterator, Lookup, Delete, AddOnly or Update modes.
Field Summary |
---|
Fields inherited from class com.ibm.di.connector.Connector |
---|
ALL_MODES, myLog, PROPERTY_MESSAGE, PROPERTY_READER, PROPERTY_WRITER |
Constructor Summary | |
---|---|
FileManagementConnector()
Constructor. |
Method Summary | |
---|---|
void |
deleteEntry(Entry entry,
SearchCriteria searchCrit)
Deletes an existing entry. |
Entry |
findEntry(SearchCriteria searchCrit)
Finds an existing entry. |
void |
forceDelete(File fileToDelete)
Delete the given file or directory. |
void |
forceDelete(String filePathToDelete)
Delete the file or directory which path is provided. |
Entry |
getNextEntry()
Returns the next Entry from the connector. |
String |
getVersion()
Version information. |
void |
initialize(Object o)
Initialize the connector. |
void |
modEntry(Entry newEntry,
SearchCriteria searchCrit)
Modifies an existing entry. |
void |
modEntry(Entry newEntry,
SearchCriteria searchCrit,
Entry oldEntry)
Modifies an existing entry. |
void |
putEntry(Entry newEntry)
Adds a new entry to the data source |
void |
selectEntries()
Prepare the Connector for sequential read. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.ibm.di.connector.ConnectorInterface |
---|
getConfiguration, getContext, getFindEntryCount, getFirstFindEntry, getMaxDuplicateEntries, getName, getNextClient, getNextFindEntry, getParam, getPushbackEntry, getRawConnectorConfiguration, isDeltaSupported, isExceptionFatal, isIOException, pushback, queryOperations, queryReply, querySchema, reconnect, registerScriptBeans, replyEntry, setConfiguration, setContext, setCurrent, setLog, setMaxDuplicateEntries, setName, setParam, setRSInterface, terminate, terminateServer |
Constructor Detail |
---|
public FileManagementConnector()
Method Detail |
---|
public void initialize(Object o) throws Exception
initialize
in interface ConnectorInterface
initialize
in class Connector
o
- User provided parameter
Exception
- if the initialization of this connector fails.public void selectEntries() throws Exception
selectEntries
in interface ConnectorInterface
selectEntries
in class Connector
Exception
- if startDirectory parameter is not name of existing directory
or maxDirDepth is negative.public Entry getNextEntry() throws Exception
Example:
var ctor = input.getConnector(); var entry = ctor.getNextEntry(); for (; entry != null; entry = ctor.getNextEntry()) { main.logmsg("Read entry..."); main.dumpEntry(entry); }
getNextEntry
in interface ConnectorInterface
getNextEntry
in class Connector
Exception
- if an error occurs.ConnectorInterface.selectEntries()
public Entry findEntry(SearchCriteria searchCrit) throws Exception
Here is an example of how to find all people with names starting with 'J' which are from IBM organization in US.
Example:
var ctor = input.getConnector(); var crit = new com.ibm.di.SearchCriteria("$dn", com.ibm.di.SearchCriteria.SUBSTRING, "c=US,o=IBM"); crit.addCriteria("name", com.ibm.di.SearchCriteria.INITIAL_STRING, "J"); crit.addCriteria("objectclass", com.ibm.di.SearchCriteria.SUBSTRING, "person"); var res = ctor.findEntry(crit); if (res != null) { main.logmsg("Found entry:"); main.dumpEntry(res); } else { if( getFindEntryCount()> 1 ){ main.logmsg("Found these entries:"); while ( (entry = ctor.getNextFindEntry()) != null ) { main.dumpEntry(entry); } } else { main.logmsg("Entry not found!"); } }
findEntry
in interface ConnectorInterface
findEntry
in class Connector
searchCrit
- The search criteria used to locate the entry to be modified
Exception
- if an error occurs.public void deleteEntry(Entry entry, SearchCriteria searchCrit) throws Exception
deleteEntry
in interface ConnectorInterface
deleteEntry
in class Connector
entry
- The entry datasearchCrit
- The search criteria used to locate the entry to be deleted
Exception
- if an error occurs.public void forceDelete(String filePathToDelete) throws Exception
filePathToDelete
- to be deleted.
Exception
- if the file or directory cannot be deleted.public void forceDelete(File fileToDelete) throws Exception
fileToDelete
- to be deleted.
Exception
- if the file or directory cannot be deleted.public void putEntry(Entry newEntry) throws Exception
Example:
var ctor = write.getConnector(); for (i = 0; i < 10; i++) { var entry = system.newEntry(); entry.setAttribute("linenumber", i); entry.setAttribute("line", i + " line of text..."); main.logmsg("Writes entry to output..."); main.dumpEntry(entry); ctor.putEntry(entry); }
putEntry
in interface ConnectorInterface
putEntry
in class Connector
newEntry
- The entry data to add
Exception
- if an error occurs.public void modEntry(Entry newEntry, SearchCriteria searchCrit) throws Exception
modEntry
in interface ConnectorInterface
modEntry
in class Connector
newEntry
- The entry datasearchCrit
- The search criteria used to locate the entry to be modified
Exception
- if an error occurs.public void modEntry(Entry newEntry, SearchCriteria searchCrit, Entry oldEntry) throws Exception
modEntry
in interface ConnectorInterface
modEntry
in class Connector
newEntry
- The entry datasearchCrit
- The search criteria used to locate the entry to be modifiedoldEntry
- The old entry found by the search criteria
Exception
- if an error occurs.public String getVersion()
getVersion
in interface VersionInfoInterface
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |