use of com.teradata.jaqy.VariableManager in project jaqy by Teradata.
the class ExpNodePredicate method bind.
@Override
public void bind(JaqyResultSet rs, JaqyInterpreter interpreter) throws Exception {
m_vm = new VariableManager(interpreter.getVariableManager());
m_vm.setVariable(RS_VAR, rs);
m_exp.bind(rs, m_vm, interpreter);
}
use of com.teradata.jaqy.VariableManager in project jaqy by Teradata.
the class ExpNodeProject method bind.
@Override
public void bind(JaqyResultSet rs, JaqyInterpreter interpreter) throws Exception {
m_vm = new VariableManager(interpreter.getVariableManager());
m_vm.setVariable(ExpNodePredicate.RS_VAR, rs);
for (ExpNode exp : m_expList) exp.bind(rs, m_vm, interpreter);
}
use of com.teradata.jaqy.VariableManager in project jaqy by Teradata.
the class ClientRSUtils method setSortNull.
public static void setSortNull(JaqyInterpreter interpreter, boolean nullSort) {
VariableManager vm = interpreter.getVariableManager();
vm.setVariable(NULLSORT_VAR, Boolean.valueOf(nullSort));
}
use of com.teradata.jaqy.VariableManager in project jaqy by Teradata.
the class S3Utils method getS3Client.
public static AmazonS3 getS3Client(JaqyInterpreter interpreter) {
VariableManager vm = interpreter.getVariableManager();
Variable clientVar = vm.getVariable(S3CLIENT_VAR);
if (clientVar != null) {
Object o = clientVar.get();
if (o instanceof AmazonS3)
return (AmazonS3) o;
}
// now we need to setup a new client.
AmazonS3ClientBuilder builder = getS3Builder(interpreter);
// check if we need to set up the access / secret key
String access = null;
String secret = null;
{
Variable var = vm.getVariable(S3ACCESS_VAR);
if (var != null) {
Object o = var.get();
if (o != null)
access = o.toString();
}
}
{
Variable var = vm.getVariable(S3SECRET_VAR);
if (var != null) {
Object o = var.get();
if (o != null)
secret = o.toString();
}
}
if (access != null && secret != null) {
/*
* When both access and secret are null, we are using the default
* values (i.e. from credential file or env variables etc).
*
* When both are set, then we override the default settings (and
* subsequent uses).
*/
if (access.length() == 0 && secret.length() == 0) {
/*
* This is for accessing publicly accessible buckets.
*/
builder.withCredentials(new AWSStaticCredentialsProvider(new AnonymousAWSCredentials()));
} else {
builder.withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(access, secret)));
}
}
AmazonS3 client = builder.build();
// now save the client to s3client variable
if (clientVar == null) {
clientVar = new Variable() {
private AmazonS3 m_client;
@Override
public Object get() {
return m_client;
}
@Override
public boolean set(Object value) {
if (value != null && !(value instanceof AmazonS3))
return false;
m_client = (AmazonS3) value;
return true;
}
@Override
public String getName() {
return S3CLIENT_VAR;
}
};
}
clientVar.set(client);
vm.setVariable(clientVar);
return client;
}
Aggregations