Author: jflesch
Date: 2006-10-10 18:52:05 +0000 (Tue, 10 Oct 2006)
New Revision: 10657
Modified:
trunk/apps/Thaw/src/thaw/plugins/FetchPlugin.java
trunk/apps/Thaw/src/thaw/plugins/index/Index.java
trunk/apps/Thaw/src/thaw/plugins/index/IndexCategory.java
trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java
trunk/apps/Thaw/src/thaw/plugins/index/LinkTable.java
Log:
Fix index first update
Modified: trunk/apps/Thaw/src/thaw/plugins/FetchPlugin.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/FetchPlugin.java 2006-10-10 17:28:58 UTC
(rev 10656)
+++ trunk/apps/Thaw/src/thaw/plugins/FetchPlugin.java 2006-10-10 18:52:05 UTC
(rev 10657)
@@ -57,6 +57,7 @@
String[] subKey = keys[i].split("\\?"); /* Because of
VolodyA :p */
String key =
subKey[0].replaceFirst("http://127.0.0.1:8888/", "");
+ key = key.replaceFirst("http://localhost/", "");
try {
key = java.net.URLDecoder.decode(key, "UTF-8");
Modified: trunk/apps/Thaw/src/thaw/plugins/index/Index.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/Index.java 2006-10-10 17:28:58 UTC
(rev 10656)
+++ trunk/apps/Thaw/src/thaw/plugins/index/Index.java 2006-10-10 18:52:05 UTC
(rev 10657)
@@ -63,12 +63,17 @@
private String author = null;
+ private boolean freshIndex = false;
+ /**
+ * The bigest constructor of the world ...
+ * @param fresh If set to true, won't increment revision for the next
update
+ */
public Index(Hsqldb db, FCPQueueManager queueManager,
int id, IndexCategory parent,
String realName, String displayName,
String publicKey, String privateKey,
- int revision, String author,
+ int revision, String author, boolean fresh,
boolean modifiable) {
this.queueManager = queueManager;
@@ -77,6 +82,7 @@
this.db = db;
this.tree = tree;
+ this.freshIndex = fresh;
this.id = id;
this.parent = parent;
this.realName = realName;
@@ -258,8 +264,13 @@
Logger.info(this, "Getting lastest version ...");
- String key = changeRevision(publicKey, 1);
+ String key;
+ if (!freshIndex)
+ key = changeRevision(publicKey, 1);
+ else
+ key = publicKey;
+
Logger.info(this, "Key asked: "+key);
clientGet = new FCPClientGet(key, 4, 2, false,
System.getProperty("java.io.tmpdir"));
Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexCategory.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexCategory.java 2006-10-10
17:28:58 UTC (rev 10656)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexCategory.java 2006-10-10
18:52:05 UTC (rev 10657)
@@ -287,7 +287,7 @@
set(children, position, (new Index(db,
queueManager, id, this,
realName,
displayName,
publicKey,
privateKey, revision,
- author,
+ author,
false,
modifiables)).getTreeNode());
}
} catch (java.sql.SQLException e) {
Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java 2006-10-10
17:28:58 UTC (rev 10656)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java 2006-10-10
18:52:05 UTC (rev 10657)
@@ -252,6 +252,8 @@
if(!modifiables) {
publicKey =
askAName(I18n.getMessage("thaw.plugin.index.indexKey"), "USK@");
+ publicKey =
publicKey.replaceFirst("http://127.0.0.1/", "");
+ publicKey =
publicKey.replaceFirst("http://localhost/", "");
try {
publicKey =
java.net.URLDecoder.decode(publicKey, "UTF-8");
@@ -263,14 +265,14 @@
} else
name =
askAName(I18n.getMessage("thaw.plugin.index.indexName"),
-
I18n.getMessage("thaw.plugin.index.newIndex"));
+
I18n.getMessage("thaw.plugin.index.newIndex"));
if(name == null)
return;
IndexCategory parent = (IndexCategory)selectedNode;
- Index index = new Index(db, queueManager, -2, parent,
name, name, publicKey, null, 0, null, modifiables);
+ Index index = new Index(db, queueManager, -2, parent,
name, name, publicKey, null, 0, null, true, modifiables);
if(modifiables)
index.generateKeys(queueManager);
Modified: trunk/apps/Thaw/src/thaw/plugins/index/LinkTable.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/LinkTable.java 2006-10-10
17:28:58 UTC (rev 10656)
+++ trunk/apps/Thaw/src/thaw/plugins/index/LinkTable.java 2006-10-10
18:52:05 UTC (rev 10657)
@@ -160,7 +160,7 @@
Link link = (Link)links.get(selectedRows[i]);
Index index = new Index(db, queueManager, -2,
null, Index.getNameFromKey(link.getKey()),
Index.getNameFromKey(link.getKey()), link.getKey(), null,
- 0, null, false);
+ 0, null, true, false);
index.create();
indexTree.addToRoot(index);
}