001    package org.opencfml.eventgateway;
002    
003    import java.util.Map;
004    
005    public interface Gateway {
006        
007            public static final int STARTING = 1;
008        public static final int RUNNING = 2;
009        public static final int STOPPING = 3;
010        public static final int STOPPED = 4;
011        public static final int FAILED = 5;
012        
013        /**
014         * method to initialize the gateway
015         * @param engine the gateway engine
016         * @param id the id of the gateway 
017         * @param cfcPath the path to the listener component
018         * @param config the configuration as map
019         */
020        public void init(GatewayEngine engine,String id, String cfcPath,Map config) throws GatewayException;
021    
022        /**
023         * returns the id of the gateway
024         * @return the id of the gateway
025         */
026        public String getId();
027        
028        /**
029         * sends a message based on given data
030         * @param data
031         * @return answer from gateway
032         */
033        public String sendMessage(Map data) throws GatewayException;
034        
035        /**
036         * return helper object
037         * @return helper object
038         */
039        public Object getHelper();
040        
041        /**
042         * starts the gateway
043         * @throws GatewayException
044         */
045        public void doStart() throws GatewayException;
046        
047        /**
048         * stop the gateway
049         * @throws GatewayException
050         */
051        public void doStop() throws GatewayException;
052        
053        /**
054         * restart the gateway
055         * @throws GatewayException
056         */
057        public void doRestart() throws GatewayException;
058        
059        /**
060         * returns a string that is used by the event gateway administrator to display status
061         * @return status (STARTING, RSTOPPING, STOPPED, FAILED)
062         */
063        public int getState();
064    }