use of com.google.cloud.bigquery.connection.v1.Connection in project osate2 by osate.
the class ComponentImplementationImpl method getAllConnections.
/**
* Get list of all connections of a component implementation in a given mode, including ancestor
* implementations. In case of refined connections the refined connection is returned in the list.
*
* @param mode Mode for which connections are to be retrieved.
* @return List of connections
*/
public EList<Connection> getAllConnections(Mode mode) {
final EList<Classifier> ancestors = getSelfPlusAllExtended();
final BasicEList<Connection> returnlist = new BasicEList<Connection>();
// Process from farthest ancestor to self
for (ListIterator<Classifier> li = ancestors.listIterator(ancestors.size()); li.hasPrevious(); ) {
final ComponentImplementation current = (ComponentImplementation) li.previous();
final EList<Connection> currentItems = current.getOwnedConnections(mode);
for (final Connection fe : currentItems) {
final Connection rfe = fe.getRefined();
if (rfe != null) {
returnlist.remove(rfe);
}
returnlist.add(fe);
}
}
return returnlist;
}
use of com.google.cloud.bigquery.connection.v1.Connection in project osate2 by osate.
the class ConnectionImpl method setRefined.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setRefined(Connection newRefined) {
Connection oldRefined = refined;
refined = newRefined;
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET, Aadl2Package.CONNECTION__REFINED, oldRefined, refined));
}
}
use of com.google.cloud.bigquery.connection.v1.Connection in project osate2 by osate.
the class ConnectionImpl method getPropertyValueInternal.
public final void getPropertyValueInternal(final Property pn, final PropertyAcc pas, final boolean fromInstanceSlaveCall, final boolean all) throws InvalidModelException {
final ComponentImplementation partOf = (ComponentImplementation) getContainingClassifier();
// First look in the container's contained property associations
if (!fromInstanceSlaveCall && pas.addLocalContained(this, partOf)) {
if (!all) {
return;
}
}
/*
* Next see if the property is defined in connection's properties
* subclause (could merge this with the loop below, but I want to make
* the steps more explicit.)
*/
if (pas.addLocal(this)) {
if (!all) {
return;
}
}
// Next find the value by walking up the connection's refinement
// sequence
Connection refined = getRefined();
while (refined != null) {
if (!fromInstanceSlaveCall && pas.addLocalContained(refined, refined.getContainingClassifier())) {
if (!all) {
return;
}
}
if (pas.addLocal(refined)) {
if (!all) {
return;
}
}
refined = refined.getRefined();
}
/*
* if still not set, and the property is "inherit", try the containing
* component implementation.
*/
if (!fromInstanceSlaveCall && pn.isInherit()) {
partOf.getPropertyValueInternal(pn, pas, fromInstanceSlaveCall, all);
}
}
use of com.google.cloud.bigquery.connection.v1.Connection in project hydrator-plugins by cdapio.
the class SSHAction method run.
@Override
public void run(final ActionContext context) throws Exception {
// Now that macros have been substituted, try validation again
FailureCollector collector = context.getFailureCollector();
config.validate(collector);
collector.getOrThrowException();
Connection connection = new Connection(config.host, config.port);
try {
connection.connect();
if (!connection.authenticateWithPublicKey(config.user, config.privateKey.toCharArray(), config.passphrase)) {
throw new IOException(String.format("SSH authentication error when connecting to %s@%s on port %d", config.user, config.host, config.port));
}
LOG.debug("Connection established with the host {}", config.host);
Session session = connection.openSession();
session.execCommand(config.command);
InputStream stdout = new StreamGobbler(session.getStdout());
BufferedReader outBuffer = new BufferedReader(new InputStreamReader(stdout, Charsets.UTF_8));
InputStream stderr = new StreamGobbler(session.getStderr());
BufferedReader errBuffer = new BufferedReader(new InputStreamReader(stderr, Charsets.UTF_8));
String out = CharStreams.toString(outBuffer);
String err = CharStreams.toString(errBuffer);
if (out.length() > 0) {
LOG.debug("Stdout: {}", out);
}
if (err.length() > 0) {
LOG.error("Stderr: {}", err);
}
Integer exitCode = session.getExitStatus();
if (exitCode != null && exitCode != 0) {
throw new IOException(String.format("Error: command %s running on hostname %s finished with exit code: %d", config.command, config.host, exitCode));
}
// Removes the carriage return at the end of the line
out = out.endsWith("\n") ? out.substring(0, out.length() - 1) : out;
context.getArguments().set(config.outputKey, out);
} finally {
connection.close();
}
}
use of com.google.cloud.bigquery.connection.v1.Connection in project study-by-myself by Howinfun.
the class HttpLoggingInterceptor method printRequestStart.
private void printRequestStart(Chain chain, Request request, boolean logHeaders, RequestBody requestBody, boolean hasRequestBody) throws IOException {
Connection connection = chain.connection();
String requestStartMessage = "--> " + request.method() + ' ' + request.url() + (connection != null ? " " + connection.protocol() : "");
if (!logHeaders && hasRequestBody) {
requestStartMessage += " (" + requestBody.contentLength() + "-byte body)";
}
logger.log(requestStartMessage);
}
Aggregations