Project

General

Profile

« Previous | Next » 

Revision 9477

Added by Jing Tao over 8 years ago

Add the code to check if the metacat is in the read-only mode.

View differences:

src/edu/ucsb/nceas/metacat/MetaCatServlet.java
1218 1218
    	return _fullyInitialized;
1219 1219
    }
1220 1220
    
1221
    private boolean isReadOnly(HttpServletResponse response) throws IOException {
1221
    public static boolean isReadOnly(HttpServletResponse response) throws IOException {
1222 1222
        boolean readOnly = false;
1223 1223
        ReadOnlyChecker checker = new ReadOnlyChecker();
1224 1224
        readOnly = checker.isReadOnly();
src/edu/ucsb/nceas/metacat/replication/ReplicationServlet.java
47 47
import org.apache.log4j.Logger;
48 48
import org.dataone.client.auth.CertificateManager;
49 49

  
50
import edu.ucsb.nceas.metacat.MetaCatServlet;
50 51
import edu.ucsb.nceas.metacat.service.ServiceService;
51 52
import edu.ucsb.nceas.metacat.shared.ServiceException;
52 53

  
......
149 150
				ReplicationService.handleGetDataFileRequest(outStream, params, response);
150 151
				outStream.close();
151 152
			} else if (action.equals("forcereplicatedatafile")) {
153
			    if(MetaCatServlet.isReadOnly(response)) {
154
                    return;
155
                }
152 156
				//read a specific docid from remote host, and store it into local host
153 157
				ReplicationService.handleForceReplicateDataFileRequest(params, request);
154 158
			} else if (action.equals("forcereplicate")) {
159
			    if(MetaCatServlet.isReadOnly(response)) {
160
                    return;
161
                }
155 162
				// read a specific docid from remote host, and store it into local host
156 163
				ReplicationService.handleForceReplicateRequest(params, response, request);
157 164
			} else if (action.equals("forcereplicatesystemmetadata")) {
165
			    if(MetaCatServlet.isReadOnly(response)) {
166
                    return;
167
                }
158 168
				ReplicationService.handleForceReplicateSystemMetadataRequest(params, response, request);
159 169
			} else if (action.equals(ReplicationService.FORCEREPLICATEDELETE)) {
170
			    if(MetaCatServlet.isReadOnly(response)) {
171
                    return;
172
                }
160 173
				// read a specific docid from remote host, and store it into local host
161 174
				ReplicationService.handleForceReplicateDeleteRequest(params, response, request, false);
162 175
			} else if (action.equals(ReplicationService.FORCEREPLICATEDELETEALL)) {
176
			    if(MetaCatServlet.isReadOnly(response)) {
177
                    return;
178
                }
163 179
				// read a specific docid from remote host, and store it into local host
164 180
				ReplicationService.handleForceReplicateDeleteRequest(params, response, request, true);
165 181
			} else if (action.equals("update")) {
182
			    if(MetaCatServlet.isReadOnly(response)) {
183
                    return;
184
                }
166 185
				// request an update list from the server
167 186
				ReplicationService.handleUpdateRequest(params, response);
168 187
			} else if (action.equals("read")) {

Also available in: Unified diff