001    package railo.loader.engine;
002    
003    import java.io.IOException;
004    import java.net.URL;
005    
006    import javax.servlet.ServletConfig;
007    import javax.servlet.ServletContext;
008    import javax.servlet.ServletException;
009    import javax.servlet.http.HttpServlet;
010    import javax.servlet.http.HttpServletRequest;
011    import javax.servlet.http.HttpServletResponse;
012    
013    import railo.runtime.CFMLFactory;
014    import railo.runtime.PageContext;
015    import railo.runtime.util.Cast;
016    import railo.runtime.util.Creation;
017    import railo.runtime.util.Decision;
018    import railo.runtime.util.Excepton;
019    import railo.runtime.util.HTTPUtil;
020    import railo.runtime.util.Operation;
021    import railo.runtime.util.ResourceUtil;
022    import railo.runtime.util.ZipUtil;
023    import railo.runtime.video.VideoUtil;
024    
025    /**
026     * The CFML Engine
027     */
028    public interface CFMLEngine { 
029    
030        /**
031         * Field <code>CAN_UPDATE</code>
032         */
033        public static int CAN_UPDATE=0;
034        
035        /**
036         * Field <code>CAN_RESTART</code>
037         */
038        public static int CAN_RESTART=1; 
039        public static int CAN_RESTART_ALL=CAN_RESTART; 
040        public static int CAN_RESTART_CONTEXT=2; 
041    
042        public abstract  CFMLFactory getCFMLFactory(ServletContext srvContext, ServletConfig srvConfig,HttpServletRequest req) throws ServletException;
043        
044        /**
045         * adds a servlet config 
046         * @param config
047         * @throws ServletException
048         */
049        public abstract void addServletConfig(ServletConfig config) throws ServletException;
050        
051        //public ConfigServer getConfigServer();
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        /**
098         * @return returns the version of the engine in the format [x.x.x.xxx]
099         */
100        public String getVersion();
101        
102        /**
103         * @return returns the stae of the version (alpha,beta,rc,final)
104         */
105        public String getState();
106        
107        /**
108         * @return returns how this engine will be updated (auto, manuell)
109         */
110        public String getUpdateType();
111    
112        /**
113         * @return return location URL to get updates for the engines
114         */
115        public URL getUpdateLocation();
116    
117        /**
118         * checks if process has the right to do was given with type, the engine with given password
119         * @param type restart type (CFMLEngine.CAN_UPDATE, CFMLEngine.CAN_RESTART)
120         * @param password 
121         * @return has right
122         */
123        public boolean can(int type, String password); 
124        
125        /**
126         * @return returns the engine that has produced this engine
127         */
128        public CFMLEngineFactory getCFMLEngineFactory();
129    
130        /**
131         * reset the engine
132         */
133        public void reset();
134        
135        /**
136         * reset the engine
137         */
138        public void reset(String configId);
139        
140        /** 
141         * return the cast util 
142         * @return operaton util 
143         */ 
144        public Cast getCastUtil(); 
145        
146        /** 
147         * return the operation util 
148         * @return operaton util 
149         */ 
150        public Operation getOperatonUtil(); 
151    
152        /** 
153         * returns the decision util 
154         * @return decision util 
155         */ 
156        public Decision getDecisionUtil(); 
157        
158        /** 
159         * returns the decision util 
160         * @return decision util 
161         */ 
162        public Excepton getExceptionUtil();
163        
164        
165        
166        /** 
167         * returns the decision util 
168         * @return decision util 
169         */ 
170        public Creation getCreationUtil();
171    
172            /**
173             * returns the FusionDebug Engine
174             * @return IFDController
175             */
176            public Object getFDController();
177    
178            /**
179             * returns the Blaze DS Util 
180             * @return Blaze DS Util 
181             */
182            public Object getBlazeDSUtil(); 
183    
184            /**
185             * returns the Resource Util 
186             * @return Blaze DS Util 
187             */
188            public ResourceUtil getResourceUtil(); 
189            
190            /**
191             * returns the HTTP Util
192             * @return the HTTP Util
193             */
194            public HTTPUtil getHTTPUtil(); 
195            
196            /**
197             * @return return PageContext for the current PageContext
198             */
199            public PageContext getThreadPageContext();
200    
201            public VideoUtil getVideoUtil();
202    
203            public ZipUtil getZipUtil();
204    }