summaryrefslogtreecommitdiffstats
path: root/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources
diff options
context:
space:
mode:
authordims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
committerdims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
commitbdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch)
tree38a92061c0793434c4be189f1d70c3458b6bc41d /sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources')
-rw-r--r--sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/DomainManager.composite246
-rw-r--r--sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/cloud.html362
-rw-r--r--sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/composite.html257
-rw-r--r--sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/files.html114
-rw-r--r--sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/home.html59
-rw-r--r--sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/icons/feed-icon.pngbin0 -> 818 bytes
-rw-r--r--sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/manager.css99
-rw-r--r--sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/utils.js197
-rw-r--r--sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/workspace.html206
9 files changed, 1540 insertions, 0 deletions
diff --git a/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/DomainManager.composite b/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/DomainManager.composite
new file mode 100644
index 0000000000..fe1fdc2d80
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/DomainManager.composite
@@ -0,0 +1,246 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="DomainManager">
+
+ <component name="HomeUI">
+ <t:implementation.widget location="home.html"/>
+ <service name="Widget">
+ <t:binding.http uri="http://localhost:9990/ui/home"/>
+ </service>
+ </component>
+
+ <component name="ContributionUI">
+ <t:implementation.widget location="workspace.html"/>
+ <service name="Widget">
+ <t:binding.http uri="http://localhost:9990/ui/workspace"/>
+ </service>
+ <reference name="workspace" target="ContributionCollectionComponent/ItemCollection">
+ <t:binding.atom/>
+ </reference>
+ </component>
+
+ <component name="FilesUI">
+ <t:implementation.widget location="files.html"/>
+ <service name="Widget">
+ <t:binding.http uri="http://localhost:9990/ui/files"/>
+ </service>
+ <reference name="files" target="FileCollectionComponent">
+ <t:binding.atom/>
+ </reference>
+ </component>
+
+ <component name="DomainCompositeUI">
+ <t:implementation.widget location="composite.html"/>
+ <service name="Widget">
+ <t:binding.http uri="http://localhost:9990/ui/composite"/>
+ </service>
+ <reference name="domainComposite" target="DomainCompositeCollectionComponent/ItemCollection">
+ <t:binding.atom/>
+ </reference>
+ <reference name="workspace" target="ContributionCollectionComponent/ItemCollection">
+ <t:binding.atom/>
+ </reference>
+ </component>
+
+ <component name="CloudUI">
+ <t:implementation.widget location="cloud.html"/>
+ <service name="Widget">
+ <t:binding.http uri="http://localhost:9990/ui/cloud"/>
+ </service>
+ <reference name="cloudComposite" target="CloudCollectionComponent/ItemCollection">
+ <t:binding.atom/>
+ </reference>
+ <reference name="domainComposite" target="DomainCompositeCollectionComponent/ItemCollection">
+ <t:binding.atom/>
+ </reference>
+ <reference name="processCollection" target="NodeProcessCollectionFacadeComponent/ItemCollection">
+ <t:binding.atom/>
+ </reference>
+ </component>
+
+ <component name="ContributionCollectionComponent">
+ <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.ContributionCollectionImpl"/>
+ <property name="workspaceFile">workspace.xml</property>
+ <property name="deploymentContributionDirectory">cloud</property>
+ <service name="ItemCollection">
+ <t:binding.atom uri="http://localhost:9990/workspace" title="Contributions"/>
+ </service>
+ <reference name="domainManagerConfiguration" target="DomainManagerConfigurationComponent"/>
+ </component>
+
+ <component name="ContributionServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.ContributionServiceImpl"/>
+ <service name="Servlet">
+ <t:binding.http uri="http://localhost:9990/contribution"/>
+ </service>
+ <reference name="contributionCollection" target="ContributionCollectionComponent/LocalItemCollection"/>
+ </component>
+
+ <component name="FileCollectionComponent">
+ <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.FileCollectionImpl"/>
+ <property name="directoryName">files</property>
+ <service name="ItemCollection">
+ <t:binding.atom uri="http://localhost:9990/feed/files" title="Files"/>
+ </service>
+ <reference name="domainManagerConfiguration" target="DomainManagerConfigurationComponent"/>
+ </component>
+
+ <component name="FileServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.FileServiceImpl"/>
+ <property name="directoryName">files</property>
+ <service name="Servlet">
+ <t:binding.http uri="http://localhost:9990/files"/>
+ </service>
+ <reference name="domainManagerConfiguration" target="DomainManagerConfigurationComponent"/>
+ </component>
+
+ <component name="DomainCompositeCollectionComponent">
+ <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.DeployedCompositeCollectionImpl"/>
+ <property name="compositeFile">domain.composite</property>
+ <service name="ItemCollection">
+ <t:binding.atom uri="http://localhost:9990/composite" title="Domain Composite"/>
+ </service>
+ <reference name="deployableCollection" target="DeployableCompositeCollectionComponent/LocalItemCollection"/>
+ <reference name="domainManagerConfiguration" target="DomainManagerConfigurationComponent"/>
+ </component>
+
+ <component name="DeployableCompositeServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.DeployableCompositeServiceImpl"/>
+ <service name="Servlet">
+ <t:binding.http uri="http://localhost:9990/composite-source"/>
+ </service>
+ <reference name="deployableCollection" target="DeployableCompositeCollectionComponent/LocalItemCollection"/>
+ <reference name="domainManagerConfiguration" target="DomainManagerConfigurationComponent"/>
+ </component>
+
+ <component name="DeployableCompositeCollectionComponent">
+ <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.DeployableCompositeCollectionImpl"/>
+ <service name="ItemCollection">
+ <t:binding.atom uri="http://localhost:9990/deployable" title="Deployable Composites"/>
+ </service>
+ <reference name="domainManagerConfiguration" target="DomainManagerConfigurationComponent"/>
+ <reference name="contributionCollection" target="ContributionCollectionComponent/LocalItemCollection"/>
+ </component>
+
+ <component name="CompositeGeneratorServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.CompositeGeneratorServiceImpl"/>
+ <service name="Servlet">
+ <t:binding.http uri="http://localhost:9990/composite-generated"/>
+ </service>
+ <reference name="domainManagerConfiguration" target="DomainManagerConfigurationComponent"/>
+ <reference name="contributionCollection" target="ContributionCollectionComponent/LocalItemCollection"/>
+ </component>
+
+ <component name="CompositeConfigurationServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.CompositeConfigurationServiceImpl"/>
+ <service name="Servlet">
+ <t:binding.http uri="http://localhost:9990/composite-resolved"/>
+ </service>
+ <reference name="domainManagerConfiguration" target="DomainManagerConfigurationComponent"/>
+ <reference name="contributionCollection" target="ContributionCollectionComponent/LocalItemCollection"/>
+ <reference name="domainCompositeCollection" target="DomainCompositeCollectionComponent/LocalItemCollection"/>
+ <reference name="cloudCollection" target="CloudCollectionComponent/LocalItemCollection"/>
+ </component>
+
+ <component name="CloudCollectionComponent">
+ <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.DeployedCompositeCollectionImpl"/>
+ <property name="compositeFile">cloud.composite</property>
+ <property name="deploymentContributionDirectory">cloud</property>
+ <service name="ItemCollection">
+ <t:binding.atom uri="http://localhost:9990/cloud" title="Cloud"/>
+ </service>
+ <reference name="deployableCollection" target="DeployableCompositeCollectionComponent/LocalItemCollection"/>
+ <reference name="processCollection" target="NodeProcessCollectionFacadeComponent/LocalItemCollection"/>
+ <reference name="domainManagerConfiguration" target="DomainManagerConfigurationComponent"/>
+ </component>
+
+ <component name="CloudCompositeServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.DeployableCompositeServiceImpl"/>
+ <service name="Servlet">
+ <t:binding.http uri="http://localhost:9990/cloud-source"/>
+ </service>
+ <reference name="deployableCollection" target="DeployableCompositeCollectionComponent/LocalItemCollection"/>
+ <reference name="domainManagerConfiguration" target="DomainManagerConfigurationComponent"/>
+ </component>
+
+ <component name="CompositeConfigurationCollectionComponent">
+ <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.CompositeConfigurationCollectionImpl"/>
+ <service name="ItemCollection">
+ <t:binding.atom uri="http://localhost:9990/composite-config" title="Node Configuration"/>
+ </service>
+ <reference name="contributionCollection" target="ContributionCollectionComponent/LocalItemCollection"/>
+ <reference name="cloudCollection" target="CloudCollectionComponent/LocalItemCollection"/>
+ </component>
+
+ <component name="NodeConfigurationServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.NodeConfigurationServiceImpl"/>
+ <service name="Servlet">
+ <t:binding.http uri="http://localhost:9990/node-config"/>
+ </service>
+ <reference name="contributionCollection" target="ContributionCollectionComponent/LocalItemCollection"/>
+ <reference name="cloudCollection" target="CloudCollectionComponent/LocalItemCollection"/>
+ </component>
+
+ <component name="QuickStartServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.QuickStartServiceImpl"/>
+ <service name="Servlet">
+ <t:binding.http uri="http://localhost:9990/quickstart"/>
+ </service>
+ <reference name="contributionCollection" target="ContributionCollectionComponent/LocalItemCollection"/>
+ <reference name="deployableCollection" target="DeployableCompositeCollectionComponent/LocalItemCollection"/>
+ <reference name="domainCompositeCollection" target="DomainCompositeCollectionComponent/LocalItemCollection"/>
+ <reference name="cloudCollection" target="CloudCollectionComponent/LocalItemCollection"/>
+ <reference name="processCollection" target="NodeProcessCollectionComponent/LocalItemCollection"/>
+ </component>
+
+ <component name="NodeProcessCollectionFacadeComponent">
+ <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.NodeProcessCollectionFacadeImpl"/>
+ <service name="ItemCollection">
+ <t:binding.atom uri="http://localhost:9990/processes" title="Log"/>
+ </service>
+ <reference name="domainManagerConfiguration" target="DomainManagerConfigurationComponent"/>
+ <reference name="cloudCollection" target="CloudCollectionComponent/LocalItemCollection"/>
+ <reference name="processCollection" target="NodeProcessCollectionComponent/ItemCollection">
+ <t:binding.atom/>
+ </reference>
+ </component>
+
+ <component name="NodeProcessCollectionComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.node.launcher.NodeProcessCollectionImpl"/>
+ <service name="ItemCollection">
+ <t:binding.atom uri="http://localhost:9990/node/processes" title="Log"/>
+ </service>
+ </component>
+
+ <component name="PingServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.node.launcher.PingServiceImpl"/>
+ <service name="Servlet">
+ <t:binding.http uri="http://localhost:9990/ping"/>
+ </service>
+ </component>
+
+ <component name="DomainManagerConfigurationComponent">
+ <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.DomainManagerConfigurationImpl"/>
+ </component>
+
+</composite>
diff --git a/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/cloud.html b/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/cloud.html
new file mode 100644
index 0000000000..2564322ec9
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/cloud.html
@@ -0,0 +1,362 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<html>
+<head>
+<title>SCA Domain - Cloud</title>
+
+<script type="text/javascript" src="cloud.js"></script>
+<script type="text/javascript" src="utils.js"></script>
+
+<script language="JavaScript">
+
+ //@Reference
+ var cloudComposite = new Reference("cloudComposite");
+
+ //@Reference
+ var domainComposite = new Reference("domainComposite");
+
+ //@Reference
+ var processCollection = new Reference("processCollection");
+
+ function getNodes() {
+ cloudComposite.get("", getNodesResponse);
+ }
+
+ function contributionURI(id) {
+ var i = id.indexOf(';');
+ return id.substring(10, i);
+ }
+
+ function compositeName(id) {
+ var i = id.indexOf(';');
+ return id.substring(i + 1);
+ }
+
+ function compositeLocalName(id) {
+ name = compositeName(id);
+ var i = name.indexOf(';');
+ return name.substring(i + 1);
+ }
+
+ var nodeNames;
+
+ function getNodesResponse(feed) {
+ nodeNames = new Array();
+ if (feed != null) {
+ var entries = feed.getElementsByTagName("entry");
+ var composites = "";
+ composites += '<table width="100%">';
+ composites += '<tr><th>Node</th><th>Status</th><th>Composite</th>' +
+ '<th>Contribution</th><th>Node Config</th></tr>';
+
+ for (var i=0; i<entries.length; i++) {
+ var nodeId = entries[i].getElementsByTagName("id")[0].firstChild.nodeValue;
+ var links = entries[i].getElementsByTagName("link");
+ var nodeLink = undefined;
+ var compositeLink = undefined;
+ var compositeId = "composite:undefined;undefined;undefined";
+ var uri = '<span style="color: red">unknown</span>';
+ var qname = undefined;
+ for (var l = 0; l < links.length; l++) {
+ var a = links[l].getAttribute('rel');
+ if (a == undefined) {
+ nodeLink = links[l].getAttribute('href');
+ } else if (a == 'related') {
+ compositeLink = links[l].getAttribute('href');
+ var c = compositeLink.indexOf('composite:');
+ compositeId = compositeLink.substring(c);
+ uri = contributionURI(compositeId);
+ qname = compositeName(compositeId);
+ }
+ }
+
+ var nodeName = compositeLocalName(nodeId);
+ nodeNames[i] = nodeName;
+
+ var content = "";
+ if (entries[i].getElementsByTagName("content")[0].firstChild != null) {
+ content = entries[i].getElementsByTagName("content")[0].firstChild.nodeValue;
+ }
+
+ composites += '<tr>'
+ if (content.indexOf('<span id="problem"') != -1) {
+ composites += '<td><input name="composites" type="checkbox" value="' + nodeId + '">' +
+ '<a href=\"' + nodeLink + '\">' + nodeName + '</a></td>';
+ composites += '<td><span id="status_' + nodeName + '">unknown</span></td>';
+ composites += '<td>' + content + '</td>';
+ composites += '<td>' + uri + '</td>';
+ } else {
+ composites += '<td><input name="composites" type="checkbox" value="' + nodeId + '">' +
+ '<a href=\"' + nodeLink + '\">' + nodeName + '</a></td>';
+ composites += '<td><span id="status_' + nodeName + '">unknown</span></td>';
+ composites += '<td><a href=\"' + compositeLink + '\">' + qname + '</a></td>';
+ composites += '<td><a href="/contribution/' + uri + '">' + uri + '</a></td>';
+ }
+ composites += '<td><a href="/node-config/' + nodeName + '"><img src="icons/feed-icon.png" border="0"></a></td>';
+ composites += '</tr>';
+ }
+ composites += '</table>';
+ document.getElementById("composites").innerHTML = composites;
+
+ processCollection.get("", getProcessesResponse);
+ }
+ }
+
+ function getProcessesResponse(feed) {
+ if (feed != null) {
+ var nodeStatus = new Array();
+
+ var entries = feed.getElementsByTagName("entry");
+ for (var i=0; i<entries.length; i++) {
+ var nodeName = entries[i].getElementsByTagName("id")[0].firstChild.nodeValue;
+ nodeStatus[nodeName] = 'started';
+ }
+
+ for (var i = 0; i < nodeNames.length; i++) {
+ var element = document.getElementById('status_' + nodeNames[i]);
+ var nodeName = nodeNames[i];
+ if (nodeStatus[nodeName] == null) {
+ element.innerHTML = '<span>stopped</span>';
+ } else {
+ element.innerHTML = '<span><a style="color: green" href="/processes/?node=' + nodeName + '">started</a></span>';
+ }
+ }
+ }
+ }
+
+ function deleteNode() {
+ var composites = array(document.cloudCompositeForm.composites);
+ for (var i = 0; i < composites.length; i++) {
+ if (composites[i].checked) {
+ var id = composites[i].value;
+ cloudComposite.del(id, deleteNodeResponse);
+ }
+ }
+ }
+
+ function deleteNodeResponse() {
+ getNodes();
+ }
+
+ function addNode() {
+ var nodeName = document.newNodeForm.nodeName.value;
+ var nodeURI = document.newNodeForm.nodeURI.value;
+ var compositeNamespace = document.newNodeForm.compositeNamespace.value;
+ var compositeName = document.newNodeForm.compositeName.value;
+ var contributionURI = document.newNodeForm.contributionURI.value;
+ var id = 'composite:' +
+ 'http://tuscany.apache.org/cloud' + ';' +
+ 'http://tuscany.apache.org/cloud' + ';' +
+ nodeName;
+
+ var entry = '<entry xmlns="http://www.w3.org/2005/Atom">\n' +
+ '<id>' + id + '</id>\n' +
+ '<content type="text/xml">\n' +
+ '<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"\n' +
+ ' xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"\n' +
+ ' targetNamespace="http://tuscany.apache.org/cloud"\n' +
+ ' xmlns:c="' + compositeNamespace + '"\n' +
+ ' name="' + nodeName + '">\n' +
+ '\n' +
+ ' <component name="' + nodeName + '">\n' +
+ ' <t:implementation.node uri="' + contributionURI + '" composite="c:' + compositeName + '"/>\n' +
+ ' <service name="Node">\n' +
+ ' <binding.ws uri="' + nodeURI + '"/>\n' +
+ ' <t:binding.http uri="' + nodeURI + '"/>\n' +
+ ' <t:binding.jsonrpc uri="' + nodeURI + '"/>\n' +
+ ' <t:binding.atom uri="' + nodeURI + '"/>\n' +
+ ' </service>\n' +
+ ' </component>\n' +
+ '</composite>' +
+ '</content>' +
+ '</entry>';
+ cloudComposite.post(entry, addNodeResponse);
+ }
+
+ function addNodeResponse() {
+ document.newNodeForm.nodeName.value = "";
+ document.newNodeForm.nodeURI.value = "";
+ document.newNodeForm.compositeNamespace.value = "";
+ document.newNodeForm.compositeName.value = "";
+ document.newNodeForm.contributionURI.value = "";
+ getNodes();
+ }
+
+ function startNode() {
+ var composites = array(document.cloudCompositeForm.composites);
+ for (var i = 0; i < composites.length; i++) {
+ if (composites[i].checked) {
+ var id = nodeNames[i];
+
+ var entry = '<entry xmlns="http://www.w3.org/2005/Atom">' +
+ '<id>' + id + '</id>' +
+ '</entry>';
+ processCollection.post(entry, startNodeResponse);
+ }
+ }
+ }
+
+ function startNodeResponse() {
+ processCollection.get("", getProcessesResponse);
+
+ var composites = array(document.cloudCompositeForm.composites);
+ for (var i = 0; i < composites.length; i++) {
+ if (composites[i].checked) {
+ composites[i].checked = false;
+ }
+ }
+ }
+
+ function stopNode() {
+ var composites = array(document.cloudCompositeForm.composites);
+ for (var i = 0; i < composites.length; i++) {
+ if (composites[i].checked) {
+ var id = nodeNames[i];
+ processCollection.del(id, stopNodeResponse);
+ }
+ }
+ }
+
+ function stopNodeResponse() {
+ processCollection.get("", getProcessesResponse);
+
+ var composites = array(document.cloudCompositeForm.composites);
+ for (var i = 0; i < composites.length; i++) {
+ if (composites[i].checked) {
+ composites[i].checked = false;
+ }
+ }
+ }
+
+ var deployedComposites = new Array();
+
+ function getComposites() {
+ domainComposite.get("", getCompositesResponse);
+ }
+
+ function getCompositesResponse(feed) {
+ if (feed != null) {
+ var entries = feed.getElementsByTagName("entry");
+ for (var i=0; i<entries.length; i++) {
+ var id = entries[i].getElementsByTagName("id")[0].firstChild.nodeValue;
+ deployedComposites[id] = id;
+ }
+ }
+ }
+
+ function suggestCompositeNamespaces() {
+ var namespaces = new Array();
+ for (var uri in deployedComposites) {
+ var qname = compositeName(uri);
+ var ns = qname.substring(0, qname.indexOf(';'));
+ namespaces[ns] = ns;
+ }
+ return array(namespaces);
+ }
+
+ function suggestCompositeNames() {
+ var inputns = document.newNodeForm.compositeNamespace.value;
+ var names = new Array();
+ for (var uri in deployedComposites) {
+ var qname = compositeName(uri);
+ var sc = qname.indexOf(';');
+ var ns = qname.substring(0, sc);
+ var name = qname.substring(sc + 1);
+ if (ns == inputns || inputns == "") {
+ names[name] = name;
+ }
+ }
+ return array(names);
+ }
+
+ function suggestContributionURIs() {
+ var inputns = document.newNodeForm.compositeNamespace.value;
+ var inputname = document.newNodeForm.compositeName.value;
+ var uris = new Array();
+ for (var uri in deployedComposites) {
+ var qname = compositeName(uri);
+ var sc = qname.indexOf(';');
+ var ns = qname.substring(0, sc);
+ var name = qname.substring(sc + 1);
+ if ((ns == inputns || inputns == "") && (name == inputname || inputname == "")) {
+ var curi = contributionURI(uri);
+ uris[curi] = curi;
+ }
+ }
+ return array(uris);
+ }
+
+ function init() {
+ toolbar();
+ getNodes();
+ getComposites();
+ suggest(document.newNodeForm.compositeNamespace, suggestCompositeNamespaces);
+ suggest(document.newNodeForm.compositeName, suggestCompositeNames);
+ suggest(document.newNodeForm.contributionURI, suggestContributionURIs);
+ }
+
+</script>
+
+<link rel="stylesheet" type="text/css" href="manager.css">
+</head>
+
+<body onload="init()">
+ <div id="toolbar"></div>
+
+ <div id="cloudComposite">
+ <br>
+ <span class=hd1>
+ SCA Domain<br><br>
+ Cloud</b>&nbsp;<a href="/cloud/"><img src="icons/feed-icon.png" border="0"></a>
+ </span>
+ <br><br>
+ Here is the list of SCA nodes configured in your SCA domain cloud.
+ <br><br>
+
+ <form name="cloudCompositeForm">
+ <div id="composites" ></div>
+ <br>
+ <input type="button" onClick="startNode()" value="Start" />
+ <input type="button" onClick="stopNode()" value="Stop" />
+ &nbsp;&nbsp;
+ <input type="button" onClick="deleteNode()" value="Delete" />
+ </form>
+
+ <br><br>
+
+ <form name="newNodeForm">
+ <table width="100%">
+ <tr><th>Add a Node</th></tr>
+ <tr><td>Add a node to the cloud. The node will run the SCA components declared in the specified composite.</td></tr>
+ </table>
+ <br>
+ <table>
+ <tr><td>Node name:</td><td><input type="text" name="nodeName" size="50"/></td><td>e.g. YourNode</td></tr>
+ <tr><td>Node URI:</td><td><input type="text" name="nodeURI" size="50"/></td></td><td>e.g. http://yourhost:8080</td></tr>
+ <tr><td>Composite namespace:</td><td><input type="text" name="compositeNamespace" size="50"/></td></td><td>e.g. http://your/namespace</td></tr>
+ <tr><td>Composite name:</td><td><input type="text" name="compositeName" size="50"/></td></td><td>e.g. yourcomposite</td></tr>
+ <tr><td>Contribution URI:</td><td><input type="text" name="contributionURI" size="50"/></td></td><td>e.g. yourcontrib, http://yourcontrib</td></tr>
+ </table>
+ <input type="button" onClick="addNode()" value="Add" />
+ </form>
+
+ </div>
+</body>
+
+</html>
diff --git a/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/composite.html b/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/composite.html
new file mode 100644
index 0000000000..9a873d42d2
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/composite.html
@@ -0,0 +1,257 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<html>
+<head>
+<title>SCA Domain - Domain Composite</title>
+
+<script type="text/javascript" src="composite.js"></script>
+<script type="text/javascript" src="utils.js"></script>
+
+<script language="JavaScript">
+
+ //@Reference
+ var domainComposite = new Reference("domainComposite");
+
+ //@Reference
+ var workspace = new Reference("workspace");
+
+ function getComposites() {
+ domainComposite.get("", getCompositesResponse);
+ }
+
+ function contributionURI(id) {
+ var i = id.indexOf(';');
+ return id.substring(10, i);
+ }
+
+ function compositeName(id) {
+ var i = id.indexOf(';');
+ return id.substring(i + 1);
+ }
+
+ function getCompositesResponse(feed) {
+ if (feed != null) {
+ var entries = feed.getElementsByTagName("entry");
+ var composites = "";
+ composites += '<table width="100%">';
+ composites += '<tr><th>Composite</th>' +
+ '<th>Contribution</th>' +
+ '<th>Components</th>' +
+ '</tr>';
+ //'<th>Composite Configuration</th>' +
+
+ for (var i=0; i<entries.length; i++) {
+ var id = entries[i].getElementsByTagName("id")[0].firstChild.nodeValue;
+ var link = entries[i].getElementsByTagName("link")[0].getAttribute("href");
+ var uri = contributionURI(id);
+ var qname = compositeName(id);
+
+ var content = "";
+ if (entries[i].getElementsByTagName("content")[0].firstChild != null) {
+ content = entries[i].getElementsByTagName("content")[0].firstChild.nodeValue;
+ }
+ var components = '';
+ var bs = content.indexOf('<span id="components">');
+ if (bs != -1) {
+ var es = content.indexOf('</span>', bs);
+ components = content.substring(bs, es + 7);
+ } else {
+ bs = content.indexOf('<span id="problem"');
+ if (bs != -1) {
+ var es = content.indexOf('</span>', bs);
+ components = content.substring(bs, es + 7);
+ }
+ }
+
+ composites += '<tr>'
+ composites += '<td><input name="composites" type="checkbox" value="' + id + '">';
+ composites += '<a href=\"' + link + '\">' + qname + '</a></td>';
+ composites += '<td><a href="/contribution/' + uri + '">' + uri + '</a></td>';
+ composites += '<td class=tdw>' + components + '</td>';
+ //composites += '<td><a href="/composite-config/?composite=' + id + '"><img src="icons/feed-icon.png" border="0"></a></td>';
+ composites += '</tr>';
+ }
+ composites += '</table>';
+ document.getElementById("composites").innerHTML = composites;
+ }
+ }
+
+ function deleteComposite() {
+ var composites = array(document.domainCompositeForm.composites);
+ for (var i = 0; i < composites.length; i++) {
+ if (composites[i].checked) {
+ var id = composites[i].value;
+ domainComposite.del(id, deleteCompositeResponse);
+ }
+ }
+ }
+
+ function deleteCompositeResponse() {
+ getComposites();
+ }
+
+ function addComposite() {
+ var id = 'composite:' +
+ document.newCompositeForm.contributionURI.value + ';' +
+ document.newCompositeForm.compositeNamespace.value + ';' +
+ document.newCompositeForm.compositeName.value;
+ var entry = '<entry xmlns="http://www.w3.org/2005/Atom">' +
+ '<title>' + id +'</title>' +
+ '<id>' + id + '</id>' +
+ '</entry>';
+ domainComposite.post(entry, addCompositeResponse);
+ }
+
+ function addCompositeResponse() {
+ document.newCompositeForm.compositeNamespace.value = "";
+ document.newCompositeForm.compositeName.value = "";
+ document.newCompositeForm.contributionURI.value = "";
+ getComposites();
+ }
+
+ var contributedComposites = new Array();
+
+ function getContributions() {
+ workspace.get("", getContributionsResponse);
+ }
+
+ function getContributionsResponse(feed) {
+ if (feed != null) {
+ contributedComposites = new Array();
+ var entries = feed.getElementsByTagName("entry");
+ for (var i=0; i<entries.length; i++) {
+ if (entries[i].getElementsByTagName("content")[0].firstChild != null) {
+ var content = entries[i].getElementsByTagName("content")[0].firstChild.nodeValue;
+ var bs = content.indexOf('<span id="deployables">');
+ if (bs != -1) {
+ var es = content.indexOf('</span>', bs);
+ content = content.substring(bs, es + 7);
+ for (;;) {
+ var bc = content.indexOf('composite:');
+ if (bc == -1) {
+ break;
+ }
+ var ec = content.indexOf('">', bc);
+ if (ec == -1) {
+ break;
+ }
+ var uri = content.substring(bc, ec);
+ contributedComposites[uri] = uri;
+ content = content.substring(ec +1);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ function suggestCompositeNamespaces() {
+ var namespaces = new Array();
+ for (var uri in contributedComposites) {
+ var qname = compositeName(uri);
+ var ns = qname.substring(0, qname.indexOf(';'));
+ namespaces[ns] = ns;
+ }
+ return array(namespaces);
+ }
+
+ function suggestCompositeNames() {
+ var inputns = document.newCompositeForm.compositeNamespace.value;
+ var names = new Array();
+ for (var uri in contributedComposites) {
+ var qname = compositeName(uri);
+ var sc = qname.indexOf(';');
+ var ns = qname.substring(0, sc);
+ var name = qname.substring(sc + 1);
+ if (ns == inputns || inputns == "") {
+ names[name] = name;
+ }
+ }
+ return array(names);
+ }
+
+ function suggestContributionURIs() {
+ var inputns = document.newCompositeForm.compositeNamespace.value;
+ var inputname = document.newCompositeForm.compositeName.value;
+ var uris = new Array();
+ for (var uri in contributedComposites) {
+ var qname = compositeName(uri);
+ var sc = qname.indexOf(';');
+ var ns = qname.substring(0, sc);
+ var name = qname.substring(sc + 1);
+ if ((ns == inputns || inputns == "") && (name == inputname || inputname == "")) {
+ var curi = contributionURI(uri);
+ uris[curi] = curi;
+ }
+ }
+ return array(uris);
+ }
+
+ function init() {
+ toolbar();
+ getComposites();
+ getContributions();
+ suggest(document.newCompositeForm.compositeNamespace, suggestCompositeNamespaces);
+ suggest(document.newCompositeForm.compositeName, suggestCompositeNames);
+ suggest(document.newCompositeForm.contributionURI, suggestContributionURIs);
+ }
+
+</script>
+
+<link rel="stylesheet" type="text/css" href="manager.css">
+</head>
+
+<body onload="init()">
+ <div id="toolbar"></div>
+
+ <div id="domainComposite">
+ <br>
+ <span class=hd1>
+ SCA Domain<br><br>
+ Domain Composite&nbsp;<a href="/composite/"><img src="icons/feed-icon.png" border="0"></a>
+ </span>
+ <br><br>
+ Here is the list of SCA composites currently included as top-level composites in your SCA domain.
+ <br><br>
+
+ <form name="domainCompositeForm">
+ <div id="composites" ></div>
+ <br>
+ <input type="button" onClick="deleteComposite()" value="Delete" />
+ </form>
+
+ <br><br>
+
+ <form name="newCompositeForm">
+ <table width="100%">
+ <tr><th>Add Composite</th></tr>
+ <tr><td>Add an SCA composite describing your SCA service components.</td></tr>
+ </table>
+ <br>
+ <table>
+ <tr><td>Composite namespace:</td><td><input type="text" name="compositeNamespace" size="50"/></td><td>e.g. http://your/namespace</td></tr>
+ <tr><td>Composite name:</td><td><input type="text" name="compositeName" size="50"/></td><td>e.g. yourcomposite</td></tr>
+ <tr><td>Contribution URI:</td><td><input type="text" name="contributionURI" size="50"/></td><td>e.g. yourcontrib, http://yourcontrib</td></tr>
+ </table>
+ <input type="button" onClick="addComposite()" value="Add" />
+ </form>
+
+ </div>
+</body>
+</html>
diff --git a/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/files.html b/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/files.html
new file mode 100644
index 0000000000..1a7460df11
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/files.html
@@ -0,0 +1,114 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<html>
+<head>
+<title>SCA Domain - Contribution File Server</title>
+
+<script type="text/javascript" src="files.js"></script>
+<script type="text/javascript" src="utils.js"></script>
+
+<script language="JavaScript">
+
+ //@Reference
+ var files = new Reference("files");
+
+ function getFiles() {
+ files.get("", getFilesResponse);
+ }
+
+ function getFilesResponse(feed) {
+ if (feed != null) {
+ var entries = feed.getElementsByTagName("entry");
+ var list = '<table width="100%"><tr><th>Files</th></tr>';
+ for (var i=0; i<entries.length; i++) {
+ var id = entries[i].getElementsByTagName("id")[0].firstChild.nodeValue;
+ var location = entries[i].getElementsByTagName("link")[0].getAttribute("href");
+ list += '<tr><td><input name="files" type="checkbox" value="' + id + '">' +
+ '<a href=\"' + location + '\">' + id + '</a></td></tr>';
+ }
+ list += "</table>";
+ document.getElementById("files").innerHTML = list;
+ }
+ }
+
+ function deleteFile() {
+ var list = array(document.filesForm.files);
+ for (var i=0; i < list.length; i++) {
+ if (list[i].checked) {
+ var id = list[i].value;
+ files.del(id, deleteFileResponse);
+ }
+ }
+ }
+
+ function deleteFileResponse() {
+ getFiles();
+ }
+
+ function uploadFile() {
+ document.uploadFileForm.submit();
+ }
+
+ function init() {
+ toolbar();
+ getFiles();
+ }
+
+</script>
+
+<link rel="stylesheet" type="text/css" href="manager.css">
+</head>
+
+<body onload="init()">
+ <div id="toolbar"></div>
+
+ <div id="fileServer">
+ <br>
+ <span class=hd1>
+ SCA Domain<br><br>
+ File Server&nbsp;<a href="/feed/files/"><img src="icons/feed-icon.png" border="0"></a>
+ </span>
+ <br><br>
+ This is a simple ATOM-based file server useful to share files if you don't have an FTP, SVN or Maven repository.
+ <br><br>
+
+ <form name="filesForm">
+ <div id="files" ></div>
+ <br/>
+ <input type="button" onClick="deleteFile()" value="Delete" />
+ </form>
+
+ <br><br>
+
+ <form method="post" name="uploadFileForm" enctype='multipart/form-data' action='/files'>
+ <table width="100%">
+ <tr><th>Upload File</th></tr>
+ <tr><td>Upload a file to the server.</td></tr>
+ </table>
+ <br>
+ <table border="0">
+ <tr><td>File:</td><td><input type="file" name="file" size="50"/></td></tr>
+ </table>
+ <br/>
+ <input type="button" onClick="uploadFile()" value="Upload" />
+ </form>
+
+ </div>
+</body>
+</html>
diff --git a/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/home.html b/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/home.html
new file mode 100644
index 0000000000..88f190336d
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/home.html
@@ -0,0 +1,59 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<html>
+<head>
+<title>SCA Domain - Home</title>
+
+<script type="text/javascript" src="home.js"></script>
+<script type="text/javascript" src="utils.js"></script>
+
+<script language="JavaScript">
+
+ function init() {
+ toolbar();
+ }
+
+
+</script>
+
+<link rel="stylesheet" type="text/css" href="manager.css">
+</head>
+
+<body onload="init()">
+ <div id="toolbar"></div>
+
+ <br>
+ <span class=hd1>
+ SCA Domain
+ </span>
+
+ <br><br><br><br><br>
+
+ <form>
+ <table border="0" align="center">
+ <tr><td valign="top"><span style="font-size:150%; color: blue">Search:</span></td><td><input type="text" name="search" size="50"/></td></tr>
+ <tr><td></td><td align="center"><input type="button" name="search" value="Search" /></td></tr>
+ </table>
+ </form>
+
+ <br><br><br><br><br><br><br>
+ <center>This page is under construction, searching the domain is not implemented yet.</center>
+
+</body>
+</html>
diff --git a/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/icons/feed-icon.png b/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/icons/feed-icon.png
new file mode 100644
index 0000000000..a59728b2ad
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/icons/feed-icon.png
Binary files differ
diff --git a/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/manager.css b/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/manager.css
new file mode 100644
index 0000000000..5f4166876d
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/manager.css
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+body {
+ white-space: nowrap
+}
+
+table {
+ border: 1px; border-collapse: separate
+}
+
+th {
+ font-weight: bold; white-space: nowrap; background-color: #e5ecf9; color: #598edd;
+ text-align: left; padding-left: 2px; padding-right: 20px; padding-top: 2px; padding-bottom: 2px; vertical-align: text-top;
+ border-top: 1px; border-bottom: 1px; border-left: 0px; border-right: 0px;
+ border-style: solid; border-top-color: #a2bae7; border-bottom-color: #d1d3d4
+}
+
+td {
+ padding-left: 2px; padding-top: 2px; padding-right: 20px; white-space: nowrap; vertical-align: text-top
+}
+
+input {
+ vertical-align: middle
+}
+
+a:link {
+ color: blue
+}
+
+a:visited {
+ color: blue
+}
+
+.tdw {
+ padding-left: 2px; padding-top: 2px; padding-right: 20px; white-space: normal; vertical-align: text-top
+}
+
+.hd1 {
+ font-size:150%; font-weight: bold
+}
+
+.tbar {
+ margin: 0px;
+ padding-top: 0px; padding-left: 0px; padding-right: 0px; padding-bottom: 3px;
+ border-bottom: 1px solid #a2bae7
+}
+
+.ltbar {
+ padding-left: 0px; padding-top: 0px; padding-right: 20px; white-space: nowrap; vertical-align: top
+}
+
+.rtbar {
+ padding-left: 0px; padding-right: 0px; padding-top: 0px; white-space: nowrap; vertical-align: top;
+ text-align: right
+}
+
+.suggest {
+ background-color: #e5ecf9; color: #598edd;
+ border-top: 1px; border-bottom: 1px; border-left: 1px; border-right: 1px;
+ border-style: solid; border-top-color: #a2bae7; border-bottom-color: #d1d3d4;
+ border-left-color: #d1d3d4; border-right-color: #d1d3d4;
+ position: absolute;
+ overflow: auto; overflow-x: hidden;
+ cursor: default;
+ padding: 0px; margin: 0px;
+}
+
+suggestTable {
+ border: 0px; border-collapse: separate;
+ padding-left: 5px; padding-right: 5px; padding-top: 2px; padding-bottom: 2px;
+ margin: 0px;
+}
+
+.suggestItem {
+ padding-left: 2px; padding-top: 0px; padding-bottom: 0px; padding-right: 2px; white-space: nowrap; vertical-align: text-top;
+ background-color: #e5ecf9; color: #598edd;
+}
+
+.suggestHilighted {
+ padding-left: 2px; padding-top: 0px; padding-bottom: 0px; padding-right: 2px; white-space: nowrap; vertical-align: text-top;
+ background-color: #598edd; color: #e5ecf9;
+}
diff --git a/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/utils.js b/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/utils.js
new file mode 100644
index 0000000000..32fbdb47ad
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/utils.js
@@ -0,0 +1,197 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Autocomplete / suggest support for input fields
+ *
+ * To use it declare a 'suggest' function as follows:
+ * function suggestItems() {
+ * return new Array('abc', 'def', 'ghi');
+ * }
+ *
+ * then hook it to an input field as follows:
+ * suggest(document.yourForm.yourInputField, suggestItems);
+ */
+function selectSuggestion(node, value) {
+ for (;;) {
+ node = node.parentNode;
+ if (node.tagName.toLowerCase() == 'div') {
+ break;
+ }
+ }
+ node.selectSuggestion(value);
+}
+
+function hilightSuggestion(node, over) {
+ if (over) {
+ node.className = 'suggestHilighted';
+ } else {
+ node.className = 'suggestItem';
+ }
+}
+
+function suggest(input, suggestFunction) {
+
+ input.suggest = suggestFunction;
+
+ input.selectSuggestion = function(value) {
+ this.hideSuggestDiv();
+ this.value = value;
+ }
+
+ input.hideSuggestDiv = function() {
+ if (this.suggestDiv != null) {
+ this.suggestDiv.style.visibility = 'hidden';
+ }
+ }
+
+ input.showSuggestDiv = function() {
+ if (this.suggestDiv == null) {
+ this.suggestDiv = document.createElement('div');
+ this.suggestDiv.input = this;
+ this.suggestDiv.className = 'suggest';
+ input.parentNode.insertBefore(this.suggestDiv, input);
+ this.suggestDiv.style.visibility = 'hidden';
+ this.suggestDiv.style.zIndex = '99';
+
+ this.suggestDiv.selectSuggestion = function(value) {
+ this.input.selectSuggestion(value);
+ }
+ }
+
+ var values = this.suggest();
+ var items = "";
+ for (var i = 0; i < values.length; i++) {
+ if (values[i].indexOf(this.value) == -1) {
+ continue;
+ }
+ if (items.length == 0) {
+ items += '<table class=suggestTable>';
+ }
+ items += '<tr><td class="suggestItem" ' +
+ 'onmouseover="hilightSuggestion(this, true)" onmouseout="hilightSuggestion(this, false)" ' +
+ 'onclick="selectSuggestion(this, \'' + values[i] + '\')">' + values[i] + '</td></tr>';
+ }
+ if (items.length != 0) {
+ items += '</table>';
+ }
+ this.suggestDiv.innerHTML = items;
+
+ if (items.length != 0) {
+ var node = input;
+ var left = 0;
+ var top = 0;
+ for (;;) {
+ left += node.offsetLeft;
+ top += node.offsetTop;
+ node = node.offsetParent;
+ if (node.tagName.toLowerCase() == 'body') {
+ break;
+ }
+ }
+ this.suggestDiv.style.left = left;
+ this.suggestDiv.style.top = top + input.offsetHeight;
+ this.suggestDiv.style.visibility = 'visible';
+ } else {
+ this.suggestDiv.style.visibility = 'hidden';
+ }
+ }
+
+ input.onkeydown = function(event) {
+ this.showSuggestDiv();
+ };
+
+ input.onkeyup = function(event) {
+ this.showSuggestDiv();
+ };
+
+ input.onmousedown = function(event) {
+ this.showSuggestDiv();
+ };
+
+ input.onblur = function(event) {
+ setTimeout(function() { input.hideSuggestDiv(); }, 50);
+ };
+}
+
+/**
+ * A Toolbar class
+ */
+function Tool(name, href) {
+ this.name = name;
+ this.href = href;
+}
+
+Tool.prototype.print = function() {
+ var loc = '' + location;
+ if (loc.match(this.href) == null) {
+ return '<a href="' + this.href + '">' + this.name + '</a>';
+ } else {
+ return '<span>' + this.name + '</span>';
+ }
+}
+
+/**
+ * Initialize the toolbar
+ */
+function toolbar() {
+ var toolbar = '<table width="100%" cellpadding="0" cellspacing="0" class=tbar><tr>' +
+ '<td class=ltbar><table border="0" cellspacing="0" cellpadding="0"><tr>';
+
+ for (var i = 0; i < tools.length; i++) {
+ toolbar = toolbar + '<td class=ltbar>' +tools[i].print() + '</td>'
+ }
+
+ toolbar = toolbar + '</tr></table></td>' +
+ '<td class=rtbar><table border="0" cellpadding="0" cellspacing="0" align="right"><tr>' +
+ '<td class=rtbar>' + home.print() + '</td></tr></table></td>' +
+ '</tr></table>';
+
+ document.getElementById('toolbar').innerHTML = toolbar;
+}
+
+/**
+ * Utility function returning an non-sparse array from an array or an object.
+ */
+function array(obj) {
+ if (obj.length == undefined) {
+ var a = new Array();
+ a[0] = obj;
+ return a;
+ }
+ else {
+ var a = new Array();
+ var n = 0;
+ for (var i in obj) {
+ a[n++] = obj[i];
+ }
+ return a;
+ }
+}
+
+/**
+ * Populate the default toolbar
+ */
+var tools = new Array();
+tools[0] = new Tool("Contributions", "/ui/workspace");
+tools[1] = new Tool("Composites", "/ui/composite");
+tools[2] = new Tool("Cloud", "/ui/cloud");
+tools[3] = new Tool("Files", "/ui/files");
+
+var home = new Tool("Home", "/ui/home");
diff --git a/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/workspace.html b/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/workspace.html
new file mode 100644
index 0000000000..db3b4ac560
--- /dev/null
+++ b/sandbox/sebastien/java/sca-node/modules/domain-manager/src/main/resources/workspace.html
@@ -0,0 +1,206 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<html>
+<head>
+<title>SCA Domain - Contributions</title>
+
+<script type="text/javascript" src="workspace.js"></script>
+<script type="text/javascript" src="utils.js"></script>
+
+<script language="JavaScript">
+
+ //@Reference
+ var workspace = new Reference("workspace");
+
+ function getContributions() {
+ workspace.get("", getContributionsResponse);
+ }
+
+ function getContributionsResponse(feed) {
+ if (feed != null) {
+ var entries = feed.getElementsByTagName("entry");
+ var contributions = "";
+ contributions += '<table width="100%">';
+ contributions += '<tr><th>Contribution</th><th>Dependencies</td><th>Deployable Composites</th></tr>';
+ for (var i=0; i<entries.length; i++) {
+ var id = entries[i].getElementsByTagName("id")[0].firstChild.nodeValue;
+ var location = entries[i].getElementsByTagName("link")[0].getAttribute("href");
+ var content = '';
+ if (entries[i].getElementsByTagName("content")[0].firstChild != null) {
+ content = entries[i].getElementsByTagName("content")[0].firstChild.nodeValue;
+ }
+
+ contributions += '<tr>';
+ contributions += '<td><input name="contributions" type="checkbox" value="' + id + '">' +
+ '<a href=\"' + location + '\">' + id + '</a></td>';
+
+ var dependencies = '';
+ var bs = content.indexOf('<span id="dependencies">');
+ if (bs != -1) {
+ var es = content.indexOf('</span>', bs);
+ dependencies = content.substring(bs, es + 7);
+ }
+
+ var deployables = '';
+ var bs = content.indexOf('<span id="deployables">');
+ if (bs != -1) {
+ var es = content.indexOf('</span>', bs);
+ deployables = content.substring(bs, es + 7);
+ }
+
+ var problems = "";
+ var bs = content.indexOf('<span id="problems" ');
+ if (bs != -1) {
+ var es = content.indexOf('</span>', bs);
+ if (dependencies.length != 0) {
+ problems = '<br>';
+ }
+ problems += content.substring(bs, es + 7);
+ }
+
+ contributions += '<td class=tdw>' + dependencies + problems + ' </td>';
+ contributions += '<td class=tdw>' + deployables + '</td>';
+ contributions += '</tr>';
+ }
+ contributions += '</table>';
+ document.getElementById("contributions").innerHTML = contributions;
+ }
+ }
+
+ var suggestedContributions = new Array();
+
+ function getSuggestedContributions() {
+ workspace.get("?suggestions=true", getSuggestedContributionsResponse);
+ }
+
+ function getSuggestedContributionsResponse(feed) {
+ suggestedContributions = new Array();
+ if (feed != null) {
+ var entries = feed.getElementsByTagName("entry");
+ for (var i=0; i<entries.length; i++) {
+ var id = entries[i].getElementsByTagName("id")[0].firstChild.nodeValue;
+ var location = entries[i].getElementsByTagName("link")[1].getAttribute("href");
+ suggestedContributions[i] = id + ':' + location;
+ }
+ }
+ }
+
+ function deleteContribution() {
+ var contributions = array(document.workspaceForm.contributions);
+ for (var i=0; i < contributions.length; i++) {
+ if (contributions[i].checked) {
+ var id = contributions[i].value;
+ workspace.del(id, deleteContributionResponse);
+ }
+ }
+ }
+
+ function deleteContributionResponse() {
+ getContributions();
+ }
+
+ function addContribution() {
+ var id = document.newContributionForm.contributionID.value;
+ var location = document.newContributionForm.contributionLocation.value;
+ var entry = '<entry xmlns="http://www.w3.org/2005/Atom">' +
+ '<title>Contribution - ' + id +'</title>' +
+ '<id>' + id + '</id>' +
+ '<link href="' + location + '" />' +
+ '</entry>';
+ workspace.post(entry, addContributionResponse);
+ }
+
+ function addContributionResponse() {
+ document.newContributionForm.contributionID.value = "";
+ document.newContributionForm.contributionLocation.value = "";
+ getContributions();
+ }
+
+ function suggestContributionIDs() {
+ var ids = new Array();
+ for (var i=0; i<suggestedContributions.length; i++) {
+ var uri = suggestedContributions[i];
+ var id = uri.substring(0, uri.indexOf(':'));
+ ids[id] = id;
+ }
+ return array(ids);
+ }
+
+ function suggestContributionLocations() {
+ var locations = new Array();
+ for (var i=0; i<suggestedContributions.length; i++) {
+ var uri = suggestedContributions[i];
+ var id = uri.substring(0, uri.indexOf(':'));
+ if (id == document.newContributionForm.contributionID.value) {
+ var location = uri.substring(uri.indexOf(':') +1);
+ locations[location] = location;
+ }
+ }
+ return array(locations);
+ }
+
+ function init() {
+ toolbar();
+ getContributions();
+ getSuggestedContributions();
+ suggest(document.newContributionForm.contributionID, suggestContributionIDs);
+ suggest(document.newContributionForm.contributionLocation, suggestContributionLocations);
+ }
+
+</script>
+
+<link rel="stylesheet" type="text/css" href="manager.css">
+</head>
+
+<body onload="init()">
+ <div id="toolbar"></div>
+
+ <div id="workspace">
+ <br>
+ <span class=hd1>
+ SCA Domain<br><br>
+ Contributions</b>&nbsp;<a href="/workspace/"><img src="icons/feed-icon.png" border="0"></a> </span>
+ <br><br>
+ Here is the list of SCA contributions currently available in your SCA domain.
+ <br><br>
+
+ <form name="workspaceForm">
+ <div id="contributions" ></div>
+ <br>
+ <input type="button" onClick="deleteContribution()" value="Delete" />
+ </form>
+
+ <br><br>
+
+ <form name="newContributionForm">
+ <table width="100%">
+ <tr><th>Add Contribution</th></tr>
+ <tr><td>Add an SCA contribution containing your application artifacts to the SCA domain.</td></tr>
+ </table>
+ <br>
+ <table>
+ <tr><td>Contribution URI:</td><td><input type="text" name="contributionID" size="50"/></td></td><td>e.g. yourcontrib, http://yourcontrib</td></tr>
+ <tr><td>Location:</td><td><input type="text" name="contributionLocation" size="50"/></td></td><td>e.g. http://host/yourjar.jar, file:/yourdir, file:/yourjar.jar</td></tr>
+ </table>
+ <input type="button" onClick="addContribution()" value="Add" />
+ </form>
+
+ </div>
+</body>
+</html>