-
Notifications
You must be signed in to change notification settings - Fork 0
/
tCouchbaseOutput_begin.javajet
40 lines (34 loc) · 1.41 KB
/
tCouchbaseOutput_begin.javajet
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
<%@ jet imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.core.model.metadata.IMetadataTable
org.talend.core.model.metadata.IMetadataColumn
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.metadata.types.JavaTypesManager
org.talend.core.model.metadata.types.JavaType"
%>
<%
final int BATCH = 1000;
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
String connection = ElementParameterParser.getValue(node, "__CONNECTION__");
int batch;
try {
batch = Integer.parseInt(ElementParameterParser.getValue(node, "__BATCH__"));
} catch (NumberFormatException e) {
System.err.println("unable to parse batch size: use default value = " + BATCH);
batch = BATCH;
}
%>
int batch_<%=cid %> = <%=batch%>;
int numError_<%=cid %> = 0;
int numSuccess_<%=cid %> = 0;
int expiration_<%=cid %> = 3600;
int nb_line_<%=cid%> = 0;
com.couchbase.client.CouchbaseClient couchbaseClient_<%=cid%>
= (com.couchbase.client.CouchbaseClient) globalMap.get("couchbase_<%=connection %>");
java.util.ArrayList<net.spy.memcached.internal.OperationFuture<Boolean>> results_<%=cid %>
= new java.util.ArrayList<net.spy.memcached.internal.OperationFuture<Boolean>>(batch_<%=cid %>);