2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.io
.specimen
.abcd206
.in
;
15 import org
.apache
.log4j
.Logger
;
17 import eu
.etaxonomy
.cdm
.common
.UriUtils
;
18 import eu
.etaxonomy
.cdm
.database
.ICdmDataSource
;
19 import eu
.etaxonomy
.cdm
.io
.common
.IImportConfigurator
;
20 import eu
.etaxonomy
.cdm
.io
.common
.IMatchingImportConfigurator
;
21 import eu
.etaxonomy
.cdm
.io
.common
.mapping
.IInputTransformer
;
22 import eu
.etaxonomy
.cdm
.io
.specimen
.SpecimenImportConfiguratorBase
;
23 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
31 public class Abcd206ImportConfigurator
<AbcdImportState
, InputStream
> extends SpecimenImportConfiguratorBase
implements IImportConfigurator
, IMatchingImportConfigurator
{
32 private static final Logger logger
= Logger
.getLogger(Abcd206ImportConfigurator
.class);
38 private static IInputTransformer defaultTransformer
= null;
40 private URI sourceUri
;
45 @SuppressWarnings("unchecked")
46 protected void makeIoClassList(){
47 System
.out
.println("makeIOClassList");
48 ioClassList
= new Class
[]{
53 public static Abcd206ImportConfigurator
NewInstance(URI uri
,ICdmDataSource destination
){
54 return new Abcd206ImportConfigurator(null, uri
, destination
, false);
63 public static Abcd206ImportConfigurator
NewInstance(URI uri
, ICdmDataSource destination
, boolean interact
) {
64 return new Abcd206ImportConfigurator(null, uri
, destination
, interact
);
73 public static Abcd206ImportConfigurator NewInstance(InputStream stream, ICdmDataSource destination, boolean interact) {
74 return new Abcd206ImportConfigurator(stream, null, destination, interact);
80 * @param berlinModelSource
81 * @param sourceReference
84 private Abcd206ImportConfigurator(InputStream stream
, URI uri
, ICdmDataSource destination
, boolean interact
) {
85 super(defaultTransformer
);
91 setDestination(destination
);
92 setSourceReferenceTitle("ABCD classic");
93 setInteractWithUser(interact
);
101 public Abcd206ImportState
getNewState() {
102 return new Abcd206ImportState(this);
107 public InputStream
getSource(){
108 if (super.getSource() != null){
109 return (InputStream
)super.getSource();
110 }else if (this.sourceUri
!= null){
112 InputStream is
= (InputStream
) UriUtils
.getInputStream(sourceUri
);
115 } catch (Exception e
) {
116 throw new RuntimeException(e
);
125 public URI
getSourceUri(){
126 return this.sourceUri
;
129 public void setSourceUri(URI sourceUri
) {
130 this.sourceUri
= sourceUri
;
131 super.setSource(null);
138 public Reference
getSourceReference() {
140 return sourceReference
;