Project

General

Profile

« Previous | Next » 

Revision 6091

In order to sync up with DataONE 0.6.1 changes, I'm backing out ObjectFormatService changes temporarily in Metacat. Most functionality will be rolled back in using the DataONE 0.6.2 tag, but some methods in ObjectFormatService (such as getListFromDisk()) will be moved into d1_libclient_java.

View differences:

ResourceHandler.java
77 77
import edu.ucsb.nceas.metacat.dataone.CrudService;
78 78
import edu.ucsb.nceas.metacat.dataone.HealthService;
79 79
import edu.ucsb.nceas.metacat.properties.PropertyService;
80
import edu.ucsb.nceas.metacat.service.ObjectFormatService;
81 80
import edu.ucsb.nceas.metacat.service.SessionService;
82 81
import edu.ucsb.nceas.metacat.util.RequestUtil;
83 82
import edu.ucsb.nceas.metacat.util.SystemUtil;
......
533 532
                            if(params.containsKey("format"))
534 533
                            {
535 534
                                String format = params.get("format")[0];
536
                                of = ObjectFormatService.getFormat(format);
535
                                of = ObjectFormat.convert(format);
537 536
                            }
538 537
                            if(params.containsKey("time"))
539 538
                            {
......
570 569
                            if(params.containsKey("format"))
571 570
                            {
572 571
                                String format = params.get("format")[0];
573
                                of = ObjectFormatService.getFormat(format);
572
                                of = ObjectFormat.convert(format);
574 573
                            }
575 574
                            if(params.containsKey("eventtime"))
576 575
                            {
......
1167 1166
        cs.setParamsFromRequest(request);
1168 1167
        AuthToken token = new AuthToken(sessionId);
1169 1168
        OutputStream out = null;
1170
        String textCSV     = ObjectFormatService.getFormat("text/csv").toString();
1171
        String textPlain   = ObjectFormatService.getFormat("text/plain").toString();
1172
        String octetStream = ObjectFormatService.getFormat("application/octet-stream").toString();
1173
        
1174 1169
        try {
1175 1170
            out = response.getOutputStream();
1176 1171
            response.setStatus(200);
......
1188 1183
                    SystemMetadata sm = cs.getSystemMetadata(token, id);
1189 1184
                    
1190 1185
                    //set the content type
1191
                    if(sm.getObjectFormat().toString().trim().equals(textCSV))
1186
                    if(sm.getObjectFormat().toString().trim().equals(ObjectFormat.TEXT_CSV.toString()))
1192 1187
                    {
1193 1188
                        response.setContentType("text/csv");
1194 1189
                        response.setHeader("Content-Disposition", "inline; filename=" + id.getValue() + ".csv");
1195 1190
                    }
1196
                    else if(sm.getObjectFormat().toString().trim().equals(textPlain))
1191
                    else if(sm.getObjectFormat().toString().trim().equals(ObjectFormat.TEXT_PLAIN.toString()))
1197 1192
                    {
1198 1193
                        response.setContentType("text/plain");
1199 1194
                        response.setHeader("Content-Disposition", "inline; filename=" + id.getValue() + ".txt");
1200 1195
                    } 
1201
                    else if(sm.getObjectFormat().toString().trim().equals(octetStream))
1196
                    else if(sm.getObjectFormat().toString().trim().equals(ObjectFormat.OCTET_STREAM.toString()))
1202 1197
                    {
1203 1198
                        response.setContentType("application/octet-stream");
1204 1199
                    }
......
1295 1290
                    }
1296 1291
                    else if(name.equals("objectFormat") && value != null) 
1297 1292
                    {
1298
                        objectFormat = ObjectFormatService.getFormat(value[0]);
1293
                        objectFormat = ObjectFormat.convert(value[0]);
1299 1294
                    }
1300 1295
                    else if(name.equals("replicaStatus") && value != null)
1301 1296
                    {

Also available in: Unified diff