private URL loadResource(String configurationResourceName) { URL url = ConfigHelper.locateConfig( configurationResourceName ); if (log.isDebugEnabled()) { log.debug("Creating EhCacheProvider from a specified resource: " + configurationResourceName + " Resolved to URL: " + url); } return url; }
@Override public String getEhCacheConfigurationFileName() { return ConfigHelper.findAsResource(this.ehCacheConfigurationFileName) .toExternalForm(); }
public HazelcastInstance loadInstance() throws CacheException { if (instance != null && instance.getLifecycleService().isRunning()) { logger.log(Level.WARNING, "Current HazelcastInstance is already loaded and running! " + "Returning current instance..."); return instance; } String configResourcePath = null; if (props != null) { instanceName = CacheEnvironment.getInstanceName(props); useLiteMember = CacheEnvironment.isLiteMember(props); if (!useLiteMember && props.contains(CacheEnvironment.USE_SUPER_CLIENT)) { useLiteMember = CacheEnvironment.isSuperClient(props); logger.log(Level.WARNING, "'" + CacheEnvironment.USE_SUPER_CLIENT + "' property is deprecated!" + " Please use '" + CacheEnvironment.USE_LITE_MEMBER + "' instead..."); } configResourcePath = CacheEnvironment.getConfigFilePath(props); } if (useLiteMember) { logger.log(Level.WARNING, "Creating Hazelcast node as Lite-Member. " + "Be sure this node has access to an already running cluster..."); } if (StringHelper.isEmpty(configResourcePath)) { // If both useLiteMember and instanceName is not set // then just use default instance. if (!useLiteMember && instanceName == null) { staticInstance = true; } } else { URL url = ConfigHelper.locateConfig(configResourcePath); try { config = new UrlXmlConfig(url); } catch (IOException e) { throw new CacheException(e); } } if (instanceName != null) { instance = Hazelcast.getHazelcastInstanceByName(instanceName); if (instance == null) { try { createOrGetInstance(); } catch (DuplicateInstanceNameException ignored) { instance = Hazelcast.getHazelcastInstanceByName(instanceName); } } } else { createOrGetInstance(); } return instance; }
/** * Get the configuration file as an <tt>InputStream</tt>. Might be overridden * by subclasses to allow the configuration to be located by some arbitrary * mechanism. */ protected InputStream getConfigurationInputStream(String resource) throws HibernateException { log.info( "Configuration resource: " + resource ); return ConfigHelper.getResourceAsStream( resource ); }