public ResourceInfo execute(URLConnection con) { ResourceInfo ret = null; try { long modified = con.getLastModified(); String filename = URLDecoder.decode(con.getURL().getFile(), "UTF-8"); ret = new ResourceInfo(filename, con.getInputStream(), modified); } catch(IOException e) { } return ret; } });
/** * Find the file for a given name. * @param name The filename or logical name (resolved via imports and extension). * @param extension The required extension. * @param imports The imports, if any. * @return The resource info identifying the file. */ protected ResourceInfo getResourceInfo(String name, String extension, String[] imports, ClassLoader classloader) throws Exception { ResourceInfo ret = null; if(registered.containsKey(name)) { // Hack!!! ignore file handling for registered models. ICacheableModel model = (ICacheableModel)registered.get(name); ret = new ResourceInfo(name, null, model.getLastModified()); } else { // Try to find directly as absolute path. // Class clazz = SReflect.findClass0(name, imports, classloader); // if(clazz!=null) ret = new ResourceInfo(name, null, 0L); // if(ret==null) // throw new IOException("File "+name+" not found in imports");//: "+SUtil.arrayToString(imports)); } return ret; }
public ResourceInfo execute(URLConnection con) { ResourceInfo ret = null; long modified = con.getLastModified(); if(con.getClass().getName().equals("org.eclipse.osgi.framework.internal.core.BundleURLConnection")) { try { Method m = con.getClass().getMethod("getLocalURL", new Class<?>[0]); ret = new ResourceInfo(m.invoke(con, new Object[0]).toString(), con.getInputStream(), modified); } catch(Exception e) { e.printStackTrace(); } } return ret; } });
/** * Find the file for a given name. * @param name The filename or logical name (resolved via imports and extension). * @param extension The required extension. * @param imports The imports, if any. * @return The resource info identifying the file. */ protected ResourceInfo getResourceInfo(String name, String extension, String[] imports, ClassLoader classloader) throws Exception { ResourceInfo ret = null; if(registered.containsKey(name)) { // Hack!!! ignore file handling for registered models. ICacheableModel model = (ICacheableModel)registered.get(name); ret = new ResourceInfo(name, null, model.getLastModified()); } else { // Try to find directly as absolute path. // Class clazz = SReflect.findClass0(name, imports, classloader); // if(clazz!=null) ret = new ResourceInfo(name, null, 0L); // if(ret==null) // throw new IOException("File "+name+" not found in imports");//: "+SUtil.arrayToString(imports)); } return ret; }
/** * Find the file for a given name. * @param name The filename or logical name (resolved via imports and extension). * @param extension The required extension. * @param imports The imports, if any. * @return The resource info identifying the file. */ protected ResourceInfo getResourceInfo(String name, String extension, String[] imports, ClassLoader classloader) throws Exception { ResourceInfo ret = null; if(registered.containsKey(name)) { // Hack!!! ignore file handling for registered models. ICacheableModel model = (ICacheableModel)registered.get(name); ret = new ResourceInfo(name, null, model.getLastModified()); } else { // Try to find directly as absolute path. // Class clazz = SReflect.findClass0(name, imports, classloader); // if(clazz!=null) ret = new ResourceInfo(name, null, 0L); // if(ret==null) // throw new IOException("File "+name+" not found in imports");//: "+SUtil.arrayToString(imports)); } return ret; }
/** * Find the file for a given name. * @param name The filename or logical name (resolved via imports and extension). * @param extension The required extension. * @param imports The imports, if any. * @return The resource info identifying the file. */ protected ResourceInfo getResourceInfo(String name, String extension, String[] imports, ClassLoader classloader) throws Exception { ResourceInfo ret = null; if(registered.containsKey(name)) { // Hack!!! ignore file handling for registered models. ICacheableModel model = (ICacheableModel)registered.get(name); ret = new ResourceInfo(name, null, model.getLastModified()); } else { // Try to find directly as absolute path. // Class clazz = SReflect.findClass0(name, imports, classloader); // if(clazz!=null) ret = new ResourceInfo(name, null, 0L); // if(ret==null) // throw new IOException("File "+name+" not found in imports");//: "+SUtil.arrayToString(imports)); } return ret; }
/** * Find the file for a given name using any supported extension. * @param name The filename or logical name (resolved via imports and extensions). * @param imports The imports, if any. * @return The resource info identifying the file. * @throws Exception when the file could not be found. */ protected ResourceInfo getResourceInfo(String name, String[] imports, ClassLoader classloader) throws Exception { ResourceInfo ret; if(registered.containsKey(name)) { // Hack!!! ignore file handling for registered models. ICacheableModel model = (ICacheableModel)registered.get(name); ret = new ResourceInfo(name, null, model.getLastModified()); } else { ret = getResourceInfo0(name, imports, classloader); if(ret==null || ret.getInputStream()==null) throw new IOException("File "+name+" not found in imports.");//: "+SUtil.arrayToString(imports)); } return ret; }
ret = new ResourceInfo(filename, con.getInputStream(), modified); ret = new ResourceInfo(filename, new JarFile(jarfilename) .getInputStream(juc.getJarEntry()), modified);
ret = new ResourceInfo(file.getCanonicalPath(), null, file.lastModified()); ret = new ResourceInfo(file.getCanonicalPath(), new FileInputStream(file), file.lastModified()); ret = new ResourceInfo(file.getCanonicalPath(), null, file.lastModified()); ret = new ResourceInfo(file.getCanonicalPath(), new FileInputStream(file), file.lastModified()); ret = new ResourceInfo(name, con.getInputStream(), con.getLastModified());
public void customResultAvailable(ClassLoader cl) { ResourceInfo res = new ResourceInfo(null, input, System.currentTimeMillis()); OAVCapabilityModel model = (OAVCapabilityModel)loader.doLoadModel(name, null, res, cl, new Object[]{rid, root}); loader.registerModel(filename, model); ((ModelInfo)model.getModelInfo()).setFilename(filename); ret.setResult(model.getModelInfo()); } });
ret = new ResourceInfo(name, null, model.getLastModified());
ResourceInfo rinfo = new ResourceInfo(file.getAbsolutePath(), new FileInputStream(file), file.lastModified()); mmodel = BpmnXMLReader.read(rinfo, BpmnMenuBar.class.getClassLoader(), new ResourceIdentifier(), null); (new BpmnVisualModelGenerator(mmodel)).generateModel(graph);