ORCentral
|
00001 package eu.coform; 00002 00003 import java.util.HashMap; 00004 00008 public enum Error { 00009 // Infrastructure 00010 NoError(0), 00011 UnspecifiedError(1), 00012 UUIDClash(10101), 00013 FunctionNotImplemented(10102), 00014 RepositoryNoConnection(10103), 00015 LocationNotLoggedInToAny(10104), 00016 SoapTransmissionFailure(10105), 00017 InternalError(10106), 00018 UUIDInvalid(10107), 00019 // Location 00020 LocationNoConnection(10201), 00021 LocationInvalid(10202), 00022 LocationAlreadyExists(10203), 00023 // Session 00024 UsernamePwWrong(10301), 00025 SessionExpired(10302), 00026 RequestedTimeoutTooLong(10303), 00027 SwitchUserNotPermitted(10304), 00028 SessionInvalid(10305), 00029 // Ingestion 00030 DatasetInconistent(10401), 00031 FileAlreadyUploadeD(10402), 00032 DatasetIdInvalid(10403), 00033 FilestructIdInvalid(10404), 00034 GroupIdInvalid(10405), 00035 ServerStorageCapacityExceeded(10405), 00036 //...... 00037 //...... 00038 // Filestatus & Mimetype 00039 FilestatusInvalid(11201), 00040 MimetypeInvalid(11202), 00041 FilestatusAlreadyExists(11203), 00042 MimetypeAlreadyExists(11204), 00043 MimetypeCreationFailed(11205), 00044 FilestatusCreationFailed(11206), 00045 ; 00046 00050 public static final HashMap<Integer, String> errorMap = new HashMap<Integer, String>(); 00051 static { 00052 errorMap.put(NoError.code(), "No error"); 00053 errorMap.put(UnspecifiedError.code(), "Unspecified error"); 00054 errorMap.put(UUIDClash.code(), "UUID Clash"); 00055 errorMap.put(FunctionNotImplemented.code(), "Function not implemented"); 00056 errorMap.put(RepositoryNoConnection.code(), "No connection to repository"); 00057 errorMap.put(LocationNotLoggedInToAny.code(), "Not logged int o any lcoation"); 00058 errorMap.put(SoapTransmissionFailure.code(), "SOAP transmission failure"); 00059 errorMap.put(InternalError.code(), "Internal Error"); 00060 errorMap.put(UUIDInvalid.code(), "UUID Invalid"); 00061 // Location 00062 errorMap.put(LocationNoConnection.code(), "No connection to location"); 00063 errorMap.put(LocationInvalid.code(), "Invalid location"); 00064 errorMap.put(LocationAlreadyExists.code(), "Location already exists"); 00065 // Session 00066 errorMap.put(UsernamePwWrong.code(), "Wrong Username/Password"); 00067 errorMap.put(SessionExpired.code(), "Session expired"); 00068 errorMap.put(RequestedTimeoutTooLong.code(), "Requested timeout too long"); 00069 errorMap.put(SwitchUserNotPermitted.code(), "Switch user not permitted"); 00070 errorMap.put(SessionInvalid.code(), "Session invalid"); 00071 // Ingestion 00072 errorMap.put(DatasetInconistent.code(), "Dataset is inconsitent"); 00073 errorMap.put(FileAlreadyUploadeD.code(), "File already uploaded"); 00074 errorMap.put(DatasetIdInvalid.code(), "Invalid dataset ID"); 00075 errorMap.put(FilestructIdInvalid.code(), "Invalid filestruct ID"); 00076 errorMap.put(GroupIdInvalid.code(), "Invalid group ID"); 00077 errorMap.put(ServerStorageCapacityExceeded.code(), "Servers storage capacity exceeded"); 00078 //...... 00079 //...... 00080 // Filestatus & Mimetype 00081 errorMap.put(FilestatusInvalid.code(), "Invalid Filestatus"); 00082 errorMap.put(MimetypeInvalid.code(), "Invalid Mimetype"); 00083 errorMap.put(FilestatusAlreadyExists.code(), "Filestatus already exists (same name or URI)"); 00084 errorMap.put(MimetypeAlreadyExists.code(), "Mimetype already exists (same name.code(), URI or extension"); 00085 errorMap.put(MimetypeCreationFailed.code(), "Creation of Mimetype failed"); 00086 errorMap.put(FilestatusCreationFailed.code(), "Creation of Filestatus failed"); 00087 } 00088 00089 private int m_code; 00090 private String m_internalError; 00091 00097 private Error(int code) { 00098 m_code = code; 00099 } 00100 00106 public void setInternalError(String string) { 00107 m_internalError = string; 00108 } 00109 00117 public String description() { 00118 return errorMap.get(m_code); 00119 } 00120 00126 public String internalErrorDescription() { 00127 return m_internalError; 00128 } 00129 00134 public int code() { 00135 return m_code; 00136 } 00137 00138 }