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