summaryrefslogtreecommitdiffstats
path: root/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF
diff options
context:
space:
mode:
Diffstat (limited to 'winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF')
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/.gitignore3
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/appengine-web.xml20
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/functions.tld153
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/jetty-web.xml7
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/about.tag65
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/addComponentInstance.tag147
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/colorwheel.tag36
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/componentinstance.tag163
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/componentinstancewithName.tag33
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/componentinstancewithNameDerivedFromAbstractFinal.tag45
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/constraints/constraint.tag83
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/entitytemplate.tag43
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/entitytype.tag49
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/entitytypes/nodetypes/reqandcapdefs/reqandcapdefs.tag334
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/genericpage.tag349
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/imageUpload.tag42
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/namespaceChooser.tag52
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/parameters/parametersHTML.tag38
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/parameters/parametersInput.tag20
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/parameters/parametersJS.tag177
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/parameters/parametersOutput.tag20
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/relationshiptype/validnodetypeendingsselect.tag43
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/servicetemplates/boundarydefinitions/browseForReqOrCap.tag161
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/servicetemplates/boundarydefinitions/browseForServiceTemplatePropertyReqOrCap.tag166
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/servicetemplates/boundarydefinitions/browseForX.tag49
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/simpleSingleFileUpload.tag114
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/submenu.tag26
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/topologyTemplateRenderer.tag208
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/typeswithshortnameasselect.tag46
-rw-r--r--winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/web.xml95
30 files changed, 2787 insertions, 0 deletions
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/.gitignore b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/.gitignore
new file mode 100644
index 0000000..3d88074
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/.gitignore
@@ -0,0 +1,3 @@
+#common-functions.tld is generated via mvn generate-sources
+#Its content is copied from org.eclipse.winery.topologymodeler
+common-functions.tld
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/appengine-web.xml b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/appengine-web.xml
new file mode 100644
index 0000000..c9883a3
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/appengine-web.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*******************************************************************************
+ * Copyright (c) 2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+-->
+<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
+ <application>opentosca-valesca</application>
+ <version>1</version>
+ <!-- we lie at this point, but we don't want to delay execution -->
+ <threadsafe>true</threadsafe>
+</appengine-web-app>
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/functions.tld b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/functions.tld
new file mode 100644
index 0000000..09921b2
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/functions.tld
@@ -0,0 +1,153 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+-->
+<taglib
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
+ version="2.1">
+
+ <tlib-version>1.0</tlib-version>
+ <short-name>Winery_Repository_Functions</short-name>
+ <uri>http://www.eclipse.org/winery/repository/functions</uri>
+
+ <function>
+ <name>URLencode</name>
+ <function-class>org.eclipse.winery.common.Util</function-class>
+ <function-signature>java.lang.String URLencode(java.lang.String)</function-signature>
+ </function>
+ <function>
+ <name>DoubleURLencode</name>
+ <function-class>org.eclipse.winery.common.Util</function-class>
+ <function-signature>java.lang.String DoubleURLencode(javax.xml.namespace.QName)</function-signature>
+ </function>
+ <function>
+ <name>absoluteURL</name>
+ <function-class> org.eclipse.winery.repository.Utils</function-class>
+ <function-signature>java.lang.String getAbsoluteURL(org.eclipse.winery.common.ids.GenericId)</function-signature>
+ </function>
+ <function>
+ <name>allNamespaces</name>
+ <function-class>org.eclipse.winery.repository.resources.admin.NamespacesResource</function-class>
+ <function-signature>java.util.Collection getNamespaces()</function-signature>
+ </function>
+ <function>
+ <name>allNodeTypeResources</name>
+ <function-class>org.eclipse.winery.repository.Utils</function-class>
+ <function-signature>java.util.Collection getAllNodeTypeResources()</function-signature>
+ </function>
+ <function>
+ <name>allRelationshipTypeResources</name>
+ <function-class>org.eclipse.winery.repository.Utils</function-class>
+ <function-signature>java.util.Collection getAllRelationshipTypeResources()</function-signature>
+ </function>
+ <function>
+ <name>determineIdUsingHashCode</name>
+ <function-class>org.eclipse.winery.repository.resources._support.collections.withoutid.IdDeterminationWithHashCode</function-class>
+ <function-signature>java.lang.String getIdStatically(java.lang.Object)</function-signature>
+ </function>
+ <function>
+ <name>isContainerLocallyAvailable</name>
+ <function-class>org.eclipse.winery.repository.Utils</function-class>
+ <function-signature>java.lang.Boolean isContainerLocallyAvailable()</function-signature>
+ </function>
+ <function>
+ <name>isRestDocDocumentationAvailable</name>
+ <function-class>org.eclipse.winery.repository.Utils</function-class>
+ <function-signature>java.lang.Boolean isRestDocDocumentationAvailable()</function-signature>
+ </function>
+ <function>
+ <name>namespace</name>
+ <function-class>org.eclipse.winery.common.ids.IdUtil</function-class>
+ <function-signature>org.eclipse.winery.common.ids.Namespace getNamespace(org.eclipse.winery.common.ids.GenericId)</function-signature>
+ </function>
+ <function>
+ <name>namespaceToJavaPackage</name>
+ <function-class>org.eclipse.winery.common.Util</function-class>
+ <function-signature>java.lang.String namespaceToJavaPackage(java.lang.String)</function-signature>
+ </function>
+ <function>
+ <name>artifactTypeQName2href</name>
+ <function-class>org.eclipse.winery.repository.Utils</function-class>
+ <function-signature>java.lang.String artifactTypeQName2href(javax.xml.namespace.QName)</function-signature>
+ </function>
+ <function>
+ <name>nodeTypeQName2href</name>
+ <function-class>org.eclipse.winery.repository.Utils</function-class>
+ <function-signature>java.lang.String nodeTypeQName2href(javax.xml.namespace.QName)</function-signature>
+ </function>
+ <function>
+ <name>policyTypeQName2href</name>
+ <function-class>org.eclipse.winery.repository.Utils</function-class>
+ <function-signature>java.lang.String policyTypeQName2href(javax.xml.namespace.QName)</function-signature>
+ </function>
+ <function>
+ <name>relationshipTypeQName2href</name>
+ <function-class>org.eclipse.winery.repository.Utils</function-class>
+ <function-signature>java.lang.String relationshipTypeQName2href(javax.xml.namespace.QName)</function-signature>
+ </function>
+ <function>
+ <name>getPrefix</name>
+ <function-class>org.eclipse.winery.repository.resources.admin.NamespacesResource</function-class>
+ <function-signature>java.lang.String getPrefix(java.lang.String)</function-signature>
+ </function>
+ <function>
+ <name>typeForTemplate</name>
+ <function-class>org.eclipse.winery.repository.Utils</function-class>
+ <function-signature>org.eclipse.winery.model.tosca.TEntityType getTypeForTemplate(org.eclipse.winery.model.tosca.TEntityTemplate)</function-signature>
+ </function>
+
+ <function>
+ <name>renderMaxInstances</name>
+ <function-class>org.eclipse.winery.common.Util</function-class>
+ <function-signature>java.lang.String renderMaxInstances(java.lang.String)</function-signature>
+ </function>
+ <function>
+ <name>renderMinInstances</name>
+ <function-class>org.eclipse.winery.common.Util</function-class>
+ <function-signature>java.lang.String renderMinInstances(java.lang.Integer)</function-signature>
+ </function>
+ <function>
+ <name>topologyModelerURI</name>
+ <function-class>org.eclipse.winery.repository.Utils</function-class>
+ <function-signature>java.lang.String getWineryTopologyModelerPath()</function-signature>
+ </function>
+ <function>
+ <name>allXSDElementDefinitionsForTypeAheadSelection</name>
+ <function-class>org.eclipse.winery.repository.Utils</function-class>
+ <function-signature>java.lang.String getAllXSDElementDefinitionsForTypeAheadSelection()</function-signature>
+ </function>
+ <function>
+ <name>allXSDTypeDefinitionsForTypeAheadSelection</name>
+ <function-class>org.eclipse.winery.repository.Utils</function-class>
+ <function-signature>java.lang.String getAllXSDTypeDefinitionsForTypeAheadSelection()</function-signature>
+ </function>
+
+ <function>
+ <name>doubleEscapeHTMLAndThenConvertNL2BR</name>
+ <function-class>org.eclipse.winery.repository.Utils</function-class>
+ <function-signature>java.lang.String doubleEscapeHTMLAndThenConvertNL2BR(java.lang.String)</function-signature>
+ </function>
+ <function>
+ <name>XML</name>
+ <function-class>org.eclipse.winery.repository.Utils</function-class>
+ <function-signature>java.lang.String getXMLAsString(java.lang.Object)</function-signature>
+ </function>
+
+ <function>
+ <name>randomUUID</name>
+ <function-class>java.util.UUID</function-class>
+ <function-signature>java.util.UUID randomUUID()</function-signature>
+ </function>
+</taglib>
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/jetty-web.xml b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/jetty-web.xml
new file mode 100644
index 0000000..a6d2944
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/jetty-web.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
+
+<Configure class="org.eclipse.jetty.webapp.WebAppContext">
+ <!-- max(int) (=2 GB) is the upload size -->
+ <Set name="maxFormContentSize">2147483640</Set>
+</Configure> \ No newline at end of file
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/about.tag b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/about.tag
new file mode 100644
index 0000000..351bd0f
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/about.tag
@@ -0,0 +1,65 @@
+<%--
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+--%>
+
+<%@tag description="About for the repository" pageEncoding="UTF-8"%>
+
+<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+<%@taglib prefix="t" tagdir="/WEB-INF/tags"%>
+<%@taglib prefix="w" uri="http://www.eclipse.org/winery/repository/functions"%>
+
+<div class="modal fade" id="about">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+ <h4 class="modal-title">Winery ${project.version}</h4>
+ </div>
+ <div class="modal-body">
+ <p> Supporting <a href="docs.oasis-open.org/tosca/TOSCA/v1.0/os/TOSCA-v1.0-os.html">TOSCA-v1.0 &ndash;
+ Topology and Orchestration Specification for Cloud Applications Version 1.0. 25 November 2013. OASIS Standard.</a><br/>
+ <br/>
+ Part of the <a href="http://www.cloudcycle.org">CloudCycle</a> ecosystem.<br/>
+ <br/>
+ Code contributions by Oliver Kopp, Tobias Binz, Uwe Breitenbücher, Kálmán Képes, Rene Trefft, Yves Schubert, Timur Sungur, Jerome Tagliaferri, and Tobias Unger.
+ </p>
+ <h3>License</h3>
+ <p>The Eclipse Foundation makes available all content of this software (&ldquo;Content&rdquo;).
+ Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 (&ldquo;EPL&rdquo;) and the and the Apache License 2.0.
+ A copy of the EPL is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ A copy of the ASL is available at <a href="http://www.apache.org/licenses/LICENSE-2.0.html">http://www.apache.org/licenses/LICENSE-2.0.html</a>.
+ For purposes of the EPL, &ldquo;Program&rdquo; will mean the Content.</p>
+ <p>If you did not receive this Content directly from the Eclipse Foundation, the Content is being redistributed by another party (&ldquo;Redistributor&rdquo;) and different terms and conditions may apply to your use of any object code in the Content.
+ Check the Redistributor's license that was provided with the Content.
+ If no such license exists, contact the Redistributor.
+ Unless otherwise indicated below, the terms and conditions of the EPL still apply to any source code in the Content and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+ </div>
+ <div class="modal-footer">
+ <c:if test="${w:isRestDocDocumentationAvailable()}">
+ <a class="btn btn-primary" target="_blank" href="/restdoc.html">Show documentation of REST API</a>
+ </c:if>
+ <button type="button" class="btn btn-primary" data-dismiss="modal" id="aboutDiagOKButton">Ok</button>
+ </div>
+ </div>
+ </div>
+</div>
+
+<script>
+$("#about").on("shown.bs.modal", function() {
+ $("#aboutDiagOKButton").focus();
+});
+
+function showAbout() {
+ $("#about").modal("show");
+}
+</script> \ No newline at end of file
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/addComponentInstance.tag b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/addComponentInstance.tag
new file mode 100644
index 0000000..a82901a
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/addComponentInstance.tag
@@ -0,0 +1,147 @@
+<%--
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+--%>
+<%@tag description="used by genericcomponentpage.jsp and by implementations.jsp to create a component instance" pageEncoding="UTF-8"%>
+<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@taglib prefix="t" tagdir="/WEB-INF/tags" %>
+<%@taglib prefix="w" uri="http://www.eclipse.org/winery/repository/functions"%>
+<%--
+function createResource(nameOfResource, fields, url, onSuccess) cannot be used as this method is more diverse
+--%>
+
+<%@attribute name="label" required="true" description="The lable to display"%>
+
+<%@attribute name="URL" description=""%>
+<%@attribute name="onSuccess" description=""%>
+<%@attribute name="type" description="added to dataToSend when doing a POST"%>
+<%@attribute name="typeSelectorData" type="java.util.Collection" description="All available types when creating a template. We do not support types with names (additional to the id) as the current TOSCA specification does not foresee the usage of both name and id at types"%>
+<%@attribute name="openinnewwindow" description="if true, the editor for the created component instance is openend in a new window"%>
+
+<div class="modal fade" id="addComponentInstanceDiag">
+<div class="modal-dialog">
+<div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+ <h4 class="modal-title">Add ${label}</h4>
+ </div>
+ <div class="modal-body" style="overflow-y: inherit;">
+ <form id="addComponentInstanceForm" enctype="multipart/form-data">
+ <%-- we send namespace + name to server. There, the ID is generated out of the name --%>
+ <fieldset>
+ <div class="form-group">
+ <label for="nameOfNewCI" class="control-label">Name</label>
+ <input class="form-control" name="name" id="nameOfNewCI" type="text" required="required" />
+ </div>
+
+ <t:namespaceChooser idOfInput="namespace" allNamespaces="${w:allNamespaces()}"></t:namespaceChooser>
+
+ <%-- (optional) the type, for instance at an artifact template or node type implementation --%>
+ <c:choose>
+ <%-- Either directly given ... --%>
+ <c:when test="${not empty type}">
+ <%-- then, we just submit it together with the other data --%>
+ <input id="ciType" type="hidden" class="form-control" name="type" value="${type}"/>
+ </c:when>
+ <%-- ... or a list is given given. --%>
+ <%-- This is somewhat ugly as the UI displays no type dialog if no types are existing, but a template is to be created.
+ We consider that as special case and do not add code to work around that issue.
+ A good solution is to present an error dialog to the user if he hits that case:
+ A hint should be presented to state that the user has to add a type first. --%>
+ <c:when test="${empty type and not empty typeSelectorData}">
+ <div class="form-group">
+ <label for="ciType" class="control-label">Type</label>
+ <%-- similar code to artifacts.jsp.openLink${name}ArtifactDiag().ajax.success --%>
+ <select id="ciType" name="type" class="form-control">
+ <c:forEach var="typeId" items="${typeSelectorData}">
+ <option value="${typeId.QName}">${typeId.xmlId.decoded}</option>
+ </c:forEach>
+ </select>
+ </div>
+ </c:when>
+ </c:choose>
+
+ </fieldset>
+
+ </form>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
+ <button type="button" class="btn btn-primary" onclick="addComponentInstance();">Add</button>
+ </div>
+</div>
+</div>
+</div>
+
+<script>
+<c:if test="${empty type and not empty typeSelectorData}">
+$("#ciType").select2();
+</c:if>
+
+$("#addComponentInstanceDiag").on("shown.bs.modal", function() {
+ $("#nameOfNewCI").focus();
+});
+
+function addComponentInstance() {
+ if (highlightRequiredFields()) {
+ vShowError("Please fill in all required fields");
+ return;
+ }
+
+ var namespace = $("#namespace").val();
+ require(["URIjs/URI"], function(URI) {
+ if (!URI(namespace).is("absolute")) {
+ vShowError("Please enter a valid namespace");
+ return;
+ }
+
+ var dataToSend = $('#addComponentInstanceForm').serialize();
+ $.ajax({
+ type: "POST",
+ async: false,
+ "data": dataToSend,
+ <c:if test="${not empty URL}">"url": "${URL}",</c:if>
+ dataType: "text",
+ error: function(jqXHR, textStatus, errorThrown) {
+ vShowAJAXError("Could not add ${label}", jqXHR, errorThrown);
+ },
+ success: function(resData, textStatus, jqXHR) {
+ <c:if test="${not empty onSuccess}">
+ ${onSuccess}
+ </c:if>
+
+ //if we want to add the new entry directly in the list, we have to start with following:
+ //var name = $('#nameOfNewCI').val();
+ //var namespace = $('#namespaceOfNewCI').val();
+
+ //otherwise: directly open edito
+ $('#addComponentInstanceDiag').modal('hide');
+ // open editor for newly created component (assumption: window.location ends with "/")
+ var loc = jqXHR.getResponseHeader('Location');
+ <c:choose>
+ <c:when test="${openinnewwindow}">
+ window.open(loc, "_blank");
+ </c:when>
+ <c:otherwise>
+ window.location = loc;
+ </c:otherwise>
+ </c:choose>
+ }
+ });
+ });
+}
+
+function openNewCIdiag() {
+ $('#addComponentInstanceDiag').modal('show');
+}
+
+</script>
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/colorwheel.tag b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/colorwheel.tag
new file mode 100644
index 0000000..1b7fede
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/colorwheel.tag
@@ -0,0 +1,36 @@
+<%--
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+--%>
+<%@tag description="displays a color wheel" pageEncoding="UTF-8"%>
+
+<%@attribute name="id" required="true" description="id of the div to initialize"%>
+<%@attribute name="url" required="true" description="URL to put to"%>
+<%@attribute name="color" required="true" description="the initial color"%>
+<%@attribute name="label" required="true" description="the label"%>
+
+<div id="${id}" class="form-group" style="height:175px;">
+ <label for="${id}Div">${label}</label>
+ <div id="${id}Div" style="width:100%">
+ <div class="colorwheel" style="float:left; margin-right:20px; width:300px; text-align:left;"></div>
+ <div style="float:left; width:50%">
+ <input id="${id}Input" name="input_example" value="${color}" size="7" style="background-color: ${color}">
+ <p class="text-info">Enter the hex value above</p>
+ <button type="button" class="btn btn-default btn-primary btn-sm" onclick="putColor('${url}', $('#${id}Input').val());">Save</button>
+ </div>
+ </div>
+</div>
+
+<script>
+ var cw = Raphael.colorwheel($("#${id} div.colorwheel")[0],150);
+ cw.input($("#${id} input")[0]);
+</script>
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/componentinstance.tag b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/componentinstance.tag
new file mode 100644
index 0000000..c5c2b4f
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/componentinstance.tag
@@ -0,0 +1,163 @@
+<%--
+/*******************************************************************************
+ * Copyright (c) 2012-2013, 2015 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+--%>
+<%@tag description="Wrapper for resources, which are backed by definitions and thus offer an XML div" pageEncoding="UTF-8"%>
+
+<%--
+ quick hack to avoid specifying windowtitle at elements having it.name, too.
+ TODO: check why in this class a check on it.name is done, although there is componentinstancewithname.tag
+--%>
+<%@attribute name="windowtitle" description="If it.name is not available, this parameter should be given"%>
+
+<%@attribute name="selected" required="true"%>
+
+<%@attribute name="cssClass" required="true"%>
+
+<%@attribute name="image" required="false"%>
+
+<%@attribute name="libs" fragment="true" %>
+
+<%@attribute name="subMenus" required="false" type="java.util.List" description="list of SubMenuData objects stating the content of the submenus. The first submenu is used as default page. Subpage #xml must not be included, it is added automatically."%>
+
+<%@attribute name="implementationFor" description="In case the component instance is an implementation for another type, the link (a href) to the type is put here"%>
+
+<%@attribute name="type" description="In case the component instance is a template, the link (a href) to the type is put here"%>
+
+<%@attribute name="twolines" required="false" description="if set, two lines are required for the tabs"%>
+
+<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@taglib prefix="w" uri="http://www.eclipse.org/winery/repository/functions" %>
+<%@taglib prefix="t" tagdir="/WEB-INF/tags" %>
+
+<c:if test="${empty windowtitle}">
+ <c:set var="windowtitle" value="${it.name}" />
+</c:if>
+
+<t:genericpage windowtitle="${windowtitle}" selected="${selected}" cssClass="mainContentContainer ${cssClass}" libs="${libs}">
+
+ <div class="top<c:if test="${not empty twolines}"> twolines</c:if>">
+ <c:if test="${not empty image}">
+ <img src='visualappearance/50x50' style='position: absolute; margin-top: 32px; margin-left: 27px; height: 40px; width: 40px;' />
+ </c:if>
+
+ <%-- Quick hack to enable usage of this tag at adminresource --%>
+ <c:catch var="exception"><c:if test="${empty it.name}"></c:if></c:catch>
+ <c:if test="${empty exception}">
+ <%@ include file="/jsp/componentnaming.jspf" %>
+ <div style="float:right; margin-right:29px; margin-top: -20px; position:relative;">
+ <div style="float:right;">
+ <button type="button" class="btn btn-danger" onclick="deleteResource('${it.name}', '.', openOverviewPage)">Delete</button>
+ <a href="?definitions" class="btn btn-info">XML</a>
+ <a href="?csar" class="btn btn-info">CSAR</a>
+ <c:if test="${w:isContainerLocallyAvailable()}">
+ <button id="deployBtn" type="button" onclick="deployOnOpenTOSCAContainer()" class="btn btn-info" data-loading-text="Deploying...">Deploy</button>
+ </c:if>
+ </div>
+ <c:if test="${not empty implementationFor}">
+ <div style="clear:both; float:right;">
+ Implementation for ${implementationFor}
+ </div>
+ </c:if>
+ <c:if test="${not empty type}">
+ <div style="clear:both; float:right;">
+ Type ${type}
+ </div>
+ </c:if>
+ </div>
+ </c:if>
+ <div class="subMenu">
+ <c:if test="${not empty subMenus}">
+ <c:forEach items="${subMenus}" var="subMenu" varStatus="status">
+ <t:submenu selected="${status.first}" subMenuData="${subMenu}">
+ </t:submenu>
+ </c:forEach>
+ </c:if>
+
+ <%-- Quick hack to enable usage of this tag at adminresource --%>
+ <c:if test="${empty exception}">
+ <t:submenu subMenuData="<%=org.eclipse.winery.repository.resources.SubMenuData.SUBMENU_DOCUMENTATION%>" selected="${empty subMenus}">
+ </t:submenu>
+ <t:submenu subMenuData="<%=org.eclipse.winery.repository.resources.SubMenuData.SUBMENU_XML%>" selected="${empty subMenus}">
+ </t:submenu>
+ </c:if>
+ </div>
+ </div>
+
+ <div class="middle" id="ccontainer">
+ </div>
+
+ <c:if test="${empty subMenus}">
+ <jsp:include page="/jsp/hashloading.jsp">
+ <jsp:param name="validpages" value="['#documentation', '#xml']" />
+ <jsp:param name="defaultpage" value="#documentation" />
+ </jsp:include>
+ </c:if>
+ <c:if test="${not empty subMenus}">
+ <c:forEach items="${subMenus}" var="subMenu" varStatus="status">
+ <c:if test="${status.first}">
+ <c:set var="defaultpage" value="${subMenu.href}"></c:set>
+ <c:set var="additionalHashes" value="'${subMenu.href}'"></c:set>
+ </c:if>
+ <c:if test="${not status.first}">
+ <c:set var="additionalHashes" value="${additionalHashes}, '${subMenu.href}'"></c:set>
+ </c:if>
+ </c:forEach>
+
+ <jsp:include page="/jsp/hashloading.jsp">
+ <jsp:param name="validpages" value="[${additionalHashes}, '#documentation', '#xml']" />
+ <jsp:param name="defaultpage" value="${defaultpage}" />
+ </jsp:include>
+ </c:if>
+
+ <div class="bottom">
+ </div>
+
+<script>
+function openOverviewPage() {
+ window.location="../../";
+}
+
+function deployOnOpenTOSCAContainer() {
+ $("#deployBtn").button('loading');
+
+ urlToUpload = window.location.href;
+ var hash = window.location.hash;
+ if (hash != "") {
+ urlToUpload = urlToUpload.substr(0, urlToUpload.length - hash.length)
+ }
+ var search = window.location.search;
+ if (search != "") {
+ urlToUpload = urlToUpload.substr(0, urlToUpload.length - search.length)
+ }
+
+ urlToUpload = urlToUpload + "?csar";
+
+ var data = {
+ urlToUpload: urlToUpload
+ }
+
+ // we assume the container runs at the same host and port
+ $.ajax({
+ url: "/admin/uploadCSARFromURL.action",
+ data: data
+ }).always(function () {
+ $("#deployBtn").button('reset');
+ }).fail(function (jqXHR, textStatus, errorThrown) {
+ vShowAJAXError("Could not trigger CSAR deployment at OpenTOSCA container", jqXHR, errorThrown);
+ }).done(function (result) {
+ vShowSuccess("Successfully triggered CSAR deployment at OpenTOSCA container");
+ });
+}
+</script>
+
+</t:genericpage>
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/componentinstancewithName.tag b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/componentinstancewithName.tag
new file mode 100644
index 0000000..f970b99
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/componentinstancewithName.tag
@@ -0,0 +1,33 @@
+<%--
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+--%>
+<%@tag import="org.eclipse.winery.repository.resources.SubMenuData"%>
+<%@tag description="Wrapper for component instances with a name. Name is also used for window title." pageEncoding="UTF-8"%>
+
+<%@taglib prefix="t" tagdir="/WEB-INF/tags" %>
+
+<%@tag import="java.util.ArrayList"%>
+
+<!-- for the header -->
+<%@attribute name="selected" required="true"%>
+<%@attribute name="cssClass" required="true"%>
+<%@attribute name="image" required="false"%>
+<%@attribute name="libs" fragment="true" %>
+<%@attribute name="implementationFor" %>
+<%@attribute name="twolines" required="false" description="if set, two lines are required for the tabs"%>
+<%@attribute name="type" description="In case the component instance is a template, the link (a href) to the type is put here"%>
+
+<%@attribute name="subMenus" required="false" type="java.util.List" %>
+
+<t:componentinstance cssClass="${cssClass}" selected="${selected}" subMenus="<%=subMenus%>" image="${image}" libs="${libs}" implementationFor="${implementationFor}" twolines="${twolines}" type="${type}">
+</t:componentinstance>
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/componentinstancewithNameDerivedFromAbstractFinal.tag b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/componentinstancewithNameDerivedFromAbstractFinal.tag
new file mode 100644
index 0000000..a8ea212
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/componentinstancewithNameDerivedFromAbstractFinal.tag
@@ -0,0 +1,45 @@
+<%--
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+--%>
+<%@tag import="org.eclipse.winery.repository.resources.SubMenuData"%>
+<%@tag description="Wrapper for component instances with name, derived from, abstract, final (equivalent to AbstractComponentInstanceWithName..." pageEncoding="UTF-8"%>
+
+<%@taglib prefix="t" tagdir="/WEB-INF/tags" %>
+
+<%@tag import="java.util.ArrayList"%>
+
+<!-- for the header -->
+<%@attribute name="selected" required="true"%>
+<%@attribute name="cssClass" required="true"%>
+<%@attribute name="image" required="false"%>
+<%@attribute name="libs" fragment="true" %>
+<%@attribute name="implementationFor" %>
+<%@attribute name="twolines" required="false" description="if set, two lines are required for the tabs"%>
+
+<%@attribute name="subMenus" required="false" type="java.util.List" description="list of SubMenuData objects stating the content of the submenus. The first submenu is used as default page. Subpage #xml must not be included, it is added automatically."%>
+
+<!-- add submenus after the submenus defined for the type -->
+<%
+
+if (subMenus == null) {
+ subMenus = new ArrayList(1);
+}
+
+SubMenuData data;
+
+data = new SubMenuData("#inheritance", "Inheritance");
+subMenus.add(data);
+%>
+
+<t:componentinstancewithName cssClass="${cssClass}" selected="${selected}" subMenus="<%=subMenus%>" image="${image}" libs="${libs}" implementationFor="${implementationFor}" twolines="${twolines}">
+</t:componentinstancewithName>
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/constraints/constraint.tag b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/constraints/constraint.tag
new file mode 100644
index 0000000..30607b6
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/constraints/constraint.tag
@@ -0,0 +1,83 @@
+<%--
+/*******************************************************************************
+ * Copyright (c) 2012-2014 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+--%>
+<%@tag description="Models editing a single constraint" pageEncoding="UTF-8"%>
+
+<%@taglib prefix="o" tagdir="/WEB-INF/tags/common/orioneditor"%>
+<%@taglib prefix="t" tagdir="/WEB-INF/tags"%>
+
+
+<div class="modal fade" id="constraint-dialog">
+ <div class="modal-dialog">
+ <div class="modal-content" style="width:660px;">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+ <h4 class="modal-title">Edit Constraint</h4>
+ </div>
+ <div class="modal-body">
+
+ <form>
+ <fieldset>
+ <t:typeswithshortnameasselect label="Type" type="constrainttype" selectname="typenameinput" typesWithShortNames="<%=org.eclipse.winery.repository.resources.admin.types.ConstraintTypesManager.INSTANCE.getTypes()%>">
+ </t:typeswithshortnameasselect>
+
+ <o:orioneditorarea areaid="constrainttextarea" />
+ </fieldset>
+ </form>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
+ <%-- click functionality is set by editConstraint() --%>
+ <button type="button" class="btn btn-primary" id="createConstraintBtn">Create</button>
+ <button type="button" class="btn btn-primary" id="updateConstraintBtn">Update</button>
+ </div>
+ </div>
+ </div>
+</div>
+
+<%--
+Quick hack to get the representation of an empty constraint
+TODO: A resource should provide the empty representation (?!)
+
+The alternative is not to use the complete XML as the specification only allows the content of the XML wrapper to be modified.
+If we use that method, this textarea is not required, but the sending of an existing constraint has to be modified to send only lines 2 to n-1, i.e., send without the wrapping lines.
+This is not possible if the stored constraint is empty, then there are 2 lines only.
+--%>
+<textarea class="hidden" id="emptyconstraint">
+<%=org.eclipse.winery.repository.Utils.getXMLAsString(new org.eclipse.winery.model.tosca.TConstraint())%>
+</textarea>
+
+<script>
+/**
+ * Shows an error if XML is invalid, calls onSuccess otherwise
+ *
+ * @param onSuccess Function called with XML String containging the constraint
+ */
+function getXMLOfConstraint(onSuccess) {
+ // we have to weave in the type into the XML
+ // The editor presents the complete XML as this is easier to implement
+ // in comparison to select lines 3 to n-1 of the XML and then create a TConstraints element
+
+ require(["winery-support-common"], function(wsc) {
+ var txt = window.winery.orionareas["constrainttextarea"].editor.getText();
+ var xmlDoc = wsc.checkXMLValidityAndShowErrorIfInvalid(txt);
+
+ var type = document.createAttribute('constraintType');
+ type.nodeValue = $("#typenameinput").val();
+ xmlDoc.documentElement.attributes.setNamedItem(type);
+ xmlString = (new XMLSerializer()).serializeToString(xmlDoc);
+
+ onSuccess(xmlString);
+ });
+}
+</script> \ No newline at end of file
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/entitytemplate.tag b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/entitytemplate.tag
new file mode 100644
index 0000000..781e2d8
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/entitytemplate.tag
@@ -0,0 +1,43 @@
+<%--
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+--%>
+<%@tag description="Wrapper for instances of entity types" pageEncoding="UTF-8"%>
+
+<%@taglib prefix="t" tagdir="/WEB-INF/tags" %>
+
+<%@tag import="java.util.ArrayList"%>
+<%@tag import="org.eclipse.winery.repository.resources.SubMenuData"%>
+
+<!-- for the header -->
+<%@attribute name="selected" required="true"%>
+<%@attribute name="cssClass" required="true"%>
+<%@attribute name="image" required="false"%>
+<%@attribute name="libs" fragment="true" %>
+
+<%@attribute name="subMenus" required="false" type="java.util.List" description="list of SubMenuData objects stating the content of the submenus. The first submenu is used as default page. Subpage #xml must not be included, it is added automatically."%>
+
+<!-- add submenus after the submenus defined for the type-->
+<%
+
+if (subMenus == null) {
+ subMenus = new ArrayList<SubMenuData>(2);
+}
+
+SubMenuData data;
+
+data = new SubMenuData("#properties", "Properties");
+subMenus.add(data);
+%>
+
+<t:componentinstancewithName cssClass="${cssClass}" selected="${selected}" subMenus="<%=subMenus%>" image="${image}" libs="${libs}">
+</t:componentinstancewithName>
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/entitytype.tag b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/entitytype.tag
new file mode 100644
index 0000000..6bd1d3d
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/entitytype.tag
@@ -0,0 +1,49 @@
+<%--
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+--%>
+<%@tag description="Wrapper for instances of entity types" pageEncoding="UTF-8"%>
+
+<%@taglib prefix="t" tagdir="/WEB-INF/tags" %>
+
+<%@tag import="java.util.ArrayList"%>
+<%@tag import="org.eclipse.winery.repository.resources.SubMenuData"%>
+
+<!-- for the header -->
+<%@attribute name="selected" required="true"%>
+<%@attribute name="cssClass" required="true"%>
+<%@attribute name="image" required="false"%>
+<%@attribute name="twolines" required="false" description="if set, two lines are required for the tabs"%>
+<%@attribute name="libs" fragment="true" %>
+
+<%@attribute name="subMenus" required="false" type="java.util.List" description="list of SubMenuData objects stating the content of the submenus. The first submenu is used as default page. Subpage #xml must not be included, it is added automatically."%>
+
+<!-- add submenus after the submenus defined for the type-->
+<%
+
+if (subMenus == null) {
+ subMenus = new ArrayList<SubMenuData>(2);
+}
+
+SubMenuData data;
+
+data = new SubMenuData("#propertiesdefinition", "Properties Definition");
+subMenus.add(data);
+
+// Tags are currently not implemented -> Don't confuse users by showing the tab
+// has to be enabled again, when tags are implemented
+//data = new SubMenuData("#tags", "Tags");
+//subMenus.add(data);
+%>
+
+<t:componentinstancewithNameDerivedFromAbstractFinal cssClass="${cssClass}" selected="${selected}" subMenus="<%=subMenus%>" image="${image}" libs="${libs}" twolines="${twolines}">
+</t:componentinstancewithNameDerivedFromAbstractFinal>
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/entitytypes/nodetypes/reqandcapdefs/reqandcapdefs.tag b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/entitytypes/nodetypes/reqandcapdefs/reqandcapdefs.tag
new file mode 100644
index 0000000..3748bd6
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/entitytypes/nodetypes/reqandcapdefs/reqandcapdefs.tag
@@ -0,0 +1,334 @@
+<%--
+/*******************************************************************************
+ * Copyright (c) 2012-2014 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation and/or initial documentation
+ * Yves Schubert - switch to bootstrap 3, integration with spinnerwithinphty
+ *******************************************************************************/
+--%>
+<%@tag description="Models Requirement and Capability Definitions" pageEncoding="UTF-8"%>
+
+<%@attribute name="labelForSingleItem" required="true" %>
+<%@attribute name="url" required="true"%>
+<%@attribute name="allSubResources" required="true" type="java.util.List" description="All available req-/cap-defs" %>
+<%@attribute name="allTypes" required="true" type="java.util.Collection" description="All available types of req-/cap-def" %>
+<%@attribute name="typeClass" required="true" type="java.lang.Class" description="The class of the type" %>
+
+<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+<%@taglib prefix="ct" tagdir="/WEB-INF/tags/common" %>
+<%@taglib prefix="con" tagdir="/WEB-INF/tags/constraints" %>
+<%@taglib prefix="o" tagdir="/WEB-INF/tags/common/orioneditor"%>
+<%@taglib prefix="t" tagdir="/WEB-INF/tags" %>
+<%@taglib prefix="w" uri="http://www.eclipse.org/winery/repository/functions"%>
+<%@taglib prefix="wc" uri="http://www.eclipse.org/winery/functions"%>
+
+<button class="rightbutton btn btn-danger btn-xs" type="button" onclick="deleteOnServerAndInTable(reqCapTableInfo, '${labelForSingleItem}', '${url}');">Remove</button>
+<button class="rightbutton btn btn-primary btn-xs" type="button" onclick="$('#addReqOrCapDefDiag').modal('show');">Add</button>
+
+<div class="modal fade" id="addReqOrCapDefDiag">
+<div class="modal-dialog">
+<div class="modal-content" style="width:660px;">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+ <h4 class="modal-title">Add ${labelForSingleItem}</h4>
+ </div>
+ <div class="modal-body">
+ <form id="addReqOrCapDefForm" enctype="multipart/form-data"><fieldset>
+ <div class="form-group">
+ <label for="reqorcapname">Name</label>
+ <input class="form-control" name="name" id="reqorcapname" type="text" required="required" />
+ </div>
+ <ct:QNameChooser allQNames="${allTypes}" idOfSelectField="type" labelOfSelectField="Type" />
+ <ct:spinnerwithinphty label="Lower Bound" id="lowerbound" min="0" value="1" />
+ <ct:spinnerwithinphty label="Upper Bound" id="upperbound" min="1" value="1" withinphty="true" />
+ </fieldset></form>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
+ <button type="button" class="btn btn-primary" onclick="createReqOrCapDef();">Add</button>
+ </div>
+</div>
+</div>
+</div>
+
+<table id="reqorcapdefs">
+
+<thead>
+ <tr>
+ <th>name</th>
+ <th>type</th>
+ <th>lower bound</th>
+ <th>upper bound</th>
+ <th>constraints</th>
+ </tr>
+</thead>
+
+<tbody>
+
+<c:forEach var="r" items="${allSubResources}">
+ <tr>
+ <td>${r.def.name}</td>
+ <td>${wc:qname2href(pageContext.request.contextPath, typeClass, r.type)}</td>
+ <td>${w:renderMinInstances(r.def.lowerBound)}</td>
+ <td>${w:renderMaxInstances(r.def.upperBound)}</td>
+ <td><button class="btn btn-xs" onclick="editConstraints('${r.def.name}');">Constraints...</button></td>
+ </tr>
+</c:forEach>
+
+</tbody>
+
+</table>
+
+<%-- Editing a set of constraints --%>
+
+<div class="modal fade" id="constraints-dialog">
+<div class="modal-dialog">
+<div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+ <h4 class="modal-title">Constraints</h4>
+ </div>
+ <div class="modal-body">
+ <div id="noconstraintsexisting" style="display:none;">No constraints defined</div>
+ <ol id="constraintlist" style="display:none;">
+ </ol>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
+ <button type="button" class="btn btn-primary" onclick="editConstraint();">Add new</button>
+ </div>
+</div>
+</div>
+</div>
+
+<script>
+function deleteConstraint(id) {
+ $.ajax({
+ url: "${url}" + currentReqCapName + "/constraints/" + id,
+ method: "DELETE",
+ error: function(jqXHR, textStatus, errorThrown) {
+ vShowAJAXError("Could not delete constraint", jqXHR, errorThrown);
+ },
+ success: function(data, textStatus, jqXHR) {
+ $("#"+id).remove();
+
+ // quick hack
+ var constraintListIsEmpty = $("#constraintlist").children().length == 0;
+ if (constraintListIsEmpty) {
+ // last item was removed -> show empty message
+ $("#noconstraintsexisting").show();
+ $("#constraintlist").hide();
+ }
+ }
+ });
+}
+
+function getLiForConstraint(id) {
+ return '<li id="' + id + '"><span onclick="editConstraint(\'' + id + '\');">constraint</span> <button class="btn btn-danger btn-xs" style="margin-left:10px;" onclick="deleteConstraint(\'' + id + '\')">Delete</button></li>';
+}
+/**
+ * @param id the id of the constraint
+ */
+function addConstraintToList(id) {
+ var constraintList = $("#constraintlist");
+
+ var li = getLiForConstraint(id);
+ constraintList.append(li);
+
+ // ensure that "no constraints existing" is hidden and the list is shown
+ $("#noconstraintsexisting").hide();
+ constraintList.show();
+}
+
+var currentReqCapName;
+
+function editConstraints(reqCapName) {
+ currentReqCapName = reqCapName;
+ $.ajax({
+ url: "${url}" + currentReqCapName + "/constraints/",
+ dataType: "json",
+ error: function(jqXHR, textStatus, errorThrown) {
+ vShowAJAXError("Could not fetch constraints data", jqXHR, errorThrown);
+ },
+ success: function(data, textStatus, jqXHR) {
+ if (data.length == 0) {
+ $("#noconstraintsexisting").show();
+ $("#constraintlist").hide();
+ } else {
+ $("#noconstraintsexisting").hide();
+ var constraintList = $("#constraintlist");
+ constraintList.empty();
+ $(data).each(function(i,id) {
+ addConstraintToList(id);
+ });
+ $("#constraintlist").show();
+ };
+ $("#constraints-dialog").modal("show");
+ }
+ });
+}
+</script>
+
+
+<%-- Editing a single constraint --%>
+
+<con:constraint />
+
+<script>
+var currentConstraintId;
+
+/**
+ * @param constraintId (optional) If not given, enable editing of a newly created constraint
+ */
+function editConstraint(constraintId) {
+ currentConstraintId = constraintId;
+
+ // Adjust Create/Update button
+ if (currentConstraintId === undefined) {
+ $("#createConstraintBtn").show();
+ $("#updateConstraintBtn").hide();
+
+ $("#createConstraintBtn").off("click");
+ $("#createConstraintBtn").on("click", function() {
+ getXMLOfConstraint(function(xmlString) {
+ $.ajax({
+ type: "POST",
+ url: "${url}" + currentReqCapName + "/constraints/",
+ contentType: "text/xml",
+ async: true,
+ data: xmlString,
+ dataType: "text",
+ error: function(jqXHR, textStatus, errorThrown) {
+ vShowAJAXError("Could not add constraint", jqXHR, errorThrown);
+ },
+ success: function(resData, textStatus, jqXHR) {
+ addConstraintToList(resData);
+ $("#constraint-dialog").modal("hide");
+ }
+ });
+ });
+ });
+ } else {
+ // updating an existing constraint
+ $("#createConstraintBtn").hide();
+ $("#updateConstraintBtn").show();
+
+ $("#updateConstraintBtn").off("click");
+ $("#updateConstraintBtn").on("click", function() {
+ getXMLOfConstraint(function(xmlString) {
+ $.ajax({
+ type: "PUT",
+ url: "${url}" + currentReqCapName + "/constraints/" + currentConstraintId + "/",
+ contentType: "text/xml",
+ async: true,
+ data: xmlString,
+ dataType: "text",
+ error: function(jqXHR, textStatus, errorThrown) {
+ vShowAJAXError("Could not update constraint", jqXHR, errorThrown);
+ },
+ success: function(newId, textStatus, jqXHR) {
+ $("#constraint-dialog").modal("hide");
+ var newLi = getLiForConstraint(newId);
+ var oldLi = $("#" + currentConstraintId);
+ oldLi.before(newLi);
+ oldLi.remove();
+ }
+ });
+ });
+ });
+ };
+
+ // fill textarea
+ if (currentConstraintId === undefined) {
+ $("#constraint-dialog").modal("show");
+ // setting content only works if dialog is fully shown
+ window.setTimeout(function() {
+ window.winery.orionareas["constrainttextarea"].editor.setText($("#emptyconstraint").val());
+ }, window.winery.BOOTSTRAP_ANIMATION_DURATION);
+ } else {
+ $.ajax({
+ type: "GET",
+ url: "${url}" + currentReqCapName + "/constraints/" + currentConstraintId + "/",
+ dataType: "xml",
+ async: true,
+ error: function(jqXHR, textStatus, errorThrown) {
+ vShowAJAXError("Could get constraint information", jqXHR, errorThrown);
+ },
+ success: function(xmlData, textStatus, jqXHR) {
+ // xmlDoc contains an XML document and not just a string
+ // We let jQuery parse the XML as we need to parse the type attribute
+
+ // *move* type information to input field
+ var type = xmlData.documentElement.getAttribute("constraintType");
+ $("#typenameinput").val(type);
+ xmlData.documentElement.removeAttribute("constraintType");
+
+ $("#constraint-dialog").modal("show");
+
+ // the XML document cannot be put directly as content. It has to be converted to a String
+ // TODO: add nice formatting
+ var xmlString = (new XMLSerializer()).serializeToString(xmlData);
+ window.setTimeout(function() {
+ window.winery.orionareas["constrainttextarea"].editor.setText(xmlString);
+ }, window.winery.BOOTSTRAP_ANIMATION_DURATION);
+ }
+ });
+ }
+}
+</script>
+
+
+<script>
+// TODO: this variable is available after switching tabs.
+// One could cache this information without requiring reloading all the content
+var reqCapTableInfo = {
+ id : '#reqorcapdefs'
+};
+
+require(["winery-support"], function(ws) {
+ ws.initTable(reqCapTableInfo);
+});
+
+function createReqOrCapDef() {
+ if (highlightRequiredFields()) {
+ vShowError("Please fill out all required fields.");
+ return;
+ }
+
+ var data = $('#addReqOrCapDefForm').serialize();
+
+ // replace &inphty; by TOSCA's "unbounded"
+ data = data.replace("∞", "unbounded");
+ // %E2%88%9E is the HTML encoding of &inphty;
+ data = data.replace("%E2%88%9E", "unbounded");
+
+ $.ajax({
+ url: "${url}",
+ type: "POST",
+ async: false,
+ data: data,
+ error: function(jqXHR, textStatus, errorThrown) {
+ vShowError("Could not add ${labelForSingleItem}: " + errorThrown + "<br/>" + jqXHR.responseText);
+ },
+ success: function(data, textStatus, jqXHR) {
+ // Data has been validated at the server
+ // We can just add the local data
+ var name = $('#reqorcapname').val();
+ var type = $('#type').select2("data").text; // TODO: make href to be consistent with other lines
+ var lbound = $('#lowerbound').val();
+ var ubound = $('#upperbound').val();
+ var constraints = "<button class=\"btn btn-xs\" onclick=\"editConstraints('" + name + "');\">Constraints...</button>";
+ var dataToAdd = [name, type, lbound, ubound, constraints];
+ reqCapTableInfo.table.fnAddData(dataToAdd);
+ $('#addReqOrCapDefDiag').modal('hide');
+ }
+ });
+}
+
+</script>
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/genericpage.tag b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/genericpage.tag
new file mode 100644
index 0000000..7063697
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/genericpage.tag
@@ -0,0 +1,349 @@
+<%--
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation and/or initial documentation
+ * Yves Schubert - switch to bootstrap 3
+ *******************************************************************************/
+--%>
+<%@tag description="Global Wrapper" pageEncoding="UTF-8"%><!DOCTYPE html>
+
+<%@attribute name="windowtitle" required="true" description="String to be used as window title"%>
+<%@attribute name="selected" required="true"%>
+<%@attribute name="cssClass" required="true"%>
+
+<%@attribute name="libs" fragment="true" %>
+
+<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+<%@taglib prefix="ct" tagdir="/WEB-INF/tags/common"%>
+<%@taglib prefix="t" tagdir="/WEB-INF/tags"%>
+<%@taglib prefix="w" uri="http://www.eclipse.org/winery/repository/functions"%>
+
+<%@tag import="org.eclipse.winery.repository.Prefs" %>
+
+<!-- This is Winery ${project.version} -->
+
+<html>
+<head>
+ <title>${windowtitle}</title>
+ <meta name="application-name" content="Winery" />
+ <meta charset="UTF-8">
+ <link rel="icon" href="${w:topologyModelerURI()}/favicon.png" type="image/png">
+ <link rel="stylesheet" href="${pageContext.request.contextPath}/components/bootstrap/dist/css/bootstrap.css" />
+ <link rel="stylesheet" href="${pageContext.request.contextPath}/components/bootstrap/dist/css/bootstrap-theme.css" />
+
+ <%-- CSS to style the file input field as button and adjust the Bootstrap progress bars --%>
+ <link rel="stylesheet" href="${pageContext.request.contextPath}/components/blueimp-file-upload/css/jquery.fileupload.css" />
+ <link rel="stylesheet" href="${pageContext.request.contextPath}/components/blueimp-file-upload/css/jquery.fileupload-ui.css" />
+ <link type="text/css" href="${pageContext.request.contextPath}/components/datatables/media/css/jquery.dataTables.css" rel="stylesheet" />
+ <link type="text/css" href="${pageContext.request.contextPath}/css/winery-repository.css" rel="Stylesheet" />
+ <link type="text/css" href="${pageContext.request.contextPath}/components/pnotify/jquery.pnotify.default.css" media="all" rel="stylesheet" />
+ <link type="text/css" href="${pageContext.request.contextPath}/components/pnotify/jquery.pnotify.default.icons.css" media="all" rel="stylesheet" />
+ <link type="text/css" href="${pageContext.request.contextPath}/components/select2/select2.css" media="all" rel="stylesheet" />
+ <link type="text/css" href="${pageContext.request.contextPath}/components/select2/select2-bootstrap.css" media="all" rel="stylesheet" />
+
+ <link type="text/css" href="${pageContext.request.contextPath}/components/bootstrap3-wysihtml5-bower/dist/bootstrap3-wysihtml5.css" media="all" rel="stylesheet" />
+ <link type="text/css" href="${pageContext.request.contextPath}/components/x-editable/dist/bootstrap3-editable/css/bootstrap-editable.css" media="all" rel="stylesheet" />
+
+ <link rel="stylesheet" href="${pageContext.request.contextPath}/components/bootstrap-spinedit/css/bootstrap-spinedit.css" />
+
+ <link rel="stylesheet" href="${pageContext.request.contextPath}/components/xmltree/xmltree.css" />
+
+ <link rel="stylesheet" type="text/css" href="http://eclipse.org/orion/editor/releases/6.0/built-editor.css"/>
+
+ <link type="text/css" href="${w:topologyModelerURI()}/css/winery-common.css" rel="stylesheet" />
+
+ <script type='text/javascript' src='${pageContext.request.contextPath}/components/requirejs/require.js'></script>
+ <script>
+ require.config({
+ baseUrl: "${pageContext.request.contextPath}/js",
+ paths: {
+ "artifacttemplateselection": "${w:topologyModelerURI()}/js/artifacttemplateselection",
+ "winery-sugiyamaLayouter": "${w:topologyModelerURI()}/js/winery-sugiyamaLayouter",
+
+ "datatables": "../components/datatables/media/js/jquery.dataTables",
+ "jquery": "../components/jquery/jquery",
+
+ "jquery.fileupload": "../components/blueimp-file-upload/js/jquery.fileupload",
+ "jquery.fileupload-ui": "../components/blueimp-file-upload/js/jquery.fileupload-ui",
+ "jquery.fileupload-process": "../components/blueimp-file-upload/js/jquery.fileupload-process",
+ "jquery.ui.widget": "../components/blueimp-file-upload/js/vendor/jquery.ui.widget",
+
+ // required for jsplumb
+ "jquery.ui": "../3rdparty/jquery-ui/js/jquery-ui",
+
+ "jsplumb": "../components/jsPlumb/dist/js/jquery.jsPlumb-1.5.4",
+
+ "keyboardjs": "../components/KeyboardJS/keyboard",
+
+ "orioneditor": "http://eclipse.org/orion/editor/releases/6.0/built-editor-amd",
+
+ "pnotify": "../components/pnotify/jquery.pnotify",
+
+ "select2": "../components/select2/select2",
+
+ "tmpl": "../components/blueimp-tmpl/js/tmpl",
+
+ "URIjs": '../components/uri.js/src',
+
+ "xmltree": "../components/xmltree/xmltree",
+
+ "XMLWriter": "../components/XMLWriter/XMLWriter"
+ }
+ });
+ </script>
+
+ <script type='text/javascript' src='${pageContext.request.contextPath}/components/jquery/jquery.js'></script>
+ <script type='text/javascript' src='${pageContext.request.contextPath}/components/bootstrap/dist/js/bootstrap.js'></script>
+
+ <script type="text/javascript" src="${pageContext.request.contextPath}/components/jquery-typing/plugin/jquery.typing-0.3.2.js"></script>
+ <script type="text/javascript" src="${pageContext.request.contextPath}/components/select2/select2.js"></script>
+
+ <script type="text/javascript" src="${pageContext.request.contextPath}/components/wysihtml5/dist/wysihtml5-0.3.0.js"></script>
+ <script type="text/javascript" src="${pageContext.request.contextPath}/components/handlebars/handlebars.min.js"></script>
+ <script type="text/javascript" src="${pageContext.request.contextPath}/components/bootstrap3-wysihtml5-bower/dist/bootstrap3-wysihtml5.min.js"></script>
+ <script type="text/javascript" src="${pageContext.request.contextPath}/components/x-editable/dist/bootstrap3-editable/js/bootstrap-editable.js"></script>
+ <script type="text/javascript" src="${pageContext.request.contextPath}/components/x-editable/dist/inputs-ext/wysihtml5/wysihtml5.js"></script>
+
+ <script type='text/javascript' src='${pageContext.request.contextPath}/components/bootstrap-spinedit/js/bootstrap-spinedit.js'></script>
+ <script type="text/javascript" src="${pageContext.request.contextPath}/js/winery-support-non-AMD.js"></script>
+ <script type="text/javascript" src="${w:topologyModelerURI()}/js/winery-common.js"></script>
+
+ <script>
+ // all x-editable popups should be placed in a way to fit "perfectly" on the screen
+ $.fn.editable.defaults.placement = "auto";
+
+ //configuration for pnotify
+ require(["jquery", "pnotify"], function() {
+ $.pnotify.defaults.styling = "bootstrap3";
+ });
+ </script>
+</head>
+
+<body>
+
+<jsp:include page="/jsp/shared/dialogs.jsp" />
+
+<script>
+//enable caching. This disables appending of "?_=xy" at requests
+jQuery.ajaxSetup({cache:true});
+
+// prevent form submission on pressing "enter"
+// In the topology modeler, this phenomen does not occurr.
+// The reason why all forms are submitted on enter pressing is unknown.
+$(document).on("keypress", "input", function(e) {
+ var key = (e.keyCode || e.which);
+ if (key == 13) {
+ // enter pressed
+ // press tab instead
+ // The following does not work
+ // TODO: include jQuery.tabbable plugin (http://stackoverflow.com/a/18740738/873282 / https://github.com/marklagendijk/jQuery.tabbable)
+ $(e.currentTarget).trigger({
+ type: 'keydown',
+ which: 9
+ });
+ return false;
+ }
+});
+
+$(function() {
+ var scrolling = $(document).height() > $(window).height();
+ if (scrolling) {
+ // add CSS fix to prevent flickering
+ $("#mainContainer").addClass("overflown");
+ } else {
+ $("#mainContainer").addClass("notoverflown");
+ }
+});
+</script>
+
+<t:about />
+
+<div id="mainContainer">
+ <div id="header">
+ <div id="showabout">
+ <button type="button" class="btn btn-default btn-xs" onClick="showAbout();">about</button>
+ </div>
+ <c:set var="warning" value="<%=Prefs.INSTANCE.getProperties().get(\"warning\")%>" />
+ <c:if test="${not empty warning}">
+ <div id="warning">
+ ${warning}
+ </div>
+ </c:if>
+
+ <div id="mainMenuContainer">
+
+ <%-- String values come from ComponentKind.toString() --%>
+
+ <a class="styledTabMenuButton <c:if test="${selected eq 'ServiceTemplate'}">selected</c:if>" href="${pageContext.request.contextPath}/servicetemplates/">
+ <div class="left"></div>
+ <div class="center">Service Templates</div>
+ <div class="right"></div>
+ </a>
+
+ <%-- TopologyTemplates: top level topology templates only in "pro" mode <a href="${pageContext.request.contextPath}/topologytemplates/">Topology Templates</a> --%><%! %>
+
+ <a class="styledTabMenuButton <c:if test="${selected eq 'NodeType'}">selected</c:if>" href="${pageContext.request.contextPath}/nodetypes/">
+ <div class="left"></div>
+ <div class="center">Node Types</div>
+ <div class="right"></div>
+ </a>
+
+ <a class="styledTabMenuButton <c:if test="${selected eq 'RelationshipType'}">selected</c:if>" href="${pageContext.request.contextPath}/relationshiptypes/">
+ <div class="left"></div>
+ <div class="center">Relationship Types</div>
+ <div class="right"></div>
+ </a>
+
+
+ <%-- include all other TOSCA Elements into admin --%>
+ <%-- We need to call it "Elements" instead of "components" as PRD01 on line 334 calls these "elements" --%>
+
+ <c:choose>
+
+ <c:when test="${selected eq 'ArtifactTemplate'}">
+ <c:set var="otherSelected" value="selected" />
+ <c:set var="otherLabel" value="Other Elements: Artifact Templates" />
+ </c:when>
+
+ <c:when test="${selected eq 'ArtifactType'}">
+ <c:set var="otherSelected" value="selected" />
+ <c:set var="otherLabel" value="Other Elements: Artifact Types" />
+ </c:when>
+
+ <c:when test="${selected eq 'CapabilityType'}">
+ <c:set var="otherSelected" value="selected" />
+ <c:set var="otherLabel" value="Other Elements: Capability Types" />
+ </c:when>
+
+ <c:when test="${selected eq 'NodeTypeImplementation'}">
+ <c:set var="otherSelected" value="selected" />
+ <c:set var="otherLabel" value="Other Elements: Node Type Implementations" />
+ </c:when>
+
+ <c:when test="${selected eq 'PolicyTemplate'}">
+ <c:set var="otherSelected" value="selected" />
+ <c:set var="otherLabel" value="Other Elements: Policy Templates" />
+ </c:when>
+
+ <c:when test="${selected eq 'PolicyType'}">
+ <c:set var="otherSelected" value="selected" />
+ <c:set var="otherLabel" value="Other Elements: Policy Types" />
+ </c:when>
+
+ <c:when test="${selected eq 'RelationshipTypeImplementation'}">
+ <c:set var="otherSelected" value="selected" />
+ <c:set var="otherLabel" value="Other Elements: Relationship Type Implementations" />
+ </c:when>
+
+ <c:when test="${selected eq 'RequirementType'}">
+ <c:set var="otherSelected" value="selected" />
+ <c:set var="otherLabel" value="Other Elements: Requirement Types" />
+ </c:when>
+
+ <c:when test="${selected eq 'XSDImport'}">
+ <c:set var="otherSelected" value="selected" />
+ <c:set var="otherLabel" value="Other Elements: Imports: XSD" />
+ </c:when>
+
+
+ <c:when test="${selected eq 'OtherElements'}">
+ <c:set var="otherSelected" value="selected" />
+ <c:set var="otherLabel" value="Other Elements" />
+ </c:when>
+
+
+ <c:otherwise>
+ <c:set var="otherSelected" value="" />
+ <c:set var="otherLabel" value="Other Elements" />
+ </c:otherwise>
+
+ </c:choose>
+
+ <a class="styledTabMenuButton ${otherSelected}" href="${pageContext.request.contextPath}/other/">
+ <div class="left"></div>
+ <div class="center">${otherLabel}</div>
+ <div class="right"></div>
+ </a>
+
+ <a class="styledTabMenuButton <c:if test="${selected eq 'admin'}">selected</c:if>" href="${pageContext.request.contextPath}/admin/">
+ <div class="left"></div>
+ <div class="center">Administration</div>
+ <div class="right"></div>
+ </a>
+
+ </div>
+ </div>
+
+<script id="template-createresource" type="text/x-tmpl">
+<div class="modal fade" id="createResource">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+ <h4 class="modal-title">{%=o.nameOfResource%}</h4>
+ </div>
+ <div class="modal-body">
+ <form id="createResourceForm" enctype="multipart/form-data">
+ <fieldset>
+ {% for (var i=0, field; field=o.fields[i]; i++) { %}
+ {%
+ if (field.type === undefined) {
+ field.type = "text";
+ }
+ if (field.type == 'checkbox' || field.type == 'radio') {
+ %}
+ <div class="form-group">
+ <label>
+ <input
+ style="margin: 0 5px;"
+ name="{%=field.name%}"
+ type="{%=field.type%}"
+ required="required"
+ {% if (field.checked) { %}checked="checked"{% } %}
+ autocomplete="off">
+ {%=field.label%}
+ </label>
+ {% } else { %}
+ <div class="form-group">
+ <label for="addedtypeinput">{%=field.label%}</label>
+ <input id="addedtypeinput" class="form-control" name="{%=field.name%}" type="{%=field.type%}" required="required" autocomplete="off" />
+ {% } %}
+ {% if (field.hint) { %}
+ <span class="help-block">{%=field.hint%}</span>
+ {% } %}
+ </div>
+ {% } %}
+ </fieldset>
+ </form>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
+ <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="addResourceInstance();">Add</button>
+ </div>
+ </div>
+ </div>
+</div>
+</script>
+
+<div id="mainContent">
+
+
+<jsp:invoke fragment="libs"></jsp:invoke>
+
+<div class="${cssClass}">
+<jsp:doBody/>
+</div>
+
+</div>
+</div>
+
+</body>
+</html>
+
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/imageUpload.tag b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/imageUpload.tag
new file mode 100644
index 0000000..6ef5d18
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/imageUpload.tag
@@ -0,0 +1,42 @@
+<%--
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+--%>
+<%@tag description="form div to upload an icon" pageEncoding="UTF-8"%>
+
+<%@attribute name="label" required="true" description="LAbel to be used. Also used as title of the dialog"%>
+<%@attribute name="URL" required="true" description="URL to post to"%>
+<%@attribute name="id" required="true" description="id to form basis for ...Diag: id of diag; ...Form: id of input field used for file upload; ...Img: Image to refresh"%>
+<%@attribute name="accept" description="if not null/'': list of accepted MIME file types"%>
+<%@attribute name="width" required="true" description="Width of the image to display"%>
+<%@attribute name="resize" description="if not null/'': enables image resizing. Currently not supported"%>
+
+<%@taglib prefix="t" tagdir="/WEB-INF/tags" %>
+
+<t:simpleSingleFileUpload
+ title="Upload ${label}"
+ text="File"
+ additionalDropZone="#${id}FormGroup"
+ URL="${URL}"
+ type="PUT"
+ id="${id}"
+ accept="${accept}"/>
+
+<div id="${id}FormGroup" class="form-group">
+ <label for="${id}DisplayDiv">${label}</label>
+ <div id="${id}DisplayDiv" style="width:100%">
+ <div class="col-md-2">
+ <a href="${URL}" target="_blank"><img id="${id}Img" style="width:${width};" src="${URL}" alt="n/a" /></a>
+ </div>
+ <button class="btn btn-default btn-xs" type="button" onClick="$('#${id}Diag').modal('show');">Upload...</button> or drop the image in this area.
+ </div>
+</div>
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/namespaceChooser.tag b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/namespaceChooser.tag
new file mode 100644
index 0000000..56b0712
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/namespaceChooser.tag
@@ -0,0 +1,52 @@
+<%--
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+--%>
+<%@tag description="places a bootstrap form control to chooose a namespace. A new namespace can be created" pageEncoding="UTF-8"%>
+
+<!--
+ This tag is shared at repository and topologytemplate.
+ Both versions differ from each other.
+ In the repository, ns.decoded is used.
+ In the topology modeler only "ns" is used:
+ In other words: The topology modeler passes a Collection<String>, whereas repository passes Collection<Namespace>
+ -->
+
+<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
+<%@attribute name="allNamespaces" required="true" type="java.util.Collection" description="All known namespaces"%>
+<%@attribute name="idOfInput" required="true" description="The id if the input field storing the namespace. Also used as name"%>
+<%@attribute name="nameOfInput" required="false" description="The name if the input field storing the namespace. If not provided, ifOfInput is used"%>
+<%@attribute name="selected" description="The currently selected namespace (optional)"%>
+
+<c:if test="${empty nameOfInput}"><c:set var="nameOfInput" value="${idOfInput}"></c:set></c:if>
+
+<!-- createArtifactTemplate class is required for artifactcreationdialog -->
+<div class="form-group createArtifactTemplate">
+ <label for="${idOfInput}" class="control-label">Namespace</label>
+ <input type="hidden" class="form-control" name="${nameOfInput}" id="${idOfInput}"></input>
+</div>
+
+<script>
+// we have to use data as select2 does not allow "createSearchChoice" when using <select> as underlying html element
+$("#${idOfInput}").select2({
+ createSearchChoice: function(term) {
+ // enables creation of new namespaces
+ return {id:term, text:term};
+ },
+ data:[
+ <c:forEach var="ns" items="${allNamespaces}" varStatus="loop">
+ {id:"${ns.decoded}",text:"${ns.decoded}"}<c:if test="${!loop.last}">,</c:if>
+ </c:forEach>
+ ]
+}).select2("val", "${selected}");
+</script>
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/parameters/parametersHTML.tag b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/parameters/parametersHTML.tag
new file mode 100644
index 0000000..7474851
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/parameters/parametersHTML.tag
@@ -0,0 +1,38 @@
+<%--
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+--%>
+<%@tag description="Input or Output parameters" pageEncoding="UTF-8"%>
+
+<%@attribute name="label" required="true" %>
+<%@attribute name="inOrOut" required="true" %>
+<%@attribute name="tableId" required="true" %>
+<%@attribute name="baseURL" required="true" description="JavaScript expression for determining the baseURL"%>
+
+<div class="row">
+ <div class="row listheading">
+ <button class="rightbutton btn btn-danger btn-xs" type="button" onclick="delete${inOrOut}putParameter(${baseURL});" id="remove${inOrOut}ParBtn">Remove</button>
+ <button class="rightbutton btn btn-primary btn-xs" type="button" onclick="create${inOrOut}putParameter(${baseURL});" id="add${inOrOut}ParBtn">Add</button>
+ <label>${label}</label>
+ </div>
+ <table class="row" id="${tableId}">
+ <thead>
+ <tr>
+ <th>Name</th>
+ <th>Type</th>
+ <th>Required</th>
+ </tr>
+ </thead>
+ <tbody>
+ </tbody>
+ </table>
+</div>
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/parameters/parametersInput.tag b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/parameters/parametersInput.tag
new file mode 100644
index 0000000..73b8c1b
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/parameters/parametersInput.tag
@@ -0,0 +1,20 @@
+<%--
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+--%>
+<%@tag pageEncoding="UTF-8"%>
+
+<%@attribute name="baseURL" required="true" description="JavaScript expression for determining the baseURL"%>
+
+<%@ taglib prefix="p" tagdir="/WEB-INF/tags/parameters" %>
+
+<p:parametersHTML label="Input Parameters" tableId="inputparameterstab" baseURL="${baseURL}" inOrOut="In"></p:parametersHTML>
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/parameters/parametersJS.tag b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/parameters/parametersJS.tag
new file mode 100644
index 0000000..021c8c0
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/parameters/parametersJS.tag
@@ -0,0 +1,177 @@
+<%--
+/*******************************************************************************
+ * Copyright (c) 2012-2013,2015 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+--%>
+<%@tag description="Input and Output parameters handling. Used at interface/operation and plan" pageEncoding="UTF-8"%>
+
+<%@attribute name="afterLoad" description="JavaScript code to be executed after successfully loading/initialization"%>
+
+<script>
+var inputParametersTableInfo = {
+ id: '#inputparameterstab'
+};
+
+var outputParametersTableInfo = {
+ id: '#outputparameterstab'
+};
+
+$(function() {
+ // for options see http://datatables.net/usage/options#sDom
+ var opts = {
+ "sDom": '<"H"r>t<"F"ip>',
+ "iDisplayLength" : 3
+ };
+
+ require(["winery-support"], function(ws) {
+ ws.initTable(inputParametersTableInfo, opts);
+ $(inputParametersTableInfo.id).click(function(event) {
+ if (inputParametersTableInfo.selectedRow) {
+ // something has been selected
+ $("#removeInParBtn").removeAttr("disabled");
+ } else {
+ // row has been deselected
+ $("#removeInParBtn").attr("disabled", "disabled");
+ }
+ });
+
+ ws.initTable(outputParametersTableInfo, opts, function() {
+ ${afterLoad}
+ });
+ $(outputParametersTableInfo.id).click(function(event) {
+ if (outputParametersTableInfo.selectedRow) {
+ // something has been selected
+ $("#removeOutParBtn").removeAttr("disabled");
+ } else {
+ // row has been deselected
+ $("#removeOutParBtn").attr("disabled", "disabled");
+ }
+ });
+ });
+
+});
+
+function afterInputParameterCreation(serializedArray, resData, textStatus, jqXHR) {
+ var required;
+ if (serializedArray.length == 2) {
+ required = "no";
+ } else {
+ required = serializedArray[2].value;
+ }
+ addRowToParameterstable(inputParametersTableInfo, serializedArray[0].value, serializedArray[1].value, required);
+}
+
+function afterOutputParameterCreation(serializedArray, resData, textStatus, jqXHR) {
+ var required;
+ if (serializedArray.length == 2) {
+ required = "no";
+ } else {
+ required = serializedArray[2].value;
+ }
+ addRowToParameterstable(outputParametersTableInfo, serializedArray[0].value, serializedArray[1].value, required);
+}
+
+function createInputParameter(baseURL) {
+ var url = baseURL + "inputparameters/";
+ createResource('Input Parameter', [
+ {'label': 'Name', 'name':'name'},
+ {
+ label: 'Type',
+ name: 'type',
+ hint:'TOSCA v1.0 does not specify any type system here. The content of this field is a string. The concrete semantics is left open. The convension is to use the xsd prefix for XML Schema basic types.'
+ },
+ {'label':'Required', 'name':'required', 'type': 'checkbox'}
+ ],
+ url,
+ afterInputParameterCreation);
+}
+
+function createOutputParameter(baseURL) {
+ var url = baseURL + "outputparameters/";
+ createResource('Output Parameter', [
+ {'label': 'Name', 'name':'name'},
+ {
+ label: 'Type',
+ name: 'type',
+ hint:'TOSCA v1.0 does not specify any type system here. The content of this field is a string. The concrete semantics is left open. The convension is to use the xsd prefix for XML Schema basic types.'
+ },
+ {'label':'Required', 'name':'required', 'type': 'checkbox'}
+ ],
+ url,
+ afterOutputParameterCreation);
+}
+
+function addRowToParameterstable(tableInfo, name, type, required) {
+ var checked;
+ required = required.toLowerCase();
+ if ((required == "yes") || (required == "on")) {
+ checked = ' checked="checked"';
+ } else {
+ checked = "";
+ }
+ var checkbox = '<input type="checkbox"' + checked + ' disabled="disabled"></input>';
+ var addData = [name, type, checkbox];
+ tableInfo.table.fnAddData(addData);
+}
+
+function deleteInputParameter() {
+ deleteOnServerAndInTable(inputParametersTableInfo, "Input Parameter", getOperationURL() + "inputparameters/");
+}
+
+function deleteOutputParameter() {
+ deleteOnServerAndInTable(outputParametersTableInfo, "Output Parameter", getOperationURL() + "outputparameters/");
+}
+
+/**
+ * only called if operation is selected
+ *
+ * @param url: the URL to query the parameters data
+ * @param inOrOut: "In"|"Out"
+ */
+function updateParameters(url, tableInfo, inOrOut) {
+ $.ajax({
+ "url": url,
+ dataType: "json",
+ success: function(data) {
+ tableInfo.table.fnClearTable();
+ $.each(data, function(number, item) {
+ var paramURL = url + item + "/";
+ $.ajax({
+ async: false,
+ dataType: "json",
+ url: paramURL,
+ error: function(jqXHR, textStatus, errorThrown) {
+ vShowAJAXError("Could not fetch operation information", jqXHR, errorThrown);
+ },
+ success: function(data) {
+ addRowToParameterstable(tableInfo, data.name, data.type, data.required);
+ }
+ });
+ });
+ $("#add" + inOrOut + "ParBtn").removeAttr("disabled");
+
+ // remove button should always be disalbed as it gets enabled only after clicking a row in the table
+ $("#remove" + inOrOut + "ParBtn").attr("disabled", "disabled");
+ },
+ error: function(jqXHR, textStatus, errorThrown) {
+ vShowAJAXError("Could not fetch interface", jqXHR, errorThrown);
+ }
+ });
+}
+
+function updateInputAndOutputParameters(baseURL) {
+ var url = baseURL + "inputparameters/";
+ updateParameters(url, inputParametersTableInfo, "In");
+ url = baseURL + "outputparameters/";
+ updateParameters(url, outputParametersTableInfo, "Out");
+}
+
+</script>
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/parameters/parametersOutput.tag b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/parameters/parametersOutput.tag
new file mode 100644
index 0000000..32a5565
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/parameters/parametersOutput.tag
@@ -0,0 +1,20 @@
+<%--
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+--%>
+<%@tag pageEncoding="UTF-8"%>
+
+<%@attribute name="baseURL" required="true" description="JavaScript expression for determining the baseURL"%>
+
+<%@ taglib prefix="p" tagdir="/WEB-INF/tags/parameters" %>
+
+<p:parametersHTML label="Output Parameters" tableId="outputparameterstab" baseURL="${baseURL}" inOrOut="Out"></p:parametersHTML>
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/relationshiptype/validnodetypeendingsselect.tag b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/relationshiptype/validnodetypeendingsselect.tag
new file mode 100644
index 0000000..1e0702d
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/relationshiptype/validnodetypeendingsselect.tag
@@ -0,0 +1,43 @@
+<%--
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+--%>
+<%@tag description="Offers choice for valid endings" pageEncoding="UTF-8"%>
+
+<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+
+<%@attribute name="shortName" required="true" description="source|target"%>
+<%@attribute name="currentSelection" required="false"%>
+<%@attribute name="possibleValidEndings" type="java.util.Collection" %>
+
+
+<select name="valid${shortName}" onchange="updateValue('valid${shortName}', this.options[this.selectedIndex].value);">
+ <c:choose>
+ <c:when test="${empty currentSelection}">
+ <option value="" selected="selected">(all)</option>
+ </c:when>
+ <c:otherwise>
+ <option value="">(all)</option>
+ </c:otherwise>
+ </c:choose>
+ <c:forEach var="typeId" items="${possibleValidEndings}">
+ <c:choose>
+ <c:when test="${currentSelection eq typeId.QName}">
+ <c:set var="selected" value=" selected=\"selected\"" />
+ </c:when>
+ <c:otherwise>
+ <c:set var="selected" value="" />
+ </c:otherwise>
+ </c:choose>
+ <option value="${typeId.QName}"${selected}>${typeId.xmlId.decoded} (${typeId.namespace.decoded})</option>
+ </c:forEach>
+</select>
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/servicetemplates/boundarydefinitions/browseForReqOrCap.tag b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/servicetemplates/boundarydefinitions/browseForReqOrCap.tag
new file mode 100644
index 0000000..5195f9b
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/servicetemplates/boundarydefinitions/browseForReqOrCap.tag
@@ -0,0 +1,161 @@
+<%--
+/*******************************************************************************
+ * Copyright (c) 2014 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+--%>
+
+<%@tag pageEncoding="UTF-8"%>
+
+<%@attribute name="label" description="Requirement|Capability" required="true" %>
+<%@attribute name="requirementsOrCapabilities" description="requirements|capabilities" required="true" %>
+<%@attribute name="reqOrCap" description="requirement|capability" required="true" %>
+
+<%@taglib prefix="b" tagdir="/WEB-INF/tags/servicetemplates/boundarydefinitions"%>
+
+<b:browseForX XShort="${reqOrCap}" XLong="${label}" />
+
+<div class="modal fade" id="${reqOrCap}Diag">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+ <h4 class="modal-title"><span id="addOrUpdate${reqOrCap}Span"></span> ${label}</h4>
+ </div>
+ <div class="modal-body">
+ <form>
+ <fieldset>
+ <div class="form-group">
+ <label for="${reqOrCap}Name">Name</label>
+ <div>
+ <input name="${reqOrCap}Name" id="${reqOrCap}Name" class="form-control" type="text">
+ </div>
+ </div>
+ <div class="form-group">
+ <label for="${reqOrCap}RefDiv">${label}</label>
+ <div id="${reqOrCap}RefDiv" class="row">
+ <div class="col-xs-10">
+ <input id="X${reqOrCap}Ref" class="form-control" type="text"> <%-- The input id is prefixed with "X" as "requirementRef" alone does not work --%>
+ </div>
+ <div class="col-xs-2">
+ <button type="button" class="btn btn-default btn-sm" onclick="browseFor${reqOrCap}($('#XReqRef'));">Browse</button>
+ </div>
+ </div>
+ </div>
+ </fieldset>
+ </form>
+ </div>
+
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
+ <button id="add${reqOrCap}" type="button" class="btn btn-primary" onclick="addorUpdate${reqOrCap}(false);">Add</button>
+ <button id="delete${reqOrCap}" type="button" class="btn btn-danger" onclick="delete${reqOrCap}t();">Delete</button>
+ <button id="update${reqOrCap}" type="button" class="btn btn-primary" onclick="addorUpdate${reqOrCap}(true);">Update</button>
+ </div>
+ </div>
+ </div>
+</div>
+
+
+<script>
+/**
+ * Triggered by the browse button at requirements. In the dialog Add/Change Requirement
+ */
+function browseFor${reqOrCap}(field) {
+ $("#${reqOrCap}ReferenceField").val($("#X${reqOrCap}Ref").val());
+ $("#browseFor${reqOrCap}Diag").modal("show");
+}
+
+/**
+ * Called by click on "Set" button at the browseForReqDiag
+ */
+function set${reqOrCap}Ref() {
+ $("#X${reqOrCap}Ref").val($("#${reqOrCap}ReferenceField").val());
+ $("#browseFor${reqOrCap}Diag").modal("hide");
+}
+
+/**
+ * Called from the modal after the user clicks "Add" or "Delete"
+ */
+function addorUpdate${reqOrCap}(update) {
+ var data = {
+ name: $("#${reqOrCap}Name").val(),
+ ref: $("#X${reqOrCap}Ref").val()
+ }
+
+ $.ajax({
+ url: "boundarydefinitions/${requirementsOrCapabilities}/",
+ data: data,
+ type: "POST"
+ }).fail(function(jqXHR, textStatus, errorThrown) {
+ vShowAJAXError("Could not add ${label}", jqXHR, errorThrown);
+ }).done(function(id) {
+ // data is the new id
+ var tableRow = [id, data.name, data.ref];
+ ${requirementsOrCapabilities}TableInfo.table.fnAddData(tableRow);
+
+ if (update) {
+ // update is implemented as delete + recreate
+ // after successfull creation, we can delete
+ deleteOnServerAndInTable(${requirementsOrCapabilities}TableInfo, '${label}', 'boundarydefinitions/${requirementsOrCapabilities}/', undefined, undefined, undefined, true);
+ // TODO: we should hook into onSuccess/onError, but currently these are not exposed from deleteResource to deleteOnServerAndInTable
+ vShowSuccess("Successfully updated ${label}.");
+ } else {
+ vShowSuccess("Successfully added ${label}.");
+ }
+
+
+ $('#${reqOrCap}Diag').modal('hide');
+ });
+};
+
+function deleteRequirement() {
+ $('#${reqOrCap}Diag').modal('hide');
+ $("#delete${reqOrCap}").click();
+}
+
+/**
+ * Called from the buttons in the table if the user clicks "Add" or "Edit"
+ */
+function open${reqOrCap}Editor(update) {
+ if (update) {
+ if (${requirementsOrCapabilities}TableInfo.selectedRow) {
+ require(["winery-support"], function(ws) {
+ if (ws.isEmptyTable(${requirementsOrCapabilities}TableInfo)) {
+ vShowError("No ${requirementsOrCapabilities} available");
+ return;
+ }
+
+ var data = ${requirementsOrCapabilities}TableInfo.table.fnGetData(${requirementsOrCapabilities}TableInfo.table.selectedRow);
+ // we don't require the id as deleteOnServerAndInTable automatically deletes the selectedRow
+ $("#${reqOrCap}Name").val(data[0][1]);
+ $("#X${reqOrCap}Ref").val(data[0][2]);
+
+ $("#add${reqOrCap}").hide();
+ $("#update${reqOrCap}").show();
+ $("#delete${reqOrCap}").show();
+
+ $("#addOrUpdate${reqOrCap}Span").text("Change");
+ $('#${reqOrCap}Diag').modal('show');
+ });
+ } else {
+ vShowError("No ${label} selected");
+ }
+ } else {
+ // create a new req/cap
+ $("#add${reqOrCap}").show();
+ $("#update${reqOrCap}").hide();
+ $("#delete${reqOrCap}").hide();
+ $("#addOrUpdate${reqOrCap}Span").text("Add");
+ $('#${reqOrCap}Diag').modal('show');
+ }
+}
+
+</script>
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/servicetemplates/boundarydefinitions/browseForServiceTemplatePropertyReqOrCap.tag b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/servicetemplates/boundarydefinitions/browseForServiceTemplatePropertyReqOrCap.tag
new file mode 100644
index 0000000..430d4db
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/servicetemplates/boundarydefinitions/browseForServiceTemplatePropertyReqOrCap.tag
@@ -0,0 +1,166 @@
+<%--
+/*******************************************************************************
+ * Copyright (c) 2013-2014 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+--%>
+
+<%@tag pageEncoding="UTF-8"%>
+
+<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+<%@taglib prefix="bd" tagdir="/WEB-INF/tags/servicetemplates/boundarydefinitions" %>
+
+<%@attribute name="definedPropertiesAsJSONString" required="true" %>
+
+<div class="modal fade z1051" id="browseForServiceTemplatePropertyDiag" >
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+ <h4 class="modal-title">Choose Property of Service Template</h4>
+ </div>
+
+ <div class="modal-body">
+ <p class="text-info">Please click on a node to select the element</p>
+ <div id='propertymappingstree'></div>
+ <form>
+ <fieldset>
+ <div class="form-group">
+ <label for="newServiceTemplatePropertyRef">Reference to the property of the Service Template</label>
+ <input type="text" id="newServiceTemplatePropertyRef" class="form-control" />
+ </div>
+ </fieldset>
+ </form>
+ </div>
+
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
+ <button type="button" class="btn btn-primary" onclick="setServiceTemplatePropertyRef();">Set</button>
+ </div>
+ </div>
+ </div>
+</div>
+
+<%-- Browse for property --%>
+<%--
+The following cannot be used as we return TWO things: the template and the property
+<bd:browseForX XShort="Property" XLong="Node Template, Relationship Template, or directly a property" />
+--%>
+<div class="modal fade z1051" id="browseForTemplateProperty">
+ <div class="modal-dialog" style="width:1000px;">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+ <h4 class="modal-title">Choose Node Template, Relationship Template, or directly a property</h4>
+ </div>
+
+ <div class="modal-body">
+ <p class="text-info">Please click on the desired element</p>
+ <iframe id="topologyTemplatePreview" class="topologyTemplatePreviewSizing" src="topologytemplate/?view=propertySelection&script=${pageContext.request.contextPath}/js/boundaryDefinitionsXSelection.js"></iframe>
+ <form>
+ <fieldset>
+ <div class="form-group">
+ <label for="newObjectRef">Reference to the object in the topology template</label>
+ <input type="text" id="newObjectRef" class="form-control newObjectRef" /> <%-- newObjectRef required as --%>
+ </div>
+ <div class="form-group">
+ <label for="newObjectPropertyRef">Reference to the object's property</label>
+ <input type="text" id="newObjectPropertyRef" class="form-control" />
+ </div>
+ </fieldset>
+ </form>
+ </div>
+
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
+ <button type="button" class="btn btn-primary" onclick="setTemplateAndTemplatePropertyRef();">Set</button>
+ </div>
+ </div>
+ </div>
+</div>
+
+<bd:browseForReqOrCap label="Requirement" reqOrCap="Req" requirementsOrCapabilities="requirements"/>
+<bd:browseForReqOrCap label="Capability" reqOrCap="Cap" requirementsOrCapabilities="capabilities"/>
+
+<script>
+//global variable to hold the reference to the input field where the selection of the service template property should be written into
+//Requried as both a property mapping and a property constraint refer to a property of the service template.
+var fieldToWriteSelectedServiceTemplateProperty;
+
+function setServiceTemplatePropertyRef() {
+ fieldToWriteSelectedServiceTemplateProperty.val($("#newServiceTemplatePropertyRef").val());
+ $("#browseForServiceTemplatePropertyDiag").modal("hide");
+}
+
+function browseForServiceTemplateProperty(field) {
+ fieldToWriteSelectedServiceTemplateProperty = field;
+ $("#newServiceTemplatePropertyRef").val(field.val());
+ $("#browseForServiceTemplatePropertyDiag").modal("show");
+}
+
+
+/**
+ * Opens topology and lets user select a node template, relationship template,
+ */
+function browseForTemplateAndProperty() {
+ $("#newObjectRef").val($("#targetObjectRef").val());
+ $("#newObjectPropertyRef").val($("#targetPropertyRef").val());
+ $("#browseForTemplateProperty").modal("show");
+}
+
+function setTemplateAndTemplatePropertyRef() {
+ $("#targetObjectRef").val($("#newObjectRef").val());
+ // always copy over targetPropertyRef, even if it's empty
+ $("#targetPropertyRef").val($("#newObjectPropertyRef").val());
+
+ $("#browseForTemplateProperty").modal("hide");
+}
+
+<c:if test="${not empty definedPropertiesAsJSONString}">
+// initialize the xmltree of the service template properties
+// xmltree has to be inialized once and not more than once
+// Therefore, we put it here and not in some shown events
+require(["xmltree"], function(xmltree) {
+ new xmltree({
+ xml: '${definedPropertiesAsJSONString}',
+ container: '#propertymappingstree',
+ startCollapsed: false,
+ clickCallback: serviceTemplatePropertyClicked
+ });
+});
+</c:if>
+
+function serviceTemplatePropertyClicked(li, xpath, event) {
+ require(["winery-support"], function(ws) {
+ var pathFragmentRegExp = ws.QName_RegExp + "(.*)";
+ var pathFragmentPattern = new RegExp(pathFragmentRegExp);
+
+ // Transform the XPath to an XPath being namespace unaware
+ // This is required as the OpenTOSCA container does not implement XPath processing in a namespace-aware manner
+ var fragments = xpath.split("/");
+ var path = [];
+ $(fragments).each(function(i,e) {
+ var res = pathFragmentPattern.exec(e);
+ if (res != null) {
+ if (typeof res[1] !== undefined) {
+ e = "*[local-name()='" + res[3] + "']" + res[5];
+ }
+ }
+ path.push(e);
+ });
+ xpath = path.join("/");
+
+ $("#newServiceTemplatePropertyRef").val(xpath);
+ });
+}
+
+/* communication with the iframe is at boundarydefinitions.jsp as we also need it for "Interfaces" */
+
+</script> \ No newline at end of file
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/servicetemplates/boundarydefinitions/browseForX.tag b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/servicetemplates/boundarydefinitions/browseForX.tag
new file mode 100644
index 0000000..4b38b62
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/servicetemplates/boundarydefinitions/browseForX.tag
@@ -0,0 +1,49 @@
+<%--
+/*******************************************************************************
+ * Copyright (c) 2014 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+--%>
+
+<%@tag pageEncoding="UTF-8"%>
+
+<%@attribute name="XShort" description="The X to browse for. Short form. E.g., Req, Cap, ..." required="true" %>
+<%@attribute name="XLong" description="The X to browse for. Long form. E.g., Requirement, Capability, ..." required="true" %>
+
+
+<%-- Browse for property --%>
+<div class="modal fade z1051" id="browseFor${XShort}Diag">
+ <div class="modal-dialog" style="width:1000px;">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+ <h4 class="modal-title">Choose a ${XLong}</h4>
+ </div>
+
+ <div class="modal-body">
+ <p class="text-info">Please click on the desired ${XLong}</p>
+ <iframe id="topologyTemplatePreview" class="topologyTemplatePreviewSizing" src="topologytemplate/?view=${XShort}Selection&script=${pageContext.request.contextPath}/js/boundaryDefinitionsXSelection.js"></iframe>
+ <form>
+ <fieldset>
+ <div class="form-group">
+ <label for="${XShort}RefeferenceField">Reference to the ${XLong} in the topology template</label>
+ <input type="text" id="${XShort}ReferenceField" class="form-control newObjectRef" />
+ </div>
+ </fieldset>
+ </form>
+ </div>
+
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
+ <button type="button" class="btn btn-primary" onclick="set${XShort}Ref();">Set</button>
+ </div>
+ </div>
+ </div>
+</div>
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/simpleSingleFileUpload.tag b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/simpleSingleFileUpload.tag
new file mode 100644
index 0000000..9774ba3
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/simpleSingleFileUpload.tag
@@ -0,0 +1,114 @@
+<%--
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation and/or initial documentation
+ * Yves Schubert - switch to bootstrap 3
+ *******************************************************************************/
+--%>
+<%@tag description="Global Wrapper" pageEncoding="UTF-8"%>
+
+<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+
+<%@attribute name="title" required="true" description="title of the dialog"%>
+<%@attribute name="text" required="true" description="text to show before upload box"%>
+<%@attribute name="URL" required="true" description="URL to post to"%>
+<%@attribute name="type" required="true" description="PUT|POST"%>
+<%@attribute name="additionalDropZone" required="false" description="jQuery selector for an additional dropzone"%>
+<%@attribute name="id" required="true" description="id to form basis for ...Diag: id of diag; ...Form: id of input field used for file upload; ...Img: Image to refresh"%>
+<%@attribute name="accept" description="if not null/'': list of accepted MIME file types"%>
+<%@attribute name="resize" description="if not null/'': enables image resizing. Currently not supported"%>
+
+<div class="modal fade" id="${id}Diag">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+ <h4 class="modal-title">${title}</h4>
+ </div>
+ <div class="modal-body">
+ <form>
+ <fieldset>
+ <div class="form-group">
+ <label for="${id}Form">${text}:</label>
+ <input id="${id}Form" class="form-control" type="file" name="${id}Form" <c:if test="${!empty accept}">accept="${accept}"</c:if> />
+ </div>
+ </fieldset>
+ <p>You may also <strong>drop the file</strong> here.</p>
+ <p>The file is <strong>immediately</strong> uploaded without any confirmation.</p>
+ </form>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" data-dismiss="modal" data-loading-text="Uploading..." id="cancelfileuploadbtn">Cancel</button>
+ </div>
+ </div>
+ </div>
+</div>
+
+<script>
+/**
+ * We cannot use jQuery's ",", because this leads to multiple uploads at a single drop.
+ * Therefore, we introduced that function
+ */
+function bindFileUploadForSingleFileUpload(selector) {
+ requirejs(["jquery.fileupload"], function(){
+ $(selector).fileupload({
+ dataType: 'json',
+ url: '${URL}',
+ type: '${type}',
+ dropZone: $(selector),
+ paramName: 'file',
+ autoUpload: true
+ }).bind("fileuploadstart", function(e) {
+ $("#cancelfileuploadbtn").button("loading");
+ }).bind('fileuploadfail', function(e, data) {
+ vShowAJAXError("File upload failed", data.jqXHR, data.errorThrown);
+ $("#cancelfileuploadbtn").button("reset");
+ }).bind('fileuploaddone', function(e, data) {
+ var text = "File uploaded successfully.";
+ var responseText = data.jqXHR.responseText;
+ if (responseText != "") {
+ // we expect a JSON array
+ var response = $.parseJSON(responseText);
+ if (response.length == 0) {
+ // some JSON parsing error, just display the text itself
+ text = text + "<br /><br />With following issues, possibly wrong<br />" + responseText;
+ } else if (response.length == 1) {
+ text = text + "<br /><br />With following issue<br />" + response[0];
+ } else {
+ text = text + "<br /><br />With following issues, possibly wrong<br /><ul>";
+ $(response).each(function(i,e) {
+ text = text + "<li>" + e + "</li>";
+ });
+ text = text + "</ul>";
+ }
+ }
+ vShowSuccess(text);
+ $("#cancelfileuploadbtn").button("reset");
+ $('#${id}Diag').modal('hide');
+
+ // refresh the image
+ img = $('#${id}Img');
+ if (img.length === 1) {
+ src = img.attr('src');
+ queryPos = src.indexOf('?');
+ if(queryPos != -1) {
+ src = src.substring(0, queryPos);
+ }
+ img.attr('src', src + '?' + Math.random());
+ }
+ });
+ });
+}
+
+$(function() {
+ bindFileUploadForSingleFileUpload("#${id}Diag");
+ <c:if test="${not empty additionalDropZone}">bindFileUploadForSingleFileUpload("${additionalDropZone}");</c:if>
+});
+</script>
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/submenu.tag b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/submenu.tag
new file mode 100644
index 0000000..0e6a320
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/submenu.tag
@@ -0,0 +1,26 @@
+<%--
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+--%>
+<!-- basic idea by http://stackoverflow.com/a/3257426/873282 -->
+<%@tag description="submenu" pageEncoding="UTF-8"%>
+
+<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+
+<%@attribute name="subMenuData" required="true" type="org.eclipse.winery.repository.resources.SubMenuData"%>
+<%@attribute name="selected" required="true"%>
+
+<a href="${subMenuData.href}" class="styledTabMenuButton styledTabMenuButton2ndlevel<c:if test="${selected}"> selected</c:if>">
+ <div class="left"></div>
+ <div class="center">${subMenuData.text}</div>
+ <div class="right"></div>
+</a>
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/topologyTemplateRenderer.tag b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/topologyTemplateRenderer.tag
new file mode 100644
index 0000000..5f0aaa4
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/topologyTemplateRenderer.tag
@@ -0,0 +1,208 @@
+<%--
+/*******************************************************************************
+ * Copyright (c) 2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Pascal Hirmer - skeletton for topology rendering
+ * Oliver Kopp - converted to .tag and integrated in the repository
+ *******************************************************************************/
+--%>
+<%@tag description="Renders a toplogytemplate. This tag is used to render a topology template readonly. The topoology modeler does the rendering on itself." pageEncoding="UTF-8" %>
+
+<%@tag import="java.lang.Math"%>
+<%@tag import="java.util.ArrayList"%>
+<%@tag import="java.util.Collection"%>
+<%@tag import="java.util.Map"%>
+<%@tag import="java.util.HashMap"%>
+<%@tag import="java.util.UUID"%>
+<%@tag import="javax.xml.namespace.QName"%>
+<%@tag import="org.eclipse.winery.common.ModelUtilities"%>
+<%@tag import="org.eclipse.winery.model.tosca.TEntityTemplate"%>
+<%@tag import="org.eclipse.winery.model.tosca.TNodeTemplate"%>
+<%@tag import="org.eclipse.winery.model.tosca.TNodeType"%>
+<%@tag import="org.eclipse.winery.model.tosca.TRelationshipTemplate"%>
+<%@tag import="org.eclipse.winery.model.tosca.TRelationshipTemplate.SourceElement"%>
+<%@tag import="org.eclipse.winery.model.tosca.TRelationshipTemplate.TargetElement"%>
+<%@tag import="org.eclipse.winery.model.tosca.TRelationshipType"%>
+<%@tag import="org.eclipse.winery.model.tosca.TTopologyTemplate"%>
+<%@tag import="org.eclipse.winery.repository.Utils"%>
+
+<%@attribute name="topology" required="true" description="the topology template to be rendered" type="org.eclipse.winery.model.tosca.TTopologyTemplate" %>
+<%@attribute name="repositoryURL" required="true" %>
+<%@attribute name="client" required="true" type="org.eclipse.winery.common.interfaces.IWineryRepository" %>
+<%@attribute name="fullscreen" required="false" type="java.lang.Boolean" %>
+<%@attribute name="additonalCSS" required="false"%>
+<%@attribute name="autoLayoutOnLoad" required="false" type="java.lang.Boolean" %>
+
+<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+<%@taglib prefix="tmpl" tagdir="/WEB-INF/tags/common/templates" %>
+<%@taglib prefix="nt" tagdir="/WEB-INF/tags/common/templates/nodetemplates" %>
+<%@taglib prefix="w" uri="http://www.eclipse.org/winery/repository/functions"%>
+
+<%-- required for vShowError --%>
+<script type="text/javascript" src="${w:topologyModelerURI()}/components/pnotify/jquery.pnotify.js"></script>
+<script type="text/javascript" src="${w:topologyModelerURI()}/js/winery-common.js"></script>
+
+<%-- required for vShowError --%>
+<link type="text/css" href="${w:topologyModelerURI()}/components/pnotify/jquery.pnotify.default.css" media="all" rel="stylesheet" />
+<link type="text/css" href="${w:topologyModelerURI()}/components/pnotify/jquery.pnotify.default.icons.css" media="all" rel="stylesheet" />
+
+<%-- winery-common.css also contains definitions for properties --%>
+<link type="text/css" href="${w:topologyModelerURI()}/css/winery-common.css" rel="stylesheet" />
+<link type="text/css" href="${w:topologyModelerURI()}/css/topologytemplatecontent.css" rel="stylesheet" />
+<link rel="stylesheet" href="${pageContext.request.contextPath}/css/topologyTemplateRenderer.css" />
+<c:if test="${not empty fullscreen}"><link rel="stylesheet" href="${pageContext.request.contextPath}/css/topologyTemplateRendererFullscreen.css" /></c:if>
+<c:if test="${not empty additonalCSS}"><link rel="stylesheet" href="${additonalCSS}" /></c:if>
+
+<%
+ Collection<TRelationshipType> relationshipTypes = client.getAllTypes(TRelationshipType.class);
+
+ // quick hack
+ // better would be to collect all types used in the curren topoloy template
+ Collection<TNodeType> nodeTypes = client.getAllTypes(TNodeType.class);
+%>
+
+<tmpl:CSSForTypes nodeTypes="<%=nodeTypes%>" relationshipTypes="<%=relationshipTypes%>"/>
+
+<script>
+// required by winery-common-topologyrendering
+if (typeof winery === "undefined") winery = {}
+if (typeof winery.connections === "undefined") winery.connections = {}
+
+//enable caching. This disables appending of "?_=xy" at requests
+jQuery.ajaxSetup({cache:true});
+
+//configuration for pnotify
+require(["jquery", "pnotify"], function() {
+ $.pnotify.defaults.styling = "bootstrap3";
+});
+</script>
+
+<%
+ // used for the position of the NodeTemplates
+ int topCounter = 0;
+%>
+<script>
+function doLayout() {
+ var editor = $("#editorArea");
+ var nodeTemplates = editor.find(".NodeTemplateShape");
+ require(["winery-sugiyamaLayouter"], function(layouter) {
+ layouter.layout(nodeTemplates);
+ });
+}
+</script>
+<div class="topbar">
+ <div class="topbarbuttons">
+ <button class="btn btn-default" onclick="doLayout();">Layout</button>
+ <tmpl:toggleButtons />
+ </div>
+</div>
+<%-- div #editorArea required for layouter --%>
+<div id="editorArea">
+<div id="templateDrawingArea">
+
+<tmpl:defineCreateConnectorEndpointsFunction relationshipTypes="<%=relationshipTypes%>"/>
+
+<%
+ // can be used later to call a doLayout()
+ boolean somethingWithoutPosition = false;
+
+ Collection<TRelationshipTemplate> relationshipTemplates = new ArrayList<TRelationshipTemplate>();
+ Collection<TNodeTemplate> nodeTemplates = new ArrayList<TNodeTemplate>();
+
+ // the minimum x/y coordinates.
+ // used to move the content to the top left corner
+ int minTop = Integer.MAX_VALUE;
+ int minLeft = Integer.MAX_VALUE;
+
+ for (TEntityTemplate entity: topology.getNodeTemplateOrRelationshipTemplate()) {
+ if (entity instanceof TNodeTemplate) {
+ TNodeTemplate nodeTemplate = (TNodeTemplate) entity;
+ nodeTemplates.add(nodeTemplate);
+
+ // determine minTop and minLeft
+ String top = ModelUtilities.getTop(nodeTemplate);
+ if (top != null) {
+ int intTop = Utils.convertStringToInt(top);
+ if (intTop != 0) {
+ minTop = Math.min(minTop, intTop);
+ }
+ }
+
+ String left = ModelUtilities.getLeft(nodeTemplate);
+ if (left != null) {
+ int intLeft = Utils.convertStringToInt(left);
+ if (intLeft != 0) {
+ minLeft = Math.min(minLeft, intLeft);
+ }
+ }
+
+ } else {
+ assert(entity instanceof TRelationshipTemplate);
+ relationshipTemplates.add((TRelationshipTemplate) entity);
+ }
+ }
+
+ for (TNodeTemplate nodeTemplate: nodeTemplates) {
+ // assuming the topology can be displayed as a stack, else call doLayout() afterwards
+ topCounter = topCounter + 150;
+
+ String left = ModelUtilities.getLeft(nodeTemplate);
+ if (left == null) {
+ left = "0";
+ somethingWithoutPosition = true;
+ } else {
+ // calulate offset
+ // we could hash the coordinate in the loop before
+ // but that would obfuscate the code and currently, we don't have speed issues here
+ left = Integer.toString(Utils.convertStringToInt(left) - minLeft);
+ }
+ String top = ModelUtilities.getTop(nodeTemplate);
+ if (top == null) {
+ top = Integer.toString(topCounter);
+ somethingWithoutPosition = true;
+ } else {
+ // calulate offset
+ top = Integer.toString(Utils.convertStringToInt(top) - minTop);
+ }
+%>
+ <nt:nodeTemplateRenderer top="<%=top%>" left="<%=left%>" nodeTemplate="<%=nodeTemplate%>" repositoryURL="${repositoryURL}" client="<%=client%>" relationshipTypes="<%=relationshipTypes%>" topologyModelerURI="${w:topologyModelerURI()}/" />
+<%
+ }
+ if (somethingWithoutPosition) {
+ autoLayoutOnLoad = true;
+ }
+%>
+
+<script>
+function onDoneRendering() {
+ <c:if test="${autoLayoutOnLoad}">
+ doLayout();
+ </c:if>
+
+ // copied from index.jsp -> togglePrintView
+
+ // move labels 10 px up
+ // we have to do it here as jsPlumb currently paints the label on the line instead of above of it
+ // See https://groups.google.com/d/msg/jsplumb/zdyAdWcRta0/K6F2MrHBH1AJ
+ $(".relationshipTypeLabel").each(function(i, e) {
+ var pos = $(e).offset();
+ pos.top = pos.top - 10;
+ $(e).offset(pos);
+ });
+
+ // The user can pass an additional script to the topologyTemplateResource via the script query parameter
+ // In that script, he can define the function wineryViewExternalScriptOnLoad which is called here
+ if (typeof wineryViewExternalScriptOnLoad === "function") {
+ wineryViewExternalScriptOnLoad();
+ }
+}
+</script>
+<tmpl:registerConnectionTypesAndConnectNodeTemplates repositoryURL="${repositoryURL}" relationshipTypes="<%=relationshipTypes%>" relationshipTemplates="<%=relationshipTemplates%>" ondone="onDoneRendering();" readOnly="true"/>
+</div>
+</div>
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/typeswithshortnameasselect.tag b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/typeswithshortnameasselect.tag
new file mode 100644
index 0000000..f658b2b
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/tags/typeswithshortnameasselect.tag
@@ -0,0 +1,46 @@
+<%--
+/*******************************************************************************
+ * Copyright (c) 2012-2014 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+--%>
+<%@tag description="Renders pairs of types with shortname as select element" pageEncoding="UTF-8"%>
+
+<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
+<%@attribute name="label" required="true"%>
+<%@attribute name="selectname" required="true" description="Used as Name and as Id"%>
+<%@attribute name="typesWithShortNames" required="true" type="java.util.Collection"%>
+<%@attribute name="type" required="true" description="The type of all types. E.g., planlanguage"%>
+
+<div class="form-group">
+<label for="${selectname}">${label}</label>
+
+<div style="display: block; width: 100%">
+ <select name="${selectname}" id="${selectname}" style="width:300px;">
+ <c:forEach var="t" items="${typesWithShortNames}">
+ <option value="${t.type}">${t.shortName}</option>
+ </c:forEach>
+ </select>
+ <button type="button" class="btn btn-info btn-xs" onclick="updateTypesWithShortNames();">Refresh</button>
+ <a href="${pageContext.request.contextPath}/admin/#${type}s" class="btn btn-info btn-xs" target="_blank">Manage</a>
+</div>
+</div>
+
+<script>
+function updateTypesWithShortNames() {
+ vShowNotification('not yet implemented')
+ /* Implementation idea:
+ * get on ...${type}s resource with app/json and ?select2 - this is the direct select2 data
+ * replace select element with input: select2 cannot update an input element
+ */
+}
+
+</script>
diff --git a/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/web.xml b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..b5eb167
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*******************************************************************************
+ * Copyright (c) 2012-2013,2015 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+-->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="winery" version="3.0">
+ <display-name>Winery Repository</display-name>
+ <filter>
+ <filter-name>WineryResources</filter-name>
+ <filter-class>com.sun.jersey.spi.container.servlet.ServletContainer</filter-class>
+ <init-param>
+ <param-name>com.sun.jersey.spi.container.ContainerResponseFilters</param-name>
+ <!-- RestDocFilter is required for RESTDoc. CORSFilter is required for the BPMN4TOSCA Plan Modeler -->
+ <param-value>org.eclipse.winery.repository.RestDocFilter;org.eclipse.winery.repository.CORSFilter</param-value>
+ </init-param>
+ <init-param>
+ <param-name>com.sun.jersey.config.property.packages</param-name>
+ <param-value>org.eclipse.winery.repository.resources</param-value>
+ </init-param>
+ <init-param>
+ <param-name>com.sun.jersey.config.feature.FilterForwardOn404</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ <init-param>
+ <param-name>com.sun.jersey.config.feature.CanonicalizeURIPath</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ <init-param>
+ <param-name>com.sun.jersey.config.feature.NormalizeURI</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ <init-param>
+ <param-name>com.sun.jersey.config.feature.Redirect</param-name>
+ <param-value>true</param-value>
+ </init-param>
+
+ <!-- enables @Consumes(MediaType.APPLICATION_JSON) and @Produces(MediaType.APPLICATION_JSON), see https://jersey.java.net/nonav/documentation/1.7/json.html -->
+ <init-param>
+ <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
+ <param-value>true</param-value>
+ </init-param>
+
+ </filter>
+ <filter-mapping>
+ <filter-name>WineryResources</filter-name>
+
+ <!--
+ Each resource handled by JAX-RS has to be written separately.
+ Reason:
+ * /components, /css, /images, /js are not provided by JAX-RS
+ * FilterForwardOn404 is a Jersey feature, not standardized
+ * It also forwards if a resource itself returns 404 (without an entity)
+ * The JAX-RS code should not be cluttered with Jersey specifics
+ -->
+
+ <!-- ordering as in TOSCA-v1.0.xsd of TOSCA CSD08 -->
+
+ <url-pattern>/imports/*</url-pattern>
+ <url-pattern>/servicetemplates/*</url-pattern>
+ <url-pattern>/nodetypes/*</url-pattern>
+ <url-pattern>/nodetypeimplementations/*</url-pattern>
+ <url-pattern>/relationshiptypes/*</url-pattern>
+ <url-pattern>/relationshiptypeimplementations/*</url-pattern>
+ <url-pattern>/requirementtypes/*</url-pattern>
+ <url-pattern>/capabilitytypes/*</url-pattern>
+ <url-pattern>/artifacttypes/*</url-pattern>
+ <url-pattern>/artifacttemplates/*</url-pattern>
+ <url-pattern>/policytypes/*</url-pattern>
+ <url-pattern>/policytemplates/*</url-pattern>
+
+ <!-- additional resources -->
+ <url-pattern>/</url-pattern>
+ <url-pattern>/admin/*</url-pattern>
+ <url-pattern>/API/*</url-pattern>
+ <url-pattern>/other/*</url-pattern>
+ <url-pattern>/test/*</url-pattern>
+
+ </filter-mapping>
+ <listener>
+ <listener-class>org.eclipse.winery.repository.Prefs</listener-class>
+ </listener>
+
+ <session-config>
+ <tracking-mode>COOKIE</tracking-mode>
+ </session-config>
+</web-app>