/*
 * Copyright (C) 1999-2006 <a href="mailto:adrian.paschke@gmx.de">Adrian Paschke</a>
 * 
 * The RBSLM Environment is part of the Rule Based Service Level Agreement (RBSLA)
 * framework, available at 
 * <a href=" http://ibis.in.tum.de/staff/paschke/rbsla/index.htm">RBSLA</a>
 * 
 * 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 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 rbsla.environment.view;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import java.util.Vector;

import org.apache.log4j.Logger;

import rbsla.environment.ECAConstraints;

/**
 * Read properties to implement new viewers.
 */
public class ViewerArray
{

    Properties prop = new Properties();

    private static ViewerArray instanceObj = null;

    private static Logger logger = Logger.getLogger(ViewerArray.class);

    public static ViewerArray instance()
    {
        if (instanceObj == null)
        {
            instanceObj = new ViewerArray();
            instanceObj.init();
        }
        return instanceObj;
    }

    private ViewerArray()
    {
    }

    private void init()
    {
        try
        {
            prop.load(new FileInputStream(new File(ECAConstraints._FILE_BASE_PATH + "eca_environment.properties")));
        } 
        catch (IOException ex)
        {
            logger.info("", ex);
        }

        int i = 0;
        String s = null;
        while ((s = prop.getProperty("viewer" + new Integer(i).toString())) != null)
        {
            registeredViewers.add(s);
            i++;
        }

    }

    private Vector registeredViewers = new Vector();

    public Vector getViewers()
    {
        return registeredViewers;

    }
}