/** * @param e * @param resource * @param message */ public ResourceNotFoundException(Throwable e, String resource, String message) { super( message, e ); resourceName = resource; determineResourceType( resource ); }
/** * Populates the context with JarClassLoader instances * * @param name * @param jcl */ public void addJcl(String name, JarClassLoader jcl) { if( loaders.containsKey( name ) ) throw new JclContextException( "JarClassLoader[" + name + "] already exist. Name must be unique" ); loaders.put( name, jcl ); }
/** * Removes the loaded resource * * @param resource */ public void unload(String resource) { if (jarEntryContents.containsKey( resource )) { logger.debug( "Removing resource {}", resource ); jarEntryContents.remove( resource ); } else { throw new ResourceNotFoundException( resource, "Resource not found in local ClasspathResources" ); } }
/** * Reads local resources from - Jar files - Class folders - Jar Library * folders * * @param path */ public void loadResource(String path) { logger.debug( "Resource: {}", path ); File fp = new File( path ); if (!fp.exists() && !ignoreMissingResources) { throw new JclException( "File/Path does not exist" ); } loadResource( fp, "" ); }
/** * Reads local resources from - Jar files - Class folders - Jar Library * folders * * @param path */ public void loadResource(String path) { logger.debug( "Resource: {}", path ); File fp = new File( path ); if (!fp.exists() && !ignoreMissingResources) { throw new JclException( "File/Path does not exist" ); } loadResource( fp, "" ); }
/** * Removes the loaded resource * * @param resource */ public void unload(String resource) { if (jarEntryContents.containsKey( resource )) { logger.debug( "Removing resource {}", resource ); jarEntryContents.remove( resource ); } else { throw new ResourceNotFoundException( resource, "Resource not found in local ClasspathResources" ); } }
/** * @param resource * @param message */ public ResourceNotFoundException(String resource, String message) { super( message ); resourceName = resource; determineResourceType( resource ); }
/** * Populates the context with JarClassLoader instances * * @param name * @param jcl */ public void addJcl(String name, JarClassLoader jcl) { if( loaders.containsKey( name ) ) throw new JclContextException( "JarClassLoader[" + name + "] already exist. Name must be unique" ); loaders.put( name, jcl ); }
/** * Reads local and remote resources * * @param url */ public void loadResource(URL url) { try { // Is Local loadResource( new File( url.toURI() ), "" ); } catch (IllegalArgumentException iae) { // Is Remote loadRemoteResource( url ); } catch (URISyntaxException e) { throw new JclException( "URISyntaxException", e ); } }
@Override public InputStream loadResource(String name) { InputStream is = null; if (enabled && isPartOfOsgiBootDelegation(name)) { is = getParentLoader().loadResource(name); if (is == null && strictLoading) { throw new ResourceNotFoundException("JCL OSGi Boot Delegation: Resource " + name + " not found."); } logger.debug("Resource " + name + " loaded via OSGi boot delegation."); } return is; }
/** * @param resource * @param message */ public ResourceNotFoundException(String resource, String message) { super( message ); resourceName = resource; determineResourceType( resource ); }
private void validate() { if( isLoaded() ) { throw new JclContextException( "Context already loaded. Destroy the existing context to create a new one." ); } }
/** * Reads local and remote resources * * @param url */ public void loadResource(URL url) { try { // Is Local loadResource( new File( url.toURI() ), "" ); } catch (IllegalArgumentException iae) { // Is Remote loadRemoteResource( url ); } catch (URISyntaxException e) { throw new JclException( "URISyntaxException", e ); } }
@Override public URL findResource(String name) { URL url = null; if (enabled && isPartOfOsgiBootDelegation(name)) { url = getParentLoader().findResource(name); if (url == null && strictLoading) { throw new ResourceNotFoundException("JCL OSGi Boot Delegation: Resource " + name + " not found."); } logger.debug("Resource " + name + " loaded via OSGi boot delegation."); } return url; }
/** * @param e * @param resource * @param message */ public ResourceNotFoundException(Throwable e, String resource, String message) { super( message, e ); resourceName = resource; determineResourceType( resource ); }
private void validate() { if( isLoaded() ) { throw new JclContextException( "Context already loaded. Destroy the existing context to create a new one." ); } }
/** * Loads local/remote source * * @param source */ public void add(Object source) { if (source instanceof InputStream) add( (InputStream) source ); else if (source instanceof URL) add( (URL) source ); else if (source instanceof String) add( (String) source ); else throw new JclException( "Unknown Resource type" ); }
@Override public InputStream loadResource(String name) { InputStream is = null; if (enabled && isPartOfOsgiBootDelegation(name)) { is = getParentLoader().loadResource(name); if (is == null && strictLoading) { throw new ResourceNotFoundException("JCL OSGi Boot Delegation: Resource " + name + " not found."); } logger.debug("Resource " + name + " loaded via OSGi boot delegation."); } return is; }
/** * Loads local/remote source * * @param source */ public void add(Object source) { if (source instanceof InputStream) add( (InputStream) source ); else if (source instanceof URL) add( (URL) source ); else if (source instanceof String) add( (String) source ); else throw new JclException( "Unknown Resource type" ); }
/** * Loads local/remote source * * @param source */ public void add(Object source) { if(source instanceof InputStream) { add((InputStream)source); } else if(source instanceof URL) { add((URL)source); } else if(source instanceof String) { add((String)source); } else { throw new JclException("Unknown Resource type"); } }