-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTransferAutomation.java
executable file
·78 lines (56 loc) · 2.77 KB
/
TransferAutomation.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import java.io.*;
import oracle.stellent.ridc.*;
import oracle.stellent.ridc.model.*;
import oracle.stellent.ridc.protocol.*;
import oracle.stellent.ridc.protocol.intradoc.*;
import oracle.stellent.ridc.common.log.*;
import oracle.stellent.ridc.model.serialize.*;
import java.util.Properties;
/*
* @author Sterin- Oracle Inc
*
* This is a class used to test the basic functionality
* of submitting a search to Content Server using RIDC.
* The response is then used to retrieve metadata about
* the content items.
*/
public class TransferAutomation {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
IdcClientManager manager = new IdcClientManager ();
Properties prop = new Properties();
InputStream input = null;
try{
input = new FileInputStream("config.properties");
// load a properties file
prop.load(input);
// Create a new IdcClient Connection using idc protocol (i.e. socket connection to Content Server)
IdcClient idcClient = manager.createClient (prop.getProperty("url"));
IdcContext userContext = new IdcContext (prop.getProperty("user"),prop.getProperty("password"));
// Create an HdaBinderSerializer; this is not necessary, but it allows us to serialize the request and response data binders
HdaBinderSerializer serializer = new HdaBinderSerializer ("UTF-8", idcClient.getDataFactory ());
// Create a new binder for submitting a search
DataBinder dataBinder = idcClient.createBinder();
dataBinder.putLocal("IdcService", "TRANSFER_ARCHIVE");
dataBinder.putLocal("IDC_Name",prop.getProperty("IDC_Name"));
dataBinder.putLocal("aArchiveName",prop.getProperty("aArchiveName"));
dataBinder.putLocal("aTargetArchive",prop.getProperty("aTargetArchive"));
// Write the data binder for the request to stdout
serializer.serializeBinder (System.out, dataBinder);
// Send the request to Content Server
ServiceResponse response = idcClient.sendRequest(userContext,dataBinder);
// Get the data binder for the response from Content Server
DataBinder responseData = response.getResponseAsBinder();
// Write the response data binder to stdout
serializer.serializeBinder (System.out, responseData);
// Retrieve the SearchResults ResultSet from the response
} catch (IdcClientException ice){
ice.printStackTrace();
} catch (IOException ioe){
ioe.printStackTrace();
}
}
}