You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
(57) |
Apr
(103) |
May
(164) |
Jun
(139) |
Jul
(173) |
Aug
(196) |
Sep
(221) |
Oct
(333) |
Nov
(214) |
Dec
(88) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(163) |
Feb
(165) |
Mar
(98) |
Apr
(93) |
May
(199) |
Jun
(118) |
Jul
(200) |
Aug
(212) |
Sep
(185) |
Oct
(297) |
Nov
(437) |
Dec
(272) |
| 2006 |
Jan
(542) |
Feb
(329) |
Mar
(267) |
Apr
(332) |
May
(267) |
Jun
(130) |
Jul
(161) |
Aug
(348) |
Sep
(166) |
Oct
(305) |
Nov
(173) |
Dec
(173) |
| 2007 |
Jan
(199) |
Feb
(118) |
Mar
(133) |
Apr
(200) |
May
(208) |
Jun
(146) |
Jul
(198) |
Aug
(146) |
Sep
(187) |
Oct
(182) |
Nov
(181) |
Dec
(83) |
| 2008 |
Jan
(252) |
Feb
(124) |
Mar
(124) |
Apr
(101) |
May
(143) |
Jun
(122) |
Jul
(129) |
Aug
(60) |
Sep
(80) |
Oct
(89) |
Nov
(54) |
Dec
(112) |
| 2009 |
Jan
(88) |
Feb
(145) |
Mar
(105) |
Apr
(164) |
May
(123) |
Jun
(154) |
Jul
(374) |
Aug
(341) |
Sep
(219) |
Oct
(137) |
Nov
(373) |
Dec
(240) |
| 2010 |
Jan
(197) |
Feb
(270) |
Mar
(253) |
Apr
(150) |
May
(102) |
Jun
(51) |
Jul
(300) |
Aug
(512) |
Sep
(254) |
Oct
(258) |
Nov
(288) |
Dec
(143) |
| 2011 |
Jan
(238) |
Feb
(179) |
Mar
(253) |
Apr
(332) |
May
(248) |
Jun
(255) |
Jul
(216) |
Aug
(282) |
Sep
(146) |
Oct
(77) |
Nov
(86) |
Dec
(69) |
| 2012 |
Jan
(172) |
Feb
(234) |
Mar
(229) |
Apr
(101) |
May
(212) |
Jun
(267) |
Jul
(129) |
Aug
(210) |
Sep
(239) |
Oct
(271) |
Nov
(368) |
Dec
(220) |
| 2013 |
Jan
(179) |
Feb
(155) |
Mar
(59) |
Apr
(47) |
May
(99) |
Jun
(158) |
Jul
(185) |
Aug
(16) |
Sep
(16) |
Oct
(7) |
Nov
(20) |
Dec
(12) |
| 2014 |
Jan
(21) |
Feb
(17) |
Mar
(18) |
Apr
(13) |
May
(27) |
Jun
(15) |
Jul
(19) |
Aug
(22) |
Sep
(30) |
Oct
(16) |
Nov
(19) |
Dec
(16) |
| 2015 |
Jan
(14) |
Feb
(24) |
Mar
(33) |
Apr
(41) |
May
(14) |
Jun
(80) |
Jul
(53) |
Aug
(8) |
Sep
(7) |
Oct
(15) |
Nov
(13) |
Dec
(2) |
| 2016 |
Jan
(22) |
Feb
(12) |
Mar
(30) |
Apr
(6) |
May
(33) |
Jun
(16) |
Jul
(8) |
Aug
(20) |
Sep
(12) |
Oct
(18) |
Nov
(12) |
Dec
(11) |
| 2017 |
Jan
(24) |
Feb
(26) |
Mar
(47) |
Apr
(23) |
May
(19) |
Jun
(14) |
Jul
(28) |
Aug
(30) |
Sep
(17) |
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
(1) |
Feb
(73) |
Mar
(90) |
Apr
(42) |
May
(116) |
Jun
(90) |
Jul
(127) |
Aug
(103) |
Sep
(56) |
Oct
(42) |
Nov
(95) |
Dec
(58) |
| 2020 |
Jan
(102) |
Feb
(31) |
Mar
(93) |
Apr
(60) |
May
(57) |
Jun
(45) |
Jul
(29) |
Aug
(32) |
Sep
(44) |
Oct
(86) |
Nov
(51) |
Dec
(71) |
| 2021 |
Jan
(44) |
Feb
(25) |
Mar
(78) |
Apr
(130) |
May
(64) |
Jun
(74) |
Jul
(21) |
Aug
(64) |
Sep
(40) |
Oct
(43) |
Nov
(21) |
Dec
(99) |
| 2022 |
Jan
(154) |
Feb
(64) |
Mar
(45) |
Apr
(95) |
May
(62) |
Jun
(48) |
Jul
(73) |
Aug
(37) |
Sep
(71) |
Oct
(27) |
Nov
(40) |
Dec
(65) |
| 2023 |
Jan
(89) |
Feb
(130) |
Mar
(124) |
Apr
(50) |
May
(93) |
Jun
(46) |
Jul
(45) |
Aug
(68) |
Sep
(62) |
Oct
(71) |
Nov
(108) |
Dec
(82) |
| 2024 |
Jan
(53) |
Feb
(76) |
Mar
(64) |
Apr
(75) |
May
(36) |
Jun
(54) |
Jul
(98) |
Aug
(137) |
Sep
(58) |
Oct
(177) |
Nov
(84) |
Dec
(52) |
| 2025 |
Jan
(70) |
Feb
(53) |
Mar
(72) |
Apr
(47) |
May
(88) |
Jun
(49) |
Jul
(86) |
Aug
(51) |
Sep
(65) |
Oct
(91) |
Nov
(18) |
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
1
(6) |
2
(16) |
3
(3) |
4
(1) |
5
(1) |
|
6
(23) |
7
|
8
|
9
|
10
|
11
(7) |
12
(1) |
|
13
(4) |
14
|
15
(33) |
16
(11) |
17
(15) |
18
(20) |
19
(3) |
|
20
(14) |
21
(4) |
22
(10) |
23
(27) |
24
(6) |
25
(2) |
26
(10) |
|
27
(3) |
28
(11) |
29
|
30
(9) |
31
|
|
|
|
From: <cu...@us...> - 2009-12-30 19:49:35
|
Revision: 10910
http://exist.svn.sourceforge.net/exist/?rev=10910&view=rev
Author: cutlass
Date: 2009-12-30 19:49:28 +0000 (Wed, 30 Dec 2009)
Log Message:
-----------
ripping out some guts to implement params and options
Modified Paths:
--------------
trunk/eXist/extensions/xprocxq/main/etc/pipeline-optional.xml
trunk/eXist/extensions/xprocxq/main/etc/pipeline-standard.xml
trunk/eXist/extensions/xprocxq/main/etc/xproc-component.xml
trunk/eXist/extensions/xprocxq/main/src/xquery/naming.xqm
trunk/eXist/extensions/xprocxq/main/src/xquery/std.xqm
trunk/eXist/extensions/xprocxq/main/src/xquery/util.xqm
trunk/eXist/extensions/xprocxq/main/src/xquery/xproc.xqm
Modified: trunk/eXist/extensions/xprocxq/main/etc/pipeline-optional.xml
===================================================================
--- trunk/eXist/extensions/xprocxq/main/etc/pipeline-optional.xml 2009-12-30 19:48:14 UTC (rev 10909)
+++ trunk/eXist/extensions/xprocxq/main/etc/pipeline-optional.xml 2009-12-30 19:49:28 UTC (rev 10910)
@@ -36,7 +36,7 @@
<p:output port="result" primary="true" select="/"/>
<p:input port="parameters" kind="parameter" select="/"/>
<p:option name="value" required="true"/>
- <p:option name="algorithm" required="true" select="'md5'"/>
+ <p:option name="algorithm" required="true"/>
<p:option name="version"/>
<p:option name="match" required="true"/>
</p:declare-step>
Modified: trunk/eXist/extensions/xprocxq/main/etc/pipeline-standard.xml
===================================================================
--- trunk/eXist/extensions/xprocxq/main/etc/pipeline-standard.xml 2009-12-30 19:48:14 UTC (rev 10909)
+++ trunk/eXist/extensions/xprocxq/main/etc/pipeline-standard.xml 2009-12-30 19:49:28 UTC (rev 10910)
@@ -8,7 +8,7 @@
<p:option name="attribute-name" required="true"/>
<p:option name="attribute-value" required="true"/>
</p:declare-step>
- <p:declare-step type="p:add-xml-base" xml:id="add-xml-base">
+ <p:declare-step type="p:add-xml-base" xml:id="add-xml-base" xmlns:xproc="http://xproc.net/xproc" xproc:support="true">
<p:input port="source" primary="true" select="/"/>
<p:output port="result" primary="true" select="/"/>
<p:option name="all" select="'false'"/>
Modified: trunk/eXist/extensions/xprocxq/main/etc/xproc-component.xml
===================================================================
--- trunk/eXist/extensions/xprocxq/main/etc/xproc-component.xml 2009-12-30 19:48:14 UTC (rev 10909)
+++ trunk/eXist/extensions/xprocxq/main/etc/xproc-component.xml 2009-12-30 19:49:28 UTC (rev 10910)
@@ -52,7 +52,7 @@
<!-- Input alternatives //-->
- <xproc:element type="p:iteration-source" xproc:support="false"/>
+ <xproc:element type="p:iteration-source" xproc:support="true"/>
<xproc:element type="p:viewport-source" xproc:support="false"/>
<xproc:element type="p:xpath-context" xproc:support="false"/>
@@ -65,7 +65,7 @@
<xproc:element type="p:option" xproc:support="true"/>
<xproc:element type="p:with-option" xproc:support="true"/>
<xproc:element type="p:with-param"/>
- <xproc:element type="p:variable"/>
+ <xproc:element type="p:variable" xproc:support="true"/>
<!-- //-->
Modified: trunk/eXist/extensions/xprocxq/main/src/xquery/naming.xqm
===================================================================
--- trunk/eXist/extensions/xprocxq/main/src/xquery/naming.xqm 2009-12-30 19:48:14 UTC (rev 10909)
+++ trunk/eXist/extensions/xprocxq/main/src/xquery/naming.xqm 2009-12-30 19:49:28 UTC (rev 10910)
@@ -318,8 +318,12 @@
for $import in $xproc/*/p:import
return
if (doc-available($import/@href)) then
- (: TODO - add file: support :)
- doc($import/@href)/p:library/*
+ let $imported := doc($import/@href)
+ return
+ if ($imported/p:library)then
+ $imported/p:library/*
+ else
+ $imported/p:pipeline/*
else
u:dynamicError('XD0002',"cannot import pipeline document ")
}
Modified: trunk/eXist/extensions/xprocxq/main/src/xquery/std.xqm
===================================================================
--- trunk/eXist/extensions/xprocxq/main/src/xquery/std.xqm 2009-12-30 19:48:14 UTC (rev 10909)
+++ trunk/eXist/extensions/xprocxq/main/src/xquery/std.xqm 2009-12-30 19:49:28 UTC (rev 10910)
@@ -77,37 +77,17 @@
(: -------------------------------------------------------------------------- :)
declare function std:add-xml-base($primary,$secondary,$options) {
-
-(: TODO: need to refactor to pass in pipeline uri and any external input uri :)
-
let $v := u:get-primary($primary)
-let $all := xs:boolean(u:get-option('all',$options,$v))
-let $relative := xs:boolean(u:get-option('relative',$options,$v))
-let $attrNames := xs:QName('xml:base')
-let $attrValues := base-uri($v)
-
+let $all := u:get-option('all',$options,$v)
+let $relative := u:get-option('relative',$options,$v)
+let $matchresult := u:evalXPATH('//*', $v, $primary)
+let $attribute-name := "xml:base"
+let $attribute-value := base-uri($v)
return
- if ($all) then
- for $element in $v/*
- return element { node-name($element)}
- { for $attrName at $seq in $attrNames
- return if ($element/@*[node-name(.) = $attrName])
- then ()
- else attribute {$attrName}
- {$attrValues[$seq]},
- $element/@*,
- $element/node() }
-else
- for $element in $v/*
- return element { node-name($element)}
- { for $attrName at $seq in $attrNames
- return if ($element/@*[node-name(.) = $attrName])
- then ()
- else attribute {$attrName}
- {$attrValues[$seq]},
- $element/@*,
- $element/node() }
-};
+<test uri="{$attribute-value}">{$v}</test>
+(:
+ u:add-attribute-matching-elements($v,$matchresult,$attribute-name,$attribute-value)
+:)};
(: -------------------------------------------------------------------------- :)
@@ -233,10 +213,11 @@
(: -------------------------------------------------------------------------- :)
declare function std:filter($primary,$secondary,$options) {
+(: TODO - broken :)
u:assert(exists($options/p:with-option[@name='select']/@select),'p:with-option match is required'),
let $v := u:get-primary($primary)
let $select := string(u:get-option('select',$options,$v))
-let $result := u:safe-evalXPATH($select, $v, $primary)
+let $result := u:evalXPATH($select, $v, $primary)
return
if(exists($result)) then
$result
@@ -396,7 +377,10 @@
for $child at $count in $v
return
- element {$wrapper}{$child,$alternate[$count]}
+ element {$wrapper}{
+ $child,
+ $alternate
+ }
};
@@ -565,26 +549,28 @@
(: -------------------------------------------------------------------------- :)
declare function std:unwrap($primary,$secondary,$options) {
-let $v := u:get-primary($primary)
-let $match := u:get-option('match',$options,$v)
-let $query := if (contains($match,'/')) then
- $match
- else
- concat('//',$match)
-let $matchresult := u:evalXPATH($query, $v, $primary)
-return
- u:unwrap-matching-elements($v/*,$matchresult)
+ let $v := u:get-primary($primary)
+ let $match := u:get-option('match',$options,$v)
+ let $query := if (contains($match,'/')) then
+ $match
+ else
+ concat('//',$match)
+ let $matchresult := u:evalXPATH($query, $v, $primary)
+ return
+ u:unwrap-matching-elements($v/*,$matchresult)
};
(: -------------------------------------------------------------------------- :)
declare function std:xslt($primary,$secondary,$options){
-
u:assert(exists($secondary/xproc:input[@port='stylesheet']/*),'stylesheet is required'),
let $v := u:get-primary($primary)
let $stylesheet := u:get-secondary('stylesheet',$secondary)
return
+ $v
+ (:
u:xslt($stylesheet,$v)
+:)
};
Modified: trunk/eXist/extensions/xprocxq/main/src/xquery/util.xqm
===================================================================
--- trunk/eXist/extensions/xprocxq/main/src/xquery/util.xqm 2009-12-30 19:48:14 UTC (rev 10909)
+++ trunk/eXist/extensions/xprocxq/main/src/xquery/util.xqm 2009-12-30 19:49:28 UTC (rev 10910)
@@ -32,6 +32,13 @@
(: -------------------------------------------------------------------------- :)
(: manage namespaces :)
(: -------------------------------------------------------------------------- :)
+
+
+declare function u:declarens($element){
+ u:declare-ns(u:enum-ns($element))
+};
+
+
declare function u:declare-ns($namespaces){
for $ns in $namespaces//ns
return
@@ -217,9 +224,10 @@
let $option := xs:string($options/*[@name=$option-name]/@select)
return
+ (: TODO - if required this could be an error :)
if (empty($option)) then
- (: TODO - if required this could be an error :)
()
+ (: TODO- need to remove this branch at some point :)
else if(contains($option,"'")) then
string(replace($option,"'",""))
else
@@ -323,6 +331,8 @@
concat('.',$query)
else if(contains($query,'(/')) then
replace($query,'\(/','(./')
+ else if($query eq '') then
+ u:dynamicError('err:XD0001','query is empty and/or XProc step is not supported')
else
$query
let $result := util:eval($qry)
Modified: trunk/eXist/extensions/xprocxq/main/src/xquery/xproc.xqm
===================================================================
--- trunk/eXist/extensions/xprocxq/main/src/xquery/xproc.xqm 2009-12-30 19:48:14 UTC (rev 10909)
+++ trunk/eXist/extensions/xprocxq/main/src/xquery/xproc.xqm 2009-12-30 19:49:28 UTC (rev 10910)
@@ -57,7 +57,10 @@
(: -------------------------------------------------------------------------- :)
declare function xproc:for-each($primary,$secondary,$options,$currentstep,$outputs) {
(: -------------------------------------------------------------------------- :)
- let $v := u:get-primary($primary)
+ let $v := if ($currentstep/p:for-each/p:iteration-source/@select) then
+ u:evalXPATH(string($currentstep/p:iteration-source/@select), u:get-primary($primary), $primary)
+ else
+ u:get-primary($primary)
let $defaultname := concat(string($currentstep/@xproc:defaultname),'.0')
let $subpipeline := $currentstep/node()
let $namespaces := xproc:enum-namespaces($subpipeline)
@@ -74,6 +77,7 @@
{$child}
</xproc:output>
return
+
(u:call($xproc:parse-and-eval,<p:declare-step name="{$defaultname}" xproc:defaultname="{$defaultname}" >
{$subpipeline}</p:declare-step>,$namespaces,$child,(),($outputs,$iteration-source))/.)[last()]/node()
};
@@ -476,8 +480,14 @@
attribute xproc:escape{'true'}
else
(),
- if (contains($child/@href,'file:')) then
+ if (starts-with($child/@href,'file:')) then
util:binary-doc($child/@href)
+ else if (ends-with($child/@href,'.xml')) then
+ let $result := doc($child/@href)
+ let $namespaces := u:declare-ns(xproc:enum-namespaces($result))
+ return
+ $result
+
else
util:binary-to-string(util:binary-doc($child/@href))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cu...@us...> - 2009-12-30 19:48:24
|
Revision: 10909
http://exist.svn.sourceforge.net/exist/?rev=10909&view=rev
Author: cutlass
Date: 2009-12-30 19:48:14 +0000 (Wed, 30 Dec 2009)
Log Message:
-----------
amended xproc docs
Modified Paths:
--------------
trunk/eXist/webapp/xproc/examples/pxquery.xproc
trunk/eXist/webapp/xproc/xproc.xml
Modified: trunk/eXist/webapp/xproc/examples/pxquery.xproc
===================================================================
--- trunk/eXist/webapp/xproc/examples/pxquery.xproc 2009-12-30 19:47:08 UTC (rev 10908)
+++ trunk/eXist/webapp/xproc/examples/pxquery.xproc 2009-12-30 19:48:14 UTC (rev 10909)
@@ -1,14 +1,13 @@
<p:pipeline name="pipeline"
- xmlns:p="http://www.w3.org/ns/xproc"
- xmlns:c="" rel="nofollow">http://www.w3.org/ns/xproc-step">
- <p:xquery>
- <p:input port="query">
- <p:inline>
- <c:query xmlns:c="http://www.w3.org/ns/xproc-step" xproc:escape="true">
- let $r := 'this pipeline successfully processed' return $r (: for now default context goes to xml database :)
- </c:query>
- </p:inline>
- </p:input>
- </p:xquery>
-
- </p:pipeline>
\ No newline at end of file
+ xmlns:p="http://www.w3.org/ns/xproc"
+ xmlns:c="" rel="nofollow">http://www.w3.org/ns/xproc-step">
+<p:xquery>
+ <p:input port="query">
+ <p:inline>
+ <c:query xmlns:c="http://www.w3.org/ns/xproc-step" xproc:escape="true">
+ let $r := 'this pipeline successfully processed' return $r
+ </c:query>
+ </p:inline>
+ </p:input>
+</p:xquery>
+</p:pipeline>
\ No newline at end of file
Modified: trunk/eXist/webapp/xproc/xproc.xml
===================================================================
--- trunk/eXist/webapp/xproc/xproc.xml 2009-12-30 19:47:08 UTC (rev 10908)
+++ trunk/eXist/webapp/xproc/xproc.xml 2009-12-30 19:48:14 UTC (rev 10909)
@@ -86,6 +86,13 @@
</listitem>
</varlistentry>
<varlistentry>
+ <term>autobind</term>
+ <listitem>
+ <para>setting this parameter to true will convert all url parameters to available input ports</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term>options</term>
<listitem>
<para>TBA: disabled for the time being</para>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cu...@us...> - 2009-12-30 19:47:17
|
Revision: 10908
http://exist.svn.sourceforge.net/exist/?rev=10908&view=rev
Author: cutlass
Date: 2009-12-30 19:47:08 +0000 (Wed, 30 Dec 2009)
Log Message:
-----------
added autobind and tweaked eval
Modified Paths:
--------------
trunk/eXist/src/org/exist/http/RESTServer.java
trunk/eXist/src/org/exist/http/run-xproc.xq
trunk/eXist/src/org/exist/xquery/functions/util/Eval.java
Modified: trunk/eXist/src/org/exist/http/RESTServer.java
===================================================================
--- trunk/eXist/src/org/exist/http/RESTServer.java 2009-12-30 07:17:06 UTC (rev 10907)
+++ trunk/eXist/src/org/exist/http/RESTServer.java 2009-12-30 19:47:08 UTC (rev 10908)
@@ -1266,6 +1266,9 @@
String bindings = request.getParameter("bindings");
context.declareVariable("bindings", bindings == null ? "<bindings/>" : bindings);
+ String autobind = request.getParameter("autobind");
+ context.declareVariable("autobind", autobind == null ? "0" : "1");
+
String options = request.getParameter("options");
context.declareVariable("options", options == null ? "<options/>" : options);
Modified: trunk/eXist/src/org/exist/http/run-xproc.xq
===================================================================
--- trunk/eXist/src/org/exist/http/run-xproc.xq 2009-12-30 07:17:06 UTC (rev 10907)
+++ trunk/eXist/src/org/exist/http/run-xproc.xq 2009-12-30 19:47:08 UTC (rev 10908)
@@ -9,9 +9,25 @@
declare variable $debug external;
declare variable $bindings external;
declare variable $options external;
+declare variable $autobind external;
-xproc:run( doc($pipeline), doc($stdin), $debug, "0", util:parse($bindings), util:parse($options))
+let $requestparams :=
+if($autobind eq '1') then
+for $binding in request:get-parameter-names()
+return
+ if($binding eq 'stdin' or $binding eq 'debug' or $binding eq 'autobind') then
+ ()
+ else
+ <binding port="{$binding}">
+ {util:parse(request:get-parameter($binding,''))}
+ </binding>
+else
+ ()
+let $xprocbindings := <bindings>
+ {$requestparams}
+ {util:parse($bindings)//binding}
+ </bindings>
-
-
+return
+ xproc:run( doc($pipeline), doc($stdin), $debug, "0", $xprocbindings, util:parse($options))
Modified: trunk/eXist/src/org/exist/xquery/functions/util/Eval.java
===================================================================
--- trunk/eXist/src/org/exist/xquery/functions/util/Eval.java 2009-12-30 07:17:06 UTC (rev 10907)
+++ trunk/eXist/src/org/exist/xquery/functions/util/Eval.java 2009-12-30 19:47:08 UTC (rev 10908)
@@ -117,7 +117,8 @@
protected static final FunctionParameterSequenceType EVAL_ARGUMENT = new FunctionParameterSequenceType("expression", Type.ITEM, Cardinality.EXACTLY_ONE, evalArgumentText);
protected static final FunctionParameterSequenceType INLINE_CONTEXT = new FunctionParameterSequenceType("inline-context", Type.ITEM, Cardinality.ZERO_OR_MORE, "The inline context");
- protected static final FunctionParameterSequenceType CONTEXT_ARGUMENT = new FunctionParameterSequenceType("context", Type.NODE, Cardinality.ZERO_OR_ONE, contextArgumentText);
+
+ protected static final FunctionParameterSequenceType CONTEXT_ARGUMENT = new FunctionParameterSequenceType("context", Type.NODE, Cardinality.ZERO_OR_ONE, contextArgumentText);
protected static final FunctionParameterSequenceType CACHE_FLAG = new FunctionParameterSequenceType("cache-flag", Type.BOOLEAN, Cardinality.EXACTLY_ONE, "The flag for whether the compiled query should be cached. The cached query will be globally available within the db instance.");
protected static final FunctionReturnSequenceType RETURN_NODE_TYPE = new FunctionReturnSequenceType(Type.NODE, Cardinality.ZERO_OR_MORE, "the results of the evaluated XPath/XQuery expression");
@@ -210,6 +211,7 @@
// save some context properties
context.pushNamespaceContext();
+
LocalVariable mark = context.markLocalVariables(false);
DocumentSet oldDocs = context.getStaticallyKnownDocuments();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sha...@us...> - 2009-12-30 07:17:12
|
Revision: 10907
http://exist.svn.sourceforge.net/exist/?rev=10907&view=rev
Author: shabanovd
Date: 2009-12-30 07:17:06 +0000 (Wed, 30 Dec 2009)
Log Message:
-----------
Modified Paths:
--------------
trunk/eXist/.classpath
Modified: trunk/eXist/.classpath
===================================================================
--- trunk/eXist/.classpath 2009-12-30 07:15:55 UTC (rev 10906)
+++ trunk/eXist/.classpath 2009-12-30 07:17:06 UTC (rev 10907)
@@ -17,6 +17,7 @@
<classpathentry kind="src" path="extensions/debuggee/test"/>
<classpathentry kind="src" path="extensions/xslt/src"/>
<classpathentry kind="src" path="extensions/xslt/test"/>
+ <classpathentry kind="src" path="extensions/security/openid/src"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test/src"/>
<classpathentry kind="src" path="tools/wrapper/src"/>
@@ -133,5 +134,6 @@
<classpathentry kind="lib" path="extensions/cocoon/lib/javacImpl-0.9.jar"/>
<classpathentry kind="lib" path="extensions/cocoon/lib/logkit-1.2.2.jar"/>
<classpathentry kind="lib" path="extensions/cocoon/lib/util.concurrent-1.3.4.jar"/>
+ <classpathentry kind="lib" path="extensions/security/openid/lib/openid4java-0.9.5.jar"/>
<classpathentry kind="output" path="test/classes"/>
</classpath>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sha...@us...> - 2009-12-30 07:16:03
|
Revision: 10906
http://exist.svn.sourceforge.net/exist/?rev=10906&view=rev
Author: shabanovd
Date: 2009-12-30 07:15:55 +0000 (Wed, 30 Dec 2009)
Log Message:
-----------
[API] new Authenticator @org.exist.security.internal
build-in authenticator with simple API:
<form action="$URI/j_security_check" method="post">
Username: <input name="exist_username" type="text"/><br>
Password: <input name="exist_password" type="password"/><br>
<input type="submit"/>
</form>
Added Paths:
-----------
trunk/eXist/src/org/exist/security/internal/Authenticator.java
Added: trunk/eXist/src/org/exist/security/internal/Authenticator.java
===================================================================
--- trunk/eXist/src/org/exist/security/internal/Authenticator.java (rev 0)
+++ trunk/eXist/src/org/exist/security/internal/Authenticator.java 2009-12-30 07:15:55 UTC (rev 10906)
@@ -0,0 +1,224 @@
+/*
+ * eXist Open Source Native XML Database
+ * Copyright (C) 2009 The eXist Project
+ * http://exist-db.org
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id:$
+ */
+package org.exist.security.internal;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.security.Principal;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionBindingEvent;
+import javax.servlet.http.HttpSessionBindingListener;
+
+import org.apache.log4j.Logger;
+import org.mortbay.jetty.Request;
+import org.mortbay.jetty.Response;
+import org.mortbay.jetty.security.Credential;
+import org.mortbay.jetty.security.Password;
+import org.mortbay.jetty.security.SSORealm;
+import org.mortbay.jetty.security.UserRealm;
+import org.mortbay.util.StringUtil;
+
+/**
+ * @author <a href="mailto:sha...@gm...">Dmitriy Shabanov</a>
+ *
+ */
+public class Authenticator extends org.mortbay.jetty.security.FormAuthenticator {
+
+ private static final long serialVersionUID = -3435898377862122388L;
+
+ private final static Logger LOG = Logger.getLogger(Authenticator.class);
+
+ public final static String AUTHENTICATED="org.exist.jetty.Auth";
+ public final static String URI="org.exist.jetty.URI";
+
+// public final static String SECURITY_CHECK="/exist_security_check";
+ public final static String USERNAME="exist_username";
+ public final static String PASSWORD="exist_password";
+
+ @Override
+ public Principal authenticate(UserRealm realm, String pathInContext,
+ Request request, Response response) throws IOException {
+
+ // Setup session
+ HttpSession session=request.getSession(response!=null);
+ if (session==null)
+ return null;
+
+ if ( pathInContext.endsWith(__J_SECURITY_CHECK) ) {
+ // Check the session object for login info.
+ EXistCredential cred=new EXistCredential();
+ cred.authenticate(realm, request.getParameter(USERNAME), request.getParameter(PASSWORD), request);
+
+ String nuri = request.getRequestURI();
+ nuri = nuri.substring(0, nuri.length() - __J_SECURITY_CHECK.length());
+
+ if (cred.user != null) {
+ // Authenticated OK
+ session.removeAttribute(URI); // Remove popped return URI.
+ request.setAuthType(getAuthMethod());
+ request.setUserPrincipal(cred.user);
+ session.setAttribute(AUTHENTICATED,cred);
+
+ // Sign-on to SSO mechanism
+ if (realm instanceof SSORealm)
+ ((SSORealm)realm).setSingleSignOn(request,response,cred.user,new Password(cred._password));
+
+ // Redirect to original request
+ if (response != null) {
+ response.setContentLength(0);
+ response.sendRedirect(response.encodeRedirectURL(nuri));
+ }
+ } else {
+ if(LOG.isDebugEnabled())LOG.debug("Form authentication FAILED for "+StringUtil.printable(cred._username));
+
+// if (_formErrorPage==null) {
+ if (response != null)
+ response.sendError(HttpServletResponse.SC_FORBIDDEN);
+// } else {
+// if (response != null)
+// response.setContentLength(0);
+// response.sendRedirect(response.encodeRedirectURL
+// (URIUtil.addPaths(request.getContextPath(),
+// _formErrorPage)));
+ }
+ // Security check is always false, only true after final redirection.
+ return null;
+ }
+
+ // Check if the session is already authenticated.
+ EXistCredential cred = (EXistCredential) session.getAttribute(AUTHENTICATED);
+
+ if (cred != null) {
+ // We have a credential. Has it been distributed?
+ if (cred.user==null) {
+ // This credential appears to have been distributed. Need to reauth
+ cred.authenticate(realm, request);
+
+ // Sign-on to SSO mechanism
+ if (cred.user!=null && realm instanceof SSORealm)
+ ((SSORealm)realm).setSingleSignOn(request,response,cred.user,new Password(cred._password));
+
+ } else if (!realm.reauthenticate(cred.user))
+ // Else check that it is still authenticated.
+ cred.user=null;
+
+ // If this credential is still authenticated
+ if (cred.user!=null) {
+ if(LOG.isDebugEnabled())LOG.debug("FORM Authenticated for "+cred.user.getName());
+ request.setAuthType(getAuthMethod());
+ request.setUserPrincipal(cred.user);
+ return cred.user;
+ } else
+ session.setAttribute(AUTHENTICATED,null);
+ } else if (realm instanceof SSORealm) {
+ // Try a single sign on.
+ Credential credSSO = ((SSORealm)realm).getSingleSignOn(request,response);
+
+ if (request.getUserPrincipal()!=null)
+ {
+ cred=new EXistCredential();
+ cred.user=request.getUserPrincipal();
+ cred._username = cred.user.getName();
+ if (credSSO!=null)
+ cred._password = credSSO.toString();
+ if(LOG.isDebugEnabled())LOG.debug("SSO for "+cred.user);
+
+ request.setAuthType(getAuthMethod());
+ session.setAttribute(AUTHENTICATED,cred);
+ return cred.user;
+ }
+ }
+
+// // Don't authenticate authform or errorpage
+// if (isLoginOrErrorPage(pathInContext))
+// return SecurityHandler.__NOBODY;
+//
+// // redirect to login page
+// if (response!=null)
+// {
+// if (request.getQueryString()!=null)
+// uri+="?"+request.getQueryString();
+// session.setAttribute(URI,
+// request.getScheme() +
+// "://" + request.getServerName() +
+// ":" + request.getServerPort() +
+// URIUtil.addPaths(request.getContextPath(),uri));
+// response.setContentLength(0);
+// response.sendRedirect(response.encodeRedirectURL(URIUtil.addPaths(request.getContextPath(),
+// _formLoginPage)));
+// }
+
+ return null;
+ }
+
+ @Override
+ public String getAuthMethod() {
+ return HttpServletRequest.FORM_AUTH;
+ }
+
+ private static class EXistCredential implements Serializable, HttpSessionBindingListener {
+
+ private static final long serialVersionUID = -3962684008216876908L;
+
+ private Principal user = null;
+
+ private String _username;
+ private String _password;
+
+ private boolean authenticate(UserRealm realm, String username, String password, Request request) {
+ _username = username;
+ _password = password;
+
+ user = realm.authenticate(username, password, request);
+ if (user == null) {
+ LOG.warn("AUTH FAILURE: user "+request.getParameter(USERNAME));
+ request.setUserPrincipal(null);
+ return false;
+ }
+
+ if(LOG.isDebugEnabled())LOG.debug("Form authentication OK for "+username);
+
+ return true;
+ }
+
+ public void authenticate(UserRealm realm, Request request) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void valueBound(HttpSessionBindingEvent event) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void valueUnbound(HttpSessionBindingEvent event) {
+ // TODO Auto-generated method stub
+
+ }
+
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sha...@us...> - 2009-12-30 06:38:46
|
Revision: 10905
http://exist.svn.sourceforge.net/exist/?rev=10905&view=rev
Author: shabanovd
Date: 2009-12-30 06:38:36 +0000 (Wed, 30 Dec 2009)
Log Message:
-----------
[feature] OpenID implementation ( http://openid.net/ )
Added Paths:
-----------
trunk/eXist/extensions/security/
trunk/eXist/extensions/security/openid/
trunk/eXist/extensions/security/openid/lib/
trunk/eXist/extensions/security/openid/lib/openid4java-0.9.5.jar
trunk/eXist/extensions/security/openid/src/
trunk/eXist/extensions/security/openid/src/org/
trunk/eXist/extensions/security/openid/src/org/exist/
trunk/eXist/extensions/security/openid/src/org/exist/security/
trunk/eXist/extensions/security/openid/src/org/exist/security/openid/
trunk/eXist/extensions/security/openid/src/org/exist/security/openid/servlet/
trunk/eXist/extensions/security/openid/src/org/exist/security/openid/servlet/AuthenticatorOpenId.java
Added: trunk/eXist/extensions/security/openid/lib/openid4java-0.9.5.jar
===================================================================
(Binary files differ)
Property changes on: trunk/eXist/extensions/security/openid/lib/openid4java-0.9.5.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/eXist/extensions/security/openid/src/org/exist/security/openid/servlet/AuthenticatorOpenId.java
===================================================================
--- trunk/eXist/extensions/security/openid/src/org/exist/security/openid/servlet/AuthenticatorOpenId.java (rev 0)
+++ trunk/eXist/extensions/security/openid/src/org/exist/security/openid/servlet/AuthenticatorOpenId.java 2009-12-30 06:38:36 UTC (rev 10905)
@@ -0,0 +1,251 @@
+/*
+ * eXist Open Source Native XML Database
+ * Copyright (C) 2009 The eXist Project
+ * http://exist-db.org
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id:$
+ */
+package org.exist.security.openid.servlet;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.*;
+import javax.servlet.http.*;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.openid4java.OpenIDException;
+import org.openid4java.association.AssociationSessionType;
+import org.openid4java.consumer.*;
+import org.openid4java.discovery.*;
+import org.openid4java.message.*;
+import org.openid4java.util.*;
+
+/**
+ * @author <a href="mailto:sha...@gm...">Dmitriy Shabanov</a>
+ *
+ */
+public class AuthenticatorOpenId extends HttpServlet {
+
+ private static final long serialVersionUID = -2924397314671034627L;
+
+ private static final Log LOG = LogFactory.getLog(AuthenticatorOpenId.class);
+
+ private ServletContext context;
+ public ConsumerManager manager;
+
+ public AuthenticatorOpenId() throws ConsumerException {
+ }
+
+ public void init(ServletConfig config) throws ServletException {
+ super.init(config);
+
+ context = config.getServletContext();
+
+ LOG.debug("context: " + context);
+
+ // --- Forward proxy setup (only if needed) ---
+ ProxyProperties proxyProps = getProxyProperties(config);
+ if (proxyProps != null) {
+ LOG.debug("ProxyProperties: " + proxyProps);
+ HttpClientFactory.setProxyProperties(proxyProps);
+ }
+
+ try {
+ this.manager = new ConsumerManager();
+ } catch (ConsumerException e) {
+ throw new ServletException(e);
+ }
+
+ manager.setAssociations(new InMemoryConsumerAssociationStore());
+ manager.setNonceVerifier(new InMemoryNonceVerifier(5000));
+ manager.setMinAssocSessEnc(AssociationSessionType.DH_SHA256);
+ }
+
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, IOException {
+ doPost(req, resp);
+ }
+
+ protected void doPost(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, IOException {
+ if ("true".equals(req.getParameter("is_return"))) {
+ processReturn(req, resp);
+ } else {
+ String identifier = req.getParameter("openid_identifier");
+ if (identifier != null) {
+ this.authRequest(identifier, req, resp);
+ } else {
+
+// this.getServletContext().getRequestDispatcher("/openid/login.xql")
+// .forward(req, resp);
+ resp.sendRedirect("openid/login.xql");
+ }
+ }
+ }
+
+ private void processReturn(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, IOException {
+ Identifier identifier = this.verifyResponse(req);
+
+ LOG.debug("identifier: " + identifier);
+ System.out.println("identifier: " + identifier);
+
+ if (identifier == null) {
+// this.getServletContext().getRequestDispatcher("/openid/login.xql").forward(req, resp);
+ resp.sendRedirect("openid/login.xql");
+ } else {
+// req.setAttribute("identifier", identifier.getIdentifier());
+// this.getServletContext().getRequestDispatcher("/openid/return.xql")
+// .forward(req, resp);
+ resp.sendRedirect("openid/return.xql?identifier="+identifier.getIdentifier());
+ }
+ }
+
+ // authentication request
+ public String authRequest(String userSuppliedString,
+ HttpServletRequest httpReq, HttpServletResponse httpResp)
+ throws IOException, ServletException {
+
+ try {
+ httpReq.getContextPath();
+
+ // configure the return_to URL where your application will receive
+ // the authentication responses from the OpenID provider
+ String returnToUrl = httpReq.getRequestURL().toString() + "?is_return=true";
+
+ // perform discovery on the user-supplied identifier
+ List<?> discoveries = manager.discover(userSuppliedString);
+
+ // attempt to associate with the OpenID provider
+ // and retrieve one service endpoint for authentication
+ DiscoveryInformation discovered = manager.associate(discoveries);
+
+ // store the discovery information in the user's session
+ httpReq.getSession().setAttribute("openid-disc", discovered);
+
+ // obtain a AuthRequest message to be sent to the OpenID provider
+ AuthRequest authReq = manager.authenticate(discovered, returnToUrl);
+
+ if (!discovered.isVersion2()) {
+ // Option 1: GET HTTP-redirect to the OpenID Provider endpoint
+ // The only method supported in OpenID 1.x
+ // redirect-URL usually limited ~2048 bytes
+ httpResp.sendRedirect(authReq.getDestinationUrl(true));
+ return null;
+
+ } else {
+ // Option 2: HTML FORM Redirection (Allows payloads >2048 bytes)
+
+ Object OPEndpoint = authReq.getDestinationUrl(false);
+
+ ServletOutputStream out = httpResp.getOutputStream();
+
+ httpResp.setContentType("text/html; charset=UTF-8");
+ httpResp.addHeader( "pragma", "no-cache" );
+ httpResp.addHeader( "Cache-Control", "no-cache" );
+
+ out.println("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
+ out.println("<head>");
+ out.println(" <title>OpenID HTML FORM Redirection</title>");
+ out.println("</head>");
+ out.println("<body "document.forms['openid-form-redirection'].submit();\">");
+ out.println(" <form name=\"openid-form-redirection\" action=\""+OPEndpoint+"\" method=\"post\" accept-charset=\"utf-8\">");
+
+ Map<String, String> parameterMap = authReq.getParameterMap();
+ for (String key : parameterMap.keySet()) {
+ out.println(" <input type=\"hidden\" name=\""+key+"\" value=\""+parameterMap.get(key)+"\"/>");
+ }
+
+ out.println(" <button type=\"submit\">Continue...</button>");
+ out.println(" </form>");
+ out.println("</body>");
+ out.println("</html>");
+
+ out.flush();
+ }
+ } catch (OpenIDException e) {
+ // present error to the user
+ }
+
+ return null;
+
+ }
+
+ // authentication response
+ public Identifier verifyResponse(HttpServletRequest httpReq)
+ throws ServletException {
+
+ try {
+ // extract the parameters from the authentication response
+ // (which comes in as a HTTP request from the OpenID provider)
+ ParameterList response = new ParameterList(httpReq
+ .getParameterMap());
+
+ // retrieve the previously stored discovery information
+ DiscoveryInformation discovered = (DiscoveryInformation) httpReq
+ .getSession().getAttribute("openid-disc");
+
+ // extract the receiving URL from the HTTP request
+ StringBuffer receivingURL = httpReq.getRequestURL();
+ String queryString = httpReq.getQueryString();
+ if (queryString != null && queryString.length() > 0)
+ receivingURL.append("?").append(httpReq.getQueryString());
+
+ // verify the response; ConsumerManager needs to be the same
+ // (static) instance used to place the authentication request
+ VerificationResult verification = manager.verify(receivingURL
+ .toString(), response, discovered);
+
+ // examine the verification result and extract the verified
+ // identifier
+ Identifier verified = verification.getVerifiedId();
+ if (verified != null) {
+
+ return verified; // success
+ }
+ } catch (OpenIDException e) {
+ // present error to the user
+ }
+
+ return null;
+ }
+
+ private static ProxyProperties getProxyProperties(ServletConfig config) {
+ ProxyProperties proxyProps;
+ String host = config.getInitParameter("proxy.host");
+ LOG.debug("proxy.host: " + host);
+ if (host == null) {
+ proxyProps = null;
+ } else {
+ proxyProps = new ProxyProperties();
+ String port = config.getInitParameter("proxy.port");
+ String username = config.getInitParameter("proxy.username");
+ String password = config.getInitParameter("proxy.password");
+ String domain = config.getInitParameter("proxy.domain");
+ proxyProps.setProxyHostName(host);
+ proxyProps.setProxyPort(Integer.parseInt(port));
+ proxyProps.setUserName(username);
+ proxyProps.setPassword(password);
+ proxyProps.setDomain(domain);
+ }
+ return proxyProps;
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sha...@us...> - 2009-12-30 06:23:00
|
Revision: 10904
http://exist.svn.sourceforge.net/exist/?rev=10904&view=rev
Author: shabanovd
Date: 2009-12-30 06:22:46 +0000 (Wed, 30 Dec 2009)
Log Message:
-----------
[API] new AuthenticationException @org.exist.security
Added Paths:
-----------
trunk/eXist/src/org/exist/security/AuthenticationException.java
Added: trunk/eXist/src/org/exist/security/AuthenticationException.java
===================================================================
--- trunk/eXist/src/org/exist/security/AuthenticationException.java (rev 0)
+++ trunk/eXist/src/org/exist/security/AuthenticationException.java 2009-12-30 06:22:46 UTC (rev 10904)
@@ -0,0 +1,39 @@
+/*
+ * eXist Open Source Native XML Database
+ * Copyright (C) 2009 The eXist Project
+ * http://exist-db.org
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id:$
+ */
+package org.exist.security;
+
+/**
+ * @author <a href="mailto:sha...@gm...">Dmitriy Shabanov</a>
+ *
+ */
+public class AuthenticationException extends Exception {
+
+ private static final long serialVersionUID = 8966739840703820248L;
+
+ public AuthenticationException(String message) {
+ super(message);
+ }
+
+ public AuthenticationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sha...@us...> - 2009-12-30 06:13:21
|
Revision: 10903
http://exist.svn.sourceforge.net/exist/?rev=10903&view=rev
Author: shabanovd
Date: 2009-12-30 06:13:05 +0000 (Wed, 30 Dec 2009)
Log Message:
-----------
[API] User & Group extends Principal
Modified Paths:
--------------
trunk/eXist/src/org/exist/security/Group.java
trunk/eXist/src/org/exist/security/User.java
Modified: trunk/eXist/src/org/exist/security/Group.java
===================================================================
--- trunk/eXist/src/org/exist/security/Group.java 2009-12-30 05:41:37 UTC (rev 10902)
+++ trunk/eXist/src/org/exist/security/Group.java 2009-12-30 06:13:05 UTC (rev 10903)
@@ -21,10 +21,9 @@
*/
package org.exist.security;
-public interface Group {
+import java.security.Principal;
- public String getName();
+public interface Group extends Principal {
public int getId();
-
}
\ No newline at end of file
Modified: trunk/eXist/src/org/exist/security/User.java
===================================================================
--- trunk/eXist/src/org/exist/security/User.java 2009-12-30 05:41:37 UTC (rev 10902)
+++ trunk/eXist/src/org/exist/security/User.java 2009-12-30 06:13:05 UTC (rev 10903)
@@ -21,9 +21,11 @@
*/
package org.exist.security;
+import java.security.Principal;
+
import org.exist.xmldb.XmldbURI;
-public interface User {
+public interface User extends Principal {
public final static int PLAIN_ENCODING = 0;
public final static int SIMPLE_MD5_ENCODING = 1;
@@ -55,13 +57,6 @@
public boolean hasDbaRole();
- /**
- * Get the user name
- *
- *@return The user value
- */
- public String getName();
-
public int getUID();
/**
@@ -82,7 +77,7 @@
/**
* Sets the password attribute of the User object
*
- *@param passwd The new password value
+ * @param passwd The new password value
*/
public void setPassword(String passwd);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sha...@us...> - 2009-12-30 05:41:45
|
Revision: 10902
http://exist.svn.sourceforge.net/exist/?rev=10902&view=rev
Author: shabanovd
Date: 2009-12-30 05:41:37 +0000 (Wed, 30 Dec 2009)
Log Message:
-----------
[ignore] deprecated
Modified Paths:
--------------
trunk/eXist/src/org/exist/security/UUIDGenerator.java
trunk/eXist/src/org/exist/security/UserImpl.java
Modified: trunk/eXist/src/org/exist/security/UUIDGenerator.java
===================================================================
--- trunk/eXist/src/org/exist/security/UUIDGenerator.java 2009-12-28 18:45:51 UTC (rev 10901)
+++ trunk/eXist/src/org/exist/security/UUIDGenerator.java 2009-12-30 05:41:37 UTC (rev 10902)
@@ -17,7 +17,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * $Id$
+ * $Id:$
*/
package org.exist.security;
@@ -37,6 +37,7 @@
* </UL>
* @author Dannes Wessels
*/
+//TODO: move to utils ? -shabanovd
public class UUIDGenerator {
@SuppressWarnings("unused")
Modified: trunk/eXist/src/org/exist/security/UserImpl.java
===================================================================
--- trunk/eXist/src/org/exist/security/UserImpl.java 2009-12-28 18:45:51 UTC (rev 10901)
+++ trunk/eXist/src/org/exist/security/UserImpl.java 2009-12-30 05:41:37 UTC (rev 10902)
@@ -36,474 +36,502 @@
import java.util.Properties;
/**
- * Represents a user within the database.
- *
- * @author Wolfgang Meier <wol...@ex...>
- * Modified by {Marco.Tampucci, Massimo.Martinelli} @isti.cnr.it
+ * Represents a user within the database.
+ *
+ * @author Wolfgang Meier <wol...@ex...> Modified by {Marco.Tampucci,
+ * Massimo.Martinelli} @isti.cnr.it
*/
public class UserImpl implements User {
- private final static Logger LOG = Logger.getLogger(UserImpl.class);
- public final static User DEFAULT =
- new UserImpl( "guest", null, "guest" );
-
- private final static String GROUP = "group";
- private final static String NAME = "name";
- private final static String PASS = "password";
- private final static String DIGEST_PASS = "digest-password";
- private final static String USER_ID = "uid";
- private final static String HOME = "home";
- private static String realm = "exist";
+ private final static Logger LOG = Logger.getLogger(UserImpl.class);
+ @Deprecated
+ public final static User DEFAULT = new UserImpl("guest", null, "guest");
- public static int PASSWORD_ENCODING;
- public static boolean CHECK_PASSWORDS = true;
-
+ private final static String GROUP = "group";
+ private final static String NAME = "name";
+ private final static String PASS = "password";
+ private final static String DIGEST_PASS = "digest-password";
+ private final static String USER_ID = "uid";
+ private final static String HOME = "home";
+ private static String realm = "exist";
+
+ public static int PASSWORD_ENCODING;
+ public static boolean CHECK_PASSWORDS = true;
+
static {
- Properties props = new Properties();
+ Properties props = new Properties();
try {
- props.load(
- UserImpl.class.getClassLoader().getResourceAsStream("org/exist/security/security.properties")
- );
+ props.load(UserImpl.class.getClassLoader().getResourceAsStream(
+ "org/exist/security/security.properties"));
} catch (IOException e) {
}
String option = props.getProperty("passwords.encoding", "md5");
- setPasswordEncoding(option);
- option = props.getProperty("passwords.check", "yes");
- CHECK_PASSWORDS = option.equalsIgnoreCase("yes") || option.equalsIgnoreCase("true");
+ setPasswordEncoding(option);
+ option = props.getProperty("passwords.check", "yes");
+ CHECK_PASSWORDS = option.equalsIgnoreCase("yes")
+ || option.equalsIgnoreCase("true");
}
- static public void enablePasswordChecks(boolean check) {
- CHECK_PASSWORDS = check;
- }
+ static public void enablePasswordChecks(boolean check) {
+ CHECK_PASSWORDS = check;
+ }
- static public void setPasswordEncoding(String encoding) {
- if (encoding != null) {
- LOG.equals("Setting password encoding to "+encoding);
- if (encoding.equalsIgnoreCase("plain")) {
- PASSWORD_ENCODING = PLAIN_ENCODING;
- } else if (encoding.equalsIgnoreCase("md5")) {
- PASSWORD_ENCODING = MD5_ENCODING;
- } else {
- PASSWORD_ENCODING = SIMPLE_MD5_ENCODING;
- }
- }
- }
-
- static public void setPasswordRealm(String value) {
- realm = value;
- }
-
- private String[] groups = null;
- private String password = null;
- private String digestPassword = null;
- private String user;
- private int uid = -1;
- private XmldbURI home = null;
-
- /**
- * Indicates if the user belongs to the dba group,
- * i.e. is a superuser.
- */
- private boolean hasDbaRole = false;
+ static public void setPasswordEncoding(String encoding) {
+ if (encoding != null) {
+ LOG.equals("Setting password encoding to " + encoding);
+ if (encoding.equalsIgnoreCase("plain")) {
+ PASSWORD_ENCODING = PLAIN_ENCODING;
+ } else if (encoding.equalsIgnoreCase("md5")) {
+ PASSWORD_ENCODING = MD5_ENCODING;
+ } else {
+ PASSWORD_ENCODING = SIMPLE_MD5_ENCODING;
+ }
+ }
+ }
- /**
- * Create a new user with name and password
- *
- *@param user Description of the Parameter
- *@param password Description of the Parameter
- */
- public UserImpl( String user, String password ) {
- this.user = user;
- setPassword( password );
+ static public void setPasswordRealm(String value) {
+ realm = value;
+ }
- }
+ private String[] groups = null;
+ private String password = null;
+ private String digestPassword = null;
+ private String user;
+ private int uid = -1;
+ private XmldbURI home = null;
+ /**
+ * Indicates if the user belongs to the dba group, i.e. is a superuser.
+ */
+ private boolean hasDbaRole = false;
- /**
- * Create a new user with name
- *
- *@param user Description of the Parameter
- */
- public UserImpl( String user ) {
- this.user = user;
- }
+ /**
+ * Create a new user with name and password
+ *
+ *@param user
+ * Description of the Parameter
+ *@param password
+ * Description of the Parameter
+ */
+ public UserImpl(String user, String password) {
+ this.user = user;
+ setPassword(password);
+ }
- /**
- * Create a new user with name, password and primary group
- *
- *@param user Description of the Parameter
- *@param password Description of the Parameter
- *@param primaryGroup Description of the Parameter
- */
- public UserImpl( String user, String password, String primaryGroup ) {
- this( user, password );
- addGroup( primaryGroup );
- }
+ /**
+ * Create a new user with name
+ *
+ *@param user
+ * Description of the Parameter
+ */
+ public UserImpl(String user) {
+ this.user = user;
+ }
+ /**
+ * Create a new user with name, password and primary group
+ *
+ *@param user
+ * Description of the Parameter
+ *@param password
+ * Description of the Parameter
+ *@param primaryGroup
+ * Description of the Parameter
+ */
+ public UserImpl(String user, String password, String primaryGroup) {
+ this(user, password);
+ addGroup(primaryGroup);
+ }
- /**
- * Read a new user from the given DOM node
- *
- *@param node Description of the Parameter
- *@exception DatabaseConfigurationException Description of the Exception
- */
- public UserImpl( int majorVersion, int minorVersion,Element node ) throws DatabaseConfigurationException {
- this.user = node.getAttribute( NAME );
- if ( user == null || user.length() == 0)
- throw new DatabaseConfigurationException( "user needs a name" );
- Attr attr;
- if (majorVersion==0) {
- attr = node.getAttributeNode(PASS);
- this.digestPassword = attr == null ? null : attr.getValue();
- this.password = null;
- } else {
- attr = node.getAttributeNode(PASS);
- this.password = attr == null ? null : attr.getValue();
- if (this.password!=null && this.password.length() > 0) {
- if (this.password.startsWith("{MD5}")) {
- this.password = this.password.substring(5);
- }
- if (this.password.charAt(0)=='{') {
- throw new DatabaseConfigurationException("Unrecognized password encoding "+password+" for user "+user);
- }
- }
- attr = node.getAttributeNode(DIGEST_PASS);
- this.digestPassword = attr == null ? null : attr.getValue();
- }
- Attr userId = node.getAttributeNode( USER_ID );
- if(userId == null)
- throw new DatabaseConfigurationException("attribute id missing");
- try {
- uid = Integer.parseInt(userId.getValue());
- } catch(NumberFormatException e) {
- throw new DatabaseConfigurationException("illegal user id: " +
- userId + " for user " + user);
- }
- Attr homeAttr = node.getAttributeNode( HOME );
- this.home = homeAttr == null ? null : XmldbURI.create(homeAttr.getValue());
- NodeList gl = node.getChildNodes();
- Node group;
- for ( int i = 0; i < gl.getLength(); i++ ) {
- group = gl.item( i );
- if(group.getNodeType() == Node.ELEMENT_NODE &&
- group.getLocalName().equals(GROUP))
- addGroup( group.getFirstChild().getNodeValue() );
- }
- }
+ /**
+ * Read a new user from the given DOM node
+ *
+ *@param node
+ * Description of the Parameter
+ *@exception DatabaseConfigurationException
+ * Description of the Exception
+ */
+ public UserImpl(int majorVersion, int minorVersion, Element node)
+ throws DatabaseConfigurationException {
+ this.user = node.getAttribute(NAME);
+ if (user == null || user.length() == 0)
+ throw new DatabaseConfigurationException("user needs a name");
+ Attr attr;
+ if (majorVersion == 0) {
+ attr = node.getAttributeNode(PASS);
+ this.digestPassword = attr == null ? null : attr.getValue();
+ this.password = null;
+ } else {
+ attr = node.getAttributeNode(PASS);
+ this.password = attr == null ? null : attr.getValue();
+ if (this.password != null && this.password.length() > 0) {
+ if (this.password.startsWith("{MD5}")) {
+ this.password = this.password.substring(5);
+ }
+ if (this.password.charAt(0) == '{') {
+ throw new DatabaseConfigurationException(
+ "Unrecognized password encoding " + password
+ + " for user " + user);
+ }
+ }
+ attr = node.getAttributeNode(DIGEST_PASS);
+ this.digestPassword = attr == null ? null : attr.getValue();
+ }
+ Attr userId = node.getAttributeNode(USER_ID);
+ if (userId == null)
+ throw new DatabaseConfigurationException("attribute id missing");
+ try {
+ uid = Integer.parseInt(userId.getValue());
+ } catch (NumberFormatException e) {
+ throw new DatabaseConfigurationException("illegal user id: "
+ + userId + " for user " + user);
+ }
+ Attr homeAttr = node.getAttributeNode(HOME);
+ this.home = homeAttr == null ? null : XmldbURI.create(homeAttr
+ .getValue());
+ NodeList gl = node.getChildNodes();
+ Node group;
+ for (int i = 0; i < gl.getLength(); i++) {
+ group = gl.item(i);
+ if (group.getNodeType() == Node.ELEMENT_NODE
+ && group.getLocalName().equals(GROUP))
+ addGroup(group.getFirstChild().getNodeValue());
+ }
+ }
-
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.exist.security.User#addGroup(java.lang.String)
*/
- public final void addGroup( String group ) {
- if (groups == null) {
- groups = new String[1];
- groups[0] = group;
- } else {
- int len = groups.length;
- String[] ngroups = new String[len + 1];
- System.arraycopy(groups, 0, ngroups, 0, len);
- ngroups[len] = group;
- groups = ngroups;
- }
- if (SecurityManager.DBA_GROUP.equals(group))
- hasDbaRole = true;
- }
-
- /* (non-Javadoc)
+ public final void addGroup(String group) {
+ if (groups == null) {
+ groups = new String[1];
+ groups[0] = group;
+ } else {
+ int len = groups.length;
+ String[] ngroups = new String[len + 1];
+ System.arraycopy(groups, 0, ngroups, 0, len);
+ ngroups[len] = group;
+ groups = ngroups;
+ }
+ if (SecurityManager.DBA_GROUP.equals(group))
+ hasDbaRole = true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.exist.security.User#remGroup(java.lang.String)
*/
- public final void remGroup( String group ) {
- if (groups == null) {
- groups = new String[1];
- groups[0] = "guest";
- } else {
- int len = groups.length;
-
- String[] rgroup = null;
- if (len>1)
- rgroup = new String[len-1];
- else {
- rgroup = new String[1];
- len=1;
- }
-
- boolean found = false;
- for (int i=0; i<len; i++) {
- if (!groups[i].equals(group)) {
- if (found == true)
- rgroup[i-1] = groups[i];
- else
- rgroup[i] = groups[i];
- }
- else {
- found = true;
- }
- }
- if (found == true && len==1)
- rgroup[0] = "guest";
- groups=rgroup;
- }
- if (SecurityManager.DBA_GROUP.equals(group))
- hasDbaRole = false;
- }
+ public final void remGroup(String group) {
+ if (groups == null) {
+ groups = new String[1];
+ groups[0] = "guest";
+ } else {
+ int len = groups.length;
- /* (non-Javadoc)
+ String[] rgroup = null;
+ if (len > 1)
+ rgroup = new String[len - 1];
+ else {
+ rgroup = new String[1];
+ len = 1;
+ }
+
+ boolean found = false;
+ for (int i = 0; i < len; i++) {
+ if (!groups[i].equals(group)) {
+ if (found == true)
+ rgroup[i - 1] = groups[i];
+ else
+ rgroup[i] = groups[i];
+ } else {
+ found = true;
+ }
+ }
+ if (found == true && len == 1)
+ rgroup[0] = "guest";
+ groups = rgroup;
+ }
+ if (SecurityManager.DBA_GROUP.equals(group))
+ hasDbaRole = false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.exist.security.User#setGroups(java.lang.String[])
*/
- public final void setGroups(String[] groups) {
- this.groups = groups;
- for (int i = 0; i < groups.length; i++)
- if (SecurityManager.DBA_GROUP.equals(groups[i]))
- hasDbaRole = true;
- }
+ public final void setGroups(String[] groups) {
+ this.groups = groups;
+ for (int i = 0; i < groups.length; i++)
+ if (SecurityManager.DBA_GROUP.equals(groups[i]))
+ hasDbaRole = true;
+ }
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.exist.security.User#getGroups()
*/
- public final String[] getGroups() {
- return groups == null ? new String[0] : groups;
- }
+ public final String[] getGroups() {
+ return groups == null ? new String[0] : groups;
+ }
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.exist.security.User#hasDbaRole()
*/
- public final boolean hasDbaRole() {
- return hasDbaRole;
- }
-
- /* (non-Javadoc)
+ public final boolean hasDbaRole() {
+ return hasDbaRole;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.exist.security.User#getName()
*/
- public final String getName() {
- return user;
- }
+ public final String getName() {
+ return user;
+ }
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.exist.security.User#getUID()
*/
public final int getUID() {
return uid;
}
- /**
- * Get the user's password
- *
- *@return Description of the Return Value
- */
- public final String getPassword() {
- return password;
- }
+ /**
+ * Get the user's password
+ *
+ * @return Description of the Return Value
+ * @deprecated
+ */
+ public final String getPassword() {
+ return password;
+ }
- public final String getDigestPassword() {
- return digestPassword;
- }
+ @Deprecated
+ public final String getDigestPassword() {
+ return digestPassword;
+ }
-
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.exist.security.User#getPrimaryGroup()
*/
- public final String getPrimaryGroup() {
- if ( groups == null || groups.length == 0 )
- return null;
- return groups[0];
- }
+ public final String getPrimaryGroup() {
+ if (groups == null || groups.length == 0)
+ return null;
+ return groups[0];
+ }
-
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.exist.security.User#hasGroup(java.lang.String)
*/
- public final boolean hasGroup( String group ) {
- if (groups == null)
- return false;
- for (int i = 0; i < groups.length; i++) {
- if (groups[i].equals(group))
- return true;
- }
- return false;
- }
+ public final boolean hasGroup(String group) {
+ if (groups == null)
+ return false;
+ for (int i = 0; i < groups.length; i++) {
+ if (groups[i].equals(group))
+ return true;
+ }
+ return false;
+ }
-
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.exist.security.User#setPassword(java.lang.String)
*/
- public final void setPassword( String passwd ) {
- if (passwd==null) {
- this.password = null;
- this.digestPassword = null;
- } else {
- this.password = MessageDigester.md5(passwd,true);
- this.digestPassword = digest(passwd);
- }
- }
+ public final void setPassword(String passwd) {
+ if (passwd == null) {
+ this.password = null;
+ this.digestPassword = null;
+ } else {
+ this.password = MessageDigester.md5(passwd, true);
+ this.digestPassword = digest(passwd);
+ }
+ }
+ /**
+ * Sets the digest passwod value of the User object
+ *
+ * @param passwd
+ * The new passwordDigest value
+ * @deprecated
+ */
+ public final void setPasswordDigest(String passwd) {
+ this.digestPassword = (passwd == null) ? null : passwd;
+ }
- /**
- * Sets the digest passwod value of the User object
- *
- *@param passwd The new passwordDigest value
- */
- public final void setPasswordDigest( String passwd ) {
- this.digestPassword = ( passwd == null ) ? null : passwd;
- }
+ /**
+ * Sets the encoded passwod value of the User object
+ *
+ * @param passwd
+ * The new passwordDigest value
+ * @deprecated
+ */
+ public final void setEncodedPassword(String passwd) {
+ this.password = (passwd == null) ? null : passwd;
+ }
- /**
- * Sets the encoded passwod value of the User object
- *
- *@param passwd The new passwordDigest value
- */
- public final void setEncodedPassword( String passwd ) {
- this.password = ( passwd == null ) ? null : passwd;
- }
+ public final String digest(String passwd) {
+ switch (PASSWORD_ENCODING) {
+ case PLAIN_ENCODING:
+ return passwd;
+ case MD5_ENCODING:
+ return MessageDigester
+ .md5(user + ":" + realm + ":" + passwd, false);
+ default:
+ return MessageDigester.md5(passwd, true);
+ }
- public final String digest(String passwd) {
- switch(PASSWORD_ENCODING) {
- case PLAIN_ENCODING:
- return passwd;
- case MD5_ENCODING:
- return MessageDigester.md5(user + ":"+realm+":" + passwd,false);
- default:
- return MessageDigester.md5(passwd,true);
- }
-
- }
-
- public final String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append( "<user name=\"" );
- buf.append( user );
- buf.append( "\" " );
- buf.append( "uid=\"");
- buf.append( Integer.toString(uid) );
- buf.append( "\"" );
- if ( password != null ) {
- buf.append( " password=\"{MD5}" );
- buf.append( password );
- buf.append( '"' );
- }
- if (digestPassword!=null) {
- buf.append( " digest-password=\"" );
- buf.append( digestPassword );
- buf.append( '"' );
- }
- if( home != null ) {
- buf.append(" home=\"" );
+ }
+
+ public final String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("<user name=\"");
+ buf.append(user);
+ buf.append("\" ");
+ buf.append("uid=\"");
+ buf.append(Integer.toString(uid));
+ buf.append("\"");
+ if (password != null) {
+ buf.append(" password=\"{MD5}");
+ buf.append(password);
+ buf.append('"');
+ }
+ if (digestPassword != null) {
+ buf.append(" digest-password=\"");
+ buf.append(digestPassword);
+ buf.append('"');
+ }
+ if (home != null) {
+ buf.append(" home=\"");
buf.append(home);
buf.append("\">");
} else
buf.append(">");
- if (groups != null) {
- for (int i = 0; i < groups.length; i++) {
- buf.append( "<group>" );
- buf.append( groups[i] );
- buf.append( "</group>" );
- }
- }
- buf.append( "</user>" );
- return buf.toString();
- }
-
- /**
- * Split up the validate method into two, to make
- * it possible to authenticate users, which are not
- * defined in the instance named "exist" without
- * having impact on the standard functionality.
- *
- * @param passwd
- * @return true if the password was correct, false if not,
- * or if there was a problem.
- */
- public final boolean validate( String passwd ) {
- SecurityManager sm;
- try {
- sm=BrokerPool.getInstance().getSecurityManager();
- return validate(passwd, sm);
- } catch (EXistException e) {
- LOG.warn("Failed to get security manager in validate: ",e);
- return false;
- }
- }
+ if (groups != null) {
+ for (int i = 0; i < groups.length; i++) {
+ buf.append("<group>");
+ buf.append(groups[i]);
+ buf.append("</group>");
+ }
+ }
+ buf.append("</user>");
+ return buf.toString();
+ }
- public final boolean validate( String passwd, SecurityManager sm ) {
- // security management is disabled if in repair mode
- if (!CHECK_PASSWORDS)
- return true;
-
- if (password==null && digestPassword==null) {
- return true;
- }
- if ( passwd == null ) {
- return false;
- }
-
- // [ 1557095 ] LDAP passwords patch
- //Try to authenticate using LDAP
- if(sm != null) {
- if(sm instanceof LDAPbindSecurityManager ) {
- if( ((LDAPbindSecurityManager)sm).bind(user,passwd))
- return true;
- else
- return false;
- }
- }
-
- if (password!=null) {
- if (MessageDigester.md5(passwd,true).equals( password )) {
- return true;
- }
- }
- if (digestPassword!=null) {
- if (digest( passwd ).equals( digestPassword )) {
- return true;
- }
- }
- return false;
- }
-
- public final boolean validateDigest( String passwd ) {
- if ( digestPassword == null )
- return true;
- if ( passwd == null )
- return false;
- return digest( passwd ).equals( digestPassword );
- }
-
- public void setUID(int uid) {
- this.uid = uid;
- }
-
- /* (non-Javadoc)
+ /**
+ * Split up the validate method into two, to make it possible to
+ * authenticate users, which are not defined in the instance named "exist"
+ * without having impact on the standard functionality.
+ *
+ * @param passwd
+ * @return true if the password was correct, false if not, or if there was a
+ * problem.
+ */
+ public final boolean validate(String passwd) {
+ SecurityManager sm;
+ try {
+ sm = BrokerPool.getInstance().getSecurityManager();
+ return validate(passwd, sm);
+ } catch (EXistException e) {
+ LOG.warn("Failed to get security manager in validate: ", e);
+ return false;
+ }
+ }
+
+ public final boolean validate(String passwd, SecurityManager sm) {
+ // security management is disabled if in repair mode
+ if (!CHECK_PASSWORDS)
+ return true;
+
+ if (password == null && digestPassword == null) {
+ return true;
+ }
+ if (passwd == null) {
+ return false;
+ }
+
+ // [ 1557095 ] LDAP passwords patch
+ // Try to authenticate using LDAP
+ if (sm != null) {
+ if (sm instanceof LDAPbindSecurityManager) {
+ if (((LDAPbindSecurityManager) sm).bind(user, passwd))
+ return true;
+ else
+ return false;
+ }
+ }
+
+ if (password != null) {
+ if (MessageDigester.md5(passwd, true).equals(password)) {
+ return true;
+ }
+ }
+ if (digestPassword != null) {
+ if (digest(passwd).equals(digestPassword)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public final boolean validateDigest(String passwd) {
+ if (digestPassword == null)
+ return true;
+ if (passwd == null)
+ return false;
+ return digest(passwd).equals(digestPassword);
+ }
+
+ //switch to protected
+ public void setUID(int uid) {
+ this.uid = uid;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.exist.security.User#setHome(org.exist.xmldb.XmldbURI)
*/
- public void setHome(XmldbURI homeCollection) {
- home = homeCollection;
- }
-
- /* (non-Javadoc)
+ public void setHome(XmldbURI homeCollection) {
+ home = homeCollection;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.exist.security.User#getHome()
*/
- public XmldbURI getHome() {
- return home;
- }
-
- /* (non-Javadoc)
+ public XmldbURI getHome() {
+ return home;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object obj) {
- UserImpl other = (UserImpl)obj;
-
- if(other != null)
- {
+ UserImpl other = (UserImpl) obj;
+
+ if (other != null) {
return uid == other.uid;
+ } else {
+ return (false);
}
- else
- {
- return(false);
- }
}
}
-
-
-
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2009-12-28 18:45:58
|
Revision: 10901
http://exist.svn.sourceforge.net/exist/?rev=10901&view=rev
Author: dizzzz
Date: 2009-12-28 18:45:51 +0000 (Mon, 28 Dec 2009)
Log Message:
-----------
[ignore] scripts in installer are now copied and filtered from bin directory. final cut.
Property Changed:
----------------
trunk/eXist/installer/scripts/
Property changes on: trunk/eXist/installer/scripts
___________________________________________________________________
Added: svn:ignore
+ backup.bat
backup.sh
client.bat
client.sh
server.bat
server.sh
shutdown.bat
shutdown.sh
startup.bat
startup.sh
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2009-12-28 18:11:41
|
Revision: 10900
http://exist.svn.sourceforge.net/exist/?rev=10900&view=rev
Author: dizzzz
Date: 2009-12-28 18:11:34 +0000 (Mon, 28 Dec 2009)
Log Message:
-----------
[ignore] scripts in installer are now copied and filtered from bin directory. final cut.
Modified Paths:
--------------
trunk/eXist/build/scripts/installer.xml
Modified: trunk/eXist/build/scripts/installer.xml
===================================================================
--- trunk/eXist/build/scripts/installer.xml 2009-12-28 18:07:14 UTC (rev 10899)
+++ trunk/eXist/build/scripts/installer.xml 2009-12-28 18:11:34 UTC (rev 10900)
@@ -14,7 +14,7 @@
<ant antfile="build.xml" dir="tools/izpack"/>
</target>
- <target depends="all,samples,javadocs" name="prepare-installer">
+ <target depends="all,samples,javadocs,copy_scripts" name="prepare-installer">
<taskdef name="izpack" classpath="${izpack.dir}/lib/compiler.jar"
classname="com.izforge.izpack.ant.IzPackTask"/>
<tstamp/>
@@ -111,4 +111,19 @@
installerType="standard"/>
</target-->
+ <target name="copy_scripts">
+ <filter filtersfile="installer/scripts/scripts.properties" />
+
+ <copy todir="installer/scripts" filtering="true" overwrite="true">
+ <fileset dir="bin">
+ <include name="*.sh"/>
+ <exclude name="run.sh"/>
+ <exclude name="startupCluster.sh"/>
+
+ <include name="*.bat"/>
+ <exclude name="run.bat"/>
+ <exclude name="startupCluster.bat"/>
+ </fileset>
+ </copy>
+ </target>
</project>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2009-12-28 18:07:39
|
Revision: 10899
http://exist.svn.sourceforge.net/exist/?rev=10899&view=rev
Author: dizzzz
Date: 2009-12-28 18:07:14 +0000 (Mon, 28 Dec 2009)
Log Message:
-----------
[ignore] scripts in installer are now copied and filtered from bin directory. More commits soon
Modified Paths:
--------------
trunk/eXist/bin/backup.bat
trunk/eXist/bin/backup.sh
trunk/eXist/bin/client.bat
trunk/eXist/bin/client.sh
trunk/eXist/bin/run.bat
trunk/eXist/bin/server.bat
trunk/eXist/bin/server.sh
trunk/eXist/bin/shutdown.bat
trunk/eXist/bin/shutdown.sh
trunk/eXist/bin/startup.bat
trunk/eXist/bin/startup.sh
trunk/eXist/bin/startupCluster.bat
Added Paths:
-----------
trunk/eXist/installer/scripts/scripts.properties
Removed Paths:
-------------
trunk/eXist/installer/scripts/backup.bat
trunk/eXist/installer/scripts/backup.sh
trunk/eXist/installer/scripts/client.bat
trunk/eXist/installer/scripts/client.sh
trunk/eXist/installer/scripts/server.bat
trunk/eXist/installer/scripts/server.sh
trunk/eXist/installer/scripts/shutdown.bat
trunk/eXist/installer/scripts/shutdown.sh
trunk/eXist/installer/scripts/startup.bat
trunk/eXist/installer/scripts/startup.sh
Modified: trunk/eXist/bin/backup.bat
===================================================================
--- trunk/eXist/bin/backup.bat 2009-12-28 17:59:15 UTC (rev 10898)
+++ trunk/eXist/bin/backup.bat 2009-12-28 18:07:14 UTC (rev 10899)
@@ -21,6 +21,8 @@
if not "%JAVA_HOME%" == "" goto gotJavaHome
+rem @WINDOWS_INSTALLER_1@
+
echo Java environment not found. Please set
echo your JAVA_HOME environment variable to
echo the home of your JDK.
@@ -29,12 +31,15 @@
:gotJavaHome
if not "%EXIST_HOME%" == "" goto gotExistHome
-rem try to guess (will be set by the installer)
+rem try to guess (will be overridden by the installer)
set EXIST_HOME=.
-if exist %EXIST_HOME%\start.jar goto gotExistHome
+rem @WINDOWS_INSTALLER_2@
+
+if exist "%EXIST_HOME%\start.jar" goto gotExistHome
+
set EXIST_HOME=..
-if exist %EXIST_HOME%\start.jar goto gotExistHome
+if exist "%EXIST_HOME%\start.jar" goto gotExistHome
echo EXIST_HOME not found. Please set your
echo EXIST_HOME environment variable to the
Modified: trunk/eXist/bin/backup.sh
===================================================================
--- trunk/eXist/bin/backup.sh 2009-12-28 17:59:15 UTC (rev 10898)
+++ trunk/eXist/bin/backup.sh 2009-12-28 18:07:14 UTC (rev 10899)
@@ -5,6 +5,8 @@
# $Id$
# -----------------------------------------------------------------------------
+## @UNIX_INSTALLER_1@
+
#
# In addition to the other parameter options for the interactive client
# pass -j or --jmx to enable JMX agent. The port for it can be specified
Modified: trunk/eXist/bin/client.bat
===================================================================
--- trunk/eXist/bin/client.bat 2009-12-28 17:59:15 UTC (rev 10898)
+++ trunk/eXist/bin/client.bat 2009-12-28 18:07:14 UTC (rev 10899)
@@ -12,20 +12,24 @@
if not "%JAVA_HOME%" == "" goto gotJavaHome
+rem @WINDOWS_INSTALLER_1@
+
echo Java environment not found. Please set
echo your JAVA_HOME environment variable to
echo the home of your JDK.
goto :eof
:gotJavaHome
+rem @WINDOWS_INSTALLER_2@
+
if not "%EXIST_HOME%" == "" goto gotExistHome
rem try to guess (will be set by the installer)
set EXIST_HOME=.
+if exist "%EXIST_HOME%\start.jar" goto gotExistHome
-if exist %EXIST_HOME%\start.jar goto gotExistHome
set EXIST_HOME=..
-if exist %EXIST_HOME%\start.jar goto gotExistHome
+if exist "%EXIST_HOME%\start.jar" goto gotExistHome
echo EXIST_HOME not found. Please set your
echo EXIST_HOME environment variable to the
Modified: trunk/eXist/bin/client.sh
===================================================================
--- trunk/eXist/bin/client.sh 2009-12-28 17:59:15 UTC (rev 10898)
+++ trunk/eXist/bin/client.sh 2009-12-28 18:07:14 UTC (rev 10899)
@@ -5,6 +5,8 @@
# $Id$
# -----------------------------------------------------------------------------
+## @UNIX_INSTALLER_1@
+
#
# In addition to the other parameter options for the interactive client
# pass -j or --jmx to enable JMX agent. The port for it can be specified
Modified: trunk/eXist/bin/run.bat
===================================================================
--- trunk/eXist/bin/run.bat 2009-12-28 17:59:15 UTC (rev 10898)
+++ trunk/eXist/bin/run.bat 2009-12-28 18:07:14 UTC (rev 10899)
@@ -18,8 +18,9 @@
rem and for NT handling to skip to.
:doneStart
+if not "%JAVA_HOME%" == "" goto gotJavaHome
+rem @WINDOWS_INSTALLER_1@
-
if not "%JAVA_HOME%" == "" goto gotJavaHome
echo Java environment not found. Please set
echo your JAVA_HOME environment variable to
@@ -27,13 +28,15 @@
goto :eof
:gotJavaHome
+rem @WINDOWS_INSTALLER_2@
+
if not "%EXIST_HOME%" == "" goto gotExistHome
rem try to guess
set EXIST_HOME=.
-if exist %EXIST_HOME%\start.jar goto gotExistHome
+if exist "%EXIST_HOME%\start.jar" goto gotExistHome
set EXIST_HOME=..
-if exist %EXIST_HOME%\start.jar goto gotExistHome
+if exist "%EXIST_HOME%\start.jar" goto gotExistHome
echo EXIST_HOME not found. Please set your
echo EXIST_HOME environment variable to the
Modified: trunk/eXist/bin/server.bat
===================================================================
--- trunk/eXist/bin/server.bat 2009-12-28 17:59:15 UTC (rev 10898)
+++ trunk/eXist/bin/server.bat 2009-12-28 18:07:14 UTC (rev 10899)
@@ -13,20 +13,26 @@
if not "%JAVA_HOME%" == "" goto gotJavaHome
+rem @WINDOWS_INSTALLER_1@
+
+if not "%JAVA_HOME%" == "" goto gotJavaHome
+
echo Java environment not found. Please set
echo your JAVA_HOME environment variable to
echo the home of your JDK.
goto :eof
:gotJavaHome
+rem @WINDOWS_INSTALLER_2@
+
if not "%EXIST_HOME%" == "" goto gotExistHome
rem try to guess (will be set by the installer)
set EXIST_HOME=.
-if exist %EXIST_HOME%\start.jar goto gotExistHome
+if exist "%EXIST_HOME%\start.jar" goto gotExistHome
set EXIST_HOME=..
-if exist %EXIST_HOME%\start.jar goto gotExistHome
+if exist "%EXIST_HOME%\start.jar" goto gotExistHome
echo EXIST_HOME not found. Please set your
echo EXIST_HOME environment variable to the
Modified: trunk/eXist/bin/server.sh
===================================================================
--- trunk/eXist/bin/server.sh 2009-12-28 17:59:15 UTC (rev 10898)
+++ trunk/eXist/bin/server.sh 2009-12-28 18:07:14 UTC (rev 10899)
@@ -5,6 +5,8 @@
# $Id$
# -----------------------------------------------------------------------------
+## @UNIX_INSTALLER_1@
+
#
# In addition to the other parameter options for the standalone server
# pass -j or --jmx to enable JMX agent. The port for it can be specified
Modified: trunk/eXist/bin/shutdown.bat
===================================================================
--- trunk/eXist/bin/shutdown.bat 2009-12-28 17:59:15 UTC (rev 10898)
+++ trunk/eXist/bin/shutdown.bat 2009-12-28 18:07:14 UTC (rev 10899)
@@ -19,7 +19,10 @@
:doneStart
+if not "%JAVA_HOME%" == "" goto gotJavaHome
+rem @WINDOWS_INSTALLER_1@
+
if not "%JAVA_HOME%" == "" goto gotJavaHome
echo Java environment not found. Please set
@@ -28,14 +31,16 @@
goto :eof
:gotJavaHome
+rem @WINDOWS_INSTALLER_2@
+
if not "%EXIST_HOME%" == "" goto gotExistHome
rem try to guess (will be set by the installer)
set EXIST_HOME=.
-if exist %EXIST_HOME%\start.jar goto gotExistHome
+if exist "%EXIST_HOME%\start.jar" goto gotExistHome
set EXIST_HOME=..
-if exist %EXIST_HOME%\start.jar goto gotExistHome
+if exist "%EXIST_HOME%\start.jar" goto gotExistHome
echo EXIST_HOME not found. Please set your
echo EXIST_HOME environment variable to the
Modified: trunk/eXist/bin/shutdown.sh
===================================================================
--- trunk/eXist/bin/shutdown.sh 2009-12-28 17:59:15 UTC (rev 10898)
+++ trunk/eXist/bin/shutdown.sh 2009-12-28 18:07:14 UTC (rev 10899)
@@ -5,6 +5,8 @@
# $Id$
# -----------------------------------------------------------------------------
+## @UNIX_INSTALLER_1@
+
case "$0" in
/*)
SCRIPTPATH=$(dirname "$0")
Modified: trunk/eXist/bin/startup.bat
===================================================================
--- trunk/eXist/bin/startup.bat 2009-12-28 17:59:15 UTC (rev 10898)
+++ trunk/eXist/bin/startup.bat 2009-12-28 18:07:14 UTC (rev 10899)
@@ -13,20 +13,26 @@
if not "%JAVA_HOME%" == "" goto gotJavaHome
+rem @WINDOWS_INSTALLER_1@
+
+if not "%JAVA_HOME%" == "" goto gotJavaHome
+
echo Java environment not found. Please set
echo your JAVA_HOME environment variable to
echo the home of your JDK.
goto :eof
:gotJavaHome
+rem @WINDOWS_INSTALLER_2@
+
if not "%EXIST_HOME%" == "" goto gotExistHome
rem try to guess
set EXIST_HOME=.
-if exist %EXIST_HOME%\start.jar goto gotExistHome
+if exist "%EXIST_HOME%\start.jar" goto gotExistHome
set EXIST_HOME=..
-if exist %EXIST_HOME%\start.jar goto gotExistHome
+if exist "%EXIST_HOME%\start.jar" goto gotExistHome
echo EXIST_HOME not found. Please set your
echo EXIST_HOME environment variable to the
Modified: trunk/eXist/bin/startup.sh
===================================================================
--- trunk/eXist/bin/startup.sh 2009-12-28 17:59:15 UTC (rev 10898)
+++ trunk/eXist/bin/startup.sh 2009-12-28 18:07:14 UTC (rev 10899)
@@ -5,6 +5,8 @@
# $Id$
# -----------------------------------------------------------------------------
+## @UNIX_INSTALLER_1@
+
#
# In addition to the other parameter options for the jetty container
# pass -j or --jmx to enable JMX agent. The port for it can be specified
Modified: trunk/eXist/bin/startupCluster.bat
===================================================================
--- trunk/eXist/bin/startupCluster.bat 2009-12-28 17:59:15 UTC (rev 10898)
+++ trunk/eXist/bin/startupCluster.bat 2009-12-28 18:07:14 UTC (rev 10899)
@@ -19,7 +19,10 @@
:doneStart
+if not "%JAVA_HOME%" == "" goto gotJavaHome
+rem @WINDOWS_INSTALLER_1@
+
if not "%JAVA_HOME%" == "" goto gotJavaHome
echo Java environment not found. Please set
echo your JAVA_HOME environment variable to
@@ -27,13 +30,15 @@
goto :eof
:gotJavaHome
+rem @WINDOWS_INSTALLER_2@
+
if not "%EXIST_HOME%" == "" goto gotExistHome
rem try to guess
set EXIST_HOME=.
-if exist %EXIST_HOME%\start.jar goto gotExistHome
+if exist "%EXIST_HOME%\start.jar" goto gotExistHome
set EXIST_HOME=..
-if exist %EXIST_HOME%\start.jar goto gotExistHome
+if exist "%EXIST_HOME%\start.jar" goto gotExistHome
echo EXIST_HOME not found. Please set your
echo EXIST_HOME environment variable to the
Deleted: trunk/eXist/installer/scripts/backup.bat
===================================================================
--- trunk/eXist/installer/scripts/backup.bat 2009-12-28 17:59:15 UTC (rev 10898)
+++ trunk/eXist/installer/scripts/backup.bat 2009-12-28 18:07:14 UTC (rev 10899)
@@ -1,54 +0,0 @@
-@echo off
-
-rem $Id$
-
-rem Slurp the command line arguments. This loop allows for an unlimited number
-rem of arguments (up to the command line limit, anyway).
-
-set CMD_LINE_ARGS=%1
-if ""%1""=="""" goto doneStart
-shift
-:setupArgs
-if ""%1""=="""" goto doneStart
-set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
-shift
-goto setupArgs
-
-rem This label provides a place for the argument list loop to break out
-rem and for NT handling to skip to.
-
-:doneStart
-
-if not "%JAVA_HOME%" == "" goto gotJavaHome
-
-rem will be set by the installer
-set JAVA_HOME="$JDKPath"
-
-rem second check
-if not "%JAVA_HOME%" == "" goto gotJavaHome
-
-echo Java environment not found. Please set
-echo your JAVA_HOME environment variable to
-echo the home of your JDK.
-goto :eof
-
-:gotJavaHome
-rem will be set by the installer
-set EXIST_HOME=$INSTALL_PATH
-
-if exist "%EXIST_HOME%\start.jar" goto gotExistHome
-set EXIST_HOME=..
-if exist "%EXIST_HOME%\start.jar" goto gotExistHome
-
-echo EXIST_HOME not found. Please set your
-echo EXIST_HOME environment variable to the
-echo home directory of eXist.
-goto :eof
-
-:gotExistHome
-set JAVA_ENDORSED_DIRS="%EXIST_HOME%"\lib\endorsed
-set JAVA_OPTS="-Xms128m -Xmx512m -Dfile.encoding=UTF-8 -Djava.endorsed.dirs=%JAVA_ENDORSED_DIRS%"
-
-"%JAVA_HOME%\bin\java" "%JAVA_OPTS%" -Dexist.home="%EXIST_HOME%" -jar "%EXIST_HOME%\start.jar" backup %CMD_LINE_ARGS%
-:eof
-
Deleted: trunk/eXist/installer/scripts/backup.sh
===================================================================
--- trunk/eXist/installer/scripts/backup.sh 2009-12-28 17:59:15 UTC (rev 10898)
+++ trunk/eXist/installer/scripts/backup.sh 2009-12-28 18:07:14 UTC (rev 10899)
@@ -1,58 +0,0 @@
-#!/bin/bash
-# -----------------------------------------------------------------------------
-# backup.sh - Backup tool start script
-#
-# $Id$
-# -----------------------------------------------------------------------------
-
-# will be set by the installer
-if [ -z "$EXIST_HOME" ]; then
- EXIST_HOME="%{INSTALL_PATH}"
-fi
-
-if [ -z "$JAVA_HOME" ]; then
- JAVA_HOME="%{JDKPath}"
-fi
-
-if [ ! -d "$JAVA_HOME" ]; then
- JAVA_HOME="%{JAVA_HOME}"
-fi
-
-#
-# In addition to the other parameter options for the interactive client
-# pass -j or --jmx to enable JMX agent. The port for it can be specified
-# with optional port number e.g. -j1099 or --jmx=1099.
-#
-
-case "$0" in
- /*)
- SCRIPTPATH=$(dirname "$0")
- ;;
- *)
- SCRIPTPATH=$(dirname "$PWD/$0")
- ;;
-esac
-
-# source common functions and settings
-source "${SCRIPTPATH}"/functions.d/eXist-settings.sh
-source "${SCRIPTPATH}"/functions.d/jmx-settings.sh
-source "${SCRIPTPATH}"/functions.d/getopt-settings.sh
-
-get_opts "$@";
-
-check_exist_home "$0";
-
-set_exist_options;
-
-# set java options
-set_client_java_options;
-
-# enable the JMX agent? If so, concat to $JAVA_OPTIONS:
-check_jmx_status;
-
-# save LANG
-set_locale_lang;
-
-"${JAVA_HOME}"/bin/java ${JAVA_OPTIONS} ${OPTIONS} ${DEBUG_OPTS} -jar "$EXIST_HOME/start.jar" backup "${JAVA_OPTS[@]}"
-
-restore_locale_lang;
Deleted: trunk/eXist/installer/scripts/client.bat
===================================================================
--- trunk/eXist/installer/scripts/client.bat 2009-12-28 17:59:15 UTC (rev 10898)
+++ trunk/eXist/installer/scripts/client.bat 2009-12-28 18:07:14 UTC (rev 10899)
@@ -1,47 +0,0 @@
-@echo off
-rem $Id$
-rem
-rem In addition to the other parameter options for the interactive client
-rem pass -j or --jmx to enable JMX agent. The port for it can be specified
-rem with optional port number e.g. -j1099 or --jmx=1099.
-rem
-
-set JMX_ENABLED=0
-set JMX_PORT=1099
-set JAVA_ARGS=
-
-if not "%JAVA_HOME%" == "" goto gotJavaHome
-
-rem will be set by the installer
-set JAVA_HOME=$JDKPath
-
-if not "%JAVA_HOME%" == "" goto gotJavaHome
-
-echo Java environment not found. Please set
-echo your JAVA_HOME environment variable to
-echo the home of your JDK.
-goto :eof
-
-:gotJavaHome
-rem will be set by the installer
-set EXIST_HOME=$INSTALL_PATH
-
-if exist "%EXIST_HOME%\start.jar" goto gotExistHome
-set EXIST_HOME=..
-if exist "%EXIST_HOME%\start.jar" goto gotExistHome
-
-echo EXIST_HOME not found. Please set your
-echo EXIST_HOME environment variable to the
-echo home directory of eXist.
-goto :eof
-
-:gotExistHome
-set JAVA_ENDORSED_DIRS="%EXIST_HOME%"\lib\endorsed
-set JAVA_OPTS="-Xms128m -Xmx512m -Dfile.encoding=UTF-8 -Djava.endorsed.dirs=%JAVA_ENDORSED_DIRS%"
-
-set BATCH.D="%EXIST_HOME%\bin\batch.d"
-call %BATCH.D%\get_opts.bat %*
-call %BATCH.D%\check_jmx_status.bat
-
-"%JAVA_HOME%\bin\java" "%JAVA_OPTS%" -Dexist.home="%EXIST_HOME%" -jar "%EXIST_HOME%\start.jar" client %JAVA_ARGS%
-:eof
Deleted: trunk/eXist/installer/scripts/client.sh
===================================================================
--- trunk/eXist/installer/scripts/client.sh 2009-12-28 17:59:15 UTC (rev 10898)
+++ trunk/eXist/installer/scripts/client.sh 2009-12-28 18:07:14 UTC (rev 10899)
@@ -1,62 +0,0 @@
-#!/bin/bash
-# -----------------------------------------------------------------------------
-# client.sh - Start Script for eXist interactive client
-#
-# $Id$
-# -----------------------------------------------------------------------------
-
-# will be set by the installer
-if [ -z "$EXIST_HOME" ]; then
- EXIST_HOME="%{INSTALL_PATH}"
-fi
-
-if [ -z "$JAVA_HOME" ]; then
- JAVA_HOME="%{JDKPath}"
-fi
-
-if [ ! -d "$JAVA_HOME" ]; then
- JAVA_HOME="%{JAVA_HOME}"
-fi
-
-#
-# In addition to the other parameter options for the interactive client
-# pass -j or --jmx to enable JMX agent. The port for it can be specified
-# with optional port number e.g. -j1099 or --jmx=1099.
-#
-
-case "$0" in
- /*)
- SCRIPTPATH=$(dirname "$0")
- ;;
- *)
- SCRIPTPATH=$(dirname "$PWD/$0")
- ;;
-esac
-
-# source common functions and settings
-source "${SCRIPTPATH}"/functions.d/eXist-settings.sh
-source "${SCRIPTPATH}"/functions.d/jmx-settings.sh
-source "${SCRIPTPATH}"/functions.d/getopt-settings.sh
-
-get_opts "$@";
-
-check_exist_home "$0";
-
-set_exist_options;
-
-# set java options
-set_client_java_options;
-
-# enable the JMX agent? If so, concat to $JAVA_OPTIONS:
-check_jmx_status;
-
-# save LANG
-set_locale_lang;
-
-# save LD_LIBRARY_PATH
-set_library_path;
-
-"${JAVA_HOME}"/bin/java ${JAVA_OPTIONS} ${OPTIONS} ${DEBUG_OPTS} -jar "$EXIST_HOME/start.jar" client "${JAVA_OPTS[@]}"
-
-restore_library_path;
-restore_locale_lang;
Added: trunk/eXist/installer/scripts/scripts.properties
===================================================================
--- trunk/eXist/installer/scripts/scripts.properties (rev 0)
+++ trunk/eXist/installer/scripts/scripts.properties 2009-12-28 18:07:14 UTC (rev 10899)
@@ -0,0 +1,21 @@
+UNIX_INSTALLER_1=\
+will be set by the installer\n\
+if [ -z "$EXIST_HOME" ]; then\n\
+\tEXIST_HOME="%{INSTALL_PATH}"\n\
+fi\n\n\
+if [ -z "$JAVA_HOME" ]; then\n\
+\tJAVA_HOME="%{JDKPath}"\n\
+fi\n\n\
+if [ ! -d "$JAVA_HOME" ]; then\n\
+\tJAVA_HOME="%{JAVA_HOME}"\n\
+fi\n\n
+WINDOWS_INSTALLER_1=\
+will be set by the installer\r\n\
+set JAVA_HOME="$JDKPath"\r\n\
+\r\n\
+rem second check\r\n\
+if not "%JAVA_HOME%" == "" goto gotJavaHome\r\n
+WINDOWS_INSTALLER_2=\
+will be set by the installer\r\n\
+set EXIST_HOME=$INSTALL_PATH\r\n\
+\r\n
\ No newline at end of file
Deleted: trunk/eXist/installer/scripts/server.bat
===================================================================
--- trunk/eXist/installer/scripts/server.bat 2009-12-28 17:59:15 UTC (rev 10898)
+++ trunk/eXist/installer/scripts/server.bat 2009-12-28 18:07:14 UTC (rev 10899)
@@ -1,48 +0,0 @@
-@echo off
-
-rem $Id$
-rem
-rem In addition to the other parameter options for the standalone server
-rem pass -j or --jmx to enable JMX agent. The port for it can be specified
-rem with optional port number e.g. -j1099 or --jmx=1099.
-rem
-
-set JMX_ENABLED=0
-set JMX_PORT=1099
-set JAVA_ARGS=
-
-if not "%JAVA_HOME%" == "" goto gotJavaHome
-
-rem will be set by the installer
-set JAVA_HOME=$JDKPath
-
-if not "%JAVA_HOME%" == "" goto gotJavaHome
-
-echo Java environment not found. Please set
-echo your JAVA_HOME environment variable to
-echo the home of your JDK.
-goto :eof
-
-:gotJavaHome
-rem will be set by the installer
-set EXIST_HOME=$INSTALL_PATH
-
-if exist "%EXIST_HOME%\start.jar" goto gotExistHome
-set EXIST_HOME=..
-if exist "%EXIST_HOME%\start.jar" goto gotExistHome
-
-echo EXIST_HOME not found. Please set your
-echo EXIST_HOME environment variable to the
-echo home directory of eXist.
-goto :eof
-
-:gotExistHome
-set JAVA_ENDORSED_DIRS="%EXIST_HOME%"\lib\endorsed
-set JAVA_OPTS="-Xms128m -Xmx512m -Dfile.encoding=UTF-8 -Djava.endorsed.dirs=%JAVA_ENDORSED_DIRS%"
-
-set BATCH.D="%EXIST_HOME%\bin\batch.d"
-call %BATCH.D%\get_opts.bat %*
-call %BATCH.D%\check_jmx_status.bat
-
-"%JAVA_HOME%\bin\java" "%JAVA_OPTS%" -Dexist.home="%EXIST_HOME%" -jar "%EXIST_HOME%\start.jar" standalone %JAVA_ARGS%
-:eof
Deleted: trunk/eXist/installer/scripts/server.sh
===================================================================
--- trunk/eXist/installer/scripts/server.sh 2009-12-28 17:59:15 UTC (rev 10898)
+++ trunk/eXist/installer/scripts/server.sh 2009-12-28 18:07:14 UTC (rev 10899)
@@ -1,58 +0,0 @@
-#!/bin/bash
-# -----------------------------------------------------------------------------
-# startup.sh - Start Script for Jetty + eXist
-#
-# $Id$
-# -----------------------------------------------------------------------------
-
-# will be set by the installer
-if [ -z "$EXIST_HOME" ]; then
- EXIST_HOME="%{INSTALL_PATH}"
-fi
-
-if [ -z "$JAVA_HOME" ]; then
- JAVA_HOME="%{JDKPath}"
-fi
-
-if [ ! -d "$JAVA_HOME" ]; then
- JAVA_HOME="%{JAVA_HOME}"
-fi
-
-#
-# In addition to the other parameter options for the standalone server
-# pass -j or --jmx to enable JMX agent. The port for it can be specified
-# with optional port number e.g. -j1099 or --jmx=1099.
-#
-
-case "$0" in
- /*)
- SCRIPTPATH=$(dirname "$0")
- ;;
- *)
- SCRIPTPATH=$(dirname "$PWD/$0")
- ;;
-esac
-
-# source common functions and settings
-source "${SCRIPTPATH}"/functions.d/eXist-settings.sh
-source "${SCRIPTPATH}"/functions.d/jmx-settings.sh
-source "${SCRIPTPATH}"/functions.d/getopt-settings.sh
-
-get_opts "$@";
-
-check_exist_home "$0";
-
-set_exist_options;
-
-# set java options
-set_java_options;
-
-# enable the JMX agent? If so, concat to $JAVA_OPTIONS:
-check_jmx_status;
-
-# save LANG
-set_locale_lang;
-
-"$JAVA_HOME"/bin/java $JAVA_OPTIONS $OPTIONS -jar "$EXIST_HOME/start.jar" standalone "${JAVA_OPTS[@]}"
-
-restore_locale_lang;
Deleted: trunk/eXist/installer/scripts/shutdown.bat
===================================================================
--- trunk/eXist/installer/scripts/shutdown.bat 2009-12-28 17:59:15 UTC (rev 10898)
+++ trunk/eXist/installer/scripts/shutdown.bat 2009-12-28 18:07:14 UTC (rev 10899)
@@ -1,50 +0,0 @@
-@echo off
-
-rem $Id$
-
-rem Slurp the command line arguments. This loop allows for an unlimited number
-rem of arguments (up to the command line limit, anyway).
-
-set CMD_LINE_ARGS=%1
-if ""%1""=="""" goto doneStart
-shift
-:setupArgs
-if ""%1""=="""" goto doneStart
-set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
-shift
-goto setupArgs
-
-rem This label provides a place for the argument list loop to break out
-rem and for NT handling to skip to.
-
-:doneStart
-
-
-if not "%JAVA_HOME%" == "" goto gotJavaHome
-
-rem will be set by the installer
-set JAVA_HOME=$JDKPath
-
-if not "%JAVA_HOME%" == "" goto gotJavaHome
-
-echo Java environment not found. Please set
-echo your JAVA_HOME environment variable to
-echo the home of your JDK.
-goto :eof
-
-:gotJavaHome
-rem will be set by the installer
-set EXIST_HOME=$INSTALL_PATH
-
-if exist "%EXIST_HOME%\start.jar" goto gotExistHome
-set EXIST_HOME=..
-if exist "%EXIST_HOME%\start.jar" goto gotExistHome
-
-echo EXIST_HOME not found. Please set your
-echo EXIST_HOME environment variable to the
-echo home directory of eXist.
-goto :eof
-
-:gotExistHome
-"%JAVA_HOME%\bin\java" -Dexist.home="%EXIST_HOME%" -jar "%EXIST_HOME%\start.jar" shutdown %CMD_LINE_ARGS%
-:eof
Deleted: trunk/eXist/installer/scripts/shutdown.sh
===================================================================
--- trunk/eXist/installer/scripts/shutdown.sh 2009-12-28 17:59:15 UTC (rev 10898)
+++ trunk/eXist/installer/scripts/shutdown.sh 2009-12-28 18:07:14 UTC (rev 10899)
@@ -1,43 +0,0 @@
-#!/bin/bash
-# -----------------------------------------------------------------------------
-# shutdown.sh - Stop Jetty + eXist
-#
-# $Id$
-# -----------------------------------------------------------------------------
-
-# will be set by the installer
-if [ -z "$EXIST_HOME" ]; then
- EXIST_HOME="%{INSTALL_PATH}"
-fi
-
-if [ -z "$JAVA_HOME" ]; then
- JAVA_HOME="%{JDKPath}"
-fi
-
-if [ ! -d "$JAVA_HOME" ]; then
- JAVA_HOME="%{JAVA_HOME}"
-fi
-
-case "$0" in
- /*)
- SCRIPTPATH=$(dirname "$0")
- ;;
- *)
- SCRIPTPATH=$(dirname "$PWD/$0")
- ;;
-esac
-
-# source common functions and settings
-source "${SCRIPTPATH}"/functions.d/eXist-settings.sh
-source "${SCRIPTPATH}"/functions.d/jmx-settings.sh
-source "${SCRIPTPATH}"/functions.d/getopt-settings.sh
-
-check_exist_home "$0";
-
-set_exist_options;
-
-# set java options
-set_java_options;
-
-"${JAVA_HOME}"/bin/java ${JAVA_OPTIONS} ${OPTIONS} -jar "$EXIST_HOME/start.jar" \
- shutdown $*
Deleted: trunk/eXist/installer/scripts/startup.bat
===================================================================
--- trunk/eXist/installer/scripts/startup.bat 2009-12-28 17:59:15 UTC (rev 10898)
+++ trunk/eXist/installer/scripts/startup.bat 2009-12-28 18:07:14 UTC (rev 10899)
@@ -1,49 +0,0 @@
-@echo off
-
-rem $Id$
-rem
-rem In addition to the other parameter options for the Jetty container
-rem pass -j or --jmx to enable JMX agent. The port for it can be specified
-rem with optional port number e.g. -j1099 or --jmx=1099.
-rem
-
-set JMX_ENABLED=0
-set JMX_PORT=1099
-set JAVA_ARGS=
-
-if not "%JAVA_HOME%" == "" goto gotJavaHome
-
-rem will be set by the installer
-set JAVA_HOME=$JDKPath
-
-if not "%JAVA_HOME%" == "" goto gotJavaHome
-
-echo Java environment not found. Please set
-echo your JAVA_HOME environment variable to
-echo the home of your JDK.
-goto :eof
-
-:gotJavaHome
-rem will be set by the installer
-set EXIST_HOME=$INSTALL_PATH
-
-if exist "%EXIST_HOME%\start.jar" goto gotExistHome
-set EXIST_HOME=..
-if exist "%EXIST_HOME%\start.jar" goto gotExistHome
-
-echo EXIST_HOME not found. Please set your
-echo EXIST_HOME environment variable to the
-echo home directory of eXist.
-goto :eof
-
-:gotExistHome
-set JAVA_ENDORSED_DIRS="%EXIST_HOME%"\lib\endorsed
-set JAVA_OPTS="-Xms128m -Xmx512m -Dfile.encoding=UTF-8 -Djava.endorsed.dirs=%JAVA_ENDORSED_DIRS%"
-
-set BATCH.D="%EXIST_HOME%\bin\batch.d"
-call %BATCH.D%\get_opts.bat %*
-call %BATCH.D%\check_jmx_status.bat
-
-"%JAVA_HOME%\bin\java" "%JAVA_OPTS%" -Dexist.home="%EXIST_HOME%" -jar "%EXIST_HOME%\start.jar" jetty %JAVA_ARGS%
-:eof
-
Deleted: trunk/eXist/installer/scripts/startup.sh
===================================================================
--- trunk/eXist/installer/scripts/startup.sh 2009-12-28 17:59:15 UTC (rev 10898)
+++ trunk/eXist/installer/scripts/startup.sh 2009-12-28 18:07:14 UTC (rev 10899)
@@ -1,64 +0,0 @@
-#!/bin/bash
-# -----------------------------------------------------------------------------
-# startup.sh - Start Script for Jetty + eXist
-#
-# $Id$
-# -----------------------------------------------------------------------------
-
-# will be set by the installer
-if [ -z "$EXIST_HOME" ]; then
- EXIST_HOME="%{INSTALL_PATH}"
-fi
-
-if [ -z "$JAVA_HOME" ]; then
- JAVA_HOME="%{JDKPath}"
-fi
-
-if [ ! -d "$JAVA_HOME" ]; then
- JAVA_HOME="%{JAVA_HOME}"
-fi
-
-#
-# In addition to the other parameter options for the jetty container
-# pass -j or --jmx to enable JMX agent. The port for it can be specified
-# with optional port number e.g. -j1099 or --jmx=1099.
-#
-usage="startup.sh [-j[jmx-port]|--jmx[=jmx-port]]\n"
-
-#DEBUG_OPTS="-Dexist.start.debug=true"
-
-case "$0" in
- /*)
- SCRIPTPATH=$(dirname "$0")
- ;;
- *)
- SCRIPTPATH=$(dirname "$PWD/$0")
- ;;
-esac
-
-# source common functions and settings
-source "${SCRIPTPATH}"/functions.d/eXist-settings.sh
-source "${SCRIPTPATH}"/functions.d/jmx-settings.sh
-source "${SCRIPTPATH}"/functions.d/getopt-settings.sh
-
-get_opts "$@";
-
-check_exist_home "$0";
-
-set_exist_options;
-set_jetty_home;
-
-# set java options
-set_java_options;
-
-# save LANG
-set_locale_lang;
-
-# enable the JMX agent? If so, concat to $JAVA_OPTIONS:
-check_jmx_status;
-
-"${JAVA_HOME}"/bin/java ${JAVA_OPTIONS} ${OPTIONS} \
- ${DEBUG_OPTS} -jar "$EXIST_HOME/start.jar" \
- jetty ${JAVA_OPTS[@]}
-
-restore_locale_lang;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2009-12-28 17:59:25
|
Revision: 10898
http://exist.svn.sourceforge.net/exist/?rev=10898&view=rev
Author: dizzzz
Date: 2009-12-28 17:59:15 +0000 (Mon, 28 Dec 2009)
Log Message:
-----------
[ignore] force Java6 for installer
Modified Paths:
--------------
trunk/eXist/installer/install.xml.tmpl
Modified: trunk/eXist/installer/install.xml.tmpl
===================================================================
--- trunk/eXist/installer/install.xml.tmpl 2009-12-28 17:57:44 UTC (rev 10897)
+++ trunk/eXist/installer/install.xml.tmpl 2009-12-28 17:59:15 UTC (rev 10898)
@@ -34,7 +34,7 @@
<variables>
<variable name="JETTY_HOME" value="$EXIST_HOME/tools/jetty"/>
<variable name="JDKPathPanel.skipIfValid" value="yes"/>
- <variable name="JDKPathPanel.minVersion" value="1.5"/>
+ <variable name="JDKPathPanel.minVersion" value="1.6"/>
<variable name="dataDir" value="webapp/WEB-INF/data" />
</variables>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <del...@us...> - 2009-12-28 17:57:53
|
Revision: 10897
http://exist.svn.sourceforge.net/exist/?rev=10897&view=rev
Author: deliriumsky
Date: 2009-12-28 17:57:44 +0000 (Mon, 28 Dec 2009)
Log Message:
-----------
Moved test libs into dedicated folder. Preparing the way for better testing hopefully, need this for JSR-225 stuff
Modified Paths:
--------------
trunk/eXist/.classpath
trunk/eXist/build/scripts/junit.xml
trunk/eXist/build.properties
trunk/eXist/extensions/fluent/build.xml
trunk/eXist/extensions/xqdoc/build.xml
trunk/eXist/nbproject/project.properties
Added Paths:
-----------
trunk/eXist/lib/test/
trunk/eXist/lib/test/easymock-2.5.2.jar
trunk/eXist/lib/test/easymockclassextension-2.5.2.jar
trunk/eXist/lib/test/junit-4.6.jar
Removed Paths:
-------------
trunk/eXist/tools/ant/lib/junit-4.6.jar
Modified: trunk/eXist/.classpath
===================================================================
--- trunk/eXist/.classpath 2009-12-28 17:07:36 UTC (rev 10896)
+++ trunk/eXist/.classpath 2009-12-28 17:57:44 UTC (rev 10897)
@@ -68,7 +68,7 @@
<classpathentry kind="lib" path="thirdparty/tomcat5/bin/jmx.jar"/>
<classpathentry kind="lib" path="thirdparty/tomcat5/server/lib/catalina-5.0.28.jar"/>
<classpathentry kind="lib" path="tools/ant/lib/ant.jar"/>
- <classpathentry kind="lib" path="tools/ant/lib/junit-4.6.jar"/>
+ <classpathentry kind="lib" path="lib/test/junit-4.6.jar"/>
<classpathentry kind="lib" path="tools/ant/lib/xmlunit-1.2.jar"/>
<classpathentry kind="lib" path="tools/ircbot/lib/pircbot.jar"/>
<classpathentry kind="lib" path="tools/wrapper/lib/wrapper.jar"/>
Modified: trunk/eXist/build/scripts/junit.xml
===================================================================
--- trunk/eXist/build/scripts/junit.xml 2009-12-28 17:07:36 UTC (rev 10896)
+++ trunk/eXist/build/scripts/junit.xml 2009-12-28 17:57:44 UTC (rev 10897)
@@ -9,14 +9,20 @@
<description>jUnit tests for eXist</description>
- <!-- import common targets -->
- <import file="../../build.xml"/>
+ <!-- import common targets -->
+ <import file="../../build.xml"/>
- <path id="classpath.junit">
+ <path id="classpath.junit">
<pathelement path="${junit.reports}/classes"/>
</path>
+ <path id="classpath.test-libs">
+ <fileset dir="${lib.test}">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+
<target name="test"
depends="test-prepare, test-local, test-fluent, test-indexing, test-xqdoc, test-jetty, test-concurrent, test-remote, test-recovery, test-wrapup, test-ant"
description="Run jUnit tests"/>
@@ -39,6 +45,7 @@
<classpath>
<path refid="classpath.core"/>
<path refid="classpath.jetty"/>
+ <path refid="classpath.test-libs"/>
</classpath>
</javac>
<copy todir="${junit.reports}/classes/org/exist/performance/ant"
@@ -89,6 +96,7 @@
<classpath refid="classpath.core"/>
<classpath refid="classpath.jetty"/>
<classpath refid="classpath.junit"/>
+ <classpath refid="classpath.test-libs"/>
<formatter type="plain"/>
<formatter type="xml"/>
@@ -142,6 +150,7 @@
<classpath refid="classpath.core"/>
<classpath refid="classpath.jetty"/>
<classpath refid="classpath.junit"/>
+ <classpath refid="classpath.test-libs"/>
<formatter type="plain"/>
<formatter type="xml"/>
@@ -168,6 +177,7 @@
<classpath refid="classpath.core"/>
<classpath refid="classpath.jetty"/>
<classpath refid="classpath.junit"/>
+ <classpath refid="classpath.test-libs"/>
<formatter type="plain"/>
<formatter type="xml"/>
@@ -184,6 +194,7 @@
<sysproperty key="exist.home" value="${basedir}" />
<classpath refid="classpath.core"/>
<classpath refid="classpath.junit"/>
+ <classpath refid="classpath.test-libs"/>
<formatter type="plain"/>
<formatter type="xml"/>
<test name="org.exist.storage.AllStorageTests" todir="${junit.reports.dat}"/>
@@ -232,6 +243,7 @@
<classpath refid="classpath.core"/>
<classpath refid="classpath.jetty"/>
<classpath refid="classpath.junit"/>
+ <classpath refid="classpath.test-libs"/>
<formatter type="plain"/>
<formatter type="xml"/>
@@ -256,6 +268,7 @@
<classpath refid="classpath.core"/>
<classpath refid="classpath.jetty"/>
<classpath refid="classpath.junit"/>
+ <classpath refid="classpath.test-libs"/>
<formatter type="plain"/>
<formatter type="xml"/>
@@ -273,7 +286,8 @@
<classpath refid="classpath.core"/>
<classpath refid="classpath.jetty"/>
<classpath refid="classpath.junit"/>
-
+ <classpath refid="classpath.test-libs"/>
+
<formatter type="plain"/>
<formatter type="xml"/>
<test fork="yes" name="org.exist.xquery.XQueryUpdateTest" todir="${junit.reports.dat}"/>
@@ -394,6 +408,7 @@
<classpath refid="classpath.jetty"/>
<classpath refid="classpath.ant_launcher"/>
<classpath refid="classpath.junit"/>
+ <classpath refid="classpath.test-libs"/>
<formatter type="plain"/>
<formatter type="xml"/>
<test name="org.exist.xquery.xqts.XQTS_1_0_2.AllTests" todir="${junit.reports.dat}"/>
@@ -411,6 +426,7 @@
<classpath refid="classpath.jetty"/>
<classpath refid="classpath.ant_launcher"/>
<classpath refid="classpath.junit"/>
+ <classpath refid="classpath.test-libs"/>
<formatter type="plain"/>
<formatter type="xml"/>
<test name="org.exist.xslt.xslts.AllTests" todir="${junit.reports.dat}"/>
Modified: trunk/eXist/build.properties
===================================================================
--- trunk/eXist/build.properties 2009-12-28 17:07:36 UTC (rev 10896)
+++ trunk/eXist/build.properties 2009-12-28 17:57:44 UTC (rev 10897)
@@ -35,6 +35,7 @@
lib.endorsed = ./lib/endorsed
lib.user = ./lib/user
lib.extensions = ./lib/extensions
+lib.test = ./lib/test
# antlr is only needed if you change the XPath/XQuery parser
# set these properties to true to get a lot of debugging output
Modified: trunk/eXist/extensions/fluent/build.xml
===================================================================
--- trunk/eXist/extensions/fluent/build.xml 2009-12-28 17:07:36 UTC (rev 10896)
+++ trunk/eXist/extensions/fluent/build.xml 2009-12-28 17:57:44 UTC (rev 10897)
@@ -44,6 +44,11 @@
<path id="classpath.jar">
<pathelement path="${top.dir}/exist-fluent.jar"/>
</path>
+ <path id="classpath.test-libs">
+ <fileset dir="${top.dir}/${lib.test}">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
<path id="classpath.test">
<pathelement path="${test}/classes"/>
</path>
@@ -82,6 +87,7 @@
source="${build.compiler.source}" target="${build.compiler.target}">
<classpath>
<path refid="classpath.core"/>
+ <path refid="classpath.test-libs"/>
<pathelement path="${classes}" />
</classpath>
</javac>
@@ -130,6 +136,7 @@
<path refid="classpath.core"/>
<path refid="classpath.jar"/>
<path refid="classpath.test"/>
+ <path refid="classpath.test-libs"/>
<pathelement path="${classes}" />
</classpath>
Modified: trunk/eXist/extensions/xqdoc/build.xml
===================================================================
--- trunk/eXist/extensions/xqdoc/build.xml 2009-12-28 17:07:36 UTC (rev 10896)
+++ trunk/eXist/extensions/xqdoc/build.xml 2009-12-28 17:57:44 UTC (rev 10897)
@@ -56,6 +56,12 @@
<pathelement path="${test.classes}"/>
</path>
+ <path id="classpath.test-libs">
+ <fileset dir="${top.dir}/${lib.test}">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+
<target name="prepare">
<mkdir dir="${xqdoc.classes}"/>
</target>
@@ -108,6 +114,7 @@
source="${build.compiler.source}" target="${build.compiler.target}">
<classpath>
<path refid="classpath.core"/>
+ <path refid="classpath.test-libs"/>
</classpath>
</javac>
</target>
@@ -117,6 +124,7 @@
<classpath refid="classpath.core"/>
<classpath refid="classpath.junit"/>
+ <classpath refid="classpath.test-libs"/>
<formatter type="plain"/>
<formatter type="xml"/>
Added: trunk/eXist/lib/test/easymock-2.5.2.jar
===================================================================
(Binary files differ)
Property changes on: trunk/eXist/lib/test/easymock-2.5.2.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/eXist/lib/test/easymockclassextension-2.5.2.jar
===================================================================
(Binary files differ)
Property changes on: trunk/eXist/lib/test/easymockclassextension-2.5.2.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Copied: trunk/eXist/lib/test/junit-4.6.jar (from rev 10887, trunk/eXist/tools/ant/lib/junit-4.6.jar)
===================================================================
(Binary files differ)
Modified: trunk/eXist/nbproject/project.properties
===================================================================
--- trunk/eXist/nbproject/project.properties 2009-12-28 17:07:36 UTC (rev 10896)
+++ trunk/eXist/nbproject/project.properties 2009-12-28 17:57:44 UTC (rev 10897)
@@ -10,6 +10,8 @@
file.reference.commons-jxpath-1.2.jar=extensions/cocoon/lib/commons-jxpath-1.2.jar
file.reference.commons-lang-2.0-20041007T2305.jar=extensions/cocoon/lib/commons-lang-2.0-20041007T2305.jar
file.reference.commons-pool-1.5.4.jar=lib/core/commons-pool-1.5.4.jar
+file.reference.easymock-2.5.2.jar=lib/test/easymock-2.5.2.jar
+file.reference.easymockclassextension-2.5.2.jar=lib/test/easymockclassextension-2.5.2.jar
file.reference.ehcache-1.1.jar=extensions/cocoon/lib/ehcache-1.1.jar
file.reference.excalibur-component-1.2.jar=extensions/cocoon/lib/excalibur-component-1.2.jar
file.reference.excalibur-datasource-1.1.1.jar=extensions/cocoon/lib/excalibur-datasource-1.1.1.jar
@@ -26,9 +28,12 @@
file.reference.excalibur-xmlutil-1.0.jar=extensions/cocoon/lib/excalibur-xmlutil-1.0.jar
file.reference.javacApi-0.9.jar=extensions/cocoon/lib/javacApi-0.9.jar
file.reference.javacImpl-0.9.jar=extensions/cocoon/lib/javacImpl-0.9.jar
+file.reference.junit-4.6.jar=lib/test/junit-4.6.jar
file.reference.logkit-1.2.2.jar=extensions/cocoon/lib/logkit-1.2.2.jar
file.reference.util.concurrent-1.3.4.jar=extensions/cocoon/lib/util.concurrent-1.3.4.jar
file.reference.xml-apis-1.4.01.jar=lib/endorsed/xml-apis-1.4.01.jar
+file.reference.xmlunit-1.2.jar=lib/test/xmlunit-1.2.jar
+file.reference.xmlunit-1.2.jar-1=tools/ant/lib/xmlunit-1.2.jar
jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api"
#Fri Dec 11 13:25:47 CET 2009
jmx.jconsole.enabled=true
@@ -72,7 +77,6 @@
javac.compilerargs=
file.reference.xmlrpc-common-3.1.2.jar=lib/core/xmlrpc-common-3.1.2.jar
file.reference.excalibur-naming-1.0.jar=lib/cocoon/excalibur-naming-1.0.jar
-file.reference.junit-4.6.jar=tools/ant/lib/junit-4.6.jar
jar.compress=false
file.reference.wrapper.jar=tools/wrapper/lib/wrapper.jar
file.reference.jetty-6.1.21.jar=tools/jetty/lib/jetty-6.1.21.jar
@@ -105,7 +109,10 @@
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}:\
- ${libs.junit_4.classpath}
+ ${file.reference.easymock-2.5.2.jar}:\
+ ${file.reference.easymockclassextension-2.5.2.jar}:\
+ ${file.reference.junit-4.6.jar}:\
+ ${file.reference.xmlunit-1.2.jar}
file.reference.wsdl4j-1.5.1.jar=lib/optional/wsdl4j-1.5.1.jar
javadoc.splitindex=true
file.reference.commons-codec-1.4.jar=lib/optional/commons-codec-1.4.jar
@@ -141,7 +148,6 @@
jnlp.offline-allowed=false
src.src6.dir=tools/wrapper/src
javac.deprecation=false
-file.reference.xmlunit-1.2.jar=tools/ant/lib/xmlunit-1.2.jar
build.classes.excludes=**/*.java,**/*.form
dist.dir=nbproject/dist
debug.classpath=${run.classpath}
@@ -203,8 +209,6 @@
${file.reference.mail-1.4.2.jar}:\
${file.reference.nekohtml-1.9.11.jar}:\
${file.reference.ant.jar}:\
- ${file.reference.junit-4.6.jar}:\
- ${file.reference.xmlunit-1.2.jar}:\
${file.reference.catalina-5.0.28.jar}:\
${file.reference.jasper-compiler.jar}:\
${file.reference.jasper-runtime.jar}:\
@@ -244,7 +248,8 @@
${file.reference.javacApi-0.9.jar}:\
${file.reference.javacImpl-0.9.jar}:\
${file.reference.logkit-1.2.2.jar}:\
- ${file.reference.util.concurrent-1.3.4.jar}
+ ${file.reference.util.concurrent-1.3.4.jar}:\
+ ${file.reference.xmlunit-1.2.jar-1}
javadoc.additionalparam=-J-Xmx320m
build.classes.dir=${build.dir}/classes
file.reference.samples-src=samples/src
Deleted: trunk/eXist/tools/ant/lib/junit-4.6.jar
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2009-12-28 17:07:46
|
Revision: 10896
http://exist.svn.sourceforge.net/exist/?rev=10896&view=rev
Author: brihaye
Date: 2009-12-28 17:07:36 +0000 (Mon, 28 Dec 2009)
Log Message:
-----------
Restoring attributes for spatial config, removed by v. 10379
Modified Paths:
--------------
trunk/eXist/conf.xml.tmpl
Modified: trunk/eXist/conf.xml.tmpl
===================================================================
--- trunk/eXist/conf.xml.tmpl 2009-12-28 11:32:30 UTC (rev 10895)
+++ trunk/eXist/conf.xml.tmpl 2009-12-28 17:07:36 UTC (rev 10896)
@@ -385,6 +385,7 @@
<!--
<module id="spatial-index" class="org.exist.indexing.spatial.GMLHSQLIndex"
+ connectionTimeout="10000" flushAfter="300" />
-->
<module id="lucene-index" class="org.exist.indexing.lucene.LuceneIndex"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2009-12-28 11:32:42
|
Revision: 10895
http://exist.svn.sourceforge.net/exist/?rev=10895&view=rev
Author: dizzzz
Date: 2009-12-28 11:32:30 +0000 (Mon, 28 Dec 2009)
Log Message:
-----------
[ignore] isolation of files. Need to be tested, or removed. should not be in 'bin'
Added Paths:
-----------
trunk/eXist/bin/deprecated/
trunk/eXist/bin/deprecated/query.py
trunk/eXist/bin/deprecated/rpclite.pl
trunk/eXist/bin/deprecated/xmlrpc.pl
Removed Paths:
-------------
trunk/eXist/bin/query.py
trunk/eXist/bin/rpclite.pl
trunk/eXist/bin/xmlrpc.pl
Copied: trunk/eXist/bin/deprecated/query.py (from rev 10890, trunk/eXist/bin/query.py)
===================================================================
--- trunk/eXist/bin/deprecated/query.py (rev 0)
+++ trunk/eXist/bin/deprecated/query.py 2009-12-28 11:32:30 UTC (rev 10895)
@@ -0,0 +1,307 @@
+#!/usr/bin/python
+
+# eXist xml document repository and xpath implementation
+# Copyright (C) 2001, Wolfgang M. Meier (me...@if...)
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+import httplib, getopt, sys, readline
+from string import split, replace, atoi, rfind
+import re, time
+
+class eXistClient:
+
+ host = '127.0.0.1:8088'
+ requestFile = ''
+ xslStyle = ''
+ display = 1
+ start = 1
+ howmany = 15
+ outfile = ''
+ indent = 'true'
+
+ def __init__(self, args):
+ optlist, args = getopt.getopt(args[1:], 'hqis:b:p:')
+ quiet = 0
+ for i in optlist:
+ if i[0] == '-h':
+ self.printUsage()
+ sys.exit(0)
+ elif i[0] == '-s':
+ self.host = i[1]
+ elif i[0] == '-b':
+ self.benchmark(i[1])
+ return
+ elif i[0] == '-q':
+ self.quiet = 1
+ elif i[0] == '-i':
+ self.indent = 'false'
+ elif i[0] == '-p':
+ self.parse(i[1], args)
+ return
+
+ if not quiet:
+ self.printBanner()
+
+ if len(args) < 1:
+ self.interactive()
+ return
+ else:
+ try:
+ freq = open(args[0], 'r')
+ except IOError:
+ print 'Unable to open file ', args[0]
+ sys.exit(0)
+ else:
+ req = freq.read()
+ freq.close()
+
+ self.doQuery(req)
+
+ def interactive(self):
+ print '\npress h or ? for help on available commands.'
+ while 1:
+ s = raw_input('exist> ')
+ line = split(s, ' ', 1)
+ if line[0] in ('find', 'f'):
+ r = self.queryRequest(line[1], 1, self.howmany)
+ print r
+ resp = self.doQuery(r)
+ if self.outfile:
+ o = open(self.outfile, 'w')
+ o.write(resp)
+ print 'output written to ', self.outfile
+ else:
+ print '\nserver responded:\n'
+ print resp
+ elif line[0] in ('get', 'g'):
+ args = split(line[1])
+ if len(args) > 1:
+ self.getRequest(args[0], args[1])
+ else:
+ self.getRequest(args[0])
+ elif line[0] in ('url', 'u'):
+ self.host = line[1]
+ print 'set host address = %s' % self.host
+ elif line[0] in ('display', 'd'):
+ self.setDisplay(split(line[1]))
+ elif line[0] in ('output', 'o'):
+ self.outfile = line[1]
+ print 'set output file = %s' % self.outfile
+ elif line[0] in ('bench', 'b'):
+ self.benchmark(line[1])
+ elif line[0] in ('remove', 'r'):
+ self.remove(line[1])
+ elif line[0] in ('parse', 'p'):
+ args = split(line[1], ' ', 1)
+ if len(args) > 1:
+ self.parse(args[0], [ args[1] ])
+ else:
+ self.parse(args[0], [])
+ elif line[0] in ('help', '?', 'h'):
+ self.getHelp()
+ elif line[0] in ('quit', 'q'):
+ break
+ else:
+ print 'unknown command: ' + `line[0]`
+
+ def setDisplay(self, line):
+ self.display = 1
+ for i in line:
+ self.setArg(i)
+
+ def setArg(self, arg):
+ if arg in ('summary', 's'):
+ self.display = 0
+ print 'summarize = %i' % self.display
+ elif arg in ('all', 'a'):
+ self.display = 1
+ print 'summarize = %i' % self.display
+ else:
+ self.howmany = atoi(arg)
+ print 'howmany = %s' % self.howmany
+
+ def getRequest(self, document, gid = ""):
+ if gid != "":
+ gid = 'id="%s"'
+ temp = """
+ <exist:request xmlns:exist="" rel="nofollow">http://exist.sourceforge.net/NS/exist">
+ <exist:display indent="%s"/>
+ <exist:get document="%s" %s/>
+ </exist:request>
+ """
+ req = temp % (self.indent, document, gid)
+ print req
+ resp = self.doQuery(req)
+ if self.outfile:
+ o = open(self.outfile, 'w')
+ o.write(resp)
+ print 'output written to ', self.outfile
+ else:
+ print '\nserver responded:\n'
+ print resp
+
+ def queryRequest(self, query, start, howmany):
+ temp = """
+ <exist:request xmlns:exist="" rel="nofollow">http://exist.sourceforge.net/NS/exist">
+ <exist:query>%s</exist:query>
+ <exist:%s indent="%s" howmany="%i" start="%i"/>
+ </exist:request>
+ """
+ if self.display:
+ disp = "display"
+ else:
+ disp = "summarize"
+ return temp % ( self.escape(query), disp, self.indent, howmany, start)
+
+ def remove(self, doc):
+ temp = """
+ <exist:request xmlns:exist="" rel="nofollow">http://exist.sourceforge.net/NS/exist">
+ <exist:remove document="%s"/>
+ </exist:request>
+ """
+ req = temp % ( doc )
+ print req
+ resp = self.doQuery(req)
+ print resp
+
+
+ def escape(self, str):
+ n = ''
+ for c in str:
+ if c == '&':
+ n = n + '&'
+ elif c == '<':
+ n = n + '<'
+ elif c == '>':
+ n = n + '>'
+ else:
+ n = n + c
+ return n
+
+ def parse(self, file, args):
+ p = rfind(file, '/')
+ if p > -1:
+ doc = file[p+1:]
+ else:
+ doc = file
+ if(len(args) > 0):
+ doc = args[0] + "/" + doc
+ f = open(file, 'r')
+ print "reading file %s ..." % file
+ xml = f.read()
+ f.close()
+ print "ok.\nsending %s to server ..." % doc
+ con = httplib.HTTP(self.host)
+ con.putrequest('PUT', doc)
+ con.putheader('Accept', 'text/xml')
+ clen = len(xml)
+ con.putheader('Content-Length', `clen`)
+ con.endheaders()
+ con.send(xml)
+
+ errcode, errmsg, headers = con.getreply()
+
+ if errcode != 200:
+ print 'an error occurred: %s' % errmsg
+ else:
+ print "ok."
+
+ def doQuery(self, request):
+ con = httplib.HTTP(self.host)
+ con.putrequest('POST', '/')
+ con.putheader('Accept', 'text/xml')
+ clen = len(request)
+ con.putheader('Content-Length', `clen`)
+ con.endheaders()
+ print 'Sending request ...\n'
+ con.send(request)
+
+ errcode, errmsg, headers = con.getreply()
+
+ if errcode != 200:
+ print 'an error occurred: %s' % errmsg
+ return
+ f = con.getfile()
+ data = f.read()
+ f.close()
+ return data
+
+ def benchmark(self, benchfile):
+ bench = open(benchfile, 'r')
+ o = open('benchmark.out', 'w')
+ queries = bench.readlines()
+ print '%-10s | %-10s | %-50s' % ("query", "retrieve", "query string")
+ print '=' * 75
+ qt = 0.0
+ rt = 0.0
+ i = 1
+ for qu in queries:
+ start = time.clock()
+ req = self.queryRequest(qu, 1, 20)
+ data = self.doQuery(req)
+ queryTime = re.search('queryTime="([0-9]+)"', data).group(1)
+ #retrTime = re.search('retrieveTime="([0-9]+)"', data).group(1)
+ retrTime = 0
+ print '%-10s | %-10s ==> %-47s' % (queryTime, retrTime, qu[0:50])
+ i = i + 1
+ bench.close()
+
+ def getHelp(self):
+ print """
+Available commands:
+ h|help print this help message
+
+ g|get docName retrieve document docName from the database
+
+ r|remove docName remove document docName from the database
+
+ p|parse file [collection]
+ parse and store file to the repository
+
+ f|find expr create query request with expr as query argument
+
+ d|display [ [a|all] | [s|summary] ] [howmany]
+ all : return the actual content of matching nodes
+ summary: just return a short summary of hits per document
+ howmany: howmany nodes should be returned at maximum
+
+ o|output file write server response to file
+
+ u|url host:port set server address to host:port
+
+ b|bench file execute queries contained in file and print statistics
+ """
+
+ def printUsage(self):
+ print """
+Usage: query.py [-h] [-s server] [-b benchmark-file] request-file
+ -h Display this message
+ -s Server address (e.g. localhost:8088)
+ -b Benchmark: Execute queries from benchmark-file and print statistics
+ -i Switch off indentation of results
+ """
+
+ def printBanner(self):
+ print """
+eXist version 0.5, Copyright (C) 2001 Wolfgang M. Meier
+eXist comes with ABSOLUTELY NO WARRANTY.
+This is free software, and you are welcome to
+redistribute it under certain conditions;
+for details read the license file.
+ """
+
+c = eXistClient(sys.argv)
Copied: trunk/eXist/bin/deprecated/rpclite.pl (from rev 10890, trunk/eXist/bin/rpclite.pl)
===================================================================
--- trunk/eXist/bin/deprecated/rpclite.pl (rev 0)
+++ trunk/eXist/bin/deprecated/rpclite.pl 2009-12-28 11:32:30 UTC (rev 10895)
@@ -0,0 +1,29 @@
+#!/usr/bin/perl -w
+
+use XMLRPC::Lite;
+
+$client = XMLRPC::Lite->proxy('http://localhost:8081');
+
+open(XIN, $ARGV[0]);
+$xml = '';
+$pos = 0;
+while(($l = sysread(XIN, $buf, 57)) > 0) {
+ $pos = $pos + $l;
+ $xml = $xml . $buf;
+}
+$xml = iso2utf8($xml);
+print "$xml\n";
+$doc = '/db/test/test.xml';
+print "ok.\nsending $doc to server ...\n";
+$resp = $client->parse(SOAP::Data->type(base64 => $xml), $doc);
+if(!$resp->fault) {
+ print "ok.\n";
+} else {
+ print "\nerror occured: " . $resp->faultstring. "\n";
+}
+
+sub iso2utf8 {
+ my $buffer = shift;
+ $buffer =~ s/([\x80-\xFF])/chr(0xC0|ord($1)>>6).chr(0x80|ord($1)&0x3F)/eg;
+ return $buffer;
+}
Copied: trunk/eXist/bin/deprecated/xmlrpc.pl (from rev 10890, trunk/eXist/bin/xmlrpc.pl)
===================================================================
--- trunk/eXist/bin/deprecated/xmlrpc.pl (rev 0)
+++ trunk/eXist/bin/deprecated/xmlrpc.pl 2009-12-28 11:32:30 UTC (rev 10895)
@@ -0,0 +1,557 @@
+#!/usr/bin/perl
+
+use RPC::XML;
+use RPC::XML::Client;
+use Term::ReadLine;
+use MIME::Base64;
+use Getopt::Long;
+
+$PRETTY = 1;
+$CLIENTS = 5;
+$QUERY_COUNT=5;
+$HOWMANY = 10;
+$NEXT_RECORD = 1;
+@RESULT_SET = undef;
+$COLLECTION = "/db";
+$USER = "admin";
+$PASS = "";
+
+printNotice();
+
+GetOptions("i|indent" => \$indent,
+ "t|test=s" => \$test,
+ "clients=i" => \$CLIENTS,
+ "count=i" => \$QUERY_COUNT,
+ "u|user=s" => \$USER,
+ "p|password=s" => \$PASS);
+
+$URL = "http://$USER:$PASS\@localhost:8081";
+print "connecting to $URL...\n";
+$client = new RPC::XML::Client $URL;
+
+$PRETTY = ($indent ? 1 : 0);
+if($test) {
+ test();
+ exit(0);
+}
+
+if(@ARGV > 0) {
+ # execute query found on command line
+ print "\n" . query($ARGV[0]) . "\n";
+ exit(0);
+}
+
+# enter interactive mode
+
+$term = new Term::ReadLine 'eXist perl-client';
+$PRETTY = 1; # turn pretty printing on
+$PROMPT = "[eXist $COLLECTION]\$ ";
+
+print "Type help for help.\n";
+while(defined($_ = $term->readline($PROMPT))) {
+ next if($_ eq "");
+ ($cmd, $args) = /(\w+)[\s]*(.*)/;
+ if($cmd eq "find") {
+ $hits = query($args);
+ print "found " . $hits . " hits. Use show to retrieve results.\n"
+ if($hits > -1);
+
+ } elsif($cmd eq "summary") {
+ summary($args);
+
+ } elsif($cmd eq "show") {
+ print show($args) . "\n";
+
+ } elsif($cmd eq "quit") {
+ last;
+
+ } elsif($cmd eq "get") {
+ print getDocument($args);
+
+ } elsif($cmd eq "ls") {
+ listDocuments();
+
+ } elsif($cmd eq "cd") {
+ if($args =~ /^\/.*/) {
+ $tmpColl = $args;
+ } else {
+ $tmpColl = "$COLLECTION/$args";
+ }
+ $req = RPC::XML::request->new('getCollectionDesc', $tmpColl);
+ $resp = $client->send_request($req);
+ if($resp->is_fault) {
+ print "collection $tmpColl not found!\n";
+ } else {
+ $COLLECTION = $tmpColl;
+ }
+ } elsif($cmd eq "createid") {
+ $req = RPC::XML::request->new('createId', $COLLECTION);
+ $resp = $client->send_request($req);
+ if($resp->is_fault) {
+ print $resp->string . "\n";
+ } else {
+ print $resp->value . "\n";
+ }
+ } elsif($cmd eq "put") {
+ parse($args);
+
+ } elsif($cmd eq "rm") {
+ remove($args);
+
+ } elsif($cmd eq "mkcol") {
+ mkcol($args);
+
+ } elsif($cmd eq "rmcol") {
+ rmcol($args);
+
+ } elsif($cmd eq "help") {
+ printHelp();
+
+ } elsif($cmd eq "set") {
+ setProperty($args);
+
+ } elsif($cmd eq "bench") {
+ benchmark($args);
+
+ } else {
+ print "unknown command $cmd.\n";
+ printHelp();
+ next;
+ }
+ $PROMPT = "[eXist $COLLECTION]\$";
+}
+
+sub test {
+ open(QIN, $test);
+ @queries = <QIN>;
+ close(QIN);
+
+ print "forking $CLIENTS client processes ...\n";
+ for($i = 0; $i < $CLIENTS; $i++) {
+ if(!defined($child_pid = fork())) {
+ die "unable to fork child process.";
+ } elsif($child_pid) {
+ # child process runs here
+ $out_file = ">" . $child_pid . ".out";
+ open(CHILD_OUT, $out_file);
+
+ srand($child_pid);
+ for($i = 0; $i < $QUERY_COUNT; $i++) {
+ $r = rand(@queries);
+ $qu = $queries[$r];
+ print "[$child_pid] query $i: $qu\n";
+ print CHILD_OUT "query: $qu\n";
+ $start = time();
+ $req = RPC::XML::request->new('query', $qu, "UTF-8",
+ RPC::XML::int->new($HOWMANY),
+ RPC::XML::int->new(1),
+ RPC::XML::int->new($PRETTY)
+ );
+ $resp = $client->send_request($req);
+ if($resp->is_fault) {
+ print "\nerror occured: " . $resp->string . "\n";
+ print "($child_pid) query: $qu\n";
+ return -1;
+ } else {
+ $result = decode_base64($resp->value);
+ $hits = $resp->value;
+ print CHILD_OUT $result;
+ $t = (time() - $start);
+ print "($child_pid) query: [$i] " . $qu . " took $t sec.\n";
+ print CHILD_OUT "$qu took $t sec.\n";
+ }
+ }
+ close(CHILD_OUT);
+ }
+ }
+ $waitpid = 1;
+ while($waitpid > -1) {
+ $waitpid = wait();
+ }
+ exit(0);
+}
+
+sub query {
+ my($query) = @_;
+ $query = iso2utf8($query);
+ $req = RPC::XML::request->new('executeQuery',
+ RPC::XML::base64->new($query), 'UTF-8');
+ $resp = $client->send_request($req);
+ if($resp->is_fault) {
+ print "\nerror occured: " . $resp->string . "\n";
+ return -1;
+ }
+ $RESULT_ID = $resp->value;
+ $req = RPC::XML::request->new('getHits', RPC::XML::int->new($RESULT_ID));
+ $resp = $client->send_request($req);
+ if(!$resp->is_fault) {
+ $HITS = $resp->value;
+ return $HITS;
+ } else {
+ print "\nerror occured: " . $resp->string . "\n";
+ return -1;
+ }
+}
+
+sub show {
+ my($args) = @_;
+ my($start, $howmany, $xml);
+ if($RESULT_ID < 0) {
+ print "no query. Use find to do a query!\n";
+ return;
+ }
+ if(!$args) {
+ $start = $NEXT_RECORD;
+ $howmany = $HOWMANY;
+ } elsif($args =~ /\d+\s*,\s*\d+/) {
+ ($start, $howmany) = $args =~ /(\d+)\s*,\s*(\d+)/;
+ } else {
+ $start = $args;
+ $howmany = $HOWMANY;
+ }
+
+ if($start > $HITS) {
+ print "start parameter out of range.\n";
+ return;
+ }
+ $howmany = $HITS - $start + 1 if($start + $howmany > $HITS);
+
+ for($i = $start - 1; $i < $start + $howmany - 1; $i++) {
+ $req = RPC::XML::request->new('retrieve',
+ RPC::XML::int->new($RESULT_ID),
+ $i,
+ RPC::XML::int->new($PRETTY),
+ "ISO-8859-1");
+ $resp = $client->send_request($req);
+ if(!$resp->is_fault) {
+ #$xml .= $resp->value;
+ $xml .= decode_base64($resp->value);
+ } else {
+ print "\nerror occured: " . $resp->string . "\n";
+ return $xml;
+ }
+ }
+ $NEXT_RECORD = $start + $howmany;
+ return $xml;
+}
+
+sub setProperty {
+ my($args) = @_;
+ ($key, $value) = $args =~ /(\w+)\s*=\s*(.*)/;
+ if($key eq "indent") {
+ $PRETTY = ($value eq "on") ? 1 : 0;
+ print "$key = $value\n";
+ } elsif($key eq "collection") {
+ $COLLECTION = $value;
+ print "$key = $value\n";
+ } elsif($key eq "display") {
+ $HOWMANY = $value;
+ print "$key = $value\n";
+ } else {
+ print "unknown property: $key\n";
+ }
+}
+
+sub escape {
+ my($str) = @_;
+ $str =~ s/&/&/g;
+ $str =~ s/</</g;
+ $str =~ s/>/>/g;
+ print $str;
+ return $str;
+}
+
+sub parse {
+ my($args) = @_;
+ ($file, $doc) = split(/,\s*/, $args);
+ if(-d $file) {
+ print "reading files from directory $file\n";
+ while($name = <$file/*.xml $file/*.XML>) {
+ print "\nparsing $name:\n";
+ print "-" x 25 . "\n";
+ ($doc = $name) =~ s#.*/##s;
+ parseFile($name, $doc);
+ }
+ } else {
+ if($doc eq '') {
+ ($doc = $file) =~ s#.*/##s;
+ }
+ parseFile($file, $doc);
+ }
+}
+
+sub parseFile {
+ my($file, $doc) = @_;
+ if(!(-r $file)) {
+ print "cannot read $file!\n";
+ return;
+ }
+ print "reading $file ...";
+ open(XIN, $file);
+ $xml = '';
+ $pos = 0;
+ $buf = '';
+ while(($l = sysread(XIN, $xml, 57, $pos)) > 0) {
+ $pos = $pos + $l;
+ }
+ $xml = iso2utf8($xml);
+ $doc = "$COLLECTION/$doc" if($COLLECTION);
+ print "ok.\nsending $doc to server ...\n";
+ $req = RPC::XML::request->new('parse',
+ RPC::XML::base64->new($xml),
+ $doc);
+ $resp = $client->send_request($req);
+ if(!$resp->is_fault) {
+ print "ok.\n";
+ } else {
+ print "\nerror occured: " . $resp->string. "\n";
+ }
+}
+
+sub remove {
+ my($args) = @_;
+ if(!($args =~ /\/.*/)) {
+ $args = "$COLLECTION/$args";
+ }
+ print "removing document $args ...\n";
+ $resp = $client->send_request(RPC::XML::request->new('remove', $args));
+ if(!$resp->is_fault) {
+ print "ok.\n";
+ } else {
+ print "\nerror occured: " . $resp->string . "\n";
+ }
+}
+
+sub mkcol {
+ my($args) = @_;
+ if(!($args =~ /\/.*/)) {
+ $args = "$COLLECTION/$args";
+ }
+ print "creating collection $args";
+ $resp =
+ $client->send_request(RPC::XML::request->new('createCollection', $args));
+ if(!$resp->is_fault) {
+ print "ok.\n";
+ } else {
+ print "\nerror occurred: " . $resp->string . "\n";
+ }
+}
+
+sub rmcol {
+ my($args) = @_;
+ if(!($args =~ /\/.*/)) {
+ $args = "$COLLECTION/$args";
+ }
+ print "removing collection $args\n";
+ $resp =
+ $client->send_request(RPC::XML::request->new('removeCollection', $args));
+ if(!$resp->is_fault) {
+ if($resp->value == 0) {
+ print "could not remove collection $args.\n";
+ } else {
+ print "removed collection $args.\n";
+ }
+ } else {
+ print "\nerror occurred: " . $resp->string . "\n";
+ }
+}
+
+sub benchmark {
+ my($file) = @_;
+ format STDOUT =
+@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<
+$q $t
+.
+ open(IN, $file);
+ while(<IN>) {
+ #$query = escape($_);
+ $resp = $client->send_request(RPC::XML::request->new('querySummary', $query));
+ if(!$resp->is_fault) {
+ %struct = %{$resp->value->value};
+ $q = $_;
+ $t = $struct{"queryTime"};
+ write(STDOUT);
+ } else {
+ print "error occured: $resp->value->string\n";
+ return;
+ }
+ }
+}
+
+sub summary {
+ my($query) = @_;
+ if($RESULT_ID < 0) {
+ print "no query. Use find to do a query!\n";
+ return;
+ }
+ $resp = $client->send_request(RPC::XML::request->new('querySummary', $RESULT_ID));
+ if(!ref($resp)) {
+ print "error occured: $resp\n";
+ } else {
+ %struct = %{$resp->value->value};
+ print "\nQuery result summary\n";
+ print "--------------------\n";
+ print "Hits: " . $struct{"hits"} . "\n";
+ print "Query time: " . $struct{"queryTime"} . "\n\n";
+ @docs = @{$struct{"documents"}};
+ format STDOUT_TOP =
+DocId Document Hits
+========================================================
+.
+
+ format STDOUT =
+@<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<
+$docId $docName $hits
+.
+
+ foreach $doc (@docs) {
+ ($docName, $docId, $hits) = @{$doc};
+ write(STDOUT);
+ }
+ }
+}
+
+sub getDocument {
+ my($name) = @_;
+ if(!($name =~ /\/.*/)) {
+ $name = "$COLLECTION/$name";
+ }
+ $req = RPC::XML::request->new('getDocument', $name, "ISO-8859-1",
+ RPC::XML::int->new($PRETTY), '/db/shakespeare/plays/shakes.xsl');
+
+ $resp =
+ $client->send_request($req);
+
+ if(!$resp->is_fault) {
+ return decode_base64($resp->value);
+ } else {
+ print "error occured: ". $resp->string . "\n";
+ return '';
+ }
+}
+
+sub listDocuments {
+ $req = RPC::XML::request->new('getCollectionDesc', $COLLECTION);
+ $resp = $client->send_request($req);
+ if(!$resp->is_fault) {
+ %struct = %{$resp->value};
+ @docs = @{$struct{"documents"}};
+ @colls = @{$struct{"collections"}};
+ foreach $coll (sort(@colls)) {
+ print "$coll/\n";
+ }
+ foreach $_ (sort(@docs)) {
+ /.*\/([^\/]*)$/;
+ print "$1\n";
+ }
+ return true;
+ } else {
+ print "\nerror occured: " . $resp->string . "\n";
+ return false;
+ }
+}
+
+sub printNotice {
+ print <<END;
+eXist version 0.8, Copyright (C) 2001 Wolfgang M. Meier
+eXist comes with ABSOLUTELY NO WARRANTY.
+This is free software, and you are welcome to
+redistribute it under certain conditions;
+for details read the license file.
+
+END
+}
+
+sub printHelp {
+ print <<END;
+parse xmlFile Parse file xmlFile.
+get docName Get the document identified by docName.
+find xpathQuery Execute XPath query and print number of results found.
+ Use show to display results.
+show [start [, howmany] Retrieve howmany results from the last query, beginning
+ at start. With no argument, retrieves the 15 next results.
+summary xpathQuery Same as find but prints a summary of hits
+ by document.
+remove docName Remove document identified by docName from
+ the database.
+list List all documents contained in the database.
+quit exit.
+
+set option=value Set an option. The following options are available:
+ indent=[ on | off ] Turn pretty printing of results on or off
+ collection=x Set current collection to x.
+END
+}
+
+sub iso2utf8 {
+ my $buffer = shift;
+ $buffer =~ s/([\x80-\xFF])/chr(0xC0|ord($1)>>6).chr(0x80|ord($1)&0x3F)/eg;
+ return $buffer;
+}
+
+__END__
+
+=head1 NAME
+
+xmlrpc.pl Perl command line client for eXist
+
+=head1 SYNOPSIS
+
+C<xmlrpc.pl>
+
+Enter interactive mode.
+
+C<xmlrpc.pl [-i | --indent] xpath>
+
+Execute xpath expression given in C<xpath> and print results.
+
+C<xmlrpc.pl [-t file | --test=file] [--clients=n] [--count=n]>
+
+Enter test mode. In test mode, the skript will fork multiple parallel
+clients. Each client will randomly select queries from a list, send it
+to the server and retrieve the results. The list of possible queries
+is read from the file identified by option C<--test>. The number of parallel
+clients is defined by option C<--clients>. Each client will perfom
+C<--count> queries before it stops.
+
+Every client writes it's output into a file. The file's name
+consists of the client's process-id and ends with C<.out>.
+
+=head1 DESCRIPTION
+
+B<xmlrpc.pl> is a Perl command line client for the eXist native XML
+database. Communication with the eXist server is done by XML-RPC calls.
+
+In interactive mode, type B<help> to get a list of available commands.
+
+=head2 Commands in interactive mode
+
+=over4
+
+=item ls
+
+Get a list of all documents contained in the database.
+
+=item cd I<collection>
+
+Change current collection to I<collection>
+
+=item get I<xml document>
+
+Retrieve I<xml document> from the database.
+
+=item find I<xpath query>
+
+Send I<xpath query> to the server and retrieve the list of hits. The number of
+hits is displayed. You may then use command B<show> to display results.
+
+=item show [I<start> [, I<howmany>]
+
+Retrieve I<howmany> hits from the current result set, beginning at I<start>,
+and display them. If I<howmany> is omitted, 15 hits will be retrieved. Without
+arguments, B<show> will display the next 15 hits, beginning at the current position
+in the result set.
+
+=back
+
+=cut
Deleted: trunk/eXist/bin/query.py
===================================================================
--- trunk/eXist/bin/query.py 2009-12-28 11:30:08 UTC (rev 10894)
+++ trunk/eXist/bin/query.py 2009-12-28 11:32:30 UTC (rev 10895)
@@ -1,307 +0,0 @@
-#!/usr/bin/python
-
-# eXist xml document repository and xpath implementation
-# Copyright (C) 2001, Wolfgang M. Meier (me...@if...)
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-import httplib, getopt, sys, readline
-from string import split, replace, atoi, rfind
-import re, time
-
-class eXistClient:
-
- host = '127.0.0.1:8088'
- requestFile = ''
- xslStyle = ''
- display = 1
- start = 1
- howmany = 15
- outfile = ''
- indent = 'true'
-
- def __init__(self, args):
- optlist, args = getopt.getopt(args[1:], 'hqis:b:p:')
- quiet = 0
- for i in optlist:
- if i[0] == '-h':
- self.printUsage()
- sys.exit(0)
- elif i[0] == '-s':
- self.host = i[1]
- elif i[0] == '-b':
- self.benchmark(i[1])
- return
- elif i[0] == '-q':
- self.quiet = 1
- elif i[0] == '-i':
- self.indent = 'false'
- elif i[0] == '-p':
- self.parse(i[1], args)
- return
-
- if not quiet:
- self.printBanner()
-
- if len(args) < 1:
- self.interactive()
- return
- else:
- try:
- freq = open(args[0], 'r')
- except IOError:
- print 'Unable to open file ', args[0]
- sys.exit(0)
- else:
- req = freq.read()
- freq.close()
-
- self.doQuery(req)
-
- def interactive(self):
- print '\npress h or ? for help on available commands.'
- while 1:
- s = raw_input('exist> ')
- line = split(s, ' ', 1)
- if line[0] in ('find', 'f'):
- r = self.queryRequest(line[1], 1, self.howmany)
- print r
- resp = self.doQuery(r)
- if self.outfile:
- o = open(self.outfile, 'w')
- o.write(resp)
- print 'output written to ', self.outfile
- else:
- print '\nserver responded:\n'
- print resp
- elif line[0] in ('get', 'g'):
- args = split(line[1])
- if len(args) > 1:
- self.getRequest(args[0], args[1])
- else:
- self.getRequest(args[0])
- elif line[0] in ('url', 'u'):
- self.host = line[1]
- print 'set host address = %s' % self.host
- elif line[0] in ('display', 'd'):
- self.setDisplay(split(line[1]))
- elif line[0] in ('output', 'o'):
- self.outfile = line[1]
- print 'set output file = %s' % self.outfile
- elif line[0] in ('bench', 'b'):
- self.benchmark(line[1])
- elif line[0] in ('remove', 'r'):
- self.remove(line[1])
- elif line[0] in ('parse', 'p'):
- args = split(line[1], ' ', 1)
- if len(args) > 1:
- self.parse(args[0], [ args[1] ])
- else:
- self.parse(args[0], [])
- elif line[0] in ('help', '?', 'h'):
- self.getHelp()
- elif line[0] in ('quit', 'q'):
- break
- else:
- print 'unknown command: ' + `line[0]`
-
- def setDisplay(self, line):
- self.display = 1
- for i in line:
- self.setArg(i)
-
- def setArg(self, arg):
- if arg in ('summary', 's'):
- self.display = 0
- print 'summarize = %i' % self.display
- elif arg in ('all', 'a'):
- self.display = 1
- print 'summarize = %i' % self.display
- else:
- self.howmany = atoi(arg)
- print 'howmany = %s' % self.howmany
-
- def getRequest(self, document, gid = ""):
- if gid != "":
- gid = 'id="%s"'
- temp = """
- <exist:request xmlns:exist="" rel="nofollow">http://exist.sourceforge.net/NS/exist">
- <exist:display indent="%s"/>
- <exist:get document="%s" %s/>
- </exist:request>
- """
- req = temp % (self.indent, document, gid)
- print req
- resp = self.doQuery(req)
- if self.outfile:
- o = open(self.outfile, 'w')
- o.write(resp)
- print 'output written to ', self.outfile
- else:
- print '\nserver responded:\n'
- print resp
-
- def queryRequest(self, query, start, howmany):
- temp = """
- <exist:request xmlns:exist="" rel="nofollow">http://exist.sourceforge.net/NS/exist">
- <exist:query>%s</exist:query>
- <exist:%s indent="%s" howmany="%i" start="%i"/>
- </exist:request>
- """
- if self.display:
- disp = "display"
- else:
- disp = "summarize"
- return temp % ( self.escape(query), disp, self.indent, howmany, start)
-
- def remove(self, doc):
- temp = """
- <exist:request xmlns:exist="" rel="nofollow">http://exist.sourceforge.net/NS/exist">
- <exist:remove document="%s"/>
- </exist:request>
- """
- req = temp % ( doc )
- print req
- resp = self.doQuery(req)
- print resp
-
-
- def escape(self, str):
- n = ''
- for c in str:
- if c == '&':
- n = n + '&'
- elif c == '<':
- n = n + '<'
- elif c == '>':
- n = n + '>'
- else:
- n = n + c
- return n
-
- def parse(self, file, args):
- p = rfind(file, '/')
- if p > -1:
- doc = file[p+1:]
- else:
- doc = file
- if(len(args) > 0):
- doc = args[0] + "/" + doc
- f = open(file, 'r')
- print "reading file %s ..." % file
- xml = f.read()
- f.close()
- print "ok.\nsending %s to server ..." % doc
- con = httplib.HTTP(self.host)
- con.putrequest('PUT', doc)
- con.putheader('Accept', 'text/xml')
- clen = len(xml)
- con.putheader('Content-Length', `clen`)
- con.endheaders()
- con.send(xml)
-
- errcode, errmsg, headers = con.getreply()
-
- if errcode != 200:
- print 'an error occurred: %s' % errmsg
- else:
- print "ok."
-
- def doQuery(self, request):
- con = httplib.HTTP(self.host)
- con.putrequest('POST', '/')
- con.putheader('Accept', 'text/xml')
- clen = len(request)
- con.putheader('Content-Length', `clen`)
- con.endheaders()
- print 'Sending request ...\n'
- con.send(request)
-
- errcode, errmsg, headers = con.getreply()
-
- if errcode != 200:
- print 'an error occurred: %s' % errmsg
- return
- f = con.getfile()
- data = f.read()
- f.close()
- return data
-
- def benchmark(self, benchfile):
- bench = open(benchfile, 'r')
- o = open('benchmark.out', 'w')
- queries = bench.readlines()
- print '%-10s | %-10s | %-50s' % ("query", "retrieve", "query string")
- print '=' * 75
- qt = 0.0
- rt = 0.0
- i = 1
- for qu in queries:
- start = time.clock()
- req = self.queryRequest(qu, 1, 20)
- data = self.doQuery(req)
- queryTime = re.search('queryTime="([0-9]+)"', data).group(1)
- #retrTime = re.search('retrieveTime="([0-9]+)"', data).group(1)
- retrTime = 0
- print '%-10s | %-10s ==> %-47s' % (queryTime, retrTime, qu[0:50])
- i = i + 1
- bench.close()
-
- def getHelp(self):
- print """
-Available commands:
- h|help print this help message
-
- g|get docName retrieve document docName from the database
-
- r|remove docName remove document docName from the database
-
- p|parse file [collection]
- parse and store file to the repository
-
- f|find expr create query request with expr as query argument
-
- d|display [ [a|all] | [s|summary] ] [howmany]
- all : return the actual content of matching nodes
- summary: just return a short summary of hits per document
- howmany: howmany nodes should be returned at maximum
-
- o|output file write server response to file
-
- u|url host:port set server address to host:port
-
- b|bench file execute queries contained in file and print statistics
- """
-
- def printUsage(self):
- print """
-Usage: query.py [-h] [-s server] [-b benchmark-file] request-file
- -h Display this message
- -s Server address (e.g. localhost:8088)
- -b Benchmark: Execute queries from benchmark-file and print statistics
- -i Switch off indentation of results
- """
-
- def printBanner(self):
- print """
-eXist version 0.5, Copyright (C) 2001 Wolfgang M. Meier
-eXist comes with ABSOLUTELY NO WARRANTY.
-This is free software, and you are welcome to
-redistribute it under certain conditions;
-for details read the license file.
- """
-
-c = eXistClient(sys.argv)
Deleted: trunk/eXist/bin/rpclite.pl
===================================================================
--- trunk/eXist/bin/rpclite.pl 2009-12-28 11:30:08 UTC (rev 10894)
+++ trunk/eXist/bin/rpclite.pl 2009-12-28 11:32:30 UTC (rev 10895)
@@ -1,29 +0,0 @@
-#!/usr/bin/perl -w
-
-use XMLRPC::Lite;
-
-$client = XMLRPC::Lite->proxy('http://localhost:8081');
-
-open(XIN, $ARGV[0]);
-$xml = '';
-$pos = 0;
-while(($l = sysread(XIN, $buf, 57)) > 0) {
- $pos = $pos + $l;
- $xml = $xml . $buf;
-}
-$xml = iso2utf8($xml);
-print "$xml\n";
-$doc = '/db/test/test.xml';
-print "ok.\nsending $doc to server ...\n";
-$resp = $client->parse(SOAP::Data->type(base64 => $xml), $doc);
-if(!$resp->fault) {
- print "ok.\n";
-} else {
- print "\nerror occured: " . $resp->faultstring. "\n";
-}
-
-sub iso2utf8 {
- my $buffer = shift;
- $buffer =~ s/([\x80-\xFF])/chr(0xC0|ord($1)>>6).chr(0x80|ord($1)&0x3F)/eg;
- return $buffer;
-}
Deleted: trunk/eXist/bin/xmlrpc.pl
===================================================================
--- trunk/eXist/bin/xmlrpc.pl 2009-12-28 11:30:08 UTC (rev 10894)
+++ trunk/eXist/bin/xmlrpc.pl 2009-12-28 11:32:30 UTC (rev 10895)
@@ -1,557 +0,0 @@
-#!/usr/bin/perl
-
-use RPC::XML;
-use RPC::XML::Client;
-use Term::ReadLine;
-use MIME::Base64;
-use Getopt::Long;
-
-$PRETTY = 1;
-$CLIENTS = 5;
-$QUERY_COUNT=5;
-$HOWMANY = 10;
-$NEXT_RECORD = 1;
-@RESULT_SET = undef;
-$COLLECTION = "/db";
-$USER = "admin";
-$PASS = "";
-
-printNotice();
-
-GetOptions("i|indent" => \$indent,
- "t|test=s" => \$test,
- "clients=i" => \$CLIENTS,
- "count=i" => \$QUERY_COUNT,
- "u|user=s" => \$USER,
- "p|password=s" => \$PASS);
-
-$URL = "http://$USER:$PASS\@localhost:8081";
-print "connecting to $URL...\n";
-$client = new RPC::XML::Client $URL;
-
-$PRETTY = ($indent ? 1 : 0);
-if($test) {
- test();
- exit(0);
-}
-
-if(@ARGV > 0) {
- # execute query found on command line
- print "\n" . query($ARGV[0]) . "\n";
- exit(0);
-}
-
-# enter interactive mode
-
-$term = new Term::ReadLine 'eXist perl-client';
-$PRETTY = 1; # turn pretty printing on
-$PROMPT = "[eXist $COLLECTION]\$ ";
-
-print "Type help for help.\n";
-while(defined($_ = $term->readline($PROMPT))) {
- next if($_ eq "");
- ($cmd, $args) = /(\w+)[\s]*(.*)/;
- if($cmd eq "find") {
- $hits = query($args);
- print "found " . $hits . " hits. Use show to retrieve results.\n"
- if($hits > -1);
-
- } elsif($cmd eq "summary") {
- summary($args);
-
- } elsif($cmd eq "show") {
- print show($args) . "\n";
-
- } elsif($cmd eq "quit") {
- last;
-
- } elsif($cmd eq "get") {
- print getDocument($args);
-
- } elsif($cmd eq "ls") {
- listDocuments();
-
- } elsif($cmd eq "cd") {
- if($args =~ /^\/.*/) {
- $tmpColl = $args;
- } else {
- $tmpColl = "$COLLECTION/$args";
- }
- $req = RPC::XML::request->new('getCollectionDesc', $tmpColl);
- $resp = $client->send_request($req);
- if($resp->is_fault) {
- print "collection $tmpColl not found!\n";
- } else {
- $COLLECTION = $tmpColl;
- }
- } elsif($cmd eq "createid") {
- $req = RPC::XML::request->new('createId', $COLLECTION);
- $resp = $client->send_request($req);
- if($resp->is_fault) {
- print $resp->string . "\n";
- } else {
- print $resp->value . "\n";
- }
- } elsif($cmd eq "put") {
- parse($args);
-
- } elsif($cmd eq "rm") {
- remove($args);
-
- } elsif($cmd eq "mkcol") {
- mkcol($args);
-
- } elsif($cmd eq "rmcol") {
- rmcol($args);
-
- } elsif($cmd eq "help") {
- printHelp();
-
- } elsif($cmd eq "set") {
- setProperty($args);
-
- } elsif($cmd eq "bench") {
- benchmark($args);
-
- } else {
- print "unknown command $cmd.\n";
- printHelp();
- next;
- }
- $PROMPT = "[eXist $COLLECTION]\$";
-}
-
-sub test {
- open(QIN, $test);
- @queries = <QIN>;
- close(QIN);
-
- print "forking $CLIENTS client processes ...\n";
- for($i = 0; $i < $CLIENTS; $i++) {
- if(!defined($child_pid = fork())) {
- die "unable to fork child process.";
- } elsif($child_pid) {
- # child process runs here
- $out_file = ">" . $child_pid . ".out";
- open(CHILD_OUT, $out_file);
-
- srand($child_pid);
- for($i = 0; $i < $QUERY_COUNT; $i++) {
- $r = rand(@queries);
- $qu = $queries[$r];
- print "[$child_pid] query $i: $qu\n";
- print CHILD_OUT "query: $qu\n";
- $start = time();
- $req = RPC::XML::request->new('query', $qu, "UTF-8",
- RPC::XML::int->new($HOWMANY),
- RPC::XML::int->new(1),
- RPC::XML::int->new($PRETTY)
- );
- $resp = $client->send_request($req);
- if($resp->is_fault) {
- print "\nerror occured: " . $resp->string . "\n";
- print "($child_pid) query: $qu\n";
- return -1;
- } else {
- $result = decode_base64($resp->value);
- $hits = $resp->value;
- print CHILD_OUT $result;
- $t = (time() - $start);
- print "($child_pid) query: [$i] " . $qu . " took $t sec.\n";
- print CHILD_OUT "$qu took $t sec.\n";
- }
- }
- close(CHILD_OUT);
- }
- }
- $waitpid = 1;
- while($waitpid > -1) {
- $waitpid = wait();
- }
- exit(0);
-}
-
-sub query {
- my($query) = @_;
- $query = iso2utf8($query);
- $req = RPC::XML::request->new('executeQuery',
- RPC::XML::base64->new($query), 'UTF-8');
- $resp = $client->send_request($req);
- if($resp->is_fault) {
- print "\nerror occured: " . $resp->string . "\n";
- return -1;
- }
- $RESULT_ID = $resp->value;
- $req = RPC::XML::request->new('getHits', RPC::XML::int->new($RESULT_ID));
- $resp = $client->send_request($req);
- if(!$resp->is_fault) {
- $HITS = $resp->value;
- return $HITS;
- } else {
- print "\nerror occured: " . $resp->string . "\n";
- return -1;
- }
-}
-
-sub show {
- my($args) = @_;
- my($start, $howmany, $xml);
- if($RESULT_ID < 0) {
- print "no query. Use find to do a query!\n";
- return;
- }
- if(!$args) {
- $start = $NEXT_RECORD;
- $howmany = $HOWMANY;
- } elsif($args =~ /\d+\s*,\s*\d+/) {
- ($start, $howmany) = $args =~ /(\d+)\s*,\s*(\d+)/;
- } else {
- $start = $args;
- $howmany = $HOWMANY;
- }
-
- if($start > $HITS) {
- print "start parameter out of range.\n";
- return;
- }
- $howmany = $HITS - $start + 1 if($start + $howmany > $HITS);
-
- for($i = $start - 1; $i < $start + $howmany - 1; $i++) {
- $req = RPC::XML::request->new('retrieve',
- RPC::XML::int->new($RESULT_ID),
- $i,
- RPC::XML::int->new($PRETTY),
- "ISO-8859-1");
- $resp = $client->send_request($req);
- if(!$resp->is_fault) {
- #$xml .= $resp->value;
- $xml .= decode_base64($resp->value);
- } else {
- print "\nerror occured: " . $resp->string . "\n";
- return $xml;
- }
- }
- $NEXT_RECORD = $start + $howmany;
- return $xml;
-}
-
-sub setProperty {
- my($args) = @_;
- ($key, $value) = $args =~ /(\w+)\s*=\s*(.*)/;
- if($key eq "indent") {
- $PRETTY = ($value eq "on") ? 1 : 0;
- print "$key = $value\n";
- } elsif($key eq "collection") {
- $COLLECTION = $value;
- print "$key = $value\n";
- } elsif($key eq "display") {
- $HOWMANY = $value;
- print "$key = $value\n";
- } else {
- print "unknown property: $key\n";
- }
-}
-
-sub escape {
- my($str) = @_;
- $str =~ s/&/&/g;
- $str =~ s/</</g;
- $str =~ s/>/>/g;
- print $str;
- return $str;
-}
-
-sub parse {
- my($args) = @_;
- ($file, $doc) = split(/,\s*/, $args);
- if(-d $file) {
- print "reading files from directory $file\n";
- while($name = <$file/*.xml $file/*.XML>) {
- print "\nparsing $name:\n";
- print "-" x 25 . "\n";
- ($doc = $name) =~ s#.*/##s;
- parseFile($name, $doc);
- }
- } else {
- if($doc eq '') {
- ($doc = $file) =~ s#.*/##s;
- }
- parseFile($file, $doc);
- }
-}
-
-sub parseFile {
- my($file, $doc) = @_;
- if(!(-r $file)) {
- print "cannot read $file!\n";
- return;
- }
- print "reading $file ...";
- open(XIN, $file);
- $xml = '';
- $pos = 0;
- $buf = '';
- while(($l = sysread(XIN, $xml, 57, $pos)) > 0) {
- $pos = $pos + $l;
- }
- $xml = iso2utf8($xml);
- $doc = "$COLLECTION/$doc" if($COLLECTION);
- print "ok.\nsending $doc to server ...\n";
- $req = RPC::XML::request->new('parse',
- RPC::XML::base64->new($xml),
- $doc);
- $resp = $client->send_request($req);
- if(!$resp->is_fault) {
- print "ok.\n";
- } else {
- print "\nerror occured: " . $resp->string. "\n";
- }
-}
-
-sub remove {
- my($args) = @_;
- if(!($args =~ /\/.*/)) {
- $args = "$COLLECTION/$args";
- }
- print "removing document $args ...\n";
- $resp = $client->send_request(RPC::XML::request->new('remove', $args));
- if(!$resp->is_fault) {
- print "ok.\n";
- } else {
- print "\nerror occured: " . $resp->string . "\n";
- }
-}
-
-sub mkcol {
- my($args) = @_;
- if(!($args =~ /\/.*/)) {
- $args = "$COLLECTION/$args";
- }
- print "creating collection $args";
- $resp =
- $client->send_request(RPC::XML::request->new('createCollection', $args));
- if(!$resp->is_fault) {
- print "ok.\n";
- } else {
- print "\nerror occurred: " . $resp->string . "\n";
- }
-}
-
-sub rmcol {
- my($args) = @_;
- if(!($args =~ /\/.*/)) {
- $args = "$COLLECTION/$args";
- }
- print "removing collection $args\n";
- $resp =
- $client->send_request(RPC::XML::request->new('removeCollection', $args));
- if(!$resp->is_fault) {
- if($resp->value == 0) {
- print "could not remove collection $args.\n";
- } else {
- print "removed collection $args.\n";
- }
- } else {
- print "\nerror occurred: " . $resp->string . "\n";
- }
-}
-
-sub benchmark {
- my($file) = @_;
- format STDOUT =
-@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<
-$q $t
-.
- open(IN, $file);
- while(<IN>) {
- #$query = escape($_);
- $resp = $client->send_request(RPC::XML::request->new('querySummary', $query));
- if(!$resp->is_fault) {
- %struct = %{$resp->value->value};
- $q = $_;
- $t = $struct{"queryTime"};
- write(STDOUT);
- } else {
- print "error occured: $resp->value->string\n";
- return;
- }
- }
-}
-
-sub summary {
- my($query) = @_;
- if($RESULT_ID < 0) {
- print "no query. Use find to do a query!\n";
- return;
- }
- $resp = $client->send_request(RPC::XML::request->new('querySummary', $RESULT_ID));
- if(!ref($resp)) {
- print "error occured: $resp\n";
- } else {
- %struct = %{$resp->value->value};
- print "\nQuery result summary\n";
- print "--------------------\n";
- print "Hits: " . $struct{"hits"} . "\n";
- print "Query time: " . $struct{"queryTime"} . "\n\n";
- @docs = @{$struct{"documents"}};
- format STDOUT_TOP =
-DocId Document Hits
-========================================================
-.
-
- format STDOUT =
-@<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<
-$docId $docName $hits
-.
-
- foreach $doc (@docs) {
- ($docName, $docId, $hits) = @{$doc};
- write(STDOUT);
- }
- }
-}
-
-sub getDocument {
- my($name) = @_;
- if(!($name =~ /\/.*/)) {
- $name = "$COLLECTION/$name";
- }
- $req = RPC::XML::request->new('getDocument', $name, "ISO-8859-1",
- RPC::XML::int->new($PRETTY), '/db/shakespeare/plays/shakes.xsl');
-
- $resp =
- $client->send_request($req);
-
- if(!$resp->is_fault) {
- return decode_base64($resp->value);
- } else {
- print "error occured: ". $resp->string . "\n";
- return '';
- }
-}
-
-sub listDocuments {
- $req = RPC::XML::request->new('getCollectionDesc', $COLLECTION);
- $resp = $client->send_request($req);
- if(!$resp->is_fault) {
- %struct = %{$resp->value};
- @docs = @{$struct{"documents"}};
- @colls = @{$struct{"collections"}};
- foreach $coll (sort(@colls)) {
- print "$coll/\n";
- }
- foreach $_ (sort(@docs)) {
- /.*\/([^\/]*)$/;
- print "$1\n";
- }
- return true;
- } else {
- print "\nerror occured: " . $resp->string . "\n";
- return false;
- }
-}
-
-sub printNotice {
- print <<END;
-eXist version 0.8, Copyright (C) 2001 Wolfgang M. Meier
-eXist comes with ABSOLUTELY NO WARRANTY.
-This is free software, and you are welcome to
-redistribute it under certain conditions;
-for details read the license file.
-
-END
-}
-
-sub printHelp {
- print <<END;
-parse xmlFile Parse file xmlFile.
-get docName Get the document identified by docName.
-find xpathQuery Execute XPath query and print number of results found.
- Use show to display results.
-show [start [, howmany] Retrieve howmany results from the last query, beginning
- at start. With no argument, retrieves the 15 next results.
-summary xpathQuery Same as find but prints a summary of hits
- by document.
-remove docName Remove document identified by docName from
- the database.
-list List all documents contained in the database.
-quit exit.
-
-set option=value Set an option. The following options are available:
- indent=[ on | off ] Turn pretty printing of results on or off
- collection=x Set current collection to x.
-END
-}
-
-sub iso2utf8 {
- my $buffer = shift;
- $buffer =~ s/([\x80-\xFF])/chr(0xC0|ord($1)>>6).chr(0x80|ord($1)&0x3F)/eg;
- return $buffer;
-}
-
-__END__
-
-=head1 NAME
-
-xmlrpc.pl Perl command line client for eXist
-
-=head1 SYNOPSIS
-
-C<xmlrpc.pl>
-
-Enter interactive mode.
-
-C<xmlrpc.pl [-i | --indent] xpath>
-
-Execute xpath expression given in C<xpath> and print results.
-
-C<xmlrpc.pl [-t file | --test=file] [--clients=n] [--count=n]>
-
-Enter test mode. In test mode, the skript will fork multiple parallel
-clients. Each client will randomly select queries from a list, send it
-to the server and retrieve the results. The list of possible queries
-is read from the file identified by option C<--test>. The number of parallel
-clients is defined by option C<--clients>. Each client will perfom
-C<--count> queries before it stops.
-
-Every client writes it's output into a file. The file's name
-consists of the client's process-id and ends with C<.out>.
-
-=head1 DESCRIPTION
-
-B<xmlrpc.pl> is a Perl command line client for the eXist native XML
-database. Communication with the eXist server is done by XML-RPC calls.
-
-In interactive mode, type B<help> to get a list of available commands.
-
-=head2 Commands in interactive mode
-
-=over4
-
-=item ls
-
-Get a list of all documents contained in the database.
-
-=item cd I<collection>
-
-Change current collection to I<collection>
-
-=item get I<xml document>
-
-Retrieve I<xml document> from the database.
-
-=item find I<xpath query>
-
-Send I<xpath query> to the server and retrieve the list of hits. The number of
-hits is displayed. You may then use command B<show> to display results.
-
-=item show [I<start> [, I<howmany>]
-
-Retrieve I<howmany> hits from the current result set, beginning at I<start>,
-and display them. If I<howmany> is omitted, 15 hits will be retrieved. Without
-arguments, B<show> will display the next 15 hits, beginning at the current position
-in the result set.
-
-=back
-
-=cut
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2009-12-28 11:30:17
|
Revision: 10894
http://exist.svn.sourceforge.net/exist/?rev=10894&view=rev
Author: dizzzz
Date: 2009-12-28 11:30:08 +0000 (Mon, 28 Dec 2009)
Log Message:
-----------
[ignore] removal of unused file
Removed Paths:
-------------
trunk/eXist/bin/cpappend.bat
Deleted: trunk/eXist/bin/cpappend.bat
===================================================================
--- trunk/eXist/bin/cpappend.bat 2009-12-28 11:27:01 UTC (rev 10893)
+++ trunk/eXist/bin/cpappend.bat 2009-12-28 11:30:08 UTC (rev 10894)
@@ -1 +0,0 @@
-set _LIBJARS=%_LIBJARS%;%1
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2009-12-28 11:27:12
|
Revision: 10893
http://exist.svn.sourceforge.net/exist/?rev=10893&view=rev
Author: dizzzz
Date: 2009-12-28 11:27:01 +0000 (Mon, 28 Dec 2009)
Log Message:
-----------
[ignore] move jsvc stuff from bin to tools/jsvc
Added Paths:
-----------
trunk/eXist/tools/jsvc/exist-init.d.sh
Removed Paths:
-------------
trunk/eXist/bin/exist-init.d.sh
Deleted: trunk/eXist/bin/exist-init.d.sh
===================================================================
--- trunk/eXist/bin/exist-init.d.sh 2009-12-28 11:22:23 UTC (rev 10892)
+++ trunk/eXist/bin/exist-init.d.sh 2009-12-28 11:27:01 UTC (rev 10893)
@@ -1,101 +0,0 @@
-#!/bin/sh
-##############################################################################
-#
-# Copyright 2004 The Apache Software Foundation.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-##############################################################################
-
-### BEGIN INIT INFO
-# Provides: appbrokers
-# Required-Start: $network
-# Required-Stop: $network
-# Default-Start: 3 5
-# Default-Stop: 0 1 2 6
-# Description: Start the eXist database
-### END INIT INFO
-
-#
-# Small shell script to show how to start/stop eXist using jsvc
-#
-# Adapt the following lines to your configuration
-
-JAVA_HOME=/usr/java/jdk1.5.0_03/
-EXIST_HOME=/opt/exist
-DAEMON_HOME=$EXIST_HOME/bin
-EXIST_USER=exist
-
-# for multi instances adapt those lines.
-TMP_DIR=/var/tmp
-PID_FILE=$EXIST_HOME/jsvc.pid
-
-JAVA_ENDORSED_DIR=$EXIST_HOME/lib/endorsed
-#LDAP_OPTIONS="-Dsecurity.ldap.connection.url=ldap://your-server.com:389 -Dsecurity.ldap.dn.user=ou=Users,dc=yourdomain,dc=org,dc=authority -Dsecurity.ldap.dn.group=ou=Groups,dc=yourdomain,dc=org,dc=authority"
-JAVA_OPTIONS="-Dexist.home=$EXIST_HOME -Djava.library.path=$EXIST_HOME/jni/native/.libs -Xmx512m -Dfile.encoding=UTF-8 $LDAP_OPTIONS"
-
-CLASSPATH=\
-$EXIST_HOME/bin/commons-daemon.jar:\
-$EXIST_HOME/start.jar
-
-. /etc/rc.status
-
-# First reset status of this service
-rc_reset
-
-
-case "$1" in
- start)
- #
- # Start eXist
- #
- $DAEMON_HOME/jsvc \
- -user $EXIST_USER \
- -home $JAVA_HOME \
- -Djava.endorsed.dir=$JAVA_ENDORSED_DIR \
- -Djava.io.tmpdir=$TMP_DIR \
- -wait 10 \
- -pidfile $PID_FILE \
- -outfile $EXIST_HOME/logs/exist.out \
- -errfile '&1' \
- $JAVA_OPTIONS \
- -cp $CLASSPATH \
- org.exist.start.ServiceDaemon standalone
- #
- # To get a verbose JVM
- #-verbose \
- # To get a debug of jsvc.
- #-debug \
-
- rc_status -v
-
- exit $?
- ;;
-
- stop)
- #
- # Stop eXist
- #
- $DAEMON_HOME/jsvc \
- -Djava.endorsed.dir=$JAVA_ENDORSED_DIR \
- -cp $CLASSPATH \
- -stop \
- -pidfile $PID_FILE \
- org.exist.start.ServiceDaemon shutdown
- rc_status -v
- exit $?
- ;;
-
- *)
- echo "Usage $0 start/stop"
- exit 1;;
-esac
Copied: trunk/eXist/tools/jsvc/exist-init.d.sh (from rev 10890, trunk/eXist/bin/exist-init.d.sh)
===================================================================
--- trunk/eXist/tools/jsvc/exist-init.d.sh (rev 0)
+++ trunk/eXist/tools/jsvc/exist-init.d.sh 2009-12-28 11:27:01 UTC (rev 10893)
@@ -0,0 +1,101 @@
+#!/bin/sh
+##############################################################################
+#
+# Copyright 2004 The Apache Software Foundation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##############################################################################
+
+### BEGIN INIT INFO
+# Provides: appbrokers
+# Required-Start: $network
+# Required-Stop: $network
+# Default-Start: 3 5
+# Default-Stop: 0 1 2 6
+# Description: Start the eXist database
+### END INIT INFO
+
+#
+# Small shell script to show how to start/stop eXist using jsvc
+#
+# Adapt the following lines to your configuration
+
+JAVA_HOME=/usr/java/jdk1.5.0_03/
+EXIST_HOME=/opt/exist
+DAEMON_HOME=$EXIST_HOME/bin
+EXIST_USER=exist
+
+# for multi instances adapt those lines.
+TMP_DIR=/var/tmp
+PID_FILE=$EXIST_HOME/jsvc.pid
+
+JAVA_ENDORSED_DIR=$EXIST_HOME/lib/endorsed
+#LDAP_OPTIONS="-Dsecurity.ldap.connection.url=ldap://your-server.com:389 -Dsecurity.ldap.dn.user=ou=Users,dc=yourdomain,dc=org,dc=authority -Dsecurity.ldap.dn.group=ou=Groups,dc=yourdomain,dc=org,dc=authority"
+JAVA_OPTIONS="-Dexist.home=$EXIST_HOME -Djava.library.path=$EXIST_HOME/jni/native/.libs -Xmx512m -Dfile.encoding=UTF-8 $LDAP_OPTIONS"
+
+CLASSPATH=\
+$EXIST_HOME/bin/commons-daemon.jar:\
+$EXIST_HOME/start.jar
+
+. /etc/rc.status
+
+# First reset status of this service
+rc_reset
+
+
+case "$1" in
+ start)
+ #
+ # Start eXist
+ #
+ $DAEMON_HOME/jsvc \
+ -user $EXIST_USER \
+ -home $JAVA_HOME \
+ -Djava.endorsed.dir=$JAVA_ENDORSED_DIR \
+ -Djava.io.tmpdir=$TMP_DIR \
+ -wait 10 \
+ -pidfile $PID_FILE \
+ -outfile $EXIST_HOME/logs/exist.out \
+ -errfile '&1' \
+ $JAVA_OPTIONS \
+ -cp $CLASSPATH \
+ org.exist.start.ServiceDaemon standalone
+ #
+ # To get a verbose JVM
+ #-verbose \
+ # To get a debug of jsvc.
+ #-debug \
+
+ rc_status -v
+
+ exit $?
+ ;;
+
+ stop)
+ #
+ # Stop eXist
+ #
+ $DAEMON_HOME/jsvc \
+ -Djava.endorsed.dir=$JAVA_ENDORSED_DIR \
+ -cp $CLASSPATH \
+ -stop \
+ -pidfile $PID_FILE \
+ org.exist.start.ServiceDaemon shutdown
+ rc_status -v
+ exit $?
+ ;;
+
+ *)
+ echo "Usage $0 start/stop"
+ exit 1;;
+esac
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2009-12-28 11:22:33
|
Revision: 10892
http://exist.svn.sourceforge.net/exist/?rev=10892&view=rev
Author: dizzzz
Date: 2009-12-28 11:22:23 +0000 (Mon, 28 Dec 2009)
Log Message:
-----------
[ignore] move jsvc stuff from bin to tools/jsvc
Added Paths:
-----------
trunk/eXist/tools/jsvc/
trunk/eXist/tools/jsvc/commons-daemon.jar
trunk/eXist/tools/jsvc/exist.sh
trunk/eXist/tools/jsvc/jsvc.tar.gz
Removed Paths:
-------------
trunk/eXist/bin/commons-daemon.jar
trunk/eXist/bin/exist.sh
trunk/eXist/bin/jsvc.tar.gz
Deleted: trunk/eXist/bin/commons-daemon.jar
===================================================================
(Binary files differ)
Deleted: trunk/eXist/bin/exist.sh
===================================================================
--- trunk/eXist/bin/exist.sh 2009-12-28 11:05:51 UTC (rev 10891)
+++ trunk/eXist/bin/exist.sh 2009-12-28 11:22:23 UTC (rev 10892)
@@ -1,80 +0,0 @@
-#!/bin/sh
-##############################################################################
-#
-# Copyright 2004 The Apache Software Foundation.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-##############################################################################
-#
-# Small shell script to show how to start/stop eXist using jsvc
-#
-# Adapt the following lines to your configuration
-JAVA_HOME=/usr/java/jdk1.5.0_03/
-EXIST_HOME=/opt/exist
-DAEMON_HOME=$EXIST_HOME/bin
-EXIST_USER=exist
-
-# for multi instances adapt those lines.
-TMP_DIR=/var/tmp
-PID_FILE=$EXIST_HOME/jsvc.pid
-
-JAVA_ENDORSED_DIR=$EXIST_HOME/lib/endorsed
-#LDAP_OPTIONS="-Dsecurity.ldap.connection.url=ldap://your-server.com:389 -Dsecurity.ldap.dn.user=ou=Users,dc=yourdomain,dc=org,dc=authority -Dsecurity.ldap.dn.group=ou=Groups,dc=yourdomain,dc=org,dc=authority"
-JAVA_OPTIONS="-Dexist.home=$EXIST_HOME -Djava.library.path=$EXIST_HOME/jni/native/.libs -Xmx512m -Dfile.encoding=UTF-8 $LDAP_OPTIONS"
-
-CLASSPATH=\
-$EXIST_HOME/bin/commons-daemon.jar:\
-$EXIST_HOME/start.jar
-
-case "$1" in
- start)
- #
- # Start eXist
- #
- $DAEMON_HOME/jsvc \
- -user $EXIST_USER \
- -home $JAVA_HOME \
- -Djava.endorsed.dir=$JAVA_ENDORSED_DIR \
- -Djava.io.tmpdir=$TMP_DIR \
- -wait 10 \
- -pidfile $PID_FILE \
- -outfile $EXIST_HOME/logs/exist.out \
- -errfile '&1' \
- $JAVA_OPTIONS \
- -cp $CLASSPATH \
- org.exist.start.ServiceDaemon standalone
- #
- # To get a verbose JVM
- #-verbose \
- # To get a debug of jsvc.
- #-debug \
- exit $?
- ;;
-
- stop)
- #
- # Stop eXist
- #
- $DAEMON_HOME/jsvc \
- -Djava.endorsed.dir=$JAVA_ENDORSED_DIR \
- -cp $CLASSPATH \
- -stop \
- -pidfile $PID_FILE \
- org.exist.start.ServiceDaemon shutdown
- exit $?
- ;;
-
- *)
- echo "Usage eXist.sh start/stop"
- exit 1;;
-esac
Deleted: trunk/eXist/bin/jsvc.tar.gz
===================================================================
(Binary files differ)
Copied: trunk/eXist/tools/jsvc/commons-daemon.jar (from rev 10890, trunk/eXist/bin/commons-daemon.jar)
===================================================================
(Binary files differ)
Copied: trunk/eXist/tools/jsvc/exist.sh (from rev 10890, trunk/eXist/bin/exist.sh)
===================================================================
--- trunk/eXist/tools/jsvc/exist.sh (rev 0)
+++ trunk/eXist/tools/jsvc/exist.sh 2009-12-28 11:22:23 UTC (rev 10892)
@@ -0,0 +1,80 @@
+#!/bin/sh
+##############################################################################
+#
+# Copyright 2004 The Apache Software Foundation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##############################################################################
+#
+# Small shell script to show how to start/stop eXist using jsvc
+#
+# Adapt the following lines to your configuration
+JAVA_HOME=/usr/java/jdk1.5.0_03/
+EXIST_HOME=/opt/exist
+DAEMON_HOME=$EXIST_HOME/bin
+EXIST_USER=exist
+
+# for multi instances adapt those lines.
+TMP_DIR=/var/tmp
+PID_FILE=$EXIST_HOME/jsvc.pid
+
+JAVA_ENDORSED_DIR=$EXIST_HOME/lib/endorsed
+#LDAP_OPTIONS="-Dsecurity.ldap.connection.url=ldap://your-server.com:389 -Dsecurity.ldap.dn.user=ou=Users,dc=yourdomain,dc=org,dc=authority -Dsecurity.ldap.dn.group=ou=Groups,dc=yourdomain,dc=org,dc=authority"
+JAVA_OPTIONS="-Dexist.home=$EXIST_HOME -Djava.library.path=$EXIST_HOME/jni/native/.libs -Xmx512m -Dfile.encoding=UTF-8 $LDAP_OPTIONS"
+
+CLASSPATH=\
+$EXIST_HOME/bin/commons-daemon.jar:\
+$EXIST_HOME/start.jar
+
+case "$1" in
+ start)
+ #
+ # Start eXist
+ #
+ $DAEMON_HOME/jsvc \
+ -user $EXIST_USER \
+ -home $JAVA_HOME \
+ -Djava.endorsed.dir=$JAVA_ENDORSED_DIR \
+ -Djava.io.tmpdir=$TMP_DIR \
+ -wait 10 \
+ -pidfile $PID_FILE \
+ -outfile $EXIST_HOME/logs/exist.out \
+ -errfile '&1' \
+ $JAVA_OPTIONS \
+ -cp $CLASSPATH \
+ org.exist.start.ServiceDaemon standalone
+ #
+ # To get a verbose JVM
+ #-verbose \
+ # To get a debug of jsvc.
+ #-debug \
+ exit $?
+ ;;
+
+ stop)
+ #
+ # Stop eXist
+ #
+ $DAEMON_HOME/jsvc \
+ -Djava.endorsed.dir=$JAVA_ENDORSED_DIR \
+ -cp $CLASSPATH \
+ -stop \
+ -pidfile $PID_FILE \
+ org.exist.start.ServiceDaemon shutdown
+ exit $?
+ ;;
+
+ *)
+ echo "Usage eXist.sh start/stop"
+ exit 1;;
+esac
Copied: trunk/eXist/tools/jsvc/jsvc.tar.gz (from rev 10890, trunk/eXist/bin/jsvc.tar.gz)
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2009-12-28 11:05:58
|
Revision: 10891
http://exist.svn.sourceforge.net/exist/?rev=10891&view=rev
Author: dizzzz
Date: 2009-12-28 11:05:51 +0000 (Mon, 28 Dec 2009)
Log Message:
-----------
[ignore] rename script, make names more consistent
Added Paths:
-----------
trunk/eXist/bin/startupCluster.bat
Removed Paths:
-------------
trunk/eXist/bin/startup_cluster.bat
Copied: trunk/eXist/bin/startupCluster.bat (from rev 10890, trunk/eXist/bin/startup_cluster.bat)
===================================================================
--- trunk/eXist/bin/startupCluster.bat (rev 0)
+++ trunk/eXist/bin/startupCluster.bat 2009-12-28 11:05:51 UTC (rev 10891)
@@ -0,0 +1,49 @@
+@echo off
+
+rem $Id$
+
+rem Slurp the command line arguments. This loop allows for an unlimited number
+rem of arguments (up to the command line limit, anyway).
+
+set CMD_LINE_ARGS=%1
+if ""%1""=="""" goto doneStart
+shift
+:setupArgs
+if ""%1""=="""" goto doneStart
+set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
+shift
+goto setupArgs
+
+rem This label provides a place for the argument list loop to break out
+rem and for NT handling to skip to.
+
+:doneStart
+
+
+if not "%JAVA_HOME%" == "" goto gotJavaHome
+echo Java environment not found. Please set
+echo your JAVA_HOME environment variable to
+echo the home of your JDK.
+goto :eof
+
+:gotJavaHome
+if not "%EXIST_HOME%" == "" goto gotExistHome
+
+rem try to guess
+set EXIST_HOME=.
+if exist %EXIST_HOME%\start.jar goto gotExistHome
+set EXIST_HOME=..
+if exist %EXIST_HOME%\start.jar goto gotExistHome
+
+echo EXIST_HOME not found. Please set your
+echo EXIST_HOME environment variable to the
+echo home directory of eXist.
+goto :eof
+
+:gotExistHome
+set JAVA_ENDORSED_DIRS="%EXIST_HOME%"\lib\endorsed
+set JAVA_OPTS="-Xms128m -Xmx512m -Dfile.encoding=UTF-8 -Djava.endorsed.dirs=%JAVA_ENDORSED_DIRS%"
+
+"%JAVA_HOME%\bin\java" "%JAVA_OPTS%" -Dexist.home="%EXIST_HOME%" -jar "%EXIST_HOME%\start.jar" cluster %CMD_LINE_ARGS%
+:eof
+
Deleted: trunk/eXist/bin/startup_cluster.bat
===================================================================
--- trunk/eXist/bin/startup_cluster.bat 2009-12-27 21:06:40 UTC (rev 10890)
+++ trunk/eXist/bin/startup_cluster.bat 2009-12-28 11:05:51 UTC (rev 10891)
@@ -1,49 +0,0 @@
-@echo off
-
-rem $Id$
-
-rem Slurp the command line arguments. This loop allows for an unlimited number
-rem of arguments (up to the command line limit, anyway).
-
-set CMD_LINE_ARGS=%1
-if ""%1""=="""" goto doneStart
-shift
-:setupArgs
-if ""%1""=="""" goto doneStart
-set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
-shift
-goto setupArgs
-
-rem This label provides a place for the argument list loop to break out
-rem and for NT handling to skip to.
-
-:doneStart
-
-
-if not "%JAVA_HOME%" == "" goto gotJavaHome
-echo Java environment not found. Please set
-echo your JAVA_HOME environment variable to
-echo the home of your JDK.
-goto :eof
-
-:gotJavaHome
-if not "%EXIST_HOME%" == "" goto gotExistHome
-
-rem try to guess
-set EXIST_HOME=.
-if exist %EXIST_HOME%\start.jar goto gotExistHome
-set EXIST_HOME=..
-if exist %EXIST_HOME%\start.jar goto gotExistHome
-
-echo EXIST_HOME not found. Please set your
-echo EXIST_HOME environment variable to the
-echo home directory of eXist.
-goto :eof
-
-:gotExistHome
-set JAVA_ENDORSED_DIRS="%EXIST_HOME%"\lib\endorsed
-set JAVA_OPTS="-Xms128m -Xmx512m -Dfile.encoding=UTF-8 -Djava.endorsed.dirs=%JAVA_ENDORSED_DIRS%"
-
-"%JAVA_HOME%\bin\java" "%JAVA_OPTS%" -Dexist.home="%EXIST_HOME%" -jar "%EXIST_HOME%\start.jar" cluster %CMD_LINE_ARGS%
-:eof
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wol...@us...> - 2009-12-27 21:06:49
|
Revision: 10890
http://exist.svn.sourceforge.net/exist/?rev=10890&view=rev
Author: wolfgang_m
Date: 2009-12-27 21:06:40 +0000 (Sun, 27 Dec 2009)
Log Message:
-----------
[ignore] directly use new structural index to resolve ancestor lookups. This is used by optimized expressions and greatly improves query performance of XPath expressions on huge node sets.
Modified Paths:
--------------
branches/wolfgang/src/org/exist/indexing/StructuralIndex.java
branches/wolfgang/src/org/exist/storage/NativeElementIndex.java
branches/wolfgang/src/org/exist/storage/btree/BTree.java
branches/wolfgang/src/org/exist/storage/btree/Value.java
branches/wolfgang/src/org/exist/storage/structural/NativeStructuralIndexWorker.java
branches/wolfgang/src/org/exist/xquery/pragmas/Optimize.java
Modified: branches/wolfgang/src/org/exist/indexing/StructuralIndex.java
===================================================================
--- branches/wolfgang/src/org/exist/indexing/StructuralIndex.java 2009-12-27 19:20:26 UTC (rev 10889)
+++ branches/wolfgang/src/org/exist/indexing/StructuralIndex.java 2009-12-27 21:06:40 UTC (rev 10890)
@@ -24,4 +24,6 @@
public NodeSet findDescendantsByTagName(byte type, QName qname, int axis,
DocumentSet docs, ExtNodeSet contextSet, int contextId);
+
+ public NodeSet findAncestorsByTagName(byte type, QName qname, int axis, DocumentSet docs, NodeSet contextSet, int contextId);
}
Modified: branches/wolfgang/src/org/exist/storage/NativeElementIndex.java
===================================================================
--- branches/wolfgang/src/org/exist/storage/NativeElementIndex.java 2009-12-27 19:20:26 UTC (rev 10889)
+++ branches/wolfgang/src/org/exist/storage/NativeElementIndex.java 2009-12-27 21:06:40 UTC (rev 10890)
@@ -484,6 +484,10 @@
os = new VariableByteOutputStream();
}
+ public NodeSet findAncestorsByTagName(byte type, QName qname, int axis, DocumentSet docs, NodeSet contextSet, int contextId) {
+ return null; // Default
+ }
+
/**
* Lookup elements or attributes in the index matching a given {@link QName} and
* {@link NodeSelector}. The NodeSelector argument is optional. If selector is
Modified: branches/wolfgang/src/org/exist/storage/btree/BTree.java
===================================================================
--- branches/wolfgang/src/org/exist/storage/btree/BTree.java 2009-12-27 19:20:26 UTC (rev 10889)
+++ branches/wolfgang/src/org/exist/storage/btree/BTree.java 2009-12-27 21:06:40 UTC (rev 10890)
@@ -554,8 +554,8 @@
byte[] data = value.getData();
writer.write('[');
for (int i = 0; i < data.length; i++) {
- writer.write(Integer.toString(data[i]));
- writer.write(' ');
+ writer.write(Integer.toHexString(data[i]));
+// writer.write(' ');
}
writer.write(']');
}
@@ -1061,6 +1061,8 @@
ptrs[i] = ByteConversion.byteToLong(data, p);
p += 8;
}
+// if (getFile().getName().equals("structure.dbx"))
+// System.out.println("nKeys: " + nKeys + "; size: " + p);
}
/**
@@ -1212,12 +1214,14 @@
//recalculateDataLen();
if (mustSplit()) {
// we normally split a node at its median value.
- // however, if the inserted key is at the maximum or minimum of the
- // current node, we split right after or before the inserted key.
- if (idx == 0 || idx == nKeys - 1)
+ // however, if the inserted key is in the upper or lower
+ // section of the node, we split directly at the key. this
+ // has advantages if keys are inserted in ascending order
+ if (idx == 0 || idx > (nKeys / 3) * 2)
split(transaction, idx == 0 ? 1 : idx);
- else
+ else {
split(transaction);
+ }
}
}
return -1;
Modified: branches/wolfgang/src/org/exist/storage/btree/Value.java
===================================================================
--- branches/wolfgang/src/org/exist/storage/btree/Value.java 2009-12-27 19:20:26 UTC (rev 10889)
+++ branches/wolfgang/src/org/exist/storage/btree/Value.java 2009-12-27 21:06:40 UTC (rev 10890)
@@ -292,8 +292,8 @@
public String dump() {
StringBuilder buf = new StringBuilder();
for (int i = 0; i < len; i++) {
- buf.append(Integer.toString(data[pos + i] & 0xFF));
- buf.append(' ');
+ buf.append(Integer.toHexString(data[pos + i] ));
+// buf.append(' ');
}
return buf.toString();
}
Modified: branches/wolfgang/src/org/exist/storage/structural/NativeStructuralIndexWorker.java
===================================================================
--- branches/wolfgang/src/org/exist/storage/structural/NativeStructuralIndexWorker.java 2009-12-27 19:20:26 UTC (rev 10889)
+++ branches/wolfgang/src/org/exist/storage/structural/NativeStructuralIndexWorker.java 2009-12-27 21:06:40 UTC (rev 10890)
@@ -71,8 +71,7 @@
final Lock lock = index.btree.getLock();
final NewArrayNodeSet result = new NewArrayNodeSet(docs.getDocumentCount(), 256);
FindDescendantsCallback callback = new FindDescendantsCallback(type, axis, contextId, result);
- for (Iterator<NodeProxy> i = contextSet.iterator(); i.hasNext(); ) {
- NodeProxy ancestor = i.next();
+ for (NodeProxy ancestor : contextSet) {
DocumentImpl doc = ancestor.getDocument();
NodeId ancestorId = ancestor.getNodeId();
callback.setAncestor(doc, ancestor);
@@ -103,6 +102,48 @@
return result;
}
+ public NodeSet findAncestorsByTagName(byte type, QName qname, int axis, DocumentSet docs, NodeSet contextSet, int contextId) {
+ final Lock lock = index.btree.getLock();
+ final NewArrayNodeSet result = new NewArrayNodeSet(docs.getDocumentCount(), 256);
+ for (NodeProxy descendant : contextSet) {
+ NodeId parentId;
+ if (axis == Constants.ANCESTOR_SELF_AXIS || axis == Constants.SELF_AXIS)
+ parentId = descendant.getNodeId();
+ else
+ parentId = descendant.getNodeId().getParentId();
+ DocumentImpl doc = descendant.getDocument();
+ byte[] key;
+ while (parentId != NodeId.DOCUMENT_NODE) {
+ key = computeKey(type, doc.getDocId(), qname, parentId);
+ try {
+ lock.acquire(Lock.READ_LOCK);
+ if (index.btree.findValue(new Value(key)) > -1) {
+ NodeProxy storedNode = new NodeProxy(doc, parentId,
+ type == ElementValue.ATTRIBUTE ? Node.ATTRIBUTE_NODE : Node.ELEMENT_NODE, -1);
+ result.add(storedNode);
+ if (Expression.NO_CONTEXT_ID != contextId) {
+ storedNode.deepCopyContext(descendant, contextId);
+ } else
+ storedNode.copyContext(descendant);
+ storedNode.addMatches(descendant);
+ }
+ } catch (LockException e) {
+ NativeStructuralIndex.LOG.warn("Lock problem while searching structural index: " + e.getMessage(), e);
+ } catch (Exception e) {
+ NativeStructuralIndex.LOG.error("Error while searching structural index: " + e.getMessage(), e);
+ } finally {
+ lock.release(Lock.READ_LOCK);
+ }
+ // stop after first iteration if we are on the self axis
+ if (axis == Constants.SELF_AXIS)
+ break;
+ // continue with the parent of the parent
+ parentId = parentId.getParentId();
+ }
+ }
+ return result;
+ }
+
private class FindElementsCallback implements BTreeCallback {
byte type;
DocumentImpl doc;
Modified: branches/wolfgang/src/org/exist/xquery/pragmas/Optimize.java
===================================================================
--- branches/wolfgang/src/org/exist/xquery/pragmas/Optimize.java 2009-12-27 19:20:26 UTC (rev 10889)
+++ branches/wolfgang/src/org/exist/xquery/pragmas/Optimize.java 2009-12-27 21:06:40 UTC (rev 10890)
@@ -125,18 +125,23 @@
ancestors = selection.selectAncestorDescendant(contextSequence.toNodeSet(), NodeSet.ANCESTOR,
true, contextId, false);
} else {
- NodeSelector selector;
+// NodeSelector selector;
long start = System.currentTimeMillis();
- selector = new AncestorSelector(selection, contextId, true, false);
+// selector = new AncestorSelector(selection, contextId, true, false);
StructuralIndex index = context.getBroker().getStructuralIndex();
QName ancestorQN = contextStep.getTest().getName();
if (optimizables[current].optimizeOnSelf()) {
- selector = new SelfSelector(selection, contextId);
- ancestors = index.findElementsByTagName(ancestorQN.getNameType(), selection.getDocumentSet(),
- ancestorQN, selector);
- } else
- ancestors = index.findElementsByTagName(ancestorQN.getNameType(), selection.getDocumentSet(),
- ancestorQN, selector);
+// selector = new SelfSelector(selection, contextId);
+// ancestors = index.findElementsByTagName(ancestorQN.getNameType(), selection.getDocumentSet(),
+// ancestorQN, selector);
+ ancestors = index.findAncestorsByTagName(ancestorQN.getNameType(), ancestorQN, Constants.SELF_AXIS,
+ selection.getDocumentSet(), selection, contextId);
+ } else {
+// ancestors = index.findElementsByTagName(ancestorQN.getNameType(), selection.getDocumentSet(),
+// ancestorQN, selector);
+ ancestors = index.findAncestorsByTagName(ancestorQN.getNameType(), ancestorQN,
+ Constants.ANCESTOR_SELF_AXIS, selection.getDocumentSet(), selection, contextId);
+ }
if (LOG.isTraceEnabled()) {
LOG.trace("Ancestor selection took " + (System.currentTimeMillis() - start));
LOG.trace("Found: " + ancestors.getLength());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <del...@us...> - 2009-12-27 19:20:34
|
Revision: 10889
http://exist.svn.sourceforge.net/exist/?rev=10889&view=rev
Author: deliriumsky
Date: 2009-12-27 19:20:26 +0000 (Sun, 27 Dec 2009)
Log Message:
-----------
Test case should be in test folder
Added Paths:
-----------
trunk/eXist/extensions/fluent/test/src/org/exist/fluent/DatabaseTestCase.java
Removed Paths:
-------------
trunk/eXist/extensions/fluent/src/org/exist/fluent/DatabaseTestCase.java
Deleted: trunk/eXist/extensions/fluent/src/org/exist/fluent/DatabaseTestCase.java
===================================================================
--- trunk/eXist/extensions/fluent/src/org/exist/fluent/DatabaseTestCase.java 2009-12-27 19:13:53 UTC (rev 10888)
+++ trunk/eXist/extensions/fluent/src/org/exist/fluent/DatabaseTestCase.java 2009-12-27 19:20:26 UTC (rev 10889)
@@ -1,84 +0,0 @@
-package org.exist.fluent;
-
-import java.io.File;
-import java.lang.annotation.*;
-import java.util.Iterator;
-
-import org.exist.collections.Collection;
-import org.exist.dom.*;
-import org.exist.security.SecurityManager;
-import org.exist.storage.DBBroker;
-import org.exist.xmldb.XmldbURI;
-import org.junit.*;
-
-/**
- * A superclass for database unit tests. It takes care of starting up and clearing the database in
- * its <code>setUp</code> method, and supports mocking with jMock. By default, the database
- * will be configured from the file "conf.xml" in the current directory, but you can annotate your
- * test class with {@link DatabaseTestCase.ConfigFile} to specify a different one.
- *
- * @author <a href="mailto:pi...@id...">Piotr Kaminski</a>
- */
-@DatabaseTestCase.ConfigFile("conf.xml")
-public abstract class DatabaseTestCase {
-
- /**
- * An annotation that specifies the path of the config file to use when setting up the database
- * for a test.
- *
- * @author <a href="mailto:pi...@id...">Piotr Kaminski</a>
- */
- @Inherited @Documented @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE)
- public @interface ConfigFile {
- String value();
- }
-
- protected static Database db;
-
- @Before public void startupDatabase() throws Exception {
- ConfigFile configFileAnnotation = getClass().getAnnotation(ConfigFile.class);
- if (configFileAnnotation == null)
- throw new DatabaseException("Missing ConfigFile annotation on DatabaseTestCase subclass");
- File configFile = new File(configFileAnnotation.value());
- if (!Database.isStarted()) {
- Database.startup(configFile);
- db = null;
- }
- if (db == null) db = new Database(SecurityManager.SYSTEM_USER);
- wipeDatabase();
- Database.configureRootCollection(configFile); // config file gets erased by wipeDatabase()
- }
-
- @AfterClass public static void shutdownDatabase() throws Exception {
- if (Database.isStarted()) {
- wipeDatabase();
- Database.shutdown();
- db = null;
- }
- }
-
- private static void wipeDatabase() throws Exception {
- Transaction tx = db.requireTransactionWithBroker();
- try {
- Collection root = tx.broker.getCollection(XmldbURI.ROOT_COLLECTION_URI);
- for (Iterator<XmldbURI> it = root.collectionIterator(); it.hasNext(); ) {
- XmldbURI childName = it.next();
- if (!childName.getCollectionPath().equals(DBBroker.SYSTEM_COLLECTION_NAME)) {
- tx.broker.removeCollection(tx.tx, tx.broker.getCollection(root.getURI().append(childName)));
- }
- }
- for (Iterator<DocumentImpl> it = root.iterator(tx.broker); it.hasNext(); ) {
- DocumentImpl doc = it.next();
- if (doc instanceof BinaryDocument) {
- root.removeBinaryResource(tx.tx, tx.broker, doc);
- } else {
- root.removeXMLResource(tx.tx, tx.broker, doc.getFileURI());
- }
- }
- tx.commit();
- } finally {
- tx.abortIfIncomplete();
- }
- }
-
-}
\ No newline at end of file
Copied: trunk/eXist/extensions/fluent/test/src/org/exist/fluent/DatabaseTestCase.java (from rev 10887, trunk/eXist/extensions/fluent/src/org/exist/fluent/DatabaseTestCase.java)
===================================================================
--- trunk/eXist/extensions/fluent/test/src/org/exist/fluent/DatabaseTestCase.java (rev 0)
+++ trunk/eXist/extensions/fluent/test/src/org/exist/fluent/DatabaseTestCase.java 2009-12-27 19:20:26 UTC (rev 10889)
@@ -0,0 +1,87 @@
+package org.exist.fluent;
+
+import java.io.File;
+import java.lang.annotation.*;
+import java.util.Iterator;
+
+import org.exist.collections.Collection;
+import org.exist.dom.*;
+import org.exist.fluent.Database;
+import org.exist.fluent.DatabaseException;
+import org.exist.fluent.Transaction;
+import org.exist.security.SecurityManager;
+import org.exist.storage.DBBroker;
+import org.exist.xmldb.XmldbURI;
+import org.junit.*;
+
+/**
+ * A superclass for database unit tests. It takes care of starting up and clearing the database in
+ * its <code>setUp</code> method, and supports mocking with jMock. By default, the database
+ * will be configured from the file "conf.xml" in the current directory, but you can annotate your
+ * test class with {@link DatabaseTestCase.ConfigFile} to specify a different one.
+ *
+ * @author <a href="mailto:pi...@id...">Piotr Kaminski</a>
+ */
+@DatabaseTestCase.ConfigFile("conf.xml")
+public abstract class DatabaseTestCase {
+
+ /**
+ * An annotation that specifies the path of the config file to use when setting up the database
+ * for a test.
+ *
+ * @author <a href="mailto:pi...@id...">Piotr Kaminski</a>
+ */
+ @Inherited @Documented @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE)
+ public @interface ConfigFile {
+ String value();
+ }
+
+ protected static Database db;
+
+ @Before public void startupDatabase() throws Exception {
+ ConfigFile configFileAnnotation = getClass().getAnnotation(ConfigFile.class);
+ if (configFileAnnotation == null)
+ throw new DatabaseException("Missing ConfigFile annotation on DatabaseTestCase subclass");
+ File configFile = new File(configFileAnnotation.value());
+ if (!Database.isStarted()) {
+ Database.startup(configFile);
+ db = null;
+ }
+ if (db == null) db = new Database(SecurityManager.SYSTEM_USER);
+ wipeDatabase();
+ Database.configureRootCollection(configFile); // config file gets erased by wipeDatabase()
+ }
+
+ @AfterClass public static void shutdownDatabase() throws Exception {
+ if (Database.isStarted()) {
+ wipeDatabase();
+ Database.shutdown();
+ db = null;
+ }
+ }
+
+ private static void wipeDatabase() throws Exception {
+ Transaction tx = db.requireTransactionWithBroker();
+ try {
+ Collection root = tx.broker.getCollection(XmldbURI.ROOT_COLLECTION_URI);
+ for (Iterator<XmldbURI> it = root.collectionIterator(); it.hasNext(); ) {
+ XmldbURI childName = it.next();
+ if (!childName.getCollectionPath().equals(DBBroker.SYSTEM_COLLECTION_NAME)) {
+ tx.broker.removeCollection(tx.tx, tx.broker.getCollection(root.getURI().append(childName)));
+ }
+ }
+ for (Iterator<DocumentImpl> it = root.iterator(tx.broker); it.hasNext(); ) {
+ DocumentImpl doc = it.next();
+ if (doc instanceof BinaryDocument) {
+ root.removeBinaryResource(tx.tx, tx.broker, doc);
+ } else {
+ root.removeXMLResource(tx.tx, tx.broker, doc.getFileURI());
+ }
+ }
+ tx.commit();
+ } finally {
+ tx.abortIfIncomplete();
+ }
+ }
+
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <del...@us...> - 2009-12-27 19:14:00
|
Revision: 10888
http://exist.svn.sourceforge.net/exist/?rev=10888&view=rev
Author: deliriumsky
Date: 2009-12-27 19:13:53 +0000 (Sun, 27 Dec 2009)
Log Message:
-----------
Dont exclude the mail module
Modified Paths:
--------------
trunk/eXist/nbproject/project.properties
Modified: trunk/eXist/nbproject/project.properties
===================================================================
--- trunk/eXist/nbproject/project.properties 2009-12-26 15:32:33 UTC (rev 10887)
+++ trunk/eXist/nbproject/project.properties 2009-12-27 19:13:53 UTC (rev 10888)
@@ -128,7 +128,7 @@
file.reference.ws-commons-util-1.0.2.jar=lib/core/ws-commons-util-1.0.2.jar
test.eXist-1.32.dir=${file.reference.test-src-1}
file.reference.xalan-2.7.1.jar=lib/endorsed/xalan-2.7.1.jar
-excludes=**/spatial/*, **/modules/svn/*, **/modules/xslfo/*,**/modules/mail/*,**/modules/jfreechart/**
+excludes=**/spatial/*, **/modules/svn/*, **/modules/xslfo/*,**/modules/jfreechart/**
file.reference.axis-schema-1.3.jar=lib/optional/axis-schema-1.3.jar
jnlp.descriptor=application
file.reference.commons-logging-1.1.1.jar=lib/core/commons-logging-1.1.1.jar
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sha...@us...> - 2009-12-26 15:32:40
|
Revision: 10887
http://exist.svn.sourceforge.net/exist/?rev=10887&view=rev
Author: shabanovd
Date: 2009-12-26 15:32:33 +0000 (Sat, 26 Dec 2009)
Log Message:
-----------
[ignore] pure XPath 2.0 grammar
Added Paths:
-----------
trunk/eXist/extensions/xpath/src/org/exist/xpath/parser/
trunk/eXist/extensions/xpath/src/org/exist/xpath/parser/XPath.g
Added: trunk/eXist/extensions/xpath/src/org/exist/xpath/parser/XPath.g
===================================================================
--- trunk/eXist/extensions/xpath/src/org/exist/xpath/parser/XPath.g (rev 0)
+++ trunk/eXist/extensions/xpath/src/org/exist/xpath/parser/XPath.g 2009-12-26 15:32:33 UTC (rev 10887)
@@ -0,0 +1,400 @@
+grammar XPath;
+
+options {
+ language = Java;
+}
+
+// XPath 2.0
+
+//[1]
+XPath
+ : Expr
+ ;
+//[2]
+Expr
+ : ExprSingle ("," ExprSingle)*
+ ;
+//[3]
+ExprSingle
+ : ForExpr
+ | QuantifiedExpr
+ | IfExpr
+ | OrExpr
+ ;
+//[4]
+ForExpr
+ : SimpleForClause "return" ExprSingle
+ ;
+//[5]
+SimpleForClause
+ : "for" "$" VarName "in" ExprSingle ("," "$" VarName "in" ExprSingle)*
+ ;
+//[6]
+QuantifiedExpr
+ : ("some" | "every") "$" VarName "in" ExprSingle ("," "$" VarName "in" ExprSingle)* "satisfies" ExprSingle
+ ;
+//[7]
+IfExpr
+ : "if" "(" Expr ")" "then" ExprSingle "else" ExprSingle
+ ;
+//[8]
+OrExpr
+ : AndExpr ( "or" AndExpr )*
+ ;
+//[9]
+AndExpr
+ : ComparisonExpr ( "and" ComparisonExpr )*
+ ;
+//[10]
+ComparisonExpr
+ : RangeExpr (
+ ( ValueComp
+ | GeneralComp
+ | NodeComp
+ )
+ RangeExpr )?
+ ;
+//[11]
+RangeExpr
+ : AdditiveExpr ( "to" AdditiveExpr )?
+ ;
+//[12]
+AdditiveExpr
+ : MultiplicativeExpr ( ("+" | "-") MultiplicativeExpr )*
+ ;
+//[13]
+MultiplicativeExpr
+ : UnionExpr ( ("*" | "div" | "idiv" | "mod") UnionExpr )*
+ ;
+//[14]
+UnionExpr
+ : IntersectExceptExpr ( ("union" | "|") IntersectExceptExpr )*
+ ;
+//[15]
+IntersectExceptExpr
+ : InstanceofExpr ( ("intersect" | "except") InstanceofExpr )*
+ ;
+//[16]
+InstanceofExpr
+ : TreatExpr ( "instance" "of" SequenceType )?
+ ;
+//[17]
+TreatExpr
+ : CastableExpr ( "treat" "as" SequenceType )?
+ ;
+//[18]
+CastableExpr
+ : CastExpr ( "castable" "as" SingleType )?
+ ;
+//[19]
+CastExpr
+ : UnaryExpr ( "cast" "as" SingleType )?
+ ;
+//[20]
+UnaryExpr
+ : ("-" | "+")* ValueExpr
+ ;
+//[21]
+ValueExpr
+ : PathExpr
+ ;
+//[22]
+GeneralComp
+ : "=" | "!=" | "<" | "<=" | ">" | ">="
+ ;
+//[23]
+ValueComp
+ : "eq" | "ne" | "lt" | "le" | "gt" | "ge"
+ ;
+//[24]
+NodeComp
+ : "is" | "<<" | ">>"
+ ;
+//[25]
+PathExpr
+ : ("/" RelativePathExpr?)
+ | ("//" RelativePathExpr)
+ | RelativePathExpr /* xgs: leading-lone-slash */
+ ;
+//[26]
+RelativePathExpr
+ : StepExpr (("/" | "//") StepExpr)*
+ ;
+//[27]
+StepExpr
+ : FilterExpr
+ | AxisStep
+ ;
+//[28]
+AxisStep
+ : (ReverseStep | ForwardStep) PredicateList
+ ;
+//[29]
+ForwardStep
+ : (ForwardAxis NodeTest)
+ | AbbrevForwardStep
+ ;
+//[30]
+ForwardAxis
+ : ("child" "::")
+ | ("descendant" "::")
+ | ("attribute" "::")
+ | ("self" "::")
+ | ("descendant-or-self" "::")
+ | ("following-sibling" "::")
+ | ("following" "::")
+ | ("namespace" "::")
+ ;
+//[31]
+AbbrevForwardStep
+ : "@"? NodeTest
+ ;
+//[32]
+ReverseStep
+ : (ReverseAxis NodeTest)
+ | AbbrevReverseStep
+ ;
+//[33]
+ReverseAxis
+ : ("parent" "::")
+ | ("ancestor" "::")
+ | ("preceding-sibling" "::")
+ | ("preceding" "::")
+ | ("ancestor-or-self" "::")
+ ;
+//[34]
+AbbrevReverseStep
+ : ".."
+ ;
+//[35]
+NodeTest
+ : KindTest
+ | NameTest
+ ;
+//[36]
+NameTest
+ : QName
+ | Wildcard
+ ;
+//[37]
+Wildcard
+ : "*"
+ | (NCName ":" "*")
+ | ("*" ":" NCName) /* ws: explicit */
+ ;
+//[38]
+FilterExpr
+ : PrimaryExpr PredicateList
+ ;
+//[39]
+PredicateList
+ : Predicate*
+ ;
+//[40]
+Predicate
+ : "[" Expr "]"
+ ;
+//[41]
+PrimaryExpr
+ : Literal | VarRef | ParenthesizedExpr | ContextItemExpr | FunctionCall
+ ;
+//[42]
+Literal
+ : NumericLiteral | StringLiteral
+ ;
+//[43]
+NumericLiteral
+ : IntegerLiteral | DecimalLiteral | DoubleLiteral
+ ;
+//[44]
+VarRef
+ : "$" VarName
+ ;
+//[45]
+VarName
+ : QName
+ ;
+//[46]
+ParenthesizedExpr
+ : "(" Expr? ")"
+ ;
+//[47]
+ContextItemExpr
+ : "."
+ ;
+//[48]
+FunctionCall
+ : QName "(" (ExprSingle ("," ExprSingle)*)? ")" /* xgs: reserved-function-names */
+ ;
+ /* gn: parens */
+//[49]
+SingleType
+ : AtomicType "?"?
+ ;
+//[50]
+SequenceType
+ : ("empty-sequence" "(" ")")
+ | (ItemType OccurrenceIndicator?)
+ ;
+//[51]
+OccurrenceIndicator
+ : "?" | "*" | "+" /* xgs: occurrence-indicators */
+ ;
+//[52]
+ItemType
+ : KindTest | ("item" "(" ")") | AtomicType
+ ;
+//[53]
+AtomicType
+ : QName
+ ;
+//[54]
+KindTest
+ : DocumentTest
+ | ElementTest
+ | AttributeTest
+ | SchemaElementTest
+ | SchemaAttributeTest
+ | PITest
+ | CommentTest
+ | TextTest
+ | AnyKindTest
+ ;
+//[55]
+AnyKindTest
+ : "node" "(" ")"
+ ;
+//[56]
+DocumentTest
+ : "document-node" "(" (ElementTest | SchemaElementTest)? ")"
+ ;
+//[57]
+TextTest
+ : "text" "(" ")"
+ ;
+//[58]
+CommentTest
+ : "comment" "(" ")"
+ ;
+//[59]
+PITest
+ : "processing-instruction" "(" (NCName | StringLiteral)? ")"
+ ;
+//[60]
+AttributeTest
+ : "attribute" "(" (AttribNameOrWildcard ("," TypeName)?)? ")"
+ ;
+//[61]
+AttribNameOrWildcard
+ : AttributeName | "*"
+ ;
+//[62]
+SchemaAttributeTest
+ : "schema-attribute" "(" AttributeDeclaration ")"
+ ;
+//[63]
+AttributeDeclaration
+ : AttributeName
+ ;
+//[64]
+ElementTest
+ : "element" "(" (ElementNameOrWildcard ("," TypeName "?"?)?)? ")"
+ ;
+//[65]
+ElementNameOrWildcard
+ : ElementName | "*"
+ ;
+//[66]
+SchemaElementTest
+ : "schema-element" "(" ElementDeclaration ")"
+ ;
+//[67]
+ElementDeclaration
+ : ElementName
+ ;
+//[68]
+AttributeName
+ : QName
+ ;
+//[69]
+ElementName
+ : QName
+ ;
+//[70]
+TypeName
+ : QName
+ ;
+
+//***************************************
+// Terminal Symbols
+//***************************************
+//[71]
+IntegerLiteral
+ : Digits
+ ;
+//[72]
+DecimalLiteral
+ : ("." Digits) | (Digits "." [0-9]*) /* ws: explicit */
+ ;
+//[73]
+DoubleLiteral
+ : (("." Digits) | (Digits ("." [0-9]*)?)) [eE] [+-]? Digits /* ws: explicit */
+ ;
+//[74]
+StringLiteral
+ : ('"' (EscapeQuot | [^"])* '"')
+ | ('\'' (EscapeApos | [^'])* '\'') /* ws: explicit */
+ ;
+//[75]
+EscapeQuot
+ : '""'
+ ;
+//[76]
+EscapeApos
+ : "''"
+ ;
+//[77]
+Comment
+ : "(:" (CommentContents | Comment)* ":)" /* ws: explicit */
+ ;
+ /* gn: comments */
+
+//******************************************************************
+//[78] QName : [http://www.w3.org/TR/REC-xml-names/#NT-QName] Names /* xgs: xml-version */
+//[7]
+QName
+ : PrefixedName
+ | UnprefixedName
+ ;
+//[8]
+PrefixedName
+ : Prefix ':' LocalPart
+ ;
+//[9]
+UnprefixedName
+ : LocalPart
+ ;
+//[10]
+Prefix
+ : NCName
+ ;
+//[11]
+LocalPart
+ : NCName
+ ;
+
+//******************************************************************
+//[79] NCName : [http://www.w3.org/TR/REC-xml-names/#NT-NCName] Names /* xgs: xml-version */
+//[4]
+NCName
+ : Name - (Char* ':' Char*) /* An XML Name, minus the ":" */
+ ;
+
+//******************************************************************
+//[80] Char : [http://www.w3.org/TR/REC-xml#NT-Char] XML /* xgs: xml-version */
+//[2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] /* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */ ;
+fragment
+Char
+ : '\u0009' | '\u000A' | '\u000D'
+ | '\u0020'..'\uD7FF' | '\uE000'..'\uFFFD' | '\u10000'..'\u10FFFF'
+ ;
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: Wolfgang M. <wol...@ex...> - 2009-12-26 08:44:48
|
Why this extension? eXist already has XPath 2.0 (which is part of XQuery 1.0). Wolfgang On Sat, Dec 26, 2009 at 9:32 AM, <sha...@us...> wrote: > Revision: 10886 > http://exist.svn.sourceforge.net/exist/?rev=10886&view=rev > Author: shabanovd > Date: 2009-12-26 08:32:40 +0000 (Sat, 26 Dec 2009) > > Log Message: > ----------- > [feature] XPath extension. The target is 2.0 & 2.1 versions. > > Added Paths: > ----------- > trunk/eXist/extensions/xpath/ > trunk/eXist/extensions/xpath/src/ > trunk/eXist/extensions/xpath/src/org/ > trunk/eXist/extensions/xpath/src/org/exist/ > trunk/eXist/extensions/xpath/src/org/exist/xpath/ > > > This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. > > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > _______________________________________________ > Exist-commits mailing list > Exi...@li... > https://lists.sourceforge.net/lists/listinfo/exist-commits > |