1 /*------------------------------------------------------------------------------
  2 Name:      ErrorCode.h
  3 Project:   xmlBlaster.org
  4 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
  5 Comment:   Basic xmlBlaster exception ErrorCode definitions.
  6 ------------------------------------------------------------------------------*/
  7 
  8 /**
  9  * The basic exception handling class for xmlBlaster.
 10  * <p>
 11  * The getMessage() method returns a configurable formatted std::string
 12  * (TODO)
 13  * here is an example how to configure the format in your xmlBlaster.properties:
 14  * <pre>
 15  *  XmlBlasterException.logFormat=XmlBlasterException errorCode=[{0}] node=[{1}] location=[{2}] message=[{4} : {8}]
 16  *  XmlBlasterException.logFormat.internal= org::xmlBlaster::util::XmlBlasterException errorCode=[{0}] node=[{1}] location=[{2}]\nmessage={4} : {8}\nversionInfo={5}\nstackTrace={7}
 17  *  XmlBlasterException.logFormat.resource= defaults to org::xmlBlaster::util::XmlBlasterException.logFormat
 18  *  XmlBlasterException.logFormat.communication= defaults to org::xmlBlaster::util::XmlBlasterException.logFormat
 19  *  XmlBlasterException.logFormat.user= defaults to org::xmlBlaster::util::XmlBlasterException.logFormat
 20  *  XmlBlasterException.logFormat.transaction= defaults to org::xmlBlaster::util::XmlBlasterException.logFormat
 21  *  XmlBlasterException.logFormat.legacy= defaults to org::xmlBlaster::util::XmlBlasterException.logFormat
 22  * </pre>
 23  * where the replacements are:
 24  * <pre>
 25  *  {0} = errorCodeStr
 26  *  {1} = node
 27  *  {2} = location
 28  *  {3} = lang
 29  *  {4} = message
 30  *  {5} = versionInfo
 31  *  {6} = timestamp
 32  *  {7} = stackTrace
 33  *  {8} = embeddedMessage
 34  *  {9} = transactionInfo
 35  * </pre>
 36  * @author "Marcel Ruff" <xmlBlaster@marcelruff.info>
 37  * @author "Michele Laghi" <laghi@swissinfo.org>
 38  * @since 0.8+ with extended attributes
 39  * @see <a href="http://www.xmlBlaster.org/xmlBlaster/doc/requirements/admin.errorcodes.html">The admin.errorcodes requirement</a>
 40  */
 41 
 42 #ifndef _UTIL_ERRORCODE_H
 43 #define _UTIL_ERRORCODE_H
 44 
 45 #include <string>
 46 #include <util/Timestamp.h>
 47 
 48 namespace org { namespace xmlBlaster { namespace util {
 49 
 50    struct Dll_Export ErrorCode {
 51       std::string errorCode;
 52       std::string description;
 53       ErrorCode(const std::string &ec, const std::string &desc)
 54         : errorCode(ec), description(desc)
 55       {
 56       }
 57    };
 58 
 59    const ErrorCode LEGACY("legacy",
 60       std::string("This error code marks all old style org::xmlBlaster::util::XmlBlasterExceptions ") +
 61       std::string("until they are ported to the new behaviour.")
 62    );
 63 
 64    const ErrorCode INTERNAL_UNKNOWN("internal.unknown",
 65       std::string("This is an unknown and unexpected error, usually a runtime ") +
 66       std::string("exception, please post it to the mailing list.")
 67    );
 68 
 69    const ErrorCode INTERNAL_NULLPOINTER("internal.nullpointer",
 70       std::string("A null pointer is an xmlBlaster internal programming error, ") +
 71       std::string("please post it to the mailing list.")
 72    );
 73 
 74    const ErrorCode INTERNAL_ILLEGALARGUMENT("internal.illegalArgument",
 75       std::string("An illegal argument is an xmlBlaster internal programming ") +
 76       std::string("error, please post it to the mailing list.")
 77    );
 78 
 79    const ErrorCode INTERNAL_NOTIMPLEMENTED("internal.notImplemented",
 80       std::string("The feature is not implemented yet.")
 81    );
 82 
 83    const ErrorCode INTERNAL_CONNECTIONFAILURE("internal.connectionFailure",
 84       std::string("An internal error occurred, we were not able to access the ") +
 85       std::string("server handle.")
 86    );
 87 
 88    const ErrorCode INTERNAL_DISCONNECT("internal.disconnect",
 89       std::string("An internal error occurred when processing a disconnect() request.")
 90    );
 91 
 92    const ErrorCode INTERNAL_SUBSCRIBE("internal.subscribe",
 93          "An internal error occurred when processing a subscribe() request."
 94    );
 95 
 96    const ErrorCode INTERNAL_UNSUBSCRIBE("internal.unSubscribe",
 97          "An internal error occurred when processing an unSubscribe() request."
 98    );
 99 
100    const ErrorCode INTERNAL_PUBLISH("internal.publish",
101          "An internal error occurred when processing a publish() request."
102    );
103 
104    const ErrorCode INTERNAL_ERASE("internal.erase",
105          "An internal error occurred when processing a erase() request."
106    );
107 
108    const ErrorCode INTERNAL_GET("internal.get",
109          "An internal error occurred when processing a get() request."
110    );
111 
112    const ErrorCode RESOURCE_OUTOFMEMORY("resource.outOfMemory",
113       std::string("The JVM has no more RAM memory, try increasing it like 'java ") +
114       std::string("-Xms18M -Xmx256M org.xmlBlaster.Main'")
115    );
116 
117    const ErrorCode RESOURCE_TOO_MANY_THREADS("resource.tooManyThreads",
118       std::string("The number of threads used is exceeded, try increasing the ") +
119       std::string("number of threads in the properties")
120    );
121 
122    const ErrorCode RESOURCE_CALLBACKSERVER_CREATION("resource.callbackServer.creation",
123             "The callback server can't be created"
124    );
125 
126    const ErrorCode RESOURCE_OVERFLOW_QUEUE_BYTES("resource.overflow.queue.bytes",
127          "The maximum size in bytes of a queue is exhausted"
128    );
129 
130    const ErrorCode RESOURCE_OVERFLOW_QUEUE_ENTRIES("resource.overflow.queue.entries",
131          "The maximum number of entries of a queue is exhausted"
132    );
133 
134    const ErrorCode RESOURCE_DB_UNAVAILABLE("resource.db.unavailable",
135          "There is no connection to a backend database using JDBC"
136    );
137 
138    const ErrorCode RESOURCE_CONFIGURATION_PLUGINFAILED("resource.configuration.pluginFailed",
139          "A plugin required couldn't be loaded, please check your configuration."
140    );
141 
142    const ErrorCode RESOURCE_CONFIGURATION_ADDRESS("resource.configuration.address",
143          "A remote address you passed is invalid, please check your configuration."
144    );
145 
146    const ErrorCode RESOURCE_FILEIO("resource.fileIO", "A file access failed.");
147 
148    const ErrorCode RESOURCE_FILEIO_FILELOST("resource.fileIO.fileLost",
149          "A file disappeared, access failed."
150    );
151 
152    const ErrorCode RESOURCE_CLUSTER_NOTAVAILABLE("resource.cluster.notAvailable",
153          "A remote cluster node is not reachable."
154    );
155 
156    const ErrorCode COMMUNICATION_NOCONNECTION("communication.noConnection",
157          "A method invocation on a remote connection failed."
158    );
159 
160    const ErrorCode COMMUNICATION_TIMEOUT("communication.timeout",
161          "The socket call blocked until a timeout occurred."
162    );
163 
164    const ErrorCode COMMUNICATION_RESPONSETIMEOUT("communication.responseTimeout",
165          "A method call blocked when waiting on the ACK/NAK return message."
166    );
167 
168    const ErrorCode COMMUNICATION_NOCONNECTION_POLLING("communication.noConnection.polling",
169          "The remote connection is not established and we are currently polling for it."
170    );
171 
172    const ErrorCode COMMUNICATION_NOCONNECTION_DEAD("communication.noConnection.dead",
173          "The remote connection is not established and we have given up to poll for it."
174    );
175 
176    const ErrorCode USER_WRONG_API_USAGE("user.wrongApiUsage",
177          "Please check your code."
178    );
179 
180    const ErrorCode USER_CONFIGURATION("user.configuration",
181          "Login to xmlBlaster failed due to configuration problems."
182    );
183 
184    const ErrorCode USER_SECURITY_AUTHENTICATION_ACCESSDENIED("user.security.authentication.accessDenied",
185          "Login to xmlBlaster failed due to missing privileges."
186    );
187 
188    const ErrorCode USER_SECURITY_AUTHENTICATION_ILLEGALARGUMENT("user.security.authentication.illegalArgument",
189          "Login to xmlBlaster failed due to illegal arguments."
190    );
191 
192    const ErrorCode USER_SECURITY_AUTHORIZATION_NOTAUTHORIZED("user.security.authorization.notAuthorized",
193          "Login to xmlBlaster failed due to missing privileges."
194    );
195 
196    const ErrorCode USER_UPDATE_ERROR("user.update.error",
197          "Exception thrown by client on callback update invocation."
198    );
199 
200    const ErrorCode USER_UPDATE_INTERNALERROR("user.update.internalError",
201          "Unexpected exception thrown by client code on programming error."
202    );
203 
204    const ErrorCode USER_UPDATE_ILLEGALARGUMENT("user.update.illegalArgument",
205          "The update method was invoked without useful data."
206    );
207 
208    const ErrorCode USER_ILLEGALARGUMENT("user.illegalArgument",
209          "You have invoked a server method with illegal arguments."
210    );
211 
212    const ErrorCode USER_UPDATE_HOLDBACK("user.update.holdback",
213          "You can throw this on client side in your update() method: Like this the server queues the message and sets the dispatcActive to false. You need to manually activate the dispatcher again."
214    );
215 
216    const ErrorCode USER_UPDATE_DEADMESSAGE("user.update.deadMessage",
217          "You can throw this on client side in your update() method: Like this the server publishes the message as dead letter and removes it from the callback queue. Since xmlBlaster > v2.0."
218    );
219 
220    const ErrorCode USER_UPDATE_SECURITY_AUTHENTICATION_ACCESSDENIED("user.update.security.authentication.accessDenied",
221          "The update method was invoked with an invalid callback session ID."
222    );
223 
224    const ErrorCode USER_OID_UNKNOWN("user.oid.unknown",
225          "You passed a message oid which is not known."
226    );
227 
228    const ErrorCode USER_JDBC_INVALID("user.jdbc.invalid",
229          "You have invoked get() with an illegal JDBC query."
230    );
231 
232    const ErrorCode USER_PUBLISH("user.publish",
233          "Your published message could not be handled, check your QoS"
234    );
235 
236    const ErrorCode USER_SUBSCRIBE_ID("user.subscribe.id",
237          "Your subscription tries to pass an illegal subscriptionId."
238    );
239 
240    const ErrorCode USER_CONNECT("user.connect",
241          "Your connection request could not be handled, check your QoS"
242    );
243 
244    const ErrorCode USER_PTP_UNKNOWNSESSION("user.ptp.unknownSession",
245       std::string("You have send a point to point message to a specific user ") +
246       std::string("session but the receiver is not known.")
247    );
248 
249    const ErrorCode USER_PTP_UNKNOWNDESTINATION("user.ptp.unknownDestination",
250       std::string("You have send a point to point message but the receiver is not ") +
251       std::string("known and <destination forceQueuing='true'> is not set.")
252    );
253 
254    const ErrorCode USER_QUERY_TYPE_INVALID("user.query.type.invalid",
255       std::string("You have invoked get(), subscribe(), unSubscribe() or erase() ") +
256       std::string("with an illegal query type, try EXACT or XPATH.")
257    );
258 
259    const ErrorCode USER_NOT_CONNECTED("user.notConnected",
260       "Your operation is not possible, please login with connect() first"
261    );
262 
263 
264 }}} // namespaces
265 
266 #endif


syntax highlighted by Code2HTML, v. 0.9.1