Author: jflesch
Date: 2006-07-13 23:22:07 +0000 (Thu, 13 Jul 2006)
New Revision: 9598
Added:
trunk/apps/Thaw/src/thaw/fcp/FCPGenerateSSK.java
Modified:
trunk/apps/Thaw/src/thaw/fcp/FCPClientGet.java
trunk/apps/Thaw/src/thaw/fcp/FCPClientPut.java
trunk/apps/Thaw/src/thaw/fcp/FCPConnection.java
trunk/apps/Thaw/src/thaw/fcp/FCPMessage.java
trunk/apps/Thaw/src/thaw/fcp/FCPQueryManager.java
trunk/apps/Thaw/src/thaw/fcp/FCPQueueLoader.java
trunk/apps/Thaw/src/thaw/fcp/FCPQueueManager.java
trunk/apps/Thaw/src/thaw/fcp/FCPTransferQuery.java
trunk/apps/Thaw/src/thaw/plugins/FetchPlugin.java
trunk/apps/Thaw/src/thaw/plugins/InsertPlugin.java
trunk/apps/Thaw/src/thaw/plugins/insertPlugin/InsertPanel.java
trunk/apps/Thaw/src/thaw/plugins/queueWatcher/DetailPanel.java
trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueuePanel.java
trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueueTableModel.java
Log:
Thaw can now do insertions
Modified: trunk/apps/Thaw/src/thaw/fcp/FCPClientGet.java
===================================================================
--- trunk/apps/Thaw/src/thaw/fcp/FCPClientGet.java 2006-07-13 21:46:33 UTC
(rev 9597)
+++ trunk/apps/Thaw/src/thaw/fcp/FCPClientGet.java 2006-07-13 23:22:07 UTC
(rev 9598)
@@ -26,7 +26,7 @@
private boolean globalQueue = false;
private String destinationDir = null;
- private int attempt = 0;
+ private int attempt = -1;
private String status;
private String identifier;
@@ -100,7 +100,7 @@
this.progress = 0;
this.fileSize = 0;
- this.attempt = 0;
+ this.attempt = -1;
if(key.indexOf('/') == key.length()-1) {
filename = "index.html";
@@ -116,6 +116,7 @@
}
public boolean start(FCPQueueManager queueManager) {
+ attempt++;
running = true;
progress = 0;
@@ -257,8 +258,6 @@
int code = ((new
Integer(message.getValue("Code"))).intValue());
- attempt++;
-
if(MAX_RETRIES == -1 || attempt >= MAX_RETRIES || code
== 25) {
status = "Failed
("+message.getValue("CodeDescription")+")";
progress = 100;
@@ -307,6 +306,9 @@
status = "Writing";
+ setChanged();
+ notifyObservers();
+
//queueManager.getQueryManager().getConnection().lockWriting();
@@ -373,7 +375,7 @@
Logger.warning(this, "UnlockWaiter.run() : Wtf
?");
}
- saveFileTo(this.dir);
+ clientGet.saveFileTo(this.dir);
return;
}
}
@@ -604,6 +606,9 @@
return null;
}
+ public String getFilename() {
+ return filename;
+ }
public int getAttempt() {
return attempt;
@@ -641,14 +646,9 @@
result.put("ClientToken", destinationDir);
result.put("Attempt", ((new Integer(attempt)).toString()));
- if(status.indexOf("(?)") > 0) {
- String[] cut = status.split(" ");
- result.put("status", cut[0]);
- } else {
- result.put("status", status);
- }
+ result.put("status", status);
- result.put("Identifier", identifier);
+ result.put("Identifier", identifier);
result.put("Progress", ((new Integer(progress)).toString()));
result.put("FileSize", ((new Long(fileSize)).toString()));
result.put("Running", ((new Boolean(running)).toString()));
@@ -684,10 +684,6 @@
status = "Waiting";
}
- if(persistence < 2 && !isFinished() && identifier != null &&
!identifier.equals(""))
- status = status + " (?)";
-
-
return true;
}
Modified: trunk/apps/Thaw/src/thaw/fcp/FCPClientPut.java
===================================================================
--- trunk/apps/Thaw/src/thaw/fcp/FCPClientPut.java 2006-07-13 21:46:33 UTC
(rev 9597)
+++ trunk/apps/Thaw/src/thaw/fcp/FCPClientPut.java 2006-07-13 23:22:07 UTC
(rev 9598)
@@ -1,112 +1,774 @@
package thaw.fcp;
import java.util.HashMap;
+import java.io.File;
+import java.util.Observer;
+import java.util.Observable;
+import java.io.FileInputStream;
+import thaw.core.Logger;
+
/**
- * TODO
+ * Allow to insert a simple file.
*/
-public class FCPClientPut implements FCPTransferQuery {
+public class FCPClientPut extends Observable implements FCPTransferQuery,
Observer {
+ private FCPQueueManager queueManager = null;
+ private File localFile = null;
+ private long fileSize = 0;
+ private int keyType = 0;
+ private int rev = 0;
+ private String name = null;
+ private String privateKey = null; /* must finish by '/' (cf SSKKeypair)
*/
+ private String publicKey = null; /* publicKey contains the filename etc
*/
+ private int priority = -1;
+ private boolean global = true;
+ private int persistence = 2;
+
+ private int progress = 0;
+ private String status = null;
+
+ private int attempt = 0;
+
+ private String identifier = null;
+
+ private boolean running = false;
+ private boolean finished = false;
+ private boolean successful = false;
+
+
+ private FCPGenerateSSK sskGenerator = null;
+
+
+ private final static int PACKET_SIZE = 1024;
+
/**
* To resume query from file. (see core.QueueKeeper)
*/
public FCPClientPut(FCPQueueManager queueManager, HashMap parameters) {
+ this.queueManager = queueManager;
+ setParameters(parameters);
+ }
+ /**
+ * To start a new insert.
+ * @param keyType : 0 = CHK ; 1 = KSK ; 2 = SSK
+ * @param rev : ignored if key == CHK
+ * @param name : ignored if key == CHK
+ * @param privateKey : ignored if key == CHK/KSK ; can be null if it
has to be generated ; USK@[...]/
+ * @param persistence 0 = Forever ; 1 = Until node reboot ; 2 = Until
the app disconnect
+ */
+ public FCPClientPut(File file, int keyType,
+ int rev, String name,
+ String privateKey, int priority,
+ boolean global, int persistence) {
+ this.localFile = file;
+ fileSize = file.length();
+
+ this.keyType = keyType;
+ this.rev = rev;
+
+ if(keyType == 0) {
+ this.name = file.getName();
+ this.privateKey = null;
+ } else {
+ this.name = name;
+ this.privateKey = privateKey;
+ }
+
+ this.publicKey = null;
+
+ this.priority = priority;
+ this.global = global;
+ this.persistence = persistence;
+ this.status = "Waiting";
+ this.progress = 0;
+ this.attempt = 0;
+
+ this.identifier = null;
+
+ this.running = false;
+ this.finished = false;
+ this.successful = false;
+
}
+ /**
+ * Used for resuming.
+ * @param publicKey : Complete key (with filename, etc)
+ */
+ public FCPClientPut(String identifier, String publicKey,
+ int priority, int persistence, boolean global,
+ String srcFile, String status, int progress,
+ FCPQueueManager queueManager) {
+ this.queueManager = queueManager;
+ this.identifier = identifier;
+
+ if(publicKey.startsWith("CHK"))
+ keyType = 0;
+ if(publicKey.startsWith("KSK"))
+ keyType = 1;
+ if(publicKey.startsWith("SSK"))
+ keyType = 2;
+ if(publicKey.startsWith("USK"))
+ keyType = 2;
+
+ this.publicKey = publicKey;
+
+ if(srcFile != null) {
+ String[] plop = srcFile.split(File.separator);
+ this.name = plop[plop.length-1];
+ } else {
+ String[] plop = publicKey.split(File.separator);
+ this.name = plop[plop.length-1];
+
+ if(keyType != 0) {
+ plop = this.name.split("\\-");
+ if(plop.length >= 2) {
+ this.name = "";
+ for(int i = 0 ; i < plop.length-1; i++)
{
+ this.name = this.name + plop[i];
+ if(i < plop.length-2)
+ this.name = this.name
+"-";
+ }
+ }
+ }
+ }
+
+ this.publicKey = null;
+
+ this.priority = priority;
+ this.global = global;
+
+ this.persistence = persistence;
+
+ this.progress = progress;
+
+ this.status = status;
+ running = true;
+ finished = false;
+ successful = false;
+ }
+
+
public boolean start(FCPQueueManager queueManager) {
- return false;
+ this.queueManager = queueManager;
+
+ queueManager.getQueryManager().addObserver(this);
+
+ progress = 0;
+ running = true;
+ finished = false;
+ successful = false;
+
+ if(keyType == 2 && privateKey == null) {
+ generateSSK();
+ }
+
+ if( (keyType == 2 && privateKey != null) || keyType != 2) {
+ startInsert();
+ }
+
+ setChanged();
+ notifyObservers();
+
+ return true;
}
+ /**
+ * doesn't set running = true. startInsert() will.
+ */
+ public void generateSSK() {
+ status = "Generating keys";
+
+ sskGenerator = new FCPGenerateSSK();
+
+ sskGenerator.addObserver(this);
+ sskGenerator.start(queueManager);
+ }
+
+
+
+ private class UnlockWaiter implements Runnable {
+ FCPClientPut clientPut;
+ FCPConnection connection;
+
+ public UnlockWaiter(FCPClientPut clientPut, FCPConnection
connection) {
+ this.clientPut = clientPut;
+ this.connection = connection;
+ }
+
+ public void run() {
+ while(true) {
+ if(!connection.isWritingLocked())
+ break;
+
+ try {
+ Thread.sleep(200);
+ } catch(java.lang.InterruptedException e) {
+
+ }
+
+ }
+
+ clientPut.continueInsert();
+ return;
+ }
+ }
+
+
+
+ public boolean startInsert() {
+ FCPConnection connection =
queueManager.getQueryManager().getConnection();
+
+ status = "Waiting socket availability";
+
+ Logger.info(this, "Another file is being uploaded ... waiting
...");
+
+ Thread fork = new Thread(new UnlockWaiter(this, connection));
+
+ fork.start();
+
+ return true;
+ }
+
+ public boolean continueInsert() {
+ FCPConnection connection =
queueManager.getQueryManager().getConnection();
+
+ connection.lockWriting();
+
+ status = "Sending to the node";
+
+ identifier = queueManager.getAnID();
+
+ setChanged();
+ notifyObservers();
+
+ FCPMessage msg = new FCPMessage();
+
+ msg.setMessageName("ClientPut");
+ msg.setValue("URI", getInsertionKey());
+ msg.setValue("Identifier", identifier);
+ msg.setValue("Verbosity", "512");
+ msg.setValue("MaxRetries", "-1");
+ msg.setValue("PriorityClass", (new
Integer(priority)).toString());
+ msg.setValue("GetCHKOnly", "false");
+ if(global)
+ msg.setValue("Global", "true");
+ else
+ msg.setValue("Global", "false");
+ msg.setValue("ClientToken", localFile.getPath());
+
+ switch(persistence) {
+ case(0): msg.setValue("Persistence", "forever"); break;
+ case(1): msg.setValue("Persistence", "reboot"); break;
+ case(2): msg.setValue("Persistence", "connection"); break;
+ default: Logger.notice(this, "Unknow persistence !?"); break;
+ }
+
+ msg.setValue("UploadFrom", "direct");
+
+ msg.setAmountOfDataWaiting(localFile.length());
+ Logger.info(this, "Sending "+(new Long(localFile.length()))+"
bytes on socket ...");
+
+ queueManager.getQueryManager().writeMessage(msg, false);
+
+
+ Logger.info(this, "Sending file to the node");
+ boolean ret = sendFile();
+ Logger.info(this, "File sent (or not)");
+
+ connection.unlockWriting();
+
+ if(ret == true) {
+ successful = false;
+ finished = false;
+ progress = 0;
+ running = true;
+
+ status = "Inserting";
+
+ setChanged();
+ notifyObservers();
+
+ return true;
+ } else {
+ successful = false;
+ finished = true;
+ progress = 0;
+ running = false;
+
+ status = "Unable to send the file to the node";
+ setChanged();
+ notifyObservers();
+
+ return false;
+ }
+
+ }
+
+
+ private boolean sendFile() {
+ FCPConnection connection =
queueManager.getQueryManager().getConnection();
+
+ long remaining = localFile.length();
+ byte[] data = null;
+
+ FileInputStream in = null;
+
+ try {
+ in = new FileInputStream(localFile);
+ } catch(java.io.FileNotFoundException e) {
+ Logger.error(this, "FileNotFoundException ?! ohoh,
problems ...");
+ return false;
+ }
+
+
+ while(remaining > 0) {
+ int to_read = PACKET_SIZE;
+
+ if(remaining < to_read)
+ to_read = (int)remaining;
+
+ data = new byte[to_read];
+
+ try {
+ if(in.read(data) < 0) {
+ Logger.error(this, "Error while reading
file ?!");
+ return false;
+ }
+ } catch(java.io.IOException e) {
+ Logger.error(this, "IOException while reading
file! proobleeem");
+ return false;
+ }
+
+ if(!connection.rawWrite(data)) {
+ Logger.error(this, "Error while writing file on
socket ! Disconnected ?");
+ return false;
+ }
+
+ remaining = remaining - to_read;
+
+ //Logger.verbose(this, "Remaining: "+(new
Long(remaining)).toString());
+ }
+
+ try {
+ if(in.available() > 0) {
+ Logger.error(this, "File not send completly
?!");
+ return false;
+ }
+ } catch(java.io.IOException e) {
+ /* we will suppose its ok ... */
+ Logger.notice(this, "available() die (hu ?)");
+ }
+
+ return true;
+ }
+
public boolean stop(FCPQueueManager queueManager) {
+ status = "Stopped";
+
+ if(removeRequest()) {
+ finished = true;
+ successful = false;
+ running = false;
+
+ setChanged();
+ notifyObservers();
+
+ return true;
+ }
+
return false;
}
+ public void update(Observable o, Object param) {
+ if(o == sskGenerator) {
+ privateKey = sskGenerator.getPrivateKey();
+ publicKey = sskGenerator.getPublicKey() + "/" + name;
+
+ setChanged();
+ notifyObservers();
+
+ startInsert();
+ return;
+ }
+
+ if(o == queueManager.getQueryManager()) {
+ FCPMessage msg = (FCPMessage)param;
+
+ if(msg == null
+ || msg.getValue("Identifier") == null
+ || !msg.getValue("Identifier").equals(identifier))
+ return;
+
+ if(msg.getMessageName().equals("URIGenerated")) {
+ running = true;
+ finished = false;
+ successful = false;
+
+ status = "Inserting";
+
+ publicKey = msg.getValue("URI");
+ publicKey = publicKey.replace("freenet:", "");
+
+ /*
+ if(keyType == 0)
+ publicKey = publicKey + "/" +name;
+
+ if(keyType > 0)
+ publicKey = publicKey + "/" + name +
"-" + (new Integer(rev)).toString();
+ */
+
+
+ setChanged();
+ notifyObservers();
+ return;
+ }
+
+ if(msg.getMessageName().equals("PutSuccessful")) {
+ successful = true;
+ finished = true;
+ running = false;
+
+ publicKey = msg.getValue("URI");
+ publicKey = publicKey.replace("freenet:", "");
+
+ if(keyType == 0)
+ publicKey = publicKey + name;
+ if(keyType == 1)
+ publicKey = "KSK@"+name+"-" + (new
Integer(rev)).toString();
+ if(keyType == 2)
+ publicKey = publicKey + "/" + name +
"-" + (new Integer(rev)).toString();
+
+
+ status = "Finished";
+
+ progress = 100;
+
+ setChanged();
+ notifyObservers();
+ return;
+ }
+
+ if(msg.getMessageName().equals("PutFailed")) {
+ /*
+ if(msg.getValue("Fatal") != null
+ && msg.getValue("Fatal").equals("false")) {
+ status = "Warning
("+msg.getValue("CodeDescription+")+")";
+
+ setChanged();
+ notifyObservers();
+
+ return;
+ }
+ */
+
+ successful = false;
+ running = false;
+ finished = true;
+
+ status = "Failed
("+msg.getValue("CodeDescription")+")";
+
+ setChanged();
+ notifyObservers();
+ return;
+ }
+
+ if(msg.getMessageName().equals("ProtocolError")) {
+ /*
+ if(msg.getValue("Fatal") != null
+ && msg.getValue("Fatal").equals("false")) {
+ status = "Protocol warning
("+msg.getValue("CodeDescription+")+")";
+
+ setChanged();
+ notifyObservers();
+
+ return;
+ }
+ */
+
+ successful = false;
+ running = false;
+ finished = true;
+
+ status = "Protocol error
("+msg.getValue("CodeDescription")+")";
+
+ setChanged();
+ notifyObservers();
+
+ return;
+ }
+
+ if(msg.getMessageName().equals("IdentifierCollision")) {
+ status = "Identifier collision";
+ start(queueManager); /* et hop ca repart :) */
+ return;
+ }
+
+
+ if(msg.getMessageName().equals("PersistentPut")) {
+ status = "Inserting";
+ //publicKey = msg.getValue("URI");
+ return;
+ }
+
+ if(msg.getMessageName().equals("StartedCompression")) {
+ status = "Compressing";
+
+ setChanged();
+ notifyObservers();
+
+ return;
+ }
+
+ if(msg.getMessageName().equals("FinishedCompression")) {
+ status = "Inserting";
+
+ int rate = (int)( ((new
Long(msg.getValue("OrigSize"))).longValue() * 100) / (new
Long(msg.getValue("OrigSize"))).longValue() );
+
+ Logger.info(this, "Compression: "+ (new
Integer(rate)).intValue());
+
+ setChanged();
+ notifyObservers();
+
+ return;
+ }
+
+ if(msg.getMessageName().equals("SimpleProgress")) {
+
+ if(msg.getValue("Total") != null
+ && msg.getValue("Succeeded") != null) {
+
+ long required = (new
Long(msg.getValue("Total"))).longValue();
+ long succeeded = (new
Long(msg.getValue("Succeeded"))).longValue();
+
+ progress = (int)((succeeded * 99) /
required);
+
+ running = true;
+ finished = false;
+ successful = false;
+
+ status = "Inserting";
+
+ setChanged();
+ notifyObservers();
+ }
+
+ return;
+ }
+
+
+ Logger.notice(this, "Unknow message.");
+
+ return;
+ }
+
+ }
+
+
public int getQueryType() {
return 2;
}
public boolean pause(FCPQueueManager queueManager) {
+ progress = 0;
+ status = "Delayed";
+
+ running = false;
+ successful = false;
+ finished = false;
+
+ removeRequest();
return false;
}
public boolean removeRequest() {
- return false;
+ setChanged();
+ notifyObservers();
+
+ FCPMessage msg = new FCPMessage();
+ msg.setMessageName("RemovePersistentRequest");
+ msg.setValue("Identifier", identifier);
+
+ if(global)
+ msg.setValue("Global", "true");
+ else
+ msg.setValue("Global", "false");
+
+ queueManager.getQueryManager().writeMessage(msg);
+
+ running = false;
+
+ queueManager.getQueryManager().deleteObserver(this);
+ return true;
}
public int getThawPriority() {
- return -1;
+ return priority;
}
public String getStatus() {
- return "Tulip";
+ return status;
}
public int getProgression() {
- return 0;
+ return progress;
}
+ /**
+ * @return public key
+ */
public String getFileKey() {
- return "Tulip";
+
+ return publicKey;
}
+ public int getKeyType() {
+ return keyType;
+ }
+
+ public String getInsertionKey() {
+ String key = null;
+
+ if(keyType == 0 && publicKey != null)
+ key = publicKey;
+ if(keyType == 0 && publicKey == null)
+ key = "CHK at coinCoin/"+name;
+ if(keyType == 1)
+ key = "KSK@" + name + "-"+((new
Integer(rev)).intValue());
+ if(keyType == 2)
+ key = privateKey + name+"-"+rev;
+
+ return key;
+ }
+
public long getFileSize() {
- return 0;
+ return fileSize; /* a "file length" ? why not "file size" as
usual ? */
}
public String getPath() {
- return "Tulip";
+ if(localFile != null)
+ return localFile.getPath();
+ else
+ return null;
}
+ public String getFilename() {
+ if(localFile != null)
+ return localFile.getName();
+ else
+ return name;
+ }
+
public int getAttempt() {
- return 0;
+ return attempt;
}
public void setAttempt(int x) {
- return;
+ attempt = x;
}
public int getMaxAttempt() {
- return 0;
+ return -1;
}
public boolean isRunning() {
- return false;
+ return running;
}
public boolean isFinished() {
- return false;
+ return finished;
}
public boolean isSuccessful() {
- return false;
+ return successful;
}
+ /**
+ * not tested : TODO : to test it
+ */
public HashMap getParameters() {
- return null;
+ HashMap result = new HashMap();
+
+ result.put("localFile", localFile.getPath());
+ result.put("keyType", ((new Integer(keyType)).toString()));
+ result.put("Revision", ((new Integer(rev)).toString()));
+ result.put("Name", name);
+ result.put("privateKey", privateKey);
+ result.put("publicKey", publicKey);
+ result.put("priority", ((new Integer(priority)).toString()));
+ result.put("global", ((new Boolean(global)).toString()));
+ result.put("persistence", (new
Integer(persistence)).toString());
+
+ result.put("progress", (new Integer(progress)).toString());
+
+ result.put("status", status);
+
+ result.put("attempt", (new Integer(attempt)).intValue());
+ result.put("identifier", identifier);
+ result.put("running", ((new Boolean(running)).toString()));
+ result.put("successful", ((new
Boolean(successful)).toString()));
+ result.put("finished", ((new Boolean(finished)).toString()));
+
+ return result;
}
+ /**
+ * not tested ; TODO : to test it
+ */
public boolean setParameters(HashMap parameters) {
- return false;
+
+ localFile = new File((String)parameters.get("localFile"));
+ keyType = (new
Integer((String)parameters.get("keyType"))).intValue();
+ rev = (new
Integer((String)parameters.get("Revision"))).intValue();
+ name = (String)parameters.get("name");
+ privateKey = (String)parameters.get("privateKey");
+ publicKey = (String)parameters.get("publicKey");
+ priority = ((new
Integer((String)parameters.get("priority"))).intValue());
+ global = ((new
Boolean((String)parameters.get("global"))).booleanValue());
+ persistence = ((new
Integer((String)parameters.get("persistence"))).intValue());
+ progress = ((new
Integer((String)parameters.get("progress"))).intValue());
+ status = (String)parameters.get("status");
+ attempt = ((new
Integer((String)parameters.get("attempt"))).intValue());
+ identifier = (String)parameters.get("identifier");
+ running = ((new
Boolean((String)parameters.get("running"))).booleanValue());
+ successful = ((new
Boolean((String)parameters.get("successful"))).booleanValue());
+ finished = ((new
Boolean((String)parameters.get("finished"))).booleanValue());
+
+ if(persistence == 2 && !isFinished()) {
+ progress = 0;
+ status = "Waiting";
+ }
+
+ return true;
}
public boolean isPersistent() {
- return true;
+ return persistence < 2;
}
public boolean isGlobal() {
- return true;
+ return global;
}
public String getIdentifier() {
- return "Tulip";
+ return identifier;
}
+ public String getPrivateKey() {
+ return privateKey;
+ }
+
+ public String getPublicKey() {
+ return publicKey;
+ }
+
/**
- * Copy simply the file ... a little bit useless ...
+ * Do nothing.
*/
public boolean saveFileTo(String dir) {
return false;
Modified: trunk/apps/Thaw/src/thaw/fcp/FCPConnection.java
===================================================================
--- trunk/apps/Thaw/src/thaw/fcp/FCPConnection.java 2006-07-13 21:46:33 UTC
(rev 9597)
+++ trunk/apps/Thaw/src/thaw/fcp/FCPConnection.java 2006-07-13 23:22:07 UTC
(rev 9598)
@@ -17,6 +17,7 @@
* After being instanciated, you should commit it to the FCPQueryManager, and
then
* commit the FCPQueryManager to the FCPQueueManager.
* Call observer when connected / disconnected.
+ * TODO: Add functions socketToFile(long size, File file) / fileToSocket(File
file)
*/
public class FCPConnection extends Observable {
@@ -154,10 +155,36 @@
lockWriting = false;
}
+ public boolean isWritingLocked() {
+ return lockWriting;
+ }
+ /**
+ * Doesn't check the lock state !
+ */
+ public boolean rawWrite(byte[] data) {
+ if(out != null && socket != null && socket.isConnected()) {
+ try {
+ out.write(data);
+ } catch(java.io.IOException e) {
+ Logger.warning(this, "Unable to write() on the
socket ?! : "+ e.toString());
+ return false;
+ }
+ } else {
+ Logger.warning(this, "Cannot write if disconnected
!\n");
+ return false;
+ }
+
+ return true;
+ }
+
public synchronized boolean write(String toWrite) {
+ return write(toWrite, true);
+ }
- while(lockWriting) {
+ public synchronized boolean write(String toWrite, boolean checkLock) {
+
+ while(checkLock && lockWriting) {
Logger.verbose(this, "Writting lock, unable to write.");
try {
Thread.sleep(200);
@@ -175,6 +202,7 @@
out.write(toWrite.getBytes());
} catch(java.io.IOException e) {
Logger.warning(this, "Unable to write() on the
socket ?! : "+ e.toString());
+ disconnect();
return false;
}
} else {
@@ -209,7 +237,7 @@
rawBytesWaiting = rawBytesWaiting - rdBytes;
- Logger.verbose(this, "Remaining: "+rawBytesWaiting);
+ //Logger.verbose(this, "Remaining: "+rawBytesWaiting);
return rdBytes;
} catch(java.io.IOException e) {
@@ -276,7 +304,7 @@
}
if(DEBUG_MODE) {
- if(result.matches("[-
\\?.a-zA-Z0-9,~%@/_=\\[\\]\\(\\)]*"))
+ if(result.matches("[\\-\\
\\?.a-zA-Z0-9\\,~%@/_=\\[\\]\\(\\)]*"))
Logger.asIt(this, "Thaw <<<
Node : "+result);
else
Logger.asIt(this, "Thaw <<<
Node : Unknow chars in message. Not displayed");
@@ -286,9 +314,10 @@
return result;
} catch (java.io.IOException e) {
- if(isConnected())
+ if(isConnected()) {
Logger.error(this, "IOException while
reading but still connected, wtf? : "+e.toString());
- else
+ disconnect();
+ } else
Logger.notice(this, "IOException.
Disconnected.");
return null;
Added: trunk/apps/Thaw/src/thaw/fcp/FCPGenerateSSK.java
===================================================================
--- trunk/apps/Thaw/src/thaw/fcp/FCPGenerateSSK.java 2006-07-13 21:46:33 UTC
(rev 9597)
+++ trunk/apps/Thaw/src/thaw/fcp/FCPGenerateSSK.java 2006-07-13 23:22:07 UTC
(rev 9598)
@@ -0,0 +1,91 @@
+package thaw.fcp;
+
+import java.util.Observer;
+import java.util.Observable;
+
+import thaw.core.Logger;
+
+public class FCPGenerateSSK extends Observable implements FCPQuery, Observer {
+ private String identifier = null;
+ private String privateKey = null;
+ private String publicKey = null;
+
+ private FCPQueueManager queueManager = null;
+
+
+ public FCPGenerateSSK() {
+
+ }
+
+
+ public boolean start(FCPQueueManager queueManager) {
+ this.queueManager = queueManager;
+
+ queueManager.getQueryManager().addObserver(this);
+
+ identifier = queueManager.getAnID();
+
+ FCPMessage msg = new FCPMessage();
+ msg.setMessageName("GenerateSSK");
+ msg.setValue("Identifier", identifier);
+
+ queueManager.getQueryManager().writeMessage(msg);
+
+ return true;
+ }
+
+
+ public void update (Observable o, Object param) {
+ FCPMessage msg = (FCPMessage)param;
+
+ if(msg.getValue("Identifier") == null
+ || !msg.getValue("Identifier").equals(identifier))
+ return;
+
+ if(msg.getMessageName().equals("SSKKeypair")) {
+ Logger.debug(this, "SSKKeypair !");
+
+ privateKey = msg.getValue("InsertURI");
+ publicKey = msg.getValue("RequestURI");
+
+ privateKey = privateKey.replace("freenet:", "");
+ publicKey = publicKey.replace("freenet:", "");
+
+ setChanged();
+ notifyObservers();
+
+ stop(queueManager);
+
+ return;
+ }
+
+
+ }
+
+
+ public boolean stop(FCPQueueManager queueManager) {
+ queueManager.getQueryManager().deleteObserver(this);
+
+ return true;
+ }
+
+ public int getQueryType() {
+ return 0;
+ }
+
+
+ /**
+ * @return privateKey without the "freenet:" prefix.
+ */
+ public String getPrivateKey() {
+ return privateKey;
+ }
+
+ /**
+ * @return publicKey without the "freenet:" prefix.
+ */
+ public String getPublicKey() {
+ return publicKey;
+ }
+
+}
Modified: trunk/apps/Thaw/src/thaw/fcp/FCPMessage.java
===================================================================
--- trunk/apps/Thaw/src/thaw/fcp/FCPMessage.java 2006-07-13 21:46:33 UTC
(rev 9597)
+++ trunk/apps/Thaw/src/thaw/fcp/FCPMessage.java 2006-07-13 23:22:07 UTC
(rev 9598)
@@ -129,7 +129,7 @@
if(getAmountOfDataWaiting() == 0)
result = result + "EndMessage\n";
else {
- result = result + "DataLength="+ (new
Long(getAmountOfDataWaiting())).toString();
+ result = result + "DataLength="+ (new
Long(getAmountOfDataWaiting())).toString() + "\n";
result = result + "Data\n";
}
Modified: trunk/apps/Thaw/src/thaw/fcp/FCPQueryManager.java
===================================================================
--- trunk/apps/Thaw/src/thaw/fcp/FCPQueryManager.java 2006-07-13 21:46:33 UTC
(rev 9597)
+++ trunk/apps/Thaw/src/thaw/fcp/FCPQueryManager.java 2006-07-13 23:22:07 UTC
(rev 9598)
@@ -37,10 +37,15 @@
return connection;
}
- public synchronized boolean writeMessage(FCPMessage message) {
+ public boolean writeMessage(FCPMessage message) {
return connection.write(message.toString());
}
+ public boolean writeMessage(FCPMessage message, boolean checkLock) {
+ return connection.write(message.toString(), checkLock);
+
+ }
+
/**
* Blocking until a message is reveived.
* More exactly, read until "Data\n" or "EndMessage\n" is read.
@@ -100,8 +105,15 @@
Logger.debug(this, "Message received. Notifying
observers");
if(latestMessage != null) {
- setChanged();
- notifyObservers(latestMessage);
+ try {
+ setChanged();
+ notifyObservers(latestMessage);
+ } catch(Exception e) {
+ /* it's really bad ... because if data
are waiting on the socket ... */
+ Logger.error(this, "EXCEPTION FROM ONE
OF LISTENER : "+e.toString());
+ Logger.error(this, "ERROR :
"+e.getMessage());
+ e.printStackTrace();
+ }
} else {
Logger.info(this, "Stopping listening");
return;
Modified: trunk/apps/Thaw/src/thaw/fcp/FCPQueueLoader.java
===================================================================
--- trunk/apps/Thaw/src/thaw/fcp/FCPQueueLoader.java 2006-07-13 21:46:33 UTC
(rev 9597)
+++ trunk/apps/Thaw/src/thaw/fcp/FCPQueueLoader.java 2006-07-13 23:22:07 UTC
(rev 9598)
@@ -49,8 +49,6 @@
if(msg.getValue("PersistenceType").equals("reboot"))
persistence = 1;
- if(msg.getValue("PersistenceType").equals("connection"))
- persistence = 2;
boolean global = true;
@@ -79,8 +77,44 @@
}
+
if(msg.getMessageName().equals("PersistentPut")) {
- Logger.warning(this, "Non implemented yet !");
+ Logger.info(this, "Resuming from PersistentPut");
+
+ int persistence = 2;
+
+ /* TOFIX : Node doesn't return PersistenceType */
+ /*
+ if(msg.getValue("PersistenceType").equals("reboot"))
+ persistence = 1;
+ */
+
+ boolean global = true;
+
+ if(msg.getValue("Global").equals("false"))
+ global = false;
+
+ String srcFile = null;
+
+ if(msg.getValue("Identifier").startsWith(thawId))
+ srcFile = msg.getValue("ClientToken");
+
+ int priority = ((new
Integer(msg.getValue("PriorityClass"))).intValue());
+
+
+ FCPClientPut clientPut = new
FCPClientPut(msg.getValue("Identifier"),
+
msg.getValue("URI"), // key
+ priority,
persistence, global,
+ srcFile,
"Inserting", 0,
+ queueManager);
+
+
+ if(queueManager.addQueryToTheRunningQueue(clientPut,
false))
+
queueManager.getQueryManager().addObserver(clientPut);
+ else
+ Logger.info(this, "Already in the running
queue");
+
+
return;
}
Modified: trunk/apps/Thaw/src/thaw/fcp/FCPQueueManager.java
===================================================================
--- trunk/apps/Thaw/src/thaw/fcp/FCPQueueManager.java 2006-07-13 21:46:33 UTC
(rev 9597)
+++ trunk/apps/Thaw/src/thaw/fcp/FCPQueueManager.java 2006-07-13 23:22:07 UTC
(rev 9598)
@@ -191,6 +191,19 @@
notifyObservers(query);
}
+
+ private boolean isTheSame(FCPTransferQuery queryA,
+ FCPTransferQuery queryB) {
+ if(queryA.getIdentifier() != null && queryB.getIdentifier() !=
null)
+ return
queryA.getIdentifier().equals(queryB.getIdentifier());
+
+ if(queryA.getFileKey() != null && queryB.getFileKey() != null)
+ return queryA.getFileKey().equals(queryB.getFileKey());
+
+ return queryA.getFilename().equals(queryB.getFilename());
+ }
+
+
/**
* Compare using the key.
*/
@@ -207,7 +220,7 @@
it.hasNext(); )
{
FCPTransferQuery plop =
(FCPTransferQuery)it.next();
-
if(plop.getFileKey().equals(query.getFileKey()))
+ if(isTheSame(plop, query))
return true;
}
@@ -216,7 +229,7 @@
it.hasNext(); )
{
FCPTransferQuery plop =
(FCPTransferQuery)it.next();
-
if(plop.getFileKey().equals(query.getFileKey()))
+ if(isTheSame(plop,
query))
return true;
}
@@ -233,7 +246,7 @@
}
- public synchronized void ordonnance() {
+ public void ordonnance() {
/* We count the running query to see if there is an
empty slot */
@@ -285,6 +298,10 @@
if(query.getQueryType()
== 2)
runningInsertions++;
+
+ try {
+
Thread.sleep(300);
+ }
catch(java.lang.InterruptedException e) { }
}
Modified: trunk/apps/Thaw/src/thaw/fcp/FCPTransferQuery.java
===================================================================
--- trunk/apps/Thaw/src/thaw/fcp/FCPTransferQuery.java 2006-07-13 21:46:33 UTC
(rev 9597)
+++ trunk/apps/Thaw/src/thaw/fcp/FCPTransferQuery.java 2006-07-13 23:22:07 UTC
(rev 9598)
@@ -115,4 +115,5 @@
public String getIdentifier();
+ public String getFilename();
}
Modified: trunk/apps/Thaw/src/thaw/plugins/FetchPlugin.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/FetchPlugin.java 2006-07-13 21:46:33 UTC
(rev 9597)
+++ trunk/apps/Thaw/src/thaw/plugins/FetchPlugin.java 2006-07-13 23:22:07 UTC
(rev 9598)
@@ -52,7 +52,9 @@
for(int i = 0 ; i < keys.length ; i++) {
String[] subKey = keys[i].split("\\?"); /* Because of
VolodyA :p */
- core.getQueueManager().addQueryToThePendingQueue(new
FCPClientGet(subKey[0],
+ String key =
subKey[0].replace("http://127.0.0.1:8888/", "");
+
+ core.getQueueManager().addQueryToThePendingQueue(new
FCPClientGet(key,
priority,
persistence,
globalQueue,
Modified: trunk/apps/Thaw/src/thaw/plugins/InsertPlugin.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/InsertPlugin.java 2006-07-13 21:46:33 UTC
(rev 9597)
+++ trunk/apps/Thaw/src/thaw/plugins/InsertPlugin.java 2006-07-13 23:22:07 UTC
(rev 9598)
@@ -62,14 +62,40 @@
* @param privateKey : ignored if key == CHK/KSK ; can be null if it
has to be generated
* @param persistence 0 = Forever ; 1 = Until node reboot ; 2 = Until
the app disconnect
*/
- public FCPClientPut insertFile(File file, int keyType,
+ public boolean insertFile(String fileList, int keyType,
int rev, String name,
String privateKey,
int priority, boolean global,
int persistence) {
- /* TODO */
- return null;
+ FCPClientPut clientPut = null;
+ String[] files = fileList.split(";");
+
+ if(keyType > 0 && files.length > 1) {
+ new WarningWindow(core, "Can't insert multiple SSH@ /
KSK@ files at the same time. Use jSite.");
+ return false;
+ }
+
+ for(int i = 0 ; i < files.length ; i++) {
+
+ if(privateKey != null && !privateKey.equals("")) {
+ clientPut = new FCPClientPut(new
File(files[i]), keyType, rev, name,
+
"USK@"+privateKey+"/", priority,
+ global,
persistence);
+ } else {
+ clientPut = new FCPClientPut(new
File(files[i]), keyType, rev, name,
+ null, priority,
+ global,
persistence);
+ }
+
+ insertPanel.setLastInserted(clientPut);
+ clientPut.addObserver(insertPanel);
+
+
core.getQueueManager().addQueryToThePendingQueue(clientPut);
+
+ }
+
+ return true;
}
Modified: trunk/apps/Thaw/src/thaw/plugins/insertPlugin/InsertPanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/insertPlugin/InsertPanel.java
2006-07-13 21:46:33 UTC (rev 9597)
+++ trunk/apps/Thaw/src/thaw/plugins/insertPlugin/InsertPanel.java
2006-07-13 23:22:07 UTC (rev 9598)
@@ -17,13 +17,16 @@
import java.io.File;
import java.awt.event.ItemListener;
import java.awt.event.ItemEvent;
+import java.util.Observer;
+import java.util.Observable;
+import java.util.Vector;
import thaw.core.*;
import thaw.i18n.I18n;
import thaw.plugins.InsertPlugin;
import thaw.fcp.*;
-public class InsertPanel implements ActionListener, ItemListener {
+public class InsertPanel implements ActionListener, ItemListener, Observer {
private final static int MIN_PRIORITY = 6;
private JPanel globalPanel = null;
@@ -60,12 +63,6 @@
private JLabel globalLabel;
private JComboBox globalSelecter;
- /*
- private String[] persistences;
- private JLabel persistenceLabel;
- private JComboBox persistenceSelecter;
- */
-
private JButton letsGoButton;
@@ -90,12 +87,12 @@
JPanel subSubPanel = new JPanel();
subSubPanel.setLayout(new GridLayout(3, 1));
- browseLabel = new
JLabel(I18n.getMessage("thaw.plugin.insert.fileToInsert"));
+ browseLabel = new
JLabel(I18n.getMessage("thaw.plugin.insert.filesToInsert"));
subSubPanel.add(browseLabel);
selectedFiles = new JTextField(20);
selectedFiles.setEditable(true);
subSubPanel.add(selectedFiles);
- browseButton = new
JButton(I18n.getMessage("thaw.common.selectFile"));
+ browseButton = new
JButton(I18n.getMessage("thaw.common.selectFiles"));
browseButton.addActionListener(this);
subSubPanel.add(browseButton);
@@ -124,25 +121,11 @@
subPanel.add(subSubPanel);
+ /* GLOBAL */
+
subSubPanel = new JPanel();
subSubPanel.setLayout(new GridLayout(4, 1));
-
- // PERSISTENCE & GLOBAL
- /*
- persistences = new String[] {
- I18n.getMessage("thaw.common.persistenceConnection"),
- I18n.getMessage("thaw.common.persistenceReboot"),
- I18n.getMessage("thaw.common.persistenceForever"),
- };
-
- persistenceLabel = new
JLabel(I18n.getMessage("thaw.common.persistence"));
- subSubPanel.add(persistenceLabel);
- persistenceSelecter = new JComboBox(persistences);
-
persistenceSelecter.setSelectedItem(I18n.getMessage("thaw.common.persistenceReboot"));
- subSubPanel.add(persistenceSelecter);
- */
-
globalStr = new String[] {
I18n.getMessage("thaw.common.true"),
I18n.getMessage("thaw.common.false"),
@@ -278,8 +261,19 @@
if(keyType == 2) {
if(privateKeyField.getText() != null
- && !privateKeyField.getText().equals(""))
+ && !privateKeyField.getText().equals("")) {
privateKey = privateKeyField.getText();
+
+ if(privateKey != null
+ && !privateKey.equals("")) {
+ privateKey =
privateKey.replace("SSK@", "");
+ privateKey =
privateKey.replace("USK@", "");
+ String[] split =
privateKey.split("/");
+ privateKey = split[0];
+ } else {
+ privateKey = null;
+ }
+ }
}
for(int i = 0 ; i <= MIN_PRIORITY ; i++) {
@@ -290,43 +284,38 @@
if(((String)globalSelecter.getSelectedItem()).equals(I18n.getMessage("thaw.common.true")))
global = true;
-
if(((String)globalSelecter.getSelectedItem()).equals(I18n.getMessage("thaw.common.true")))
+
if(((String)globalSelecter.getSelectedItem()).equals(I18n.getMessage("thaw.common.false")))
global = false;
-
- /*
-
if(((String)persistenceSelecter.getSelectedItem()).equals(I18n.getMessage("thaw.common.persistenceForever")))
- persistence = 0;
-
if(((String)persistenceSelecter.getSelectedItem()).equals(I18n.getMessage("thaw.common.persistenceReboot")))
- persistence = 1;
-
if(((String)persistenceSelecter.getSelectedItem()).equals(I18n.getMessage("thaw.common.persistenceConnection")))
- persistence = 2;
- lastInsert = insertPlugin.insertFile(new
File(selectedFiles.getText()),
- keyType, rev,
name, privateKey, priority,
- global,
persistence);
- */
+
- lastInsert = insertPlugin.insertFile(new
File(selectedFiles.getText()),
- keyType, rev,
name, privateKey, priority,
- global, 0);
-
- /* TODO : Listen lastInsert to fetch display the
private / public key */
+ insertPlugin.insertFile(selectedFiles.getText(),
+ keyType, rev, name, privateKey,
priority,
+ global, 0);
}
if(e.getSource() == browseButton) {
FileChooser fileChooser = new FileChooser();
- File files;
+ File[] files;
fileChooser.setTitle(I18n.getMessage("thaw.common.selectFile"));
fileChooser.setDirectoryOnly(false);
fileChooser.setDialogType(JFileChooser.OPEN_DIALOG);
- if( (files = fileChooser.askOneFile()) == null) { /*
TODO ? : One file -> Many files */
+ if( (files = fileChooser.askManyFiles()) == null) {
Logger.info(this, "Nothing selected");
return;
}
- selectedFiles.setText(files.getPath());
+ String fileList = "";
+ for(int i = 0 ; i < files.length ; i++) {
+ if(i >= 1)
+ fileList = fileList + ";";
+ fileList = fileList + files[i].getPath();
+ }
+
+ selectedFiles.setText(fileList);
+
if(keyType != 0)
nameField.setText(getFileNameFromPath());
}
@@ -385,5 +374,49 @@
return;
}
}
+
+
+ public void setLastInserted(FCPClientPut lastInserted) {
+ this.lastInsert = lastInserted;
+ }
+
+
+ public void update(Observable o, Object param) {
+ if(o == lastInsert) {
+ FCPClientPut clientPut = (FCPClientPut)o;
+
+ if(clientPut.getKeyType() == 2) {
+ Logger.info(this, "Updating display");
+
+ if(clientPut.getPublicKey() != null) {
+ String publicKey =
clientPut.getPublicKey();
+ publicKey = publicKey.replace("SSK@",
"");
+ publicKey = publicKey.replace("USK@",
"");
+ String[] split = publicKey.split("/");
+ publicKeyField.setText(split[0]);
+ } else {
+ publicKeyField.setText("");
+ }
+
+ if(clientPut.getPrivateKey() != null) {
+ String privateKey =
clientPut.getPrivateKey();
+ privateKey = privateKey.replace("SSK@",
"");
+ privateKey = privateKey.replace("USK@",
"");
+ String[] split = privateKey.split("/");
+ privateKeyField.setText(split[0]);
+
+ } else {
+ privateKeyField.setText("");
+ }
+
+ } else {
+ publicKeyField.setText("");
+ privateKeyField.setText("");
+ }
+
+ } else {
+ o.deleteObserver(this);
+ }
+ }
}
Modified: trunk/apps/Thaw/src/thaw/plugins/queueWatcher/DetailPanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/queueWatcher/DetailPanel.java
2006-07-13 21:46:33 UTC (rev 9597)
+++ trunk/apps/Thaw/src/thaw/plugins/queueWatcher/DetailPanel.java
2006-07-13 23:22:07 UTC (rev 9598)
@@ -133,6 +133,11 @@
else
progress.setString("FAILED");
+ if(query.getFileKey() != null)
+ key.setText(query.getFileKey());
+ else
+ key.setText("Unknown");
+
size.setText((new
Long(query.getFileSize())).toString()+" B");
status.setText(query.getStatus());
@@ -155,6 +160,8 @@
attempt.setText("");
size.setText("");
priority.setText("");
+ key.setText("");
+
}
}
@@ -164,17 +171,15 @@
if(query != null) {
- String[] plop = query.getFileKey().split("/");
+ file.setText(query.getFilename());
+
+ path.setText(query.getPath());
- file.setText(plop[plop.length-1]);
-
- key.setText(query.getFileKey());
- path.setText(query.getPath());
-
if(query.isGlobal())
globalQueue.setText(I18n.getMessage("thaw.common.yes"));
else
globalQueue.setText(I18n.getMessage("thaw.common.no"));
+
} else {
file.setText("");
key.setText("");
Modified: trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueuePanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueuePanel.java
2006-07-13 21:46:33 UTC (rev 9597)
+++ trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueuePanel.java
2006-07-13 23:22:07 UTC (rev 9598)
@@ -112,8 +112,10 @@
if((new
Integer(core.getConfig().getValue("maxSimultaneousDownloads"))).intValue() >= 0
|| (new
Integer(core.getConfig().getValue("maxSimultaneousInsertions"))).intValue() >=
0)
rightClickMenu.add(delayItem);
+
+ if(!isForInsertionQueue)
+ rightClickMenu.add(downloadItem);
- rightClickMenu.add(downloadItem);
rightClickMenu.add(forceRestartItem);
rightClickMenu.add(copyKeysItem);
@@ -286,7 +288,9 @@
}
if(e.getSource() == copyKeysItem) {
- keys = keys + query.getFileKey() + "\n";
+ if(query.getFileKey() != null
+ && !query.getFileKey().equals(""))
+ keys = keys +
query.getFileKey() + "\n";
}
if(e.getSource() == downloadItem
Modified: trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueueTableModel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueueTableModel.java
2006-07-13 21:46:33 UTC (rev 9597)
+++ trunk/apps/Thaw/src/thaw/plugins/queueWatcher/QueueTableModel.java
2006-07-13 23:22:07 UTC (rev 9598)
@@ -20,17 +20,17 @@
private Vector queries = null;
- private boolean isForInsertion = false;
+ private boolean isForInsertions = false;
public QueueTableModel(boolean isForInsertions) {
super();
- this.isForInsertion = isForInsertion;
+ this.isForInsertions = isForInsertions;
columnNames.add(I18n.getMessage("thaw.common.file"));
columnNames.add(I18n.getMessage("thaw.common.size"));
- if(!isForInsertion)
+ if(!isForInsertions)
columnNames.add(I18n.getMessage("thaw.common.localPath"));
columnNames.add(I18n.getMessage("thaw.common.status"));
@@ -64,28 +64,27 @@
FCPTransferQuery query = (FCPTransferQuery)queries.get(row);
if(column == 0) {
- String[] plop = query.getFileKey().split("/");
- return plop[plop.length-1];
+ return query.getFilename();
}
if(column == 1) {
return ((new Long(query.getFileSize())).toString() + "
B"); /* TODO : Convert to KB / MB / GB */
}
- if(!isForInsertion && column == 2) {
+ if(!isForInsertions && column == 2) {
if(query.getPath() != null)
return query.getPath();
else
return
I18n.getMessage("thaw.common.unspecified");
}
- if( (isForInsertion && column == 2)
- || (!isForInsertion && column == 3) ) {
+ if( (isForInsertions && column == 2)
+ || (!isForInsertions && column == 3) ) {
return query.getStatus();
}
- if( (isForInsertion && column == 3
- || (!isForInsertion && column == 4) ) ) {
+ if( (isForInsertions && column == 3
+ || (!isForInsertions && column == 4) ) ) {
return ((new
Integer(query.getProgression())).toString() + " %");
}