1 23 24 25 package com.sun.enterprise.deployment.node; 26 27 import com.sun.enterprise.deployment.xml.PersistenceTagNames; 28 import com.sun.enterprise.deployment.PersistenceUnitDescriptor; 29 import com.sun.enterprise.deployment.PersistenceUnitsDescriptor; 30 31 import java.util.ArrayList ; 32 import java.util.List ; 33 34 42 public class PersistenceNode extends BundleNode { 43 44 public final static String SCHEMA_NS = 45 "http://java.sun.com/xml/ns/persistence"; 47 public final static String SCHEMA_ID = "persistence_1_0.xsd"; 49 private static List <String > systemIDs = null; 50 51 public final static XMLElement ROOT_ELEMENT = new XMLElement( 53 PersistenceTagNames.PERSISTENCE); 54 55 private PersistenceUnitsDescriptor persistenceUnitsDescriptor; 56 57 private static final String SPEC_VERSION = "1.0"; 58 59 67 public PersistenceNode() { 68 if (handlers != null) handlers.clear(); 70 registerElementHandler( 71 new XMLElement(PersistenceTagNames.PERSISTENCE_UNIT), 72 PersistenceUnitNode.class); 73 } 74 75 public PersistenceNode(PersistenceUnitsDescriptor persistenceUnitsDescriptor) { 76 this(); 77 this.persistenceUnitsDescriptor = persistenceUnitsDescriptor; 78 } 79 80 @Override 81 public PersistenceUnitsDescriptor getDescriptor() { 82 return persistenceUnitsDescriptor; 83 } 84 85 @Override 87 public void addDescriptor(Object descriptor) { 88 final PersistenceUnitDescriptor pud = PersistenceUnitDescriptor.class.cast(descriptor); 89 getDescriptor().addPersistenceUnitDescriptor(pud); 90 } 91 92 public String getDocType() { 93 return null; 94 } 95 96 public String getSystemID() { 97 return SCHEMA_ID; 98 } 99 100 public String getNameSpace() { 101 return SCHEMA_NS; 102 } 103 104 107 protected XMLElement getXMLRootTag() { 108 return ROOT_ELEMENT; 109 } 110 111 public List <String > getSystemIDs() { 112 if (systemIDs != null) { 113 return systemIDs; 114 } 115 systemIDs = new ArrayList <String >(); 116 systemIDs.add(SCHEMA_ID); 117 return systemIDs; 118 } 119 120 public String getSpecVersion() { 121 return SPEC_VERSION; 122 } 123 124 } 149 | Popular Tags |