00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef RLIReplicationExceptions_H
00011 #define RLIReplicationExceptions_H 1
00012
00013 #include <exception>
00014 #include <string>
00015
00016
00023 namespace EdgReplicaLocationIndex {
00024
00029 class ReplicationException : public std::exception {
00030 public:
00031
00032 public:
00033 ReplicationException() throw()
00034 : m_faultCode("FAULTABLE") {
00035 }
00036 ReplicationException(const std::string& what) throw()
00037 : m_what (what), m_faultCode("INTERNAL") {
00038 }
00039 ReplicationException(const std::string& what,
00040 const std::string& faultCode) throw()
00041 : m_what (what), m_faultCode(faultCode) {
00042 }
00043 const std::string& faultCode() const throw() {
00044 return m_faultCode;
00045 }
00046 virtual const char* what () const throw() {
00047 return m_what.c_str ();
00048 }
00049 virtual ~ReplicationException() throw(){
00050 }
00051
00052 private:
00053 std::string m_what;
00054 std::string m_faultCode;
00055
00056 };
00057
00058
00062 class NotImplementedException : public ReplicationException {
00063 public:
00064 NotImplementedException(const std::string& method)
00065 : ReplicationException("Not Implemented: " + method),
00066 m_method(method) {
00067 }
00068 virtual ~NotImplementedException() throw(){
00069 }
00070 const std::string& getMethod() const {
00071 return m_method;
00072 }
00073
00074 private:
00075 const std::string m_method;
00076 };
00077
00081 class EmptyAttributeNameException : public ReplicationException {
00082 public:
00083 EmptyAttributeNameException(const std::string& message)
00084 : ReplicationException(message) {
00085 }
00086 virtual ~EmptyAttributeNameException() throw(){
00087 }
00088 };
00089
00093 class NoSuchGuidException : public ReplicationException {
00094 public:
00095 NoSuchGuidException(const std::string& guid)
00096 : ReplicationException("No Such Guid: " + guid, "NOSUCHGUID"),
00097 m_guid(guid) {
00098 }
00099 virtual ~NoSuchGuidException() throw() {
00100 }
00101 const std::string& getGuid() const {
00102 return m_guid;
00103 }
00104
00105 private:
00106 const std::string m_guid;
00107 };
00108
00109 class NoSuchAliasException : public ReplicationException {
00110 public:
00111 NoSuchAliasException(const std::string& alias)
00112 : ReplicationException("No Such Alias: " + alias, "NOSUCHALIAS"),
00113 m_alias(alias) {
00114 }
00115 virtual ~NoSuchAliasException() throw(){
00116 }
00117 const std::string& getAlias() const {
00118 return m_alias;
00119 }
00120
00121 private:
00122 const std::string m_alias;
00123 };
00124
00125 class AliasExistsException : public ReplicationException {
00126 public:
00127 AliasExistsException(const std::string& alias)
00128 : ReplicationException("Alias Exists: " + alias, "ALIASEXISTS"),
00129 m_alias(alias) {
00130 }
00131 virtual ~AliasExistsException() throw(){
00132 }
00133 const std::string& getAlias() const {
00134 return m_alias;
00135 }
00136
00137 private:
00138 const std::string m_alias;
00139 };
00140
00144 class AttributeExistsException : public ReplicationException {
00145 public:
00146 AttributeExistsException(const std::string& message)
00147 : ReplicationException(message, "ATTRIBUTEEXISTS") {
00148 }
00149 virtual ~AttributeExistsException() throw() {
00150 }
00151 };
00152
00156 class AttributeDefinitionExistsException : public ReplicationException {
00157 public:
00158 AttributeDefinitionExistsException(const std::string& message)
00159 : ReplicationException(message, "ATTRIBUTEDEFNEXISTS") {
00160 }
00161 virtual ~AttributeDefinitionExistsException() throw(){
00162 }
00163 };
00164
00168 class NoSuchAttributeDefinitionException : public ReplicationException {
00169 public:
00170 NoSuchAttributeDefinitionException(const std::string& message)
00171 : ReplicationException(message, "NOSUCHATTRIBUTEDEFN") {
00172 }
00173 virtual ~NoSuchAttributeDefinitionException() throw(){
00174 }
00175 };
00176
00180 class NoSuchAttributeException : public ReplicationException {
00181 public:
00182 NoSuchAttributeException(const std::string& message)
00183 : ReplicationException(message, "NOSUCHATTRIBUTE") {
00184 }
00185 virtual ~NoSuchAttributeException() throw(){
00186 }
00187 };
00188
00192 class AliasesExistException : public ReplicationException {
00193 public:
00194
00195 AliasesExistException(const std::string& guid)
00196 : ReplicationException("Aliases Exist for guid : " + guid, "ALIASESEXISTS"),
00197 m_guid(guid) {
00198 }
00199 virtual ~AliasesExistException() throw(){
00200 }
00201 const std::string& getGuid() const {
00202 return m_guid;
00203 }
00204
00205 private:
00206 const std::string m_guid;
00207 };
00208
00209 class HasAliasesException : public ReplicationException {
00210 public:
00211 HasAliasesException(const std::string& guid)
00212 : ReplicationException("No Such Guid: " + guid, "HASALIASES"),
00213 m_guid(guid) {
00214 }
00215 virtual ~HasAliasesException() throw(){
00216 }
00217 const std::string& getGuid() const {
00218 return m_guid;
00219 }
00220
00221 private:
00222 const std::string m_guid;
00223 };
00224
00228 class ValueTooLongException : public ReplicationException {
00229 public:
00230 ValueTooLongException( const std::string& message )
00231 : ReplicationException(message, "TOOLONGNAME") {
00232 }
00233 virtual ~ValueTooLongException() throw() {
00234 }
00235 };
00236
00240 class CommunicationException : public ReplicationException {
00241 public:
00242 CommunicationException()
00243 : ReplicationException() {
00244 }
00245 CommunicationException(const std::string& message)
00246 : ReplicationException(message, "CONNECTION") {
00247 }
00248 virtual ~CommunicationException() throw(){
00249 }
00250 };
00251
00257 void throwReplicationException(const std::string& fault, const std::string& detail);
00258 }
00259
00260
00261 #endif // ReplicationExceptions_H
00262