Provide a variant of the updatePrototype() method that takes a
prototype object instead of the prototype name.
This commit is contained in:
parent
443dd18158
commit
9c3cbea82f
1 changed files with 12 additions and 4 deletions
|
@ -174,11 +174,19 @@ public final class TypeManager {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a prototype based on the directory which defines it.
|
* Update a prototype to the files in the prototype directory.
|
||||||
*/
|
*/
|
||||||
public void updatePrototype (String name) {
|
public void updatePrototype (String name) {
|
||||||
// System.err.println ("UPDATE PROTO: "+app.getName()+"/"+name);
|
// System.err.println ("UPDATE PROTO: "+app.getName()+"/"+name);
|
||||||
Prototype proto = getPrototype (name);
|
Prototype proto = getPrototype (name);
|
||||||
|
updatePrototype (proto);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update a prototype to the files in the prototype directory.
|
||||||
|
*/
|
||||||
|
public void updatePrototype (Prototype proto) {
|
||||||
|
|
||||||
if (proto == null)
|
if (proto == null)
|
||||||
return;
|
return;
|
||||||
if (System.currentTimeMillis() - proto.getLastCheck() < 1000)
|
if (System.currentTimeMillis() - proto.getLastCheck() < 1000)
|
||||||
|
@ -188,7 +196,7 @@ public final class TypeManager {
|
||||||
if (System.currentTimeMillis() - proto.getLastCheck() < 1000)
|
if (System.currentTimeMillis() - proto.getLastCheck() < 1000)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
File dir = new File (appDir, name);
|
File dir = new File (appDir, proto.getName());
|
||||||
boolean needsUpdate = false;
|
boolean needsUpdate = false;
|
||||||
HashSet updatables = null;
|
HashSet updatables = null;
|
||||||
|
|
||||||
|
@ -295,9 +303,9 @@ public final class TypeManager {
|
||||||
upd.update ();
|
upd.update ();
|
||||||
} catch (Exception x) {
|
} catch (Exception x) {
|
||||||
if (upd instanceof DbMapping)
|
if (upd instanceof DbMapping)
|
||||||
app.logEvent ("Error updating db mapping for type "+name+": "+x);
|
app.logEvent ("Error updating db mapping for type "+proto.getName()+": "+x);
|
||||||
else
|
else
|
||||||
app.logEvent ("Error updating "+upd+" of prototye type "+name+": "+x);
|
app.logEvent ("Error updating "+upd+" of prototye type "+proto.getName()+": "+x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue