|
XCC/J 3.2-9 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.marklogic.xcc.examples.ContentLoader
This program accepts a server URI (in the format
expected by ContentSourceFactory.newContentSource(java.net.URI))
and one or more file pathnames of documents to load.
Click here for the source code for this class
The main() method in this example leaves the
ContentCreateOptions value set to null which
will apply defaults when documents are loaded. This
means that document type (XML, text() or binary()) may
be determined by URI extention. If you instantiate this
class from another class, you can set explicit options
via setOptions(com.marklogic.xcc.ContentCreateOptions)
before calling load(java.io.File[]).
The main() method uses the absolute pathname of each file as its URI for loading. There is also a method provided which takes parallel arrays of URI strings and File objects.
| Constructor Summary | |
ContentLoader(URI serverUri)
Construct an instance that may be used to insert content. |
|
| Method Summary | |
void |
load(File[] files)
Load the provided Files into the contentbase,
using the absolute pathname of each File as
the document URI. |
void |
load(String[] uris,
File[] files)
Load the provided Files, using the provided URIs, into
the content server. |
static void |
main(String[] args)
Command-line main() module to run this content loader. |
void |
setOptions(ContentCreateOptions options)
Set (or clear) an instance of ContentCreateOptions
which defines creation options to apply to each document loaded. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ContentLoader(URI serverUri)
throws XccConfigException
serverUri - A URI identifying a ContentSource,
in the format expected by
ContentSourceFactory.newContentSource(java.net.URI).
XccConfigException - Thrown if a Session cannot
be created. This usually indicates that the host/port or
user credentials are incorrect.| Method Detail |
public void load(String[] uris,
File[] files)
throws RequestException
Files, using the provided URIs, into
the content server.
uris - An array of URIs (identifiers) that correspond to the
File instances given in the "files" parameter.files - An array of File objects representing disk
files to be loaded. The ContentCreateOptions object
set with setOptions(com.marklogic.xcc.ContentCreateOptions),
if any, will be applied to all documents when they are loaded.
RequestException - If there is an unrecoverable problem
with sending the data to the server. If this exception is
thrown, none of the documents will have been committed to the
contentbase.
public void load(File[] files)
throws RequestException
Files into the contentbase,
using the absolute pathname of each File as
the document URI.
files - An array of File objects representing disk
files to be loaded. The ContentCreateOptions object
set with setOptions(com.marklogic.xcc.ContentCreateOptions),
if any, will be applied to all documents when they are loaded.
RequestException - If there is an unrecoverable problem
with sending the data to the server. If this exception is
thrown, none of the documents will have been committed to the
contentbase.public void setOptions(ContentCreateOptions options)
ContentCreateOptions
which defines creation options to apply to each document loaded.
This is null (defaults) unless explictly set.
options -
public static void main(String[] args)
throws URISyntaxException,
XccConfigException,
RequestException
args - A URI [arg 0] identifying the server/port/user/db where
the content should be inserted and one or more [args 1-n] giving
file pathnames of documents to load.
URISyntaxException - If there is a problems interpreting the URI.
XccConfigException - If a Session cannot be created.
RequestException - If the content cannot be inserted in the
contentbase.
|
XCC/J 3.2-9 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Complete online documentation for MarkLogic Server, XQuery and related components may be found at developer.marklogic.com