Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
4,892 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,16 @@ | |||
(: | |||
: Copyright 2010 Mark Logic Corporation. All Rights Reserved. | |||
:) | |||
|
|||
xquery version "1.0-ml"; | |||
import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy"; | |||
|
|||
declare namespace ai="api-install"; | |||
declare variable $ai:name as xs:string external; | |||
|
|||
let $config := admin:database-attach-forest( | |||
admin:get-configuration(), xdmp:database($ai:name), xdmp:forest($ai:name)) | |||
return ( admin:save-configuration($config), | |||
<div class="message"> | |||
A Database and Forest called {$ai:name} attached together successfully | |||
</div> ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,17 @@ | |||
(: | |||
: Copyright 2010 Mark Logic Corporation. All Rights Reserved. | |||
:) | |||
|
|||
xquery version "1.0-ml"; | |||
import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy"; | |||
|
|||
declare namespace ai="api-install"; | |||
declare variable $ai:name as xs:string external; | |||
|
|||
let $config := admin:database-create(admin:get-configuration(), $ai:name, xdmp:database("Security"), xdmp:database("Schemas")) | |||
return | |||
( | |||
admin:save-configuration($config) | |||
, | |||
<div class="message">A Database called {$ai:name} created successfully</div> | |||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,17 @@ | |||
(: | |||
: Copyright 2010 Mark Logic Corporation. All Rights Reserved. | |||
:) | |||
|
|||
xquery version "1.0-ml"; | |||
import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy"; | |||
|
|||
declare namespace ai="api-install"; | |||
declare variable $ai:name as xs:string external; | |||
|
|||
let $config := admin:forest-create(admin:get-configuration(), $ai:name, xdmp:host(), ()) | |||
return | |||
( | |||
admin:save-configuration($config) | |||
, | |||
<div class="message">A Forest called {$ai:name} created successfully</div> | |||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,24 @@ | |||
(: | |||
: Copyright 2010 Mark Logic Corporation. All Rights Reserved. | |||
:) | |||
|
|||
xquery version "1.0-ml"; | |||
import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy"; | |||
|
|||
declare namespace ai="api-install"; | |||
declare variable $ai:name as xs:string external; | |||
declare variable $ai:port as xs:string external; | |||
declare variable $ai:nodb as xs:boolean external; | |||
|
|||
(: Apps/usr :) | |||
let $config := admin:get-configuration() | |||
let $db := if ($ai:nodb) then "Documents" else $ai:name | |||
let $groupid := admin:group-get-id($config, "Default") | |||
let $new-config := admin:http-server-create($config, $groupid, $ai:name, | |||
fn:concat("Apps/usr/",$ai:name), xs:unsignedLong($ai:port), 0, xdmp:database($db) ) | |||
return | |||
( | |||
admin:save-configuration($new-config) | |||
, | |||
<div class="message">An HTTP Server called {$ai:name} with root {$ai:name} on port {$ai:port} created successfully</div> | |||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,45 @@ | |||
(: | |||
: Copyright 2010 Mark Logic Corporation. All Rights Reserved. | |||
:) | |||
xquery version "1.0-ml"; | |||
|
|||
let $doctype := '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' | |||
let $html := | |||
<html> | |||
<head> | |||
<title>API Application Setup</title> | |||
<script language="javascript" src="js/prototype.js" type="text/javascript">{" "}</script> | |||
<script type="text/javascript" language="javascript"> | |||
//<![CDATA[ | |||
function install() { | |||
var name = document.getElementById('name').value; | |||
var port = document.getElementById('port').value; | |||
var url = '/api-installer/api-setup-run.xqy?app=' + name + ':' + port; | |||
new Ajax.Updater('results', '/api-installer/get-spinner.xqy', {asynchronous:true}); | |||
new Ajax.Updater('results', url, {asynchronous:true}); | |||
} | |||
//]]> | |||
</script> | |||
</head> | |||
<body> | |||
<div style="font-weight:bold; font-size: 120%; text-align:center; padding: 20px;">API Search Install and Setup</div> | |||
<div> | |||
<span>Name: </span> | |||
<input type="textbox" id="name" /> | |||
<span>Port: </span> | |||
<input type="textbox" id="port" /> | |||
<input type="submit" value="Install" onClick="install()"/> | |||
<div id="results" style="padding: 20px; border: 1px solid #DDD; width: 500px; font-style: italic; margin-top: 20px;">{"<Current Progress>"}</div> | |||
</div> | |||
</body> | |||
</html> | |||
|
|||
return | |||
( | |||
xdmp:set-response-content-type("text/html; charset=utf-8"), | |||
$doctype, | |||
$html | |||
) | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,20 @@ | |||
(: | |||
: Copyright 2010 Mark Logic Corporation. All Rights Reserved. | |||
:) | |||
|
|||
xquery version "1.0-ml"; | |||
import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy"; | |||
|
|||
declare namespace ai="api-install"; | |||
declare variable $ai:name as xs:string external; | |||
|
|||
try { | |||
let $config := admin:get-configuration() | |||
let $config := admin:database-delete($config, xdmp:database($ai:name)) | |||
return admin:save-configuration($config) | |||
} catch ($e) { | |||
<div class="error-delete-database"> | |||
<h3>Error</h3> | |||
<div class="error-stack-trace"> { $e } </div> | |||
</div> | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,20 @@ | |||
(: | |||
: Copyright 2010 Mark Logic Corporation. All Rights Reserved. | |||
:) | |||
|
|||
xquery version "1.0-ml"; | |||
import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy"; | |||
|
|||
declare namespace ai="api-install"; | |||
declare variable $ai:name as xs:string external; | |||
|
|||
try { | |||
let $config := admin:get-configuration() | |||
let $config := admin:forest-delete($config, admin:forest-get-id($config, $ai:name), fn:true()) | |||
return admin:save-configuration($config) | |||
} catch ($e) { | |||
<div class="error-delete-forest"> | |||
<h3>Error</h3> | |||
<div class="error-stack-trace"> { $e } </div> | |||
</div> | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,25 @@ | |||
(: | |||
: Copyright 2010 Mark Logic Corporation. All Rights Reserved. | |||
:) | |||
|
|||
xquery version "1.0-ml"; | |||
import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy"; | |||
|
|||
declare namespace ai="api-install"; | |||
declare variable $ai:name as xs:string external; | |||
|
|||
try { | |||
let $config := admin:get-configuration() | |||
let $groupid := admin:group-get-id($config, "Default") | |||
let $config := admin:appserver-delete($config, admin:appserver-get-id($config, $groupid, $ai:name) ) | |||
return | |||
( | |||
admin:save-configuration($config), | |||
xdmp:sleep(15000) | |||
) | |||
} catch ($e) { | |||
<div class="error-delete-http-server"> | |||
<h3>Error</h3> | |||
<div class="error-stack-trace"> { $e } </div> | |||
</div> | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,20 @@ | |||
(: | |||
: Copyright 2010 Mark Logic Corporation. All Rights Reserved. | |||
:) | |||
|
|||
xquery version "1.0-ml"; | |||
import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy"; | |||
|
|||
declare namespace ai="api-install"; | |||
declare variable $ai:name as xs:string external; | |||
|
|||
try { | |||
let $config := admin:get-configuration() | |||
let $config := admin:database-detach-forest($config, xdmp:database($ai:name), xdmp:forest($ai:name) ) | |||
return admin:save-configuration($config) | |||
} catch ($e) { | |||
<div class="error-detach-forest"> | |||
<h3>Error</h3> | |||
<div class="error-stack-trace"> { $e } </div> | |||
</div> | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,8 @@ | |||
(: | |||
: Copyright 2010 Mark Logic Corporation. All Rights Reserved. | |||
:) | |||
xquery version "1.0-ml"; | |||
|
|||
declare namespace htm="http://www.w3.org/1999/xhtml"; | |||
|
|||
<img src="/api-installer/images/spinner.gif"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,10 @@ | |||
(: | |||
: Copyright 2010 Mark Logic Corporation. All Rights Reserved. | |||
:) | |||
|
|||
(: dont remove (or change) this file | |||
: this is the default trigger, user can pass another that will | |||
: override this | |||
:) | |||
xquery version "1.0-ml"; | |||
() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,10 @@ | |||
(: | |||
: Copyright 2010 Mark Logic Corporation. All Rights Reserved. | |||
:) | |||
|
|||
(: dont remove (or change) this file | |||
: this is the default trigger, user can pass another that will | |||
: override this | |||
:) | |||
xquery version "1.0-ml"; | |||
() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,11 @@ | |||
(: | |||
: Copyright 2010 Mark Logic Corporation. All Rights Reserved. | |||
:) | |||
|
|||
(: dont remove (or change) this file | |||
: this is the default trigger, user can pass another that will | |||
: override this | |||
:) | |||
|
|||
xquery version "1.0-ml"; | |||
() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,11 @@ | |||
(: | |||
: Copyright 2010 Mark Logic Corporation. All Rights Reserved. | |||
:) | |||
|
|||
(: dont remove (or change) this file | |||
: this is the default trigger, user can pass another that will | |||
: override this | |||
:) | |||
|
|||
xquery version "1.0-ml"; | |||
() |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,33 @@ | |||
(: | |||
: Copyright 2010 Mark Logic Corporation. All Rights Reserved. | |||
:) | |||
xquery version "1.0-ml"; | |||
declare namespace ai="api-install"; | |||
|
|||
try { | |||
let $app := xdmp:get-request-field("app") | |||
let $name := fn:substring-before($app, ":") | |||
let $port := fn:substring-after($app, ":") | |||
let $noappserver := xdmp:get-request-field("noappserver") | |||
let $nodb := xdmp:get-request-field("nodb") | |||
let $_ := | |||
xdmp:log(fn:concat("Installing ", $name, " on port ", $port, | |||
". NoAppServer set to ", $noappserver, ". NoDB set to ", $nodb, ".")) | |||
let $args-name := (xs:QName("ai:name"), $name) | |||
let $args-port := ($args-name, xs:QName("ai:port"), $port) | |||
let $args-nodb := ($args-port, xs:QName("ai:nodb"), fn:boolean($nodb)) | |||
return ( | |||
xdmp:invoke("hooks/install/precommit.xqy", $args-port), | |||
if ($nodb) then () else xdmp:invoke("create-forest.xqy", $args-name), | |||
if ($nodb) then () else xdmp:invoke("create-database.xqy", $args-name), | |||
if ($nodb) then () else xdmp:invoke("attach-forest.xqy", $args-name), | |||
if ($noappserver) then () else xdmp:invoke("create-http-server.xqy", $args-nodb), | |||
xdmp:invoke("hooks/install/incommit.xqy", $args-port), | |||
<div> Click | |||
<a href="{fn:concat('http://localhost:', $port)}">here</a> to continue... | |||
</div> ) | |||
} catch ($e) { | |||
<div> <h3>Error</h3> | |||
<div class="error-stack-trace"> { $e } </div> | |||
</div> | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,27 @@ | |||
(: | |||
: Copyright 2010 Mark Logic Corporation. All Rights Reserved. | |||
:) | |||
|
|||
xquery version "1.0-ml"; | |||
declare namespace ai="api-install"; | |||
|
|||
try { | |||
let $app := xdmp:get-request-field("app") | |||
let $name := fn:substring-before($app, ":") | |||
let $port := fn:substring-after($app, ":") | |||
let $noappserver := xdmp:get-request-field("noappserver") | |||
return ( | |||
xdmp:invoke("hooks/install/precommit.xqy", (xs:QName("ai:name"), $name, xs:QName("ai:port"), $port)), | |||
xdmp:invoke("create-forest.xqy", (xs:QName("ai:name"), $name)), | |||
xdmp:invoke("create-database.xqy", (xs:QName("ai:name"), $name)), | |||
xdmp:invoke("attach-forest.xqy", (xs:QName("ai:name"), $name)), | |||
if ($noappserver) then () else xdmp:invoke("create-http-server.xqy", (xs:QName("ai:name"), $name, xs:QName("ai:port"), $port)), | |||
xdmp:invoke("hooks/install/incommit.xqy", (xs:QName("ai:name"), $name, xs:QName("ai:port"), $port)), | |||
<div> Click | |||
<a href="{fn:concat('http://localhost:', $port)}">here</a> to continue... | |||
</div> ) | |||
} catch ($e) { | |||
<div> <h3>Error</h3> | |||
<div class="error-stack-trace"> { $e } </div> | |||
</div> | |||
} |
Oops, something went wrong.