Major update: refactored the API of all classes to make attributes start with a lower case letter and rename encode=>to_ccnb() and decode()=>from_ccnb.
(according to the API notes: http://sea.remap.ucla.edu:8080/attachments/download/23/lwndn_api-notes_21020830.txt )
diff --git a/js/PublisherID.js b/js/PublisherID.js
index 64955f3..3558d24 100644
--- a/js/PublisherID.js
+++ b/js/PublisherID.js
@@ -34,16 +34,16 @@
//TODO, implement publisherID creation and key creation
//TODO implement generatePublicKeyDigest
- this.PublisherID =null;//= generatePublicKeyDigest(key);//ByteArray
+ this.publisherID =null;//= generatePublicKeyDigest(key);//ByteArray
//TODO implement generate key
//CryptoUtil.generateKeyID(PUBLISHER_ID_DIGEST_ALGORITHM, key);
- this.PublisherType = null;//isIssuer ? PublisherType.ISSUER_KEY : PublisherType.KEY;//publisher Type
+ this.publisherType = null;//isIssuer ? PublisherType.ISSUER_KEY : PublisherType.KEY;//publisher Type
};
-PublisherID.prototype.decode = function(decoder) {
+PublisherID.prototype.from_ccnb = function(decoder) {
// We have a choice here of one of 4 binary element types.
var nextTag = decoder.peekStartElementAsLong();
@@ -52,23 +52,23 @@
throw new Exception("Cannot parse publisher ID.");
}
- this.PublisherType = new PublisherType(nextTag);
+ this.publisherType = new PublisherType(nextTag);
if (!isTypeTagVal(nextTag)) {
throw new Exception("Invalid publisher ID, got unexpected type: " + nextTag);
}
- this.PublisherID = decoder.readBinaryElement(nextTag);
- if (null == this.PublisherID) {
+ this.publisherID = decoder.readBinaryElement(nextTag);
+ if (null == this.publisherID) {
throw new ContentDecodingException("Cannot parse publisher ID of type : " + nextTag + ".");
}
};
-PublisherID.prototype.encode = function(encoder) {
+PublisherID.prototype.to_ccnb = function(encoder) {
if (!this.validate()) {
throw new Exception("Cannot encode " + this.getClass().getName() + ": field values missing.");
}
- encoder.writeElement(this.getElementLabel(), this.PublisherID);
+ encoder.writeElement(this.getElementLabel(), this.publisherID);
};
PublisherID.peek = function(/* XMLDecoder */ decoder) {
@@ -84,7 +84,7 @@
};
PublisherID.prototype.getElementLabel = function() {
- return this.PublisherType.Tag;
+ return this.publisherType.Tag;
};
PublisherID.prototype.validate = function(){