package cz.moneta.test.harness.endpoints.demo;

import cz.moneta.test.harness.connectors.DemoConnector;
import cz.moneta.test.harness.context.StoreAccessor;
import cz.moneta.test.harness.endpoints.Endpoint;

public class DemoEndpoint implements Endpoint {

    private DemoConnector connector;

    public DemoEndpoint(StoreAccessor store) {
        connector = new DemoConnector();
        String location = store.getConfig("endpoints.demo.spirits.location");
        connector.connectToTempDirectoryService(location);
    }

    public void summonSpirit(String name) {
        connector.createFile(name);
    }

    public boolean spiritPresent(String name) {
        return connector.fileExists(name);
    }

    public void expelSpirit(String name) {
        connector.deleteFile(name);
    }
}
