JPlate Key/Value Pair 0.2
Summary
Welcome to the JPlate Key/Value Pair
(KVP) Project! This
subproject of JPlate provides key/value pair functionality - much like
java.util.Properties including a parser.
Currently this documentation is a "work in progress"
and will be enhanced when time permits.
Please
note: This is an initial version and there is much missing
(unit test cases, good Java documentation, etc).
Quick Start
This section illustrates how to quickly make use of the parser
mentioned above. However, remember that this is simply a
"quick start" and does not explain how to use the complete KVP
library.
Classpath
To utilize the KVP library, include all jar files found in the release
lib directory as part of the classpath. For example, assume KVP
0.2 has been downloaded and installed to
/shared/jplate-kvp-0.2 on a Linux platform:
JPLATE_KVP_HOME=/shared/jplate-kvp-0.2
JPLATE_KVP_LIB_HOME=${JPLATE_KVP_HOME}/lib
JPLATE_KVP_CLASSPATH=${JPLATE_KVP_LIB_HOME}/commons-logging-1.1.jar:${JPLATE_KVP_CLASSPATH}
JPLATE_KVP_CLASSPATH=${JPLATE_KVP_LIB_HOME}/jplate-foundation-0.9.jar:${JPLATE_KVP_CLASSPATH}
JPLATE_KVP_CLASSPATH=${JPLATE_KVP_LIB_HOME}/jplate-kvp-0.2.jar:${JPLATE_KVP_CLASSPATH}
JPLATE_KVP_CLASSPATH=${JPLATE_KVP_LIB_HOME}/log4j-1.2.15.jar:${JPLATE_KVP_CLASSPATH}
CLASSPATH=${JPLATE_KVP_CLASSPATH}:${CLASSPATH}
There is a utility
class that makes use of default implentations to create list/maps
from files, input streams, readers and strings. By
examining the source code for this class,
one can extrapolate how to extend or use the rest of the project.
Examples
Consider the following examples:
- Key/value pairs contained in a file to be consumed as a
java.util.List:
import java.io.File;
import java.util.List;
import org.jplate.kvp.KvpIfc;
import org.jplate.kvp.util.KvpUtil;
...
final File kvpFile = new File ( "SomeFile.kvp" );
final List <KvpIfc> KvpUtil.getAsList ( kvpFile );
...
- Keys and values streamed from a socket to be consumed as
a java.util.Map:
import java.net.Socket;
import java.util.Map;
import org.jplate.kvp.KvpIfc;
import org.jplate.kvp.util.KvpUtil;
...
final Socket kvpSocket = // Create socket in some
fashion...
final Map <String, String> KvpUtil.getAsMap ( kvpSocket.getInputStream () );
...
Please look to individual classes for
more specific information.
Building (if desired)
If you wish to build KVP from source, you will need access
to a Subversion client and Ant 1.7.0+
(preferably 1.7.1
to simplify using the included libraries - please see the documentation
on Environment
1.1 for more information).
Check out the source
Create a directory for checkout, change to this directory and execute:
svn co
https://jplate.svn.sourceforge.net/svnroot/jplate/trunk/environment
svn co
https://jplate.svn.sourceforge.net/svnroot/jplate/trunk/kvp
You will note two directories are created: environment
and kvp.
Build the source
Build the source - change directories to the aforementioned kvp
directory and execute the command:
ant
Results
After building, you should find a kvp/assembly/release
directory containing various things such as a jar file
(for example KVP 0.2 release produces jplate-kvp-0.2.jar)
and other files normally associated with a KVP release.
Dependencies
KVP has dependencies upon:
IRC Channel
There is an
IRC channel on
irc.freenode.net under the channel name #JPlate.
The Project Manager
is usually there most days under the name Flossy. He is more than
happy to help or answer questions you may have.
Related Links
Key/Value Pair related links follow:
Revision Information
Modifications:
$Date: 2007-12-26 11:09:57 -0500 (Wed, 26 Dec 2007) $
$Revision: 466 $
$Author: sfloess $
$HeadURL: https://jplate.svn.sourceforge.net/svnroot/jplate/trunk/kvp/src/doc/index.html $