1 package eu
.etaxonomy
.cdm
.io
.sdd
;
3 import java
.io
.InputStream
;
4 import java
.net
.MalformedURLException
;
7 import org
.apache
.log4j
.Logger
;
8 import org
.jdom
.Element
;
9 import org
.jdom
.Namespace
;
11 import eu
.etaxonomy
.cdm
.common
.XmlHelp
;
12 import eu
.etaxonomy
.cdm
.database
.ICdmDataSource
;
13 import eu
.etaxonomy
.cdm
.io
.common
.IImportConfigurator
;
14 import eu
.etaxonomy
.cdm
.io
.common
.ImportConfiguratorBase
;
15 import eu
.etaxonomy
.cdm
.model
.reference
.Database
;
16 import eu
.etaxonomy
.cdm
.model
.reference
.ReferenceBase
;
18 public class SDDImportConfigurator
extends ImportConfiguratorBase
implements IImportConfigurator
{
19 private static final Logger logger
= Logger
.getLogger(SDDImportConfigurator
.class);
22 Namespace sddNamespace
;
24 protected void makeIoClassList(){
25 ioClassList
= new Class
[]{
26 SDDDescriptionIO
.class
30 public static SDDImportConfigurator
NewInstance(String url
,
31 ICdmDataSource destination
){
32 return new SDDImportConfigurator(url
, destination
);
37 * @param berlinModelSource
38 * @param sourceReference
41 private SDDImportConfigurator(String url
, ICdmDataSource destination
) {
44 setDestination(destination
);
49 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSource()
51 public String
getSource() {
52 return (String
)super.getSource();
58 public void setSource(String file
) {
59 super.setSource(file
);
65 public Element
getSourceRoot(){
66 String source
= getSource();
69 url
= new URL(source
);
70 Object o
= url
.getContent();
71 InputStream is
= (InputStream
)o
;
72 Element root
= XmlHelp
.getRoot(is
);
75 } catch (MalformedURLException e
) {
77 }catch (Exception e
) {
78 // TODO Auto-generated catch block
84 private boolean makeNamespaces(Element root
){
85 sddNamespace
= root
.getNamespace();
91 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()
94 public ReferenceBase
getSourceReference() {
96 if (this.sourceReference
== null){
97 logger
.warn("getSource Reference not yet fully implemented");
98 sourceReference
= Database
.NewInstance();
99 sourceReference
.setTitleCache("XXX");
101 return sourceReference
;
106 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getSourceNameString()
108 public String
getSourceNameString() {
109 if (this.getSource() == null){
112 return this.getSource();
116 public Namespace
getSddNamespace() {
120 public void setSddNamespace(Namespace xmlNamespace
) {
121 this.sddNamespace
= xmlNamespace
;