KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > impl > tools > ij > ijException


1 /*
2
3    Derby - Class org.apache.derby.impl.tools.ij.ijException
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to You under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.impl.tools.ij;
23
24 import org.apache.derby.iapi.tools.i18n.LocalizedResource;
25 import java.io.IOException JavaDoc;
26
27 /**
28     ijException is used to get messages from the ij parser to
29     the main ij loop. Because this is not under the protocol/impl
30     umbrella, it does not have available to it the message service.
31     At this time, all messages are hard-coded in this file. A more
32     serviceable solution may need to be found.
33
34     @author ames.
35  */

36
37 public class ijException extends RuntimeException JavaDoc {
38
39     private final static String JavaDoc IllegalStatementName="IJ_IllegalStatementName";
40     private final static String JavaDoc NotYetImplemented="IJ_NotYetImpl";
41     private final static String JavaDoc AlreadyHaveConnectionNamed = "IJ_AlreHaveACon";
42     private final static String JavaDoc BangException = "IJ_ExceRunnComm";
43     private final static String JavaDoc ConnectionGetWarningsFailed = "IJ_UnabToGetWar";
44     private final static String JavaDoc ClassNotFoundForProtocol = "IJ_CoulNotLocaC";
45     private final static String JavaDoc ClassNotFound = "IJ_CoulNotLocaC_5";
46     private final static String JavaDoc DisconnectFailed = "IJ_FailToDisc";
47     private final static String JavaDoc DriverNotClassName = "IJ_DrivNotClasN";
48     private final static String JavaDoc FileNotFound = "IJ_FileNotFoun";
49     private final static String JavaDoc ForwardOnlyCursor = "IJ_IsNotAlloOnA";
50     private final static String JavaDoc GetConnectionFailed = "IJ_GetcCallFail";
51     private final static String JavaDoc IOException = "IJ_Ioex";
52     private final static String JavaDoc NeedToDisconnect = "IJ_NeedToDiscFi";
53     private final static String JavaDoc NoSuchAsyncStatement = "IJ_NoAsynStatEx";
54     private final static String JavaDoc NoSuchConnection = "IJ_NoConnExisWi";
55     private final static String JavaDoc NoSuchProtocol = "IJ_NoProtExisWi";
56     private final static String JavaDoc NoSuchTable = "IJ_NoSuchTable";
57     private final static String JavaDoc NotJDBC20 = "IJ_IsOnlySuppIn";
58     private final static String JavaDoc NoUsingResults = "IJ_UsinClauHadN";
59     private final static String JavaDoc ObjectWasNull = "IJ_UnabToEsta";
60     private final static String JavaDoc ResultSetGetWarningsFailed = "IJ_UnabToGetWar_19";
61     private final static String JavaDoc ResourceNotFound = "IJ_ResoNotFoun";
62     private final static String JavaDoc ScrollCursorsNotSupported = "IJ_ScroCursAre1";
63     private final static String JavaDoc HoldCursorsNotSupported = "IJ_HoldCursAre4";
64     private final static String JavaDoc StatementGetWarningsFailed = "IJ_UnabToGetWar_22";
65     private final static String JavaDoc WaitInterrupted = "IJ_WaitForStatI";
66     private final static String JavaDoc ZeroInvalidForAbsolute = "IJ_0IsAnInvaVal";
67
68     public ijException(String JavaDoc message) {
69         super(message);
70     }
71
72     static ijException notYetImplemented() {
73         return new ijException(LocalizedResource.getMessage(NotYetImplemented));
74     }
75
76     static ijException illegalStatementName(String JavaDoc n) {
77         return new ijException(LocalizedResource.getMessage(IllegalStatementName, n));
78     }
79     static ijException alreadyHaveConnectionNamed(String JavaDoc n) {
80         return new ijException(LocalizedResource.getMessage(AlreadyHaveConnectionNamed, n));
81     }
82     static ijException bangException(Throwable JavaDoc t) {
83         return new ijException(LocalizedResource.getMessage(BangException, t.toString()));
84     }
85     static ijException classNotFoundForProtocol(String JavaDoc p) {
86         return new ijException(LocalizedResource.getMessage(ClassNotFoundForProtocol, p));
87     }
88     static ijException classNotFound(String JavaDoc c) {
89         return new ijException(LocalizedResource.getMessage(ClassNotFound, c));
90     }
91     static ijException connectionGetWarningsFailed() {
92         return new ijException(LocalizedResource.getMessage(ConnectionGetWarningsFailed));
93     }
94     static ijException disconnectFailed() {
95         return new ijException(LocalizedResource.getMessage(DisconnectFailed));
96     }
97     static ijException driverNotClassName(String JavaDoc c) {
98         return new ijException(LocalizedResource.getMessage(DriverNotClassName, c));
99     }
100     static ijException fileNotFound() {
101         return new ijException(LocalizedResource.getMessage(FileNotFound));
102     }
103     static public ijException forwardOnlyCursor(String JavaDoc operation) {
104         return new ijException(LocalizedResource.getMessage(ForwardOnlyCursor, operation));
105     }
106     static ijException resourceNotFound() {
107         return new ijException(LocalizedResource.getMessage(ResourceNotFound));
108     }
109     static ijException getConnectionFailed() {
110         return new ijException(LocalizedResource.getMessage(GetConnectionFailed));
111     }
112     static ijException iOException(IOException JavaDoc t) {
113         return new ijException(LocalizedResource.getMessage(IOException, t.getMessage()));
114     }
115     static ijException needToDisconnect() {
116         return new ijException(LocalizedResource.getMessage(NeedToDisconnect));
117     }
118     static ijException noSuchAsyncStatement(String JavaDoc c) {
119         return new ijException(LocalizedResource.getMessage(NoSuchAsyncStatement, c));
120     }
121     static ijException noSuchConnection(String JavaDoc c) {
122         return new ijException(LocalizedResource.getMessage(NoSuchConnection, c));
123     }
124     static ijException noSuchProtocol(String JavaDoc c) {
125         return new ijException(LocalizedResource.getMessage(NoSuchProtocol, c));
126     }
127     static ijException noSuchTable(String JavaDoc c) {
128         return new ijException(LocalizedResource.getMessage(NoSuchTable, c));
129     }
130     static public ijException notJDBC20(String JavaDoc operation) {
131         return new ijException(LocalizedResource.getMessage(NotJDBC20, operation));
132     }
133     static ijException noUsingResults() {
134         return new ijException(LocalizedResource.getMessage(NoUsingResults));
135     }
136     static public ijException objectWasNull(String JavaDoc objectName) {
137         return new ijException(LocalizedResource.getMessage(ObjectWasNull, objectName));
138     }
139     static ijException resultSetGetWarningsFailed() {
140         return new ijException(LocalizedResource.getMessage(ResultSetGetWarningsFailed));
141     }
142     static ijException scrollCursorsNotSupported() {
143         return new ijException(LocalizedResource.getMessage(ScrollCursorsNotSupported));
144     }
145     //IJImpl20.utilMain can't throw exception for holdable cursors if
146
//following not declared public
147
public static ijException holdCursorsNotSupported() {
148         return new ijException(LocalizedResource.getMessage(HoldCursorsNotSupported));
149     }
150     static ijException statementGetWarningsFailed() {
151         return new ijException(LocalizedResource.getMessage(StatementGetWarningsFailed));
152     }
153     static ijException waitInterrupted(Throwable JavaDoc t) {
154         return new ijException(LocalizedResource.getMessage(WaitInterrupted, t.toString()));
155     }
156     public static ijException zeroInvalidForAbsolute() {
157         return new ijException(LocalizedResource.getMessage(ZeroInvalidForAbsolute));
158     }
159 }
160
Popular Tags