Skip to content

Commit 1d20f87

Browse files
committed
Initial Commit
1 parent 19b7aa6 commit 1d20f87

File tree

75 files changed

+1754
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1754
-0
lines changed

LICENSE.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
LICENSE
2+
3+
CouchDB Workflows for vRealize Orchestrator v1.0
4+
5+
Copyright � 2016 VMware, Inc. All rights reserved.
6+
7+
This product is licensed to you under the BSD 2-Clause (the �License�). You may not use this product except in compliance with the License.
8+
9+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
10+
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
11+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13+
14+

pom.xml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<!-- Maybe you'd like to change this to point to your organization's groupId-->
8+
<groupId>com.vmware.pso</groupId>
9+
10+
<artifactId>couchdb</artifactId>
11+
<packaging>package</packaging>
12+
<version>1.0.0</version>
13+
14+
<properties>
15+
<keystoreLocation>keystore.jks</keystoreLocation>
16+
<keystorePassword>vmware</keystorePassword>
17+
<vco.version>7.0.1</vco.version>
18+
<vcoRepoUrl>http://172.16.6.144:8280/vco-repo</vcoRepoUrl>
19+
<!-- change to vf for releases: it will lock the workflows -->
20+
<allowedMask>vef</allowedMask>
21+
</properties>
22+
23+
<repositories>
24+
<repository>
25+
<id>added-by-archetype</id>
26+
<name>This repo was added by the 'Expand to file system'</name>
27+
<url>${vcoRepoUrl}</url>
28+
</repository>
29+
</repositories>
30+
31+
<pluginRepositories>
32+
<pluginRepository>
33+
<id>added-by-archetype</id>
34+
<name>This repo was added by the 'Expand to file system'</name>
35+
<url>${vcoRepoUrl}</url>
36+
</pluginRepository>
37+
</pluginRepositories>
38+
39+
<build>
40+
<plugins>
41+
<plugin>
42+
<groupId>com.vmware.o11n.mojo.pkg</groupId>
43+
<artifactId>maven-o11n-package-plugin</artifactId>
44+
<version>${vco.version}</version>
45+
<extensions>true</extensions>
46+
<configuration>
47+
<packageName>com.vmware.pso.couchdb</packageName>
48+
<!-- Set the local path to the *.vmokeystore file used to sign the content -->
49+
<keystoreLocation>${keystoreLocation}</keystoreLocation>
50+
<keystorePassword>${keystorePassword}</keystorePassword>
51+
<includes>
52+
<include>**/*.element_info.xml</include>
53+
</includes>
54+
<packageFileName>${project.artifactId}-${project.version}</packageFileName>
55+
<allowedMask>${allowedMask}</allowedMask>
56+
<exportVersionHistory>false</exportVersionHistory>
57+
</configuration>
58+
</plugin>
59+
</plugins>
60+
</build>
61+
</project>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
3+
<properties>
4+
<comment>172.16.6.144:8281</comment>
5+
<entry key="vso-build-nb">3533702</entry>
6+
<entry key="pkg-description"></entry>
7+
<entry key="pkg-name">com.vmware.pso.couchdb</entry>
8+
<entry key="used-plugins">REST#2.0.4</entry>
9+
<entry key="pkg-owner">O=VMware,OU=Unknow,CN=vCO localhost.localdom ccd569b7-210f-4804-b3d1-1831924fa404</entry>
10+
<entry key="vso-version">7.0.1.3533702</entry>
11+
<entry key="pkg-id">4028819a546971200154698a7f6e0004</entry>
12+
</properties>
1.6 KB
Loading
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
3+
<properties>
4+
<comment>Exported from [server]</comment>
5+
<entry key="mimetype">image/png</entry>
6+
<entry key="categoryPath">CouchDB</entry>
7+
<entry key="name">couchTrans2.png</entry>
8+
<entry key="type">ResourceElement</entry>
9+
<entry key="description">Imported from : &apos;/Users/dlinsley/Pictures/couchTrans2.png&apos; on server 172.16.6.144:8281</entry>
10+
<entry key="id">8e28b251-4884-4789-923e-f0679c67b5f0</entry>
11+
</properties>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
3+
<properties>
4+
<comment>Exported from [server]</comment>
5+
<entry key="categoryPath">com.vmware.pso.couchdb</entry>
6+
<entry key="name">addUpdateDatabaseRecord</entry>
7+
<entry key="type">ScriptModule</entry>
8+
<entry key="id">35e081c3-b285-4d7e-9e6d-1edaf96016af</entry>
9+
</properties>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<dunes-script-module name="addUpdateDatabaseRecord" result-type="string" api-version="6.0.0" id="35e081c3-b285-4d7e-9e6d-1edaf96016af" version="0.0.0" allowed-operations="vef">
3+
<param n="couchHost" t="REST:RESTHost"><![CDATA[]]></param>
4+
<param n="dbName" t="string"><![CDATA[]]></param>
5+
<param n="docId" t="string"><![CDATA[(Optional)]]></param>
6+
<param n="doc" t="string"><![CDATA[]]></param>
7+
<script encoded="false"><![CDATA[var docObj = JSON.parse(doc);
8+
var requestUrl = null;
9+
if (docId != null && docId.length > 0) {
10+
docObj._id = docId;
11+
}
12+
13+
if (docObj._id != null && docObj._id.length > 0) {
14+
//potentially an existing document.
15+
requestUrl = "/"+encodeURIComponent(dbName)+"/"+encodeURIComponent(docObj._id);
16+
var request = couchHost.createRequest("HEAD",requestUrl,null);
17+
var response = request.execute();
18+
19+
if (response.statusCode == 404) {
20+
//document does not exist;
21+
} else if (response.statusCode == 200) {
22+
//document exists;
23+
var responseHeaders = response.getAllHeaders();
24+
docObj._rev = JSON.parse(responseHeaders.get("ETag"));
25+
}
26+
27+
} else {
28+
//new document
29+
var nextId = System.getModule("com.vmware.pso.couchdb").getUUIDs(couchHost,1);
30+
requestUrl = "/"+encodeURIComponent(dbName)+"/"+encodeURIComponent(nextId[0]);
31+
}
32+
33+
var updateRequest = couchHost.createRequest("PUT",requestUrl,JSON.stringify(docObj));
34+
updateRequest.contentType = "application/json";
35+
36+
var response = updateRequest.execute();
37+
38+
if (response.statusCode < 400) {
39+
return response.contentAsString;
40+
} else {
41+
throw("error");
42+
}]]></script>
43+
</dunes-script-module>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
3+
<properties>
4+
<comment>Exported from [server]</comment>
5+
<entry key="categoryPath">com.vmware.pso.couchdb</entry>
6+
<entry key="name">cleanupDatabaseViews</entry>
7+
<entry key="type">ScriptModule</entry>
8+
<entry key="id">a8676b23-21b9-4293-b4c6-545cac8ea57a</entry>
9+
</properties>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<dunes-script-module name="cleanupDatabaseViews" result-type="void" api-version="6.0.0" id="a8676b23-21b9-4293-b4c6-545cac8ea57a" version="0.0.0" allowed-operations="vef">
3+
<param n="couchHost" t="REST:RESTHost"><![CDATA[]]></param>
4+
<param n="dbName" t="string"><![CDATA[]]></param>
5+
<script encoded="false"><![CDATA[var endpoint = "/"+encodeURIComponent(dbName)+"/_view_cleanup";
6+
var response = System.getModule("com.vmware.pso.couchdb").couchPost(couchHost,endpoint,null);
7+
var responseObj;
8+
9+
try {
10+
responseObj = JSON.parse(response);
11+
} catch (e) {
12+
System.error("Expected a JSON response but received: "+response);
13+
throw("Did not receive a JSON response. Not a CouchDB Server?");
14+
}
15+
if (responseObj.ok == true) {
16+
System.log("Successfully initiated compaction for database: "+dbName);
17+
} else {
18+
System.error(responseObj.reason);
19+
throw(responseObj.reason);
20+
}]]></script>
21+
</dunes-script-module>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
3+
<properties>
4+
<comment>Exported from [server]</comment>
5+
<entry key="categoryPath">com.vmware.pso.couchdb</entry>
6+
<entry key="name">compactDatabase</entry>
7+
<entry key="type">ScriptModule</entry>
8+
<entry key="id">7a92d8a4-80d4-4081-b783-3838cc95b1a4</entry>
9+
</properties>

0 commit comments

Comments
 (0)