1 16 17 package org.apache.ws.jaxme.pm.generator.jdbc; 18 19 import java.util.ArrayList ; 20 import java.util.List ; 21 import java.util.StringTokenizer ; 22 23 import org.apache.ws.jaxme.xs.XSSchema; 24 import org.apache.ws.jaxme.xs.impl.XSUtil; 25 import org.apache.ws.jaxme.xs.parser.impl.LocSAXException; 26 import org.apache.ws.jaxme.xs.xml.XsObject; 27 import org.xml.sax.SAXException ; 28 29 32 public class TableDetails extends ConnectionDetails { 33 protected TableDetails(JaxMeJdbcSG pJdbcSG, XsObject pParent) throws SAXException { 34 super(pJdbcSG, pParent); 35 36 XSSchema schema = pParent.getXsESchema().getContext().getXSSchema(); 37 if (schema != null) { 38 ConnectionDetails details = (ConnectionDetails) 39 XSUtil.getSingleAppinfo(schema.getAnnotations(), ConnectionDetails.class); 40 if (details != null) { 41 cloneFrom(details); 42 } 43 } 44 } 45 46 private String name; 47 private List keys; 48 50 public void setName(String pName) { 51 name = pName; 52 } 53 55 public String getName() { 56 return name; 57 } 58 60 public void setKeys(String pKeys) { 61 if (keys == null) { 62 keys = new ArrayList (); 63 } 64 for (StringTokenizer st = new StringTokenizer (pKeys, ", "); st.hasMoreTokens(); ) { 65 keys.add(st.nextToken()); 66 } 67 } 68 70 public List getKeys() { 71 return keys; 72 } 73 75 public void cloneFrom(TableDetails pFrom) { 76 super.cloneFrom(pFrom); 77 name = pFrom.name; 78 } 79 80 public void validate() throws SAXException { 81 super.validate(); 82 if (name == null || name.length() == 0) { 83 throw new LocSAXException("Missing or empty 'table' attribute.", getLocator()); 84 } 85 } 86 } | Popular Tags |