Subversion Repositories pub

Compare Revisions

Ignore whitespace Rev 56 → Rev 65

/pluggablejs/trunk/src/net/outlyer/plugins/PluginLocator.java
31,6 → 31,7
import java.io.IOException;
import java.net.JarURLConnection;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
77,14 → 78,14
unique = new HashSet<Sandbox>();
}
void add(final String fileName, final BasePluginObject bpo, final Sandbox sbox) {
byName.put(bpo.name, sbox);
void add(final String fileName, final PluginProperties pp, final Sandbox sbox) {
byName.put(pp.name, sbox);
byFilename.put(fileName, sbox);
if (byType.get(bpo.type) == null) {
byType.put(bpo.type, new LinkedList<Sandbox>());
if (byType.get(pp.type) == null) {
byType.put(pp.type, new LinkedList<Sandbox>());
}
byType.get(bpo.type).add(sbox);
byType.get(pp.type).add(sbox);
unique.add(sbox);
}
275,18 → 276,21
for (final File candidateFile : dir.listFiles(jsFileFilter)) {
final URI fileURI = candidateFile.toURI();
 
try {
final Sandbox sb = environment.createSandbox(fileURI);
final BasePluginObject bpo = sb.getPluginObject();
final PluginProperties pp = PluginEnvironment.fetchPluginProperties(fileURI);
if (null == pp) {
continue;
}
if (bpo.name == null) {
bpo.name = candidateFile.getName();
if (null == pp.name) {
pp.name = candidateFile.getName();
}
library.add(candidateFile.getName(), bpo, sb);
library.add(candidateFile.getName(), pp, sb);
}
catch (final Exception e) {
catch (final PluginException e) {
continue;
}
}
322,16 → 326,22
final URI pluginUri = new URI("jar:"+jarFile+"!"+url);
 
final Sandbox sb = environment.createSandbox(pluginUri);
final BasePluginObject bpo = sb.getPluginObject();
final String fileName = new File(jarURIElements[1]).getName();
if (bpo.name == null) {
bpo.name = fileName;
final PluginProperties pp = PluginEnvironment.fetchPluginProperties(jarUri);
// JarEntry's getName() returns the full path
final String fileName = new File(je.getName()).getName();
if (pp.name == null) {
pp.name = fileName;
}
library.add(fileName, bpo, sb);
library.add(fileName, pp, sb);
}
catch (final Exception e) {
catch (final PluginException e) {
continue;
}
catch (final URISyntaxException e) {
assert false;
throw new IllegalStateException("Unexpected malformed " +
"jar URI, implementation error (?)");
}
}
}
}