/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: RegistryKey.java,v $
*
* $Revision: 1.2 $
*
* last change: $Author: rt $ $Date: 2005/09/07 19:20:49 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
************************************************************************/
package com.sun.star.tools.uno;
import java.util.Enumeration;
import java.util.Hashtable;
import com.sun.star.registry.InvalidRegistryException;
import com.sun.star.registry.InvalidValueException;
import com.sun.star.registry.RegistryKeyType;
import com.sun.star.registry.RegistryValueType;
import com.sun.star.registry.XRegistryKey;
/**
* This is a dummy registry implementation,
* which only implmenets the needed methods.
*/
class RegistryKey implements XRegistryKey {
protected RegistryValueType _registryValueType = RegistryValueType.NOT_DEFINED;
protected String _name;
protected Hashtable _keys = new Hashtable();
protected int _long;
protected int _long_list[];
protected String _ascii;
protected String _ascii_list[];
protected String _string;
protected String _string_list[];
protected byte _binary[];
public RegistryKey(String name) {
_name = name;
}
// XRegistryKey Attributes
public String getKeyName() throws com.sun.star.uno.RuntimeException {
return _name;
}
// XRegistryKey Methods
public boolean isReadOnly() throws InvalidRegistryException, com.sun.star.uno.RuntimeException {
return false;
}
public boolean isValid() throws com.sun.star.uno.RuntimeException {
return true;
}
public RegistryKeyType getKeyType( /*IN*/String rKeyName ) throws InvalidRegistryException, com.sun.star.uno.RuntimeException {
return RegistryKeyType.KEY;
}
public RegistryValueType getValueType() throws InvalidRegistryException, com.sun.star.uno.RuntimeException {
return _registryValueType;
}
public int getLongValue() throws InvalidRegistryException, InvalidValueException, com.sun.star.uno.RuntimeException {
if(_registryValueType != RegistryValueType.LONG)
throw new InvalidValueException("long");
return _long;
}
public void setLongValue( /*IN*/int value ) throws InvalidRegistryException, com.sun.star.uno.RuntimeException {
_registryValueType = RegistryValueType.LONG;
_long = value;
}
public int[] getLongListValue() throws InvalidRegistryException, InvalidValueException, com.sun.star.uno.RuntimeException {
if(_registryValueType != RegistryValueType.LONGLIST)
throw new InvalidValueException("longlist");
return _long_list;
}
public void setLongListValue( /*IN*/int[] seqValue ) throws InvalidRegistryException, com.sun.star.uno.RuntimeException {
_registryValueType = RegistryValueType.LONGLIST;
_long_list = seqValue;
}
public String getAsciiValue() throws InvalidRegistryException, InvalidValueException, com.sun.star.uno.RuntimeException {
if(_registryValueType != RegistryValueType.ASCII)
throw new InvalidValueException("ascii");
return _asci