1 19 20 package org.netbeans.modules.xml.retriever.catalog.impl; 21 22 import java.net.URI ; 23 import java.net.URISyntaxException ; 24 import java.util.HashMap ; 25 import org.netbeans.modules.xml.retriever.catalog.CatalogElement; 26 import org.netbeans.modules.xml.xam.locator.CatalogModel; 27 import org.netbeans.modules.xml.xam.locator.CatalogModelException; 28 import org.netbeans.modules.xml.xam.ModelSource; 29 import org.netbeans.modules.xml.retriever.catalog.CatalogEntry; 30 31 35 public class CatalogEntryImpl implements CatalogEntry { 36 private CatalogElement entryType; 37 private String source; 39 private String target; 41 42 private CatalogModel thisCatModel = null; 43 44 private HashMap <String ,String > extraAttributeMap = null; 45 46 54 public CatalogEntryImpl(CatalogElement entryType, String mappingEntity, String mappedEntity) { 55 this.entryType = entryType; 56 this.source = mappingEntity; 57 this.target = mappedEntity; 58 } 59 60 public CatalogEntryImpl(CatalogElement entryType, String mappingEntity, String mappedEntity, HashMap <String ,String > extraAttribMap) { 61 this.entryType = entryType; 62 this.source = mappingEntity; 63 this.target = mappedEntity; 64 this.extraAttributeMap = extraAttribMap; 65 } 66 67 public CatalogElement getEntryType(){ 68 return entryType; 69 } 70 71 public String getSource(){ 72 return this.source; 73 } 74 75 public String getTarget(){ 76 return this.target; 77 } 78 79 public HashMap <String ,String > getExtraAttributeMap(){ 80 return extraAttributeMap; 81 } 82 83 public boolean isValid() { 84 if(thisCatModel == null) 85 return false; 86 ModelSource ms = null; 87 try { 88 ms = thisCatModel.getModelSource(new URI (source), null); 90 } catch (URISyntaxException ex) { 91 return false; 92 } catch (CatalogModelException ex) { 93 return false; 94 } 95 if(ms != null) 96 return true; 97 return false; 98 } 99 100 public void setCatalogModel(CatalogModel thisCatModel){ 101 this.thisCatModel = thisCatModel; 102 } 103 } 104 | Popular Tags |