All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.technologybrewery.fermenter.mda.metamodel.RuleModelInstanceManager Maven / Gradle / Ivy

The newest version!
package org.technologybrewery.fermenter.mda.metamodel;

import org.technologybrewery.fermenter.mda.metamodel.element.Rule;
import org.technologybrewery.fermenter.mda.metamodel.element.RuleElement;

/**
 * Responsible for maintaining the list of rule model instances elements in the system.
 */
class RuleModelInstanceManager extends AbstractMetamodelManager {

    private static ThreadLocal threadBoundInstance = ThreadLocal
            .withInitial(RuleModelInstanceManager::new);

    /**
     * Returns the singleton instance of this class.
     * 
     * @return singleton
     */
    public static RuleModelInstanceManager getInstance() {
        return threadBoundInstance.get();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void reset() {
        super.reset();
        threadBoundInstance.remove();
    }

    /**
     * Prevent instantiation of this singleton from outside this class.
     */
    private RuleModelInstanceManager() {
        super();
    }

    @Override
    protected String getMetadataLocation() {
        return config.getRulesRelativePath();
    }

    @Override
    protected Class getMetamodelClass() {
        return RuleElement.class;
    }

    @Override
    protected String getMetamodelDescription() {
        return Rule.class.getSimpleName();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy