Author: batosai
Date: 2008-08-13 12:13:04 +0000 (Wed, 13 Aug 2008)
New Revision: 21798
Modified:
trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
Log:
Made the choice of a context mandatory when creating an identity.
Modified: trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/WoTplugin.java 2008-08-13 12:12:35 UTC
(rev 21797)
+++ trunk/apps/WoT/src/plugins/WoT/WoTplugin.java 2008-08-13 12:13:04 UTC
(rev 21798)
@@ -399,19 +399,20 @@
return createIdentity(
request.getPartAsString("insertURI",1024),
request.getPartAsString("requestURI",1024),
request.getPartAsString("nickName", 1024),
-
request.getPartAsString("publishTrustList", 1024));
+
request.getPartAsString("publishTrustList", 1024),
+ "testing");
}
- private OwnIdentity createIdentity(String nickName, String
publishTrustList) throws TransformerConfigurationException,
FileNotFoundException, InvalidParameterException, ParserConfigurationException,
TransformerException, IOException, InsertException {
+ private OwnIdentity createIdentity(String nickName, String
publishTrustList, String context) throws TransformerConfigurationException,
FileNotFoundException, InvalidParameterException, ParserConfigurationException,
TransformerException, IOException, InsertException {
-
FreenetURI[] keypair = client.generateKeyPair("WoT");
- return createIdentity(keypair[0].toString(),
keypair[1].toString(), nickName, publishTrustList);
+ return createIdentity(keypair[0].toString(),
keypair[1].toString(), nickName, publishTrustList, context);
}
- private OwnIdentity createIdentity(String insertURI, String requestURI,
String nickName, String publishTrustList) throws InvalidParameterException,
TransformerConfigurationException, FileNotFoundException,
ParserConfigurationException, TransformerException, IOException,
InsertException {
+ private OwnIdentity createIdentity(String insertURI, String requestURI,
String nickName, String publishTrustList, String context) throws
InvalidParameterException, TransformerConfigurationException,
FileNotFoundException, ParserConfigurationException, TransformerException,
IOException, InsertException {
OwnIdentity identity = new OwnIdentity(insertURI, requestURI,
new Date(0), new Date(), nickName, publishTrustList);
+ identity.addContext(context, db);
db.store(identity);
Score score = new Score(identity, identity, 100, 0, 100); // We
need to initialize the trust tree
@@ -465,17 +466,18 @@
SimpleFieldSet sfs = new SimpleFieldSet(false);
OwnIdentity identity;
- if(params.get("NickName")==null ||
params.get("PublishTrustList")==null) throw new
InvalidParameterException("Missing mandatory parameter");
+ if(params.get("NickName")==null ||
params.get("PublishTrustList")==null || params.get("Context")==null) throw new
InvalidParameterException("Missing mandatory parameter");
if(params.get("RequestURI")==null ||
params.get("InsertURI")==null) {
- identity = createIdentity(params.get("NickName"),
params.get("PublishTrustList"));
+ identity = createIdentity(params.get("NickName"),
params.get("PublishTrustList"), params.get("Context"));
}
else {
identity = createIdentity( params.get("InsertURI"),
params.get("RequestURI"),
params.get("NickName"),
-
params.get("PublishTrustList"));
- }
+
params.get("PublishTrustList"),
+
params.get("Context"));
+ }
sfs.putAppend("Message", "IdentityCreated");
sfs.putAppend("InsertURI", identity.getInsertURI().toString());
sfs.putAppend("RequestURI",
identity.getRequestURI().toString());