package org.hibernate.boot.xsd;
import org.jboss.logging.Logger;
@SuppressWarnings("unused")
public class ConfigXsdSupport {
private static final Logger log = Logger.getLogger( ConfigXsdSupport.class );
public static final ConfigXsdSupport INSTANCE = new ConfigXsdSupport();
private ConfigXsdSupport() {
}
private final XsdDescriptor jpa10 = LocalXsdResolver.buildXsdDescriptor(
"org/hibernate/jpa/persistence_1_0.xsd",
"1.0",
"http://java.sun.com/xml/ns/persistence"
);
private final XsdDescriptor jpa20 = LocalXsdResolver.buildXsdDescriptor(
"org/hibernate/jpa/persistence_2_0.xsd",
"2.0" ,
"http://java.sun.com/xml/ns/persistence"
);
private final XsdDescriptor jpa21 = LocalXsdResolver.buildXsdDescriptor(
"org/hibernate/jpa/persistence_2_1.xsd",
"2.1",
"http://xmlns.jcp.org/xml/ns/persistence"
);
private final XsdDescriptor jpa22 = LocalXsdResolver.buildXsdDescriptor(
"org/hibernate/jpa/persistence_2_2.xsd",
"2.2" ,
"http://xmlns.jcp.org/xml/ns/persistence"
);
private final XsdDescriptor cfgXml = LocalXsdResolver.buildXsdDescriptor(
"org/hibernate/xsd/cfg/legacy-configuration-4.0.xsd",
"4.0" ,
"http://www.hibernate.org/xsd/orm/cfg"
);
public XsdDescriptor latestJpaDescriptor() {
return jpa22;
}
public XsdDescriptor jpaXsd(String version) {
switch ( version ) {
case "1.0": {
return jpa10;
}
case "2.0": {
return jpa20;
}
case "2.1": {
return jpa21;
}
case "2.2": {
return jpa22;
}
default: {
throw new IllegalArgumentException( "Unrecognized JPA persistence.xml XSD version : `" + version + "`" );
}
}
}
public XsdDescriptor cfgXsd() {
return cfgXml;
}
}