entries = new Entry("/", new JarEntry(prefix + "/")); child = new Entry(entryName, new JarEntry(zipName)); if (parent != null) parent.addChild(child); Name compositeName = new CompositeName(name.substring(0, pos)); Entry parent = treeLookup(compositeName); Entry child = new Entry(entryName, entry); if (parent != null) parent.addChild(child);
/** * List children as objects. */ protected ArrayList list(Entry entry) { ArrayList entries = new ArrayList(); Entry[] children = entry.getChildren(); Arrays.sort(children); NamingEntry namingEntry = null; for (int i = 0; i < children.length; i++) { JarEntry current = children[i].getEntry(); Object object = null; if (current.isDirectory()) { object = new JARDirContext(base, children[i]); } else { object = new JARResource(current); } namingEntry = new NamingEntry (children[i].getName(), object, NamingEntry.ENTRY); entries.add(namingEntry); } return entries; }
entries = new Entry("/", new JarEntry(prefix + "/")); child = new Entry(entryName, new JarEntry(zipName)); if (parent != null) parent.addChild(child); Name compositeName = new CompositeName(name.substring(0, pos)); Entry parent = treeLookup(compositeName); Entry child = new Entry(entryName, entry); if (parent != null) parent.addChild(child);
/** * Retrieves the named object. If name is empty, returns a new instance * of this context (which represents the same naming context as this * context, but its environment may be modified independently and it may * be accessed concurrently). * * @param name the name of the object to look up * @return the object bound to name * @exception NamingException if a naming exception is encountered */ public Object lookup(Name name) throws NamingException { if (name.isEmpty()) return this; Entry entry = treeLookup(name); if (entry == null) throw new NamingException (sm.getString("resources.notFound", name)); ZipEntry zipEntry = entry.getEntry(); if (zipEntry.isDirectory()) return new JARDirContext(base, entry); else return new JARResource(entry.getEntry()); }
/** * Retrieves the named object. If name is empty, returns a new instance * of this context (which represents the same naming context as this * context, but its environment may be modified independently and it may * be accessed concurrently). * * @param name the name of the object to look up * @return the object bound to name * @exception NamingException if a naming exception is encountered */ public Object lookup(Name name) throws NamingException { if (name.isEmpty()) return this; Entry entry = treeLookup(name); if (entry == null) throw new NamingException (MESSAGES.resourceNotFound(name.toString())); ZipEntry zipEntry = entry.getEntry(); if (zipEntry.isDirectory()) return new JARDirContext(base, entry); else return new JARResource(entry.getEntry()); }
/** * List children as objects. */ protected ArrayList list(Entry entry) { ArrayList entries = new ArrayList(); Entry[] children = entry.getChildren(); Arrays.sort(children); NamingEntry namingEntry = null; for (int i = 0; i < children.length; i++) { JarEntry current = children[i].getEntry(); Object object = null; if (current.isDirectory()) { object = new JARDirContext(base, children[i]); } else { object = new JARResource(current); } namingEntry = new NamingEntry (children[i].getName(), object, NamingEntry.ENTRY); entries.add(namingEntry); } return entries; }
/** * Entry tree lookup. */ protected Entry treeLookup(Name name) { if (name.isEmpty()) return entries; Entry currentEntry = entries; for (int i = 0; i < name.size(); i++) { if (name.get(i).length() == 0) continue; currentEntry = currentEntry.getChild(name.get(i)); if (currentEntry == null) return null; } return currentEntry; }
/** * Entry tree lookup. */ protected Entry treeLookup(Name name) { if (name.isEmpty()) return entries; Entry currentEntry = entries; for (int i = 0; i < name.size(); i++) { if (name.get(i).length() == 0) continue; currentEntry = currentEntry.getChild(name.get(i)); if (currentEntry == null) return null; } return currentEntry; }
public int compareTo(Object o) { if (!(o instanceof Entry)) return (+1); return (name.compareTo(((Entry) o).getName())); }
public int compareTo(Object o) { if (!(o instanceof Entry)) return (+1); return (name.compareTo(((Entry) o).getName())); }