001/*
002 * IzPack - Copyright 2001-2005 Julien Ponge, All Rights Reserved.
003 * 
004 * http://www.izforge.com/izpack/
005 * http://developer.berlios.de/projects/izpack/
006 * 
007 * Copyright 2005 Klaus Bartz
008 *
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *     http://www.apache.org/licenses/LICENSE-2.0
014 *     
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 */
021
022package com.coi.tools.os.izpack;
023
024import com.coi.tools.os.win.RegistryImpl;
025import com.izforge.izpack.util.NativeLibraryClient;
026
027/**
028 * Wrapper class for com.coi.tools.os.win.RegistryImpl for using it with IzPack. This class
029 * implements only the methods of interface NativeLibraryClient. All other methods are used directly
030 * from RegistryImpl.
031 * 
032 * @author Klaus Bartz
033 * 
034 */
035public class Registry extends RegistryImpl implements NativeLibraryClient
036{
037
038    /**
039     * Default constructor.
040     */
041    public Registry() throws Exception
042    {
043        super();
044        initialize();
045    }
046
047    /**
048     * Initialize native part of this class and other settings.
049     * 
050     * @exception Exception if problems are encountered
051     */
052    /*--------------------------------------------------------------------------*/
053    private void initialize() throws Exception
054    {
055        COIOSHelper.getInstance().addDependant(this);
056    }
057
058    /*--------------------------------------------------------------------------*/
059    /**
060     * This method is used to free the library at the end of progam execution. This class has no own
061     * library else it shares it in the COI common lib. To free the library, the helper class is
062     * called. After this call, any instance of this class will not be usable any more! <b><i>
063     * <u>Note that this method does NOT return </u> at the first call, but at any other </i> </b>
064     * <br>
065     * <br>
066     * <b>DO NOT CALL THIS METHOD DIRECTLY! </b> <br>
067     * It is used by the librarian to free the native library before physically deleting it from its
068     * temporary loaction. A call to this method will freeze the application irrecoverably!
069     * 
070     * @param name the name of the library to free. Use only the name and extension but not the
071     * path.
072     * 
073     * @see com.izforge.izpack.util.NativeLibraryClient#freeLibrary
074     */
075    /*--------------------------------------------------------------------------*/
076    public void freeLibrary(String name)
077    {
078
079        COIOSHelper.getInstance().freeLibrary(name);
080    }
081
082}