001    package railo.runtime.util;
002    
003    import railo.runtime.PageContext;
004    import railo.runtime.PageSource;
005    import railo.runtime.db.SQL;
006    import railo.runtime.exp.PageException;
007    
008    /**
009     * class to get exceptions of different types
010     */
011    public interface Excepton {
012    
013        /**
014         * Field <code>TYPE_ABORT</code>
015         */
016        public static final int TYPE_ABORT=0;
017        /**
018         * Field <code>TYPE_ABORT_EXP</code>
019         */
020        public static final int TYPE_ABORT_EXP=1;
021        /**
022         * Field <code>TYPE_APPLICATION_EXP</code>
023         */
024        public static final int TYPE_APPLICATION_EXP=2;
025        /**
026         * Field <code>TYPE_CASTER_EXP</code>
027         */
028        public static final int TYPE_CASTER_EXP=3;
029        /**
030         * Field <code>TYPE_CUSTOM_TYPE_EXP</code>
031         */
032        public static final int TYPE_CUSTOM_TYPE_EXP=4;
033        /**
034         * Field <code>TYPE_DATABASE_EXP</code>
035         */
036        public static final int TYPE_DATABASE_EXP=5;
037        /**
038         * Field <code>TYPE_EXPRESSION_EXP</code>
039         */
040        public static final int TYPE_EXPRESSION_EXP=6;
041        /**
042         * Field <code>TYPE_FUNCTION_EXP</code>
043         */
044        public static final int TYPE_FUNCTION_EXP=7;
045        /**
046         * Field <code>TYPE_LOCK_EXP</code>
047         */
048        public static final int TYPE_LOCK_EXP=8;
049        /**
050         * Field <code>TYPE_MISSING_INCLUDE_EXP</code>
051         */
052        public static final int TYPE_MISSING_INCLUDE_EXP=9;
053        /**
054         * Field <code>TYPE_NATIVE_EXP</code>
055         */
056        public static final int TYPE_NATIVE_EXP=10;
057        /**
058         * Field <code>TYPE_SECURITY_EXP</code>
059         */
060        public static final int TYPE_SECURITY_EXP=11;
061        /**
062         * Field <code>TYPE_TEMPLATE_EXP</code>
063         */
064        public static final int TYPE_TEMPLATE_EXP=12;
065        /**
066         * Field <code>TYPE_XML_EXP</code>
067         */
068        public static final int TYPE_XML_EXP=13;
069        
070        /**
071         * create exception "Abort"
072         * @return Abort
073         */
074        public PageException createAbort();
075        
076        /**
077         * create exception "AbortException"
078         * @param showError 
079         * @return AbortException
080         */
081        public PageException createAbortException(String showError);
082        
083        /**
084         * create exception "ApplicationException"
085         * @param message 
086         * @return ApplicationException
087         */
088        public PageException createApplicationException(String message);
089        
090        /**
091         * create exception "ApplicationException"
092         * @param message 
093         * @param detail 
094         * @return ApplicationException
095         */
096        public PageException createApplicationException(String message, String detail);
097        
098        /**
099         * create exception "CasterException"
100         * @param message 
101         * @return CasterException
102         */
103        public PageException createCasterException(String message);
104        
105        /**
106         * create exception "CustomTypeException"
107         * @param message 
108         * @param detail 
109         * @param errorcode 
110         * @param customType 
111         * @return CustomTypeException
112         */
113        public PageException createCustomTypeException(String message, String detail, String errorcode, String customType); // FUTURE set to deprecated
114        
115     // FUTURE  public PageException createCustomTypeException(String message, String detail, String errorcode, String customType, String extendedInfo);
116        
117        /**
118         * create exception "DatabaseException"
119         * @param message 
120         * @return DatabaseException
121         */
122        public PageException createDatabaseException(String message);
123        
124        /**
125         * create exception "DatabaseException"
126         * @param message 
127         * @param detail 
128         * @return DatabaseException
129         */
130        public PageException createDatabaseException(String message, String detail);
131        
132        /**
133         * create exception "DatabaseException"
134         * @param message 
135         * @param sql 
136         * @return DatabaseException
137         */
138        public PageException createDatabaseException(String message, SQL sql);
139        
140        /**
141         * create exception "ExpressionException"
142         * @param message 
143         * @return ExpressionException
144         */
145        public PageException createExpressionException(String message);
146        
147        /**
148         * create exception "ExpressionException"
149         * @param message 
150         * @param detail 
151         * @return ExpressionException
152         */
153        public PageException createExpressionException(String message, String detail);
154        
155        /**
156         * create exception "FunctionException"
157         * @param pc 
158         * @param functionName 
159         * @param badArgumentPosition 
160         * @param badArgumentName 
161         * @param message 
162         * @return FunctionException
163         */
164        public PageException createFunctionException(PageContext pc,String functionName, String badArgumentPosition, String badArgumentName, String message);
165        
166        /**
167         * create exception "LockException"
168         * @param operation 
169         * @param name 
170         * @param message 
171         * @return LockException
172         */
173        public PageException createLockException(String operation, String name, String message);
174        
175        /**
176         * create exception "LockException" 
177         * @param ps 
178         * @return LockException
179         */
180        public PageException createMissingIncludeException(PageSource ps);
181        
182        /**
183         * create exception "NativeException" 
184         * @param t 
185         * @return NativeException
186         */
187        public PageException createNativeException(Throwable t);
188        
189        /**
190         * create exception "SecurityException" 
191         * @param message 
192         * @return SecurityException
193         */
194        public PageException createSecurityException(String message);
195        
196        /**
197         * create exception "SecurityException" 
198         * @param message 
199         * @param detail 
200         * @return SecurityException
201         */
202        public PageException createSecurityException(String message, String detail);
203        
204        /**
205         * create exception "TemplateException" 
206         * @param message 
207         * @return TemplateException
208         */
209        public PageException createTemplateException(String message);
210        
211        /**
212         * create exception "TemplateException" 
213         * @param message 
214         * @param detail 
215         * @return TemplateException
216         */
217        public PageException createTemplateException(String message, String detail);
218        
219        /**
220         * create exception "XMLException" 
221         * @param message
222         * @return XMLException
223         */
224        public PageException createXMLException(String message);
225        
226        /**
227         * create exception "XMLException" 
228         * @param message 
229         * @param detail 
230         * @return XMLException
231         */
232        public PageException createXMLException(String message, String detail);
233    
234        /**
235         * check if exception is of given type
236         * @param type type to check
237         * @param t exception to check
238         * @return is of type
239         */
240        public boolean isOfType(int type, Throwable t); 
241    }