package org.arefgard.icerya.flow.integration.icerya;

import org.arefgard.icerya.container.core.ContainerFactory;
import org.arefgard.icerya.container.core.IceryaContainer;
import org.arefgard.icerya.flow.exception.DIContainerExecuteException;
import org.arefgard.icerya.flow.exception.UsecaseFlowException;
import org.arefgard.icerya.flow.integration.DIContainer;

public class DIContainerIcerya implements DIContainer {
	
	private static IceryaContainer container;
	public DIContainerIcerya(String path) {
		try {
			container = ContainerFactory.create(path);
		}catch(Exception e) {
			e.printStackTrace();
		}
	}
	public Object get(String type) throws UsecaseFlowException {
		try {
			return container.getBean(type);
		}catch(Exception e) {
			throw new DIContainerExecuteException("failed.", e);
		}
	}

}
