1 25 package org.ofbiz.pos.container; 26 27 import java.util.Map ; 28 29 import org.ofbiz.base.container.Container; 30 import org.ofbiz.base.container.ContainerException; 31 import org.ofbiz.base.container.ContainerConfig; 32 import org.ofbiz.base.util.GeneralException; 33 import org.ofbiz.base.util.Debug; 34 import org.ofbiz.pos.device.DeviceLoader; 35 36 42 public class JposDeviceContainer implements Container { 43 44 public static final String module = JposDeviceContainer.class.getName(); 45 46 protected String configFile = null; 47 48 public void init(String [] args, String configFile) throws ContainerException { 49 this.configFile = configFile; 50 } 51 52 public boolean start() throws ContainerException { 53 ContainerConfig.Container cc = ContainerConfig.getContainer("jpos.device-container", configFile); 54 if (cc == null) { 55 throw new ContainerException("No jpos.device-container configuration found in container config!"); 56 } 57 58 Map devices = cc.properties; 60 try { 61 DeviceLoader.load(devices); 62 } catch (GeneralException e) { 63 throw new ContainerException(e); 64 } 65 66 return true; 67 } 68 69 public void stop() throws ContainerException { 70 try { 71 DeviceLoader.stop(); 72 } catch (GeneralException e) { 73 Debug.logError(e, module); 75 } 76 Debug.logInfo("JPOS Devices released and closed", module); 77 } 78 } 79 | Popular Tags |