/*----------------------------------------------------------------------------
Copyright (c)2000 TogetherSoft Corporation. Patents pending. All rights reserved.
----------------------------------------------------------------------------*/
package com.togethersoft.modules.patterns.JAVA.CLASS.HP_E_Speak.Service_Provider;

import com.togethersoft.openapi.ide.IdeAccess;

import com.togethersoft.openapi.sci.SciModelAccess;
import com.togethersoft.openapi.sci.SciModel;
import com.togethersoft.openapi.sci.SciFactory;
import com.togethersoft.openapi.sci.SciGenericFactory;
import com.togethersoft.openapi.sci.SciLanguage;

import com.togethersoft.openapi.util.propertyMap.PropertyMap;

public abstract class AbstractSciTemplate implements SciTemplate {

    protected AbstractSciTemplate(PropertyMap properties) {
        this.properties = properties;
    }
    
    public PropertyMap getProperties() {
        return this.properties;
    }
    
    protected Object getPropertyValue(String key) {
        return getProperties().getPropertyValue(key);
    }

    protected String getStringPropertyValue(String key) {
        Object value = getPropertyValue(key);
        if (value instanceof String) {
            return (String) value;
        }
        return null;
    }

    protected void setPropertyValue(String key, Object value) {
        getProperties().setPropertyValue(key, value);
    }
    
    protected static void setErrorMessage(String message) {
        IdeAccess.setErrorMessageInfo(message);
    }
    
    protected static String getLanguage() {
        return SciLanguage.JAVA;
    }
    
    protected static SciFactory getSciFactory() {
        return getSciModel().getFactory(getLanguage());
    }
    
    protected static SciGenericFactory getSciGenericFactory() {
        return getSciModel().getGenericFactory(getLanguage());
    }
    
    protected static SciModel getSciModel() {
        return SciModelAccess.getModel();
    }
    
    private PropertyMap properties;
}


