diff options
Diffstat (limited to 'sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources')
15 files changed, 2092 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/DomainManager.composite b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/DomainManager.composite new file mode 100644 index 0000000000..ba57ea45d1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/DomainManager.composite @@ -0,0 +1,281 @@ +<?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="HomePage"> + <t:implementation.widget location="home.html"/> + <service name="Widget"> + <t:binding.http uri="http://localhost:9990/ui/home"/> + </service> + </component> + + <component name="HomeGadget"> + <t:implementation.widget location="home-gadget.html"/> + <service name="Widget"> + <t:binding.http uri="http://localhost:9990/ui/home-gadget"/> + </service> + </component> + + <component name="WorkspacePage"> + <t:implementation.widget location="workspace.html"/> + <service name="Widget"> + <t:binding.http uri="http://localhost:9990/ui/workspace"/> + </service> + </component> + + <component name="WorkspaceGadget"> + <t:implementation.widget location="workspace-gadget.html"/> + <service name="Widget"> + <t:binding.http uri="http://localhost:9990/ui/workspace-gadget"/> + </service> + <reference name="workspace" target="ContributionCollectionComponent/ItemCollection"> + <t:binding.atom/> + </reference> + </component> + + <component name="FilesPage"> + <t:implementation.widget location="files.html"/> + <service name="Widget"> + <t:binding.http uri="http://localhost:9990/ui/files"/> + </service> + </component> + + <component name="FilesGadget"> + <t:implementation.widget location="files-gadget.html"/> + <service name="Widget"> + <t:binding.http uri="http://localhost:9990/ui/files-gadget"/> + </service> + <reference name="files" target="FileCollectionComponent"> + <t:binding.atom/> + </reference> + </component> + + <component name="DomainCompositePage"> + <t:implementation.widget location="composite.html"/> + <service name="Widget"> + <t:binding.http uri="http://localhost:9990/ui/composite"/> + </service> + </component> + + <component name="DomainCompositeGadget"> + <t:implementation.widget location="composite-gadget.html"/> + <service name="Widget"> + <t:binding.http uri="http://localhost:9990/ui/composite-gadget"/> + </service> + <reference name="domainComposite" target="DomainCompositeCollectionComponent/ItemCollection"> + <t:binding.atom/> + </reference> + <reference name="workspace" target="ContributionCollectionComponent/ItemCollection"> + <t:binding.atom/> + </reference> + </component> + + <component name="CloudPage"> + <t:implementation.widget location="cloud.html"/> + <service name="Widget"> + <t:binding.http uri="http://localhost:9990/ui/cloud"/> + </service> + </component> + + <component name="CloudGadget"> + <t:implementation.widget location="cloud-gadget.html"/> + <service name="Widget"> + <t:binding.http uri="http://localhost:9990/ui/cloud-gadget"/> + </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.manager.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.manager.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/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/cloud-gadget.html b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/cloud-gadget.html new file mode 100644 index 0000000000..1936f9896c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/cloud-gadget.html @@ -0,0 +1,408 @@ +<!-- + * 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-gadget/cloud-gadget.js"></script> +<script type="text/javascript" src="utils.js"></script> + +<link rel="stylesheet" type="text/css" href="manager.css"> +</head> + +<body> + <div id="cloudComposite"> + + <form id="cloudCompositeForm"> + <div id="composites" ></div> + <br> + ><a href="" id="addNodeLink">Add</a> + <a href="" id="deleteNodeLink">Delete</a> + + <a href="" id="startNodeLink">Start</a> + <a href="" id="stopNodeLink">Stop</a> + </form> + + <div id="newNode" style="visibility: hidden;"> + <form id="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 id="addNodeButton" type="button" value="Add" /> + </form> + </div> + + </div> +</body> + +<script type="text/javascript"> + + //@Reference + var cloudComposite = new tuscany.sca.Reference("cloudComposite"); + + //@Reference + var domainComposite = new tuscany.sca.Reference("domainComposite"); + + //@Reference + var processCollection = new tuscany.sca.Reference("processCollection"); + + var gadget = gadget(window, document); + if (gadget.showStatus == null) { + gadget.showStatus = true; + } + if (gadget.showConfigurations == null) { + gadget.showConfigurations = true; + } + + var cloudCompositeForm = elementByID(gadget, 'cloudCompositeForm'); + var compositesElement = elementByID(gadget, 'composites'); + var newNodeElement = elementByID(gadget, 'newNode'); + var newNodeForm = elementByID(gadget, 'newNodeForm'); + + var nodeNames; + var deployedComposites = new Array(); + + 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); + } + + 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>'; + if (gadget.showStatus) { + composites += '<th>Status</th>'; + } + if (gadget.showComposites) { + composites += '<th>Composite</th>'; + } + if (gadget.showContributions) { + composites += '<th>Contribution</th>'; + } + if (gadget.showConfigurations) { + composites += '<th>Node Config</th>'; + } + composites += '</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>'; + if (gadget.showStatus) { + composites += '<td><span id="status_' + nodeName + '">unknown</span></td>'; + } + if (gadget.showComposites) { + composites += '<td>' + content + '</td>'; + } + if (gadget.showContributions) { + composites += '<td>' + uri + '</td>'; + } + } else { + composites += '<td><input name="composites" type="checkbox" value="' + nodeId + '">' + + '<a href=\"' + nodeLink + '\">' + nodeName + '</a></td>'; + if (gadget.showStatus) { + composites += '<td><span id="status_' + nodeName + '">unknown</span></td>'; + } + if (gadget.showComposites) { + composites += '<td><a href=\"' + compositeLink + '\">' + qname + '</a></td>'; + } + if (gadget.showContributions) { + composites += '<td><a href="/contribution/' + uri + '">' + uri + '</a></td>'; + } + } + if (gadget.showConfigurations) { + composites += '<td><a href="/node-config/' + nodeName + '"><img src="icons/feed-icon.png" border="0"></a></td>'; + } + composites += '</tr>'; + } + composites += '</table>'; + compositesElement.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'; + } + + if (gadget.showStatus) { + for (var i = 0; i < nodeNames.length; i++) { + var element = elementByID(gadget, '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(cloudCompositeForm.composites); + for (var i = 0; i < composites.length; i++) { + if (composites[i].checked) { + var id = composites[i].value; + cloudComposite.del(id, deleteNodeResponse); + } + } + return false; + } + + function deleteNodeResponse() { + getNodes(); + } + + function addNode() { + var nodeName = newNodeForm.nodeName.value; + var nodeURI = newNodeForm.nodeURI.value; + var compositeNamespace = newNodeForm.compositeNamespace.value; + var compositeName = newNodeForm.compositeName.value; + var contributionURI = 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() { + newNodeForm.nodeName.value = ""; + newNodeForm.nodeURI.value = ""; + newNodeForm.compositeNamespace.value = ""; + newNodeForm.compositeName.value = ""; + newNodeForm.contributionURI.value = ""; + getNodes(); + } + + function startNode() { + var composites = array(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); + } + } + return false; + } + + function startNodeResponse() { + processCollection.get("", getProcessesResponse); + + var composites = array(cloudCompositeForm.composites); + for (var i = 0; i < composites.length; i++) { + if (composites[i].checked) { + composites[i].checked = false; + } + } + } + + function stopNode() { + var composites = array(cloudCompositeForm.composites); + for (var i = 0; i < composites.length; i++) { + if (composites[i].checked) { + var id = nodeNames[i]; + processCollection.del(id, stopNodeResponse); + } + } + return false; + } + + function stopNodeResponse() { + processCollection.get("", getProcessesResponse); + + var composites = array(cloudCompositeForm.composites); + for (var i = 0; i < composites.length; i++) { + if (composites[i].checked) { + composites[i].checked = false; + } + } + } + + 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 = 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 = newNodeForm.compositeNamespace.value; + var inputname = 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 toggleNewNode() { + var visibility = newNodeElement.style.visibility; + if (visibility == 'hidden') { + newNodeElement.style.visibility = 'visible'; + } else { + newNodeElement.style.visibility = 'hidden'; + } + return false; + } + + elementByID(gadget, 'deleteNodeLink').onclick = deleteNode; + elementByID(gadget, 'addNodeLink').onclick = toggleNewNode; + elementByID(gadget, 'startNodeLink').onclick = startNode; + elementByID(gadget, 'stopNodeLink').onclick = stopNode; + elementByID(gadget, 'addNodeButton').onclick = addNode; + + getNodes(); + getComposites(); + suggest(newNodeForm.compositeNamespace, suggestCompositeNamespaces); + suggest(newNodeForm.compositeName, suggestCompositeNames); + suggest(newNodeForm.contributionURI, suggestContributionURIs); + +</script> +</html> diff --git a/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/cloud.html b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/cloud.html new file mode 100644 index 0000000000..d661d5d38b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/cloud.html @@ -0,0 +1,68 @@ +<!-- + * 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="utils.js"></script> + +<link rel="stylesheet" type="text/css" href="manager.css"> +</head> + +<body> + <div id="toolbarGadgetDiv"></div> + <br> + + <span class=hd1> + SCA Domain<br><br> + Cloud</b> <a href="/cloud/"><img src="icons/feed-icon.png" border="0"></a> + </span> + <br> + Here is the list of SCA nodes configured in your SCA domain cloud. + <br><br> + + <div id="cloudGadgetDiv"></div> + + <iframe id="toolbarGadget" src="toolbar-gadget.html"></iframe> + <iframe id="cloudGadget" src="cloud-gadget.html"></iframe> +</body> + +<script type="text/javascript"> + var toolbarGadgetDiv = elementByID(document, 'toolbarGadgetDiv'); + var cloudGadgetDiv = elementByID(document, 'cloudGadgetDiv'); + + var toolbarGadget = elementByID(document, 'toolbarGadget'); + var cloudGadget = elementByID(document, 'cloudGadget'); + + function ongadget(win, doc) { + if (doc == content(toolbarGadget)) { + toolbarGadgetDiv.innerHTML = doc.body.innerHTML; + return toolbarGadgetDiv; + } else if (doc == content(cloudGadget)) { + cloudGadgetDiv.innerHTML = doc.body.innerHTML; + cloudGadgetDiv.showStatus = true; + cloudGadgetDiv.showComposites = true; + cloudGadgetDiv.showContributions = true; + cloudGadgetDiv.showConfigurations = true; + return cloudGadgetDiv; + } + return document; + } +</script> +</html> diff --git a/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/composite-gadget.html b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/composite-gadget.html new file mode 100644 index 0000000000..ce1039d9e5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/composite-gadget.html @@ -0,0 +1,277 @@ +<!-- + * 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-gadget/composite-gadget.js"></script> +<script type="text/javascript" src="utils.js"></script> + +<link rel="stylesheet" type="text/css" href="manager.css"> +</head> + +<body> + <div id="domainComposite"> + + <form id="domainCompositeForm"> + <div id="composites" ></div> + <br> + ><a href="" id="addCompositeLink">Add</a> + <a href="" id="deleteCompositeLink">Delete</a> + </form> + + <div id="newComposite" style="visibility: hidden;"> + <form id="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 id="addCompositeButton" type="button" value="Add" /> + </form> + </div> + + </div> +</body> + +<script type="text/javascript"> + //@Reference + var domainComposite = new tuscany.sca.Reference("domainComposite"); + + //@Reference + var workspace = new tuscany.sca.Reference("workspace"); + + var gadget = gadget(window, document); + if (gadget.showContributions == null) { + gadget.showContributions = true; + } + + var domainCompositeForm = elementByID(gadget, 'domainCompositeForm'); + var compositesElement = elementByID(gadget, 'composites'); + var newCompositeElement = elementByID(gadget, 'newComposite'); + var newCompositeForm = elementByID(gadget, 'newCompositeForm'); + + var contributedComposites = new Array(); + + 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>'; + if (gadget.showContributions) { + composites += '<th>Contribution</th>'; + } + if (gadget.showComponents) { + composites += '<th>Components</th>'; + } + composites += '</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>'; + if (gadget.showContributions) { + composites += '<td><a href="/contribution/' + uri + '">' + uri + '</a></td>'; + } + if (gadget.showComponents) { + 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>'; + compositesElement.innerHTML = composites; + } + } + + function deleteComposite() { + var composites = array(domainCompositeForm.composites); + for (var i = 0; i < composites.length; i++) { + if (composites[i].checked) { + var id = composites[i].value; + domainComposite.del(id, deleteCompositeResponse); + } + } + return false; + } + + function deleteCompositeResponse() { + getComposites(); + } + + function addComposite() { + var id = 'composite:' + + newCompositeForm.contributionURI.value + ';' + + newCompositeForm.compositeNamespace.value + ';' + + 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() { + newCompositeForm.compositeNamespace.value = ""; + newCompositeForm.compositeName.value = ""; + newCompositeForm.contributionURI.value = ""; + getComposites(); + } + + 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 = 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 = newCompositeForm.compositeNamespace.value; + var inputname = 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 toggleNewComposite() { + var visibility = newCompositeElement.style.visibility; + if (visibility == 'hidden') { + newCompositeElement.style.visibility = 'visible'; + } else { + newCompositeElement.style.visibility = 'hidden'; + } + return false; + } + + elementByID(gadget, 'deleteCompositeLink').onclick = deleteComposite; + elementByID(gadget, 'addCompositeLink').onclick = toggleNewComposite; + elementByID(gadget, 'addCompositeButton').onclick = addComposite; + + getComposites(); + getContributions(); + suggest(newCompositeForm.compositeNamespace, suggestCompositeNamespaces); + suggest(newCompositeForm.compositeName, suggestCompositeNames); + suggest(newCompositeForm.contributionURI, suggestContributionURIs); + +</script> +</html> diff --git a/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/composite.html b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/composite.html new file mode 100644 index 0000000000..b0631e1d66 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/composite.html @@ -0,0 +1,66 @@ +<!-- + * 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="utils.js"></script> + +<link rel="stylesheet" type="text/css" href="manager.css"> +</head> + +<body> + <div id="toolbarGadgetDiv"></div> + <br> + + <span class=hd1> + SCA Domain<br><br> + Domain Composite <a href="/composite/"><img src="icons/feed-icon.png" border="0"></a> + </span> + <br> + Here is the list of SCA composites currently included as top-level composites in your SCA domain. + <br><br> + + <div id="compositeGadgetDiv"></div> + + <iframe id="toolbarGadget" src="toolbar-gadget.html"></iframe> + <iframe id="compositeGadget" src="composite-gadget.html"></iframe> +</body> + +<script type="text/javascript"> + var toolbarGadgetDiv = elementByID(document, 'toolbarGadgetDiv'); + var compositeGadgetDiv = elementByID(document, 'compositeGadgetDiv'); + + var toolbarGadget = elementByID(document, 'toolbarGadget'); + var compositeGadget = elementByID(document, 'compositeGadget'); + + function ongadget(win, doc) { + if (doc == content(toolbarGadget)) { + toolbarGadgetDiv.innerHTML = doc.body.innerHTML; + return toolbarGadgetDiv; + } else if (doc == content(compositeGadget)) { + compositeGadgetDiv.innerHTML = doc.body.innerHTML; + compositeGadgetDiv.showContributions = true; + compositeGadgetDiv.showComponents = true; + return compositeGadgetDiv; + } + return document; + } +</script> +</html> diff --git a/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/files-gadget.html b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/files-gadget.html new file mode 100644 index 0000000000..7ddc923223 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/files-gadget.html @@ -0,0 +1,124 @@ +<!-- + * 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-gadget/files-gadget.js"></script> +<script type="text/javascript" src="utils.js"></script> + +<link rel="stylesheet" type="text/css" href="manager.css"> +</head> + +<body> + <div id="fileServer"> + + <form id="filesForm"> + <div id="files" ></div> + <br> + ><a href="" id="uploadFileLink">Upload</a> + <a href="" id="deleteFileLink">Delete</a> + </form> + + <div id="uploadFile" style="visibility: hidden;"> + <form method="post" id="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 id="uploadFileButton" type="button" value="Upload" /> + </form> + </div> + + </div> +</body> + +<script type="text/javascript"> + //@Reference + var files = new tuscany.sca.Reference("files"); + + var gadget = gadget(window, document); + + var filesForm = elementByID(gadget, "filesForm"); + var filesElement = elementByID(gadget, 'files'); + var uploadFileElement = elementByID(gadget, 'uploadFile'); + var uploadFileForm = elementByID(gadget, 'uploadFileForm'); + + 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>"; + filesElement.innerHTML = list; + } + } + + function deleteFile() { + var list = array(filesForm.files); + for (var i=0; i < list.length; i++) { + if (list[i].checked) { + var id = list[i].value; + files.del(id, deleteFileResponse); + } + } + return false; + } + + function deleteFileResponse() { + getFiles(); + } + + function uploadFile() { + uploadFileForm.submit(); + return false; + } + + function toggleUploadFile() { + var visibility = uploadFileElement.style.visibility; + if (visibility == 'hidden') { + uploadFileElement.style.visibility = 'visible'; + } else { + uploadFileElement.style.visibility = 'hidden'; + } + return false; + } + + elementByID(gadget, 'deleteFileLink').onclick = deleteFile; + elementByID(gadget, 'uploadFileLink').onclick = toggleUploadFile; + elementByID(gadget, 'uploadFileButton').onclick = uploadFile; + + getFiles(); + +</script> +</html> diff --git a/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/files.html b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/files.html new file mode 100644 index 0000000000..37d89e7665 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/files.html @@ -0,0 +1,64 @@ +<!-- + * 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="utils.js"></script> + +<link rel="stylesheet" type="text/css" href="manager.css"> +</head> + +<body> + <div id="toolbarGadgetDiv"></div> + <br> + + <span class=hd1> + SCA Domain<br><br> + File Server <a href="/feed/files/"><img src="icons/feed-icon.png" border="0"></a> + </span> + <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> + + <div id="filesGadgetDiv"></div> + + <iframe id="toolbarGadget" src="toolbar-gadget.html"></iframe> + <iframe id="filesGadget" src="files-gadget.html"></iframe> +</body> + +<script type="text/javascript"> + var toolbarGadgetDiv = elementByID(document, 'toolbarGadgetDiv'); + var filesGadgetDiv = elementByID(document, 'filesGadgetDiv'); + + var toolbarGadget = elementByID(document, 'toolbarGadget'); + var filesGadget = elementByID(document, 'filesGadget'); + + function ongadget(win, doc) { + if (doc == content(toolbarGadget)) { + toolbarGadgetDiv.innerHTML = doc.body.innerHTML; + return toolbarGadgetDiv; + } else if (doc == content(filesGadget)) { + filesGadgetDiv.innerHTML = doc.body.innerHTML; + return filesGadgetDiv; + } + return document; + } +</script> +</html> diff --git a/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/home-gadget.html b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/home-gadget.html new file mode 100644 index 0000000000..05e262e4df --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/home-gadget.html @@ -0,0 +1,45 @@ +<!-- + * 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-gadget/home-gadget.js"></script> +<script type="text/javascript" src="utils.js"></script> + +<link rel="stylesheet" type="text/css" href="manager.css"> +</head> + +<body> + <div id="home"> + + <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> + + </div> +</body> + +<script type="text/javascript"> + var gadget = gadget(window, document); +</script> +</html> diff --git a/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/home.html b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/home.html new file mode 100644 index 0000000000..aad1856621 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/home.html @@ -0,0 +1,65 @@ +<!-- + * 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="utils.js"></script> + +<link rel="stylesheet" type="text/css" href="manager.css"> +</head> + +<body> + <div id="toolbarGadgetDiv"></div> + <br> + + <span class=hd1> + SCA Domain + </span> + <br><br><br><br><br><br> + + <div id="homeGadgetDiv"></div> + + <br><br><br><br><br><br><br> + <center>This page is under construction, searching the domain is not implemented yet.</center> + + <iframe id="toolbarGadget" src="toolbar-gadget.html" style="visibility: hidden;"></iframe> + <iframe id="homeGadget" src="home-gadget.html" style="visibility: hidden;"></iframe> +</body> + +<script type="text/javascript"> + var toolbarGadgetDiv = elementByID(document, 'toolbarGadgetDiv'); + var homeGadgetDiv = elementByID(document, 'homeGadgetDiv'); + + var toolbarGadget = elementByID(document, 'toolbarGadget'); + var homeGadget = elementByID(document, 'homeGadget'); + + function ongadget(win, doc) { + if (doc == content(toolbarGadget)) { + toolbarGadgetDiv.innerHTML = doc.body.innerHTML; + return toolbarGadgetDiv; + } else if (doc == content(homeGadget)) { + homeGadgetDiv.innerHTML = doc.body.innerHTML; + return homeGadgetDiv; + } + return document; + } +</script> + +</html> diff --git a/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/icons/feed-icon.png b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/icons/feed-icon.png Binary files differnew file mode 100644 index 0000000000..a59728b2ad --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/icons/feed-icon.png diff --git a/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/manager.css b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/manager.css new file mode 100644 index 0000000000..e080ff1d87 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/manager.css @@ -0,0 +1,104 @@ +/* + * 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; margin: 2px; +} + +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 +} + +iframe { + visibility: hidden; +} + +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/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/toolbar-gadget.html b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/toolbar-gadget.html new file mode 100644 index 0000000000..c9389affc3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/toolbar-gadget.html @@ -0,0 +1,47 @@ +<!-- + * 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 - Toolbar</title> + +<script type="text/javascript" src="utils.js"></script> + +<link rel="stylesheet" type="text/css" href="manager.css"> +</head> + +<body> + <div id="toolbar"></div> +</body> + +<script type="text/javascript"> + var gadget = gadget(window, document); + + var tools = new Array(); + tools[0] = new Tool("Contributions", "../workspace"); + tools[1] = new Tool("Composites", "../composite"); + tools[2] = new Tool("Cloud", "../cloud"); + tools[3] = new Tool("Files", "../files"); + + var home = new Tool("Home", "../home"); + + var toolbarDiv = elementByID(gadget, 'toolbar'); + toolbarDiv.innerHTML = toolbar(home, tools); + +</script> +</html> diff --git a/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/utils.js b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/utils.js new file mode 100644 index 0000000000..77ed807e85 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/utils.js @@ -0,0 +1,246 @@ +/* + * 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)" ' + + 'onmousedown="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 + '" target="_parent">' + this.name + '</a>'; + } else { + return '<span>' + this.name + '</span>'; + } +} + +/** + * Initialize the toolbar + */ +function toolbar(home, tools) { + 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>'; + + return toolbar; +} + +/** + * Return 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; + } +} + +/** + * Dump a Javascript object to the console + */ +function dump(o) { + for (f in o) { + try { + console.log(f + '=' + o[f]); + } catch (e) {} + } +} + +/** + * Return the content document of the given window. + */ +function content(win) { + if (win.document != 'undefined' && win.document != null) { + return win.document; + } else if (win.contentDocument != 'undefined' && win.contentDocument != null) { + return win.contentDocument; + } else { + return null; + } +} + +/** + * Returns a child element with the given id. + */ +function elementByID(node, id) { + for (var i in node.childNodes) { + var child = node.childNodes[i]; + if (child.id == id) { + return child; + } else { + child = elementByID(child, id); + if (child != null) { + return child; + } + } + } + return null; +} + +/** + * Install a gadget. + */ +function gadget(win, doc) { + var ongadget = null; + try { + if (win.parent.ongadget != null && win.parent.ongadget != 'undefined') { + ongadget = win.parent.ongadget; + } + } catch (e) { + } + if (ongadget != null) { + return ongadget(win, doc); + } else { + return doc; + } +} diff --git a/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/workspace-gadget.html b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/workspace-gadget.html new file mode 100644 index 0000000000..3b8a32c940 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/workspace-gadget.html @@ -0,0 +1,232 @@ +<!-- + * 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-gadget/workspace-gadget.js"></script> +<script type="text/javascript" src="utils.js"></script> + +<link rel="stylesheet" type="text/css" href="manager.css"> +</head> + +<body> + <div id="workspace"> + + <form id="workspaceForm"> + <div id="contributions" ></div> + <br> + ><a href="" id="addContributionLink">Add</a> + <a href="" id="deleteContributionLink">Delete</a> + </form> + + <div id="newContribution" style="visibility: hidden;"> + <form id="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 id="addContributionButton" type="button" value="Add" /> + </form> + </div> + + </div> +</body> + +<script type="text/javascript"> + + //@Reference + var workspace = new tuscany.sca.Reference("workspace"); + + var gadget = gadget(window, document); + if (gadget.showDependencies == null) { + gadget.showDependencies = true; + } + + var workspaceForm = elementByID(gadget, 'workspaceForm'); + var contributionsElement = elementByID(gadget, 'contributions'); + var newContributionElement = elementByID(gadget, 'newContribution'); + var newContributionForm = elementByID(gadget, 'newContributionForm'); + + var suggestedContributions = new Array(); + + 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>'; + if (gadget.showDependencies) { + contributions += '<th>Dependencies</td>'; + } + if (gadget.showDeployables) { + contributions += '<th>Deployable Composites</th>'; + } + contributions += '</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); + } + + if (gadget.showDependencies) { + contributions += '<td class=tdw>' + dependencies + problems + ' </td>'; + } + if (gadget.showDeployables) { + contributions += '<td class=tdw>' + deployables + '</td>'; + } + contributions += '</tr>'; + } + contributions += '</table>'; + contributionsElement.innerHTML = contributions; + } + } + + 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(workspaceForm.contributions); + for (var i=0; i < contributions.length; i++) { + if (contributions[i].checked) { + var id = contributions[i].value; + alert("hey " + id); + workspace.del(id, deleteContributionResponse); + } + } + return false; + } + + function deleteContributionResponse() { + getContributions(); + } + + function addContribution() { + var id = newContributionForm.contributionID.value; + var location = 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() { + newContributionForm.contributionID.value = ""; + 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 == newContributionForm.contributionID.value) { + var location = uri.substring(uri.indexOf(':') +1); + locations[location] = location; + } + } + return array(locations); + } + + function toggleNewContribution() { + var visibility = newContributionElement.style.visibility; + if (visibility == 'hidden') { + newContributionElement.style.visibility = 'visible'; + } else { + newContributionElement.style.visibility = 'hidden'; + } + return false; + } + + elementByID(gadget, 'deleteContributionLink').onclick = deleteContribution; + elementByID(gadget, 'addContributionLink').onclick = toggleNewContribution; + elementByID(gadget, 'addContributionButton').onclick = addContribution; + + getContributions(); + getSuggestedContributions(); + suggest(newContributionForm.contributionID, suggestContributionIDs); + suggest(newContributionForm.contributionLocation, suggestContributionLocations); + +</script> +</html> diff --git a/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/workspace.html b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/workspace.html new file mode 100644 index 0000000000..36c02ab1e6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/modules/domain-manager/src/main/resources/workspace.html @@ -0,0 +1,65 @@ +<!-- + * 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="utils.js"></script> + +<link rel="stylesheet" type="text/css" href="manager.css"> +</head> + +<body> + <div id="toolbarGadgetDiv"></div> + <br> + + <span class=hd1> + SCA Domain<br><br> + Contributions</b> <a href="/workspace/"><img src="icons/feed-icon.png" border="0"></a> </span> + <br> + Here is the list of SCA contributions currently available in your SCA domain. + <br><br> + + <div id="workspaceGadgetDiv"></div> + + <iframe id="toolbarGadget" src="toolbar-gadget.html"></iframe> + <iframe id="workspaceGadget" src="workspace-gadget.html"></iframe> +</body> + +<script type="text/javascript"> + var toolbarGadgetDiv = elementByID(document, 'toolbarGadgetDiv'); + var workspaceGadgetDiv = elementByID(document, 'workspaceGadgetDiv'); + + var toolbarGadget = elementByID(document, 'toolbarGadget'); + var workspaceGadget = elementByID(document, 'workspaceGadget'); + + function ongadget(win, doc) { + if (doc == content(toolbarGadget)) { + toolbarGadgetDiv.innerHTML = doc.body.innerHTML; + return toolbarGadgetDiv; + } else if (doc == content(workspaceGadget)) { + workspaceGadgetDiv.innerHTML = doc.body.innerHTML; + workspaceGadgetDiv.showDependencies = true; + workspaceGadgetDiv.showDeployables = true; + return workspaceGadgetDiv; + } + return document; + } +</script> +</html> |