1 19 package org.openharmonise.webdav.client; 20 21 import java.util.HashMap ; 22 23 import org.openharmonise.vfs.status.*; 24 25 26 32 public class VFSStatusWebDAV extends AbstractStatusData implements StatusData { 33 34 private static HashMap m_statusMappings = new HashMap (); 35 36 static { 37 for(int i=100; i<400; i++) { 38 m_statusMappings.put(new Integer (i), new StatusMapping(i, StatusData.LEVEL_CONFIRM, StatusData.STATUS_OK)); 39 } 40 41 m_statusMappings.put(new Integer (400), new StatusMapping(400, StatusData.LEVEL_ERROR, StatusData.STATUS_INVALID_REQUEST)); 42 m_statusMappings.put(new Integer (401), new StatusMapping(401, StatusData.LEVEL_ERROR, StatusData.STATUS_INVALID_PERMISSIONS)); 43 m_statusMappings.put(new Integer (402), new StatusMapping(402, StatusData.LEVEL_ERROR, StatusData.STATUS_INVALID_REQUEST)); 44 m_statusMappings.put(new Integer (403), new StatusMapping(403, StatusData.LEVEL_ERROR, StatusData.STATUS_INVALID_PERMISSIONS)); 45 m_statusMappings.put(new Integer (404), new StatusMapping(404, StatusData.LEVEL_ERROR, StatusData.STATUS_RESOURCE_NOT_FOUND)); 46 m_statusMappings.put(new Integer (405), new StatusMapping(405, StatusData.LEVEL_ERROR, StatusData.STATUS_INVALID_REQUEST)); 47 m_statusMappings.put(new Integer (406), new StatusMapping(406, StatusData.LEVEL_ERROR, StatusData.STATUS_INVALID_REQUEST)); 48 m_statusMappings.put(new Integer (407), new StatusMapping(407, StatusData.LEVEL_ERROR, StatusData.STATUS_INVALID_PERMISSIONS)); 49 m_statusMappings.put(new Integer (408), new StatusMapping(408, StatusData.LEVEL_ERROR, StatusData.STATUS_TIMEOUT)); 50 m_statusMappings.put(new Integer (409), new StatusMapping(409, StatusData.LEVEL_ERROR, StatusData.STATUS_INVALID_RESOURCE_STATE)); 51 m_statusMappings.put(new Integer (410), new StatusMapping(410, StatusData.LEVEL_ERROR, StatusData.STATUS_RESOURCE_NOT_FOUND)); 52 m_statusMappings.put(new Integer (411), new StatusMapping(411, StatusData.LEVEL_ERROR, StatusData.STATUS_INVALID_REQUEST)); 53 m_statusMappings.put(new Integer (412), new StatusMapping(412, StatusData.LEVEL_ERROR, StatusData.STATUS_REQUEST_CONDITIONS_NOT_MET)); 54 m_statusMappings.put(new Integer (413), new StatusMapping(413, StatusData.LEVEL_ERROR, StatusData.STATUS_INVALID_REQUEST)); 55 m_statusMappings.put(new Integer (414), new StatusMapping(414, StatusData.LEVEL_ERROR, StatusData.STATUS_INVALID_REQUEST)); 56 m_statusMappings.put(new Integer (415), new StatusMapping(415, StatusData.LEVEL_ERROR, StatusData.STATUS_INVALID_REQUEST)); 57 m_statusMappings.put(new Integer (416), new StatusMapping(416, StatusData.LEVEL_ERROR, StatusData.STATUS_INVALID_REQUEST)); 58 m_statusMappings.put(new Integer (417), new StatusMapping(417, StatusData.LEVEL_ERROR, StatusData.STATUS_INVALID_REQUEST)); 59 for(int i=418; i<423; i++) { 60 m_statusMappings.put(new Integer (i), new StatusMapping(i, StatusData.LEVEL_ERROR, StatusData.STATUS_SERVER_ERROR)); 61 } 62 m_statusMappings.put(new Integer (423), new StatusMapping(423, StatusData.LEVEL_ERROR, StatusData.STATUS_RESOURCE_LOCKED)); 63 for(int i=424; i<500; i++) { 64 m_statusMappings.put(new Integer (i), new StatusMapping(i, StatusData.LEVEL_ERROR, StatusData.STATUS_SERVER_ERROR)); 65 } 66 for(int i=500; i<600; i++) { 67 m_statusMappings.put(new Integer (i), new StatusMapping(i, StatusData.LEVEL_ERROR, StatusData.STATUS_SERVER_ERROR)); 68 } 69 } 70 71 74 public VFSStatusWebDAV(int nHTTPStatus) { 75 super(); 76 StatusMapping stMap = (StatusMapping) m_statusMappings.get(new Integer (nHTTPStatus)); 77 super.setStatusCode(stMap.getStatus()); 78 super.setStatusLevel(stMap.getLevel()); 79 } 80 81 public VFSStatusWebDAV() { 82 super(); 83 } 84 85 public void setHTTPStatus(int nHTTPStatus) { 86 StatusMapping stMap = (StatusMapping) m_statusMappings.get(new Integer (nHTTPStatus)); 87 super.setStatusCode(stMap.getStatus()); 88 super.setStatusLevel(stMap.getLevel()); 89 } 90 91 94 public void setStatusCode(int nStatus) { 95 super.setStatusCode(nStatus); 96 } 97 100 public void setStatusLevel(int nLevel) { 101 super.setStatusLevel(nLevel); 102 } 103 } 104 | Popular Tags |