Package org.infinispan.commons.util

Examples of org.infinispan.commons.util.FileLookup


   }

   private ConfigurationBuilderHolder getConfigurationBuilderHolder(
         ClassLoader classLoader) {
      try {
         FileLookup fileLookup = FileLookupFactory.newInstance();
         InputStream configurationStream = uri.isAbsolute()
               ? fileLookup.lookupFileStrict(uri, classLoader)
               : fileLookup.lookupFileStrict(uri.toString(), classLoader);
         return new ParserRegistry(classLoader).parse(configurationStream);
      } catch (FileNotFoundException e) {
         // No such file, lets use default CBH
         return new ConfigurationBuilderHolder(classLoader);
      }
View Full Code Here


    }

    private static URL find(String resource, ClassLoader... loaders) {
        for (ClassLoader loader : loaders) {
            if (loader != null) {
                URL url = new FileLookup().lookupFileLocation(resource, loader);
                if (url != null) {
                    return url;
                }
            }
        }
View Full Code Here

      boolean validating = !skipSchemaValidation();
      if (!validating)
         return null;

      //1. resolve given path
      FileLookup fileLookup = FileLookupFactory.newInstance();
      InputStream is;
      if (localPathToSchema != null) {
         // Schema's are always stored in Infinispan
         is = fileLookup.lookupFile(localPathToSchema, null);
         if (is != null) {
            log.debugf("Using schema %s", localPathToSchema);
            return is;
         }
         if (log.isDebugEnabled()) {
            log.debugf("Could not find schema on path %s, resolving %s to %s",
                       localPathToSchema, SCHEMA_SYSTEM_PROPERTY, schemaPath());
         }
      }

      //2. resolve local schema path in infinispan distro
      is = fileLookup.lookupFile(schemaPath(), null);
      if (is != null) {
         log.debugf("Using schema %s", schemaPath());
         return is;
      }
      if (log.isDebugEnabled()) {
View Full Code Here

   }

   private static InputStream findInputStream(String fileName, ClassLoader cl) throws FileNotFoundException {
      if (fileName == null)
         throw new NullPointerException("File name cannot be null!");
      FileLookup fileLookup = FileLookupFactory.newInstance();
      InputStream is = fileLookup.lookupFile(fileName, cl);
      if (is == null)
         throw new FileNotFoundException("File " + fileName
                 + " could not be found, either on the classpath or on the file system!");
      return is;
   }
View Full Code Here

      gc.transport().clusterName(null).build();
   }

   @Test
   public void testSchema() throws Exception {
      FileLookup lookup = FileLookupFactory.newInstance();
      URL schemaFile = lookup.lookupFileLocation("schema/infinispan-config-6.0.xsd", Thread.currentThread().getContextClassLoader());
      Source xmlFile = new StreamSource(lookup.lookupFile("configs/all.xml", Thread.currentThread().getContextClassLoader()));
      SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(schemaFile).newValidator().validate(xmlFile);
   }
View Full Code Here

    }

    private static URL find(String resource, ClassLoader... loaders) {
        for (ClassLoader loader : loaders) {
            if (loader != null) {
                URL url = new FileLookup().lookupFileLocation(resource, loader);
                if (url != null) {
                    return url;
                }
            }
        }
View Full Code Here

   * @param filename Infinispan configuration resource name
   * @throws IOException
   * @return
   */
  public ConfigurationBuilderHolder parseFile(String filename) throws IOException {
    FileLookup fileLookup = FileLookupFactory.newInstance();
    InputStream is = fileLookup.lookupFile( filename, searchConfigClassloader );
    if ( is == null ) {
      is = fileLookup.lookupFile( filename, userDeploymentClassloader );
      if ( is == null ) {
        throw new FileNotFoundException( filename );
      }
    }
    try {
View Full Code Here

   }

   @Override
   protected ConfigurationBuilderHolder createConfiguration(String configFile) throws FileNotFoundException {
      ClassLoader classLoader = getClass().getClassLoader();
      InputStream input = new FileLookup().lookupFileStrict(configFile, classLoader);
      return new ParserRegistry(classLoader).parse(input);
   }
View Full Code Here

public class Infinispan70EmbeddedService extends Infinispan60EmbeddedService {

   @Override
   protected ConfigurationBuilderHolder createConfiguration(String configFile) throws FileNotFoundException {
      ClassLoader classLoader = getClass().getClassLoader();
      InputStream input = new FileLookup().lookupFileStrict(configFile, classLoader);
      return new ParserRegistry(classLoader).parse(input);
   }
View Full Code Here

    */
   public RemoteCacheManager(boolean start) {
      ConfigurationBuilder builder = new ConfigurationBuilder();
      ClassLoader cl = Thread.currentThread().getContextClassLoader();
      builder.classLoader(cl);
      InputStream stream = new FileLookup().lookupFile(HOTROD_CLIENT_PROPERTIES, cl);
      if (stream == null) {
         log.couldNotFindPropertiesFile(HOTROD_CLIENT_PROPERTIES);
      } else {
         try {
            builder.withProperties(loadFromStream(stream));
View Full Code Here

TOP

Related Classes of org.infinispan.commons.util.FileLookup

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.