General information about JNDI Service Provider for Windows Registry

Prepare to use

To start working with Windows registry from your Java application WinRegistry.dll file should be discoverable by JVM. You can do it euther by adding path to this file to your PATH

set PATH="Directory with WinRegistry.dll";%PATH%
or by copying WinRegistry.dll to your Windows directory or by running java with parameter "java.library.path"
java -cp dist/jndi2r.jar;... -Djava.library.path="Directory with WinRegistry.dll" ...
jndi2r.jar should be added to the classpath. Our service provider is tested to work with JDK1.3 and JDK1.4 and on Windows XP/2000/NT/Me/9x

Embedding in your Java applications

To enable registry operations in your application you should create InitialContext. This can be done as follows:

  Hashtable environment = new Hashtable();
  environment.put("java.naming.factory.initial", "com.scand.jndi.registry.RegistryInitialContextFactory");
  Context c = new InitialContext(environment);
Environment parameters
You can pass the following additional environment parameters:

Names in Registry are not case sensitive ("key" and "KEY" is the same). For more convenient use the following name aliases are defined:
    "HKEY_CLASSES_ROOT" is aliased to "HKCR"
    "HKEY_CURRENT_CONFIG" is aliased to "HKCC"
    "HKEY_CURRENT_USER" is aliased to "HKCU"
    "HKEY_LOCAL_MACHINE" is aliased to "HKLM"
    "HKEY_USERS" is aliased to "HKU"

Service provider has support of common registry types: REG_SZ (mapped to java.lang.String), REG_DWORD (mapped to java.lang.Long) and REG_BINARY (mapped to com.scand.jndi.registry.ByteArray). You can also store any serialized java object as REG_BINARY. Support of other types will be in the next release.

Demo version restrictions

In demo version you can create keys/values and read them but you cannot delete them or modify value's content (OperationNotSupported exception will be thrown).

Samples

For more information see com.scand.jndi.registry.demo.simple.Simple.java, com.scand.jndi.registry.demo.RegEdit.java and API documentation. You can run demo RegEdit program as

java -jar RegEdit.jar
Also you can use JNDI Browser that can be downloaded from http://java.sun.com/products/jndi. It should be run as follows
java -cp "jndibrowser.jar;jndi2r.jar" examples.browser.Browser "Registry|com.scand.jndi.registry.RegistryInitialContextFactory"
Before running example programs make sure WinRegistry.dll is in your PATH.

Bug reports or feature requests
If you found bugs or need feature that is not yet implemented, feel free to contact us http://www.scand.com.

THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SCAND BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.