Revision 9304
Added by Jing Tao about 9 years ago
src/edu/ucsb/nceas/metacat/dataone/convert/LogV2toV1Converter.java | ||
---|---|---|
26 | 26 |
import java.io.IOException; |
27 | 27 |
import java.lang.reflect.InvocationTargetException; |
28 | 28 |
|
29 |
import org.apache.commons.beanutils.BeanUtils; |
|
30 | 29 |
import org.dataone.service.types.v1.Event; |
31 | 30 |
import org.dataone.service.types.v2.Log; |
32 | 31 |
import org.dataone.service.types.v2.LogEntry; |
33 |
import org.dataone.service.util.TypeMarshaller; |
|
34 | 32 |
import org.jibx.runtime.JiBXException; |
35 | 33 |
/** |
36 | 34 |
* This class represents a converter to convert an DataONE v2 Log object to a v1 Log object. |
src/edu/ucsb/nceas/metacat/dataone/v1/CNodeService.java | ||
---|---|---|
70 | 70 |
import org.dataone.service.types.v1.SystemMetadata; |
71 | 71 |
import org.dataone.service.types.v1_1.QueryEngineDescription; |
72 | 72 |
import org.dataone.service.types.v1_1.QueryEngineList; |
73 |
import org.dataone.service.util.TypeMarshaller;
|
|
73 |
import org.dataone.service.types.v2.TypeFactory;
|
|
74 | 74 |
|
75 | 75 |
import edu.ucsb.nceas.metacat.IdentifierManager; |
76 | 76 |
import edu.ucsb.nceas.metacat.dataone.convert.LogV2toV1Converter; |
... | ... | |
285 | 285 |
org.dataone.service.types.v2.SystemMetadata sysMeta = impl.getSystemMetadata(null, pid); |
286 | 286 |
SystemMetadata retSysMeta = null; |
287 | 287 |
try { |
288 |
retSysMeta = TypeMarshaller.convertTypeFromType(sysMeta, SystemMetadata.class);
|
|
288 |
retSysMeta = TypeFactory.convertTypeFromType(sysMeta, SystemMetadata.class);
|
|
289 | 289 |
} catch (Exception e) { |
290 | 290 |
// report as service failure |
291 | 291 |
ServiceFailure sf = new ServiceFailure("1090", e.getMessage()); |
... | ... | |
307 | 307 |
org.dataone.service.types.v2.SystemMetadata sysMeta = impl.getSystemMetadata(session, pid); |
308 | 308 |
SystemMetadata retSysMeta = null; |
309 | 309 |
try { |
310 |
retSysMeta = TypeMarshaller.convertTypeFromType(sysMeta, SystemMetadata.class);
|
|
310 |
retSysMeta = TypeFactory.convertTypeFromType(sysMeta, SystemMetadata.class);
|
|
311 | 311 |
} catch (Exception e) { |
312 | 312 |
// report as service failure |
313 | 313 |
ServiceFailure sf = new ServiceFailure("1090", e.getMessage()); |
... | ... | |
439 | 439 |
//convert sysmeta to newer version |
440 | 440 |
org.dataone.service.types.v2.SystemMetadata v2Sysmeta = null; |
441 | 441 |
try { |
442 |
v2Sysmeta = TypeMarshaller.convertTypeFromType(sysmeta, org.dataone.service.types.v2.SystemMetadata.class);
|
|
442 |
v2Sysmeta = TypeFactory.convertTypeFromType(sysmeta, org.dataone.service.types.v2.SystemMetadata.class);
|
|
443 | 443 |
} catch (Exception e) { |
444 | 444 |
// report as service failure |
445 | 445 |
ServiceFailure sf = new ServiceFailure("1030", e.getMessage()); |
... | ... | |
493 | 493 |
org.dataone.service.types.v2.ObjectFormat format = impl.getFormat(fmtid); |
494 | 494 |
ObjectFormat v1Format = null; |
495 | 495 |
try { |
496 |
v1Format = TypeMarshaller.convertTypeFromType(format, ObjectFormat.class);
|
|
496 |
v1Format = TypeFactory.convertTypeFromType(format, ObjectFormat.class);
|
|
497 | 497 |
} catch (Exception e) { |
498 | 498 |
ServiceFailure sf = new ServiceFailure("4846", e.getMessage()); |
499 | 499 |
sf.initCause(e); |
... | ... | |
538 | 538 |
} |
539 | 539 |
org.dataone.service.types.v2.Log log = impl.getLogRecords(session, fromDate, toDate, eventValue, pidFilter, start, count); |
540 | 540 |
try { |
541 |
//retLog = TypeMarshaller.convertTypeFromType(log, Log.class);
|
|
541 |
//retLog = TypeFactory.convertTypeFromType(log, Log.class);
|
|
542 | 542 |
LogV2toV1Converter converter = new LogV2toV1Converter(); |
543 | 543 |
retLog = converter.convert(log); |
544 | 544 |
} catch (Exception e) { |
... | ... | |
581 | 581 |
List<org.dataone.service.types.v2.ObjectFormat> objectFormatList = formats.getObjectFormatList(); |
582 | 582 |
if(objectFormatList != null) { |
583 | 583 |
for(org.dataone.service.types.v2.ObjectFormat format : objectFormatList) { |
584 |
ObjectFormat v1Format = TypeMarshaller.convertTypeFromType(format, ObjectFormat.class);
|
|
584 |
ObjectFormat v1Format = TypeFactory.convertTypeFromType(format, ObjectFormat.class);
|
|
585 | 585 |
retFormats.addObjectFormat(v1Format); |
586 | 586 |
} |
587 | 587 |
} |
588 | 588 |
|
589 | 589 |
} |
590 |
//retFormats = TypeMarshaller.convertTypeFromType(formats, ObjectFormatList.class);
|
|
590 |
//retFormats = TypeFactory.convertTypeFromType(formats, ObjectFormatList.class);
|
|
591 | 591 |
} catch (Exception e) { |
592 | 592 |
// report as service failure |
593 | 593 |
ServiceFailure sf = new ServiceFailure("4841", e.getMessage()); |
... | ... | |
602 | 602 |
org.dataone.service.types.v2.NodeList nodes = impl.listNodes(); |
603 | 603 |
NodeList retNodes = null; |
604 | 604 |
try { |
605 |
retNodes = TypeMarshaller.convertTypeFromType(nodes, NodeList.class);
|
|
605 |
retNodes = TypeFactory.convertTypeFromType(nodes, NodeList.class);
|
|
606 | 606 |
} catch (Exception e) { |
607 | 607 |
// report as service failure |
608 | 608 |
ServiceFailure sf = new ServiceFailure("4801", e.getMessage()); |
... | ... | |
634 | 634 |
//convert sysmeta to newer version |
635 | 635 |
org.dataone.service.types.v2.SystemMetadata v2Sysmeta = null; |
636 | 636 |
try { |
637 |
v2Sysmeta = TypeMarshaller.convertTypeFromType(sysmeta, org.dataone.service.types.v2.SystemMetadata.class);
|
|
637 |
v2Sysmeta = TypeFactory.convertTypeFromType(sysmeta, org.dataone.service.types.v2.SystemMetadata.class);
|
|
638 | 638 |
} catch (Exception e) { |
639 | 639 |
// report as service failure |
640 | 640 |
ServiceFailure sf = new ServiceFailure("1030", e.getMessage()); |
src/edu/ucsb/nceas/metacat/dataone/v1/MNodeService.java | ||
---|---|---|
61 | 61 |
import org.dataone.service.types.v1.SystemMetadata; |
62 | 62 |
import org.dataone.service.types.v1_1.QueryEngineDescription; |
63 | 63 |
import org.dataone.service.types.v1_1.QueryEngineList; |
64 |
import org.dataone.service.util.TypeMarshaller;
|
|
64 |
import org.dataone.service.types.v2.TypeFactory;
|
|
65 | 65 |
|
66 | 66 |
import edu.ucsb.nceas.metacat.IdentifierManager; |
67 | 67 |
import edu.ucsb.nceas.metacat.dataone.convert.LogV2toV1Converter; |
... | ... | |
169 | 169 |
//convert sysmeta to newer version |
170 | 170 |
org.dataone.service.types.v2.SystemMetadata v2Sysmeta = null; |
171 | 171 |
try { |
172 |
v2Sysmeta = TypeMarshaller.convertTypeFromType(sysmeta, org.dataone.service.types.v2.SystemMetadata.class);
|
|
172 |
v2Sysmeta = TypeFactory.convertTypeFromType(sysmeta, org.dataone.service.types.v2.SystemMetadata.class);
|
|
173 | 173 |
} catch (Exception e) { |
174 | 174 |
// report as service failure |
175 | 175 |
ServiceFailure sf = new ServiceFailure("1190", e.getMessage()); |
... | ... | |
241 | 241 |
//convert sysmeta to newer version |
242 | 242 |
org.dataone.service.types.v2.SystemMetadata v2Sysmeta = null; |
243 | 243 |
try { |
244 |
v2Sysmeta = TypeMarshaller.convertTypeFromType(sysmeta, org.dataone.service.types.v2.SystemMetadata.class);
|
|
244 |
v2Sysmeta = TypeFactory.convertTypeFromType(sysmeta, org.dataone.service.types.v2.SystemMetadata.class);
|
|
245 | 245 |
} catch (Exception e) { |
246 | 246 |
// report as service failure |
247 | 247 |
ServiceFailure sf = new ServiceFailure("1030", e.getMessage()); |
... | ... | |
268 | 268 |
//convert sysmeta to newer version |
269 | 269 |
org.dataone.service.types.v2.SystemMetadata v2Sysmeta = null; |
270 | 270 |
try { |
271 |
v2Sysmeta = TypeMarshaller.convertTypeFromType(sysmeta, org.dataone.service.types.v2.SystemMetadata.class);
|
|
271 |
v2Sysmeta = TypeFactory.convertTypeFromType(sysmeta, org.dataone.service.types.v2.SystemMetadata.class);
|
|
272 | 272 |
} catch (Exception e) { |
273 | 273 |
// report as service failure |
274 | 274 |
ServiceFailure sf = new ServiceFailure("1030", e.getMessage()); |
... | ... | |
373 | 373 |
org.dataone.service.types.v2.SystemMetadata sysMeta = impl.getSystemMetadata(session, pid); |
374 | 374 |
SystemMetadata retSysMeta = null; |
375 | 375 |
try { |
376 |
retSysMeta = TypeMarshaller.convertTypeFromType(sysMeta, SystemMetadata.class);
|
|
376 |
retSysMeta = TypeFactory.convertTypeFromType(sysMeta, SystemMetadata.class);
|
|
377 | 377 |
} catch (Exception e) { |
378 | 378 |
// report as service failure |
379 | 379 |
ServiceFailure sf = new ServiceFailure("4801", e.getMessage()); |
... | ... | |
419 | 419 |
org.dataone.service.types.v2.Node node = impl.getCapabilities(); |
420 | 420 |
Node retNode = null; |
421 | 421 |
try { |
422 |
retNode = TypeMarshaller.convertTypeFromType(node, Node.class);
|
|
422 |
retNode = TypeFactory.convertTypeFromType(node, Node.class);
|
|
423 | 423 |
} catch (Exception e) { |
424 | 424 |
// report as service failure |
425 | 425 |
ServiceFailure sf = new ServiceFailure("4801", e.getMessage()); |
... | ... | |
465 | 465 |
org.dataone.service.types.v2.Log log = impl.getLogRecords(session, fromDate, toDate, eventValue, pidFilter, start, count); |
466 | 466 |
|
467 | 467 |
try { |
468 |
//retLog = TypeMarshaller.convertTypeFromType(log, Log.class);
|
|
468 |
//retLog = TypeFactory.convertTypeFromType(log, Log.class);
|
|
469 | 469 |
LogV2toV1Converter converter = new LogV2toV1Converter(); |
470 | 470 |
retLog = converter.convert(log); |
471 | 471 |
} catch (Exception e) { |
Also available in: Unified diff
Use the TypeFactory to replace the TypeMarshaller according to the change in the d1_common_java.