Revision: 3108
http://vexi.svn.sourceforge.net/vexi/?rev=3108&view=rev
Author: mkpg2
Date: 2008-09-24 16:03:00 +0000 (Wed, 24 Sep 2008)
Log Message:
-----------
Fixes.
Modified Paths:
--------------
trunk/core/org.vexi.core/src/org/vexi/core/Resources.java
trunk/core/org.vexi.core/src/org/vexi/core/Vexi.jpp
Modified: trunk/core/org.vexi.core/src/org/vexi/core/Resources.java
===================================================================
--- trunk/core/org.vexi.core/src/org/vexi/core/Resources.java 2008-09-24
16:02:37 UTC (rev 3107)
+++ trunk/core/org.vexi.core/src/org/vexi/core/Resources.java 2008-09-24
16:03:00 UTC (rev 3108)
@@ -124,13 +124,20 @@
}
}
-
- static public Fountain cache(final JS stream) throws JSExn{
- Fountain f = JSU.getFountain(stream);
+ static final int[] ARGS_cache = new int[]{JSU.FOUNTAIN};//,JSU.ANY};
+ static public Fountain cache(final JS[] args) throws JSExn{
+ JSU.checkArgs(args, ARGS_cache);
+ return cache(args[0]);
+ }
+ static public Fountain cache(final JS arg) {
+ Fountain f = JSU.getFountain(arg);
+ //String nameInCache = (args.length>1)?
+ // JSU.toString(args[0]) : null;
+
// HACK
if(f.canonical().endsWith(".vexi"))
return new CachedArchive(f);
- return new CachedFile(f);
+ return new CachedFile(f,null);
}
/* TODO review -> remove/reimplement
@@ -239,7 +246,7 @@
/** convert a path (or URL) to a file name */
static String cacheName(Fountain f) {
String path = f.canonical();
- return path.replace('/', '_').replace('\\', '_').replace(':', '_');
+ return path.replace('/', '_').replace('\\', '_').replace(':',
'_').replace('?', '_');
}
/* JS Interface for accessing the biscuits */
@@ -257,7 +264,7 @@
public static class CachedArchive extends CachedFile{
Fountain cache;
- public CachedArchive(Fountain f) { super(f);}
+ public CachedArchive(Fountain f) { super(f,null);}
public JS _get(JS key) throws JSExn {
cache_(this);
@@ -301,13 +308,11 @@
public CachedFile(Fountain source, String filename) {
this.source = source;
- this.filename = filename;
+ this.filename = DIR_VEXI + (filename!=null?
+ filename:
+ Resources.cacheName(source));
}
- public CachedFile(Fountain source) {
- this(source, DIR_VEXI + Resources.cacheName(source));
- }
-
public InputStream _getInputStream() throws IOException {
// First download we check and potentially update the cache
if(cache == null){cache(this);}
Modified: trunk/core/org.vexi.core/src/org/vexi/core/Vexi.jpp
===================================================================
--- trunk/core/org.vexi.core/src/org/vexi/core/Vexi.jpp 2008-09-24 16:02:37 UTC
(rev 3107)
+++ trunk/core/org.vexi.core/src/org/vexi/core/Vexi.jpp 2008-09-24 16:03:00 UTC
(rev 3108)
@@ -68,7 +68,7 @@
}
}
- private Cache subCache = new Cache(20, true);
+ private Cache subCache = new Cache(20);
private Sub getSub(JS key) {
Sub ret = (Sub)subCache.get(key);
if (ret == null) subCache.put(key, ret = new Sub(key));
@@ -232,7 +232,7 @@
try {
//#switch(JSU.toString(method))
case "bless": return bless_jsthread(target,
args[0],(args.length<2)?null:args[1]);
- case "cache": return Resources.cache(args[0]);
+ case "cache": return Resources.cache(args);
case "date": return new JSDate(args);
case "file.load": return accessFile(args,false);
case "file.save": return accessFile(args,true);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Vexi-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vexi-svn