From b55c6b8bcee8357483187b66380d5e7c6ed7a2d8 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 31 Oct 2014 13:15:05 -0700 Subject: [PATCH] [Framework] Initial skeletons for framework Initial skeletons for framework classes, WTD-518. --- platform/framework/src/Bundle.js | 47 +++++++++++++++++++ platform/framework/src/BundleLoader.js | 23 +++++++++ platform/framework/src/Extension.js | 65 ++++++++++++++++++++++++++ 3 files changed, 135 insertions(+) create mode 100644 platform/framework/src/Bundle.js create mode 100644 platform/framework/src/BundleLoader.js create mode 100644 platform/framework/src/Extension.js diff --git a/platform/framework/src/Bundle.js b/platform/framework/src/Bundle.js new file mode 100644 index 0000000000..8a67ed7c5b --- /dev/null +++ b/platform/framework/src/Bundle.js @@ -0,0 +1,47 @@ +/*global define*/ + +define( + [], + function () { + "use strict"; + + + /** + * A bundle's plain JSON definition. + * + * @name BundleDefinition + * @property {string} name the human-readable name of this bundle + * @property {Object.} [extensions={}] + * all extensions exposed by this bundle + */ + + + /** + * Instantiate a new reference to a bundle, based on its human-readable + * definition. + * + * @param {string} path the path to the directory containing + * this bundle + * @param {BundleDefinition} definition + * @returns {{getDefinition: Function}} + * @constructor + */ + function Bundle(path, definition) { + + + return { + /** + * + * @returns {BundleDefinition} the raw definition of this bundle + */ + getDefinition: function () { + return definition; + } + }; + } + + new Bundle().getDefinition().extensions['k'][0]. + + return Bundle; + } +); \ No newline at end of file diff --git a/platform/framework/src/BundleLoader.js b/platform/framework/src/BundleLoader.js new file mode 100644 index 0000000000..e8f72d0e6d --- /dev/null +++ b/platform/framework/src/BundleLoader.js @@ -0,0 +1,23 @@ +/*global define*/ + +/** + * Module defining BundleLoader.js. Created by vwoeltje on 10/31/14. + */ +define( + [], + function () { + "use strict"; + + /** + * + * @constructor + */ + function BundleLoader() { + return { + + }; + } + + return BundleLoader; + } +); \ No newline at end of file diff --git a/platform/framework/src/Extension.js b/platform/framework/src/Extension.js new file mode 100644 index 0000000000..0429423cde --- /dev/null +++ b/platform/framework/src/Extension.js @@ -0,0 +1,65 @@ +/*global define*/ + +define( + [], + function () { + /** + * An extension's plain JSON definition. + * + * @name ExtensionDefinition + * @property {string} [key] the machine-readable identifier for this + * extension + * @property {string} [implementation] the path to the AMD module + * which implements this extension; this path is relative + * to the containing bundle's source folder. + * @property {string[]} [depends=[]] the dependencies needed by this + * extension; these are strings as shall be passed to + * Angular's dependency resolution mechanism. + */ + + /** + * Instantiate a new extension based on its definition. This serves + * primarily as a wrapper around the extension's definition to expose + * a useful interface. + * + * An extension + * + * @param {Bundle} bundle the bundle which exposed this extension + * @param {string} category the type of extension being exposed + * @param {ExtensionDefinition} definition the plain definition of + * this extension + * @constructor + */ + function Extension(bundle, category, definition) { + + + return { + /** + * @memberof Extension# + * @returns {Bundle} + */ + getBundle: function () { + return bundle; + }, + /** + * @memberof Extension# + * @returns {string} + */ + getCategory: function () { + return category; + }, + /** + * @memberof Extension# + * @returns {ExtensionDefinition} + */ + getDefinition: function () { + return definition; + } + + }; + } + + return Extension; + + } +); \ No newline at end of file