001    package railo.loader.engine;
002    
003    import java.io.IOException;
004    import java.net.URL;
005    import java.util.Map;
006    
007    import javax.servlet.ServletConfig;
008    import javax.servlet.ServletContext;
009    import javax.servlet.ServletException;
010    import javax.servlet.http.HttpServlet;
011    import javax.servlet.http.HttpServletRequest;
012    import javax.servlet.http.HttpServletResponse;
013    import javax.servlet.jsp.JspException;
014    
015    import railo.runtime.CFMLFactory;
016    import railo.runtime.PageContext;
017    import railo.runtime.util.Cast;
018    import railo.runtime.util.Creation;
019    import railo.runtime.util.Decision;
020    import railo.runtime.util.Excepton;
021    import railo.runtime.util.HTTPUtil;
022    import railo.runtime.util.Operation;
023    import railo.runtime.util.ResourceUtil;
024    import railo.runtime.util.ZipUtil;
025    import railo.runtime.video.VideoUtil;
026    
027    /**
028     * The CFML Engine
029     */
030    public interface CFMLEngine { 
031    
032        /**
033         * Field <code>CAN_UPDATE</code>
034         */
035        public static int CAN_UPDATE=0;
036        
037        /**
038         * Field <code>CAN_RESTART</code>
039         */
040        public static int CAN_RESTART=1; 
041        public static int CAN_RESTART_ALL=CAN_RESTART; 
042        public static int CAN_RESTART_CONTEXT=2; 
043    
044        public abstract  CFMLFactory getCFMLFactory(ServletContext srvContext, ServletConfig srvConfig,HttpServletRequest req) throws ServletException;
045        
046        /**
047         * adds a servlet config 
048         * @param config
049         * @throws ServletException
050         */
051        public abstract void addServletConfig(ServletConfig config) throws ServletException;
052        
053        /**
054         * method to invoke the engine for CFML
055         * @param servlet
056         * @param req
057         * @param rsp
058         * @throws ServletException
059         * @throws IOException
060         * @throws ServletException 
061         */
062        public void serviceCFML(HttpServlet servlet, HttpServletRequest req, HttpServletResponse rsp) throws IOException, ServletException;
063    
064        /**
065         * method to invoke the engine for AMF
066         * @param servlet
067         * @param req
068         * @param rsp
069         * @throws ServletException
070         * @throws IOException
071         */
072        public void serviceAMF(HttpServlet servlet, HttpServletRequest req, HttpServletResponse rsp) 
073            throws ServletException, IOException;
074    
075        
076        /* *
077         * method to invoke the engine for AMF
078         * @param serviceAdapter 
079         * @param message
080         * @return
081         * /
082        //public Object executeFlex(ServiceAdapter serviceAdapter, Message message);*/
083        
084        
085    
086        /**
087         * method to invoke the engine for a simple file
088         * @param servlet
089         * @param req
090         * @param rsp
091         * @throws ServletException
092         * @throws IOException
093         */
094        public void serviceFile(HttpServlet servlet, HttpServletRequest req, HttpServletResponse rsp) throws ServletException, IOException; 
095        
096        /**
097         * method to invoke the engine for a Rest Requests
098         * @param servlet
099         * @param req
100         * @param rsp
101         * @throws ServletException
102         * @throws IOException
103         */
104        public abstract void serviceRest(HttpServlet servlet, HttpServletRequest req, HttpServletResponse rsp) throws ServletException, IOException; 
105        
106        
107        /**
108         * @return returns the version of the engine in the format [x.x.x.xxx]
109         */
110        public String getVersion();
111        
112        /**
113         * @return returns the stae of the version (alpha,beta,rc,final)
114         */
115        public String getState();
116        
117        /**
118         * @return returns how this engine will be updated (auto, manuell)
119         */
120        public String getUpdateType();
121    
122        /**
123         * @return return location URL to get updates for the engines
124         */
125        public URL getUpdateLocation();
126    
127        /**
128         * checks if process has the right to do was given with type, the engine with given password
129         * @param type restart type (CFMLEngine.CAN_UPDATE, CFMLEngine.CAN_RESTART)
130         * @param password 
131         * @return has right
132         */
133        public boolean can(int type, String password); 
134        
135        /**
136         * @return returns the engine that has produced this engine
137         */
138        public CFMLEngineFactory getCFMLEngineFactory();
139    
140        /**
141         * reset the engine
142         */
143        public void reset();
144        
145        /**
146         * reset the engine
147         */
148        public void reset(String configId);
149        
150        /** 
151         * return the cast util 
152         * @return operaton util 
153         */ 
154        public Cast getCastUtil(); 
155        
156        /** 
157         * return the operation util 
158         * @return operaton util 
159         */ 
160        public Operation getOperatonUtil(); 
161    
162        /** 
163         * returns the decision util 
164         * @return decision util 
165         */ 
166        public Decision getDecisionUtil(); 
167        
168        /** 
169         * returns the decision util 
170         * @return decision util 
171         */ 
172        public Excepton getExceptionUtil();
173        
174        
175        
176        /** 
177         * returns the decision util 
178         * @return decision util 
179         */ 
180        public Creation getCreationUtil();
181    
182            /**
183             * returns the FusionDebug Engine
184             * @return IFDController
185             */
186            public Object getFDController();
187    
188            /**
189             * returns the Blaze DS Util 
190             * @return Blaze DS Util 
191             */
192            public Object getBlazeDSUtil(); 
193    
194            /**
195             * returns the Resource Util 
196             * @return Blaze DS Util 
197             */
198            public ResourceUtil getResourceUtil(); 
199            
200            /**
201             * returns the HTTP Util
202             * @return the HTTP Util
203             */
204            public HTTPUtil getHTTPUtil(); 
205            
206            /**
207             * @return return PageContext for the current PageContext
208             */
209            public PageContext getThreadPageContext();
210    
211            public VideoUtil getVideoUtil();
212    
213            public ZipUtil getZipUtil();
214    
215            public abstract void cli(Map<String, String> config, ServletConfig servletConfig) throws IOException, JspException, ServletException;
216    
217            public abstract void registerThreadPageContext(PageContext pc);
218    
219            
220    }