Package org.hibernate.validation.util

Examples of org.hibernate.validation.util.GetClassLoader


    return constraintMappings;
  }

  private Schema getMappingSchema() {
    boolean isSecured = System.getSecurityManager() != null;
    GetClassLoader action = GetClassLoader.fromClass( XmlMappingParser.class );
    ClassLoader loader = isSecured ? AccessController.doPrivileged( action ) : action.run();
    URL schemaUrl = loader.getResource( VALIDATION_MAPPING_XSD );
    SchemaFactory sf = SchemaFactory.newInstance( javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI );
    Schema schema = null;
    try {
      schema = sf.newSchema( schemaUrl );
View Full Code Here



    boolean isSecured = System.getSecurityManager() != null;
    boolean isContextCL = true;
    // try the context class loader first
    GetClassLoader action = GetClassLoader.fromContext();
    ClassLoader loader = isSecured ? AccessController.doPrivileged( action ) : action.run();

    if (loader == null) {
      log.debug( "No default context class loader, fallbacking to Bean Validation's loader" );
      action = GetClassLoader.fromClass(ValidationXmlParser.class);
      loader = isSecured ? AccessController.doPrivileged( action ) : action.run();
      isContextCL = false;
    }
    InputStream inputStream = loader.getResourceAsStream( path );

    // try the current class loader
    if ( isContextCL && inputStream == null ) {
      action = GetClassLoader.fromClass(ValidationXmlParser.class);
      loader = isSecured ? AccessController.doPrivileged( action ) : action.run();
      inputStream = loader.getResourceAsStream( path );
    }
    return inputStream;
  }
View Full Code Here

public class AnnotationFactory {

  @SuppressWarnings("unchecked")
  public static <T extends Annotation> T create(AnnotationDescriptor<T> descriptor) {
    boolean isSecured = System.getSecurityManager() != null;
    GetClassLoader action = GetClassLoader.fromContext();
    ClassLoader classLoader = isSecured ? AccessController.doPrivileged( action ) : action.run();
        //TODO round 34ms to generate the proxy, hug! is Javassist Faster?
        Class<T> proxyClass = (Class<T>) Proxy.getProxyClass( classLoader, descriptor.type() );
    InvocationHandler handler = new AnnotationProxy( descriptor );
    try {
      return getProxyInstance( proxyClass, handler );
View Full Code Here

   * @return the resource bundle or <code>null</code> if none is found.
   */
  private ResourceBundle getFileBasedResourceBundle(Locale locale) {
    ResourceBundle rb = null;
    boolean isSecured = System.getSecurityManager() != null;
    GetClassLoader action = GetClassLoader.fromContext();
    ClassLoader classLoader = isSecured ? AccessController.doPrivileged( action ) : action.run();

    if ( classLoader != null ) {
      rb = loadBundle( classLoader, locale, USER_VALIDATION_MESSAGES + " not found by thread local classloader" );
    }
    if ( rb == null ) {
      action = GetClassLoader.fromClass(ResourceBundleMessageInterpolator.class);
      classLoader = isSecured ? AccessController.doPrivileged( action ) : action.run();
      rb = loadBundle(
          classLoader,
          locale,
          USER_VALIDATION_MESSAGES + " not found by validator classloader"
      );
View Full Code Here

    return inputStream;
  }

  private Schema getValidationConfigurationSchema() {
    boolean isSecured = System.getSecurityManager() != null;
    GetClassLoader action = GetClassLoader.fromClass( ValidationXmlParser.class );
    ClassLoader loader = isSecured ? AccessController.doPrivileged( action ) : action.run();
    URL schemaUrl = loader.getResource( VALIDATION_CONFIGURATION_XSD );
    SchemaFactory sf = SchemaFactory.newInstance( javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI );
    Schema schema = null;
    try {
      schema = sf.newSchema( schemaUrl );
View Full Code Here

TOP

Related Classes of org.hibernate.validation.util.GetClassLoader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.