-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GSearch: updates to point to the recently updated JARs, bug fix in th…
…e RESTClient.
- Loading branch information
Showing
9 changed files
with
67 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,14 +21,14 @@ | |
|
||
/** | ||
* Performs REST operations from command line with runRESTClient. | ||
* | ||
* | ||
* @author [email protected] | ||
* @version | ||
* @version | ||
*/ | ||
public class RESTClient { | ||
|
||
private Object content; | ||
|
||
private void updateIndex( | ||
String restUrl, | ||
String action, | ||
|
@@ -45,7 +45,7 @@ private void updateIndex( | |
+ "&indexDocXslt=" + indexDocXslt | ||
+ "&restXslt=copyXml"); | ||
} | ||
|
||
private void browseIndex( | ||
String restUrl, | ||
String startTerm, | ||
|
@@ -66,7 +66,7 @@ private void browseIndex( | |
e.printStackTrace(); | ||
} | ||
} | ||
|
||
private void gfindObjects( | ||
String restUrl, | ||
String query, | ||
|
@@ -93,7 +93,7 @@ private void gfindObjects( | |
e.printStackTrace(); | ||
} | ||
} | ||
|
||
private void getRepositoryInfo( | ||
String restUrl, | ||
String repositoryName, | ||
|
@@ -104,7 +104,7 @@ private void getRepositoryInfo( | |
+ "&restXslt=copyXml" | ||
+ "&resultPageXslt=" + resultPageXslt); | ||
} | ||
|
||
private void getIndexInfo( | ||
String restUrl, | ||
String indexName, | ||
|
@@ -115,7 +115,7 @@ private void getIndexInfo( | |
+ "&restXslt=copyXml" | ||
+ "&resultPageXslt=" + resultPageXslt); | ||
} | ||
|
||
private void configure( | ||
String restUrl, | ||
String configName, | ||
|
@@ -126,13 +126,13 @@ private void configure( | |
+ "&propertyName=" + propertyName | ||
+ "&propertyValue=" + propertyValue); | ||
} | ||
|
||
private void run( | ||
String restUrl, | ||
String queryString) { | ||
doOp(restUrl + queryString); | ||
} | ||
|
||
private void doOp( | ||
String urlString) { | ||
URL url = null; | ||
|
@@ -145,7 +145,7 @@ private void doOp( | |
URLConnection conn = null; | ||
try { | ||
conn = url.openConnection(); | ||
conn.setRequestProperty("Authorization", | ||
conn.setRequestProperty("Authorization", | ||
"Basic "+(new BASE64Encoder()).encode((System.getProperty("fedoragsearch.fgsUserName")+":"+System.getProperty("fedoragsearch.fgsPassword")).getBytes())); | ||
conn.connect(); | ||
} catch (IOException e) { | ||
|
@@ -169,14 +169,13 @@ private void doOp( | |
e1.printStackTrace(); | ||
} | ||
} | ||
|
||
public static void main(String[] args) { | ||
try { | ||
System.out.println("Args"); | ||
int argsLength = 0; | ||
while (args[argsLength].length()>0) { | ||
System.out.println(" "+argsLength+"="+args[argsLength]); | ||
argsLength++; | ||
int argsLength = args.length; | ||
for(int i=0; i<argsLength; i++) { | ||
System.out.println(" "+i+"="+args[i]); | ||
} | ||
if (argsLength<2) usage(); | ||
RESTClient client = new RESTClient(); | ||
|
@@ -229,7 +228,7 @@ public static void main(String[] args) { | |
} | ||
} | ||
String resultPageXslt = ""; | ||
if (argsLength>6) | ||
if (argsLength>6) | ||
resultPageXslt = args[6]; | ||
client.browseIndex(restUrl, startTerm, fieldName, indexName, termPageSize, resultPageXslt); | ||
} | ||
|
@@ -269,10 +268,10 @@ public static void main(String[] args) { | |
} | ||
} | ||
String sortFields = ""; | ||
if (argsLength>8) | ||
if (argsLength>8) | ||
sortFields = args[8]; | ||
String resultPageXslt = ""; | ||
if (argsLength>9) | ||
if (argsLength>9) | ||
resultPageXslt = args[9]; | ||
client.gfindObjects(restUrl, query, indexName, hitPageStart, hitPageSize, snippetsMax, fieldMaxLength, sortFields, resultPageXslt); | ||
} | ||
|
@@ -282,7 +281,7 @@ public static void main(String[] args) { | |
if (argsLength>2) | ||
repositoryName = args[2]; | ||
String resultPageXslt = ""; | ||
if (argsLength>3) | ||
if (argsLength>3) | ||
resultPageXslt = args[3]; | ||
client.getRepositoryInfo(restUrl, repositoryName, resultPageXslt); | ||
} | ||
|
@@ -292,7 +291,7 @@ public static void main(String[] args) { | |
if (argsLength>2) | ||
indexName = args[2]; | ||
String resultPageXslt = ""; | ||
if (argsLength>3) | ||
if (argsLength>3) | ||
resultPageXslt = args[3]; | ||
client.getIndexInfo(restUrl, indexName, resultPageXslt); | ||
} | ||
|
@@ -321,10 +320,10 @@ public static void main(String[] args) { | |
} catch (Exception e) { | ||
System.out.println("Exception in main: " + e.getMessage()); | ||
e.printStackTrace(); | ||
} | ||
} | ||
} | ||
public static void usage() { | ||
|
||
public static void usage() { | ||
System.out.println("Usage"); | ||
System.out.println("host:port updateIndex # shows number of index documents #"); | ||
System.out.println("host:port updateIndex createEmpty [indexName] # index dir must exist #"); | ||
|
@@ -341,5 +340,5 @@ public static void usage() { | |
System.out.println("host:port may be [protocol://]host:port[/webappname/restname], default is http://host:port/fedoragsearch/rest"); | ||
System.exit(1); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
@echo off | ||
|
||
set LIB=..\WEB-INF\lib | ||
set JARS=%LIB%\fedora-3.0-client.jar;%LIB%\log4j-1.2.14.jar;%LIB%\activation-1.0.2.jar;%LIB%\axis.jar;%LIB%\commons-discovery.jar;%LIB%\commons-logging.jar;%LIB%\jaxrpc.jar;%LIB%\mail.jar;%LIB%\saaj.jar;%LIB%\lucene-core-1.9.1.jar;%LIB%\wsdl4j-1.5.1.jar;%LIB%\PDFBox-0.7.2.jar;%LIB%\xml-apis.jar | ||
set JARS=%LIB%\fedora-client-3.1.jar;%LIB%\log4j-1.2.15.jar;%LIB%\activation-1.1.1.jar;%LIB%\axis.jar;%LIB%\commons-discovery.jar;%LIB%\commons-logging.jar;%LIB%\jaxrpc-api-1.1.jar;%LIB%\mail.jar;%LIB%\saaj-api-1.3.jar;%LIB%\lucene-core-2.4.0.jar;%LIB%\wsdl4j-1.5.1.jar;%LIB%\PDFBox-0.7.2.jar;%LIB%\xml-apis.jar | ||
|
||
java -cp ..\WEB-INF\classes;%JARS% dk.defxws.fedoragsearch.client.RESTClient %1 %2 %3 %4 %5 %6 %7 %8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src/java"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> | ||
<classpathentry kind="lib" path="/FedoraGenericSearch/lib/fedora-3.0-client.jar"/> | ||
<classpathentry kind="lib" path="/FedoraGenericSearch/lib/log4j-1.2.14.jar"/> | ||
<classpathentry combineaccessrules="false" kind="src" path="/FedoraGenericSearch"/> | ||
<classpathentry kind="lib" path="/FedoraGenericSearch/lib/lucene-core-2.3.2.jar"/> | ||
<classpathentry kind="lib" path="/FedoraGenericSearch/lib/lucene-highlighter-2.3.2.jar"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src/java"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> | ||
<classpathentry combineaccessrules="false" kind="src" path="/FedoraGenericSearch"/> | ||
<classpathentry kind="lib" path="/FedoraGenericSearch/lib/fedora-client-3.1.jar"/> | ||
<classpathentry kind="lib" path="/FedoraGenericSearch/lib/log4j-1.2.15.jar"/> | ||
<classpathentry kind="lib" path="/FedoraGenericSearch/lib/lucene-core-2.4.0.jar"/> | ||
<classpathentry kind="lib" path="/FedoraGenericSearch/lib/lucene-highlighter-2.4.0.jar"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters