Skip to content

Commit

Permalink
IGNITE-6119: Fixes for style and DSN.
Browse files Browse the repository at this point in the history
  • Loading branch information
isapego committed Sep 6, 2017
1 parent 56860d2 commit 6c9bb89
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ public interface SqlListenerConnectionContext {
SqlListenerProtocolVersion currentVersion();

/**
* Init from handshake message.
* Initialize from handshake message.
*
* @param ver Protocol version.
* @param reader Reader set to the configuration part of the handshake message.
*/
void initFromHandshake(SqlListenerProtocolVersion ver, BinaryReaderExImpl reader);
void initializeFromHandshake(SqlListenerProtocolVersion ver, BinaryReaderExImpl reader);

/**
* Handler getter.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ private void onHandshake(GridNioSession ses, byte[] msg) {
String errMsg = null;

if (connCtx.isVersionSupported(ver)) {
connCtx.initFromHandshake(ver, reader);
connCtx.initializeFromHandshake(ver, reader);

ses.addMeta(CONN_CTX_META_KEY, connCtx);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.ignite.internal.processors.odbc.jdbc;

import java.util.HashSet;
Expand Down Expand Up @@ -46,18 +63,30 @@ public class JdbcConnectionContext implements SqlListenerConnectionContext {
SUPPORTED_VERS.add(VER_2_1_0);
}

@Override
public boolean isVersionSupported(SqlListenerProtocolVersion ver) {
/**
* Constructor.
* @param ctx Kernal Context.
* @param busyLock Shutdown busy lock.
* @param maxCursors Maximum allowed cursors.
*/
public JdbcConnectionContext(GridKernalContext ctx, GridSpinBusyLock busyLock, int maxCursors) {
this.ctx = ctx;
this.busyLock = busyLock;
this.maxCursors = maxCursors;
}

/** {@inheritDoc} */
@Override public boolean isVersionSupported(SqlListenerProtocolVersion ver) {
return SUPPORTED_VERS.contains(ver);
}

@Override
public SqlListenerProtocolVersion currentVersion() {
/** {@inheritDoc} */
@Override public SqlListenerProtocolVersion currentVersion() {
return CURRENT_VER;
}

@Override
public void initFromHandshake(SqlListenerProtocolVersion ver, BinaryReaderExImpl reader) {
/** {@inheritDoc} */
@Override public void initializeFromHandshake(SqlListenerProtocolVersion ver, BinaryReaderExImpl reader) {
assert SUPPORTED_VERS.contains(ver): "Unsupported JDBC protocol version.";

boolean distributedJoins = reader.readBoolean();
Expand All @@ -77,25 +106,13 @@ public void initFromHandshake(SqlListenerProtocolVersion ver, BinaryReaderExImpl
parser = new JdbcMessageParser(ctx);
}

/**
* Constructor.
* @param ctx Kernal Context.
* @param busyLock Shutdown busy lock.
* @param maxCursors Maximum allowed cursors.
*/
public JdbcConnectionContext(GridKernalContext ctx, GridSpinBusyLock busyLock, int maxCursors) {
this.ctx = ctx;
this.busyLock = busyLock;
this.maxCursors = maxCursors;
}

@Override
public SqlListenerRequestHandler handler() {
/** {@inheritDoc} */
@Override public SqlListenerRequestHandler handler() {
return handler;
}

@Override
public SqlListenerMessageParser parser() {
/** {@inheritDoc} */
@Override public SqlListenerMessageParser parser() {
return parser;
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.ignite.internal.processors.odbc.odbc;

import java.util.HashSet;
Expand Down Expand Up @@ -46,18 +63,30 @@ public class OdbcConnectionContext implements SqlListenerConnectionContext {
SUPPORTED_VERS.add(VER_2_1_0);
}

@Override
public boolean isVersionSupported(SqlListenerProtocolVersion ver) {
/**
* Constructor.
* @param ctx Kernal Context.
* @param busyLock Shutdown busy lock.
* @param maxCursors Maximum allowed cursors.
*/
public OdbcConnectionContext(GridKernalContext ctx, GridSpinBusyLock busyLock, int maxCursors) {
this.ctx = ctx;
this.busyLock = busyLock;
this.maxCursors = maxCursors;
}

/** {@inheritDoc} */
@Override public boolean isVersionSupported(SqlListenerProtocolVersion ver) {
return SUPPORTED_VERS.contains(ver);
}

@Override
public SqlListenerProtocolVersion currentVersion() {
/** {@inheritDoc} */
@Override public SqlListenerProtocolVersion currentVersion() {
return CURRENT_VER;
}

@Override
public void initFromHandshake(SqlListenerProtocolVersion ver, BinaryReaderExImpl reader) {
/** {@inheritDoc} */
@Override public void initializeFromHandshake(SqlListenerProtocolVersion ver, BinaryReaderExImpl reader) {
assert SUPPORTED_VERS.contains(ver): "Unsupported ODBC protocol version.";

boolean distributedJoins = reader.readBoolean();
Expand All @@ -75,25 +104,13 @@ public void initFromHandshake(SqlListenerProtocolVersion ver, BinaryReaderExImpl
parser = new OdbcMessageParser(ctx);
}

/**
* Constructor.
* @param ctx Kernal Context.
* @param busyLock Shutdown busy lock.
* @param maxCursors Maximum allowed cursors.
*/
public OdbcConnectionContext(GridKernalContext ctx, GridSpinBusyLock busyLock, int maxCursors) {
this.ctx = ctx;
this.busyLock = busyLock;
this.maxCursors = maxCursors;
}

@Override
public SqlListenerRequestHandler handler() {
/** {@inheritDoc} */
@Override public SqlListenerRequestHandler handler() {
return handler;
}

@Override
public SqlListenerMessageParser parser() {
/** {@inheritDoc} */
@Override public SqlListenerMessageParser parser() {
return parser;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ public class OdbcRequestHandler implements SqlListenerRequestHandler {
* @param lazy Lazy flag.
*/
public OdbcRequestHandler(GridKernalContext ctx, GridSpinBusyLock busyLock, int maxCursors,
boolean distributedJoins, boolean enforceJoinOrder, boolean replicatedOnly,
boolean collocated, boolean lazy) {
boolean distributedJoins, boolean enforceJoinOrder, boolean replicatedOnly,
boolean collocated, boolean lazy) {
this.ctx = ctx;
this.busyLock = busyLock;
this.maxCursors = maxCursors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,13 @@ namespace ignite
break;
}

case ChildId::LAZY_CHECK_BOX:
{
lazyCheckBox->SetChecked(!lazyCheckBox->IsChecked());

break;
}

case ChildId::PROTOCOL_VERSION_COMBO_BOX:
{
std::string versionStr;
Expand Down

0 comments on commit 6c9bb89

Please sign in to comment.