Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Commit

Permalink
Issue #159 - work with https on 8000/8002
Browse files Browse the repository at this point in the history
  • Loading branch information
paxtonhare committed Dec 9, 2013
1 parent 943a67d commit 6eedc85
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
17 changes: 9 additions & 8 deletions deploy/lib/server_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def initialize(options)
@hostname = @properties["ml.server"]
@bootstrap_port_four = @properties["ml.bootstrap-port-four"]
@bootstrap_port_five = @properties["ml.bootstrap-port-five"]
@use_https = @properties["ml.use-https"]

super(
:user_name => @properties["ml.user"],
Expand Down Expand Up @@ -1029,19 +1030,19 @@ def get_config
end

def execute_query_4(query, properties)
r = go "http://#{@hostname}:#{@bootstrap_port}/use-cases/eval2.xqy", "post", {}, {
r = go "http#{@use_https ? 's' : ''}://#{@hostname}:#{@bootstrap_port}/use-cases/eval2.xqy", "post", {}, {
:queryInput => query
}
end

def get_any_db_id
r = go "http://#{@hostname}:#{@bootstrap_port}/manage/LATEST/databases?format=xml", "get"
r = go "http#{@use_https ? 's' : ''}://#{@hostname}:#{@bootstrap_port}/manage/LATEST/databases?format=xml", "get"
return nil unless r.code.to_i == 200
dbid = $1 if r.body =~ /.*<idref>([^<]+)<\/idref>.*/
end

def get_db_id(db_name)
r = go "http://#{@hostname}:#{@bootstrap_port}/manage/LATEST/databases?format=xml", "get"
r = go "http#{@use_https ? 's' : ''}://#{@hostname}:#{@bootstrap_port}/manage/LATEST/databases?format=xml", "get"
return nil unless r.code.to_i == 200

use_next_line = false
Expand All @@ -1058,7 +1059,7 @@ def get_db_id(db_name)
end

def get_sid(app_name)
r = go "http://#{@hostname}:#{@bootstrap_port}/manage/LATEST/servers?format=xml", "get"
r = go "http#{@use_https ? 's' : ''}://#{@hostname}:#{@bootstrap_port}/manage/LATEST/servers?format=xml", "get"
return nil unless r.code.to_i == 200

previous_line = ""
Expand Down Expand Up @@ -1092,15 +1093,15 @@ def execute_query_5(query, properties = {})

if db_id.present?
logger.debug "using dbid: #{db_id}"
r = go "http://#{@hostname}:#{@qconsole_port}/qconsole/endpoints/eval.xqy", "post", {}, {
r = go "http#{@use_https ? 's' : ''}://#{@hostname}:#{@qconsole_port}/qconsole/endpoints/eval.xqy", "post", {}, {
:dbid => db_id,
:resulttype => "text",
:q => query
}
logger.debug r.body
else
logger.debug "using sid: #{sid}"
r = go "http://#{@hostname}:#{@qconsole_port}/qconsole/endpoints/eval.xqy", "post", {}, {
r = go "http#{@use_https ? 's' : ''}://#{@hostname}:#{@qconsole_port}/qconsole/endpoints/eval.xqy", "post", {}, {
:sid => sid,
:resulttype => "text",
:q => query
Expand Down Expand Up @@ -1131,14 +1132,14 @@ def execute_query_7(query, properties = {})

if db_id.present?
logger.debug "using dbid: #{db_id}"
r = go("http://#{@hostname}:#{@qconsole_port}/qconsole/endpoints/evaler.xqy?dbid=#{db_id}&action=eval&querytype=xquery",
r = go("http#{@use_https ? 's' : ''}://#{@hostname}:#{@qconsole_port}/qconsole/endpoints/evaler.xqy?dbid=#{db_id}&action=eval&querytype=xquery",
"post",
{},
nil,
query)
else
logger.debug "using sid: #{sid}"
r = go("http://#{@hostname}:#{@qconsole_port}/qconsole/endpoints/evaler.xqy?sid=#{sid}&action=eval&querytype=xquery",
r = go("http#{@use_https ? 's' : ''}://#{@hostname}:#{@qconsole_port}/qconsole/endpoints/evaler.xqy?sid=#{sid}&action=eval&querytype=xquery",
"post",
{},
nil,
Expand Down
8 changes: 2 additions & 6 deletions deploy/lib/xquery/setup.xqy
Original file line number Diff line number Diff line change
Expand Up @@ -3440,18 +3440,14 @@ declare function setup:get-scheduled-task(
admin:group-get-scheduled-tasks(
$admin-config,
$default-group)
let $tasks :=
return
$tasks[gr:task-path = $task/gr:task-path and
gr:task-root = $task/gr:task-root and
gr:task-type = $task/gr:task-type and
gr:task-database = admin:database-get-id($admin-config, $task/gr:task-database/@name) and
gr:task-modules = admin:database-get-id($admin-config, $task/gr:task-modules/@name) and
gr:task-user = xdmp:user($task/gr:task-user/@name)]
let $_ := xdmp:log(("task-period: ", $task/gr:task-period))
let $filtered := $tasks[if ($task/gr:task-period) then gr:task-period = $task/gr:task-period else fn:true()]
let $_ := xdmp:log(("filtered: ", $filtered))
return
$filtered
[if ($task/gr:task-period) then gr:task-period = $task/gr:task-period else fn:true()]
(:[if ($task/gr:task-period) then gr:task-period = $task/gr:task-period else fn:true()]:)
(: [if ($task/gr:task-start-time) then gr:task-start-time = $task/gr:task-start-time else fn:true()]
[if ($task/gr:task-minute) then gr:task-minute = $task/gr:task-minute else fn:true()]
Expand Down

0 comments on commit 6eedc85

Please sign in to comment.