00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include <exception>
00014 #include <string>
00015
00016 #ifndef RLSReplicationExceptions_H
00017 #define RLSReplicationExceptions_H 1
00018
00019 namespace EdgReplicaLocationService {
00027 class ReplicationException : public std::exception {
00033 public:
00034
00035 public:
00036 ReplicationException() throw()
00037 : m_faultCode("FAULTABLE") {
00038 }
00039 ReplicationException(const std::string& what) throw()
00040 : m_what (what), m_faultCode("INTERNAL") {
00041 }
00042 ReplicationException(const std::string& what,
00043 const std::string& faultCode) throw()
00044 : m_what (what), m_faultCode(faultCode) {
00045 }
00046 const std::string& faultCode() const throw() {
00047 return m_faultCode;
00048 }
00049 virtual const char* what () const throw() {
00050 return m_what.c_str ();
00051 }
00052 virtual ~ReplicationException() throw(){
00053 }
00054
00055 private:
00056 std::string m_what;
00057 std::string m_faultCode;
00058
00059 };
00060
00064 class NotImplementedException : public ReplicationException {
00065 public:
00066 NotImplementedException(const std::string& method)
00067 : ReplicationException("Not Implemented: " + method),
00068 m_method(method) {
00069 }
00070 virtual ~NotImplementedException() throw(){
00071 }
00072 const std::string& getMethod() const {
00073 return m_method;
00074 }
00075
00076 private:
00077 const std::string m_method;
00078 };
00079
00083 class EmptyAttributeNameException : public ReplicationException {
00084 public:
00085 EmptyAttributeNameException(const std::string& message)
00086 : ReplicationException(message) {
00087 }
00088 virtual ~EmptyAttributeNameException() throw(){
00089 }
00090 };
00091
00095 class NoSuchGuidException : public ReplicationException {
00096 public:
00097 NoSuchGuidException(const std::string& guid)
00098 : ReplicationException("No Such Guid: " + guid, "NOSUCHGUID"),
00099 m_guid(guid) {
00100 }
00101 virtual ~NoSuchGuidException() throw(){
00102 }
00103 const std::string& getGuid() const {
00104 return m_guid;
00105 }
00106
00107 private:
00108 const std::string m_guid;
00109 };
00110
00114 class NoSuchPfnException : public ReplicationException {
00115 public:
00116 NoSuchPfnException(const std::string& pfn)
00117 : ReplicationException("No Such Pfn: " + pfn, "NOSUCHPFN"),
00118 m_pfn(pfn) {
00119 }
00120 virtual ~NoSuchPfnException() throw(){
00121 }
00122 const std::string getPfn() const {
00123 return m_pfn;
00124 }
00125
00126 private:
00127 const std::string m_pfn;
00128 };
00129
00133 class PfnExistsException : public ReplicationException {
00134 public:
00135 PfnExistsException(const std::string& pfn)
00136 : ReplicationException("Pfn Exists: " + pfn, "PFNEXISTS"),
00137 m_pfn(pfn) {
00138 }
00139 virtual ~PfnExistsException() throw(){
00140 }
00141 const std::string getPfn() const {
00142 return m_pfn;
00143 }
00144
00145 private:
00146 const std::string m_pfn;
00147 };
00148
00152 class AttributeExistsException : public ReplicationException {
00153 public:
00154 AttributeExistsException(const std::string& message)
00155 : ReplicationException(message, "ATTRIBUTEEXISTS") {
00156 }
00157 virtual ~AttributeExistsException() throw() {
00158 }
00159 };
00160
00164 class AttributeDefinitionExistsException : public ReplicationException {
00165 public:
00166 AttributeDefinitionExistsException(const std::string& message)
00167 : ReplicationException(message, "ATTRIBUTEDEFNEXISTS") {
00168 }
00169 virtual ~AttributeDefinitionExistsException() throw(){
00170 }
00171 };
00172
00176 class NoSuchAttributeDefinitionException : public ReplicationException {
00177 public:
00178 NoSuchAttributeDefinitionException(const std::string& message)
00179 : ReplicationException(message, "NOSUCHATTRIBUTEDEFN") {
00180 }
00181 virtual ~NoSuchAttributeDefinitionException() throw(){
00182 }
00183 };
00184
00188 class NoSuchAttributeException : public ReplicationException {
00189 public:
00190 NoSuchAttributeException(const std::string& message)
00191 : ReplicationException(message, "NOSUCHATTRIBUTE") {
00192 }
00193 virtual ~NoSuchAttributeException() throw(){
00194 }
00195 };
00196
00200 class ValueTooLongException : public ReplicationException {
00201 public:
00202 ValueTooLongException( const std::string& message )
00203 : ReplicationException(message, "TOOLONGNAME") {
00204 }
00205 virtual ~ValueTooLongException() throw() {
00206 }
00207 };
00208
00212 class UnappropriateAttributeTypeException : public ReplicationException {
00213 public:
00214 UnappropriateAttributeTypeException( const std::string& message )
00215 : ReplicationException(message, "ATTRTYPENOTGOODFORATTRNAME") {
00216 }
00217 virtual ~UnappropriateAttributeTypeException() throw() {
00218 }
00219 };
00220
00224 class InvalidQueryException : public ReplicationException {
00225 public:
00226 InvalidQueryException( const std::string& message )
00227 : ReplicationException(message, "INVALIDQUERY") {
00228 }
00229 virtual ~InvalidQueryException() throw() {
00230 }
00231 };
00232
00233 class CommunicationException : public ReplicationException {
00234 public:
00235 CommunicationException()
00236 : ReplicationException() {
00237 }
00238 CommunicationException(const std::string& message)
00239 : ReplicationException(message, "CONNECTION") {
00240 }
00241 virtual ~CommunicationException() throw(){
00242 }
00243 };
00244
00250 void
00251 throwReplicationException(const std::string& fault,
00252 const std::string& detail);
00253 }
00254
00255
00256 #endif // ReplicationExceptions_H
00257