/*
 This file is part of the software framework JStatCom, 
 a library for building applications for data based analysis.

 Copyright (C) 2000-2005  Markus Kraetzig

 This library is free software; you can redistribute it and/or modify
 it under the terms of the GNU Lesser General Public License as
 published by the Free Software Foundation; either version 2.1 of the
 License, or (at your option) any later version.

 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.jstatcom.engine.grte;

import java.util.Map;

import com.jstatcom.engine.ConfigHolder;
import com.jstatcom.engine.ConfigKeys;
import com.jstatcom.engine.Engine;
import com.jstatcom.engine.EngineTypes;

/**
 * GRTEType holds information about the GRTEngine
 * and works as a factory to create an instance of a GRTE workspace. It is a
 * Singleton.
 * 
 * @author Markus Kraetzig 
 */
public final class GRTEType extends EngineTypes {
    /**
     * To enforce the Singleton property of this class.
     */
    public static final GRTEType INSTANCE = new GRTEType("GRTE");

    private GRTEngine grteEngine = null;


    /**
     * GRTEType constructor is private to ensure Singleton.
     * 
     * @param name
     *            String
     */
    private GRTEType(String name) {
        super(name);
    }

    /**
     * Checks the validity of the configuration for the GRTEngine.
     * 
     * @see com.jstatcom.engine.EngineTypes
     * @throws IllegalArgumentException
     *             if (configHolder == null)
     */
    public String checkSettings(ConfigHolder configHolder) {

        if (configHolder == null)
            throw new IllegalArgumentException("Argument was null.");

        /* check whether graphics dir can be used */

        return null;

    }

    /**
     * @see com.jstatcom.engine.EngineTypes
     */
    public Map getConfigKeys() {
        return ConfigKeys.getAllKeys(GRTEConfigKeys.class);

    }

    /**
     * @see com.jstatcom.engine.EngineTypes
     */
    public Engine getEngine() {
        if (grteEngine == null) {
            try {
                grteEngine = GRTEngine.getInstance();
            } catch (Throwable ex) {
                throw new RuntimeException(
                        "The GRT engine could not be initialized\ndue to the following error:\n\n"
                                + ex.getMessage() + "\n");
            }
        }
        addLoadedEngine(grteEngine);
        return grteEngine;

    }
}
 

Ads help maintain this website.