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

brooklyn.entity.rebind.RebindContextImpl Maven / Gradle / Ivy

There is a newer version: 0.7.0-M1
Show newest version
package brooklyn.entity.rebind;

import java.util.Map;

import brooklyn.entity.Entity;
import brooklyn.location.Location;
import brooklyn.policy.Policy;

import com.google.common.collect.Maps;

public class RebindContextImpl implements RebindContext {

    private final Map entities = Maps.newLinkedHashMap();
    private final Map locations = Maps.newLinkedHashMap();
    private final Map policies = Maps.newLinkedHashMap();
    private final ClassLoader classLoader;
    
    public RebindContextImpl(ClassLoader classLoader) {
        this.classLoader = classLoader;
    }

    public void registerEntity(String id, Entity entity) {
        entities.put(id, entity);
    }
    
    public void registerLocation(String id, Location location) {
        locations.put(id, location);
    }
    
    public void registerPolicy(String id, Policy policy) {
        policies.put(id, policy);
    }
    
    @Override
    public Entity getEntity(String id) {
        return entities.get(id);
    }

    @Override
    public Location getLocation(String id) {
        return locations.get(id);
    }
    
    @Override
    public Policy getPolicy(String id) {
        return policies.get(id);
    }
    
    @Override
    public Class loadClass(String className) throws ClassNotFoundException {
        return classLoader.loadClass(className);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy