[Phoenix-commits] rev 15001 -
public/phoenix/trunk/phoenix/prototypes/prototype1/src/chrome/content
andi at wyona.com
andi at wyona.com
Wed Jul 5 20:03:44 CEST 2006
Author: andi
Date: 2006-07-05 20:03:43 +0200 (Wed, 05 Jul 2006)
New Revision: 15001
Modified:
public/phoenix/trunk/phoenix/prototypes/prototype1/src/chrome/content/neutron.js
public/phoenix/trunk/phoenix/prototypes/prototype1/src/chrome/content/neutronparser10.js
Log:
Added empty NeutronParser baseclass.
Added more code documentation.
Modified: public/phoenix/trunk/phoenix/prototypes/prototype1/src/chrome/content/neutron.js
===================================================================
--- public/phoenix/trunk/phoenix/prototypes/prototype1/src/chrome/content/neutron.js 2006-07-05 17:37:53 UTC (rev 15000)
+++ public/phoenix/trunk/phoenix/prototypes/prototype1/src/chrome/content/neutron.js 2006-07-05 18:03:43 UTC (rev 15001)
@@ -33,10 +33,11 @@
var Neutron = {
/**
- * Fetch introspection file.
+ * Fetch introspection file and parse it.
*
* @param {String} aURI URI of CMS to query for introspection file
- * @return {Capabilities} a Capabilities object
+ * @param {nsIURI} aBaseURI the base URI of the document
+ * @return {Capabilities} a Capabilities object
*/
introspection: function (aURI, aBaseURI) {
var xmlDocument = null;
@@ -88,6 +89,15 @@
return introspection;
},
+ /**
+ * Parse a Neutron message (like e.g. an exception).
+ *
+ * The result of the parsing is always returend by throwing
+ * an Error object.
+ *
+ * @param {String} aResponse a Neutron message as delivered by a request response
+ * @return {Undefined} does not have a return value
+ */
response: function (aResponse) {
var xmlDocument = null;
var documentRoot = null;
@@ -109,6 +119,14 @@
},
+ /**
+ * Instantiates a parser corresponding to the Neutron version
+ * used.
+ *
+ * @param {nsIDOMXMLDocument} aDocument the Neutron document to parse
+ * @param {nsIRUI} aBaseURI the base URI of the document
+ * @return {NeutronParser} the Neutron parser best matching the used Neutron version
+ */
parserFactory: function (aDocument, aBaseURI) {
var namespace = null;
var introspectionParser = null;
@@ -140,6 +158,11 @@
}
};
+
+/* TODO: the Asset type is not used in Phoenix, but may be used e.g.
+ * in the Thunderbird/Suite/SeaMonkey CMSConnector.
+ *
+ * Should we retain it here nevertheless? */
/**
* Asset constructor. Instantiates a new object of type Asset.
*
@@ -154,6 +177,7 @@
assetType = aAssetType;
// privileged instance methods
+
/**
* Return the content URI.
*
@@ -192,19 +216,49 @@
newAsset: null,
navigation: null,
+ /**
+ * Get the introspection document source.
+ *
+ * @return {String} the Neutron document as retrieved from the remote host
+ */
getIntrospectionDocument: function () {
return this.introspectionDocument;
},
+ /**
+ * Get the URI where this introspection document is
+ * located.
+ *
+ * @return {String} the URI of this introspection document
+ */
getIntrospectionURI: function () {
return this.introspectionURI;
},
+ /**
+ * Get the compatibility level of this object.
+ *
+ * @return {Undefined} does not have a return value
+ */
// THE SPECIFICATION MUST FIRST BE WRITTEN FOR THIS PART
queryCompatibility: function () {
// return compatibility level
},
+ /**
+ * Get an array of fragments which can be loaded
+ * using the Neutron "open" operation.
+ *
+ * This method returns a two-dimensional array, the
+ * first dimension consisting of arrays of fragments.
+ * The fragment array consists of the fragment string name
+ * in field 0, and the fragment nsIURI in field 1.
+ *
+ * Note that the fragment order is retained as listed in
+ * the introspection document.
+ *
+ * @return {Array} two-dimensional array containing all framgents which can be opened by the "open" operation
+ */
queryOpenFragments: function () {
var fragments = new Array();
var j = 0;
@@ -222,6 +276,20 @@
return fragments;
},
+ /**
+ * Get an array of fragments which can be loaded
+ * using the Neutron "checkout" operation.
+ *
+ * This method returns a two-dimensional array, the
+ * first dimension consisting of arrays of fragments.
+ * The fragment array consists of the fragment string name
+ * in field 0, and the fragment nsIURI in field 1.
+ *
+ * Note that the fragment order is retained as listed in
+ * the introspection document.
+ *
+ * @return {Array} two-dimensional array containing all framgents which can be opened by the "checkout" operation
+ */
queryCheckoutFragments: function () {
var fragments = new Array();
var j = 0;
@@ -239,66 +307,160 @@
return fragments;
},
+ /**
+ * Return the name of the fragment for the given
+ * fragment identifier.
+ *
+ * @param {Integer} aFragment a fragment identifier
+ * @return {String} the fragment name
+ */
queryFragmentName: function (aFragment) {
// return name for fragment
return this.fragments[aFragment].name;
},
+ /**
+ * Return the MIME type of the fragment for the given
+ * fragment identifier.
+ *
+ * @param {Integer} aFragment a fragment identifier
+ * @return {String} the MIME type
+ */
queryFragmentMIMEType: function (aFragment) {
// return MIME type for fragment
return this.fragments[aFragment].mimeType;
},
+ /**
+ * Return the URI for the "open" operation for the given
+ * fragment identifier.
+ *
+ * @param {Integer} aFragment a fragment identifier
+ * @return {nsIURI} the "open" URI
+ */
queryFragmentOpenURI: function (aFragment) {
// return open URI for fragment
return this.fragments[aFragment].open.uri;
},
+ /**
+ * Return the method for the "open" operation for the given
+ * fragment identifier.
+ *
+ * @param {Integer} aFragment a fragment identifier
+ * @return {String} the "open" method
+ */
queryFragmentOpenMethod: function (aFragment) {
// return open method for fragment
return this.fragments[aFragment].open.method;
},
+ /**
+ * Return the URI for the "save" operation for the given
+ * fragment identifier.
+ *
+ * @param {Integer} aFragment a fragment identifier
+ * @return {nsIURI} the "save" URI
+ */
queryFragmentSaveURI: function (aFragment) {
// return save URI for fragment
return this.fragments[aFragment].save.uri;
},
+ /**
+ * Return the method for the "save" operation for the given
+ * fragment identifier.
+ *
+ * @param {Integer} aFragment a fragment identifier
+ * @return {String} the "save" method
+ */
queryFragmentSaveMethod: function (aFragment) {
// return save method for fragment
return this.fragments[aFragment].save.method;
},
+ /**
+ * Return the URI for the "checkout" operation for the given
+ * fragment identifier.
+ *
+ * @param {Integer} aFragment a fragment identifier
+ * @return {nsIURI} the "checkout" URI
+ */
queryFragmentCheckoutURI: function (aFragment) {
// return checkout URI for fragment
return this.fragments[aFragment].checkout.uri;
},
+ /**
+ * Return the method for the "checkout" operation for the given
+ * fragment identifier.
+ *
+ * @param {Integer} aFragment a fragment identifier
+ * @return {String} the "checkout" method
+ */
queryFragmentCheckoutMethod: function (aFragment) {
// return checkout method for fragment
return this.fragments[aFragment].checkout.method;
},
+ /**
+ * Return the URI for the "checkin" operation for the given
+ * fragment identifier.
+ *
+ * @param {Integer} aFragment a fragment identifier
+ * @return {nsIURI} the "checkin" URI
+ */
queryFragmentCheckinURI: function (aFragment) {
// return checkin URI for fragment
return this.fragments[aFragment].checkin.uri;
},
+ /**
+ * Return the method for the "checkin" operation for the given
+ * fragment identifier.
+ *
+ * @param {Integer} aFragment a fragment identifier
+ * @return {String} the "checkin" method
+ */
queryFragmentCheckinMethod: function (aFragment) {
// return checkin method for fragment
return this.fragments[aFragment].checkin.method;
},
+ /**
+ * Return the schemas associated with the fragment for the given
+ * fragment identifier.
+ *
+ * Returns an array of objects.
+ *
+ * @param {Integer} aFragment a fragment identifier
+ * @return {Array} an array of objects
+ */
queryFragmentSchemas: function (aFragment) {
// return available schemas for fragment
return this.fragments[aFragment].schemas;
},
+ /**
+ * Return the stylesheets associated with the fragment for the given
+ * fragment identifier.
+ *
+ * Returns an array of objects.
+ *
+ * @param {Integer} aFragment a fragment identifier
+ * @return {Array} an array of objects
+ */
queryFragmentStyles: function (aFragment) {
// return available style sheets for fragment
return this.fragments[aFragment].styles;
},
+ /**
+ * Return a string representation of this capabilities
+ * object.
+ *
+ * @return {String} a string representation of this object
+ */
toString: function () {
var objString = "";
@@ -370,3 +532,15 @@
}
NeutronProtocolException.prototype.__proto__ = Error.prototype;
+
+
+/**
+ * NeutronParser constructor. Instantiates a new object of
+ * type NeutronParser.
+ *
+ * Base class for versioned Neutron parsers.
+ *
+ * @constructor
+ * @return {NeutronParser}
+ */
+function NeutronParser() {}
Modified: public/phoenix/trunk/phoenix/prototypes/prototype1/src/chrome/content/neutronparser10.js
===================================================================
--- public/phoenix/trunk/phoenix/prototypes/prototype1/src/chrome/content/neutronparser10.js 2006-07-05 17:37:53 UTC (rev 15000)
+++ public/phoenix/trunk/phoenix/prototypes/prototype1/src/chrome/content/neutronparser10.js 2006-07-05 18:03:43 UTC (rev 15001)
@@ -38,6 +38,8 @@
}
NeutronParser10.prototype = {
+ __proto__: NeutronParser,
+
documentDOM: null,
baseURI : null,
ioService : null,
More information about the Phoenix-commits
mailing list