Project

General

Profile

« Previous | Next » 

Revision 6367

remove ServiceTypeUtil - replace with TypeMarshaller

View differences:

D1ResourceHandler.java
56 56
import org.dataone.service.exceptions.ServiceFailure;
57 57
import org.dataone.service.types.v1.Session;
58 58
import org.dataone.service.types.v1.SystemMetadata;
59
import org.dataone.service.types.util.ServiceTypeUtil;
59
import org.dataone.service.util.TypeMarshaller;
60 60
import org.jibx.runtime.JiBXException;
61 61

  
62 62
import edu.ucsb.nceas.metacat.MetacatHandler;
......
150 150
        }
151 151
    }
152 152
    
153
    protected SystemMetadata collectSystemMetadata() throws IOException, FileUploadException, ServiceFailure, InvalidRequest, JiBXException  {
153
    protected SystemMetadata collectSystemMetadata() throws IOException, FileUploadException, ServiceFailure, InvalidRequest, JiBXException, InstantiationException, IllegalAccessException  {
154 154
		
155 155
		// Read the incoming data from its Mime Multipart encoding
156 156
		logMetacat.debug("Disassembling MIME multipart form");
......
221 221
		sysmeta = new FileInputStream(smFile);
222 222
	
223 223
		logMetacat.debug("Commence creation...");
224
		SystemMetadata systemMetadata = (SystemMetadata) deserializeServiceType(SystemMetadata.class, sysmeta);
224
		SystemMetadata systemMetadata = TypeMarshaller.unmarshalTypeFromStream(SystemMetadata.class, sysmeta);
225 225
		return systemMetadata;
226 226
	}
227 227
    
......
335 335
        }    
336 336
    }
337 337

  
338
    /**
339
     * serialize an object of type to out
340
     * @param type the class of the object to serialize (i.e. SystemMetadata.class)
341
     * @param object the object to serialize
342
     * @param out the stream to serialize it to
343
     * @throws JiBXException
344
     */
345
    protected void serializeServiceType(Class type, Object object, OutputStream out)
346
      throws JiBXException {
347
        ServiceTypeUtil.serializeServiceType(type, object, out);
348
    }
349
    
350
    /**
351
     * deserialize an object of type from is
352
     * @param type the class of the object to serialize (i.e. SystemMetadata.class)
353
     * @param is the stream to deserialize from
354
     * @throws JiBXException
355
     */
356
    protected Object deserializeServiceType(Class type, InputStream is)
357
      throws JiBXException {
358
        return ServiceTypeUtil.deserializeServiceType(type, is);
359
    }
360 338
        
361 339
    /**
362 340
     * locate the boundary marker for an MMP

Also available in: Unified diff