Object
FilenameFilter
The Content Manager bulk loader application.
This class will scan the local file system for files to load via the NodeOps and WorkspaceOps api.
BulkLoader has limited use when loading against a Library Services
Enabled Repository. If the content is new (not currently loaded into the BEA
Repository) and Library Services is enabled, the content may be loaded.
In this case, the lifecyclestatus must be specified in the md.properties, which
defines the status the content will be checked in as. All lifecycle actions will
operate as if the bulkloader user is a user in the adminn tools. So if a content
item is checked in as "Ready" then the assignements will occur. Please review
the LifeCycle
javadoc for
valid statuses, status transitions and how the system operates for each
specific transition. Valid transition values (integer values) for BulkLoader md.properties are as follows:
The type (ObjectClass) for the file along with the values of any required properties must be specified in the metata data properties file. Thus, a type must be defined in the content repository before the bulkloader may load files from the file system.
A folder will be loaded as a Hierarchy Node and a file will be loaded as a Content Node.
The actual bytes will be loaded into the primary property (must be defined in the type) and must be of type Binary.
In order for bulkloader to run, the repository and the application must be passed in as arguments and the server must be running.
This class is mainly designed to run as a command-line application, via a "java com.bea.content.loader.bulk.BulkLoader" command-line. To see a usage, give it a -h flag or read the Usage.txt in this package.
Additionally, BulkLoader objects can be created and used to provide the functionality in other places. The lifecycle of a BulkLoader is as follows:
The base directory that will be loaded may be passed in using the -d paramter. If it is not specified then the current directory "." will be used. Any additional argument will be considered a file/folder to load relative to the base directory, or if an absolute path is specified then it will be used.
parseArgs()
if not passed in to constructor.
validateArgs()
to make sure the loader has
valid arguments.
doLoad()
to execute the load.
If manually constructing and utilizing a BulkLoader object, be certain to synchronize all access to the object. Since the command-line program is single-threaded, BulkLoader objects are not thread-safe by design.
To load the default LoaderFilter
,
the BulkLoader looks for the com/bea/content/loader/bulk/loader.properties
file in the CLASSPATH. From that it reads the list of default LoaderFilter
class names from the "loader.defFilters" property. To not use any of the
default filters, specify +filters in the command-line args.
If BulkLoader fails with an out of memory error you should increase your java heap size. You may do this in the bulkloader script by passing -Xms???m into the java call where ??? is the number of megabytes.
Related Topics
Object
BulkLoader
FilenameFilter
Nested Class Summary |
public static class | BulkLoader.ShowUsageException
Quick inner exception thrown on parseArgs() to say we should just print a usage report. |
Field Summary |
public |
|
protected |
|
protected |
|
public static final |
|
public static final |
|
public static final |
|
protected |
|
public boolean |
|
public |
|
public |
|
public |
|
public boolean |
|
public |
|
public boolean |
|
public boolean |
|
protected boolean |
|
public static final |
|
protected |
|
public |
|
public |
|
public |
|
protected |
|
protected long |
|
protected |
|
public boolean |
|
protected |
|
protected |
|
protected |
|
public boolean |
|
Constructor Summary |
|
|
Method Summary |
public boolean | |
public boolean | |
public void | |
public void |
|
public void |
|
public void |
|
public void | |
public void | |
public void |
|
public | |
public |
|
public |
|
public void |
|
public static boolean | |
public boolean |
|
public static boolean |
|
public void |
|
public static int |
|
public static void | |
public void | |
public void |
|
public void | |
public boolean |
|
public boolean |
|
public void |
|
public void |
|
public void |
|
public void | |
public void |
Methods from class java.lang. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods from interface java.io. |
accept |
Field Detail |
public String
baseDirectory
protected String
batchFileName
protected String
DEF_ENCODE_PREFIX
public static final String
DEF_MD_FILE_EXT
public static final String
DEF_MIME_TYPE
public static final String
DEF_WLS_PROPS_PATH
protected String
deletePath
public boolean doMetaParse
public String
fileEncoding
public List
fileList
public List
htmlMatchList
public boolean ignoreErrors
public List
ignoreList
public boolean includeHidden
public boolean inheritProps
protected boolean isFileSystem
public static final String
JNDI_FACTORY
protected String
jndiName
public List
loaderFilters
public List
matchList
Empty to include all.
public String
mdFileExt
This should start with a ".".
protected Collection
metadataNames
protected long numDocsLoaded
protected String
password
public boolean recurse
protected String
repository
protected String
url
protected String
user
public boolean verbose
Constructor Detail |
public BulkLoader()
public BulkLoader(String
[] args)
Related Topics
BulkLoader.parseArgs(String[])
Method Detail |
public boolean accept(Implement the FilenameFilter interface method to use our match and ignore lists.File
dir,String
name)
public boolean checkFileAttributes(File
f)
public void debug(String
mesg)
Out put a debug message.
Subclasses can override this method to change where messages go.
public void doDelete()Do the actual bulk load logic on the file list.
throwsException
public void doLoad()Do the actual bulk load logic on the file list.
throwsException
public void doLoad(Load the given path into the database.File
baseDir,String
path,Properties
mdProperties)
throwsException
If path is a directory, all files underneath it that match our patterns will be included. If path is a file, it will be loaded.
public void error(Output an error message.String
mesg,Throwable
ex)
Subclasses can override this method to change where messages go.
public void error(String
mesg)
Output an error message.
public void finished()Once you are done remove the bean for cleanup
throwsRemoteException
,RemoveException
,Exception
publicFix up a path to be forward-slash style and to not have empty path parts.String
fixPath(String
path)
publicGet the properties from the BulkLoader's LoaderFilters for the given file.Properties
getLoaderFilterProperties(File
f,Properties
p)
publicGet the metadata properties for the given file or directory.Properties
getMetadataProperties(File
base,Properties
p)
throwsIOException
This does not do a META data parse.
public void inspectCurrentDirectory(File
f,String
path,Properties
mdProperties)
throwsException
public static boolean isHidden(File
f)
Check if the specified file is a hidden file.
Under UNIX, the File.isHidden() reports that "/weblogicCommerce/dmsBase/." is a hidden file, which it is not. So, this fixes that problem by getting canonicals paths for directories before calling isHidden(). That seems to do the trick.
public boolean isHtmlFile(String
name)
Tell if the specified file name is an HTML file to the loader.
public static boolean isReadableDirectory(String
name)
Check if the specified file name is a directory that we can get into.
public void loadIndividualFile(File
f,String
path,Properties
mdProperties)
throwsException
public static int main(The main method invoked on a BulkLoader instance.BulkLoader
loader,String
[] args)
This will take a BulkLoader through the bulk loading steps. Output
will be sent via the BulkLoader's debug()
,
warning()
, and
error()
methods.
This will not call System.exit().
Related Topics
BulkLoader.parseArgs(String[])
BulkLoader.validateArgs()
public static void main(String
[] args)
Command-line entry point.
This will call System.exit() on invalid args or error. To invoke a bulk load from your own code, create and manipulate a BulkLoader object. You can use the other main method, which does not exit.
Related Topics
BulkLoader.main(BulkLoader, String[])
public void parseArgs(Parse the given input arguments.String
[] args)
throwsIllegalArgumentException
public void printArgs()Prints the arguments as debug statements.
public void processBatchProperties()
throwsException
public boolean shouldIgnore(String
name)
Tell if the loader should ignore the specified file name.
public boolean shouldInclude(String
name)
Tell if the loader should include the specified file name.
public void usage()Print the usage of the application.
public void usage(PrintWriter
out)
Print the usage of the application.
public void validateArgs()Validate that we have been passed correct arguments.
throwsIllegalStateException
This does not validate that the arguments are valid. That will be done in initialize().
public void warning(Output a warning message.String
mesg,Throwable
ex)
Subclasses can override this method to change where messages go.
public void warning(String
mesg)
Output a warning message.