From fac40af2af758b7d6d01d4b1294f2449ae131dc8 Mon Sep 17 00:00:00 2001 From: Manuri Date: Sat, 24 Nov 2018 16:40:18 +0530 Subject: [PATCH 1/7] Adjust Cassandra client with endpoint changes --- .../src/main/ballerina/cassandra/actions.bal | 72 ------ .../src/main/ballerina/cassandra/endpoint.bal | 206 ++-------------- .../src/main/ballerina/cassandra/types.bal | 226 ++++++++++++++++++ .../cassandra/CassandraDataIterator.java | 5 +- .../cassandra/CassandraDataSource.java | 6 +- .../cassandra/CassandraDataSourceUtils.java | 26 +- .../ballerinalang/cassandra/Constants.java | 5 +- .../cassandra/actions/Close.java | 4 +- .../cassandra/actions/Select.java | 4 +- .../cassandra/actions/Update.java | 4 +- ...raClient.java => InitCassandraClient.java} | 11 +- pom.xml | 2 +- 12 files changed, 283 insertions(+), 288 deletions(-) delete mode 100644 component/src/main/ballerina/cassandra/actions.bal create mode 100644 component/src/main/ballerina/cassandra/types.bal rename component/src/main/java/org/ballerinalang/cassandra/endpoint/{CreateCassandraClient.java => InitCassandraClient.java} (86%) diff --git a/component/src/main/ballerina/cassandra/actions.bal b/component/src/main/ballerina/cassandra/actions.bal deleted file mode 100644 index b076507..0000000 --- a/component/src/main/ballerina/cassandra/actions.bal +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) 2018 WSO2 Inc. (http://www.wso2.org) All Rights Reserved. -// -// WSO2 Inc. 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. - -# The Datatype of the parameter. -public type Type "INT"|"BIGINT"|"VARINT"|"FLOAT"|"DOUBLE"|"TEXT"|"BOOLEAN"|"LIST"; - -# A 32-bit signed integer. -@final public Type TYPE_INT = "INT"; - -# A 64-bit signed long. -@final public Type TYPE_BIGINT = "BIGINT"; - -# Arbitrary precision integer. -@final public Type TYPE_VARINT = "VARINT"; - -# A 32-bit IEEE-754 floating point. -@final public Type TYPE_FLOAT = "FLOAT"; - -# A 64-bit IEEE-754 floating point. -@final public Type TYPE_DOUBLE = "DOUBLE"; - -# UTF-8 encoded string. -@final public Type TYPE_TEXT = "TEXT"; - -# Boolean value either True or false. -@final public Type TYPE_BOOLEAN = "BOOLEAN"; - -# A collection of one or more ordered elements. -@final public Type TYPE_LIST = "LIST"; - -# Represents complex parameter passed to `select` or `update` operation. - -# + cqlType - Cassandra type of the parameter -# + value - Value of the parameter -public type Parameter record { - Type cqlType; - any value; -}; - -# The union type representing either a `Parameter` or a primitive ballerina type. -public type Param string|int|boolean|float|Parameter; - -# The Caller Actions for Cassandra databases. -public type CallerActions object { - # Select data from cassandra datasource. - - # + queryString - Query to be executed - # + recordType - The Type result should be mapped to - # + return - `table` representing the result of the select action or `error` if an error occurs - public extern function select(string queryString, typedesc recordType, Param... parameters) - returns (table|error); - - # Execute update query on cassandra datasource. - - # + queryString - Query to be executed - # + return - `nil` or `error` if an error occurs - public extern function update(string queryString, Param... parameters) returns (error?); - -}; diff --git a/component/src/main/ballerina/cassandra/endpoint.bal b/component/src/main/ballerina/cassandra/endpoint.bal index fd56364..ed639ef 100644 --- a/component/src/main/ballerina/cassandra/endpoint.bal +++ b/component/src/main/ballerina/cassandra/endpoint.bal @@ -15,198 +15,38 @@ // under the License. # Represents Cassandra client endpoint. -public type Client object { - public ClientEndpointConfiguration clientEndpointConfig; - public CallerActions callerActions; +public type Client client object { + private ClientEndpointConfig clientEndpointConfig; - # Gets called when the endpoint is being initialized during the module initialization. - public function init(ClientEndpointConfiguration config) { - self.callerActions = createClient(config); + # Gets called when the Client is instantiated. + public function __init(ClientEndpointConfig config) { + self.clientEndpointConfig = config; + initClient(self, config); } - # Returns the connector that client code uses. - # - # + return - The connector that client code uses - public function getCallerActions() returns CallerActions { - return self.callerActions; - } + # Select data from cassandra datasource. + + # + queryString - Query to be executed + # + recordType - The Type result should be mapped to + # + return - `table` representing the result of the select action or `error` if an error occurs + public remote extern function select(string queryString, typedesc recordType, Param... parameters) + returns (table|error); + + # Execute update query on cassandra datasource. + + # + queryString - Query to be executed + # + return - `nil` or `error` if an error occurs + public remote extern function update(string queryString, Param... parameters) returns (error?); # Stops the registered service. public function stop() { - close(self.callerActions); + close(self); } }; # An internal function used by clients to shutdown the connection pool. # -# + callerActions - CallerActions object that encapsulates the connection/connection pool -public extern function close(CallerActions callerActions); - -extern function createClient(ClientEndpointConfiguration clientEndpointConfig) returns CallerActions; - -# The Client endpoint configuration for SQL databases. -# -# + host - The host of the database to connect -# + port - The port of the database to connect -# + username - Username for the database connection -# + password - Password for the database connection -# + options - Properties for the connection configuration -public type ClientEndpointConfiguration record { - string host; - int port; - string username; - string password; - ConnectionProperties options; -}; - -# ConnectionProperties type represents the properties which are used to configure Cassandra connection. -# -# + clusterName - The name of the cluster object -# + loadBalancingPolicy - The policy that decides which Cassandra hosts to contact for each new query -# + reconnectionPolicy - The policy that schedules reconnection attempts to a node -# + retryPolicy - The policy that defines a default behavior to adopt when a request fails -# + dataCenter - The data center used with DCAwareRoundRobinPolicy -# + withoutMetrics - Disables metrics collection for the created cluster if true -# + withoutJMXReporting - Disables JMX reporting of the metrics if true -# + allowRemoteDCsForLocalConsistencyLevel - Determine whether to allow DCAwareRoundRobinPolicy to return remote -# hosts when building query plans for queries having consistency level LOCAL_ONE or LOCAL_QUORUM -# + constantReconnectionPolicyDelay - The constant wait time between reconnection attempts of -# ConstantReconnectionPolicy -# + exponentialReconnectionPolicyBaseDelay - The base delay in milliseconds for ExponentialReconnectionPolicy -# The maximum delay in milliseconds between reconnection attempts of ExponentialReconnectionPolicy -# + queryOptionsConfig - Options related to defaults for individual queries -# + poolingOptionsConfig - Options related to connection pooling -# + socketOptionsConfig - Options to configure low-level socket options for the connections kept to the Cassandra -# hosts -# + protocolOptionsConfig - Options of the Cassandra native binary protocol -public type ConnectionProperties record { - string clusterName; - string loadBalancingPolicy; - string reconnectionPolicy; - string retryPolicy; - string dataCenter; - - boolean withoutMetrics; - boolean withoutJMXReporting; - boolean allowRemoteDCsForLocalConsistencyLevel; - - int constantReconnectionPolicyDelay = -1; - int exponentialReconnectionPolicyBaseDelay = -1; - int exponentialReconnectionPolicyMaxDelay = -1; - - QueryOptionsConfiguration queryOptionsConfig; - PoolingOptionsConfiguration poolingOptionsConfig; - SocketOptionsConfiguration socketOptionsConfig; - ProtocolOptionsConfiguration protocolOptionsConfig; -}; - -# Options of the Cassandra native binary protocol. -# -# + sslEnabled - Enables the use of SSL for the created cluster -# + noCompact - Whether or not to include the NO_COMPACT startup option -# + maxSchemaAgreementWaitSeconds - The maximum time to wait for schema agreement before returning from a DDL query -# + initialProtocolVersion - Version of the native protocol supported by the driver -# + compression - Compression supported by the Cassandra binary protocol -public type ProtocolOptionsConfiguration record { - boolean sslEnabled; - boolean noCompact; - - int maxSchemaAgreementWaitSeconds = -1; - - string initialProtocolVersion; - string compression; -}; - -# Options related to defaults for individual queries. -# -# + consistencyLevel - Determines how many nodes in the replica must respond for the coordinator node to -# successfully process a non-lightweight transaction. Supported values are ANY, ONE, TWO, THREE, QUORUM, -# ALL, LOCAL_QUORUM, EACH_QUORUM, SERIAL, LOCAL_SERIAL, LOCAL_ONE -# + serialConsistencyLevel - The serial consistency level is only used by conditional updates -# (INSERT, UPDATE or DELETE statements with an IF condition). For those, the serial consistency level -# defines the consistency level of the serial phase (or 'paxos' phase) while the normal consistency level -# defines the consistency for the 'learn' phase. Supported values are SERIAL, LOCAL_SERIAL -# + defaultIdempotence - A statement is idempotent if it can be applied multiple times without changing the -# result beyond the initial application -# + metadataEnabled - Toggles client-side token and schema metadata -# enablement -# + reprepareOnUp - Determines whether the driver should re-prepare all cached prepared statements on a host -# when it marks it back up -# + prepareOnAllHosts - Determines whether the driver should prepare statements on all hosts in the cluster -# + fetchSize - Sets the default fetch size to use for SELECT queries -# + maxPendingRefreshNodeListRequests - Determines the maximum number of node list refresh requests that -# the control connection can accumulate before executing them -# + maxPendingRefreshNodeRequests - Determines the maximum number of node refresh requests that the control -# connection can accumulate before executing them -# + maxPendingRefreshSchemaRequests - Determines the maximum number of schema refresh requests that the -# control connection can accumulate before executing them -# + refreshNodeListIntervalMillis - Determines the default window size in milliseconds used to debounce node -# list refresh requests -# + refreshNodeIntervalMillis - Determines the default window size in milliseconds used to debounce node -# refresh requests -# + refreshSchemaIntervalMillis - Determines the default window size in milliseconds used to debounce schema refresh -# requests -public type QueryOptionsConfiguration record { - string consistencyLevel; - string serialConsistencyLevel; - - boolean defaultIdempotence; - boolean metadataEnabled = true; - boolean reprepareOnUp = true; - boolean prepareOnAllHosts = true; - - int fetchSize = -1; - int maxPendingRefreshNodeListRequests = -1; - int maxPendingRefreshNodeRequests = -1; - int maxPendingRefreshSchemaRequests = -1; - int refreshNodeListIntervalMillis = -1; - int refreshNodeIntervalMillis = -1; - int refreshSchemaIntervalMillis = -1; -}; - - -# Options related to connection pooling. -# -# + maxRequestsPerConnectionLocal - The maximum number of requests per connection for local hosts -# + maxRequestsPerConnectionRemote - The maximum number of requests per connection for remote hosts -# + idleTimeoutSeconds - The timeout before an idle connection is removed -# + poolTimeoutMillis - The timeout when trying to acquire a connection from a host's pool -# + maxQueueSize - The maximum number of requests that get enqueued if no connection is available -# + heartbeatIntervalSeconds - The heart beat interval, after which a message is sent on an idle connection -# to make sure it's still alive -# + coreConnectionsPerHostLocal - The core number of connections per local host -# + maxConnectionsPerHostLocal - The maximum number of connections per local host -# + newConnectionThresholdLocal - The threshold that triggers the creation of a new connection to a local host -# + coreConnectionsPerHostRemote - The core number of connections per remote host -# + maxConnectionsPerHostRemote - The maximum number of connections per remote host -# + newConnectionThresholdRemote - The threshold that triggers the creation of a new connection to a remote host -public type PoolingOptionsConfiguration record { - int maxRequestsPerConnectionLocal = -1; - int maxRequestsPerConnectionRemote = -1; - int idleTimeoutSeconds = -1; - int poolTimeoutMillis = -1; - int maxQueueSize = -1; - int heartbeatIntervalSeconds = -1; - int coreConnectionsPerHostLocal = -1; - int maxConnectionsPerHostLocal = -1; - int newConnectionThresholdLocal = -1; - int coreConnectionsPerHostRemote = -1; - int maxConnectionsPerHostRemote = -1; - int newConnectionThresholdRemote = -1; -}; - -# Options to configure low-level socket options for the connections kept to the Cassandra hosts. -# -# + connectTimeoutMillis - The connection timeout in milliseconds -# + readTimeoutMillis - The per-host read timeout in milliseconds -# + soLinger - The linger-on-close timeout -# + receiveBufferSize - A hint to the size of the underlying buffers for incoming network I/O -# + sendBufferSize - A hint to the size of the underlying buffers for outgoing network I/O -public type SocketOptionsConfiguration record { - int connectTimeoutMillis = -1; - int readTimeoutMillis = -1; - int soLinger = -1; - int receiveBufferSize = -1; - int sendBufferSize = -1; -}; +# + cassandraClient - Client object that encapsulates the connection/connection pool +extern function close(Client cassandraClient); +extern function initClient(Client cassandraClient, ClientEndpointConfig clientEndpointConfig); diff --git a/component/src/main/ballerina/cassandra/types.bal b/component/src/main/ballerina/cassandra/types.bal new file mode 100644 index 0000000..a9f5b75 --- /dev/null +++ b/component/src/main/ballerina/cassandra/types.bal @@ -0,0 +1,226 @@ +// Copyright (c) 2018 WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +// +// WSO2 Inc. 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. + +# The Datatype of the parameter. +public type Type "INT"|"BIGINT"|"VARINT"|"FLOAT"|"DOUBLE"|"TEXT"|"BOOLEAN"|"LIST"; + +# A 32-bit signed integer. +public final Type TYPE_INT = "INT"; + +# A 64-bit signed long. +public final Type TYPE_BIGINT = "BIGINT"; + +# Arbitrary precision integer. +public final Type TYPE_VARINT = "VARINT"; + +# A 32-bit IEEE-754 floating point. +public final Type TYPE_FLOAT = "FLOAT"; + +# A 64-bit IEEE-754 floating point. +public final Type TYPE_DOUBLE = "DOUBLE"; + +# UTF-8 encoded string. +public final Type TYPE_TEXT = "TEXT"; + +# Boolean value either True or false. +public final Type TYPE_BOOLEAN = "BOOLEAN"; + +# A collection of one or more ordered elements. +public final Type TYPE_LIST = "LIST"; + +# Represents complex parameter passed to `select` or `update` operation. + +# + cqlType - Cassandra type of the parameter +# + value - Value of the parameter +public type Parameter record { + Type cqlType; + any value; +}; + +# The union type representing either a `Parameter` or a primitive ballerina type. +public type Param string|int|boolean|float|Parameter; + +# The Client endpoint configuration for Cassandra database. +# +# + host - The host of the database to connect +# + port - The port of the database to connect +# + username - Username for the database connection +# + password - Password for the database connection +# + options - Properties for the connection configuration +public type ClientEndpointConfig record { + string host = ""; + int port = 0; + string username = ""; + string password = ""; + ConnectionProperties options = {}; + !... +}; + +# ConnectionProperties type represents the properties which are used to configure Cassandra connection. +# +# + clusterName - The name of the cluster object +# + loadBalancingPolicy - The policy that decides which Cassandra hosts to contact for each new query +# + reconnectionPolicy - The policy that schedules reconnection attempts to a node +# + retryPolicy - The policy that defines a default behavior to adopt when a request fails +# + dataCenter - The data center used with DCAwareRoundRobinPolicy +# + withoutMetrics - Disables metrics collection for the created cluster if true +# + withoutJMXReporting - Disables JMX reporting of the metrics if true +# + allowRemoteDCsForLocalConsistencyLevel - Determine whether to allow DCAwareRoundRobinPolicy to return remote +# hosts when building query plans for queries having consistency level LOCAL_ONE or LOCAL_QUORUM +# + constantReconnectionPolicyDelay - The constant wait time between reconnection attempts of +# ConstantReconnectionPolicy +# + exponentialReconnectionPolicyBaseDelay - The base delay in milliseconds for ExponentialReconnectionPolicy +# The maximum delay in milliseconds between reconnection attempts of ExponentialReconnectionPolicy +# + queryOptionsConfig - Options related to defaults for individual queries +# + poolingOptionsConfig - Options related to connection pooling +# + socketOptionsConfig - Options to configure low-level socket options for the connections kept to the Cassandra +# hosts +# + protocolOptionsConfig - Options of the Cassandra native binary protocol +public type ConnectionProperties record { + string clusterName = ""; + string loadBalancingPolicy = ""; + string reconnectionPolicy = ""; + string retryPolicy = ""; + string dataCenter = ""; + + boolean withoutMetrics = false; + boolean withoutJMXReporting = false; + boolean allowRemoteDCsForLocalConsistencyLevel = false; + + int constantReconnectionPolicyDelay = -1; + int exponentialReconnectionPolicyBaseDelay = -1; + int exponentialReconnectionPolicyMaxDelay = -1; + + QueryOptionsConfig queryOptionsConfig = {}; + PoolingOptionsConfig poolingOptionsConfig = {}; + SocketOptionsConfig socketOptionsConfig = {}; + ProtocolOptionsConfig protocolOptionsConfig = {}; +}; + +# Options of the Cassandra native binary protocol. +# +# + sslEnabled - Enables the use of SSL for the created cluster +# + noCompact - Whether or not to include the NO_COMPACT startup option +# + maxSchemaAgreementWaitSeconds - The maximum time to wait for schema agreement before returning from a DDL query +# + initialProtocolVersion - Version of the native protocol supported by the driver +# + compression - Compression supported by the Cassandra binary protocol +public type ProtocolOptionsConfig record { + boolean sslEnabled = false; + boolean noCompact = false; + + int maxSchemaAgreementWaitSeconds = -1; + + string initialProtocolVersion = ""; + string compression = ""; +}; + +# Options related to defaults for individual queries. +# +# + consistencyLevel - Determines how many nodes in the replica must respond for the coordinator node to +# successfully process a non-lightweight transaction. Supported values are ANY, ONE, TWO, THREE, QUORUM, +# ALL, LOCAL_QUORUM, EACH_QUORUM, SERIAL, LOCAL_SERIAL, LOCAL_ONE +# + serialConsistencyLevel - The serial consistency level is only used by conditional updates +# (INSERT, UPDATE or DELETE statements with an IF condition). For those, the serial consistency level +# defines the consistency level of the serial phase (or 'paxos' phase) while the normal consistency level +# defines the consistency for the 'learn' phase. Supported values are SERIAL, LOCAL_SERIAL +# + defaultIdempotence - A statement is idempotent if it can be applied multiple times without changing the +# result beyond the initial application +# + metadataEnabled - Toggles client-side token and schema metadata +# enablement +# + reprepareOnUp - Determines whether the driver should re-prepare all cached prepared statements on a host +# when it marks it back up +# + prepareOnAllHosts - Determines whether the driver should prepare statements on all hosts in the cluster +# + fetchSize - Sets the default fetch size to use for SELECT queries +# + maxPendingRefreshNodeListRequests - Determines the maximum number of node list refresh requests that +# the control connection can accumulate before executing them +# + maxPendingRefreshNodeRequests - Determines the maximum number of node refresh requests that the control +# connection can accumulate before executing them +# + maxPendingRefreshSchemaRequests - Determines the maximum number of schema refresh requests that the +# control connection can accumulate before executing them +# + refreshNodeListIntervalMillis - Determines the default window size in milliseconds used to debounce node +# list refresh requests +# + refreshNodeIntervalMillis - Determines the default window size in milliseconds used to debounce node +# refresh requests +# + refreshSchemaIntervalMillis - Determines the default window size in milliseconds used to debounce schema refresh +# requests +public type QueryOptionsConfig record { + string consistencyLevel = ""; + string serialConsistencyLevel = ""; + + boolean defaultIdempotence = false; + boolean metadataEnabled = true; + boolean reprepareOnUp = true; + boolean prepareOnAllHosts = true; + + int fetchSize = -1; + int maxPendingRefreshNodeListRequests = -1; + int maxPendingRefreshNodeRequests = -1; + int maxPendingRefreshSchemaRequests = -1; + int refreshNodeListIntervalMillis = -1; + int refreshNodeIntervalMillis = -1; + int refreshSchemaIntervalMillis = -1; +}; + + +# Options related to connection pooling. +# +# + maxRequestsPerConnectionLocal - The maximum number of requests per connection for local hosts +# + maxRequestsPerConnectionRemote - The maximum number of requests per connection for remote hosts +# + idleTimeoutSeconds - The timeout before an idle connection is removed +# + poolTimeoutMillis - The timeout when trying to acquire a connection from a host's pool +# + maxQueueSize - The maximum number of requests that get enqueued if no connection is available +# + heartbeatIntervalSeconds - The heart beat interval, after which a message is sent on an idle connection +# to make sure it's still alive +# + coreConnectionsPerHostLocal - The core number of connections per local host +# + maxConnectionsPerHostLocal - The maximum number of connections per local host +# + newConnectionThresholdLocal - The threshold that triggers the creation of a new connection to a local host +# + coreConnectionsPerHostRemote - The core number of connections per remote host +# + maxConnectionsPerHostRemote - The maximum number of connections per remote host +# + newConnectionThresholdRemote - The threshold that triggers the creation of a new connection to a remote host +public type PoolingOptionsConfig record { + int maxRequestsPerConnectionLocal = -1; + int maxRequestsPerConnectionRemote = -1; + int idleTimeoutSeconds = -1; + int poolTimeoutMillis = -1; + int maxQueueSize = -1; + int heartbeatIntervalSeconds = -1; + int coreConnectionsPerHostLocal = -1; + int maxConnectionsPerHostLocal = -1; + int newConnectionThresholdLocal = -1; + int coreConnectionsPerHostRemote = -1; + int maxConnectionsPerHostRemote = -1; + int newConnectionThresholdRemote = -1; +}; + +# Options to configure low-level socket options for the connections kept to the Cassandra hosts. +# +# + connectTimeoutMillis - The connection timeout in milliseconds +# + readTimeoutMillis - The per-host read timeout in milliseconds +# + soLinger - The linger-on-close timeout +# + receiveBufferSize - A hint to the size of the underlying buffers for incoming network I/O +# + sendBufferSize - A hint to the size of the underlying buffers for outgoing network I/O +public type SocketOptionsConfig record { + int connectTimeoutMillis = -1; + int readTimeoutMillis = -1; + int soLinger = -1; + int receiveBufferSize = -1; + int sendBufferSize = -1; +}; + +public type DatabaseErrorData record { + string message; + !... +}; diff --git a/component/src/main/java/org/ballerinalang/cassandra/CassandraDataIterator.java b/component/src/main/java/org/ballerinalang/cassandra/CassandraDataIterator.java index fe48ec5..087d2f2 100644 --- a/component/src/main/java/org/ballerinalang/cassandra/CassandraDataIterator.java +++ b/component/src/main/java/org/ballerinalang/cassandra/CassandraDataIterator.java @@ -38,6 +38,7 @@ import java.util.Base64; import java.util.Iterator; import java.util.List; +import java.util.Map; /** * This iterator wraps a cassandra data row. @@ -125,12 +126,12 @@ public Object[] getArray(int columnIndex) { @Override public BMap generateNext() { BMap bStruct = new BMap<>(bStructType); - BField[] recordFields = this.bStructType.getFields(); + Map recordFields = this.bStructType.getFields(); int index = 0; for (ColumnDefinition columnDef : columnDefs) { String columnName = columnDef.getName(); TypeKind type = columnDef.getType(); - String fieldName = recordFields[index].getFieldName(); + String fieldName = recordFields.values().toArray(new BField[0])[index].getFieldName(); ++index; switch (type) { case STRING: diff --git a/component/src/main/java/org/ballerinalang/cassandra/CassandraDataSource.java b/component/src/main/java/org/ballerinalang/cassandra/CassandraDataSource.java index 4ccac72..24a3b19 100644 --- a/component/src/main/java/org/ballerinalang/cassandra/CassandraDataSource.java +++ b/component/src/main/java/org/ballerinalang/cassandra/CassandraDataSource.java @@ -531,7 +531,11 @@ public BType getType() { } @Override - public BValue copy() { + public void stamp(BType bType) { + } + + @Override + public BValue copy(Map map) { return null; } diff --git a/component/src/main/java/org/ballerinalang/cassandra/CassandraDataSourceUtils.java b/component/src/main/java/org/ballerinalang/cassandra/CassandraDataSourceUtils.java index aec2c09..51b87b0 100644 --- a/component/src/main/java/org/ballerinalang/cassandra/CassandraDataSourceUtils.java +++ b/component/src/main/java/org/ballerinalang/cassandra/CassandraDataSourceUtils.java @@ -20,31 +20,27 @@ import org.ballerinalang.bre.Context; import org.ballerinalang.bre.bvm.BLangVMErrors; +import org.ballerinalang.connector.api.BLangConnectorSPIUtil; import org.ballerinalang.model.types.BType; +import org.ballerinalang.model.types.BTypes; import org.ballerinalang.model.types.TypeTags; +import org.ballerinalang.model.values.BError; import org.ballerinalang.model.values.BMap; -import org.ballerinalang.model.values.BString; import org.ballerinalang.model.values.BValue; -import org.ballerinalang.util.BLangConstants; -import org.ballerinalang.util.codegen.PackageInfo; -import org.ballerinalang.util.codegen.StructureTypeInfo; import org.ballerinalang.util.exceptions.BallerinaException; /** * This class contains util methods required for Cassandra ballerina package. */ public class CassandraDataSourceUtils { - public static BMap getCassandraConnectorError(Context context, Throwable throwable) { - PackageInfo builtinPackage = context.getProgramFile().getPackageInfo(BLangConstants.BALLERINA_BUILTIN_PKG); - StructureTypeInfo errorStructInfo = builtinPackage.getStructInfo(BLangVMErrors.STRUCT_GENERIC_ERROR); - BMap cassandraConnectorError = new BMap<>(errorStructInfo.getType()); - if (throwable.getMessage() == null) { - cassandraConnectorError - .put(Constants.ERROR_MESSAGE_FIELD, new BString(Constants.CASSANDRA_EXCEPTION_OCCURED)); - } else { - cassandraConnectorError.put(Constants.ERROR_MESSAGE_FIELD, new BString(throwable.getMessage())); - } - return cassandraConnectorError; + public static BError getCassandraConnectorError(Context context, Throwable throwable) { + String detailedErrorMessage = + throwable.getMessage() != null ? throwable.getMessage() : Constants.CASSANDRA_EXCEPTION_OCCURED; + BMap sqlClientErrorDetailRecord = BLangConnectorSPIUtil + .createBStruct(context, Constants.CASSANDRA_PACKAGE_PATH, Constants.DATABASE_ERROR_DATA_RECORD_NAME, + detailedErrorMessage); + return BLangVMErrors.createError(context, true, BTypes.typeError, Constants.DATABASE_ERROR_CODE, + sqlClientErrorDetailRecord); } public static String getCQLType(BType value) { diff --git a/component/src/main/java/org/ballerinalang/cassandra/Constants.java b/component/src/main/java/org/ballerinalang/cassandra/Constants.java index 82e2df0..f70873c 100644 --- a/component/src/main/java/org/ballerinalang/cassandra/Constants.java +++ b/component/src/main/java/org/ballerinalang/cassandra/Constants.java @@ -25,13 +25,14 @@ public final class Constants { public static final String QUESTION_MARK = "?"; public static final String CASSANDRA_PACKAGE_PATH = "wso2/cassandra:0.0.0"; - public static final String CALLER_ACTIONS = "CallerActions"; + public static final String CLIENT = "Client"; public static final String CASSANDRA_PARAMETER = "Parameter"; public static final String CASSANDRA_EXCEPTION_OCCURED = "Exception Occurred while executing Cassandra database " + "operation"; - public static final String ERROR_MESSAGE_FIELD = "message"; public static final String CQL_TYPE_FIELD = "cqlType"; public static final String VALUE_FIELD = "value"; + public static final String DATABASE_ERROR_DATA_RECORD_NAME = "DatabaseErrorData"; + public static final String DATABASE_ERROR_CODE = "{wso2/cassandra}DatabaseError"; /** * Constants for DataTypes. diff --git a/component/src/main/java/org/ballerinalang/cassandra/actions/Close.java b/component/src/main/java/org/ballerinalang/cassandra/actions/Close.java index 1815ec3..d9da67d 100644 --- a/component/src/main/java/org/ballerinalang/cassandra/actions/Close.java +++ b/component/src/main/java/org/ballerinalang/cassandra/actions/Close.java @@ -37,7 +37,7 @@ packageName = "cassandra:0.0.0", functionName = "close", args = { - @Argument(name = "parameters", type = TypeKind.RECORD, structType = Constants.CALLER_ACTIONS, + @Argument(name = "parameters", type = TypeKind.RECORD, structType = Constants.CLIENT, structPackage = "wso2.cassandra")} ) public class Close extends AbstractCassandraAction { @@ -45,7 +45,7 @@ public class Close extends AbstractCassandraAction { @Override public void execute(Context context) { BMap bConnector = (BMap) context.getRefArgument(0); - CassandraDataSource datasource = (CassandraDataSource) bConnector.getNativeData(Constants.CALLER_ACTIONS); + CassandraDataSource datasource = (CassandraDataSource) bConnector.getNativeData(Constants.CLIENT); try { close(datasource); } catch (Throwable e) { diff --git a/component/src/main/java/org/ballerinalang/cassandra/actions/Select.java b/component/src/main/java/org/ballerinalang/cassandra/actions/Select.java index 8700488..63a5d53 100644 --- a/component/src/main/java/org/ballerinalang/cassandra/actions/Select.java +++ b/component/src/main/java/org/ballerinalang/cassandra/actions/Select.java @@ -40,7 +40,7 @@ orgName = "wso2", packageName = "cassandra:0.0.0", functionName = "select", - receiver = @Receiver(type = TypeKind.OBJECT, structType = Constants.CALLER_ACTIONS), + receiver = @Receiver(type = TypeKind.OBJECT, structType = Constants.CLIENT), args = {@Argument(name = "queryString", type = TypeKind.STRING), @Argument(name = "parameters", type = TypeKind.ARRAY, elementType = TypeKind.RECORD, structType = "Parameter") @@ -55,7 +55,7 @@ public void execute(Context context) { String query = context.getStringArgument(0); BRefValueArray parameters = (BRefValueArray) context.getNullableRefArgument(2); BStructureType structType = getStructType(context); - CassandraDataSource dataSource = (CassandraDataSource) bConnector.getNativeData(Constants.CALLER_ACTIONS); + CassandraDataSource dataSource = (CassandraDataSource) bConnector.getNativeData(Constants.CLIENT); try { BTable dataTable = executeSelect(context, dataSource, query, parameters, structType); context.setReturnValues(dataTable); diff --git a/component/src/main/java/org/ballerinalang/cassandra/actions/Update.java b/component/src/main/java/org/ballerinalang/cassandra/actions/Update.java index 4f8c534..b58bde1 100644 --- a/component/src/main/java/org/ballerinalang/cassandra/actions/Update.java +++ b/component/src/main/java/org/ballerinalang/cassandra/actions/Update.java @@ -38,7 +38,7 @@ orgName = "wso2", packageName = "cassandra:0.0.0", functionName = "update", - receiver = @Receiver(type = TypeKind.OBJECT, structType = Constants.CALLER_ACTIONS), + receiver = @Receiver(type = TypeKind.OBJECT, structType = Constants.CLIENT), args = {@Argument(name = "queryString", type = TypeKind.STRING), @Argument(name = "parameters", type = TypeKind.ARRAY, elementType = TypeKind.RECORD, structType = "Parameter") @@ -50,7 +50,7 @@ public void execute(Context context) { BMap bConnector = (BMap) context.getRefArgument(0); String query = context.getStringArgument(0); BRefValueArray parameters = (BRefValueArray) context.getNullableRefArgument(1); - CassandraDataSource dataSource = (CassandraDataSource) bConnector.getNativeData(Constants.CALLER_ACTIONS); + CassandraDataSource dataSource = (CassandraDataSource) bConnector.getNativeData(Constants.CLIENT); try { executeUpdate(context, dataSource, query, parameters); } catch (Throwable e) { diff --git a/component/src/main/java/org/ballerinalang/cassandra/endpoint/CreateCassandraClient.java b/component/src/main/java/org/ballerinalang/cassandra/endpoint/InitCassandraClient.java similarity index 86% rename from component/src/main/java/org/ballerinalang/cassandra/endpoint/CreateCassandraClient.java rename to component/src/main/java/org/ballerinalang/cassandra/endpoint/InitCassandraClient.java index fa27c57..dde5d63 100644 --- a/component/src/main/java/org/ballerinalang/cassandra/endpoint/CreateCassandraClient.java +++ b/component/src/main/java/org/ballerinalang/cassandra/endpoint/InitCassandraClient.java @@ -37,7 +37,7 @@ @BallerinaFunction( orgName = "wso2", packageName = "cassandra:0.0.0", - functionName = "createClient", + functionName = "initClient", args = { @Argument(name = "clientEndpointConfig", type = TypeKind.RECORD, @@ -45,11 +45,11 @@ }, isPublic = true ) -public class CreateCassandraClient extends BlockingNativeCallableUnit { +public class InitCassandraClient extends BlockingNativeCallableUnit { @Override public void execute(Context context) { - BMap configBStruct = (BMap) context.getRefArgument(0); + BMap configBStruct = (BMap) context.getRefArgument(1); Struct clientEndpointConfig = BLangConnectorSPIUtil.toStruct(configBStruct); //Extract parameters from the endpoint config @@ -62,9 +62,8 @@ public void execute(Context context) { CassandraDataSource dataSource = new CassandraDataSource(); dataSource.init(host, port, username, password, options); - BMap cassandraClient = BLangConnectorSPIUtil - .createBStruct(context.getProgramFile(), Constants.CASSANDRA_PACKAGE_PATH, Constants.CALLER_ACTIONS); - cassandraClient.addNativeData(Constants.CALLER_ACTIONS, dataSource); + BMap cassandraClient = (BMap) context.getRefArgument(0); + cassandraClient.addNativeData(Constants.CLIENT, dataSource); context.setReturnValues(cassandraClient); } } diff --git a/pom.xml b/pom.xml index 10e4d8e..425c249 100644 --- a/pom.xml +++ b/pom.xml @@ -353,7 +353,7 @@ my-scm-server - 0.983.0 + 0.983.1-SNAPSHOT 3.6.0 19.0 3.1.2 From c6dbfd7382f3708a94531c013daf153c9e179c69 Mon Sep 17 00:00:00 2001 From: Manuri Date: Sat, 24 Nov 2018 16:40:36 +0530 Subject: [PATCH 2/7] Update cassandra client tests --- .../samples/cassandra-actions-test.bal | 124 ++++++++++-------- .../cassandra-connection-init-test.bal | 60 ++++----- 2 files changed, 98 insertions(+), 86 deletions(-) diff --git a/component/src/test/resources/samples/cassandra-actions-test.bal b/component/src/test/resources/samples/cassandra-actions-test.bal index 8d8b8c1..aabb777 100644 --- a/component/src/test/resources/samples/cassandra-actions-test.bal +++ b/component/src/test/resources/samples/cassandra-actions-test.bal @@ -8,26 +8,26 @@ type RS record { }; function testKeySpaceCreation() { - endpoint c:Client conn { + c:Client conn = new({ host: "localhost", port: 9142, username: "cassandra", password: "cassandra", options: {} - }; + }); _ = conn->update("CREATE KEYSPACE dummyks WITH replication = {'class':'SimpleStrategy', 'replication_factor' :1}"); conn.stop(); } function testDuplicateKeySpaceCreation() returns (any) { - endpoint c:Client conn { + c:Client conn = new({ host: "localhost", port: 9142, username: "cassandra", password: "cassandra", options: {} - }; + }); _ = conn->update("CREATE KEYSPACE duplicatekstest WITH replication = {'class':'SimpleStrategy', 'replication_factor':1}"); @@ -39,25 +39,25 @@ function testDuplicateKeySpaceCreation() returns (any) { } function testTableCreation() { - endpoint c:Client conn { + c:Client conn = new({ host: "localhost", port: 9142, username: "cassandra", password: "cassandra", options: {} - }; + }); _ = conn->update("CREATE TABLE peopleinfoks.student(id int PRIMARY KEY,name text, age int)"); conn.stop(); } function testInsert() { - endpoint c:Client conn { + c:Client conn = new({ host: "localhost", port: 9142, username: "cassandra", password: "cassandra", options: {} - }; + }); c:Parameter pID = { cqlType: c:TYPE_INT, value: 2 }; c:Parameter pName = { cqlType: c:TYPE_TEXT, value: "Tim" }; @@ -71,13 +71,13 @@ function testInsert() { } function testInsertRawParams() { - endpoint c:Client conn { + c:Client conn = new({ host: "localhost", port: 9142, username: "cassandra", password: "cassandra", options: {} - }; + }); c:Parameter pIncome = { cqlType: c:TYPE_DOUBLE, value: 1001.5 }; @@ -87,13 +87,13 @@ function testInsertRawParams() { } function testSelectWithParamArray() returns (int, string, float, boolean) { - endpoint c:Client conn { + c:Client conn = new({ host: "localhost", port: 9142, username: "cassandra", password: "cassandra", options: {} - }; + }); int[] intDataArray = [1, 5]; float[] floatDataArray = [100.2, 100.5]; float[] doubleDataArray = [10000.5, 11100.8]; @@ -106,60 +106,67 @@ function testSelectWithParamArray() returns (int, string, float, boolean) { c:Parameter incomeArray = { cqlType: c:TYPE_DOUBLE, value: doubleDataArray }; c:Parameter marriageStatusArray = { cqlType: c:TYPE_BOOLEAN, value: booleanDataArray }; - var temp = conn->select("SELECT id, name, salary, married FROM peopleinfoks.person WHERE id in (?) AND + var dt = conn->select("SELECT id, name, salary, married FROM peopleinfoks.person WHERE id in (?) AND name in (?) AND salary in (?) AND income in (?) AND married in (?) ALLOW FILTERING", RS, idArray, nameArray, salaryArray, incomeArray, marriageStatusArray); - var dt = check temp; - - int id; - string name; - float salary; - boolean married; - - while (dt.hasNext()) { - var rs = check dt.getNext(); - id = rs.id; - name = rs.name; - salary = rs.salary; - married = rs.married; + int id = -1; + string name = ""; + float salary = -1; + boolean married = false; + + if (dt is table) { + while (dt.hasNext()) { + var rs = dt.getNext(); + if (rs is RS) { + id = rs.id; + name = rs.name; + salary = rs.salary; + married = rs.married; + } + } } conn.stop(); return (id, name, salary, married); } function testSelect() returns (int, string, float) { - endpoint c:Client conn { + c:Client conn = new({ host: "localhost", port: 9142, username: "cassandra", password: "cassandra", options: {} - }; - - var temp = conn->select("SELECT id, name, salary, married FROM peopleinfoks.person WHERE id = ?", RS, 1); - table dt = check temp; - int id; - string name; - float salary; - while (dt.hasNext()) { - var rs = check dt.getNext(); - id = rs.id; - name = rs.name; - salary = rs.salary; + }); + + var dt = conn->select("SELECT id, name, salary, married FROM peopleinfoks.person WHERE id = ?", RS, 1); + + int id = -1; + string name = ""; + float salary = -1; + + if (dt is table) { + while (dt.hasNext()) { + var rs = dt.getNext(); + if (rs is RS) { + id = rs.id; + name = rs.name; + salary = rs.salary; + } + } } conn.stop(); return (id, name, salary); } function testSelectNonExistentColumn() returns (any) { - endpoint c:Client conn { + c:Client conn = new({ host: "localhost", port: 9142, username: "cassandra", password: "cassandra", options: {} - }; + }); c:Parameter pID = { cqlType: c:TYPE_INT, value:1 }; @@ -168,13 +175,13 @@ function testSelectNonExistentColumn() returns (any) { } function testInsertWithNilParams() { - endpoint c:Client conn { + c:Client conn = new({ host: "localhost", port: 9142, username: "cassandra", password: "cassandra", options: {} - }; + }); _ = conn->update("INSERT INTO peopleinfoks.person(id, name, salary, income, married) values (10,'Jim',101.5,1001.5,false)"); @@ -182,24 +189,29 @@ function testInsertWithNilParams() { } function testSelectWithNilParams() returns (int, string, float) { - endpoint c:Client conn { + c:Client conn = new({ host: "localhost", port: 9142, username: "cassandra", password: "cassandra", options: {} - }; - - var temp = conn->select("SELECT id, name, salary, married FROM peopleinfoks.person WHERE id = 1", RS); - table dt = check temp; - int id; - string name; - float salary; - while (dt.hasNext()) { - var rs = check dt.getNext(); - id = rs.id; - name = rs.name; - salary = rs.salary; + }); + + var dt = conn->select("SELECT id, name, salary, married FROM peopleinfoks.person WHERE id = 1", RS); + + int id = -1; + string name = ""; + float salary = -1; + + if (dt is table) { + while (dt.hasNext()) { + var rs = dt.getNext(); + if (rs is RS) { + id = rs.id; + name = rs.name; + salary = rs.salary; + } + } } conn.stop(); return (id, name, salary); diff --git a/component/src/test/resources/samples/cassandra-connection-init-test.bal b/component/src/test/resources/samples/cassandra-connection-init-test.bal index b986cc0..9eb1350 100644 --- a/component/src/test/resources/samples/cassandra-connection-init-test.bal +++ b/component/src/test/resources/samples/cassandra-connection-init-test.bal @@ -1,41 +1,41 @@ import wso2/cassandra as c; -@final int port = 9142; -@final string host = "localhost"; -@final string username = "cassandra"; -@final string password = "cassandra"; +final int port = 9142; +final string host = "localhost"; +final string username = "cassandra"; +final string password = "cassandra"; function testConnectionInitWithLBPolicy() { - endpoint c:Client conn { + c:Client conn = new({ host: "localhost", port: 9142, username: "cassandra", password: "cassandra", options: { loadBalancingPolicy: "DCAwareRoundRobinPolicy" } - }; + }); _ = conn->update("CREATE KEYSPACE lbtestkeyspace WITH replication = {'class': 'SimpleStrategy', 'replication_factor' :1}"); conn.stop(); } function testConnectionInitWithInvalidLBPolicy() { - endpoint c:Client conn { + c:Client conn = new({ host: "localhost", port: 9142, username: "cassandra", password: "cassandra", options: { loadBalancingPolicy: "InvalidRoundRobinPolicy" } - }; + }); } function testConnectionInitWithRetryPolicy() { - endpoint c:Client conn { + c:Client conn = new({ host: "localhost", port: 9142, username: "cassandra", password: "cassandra", options: { retryPolicy: "DefaultRetryPolicy" } - }; + }); _ = conn->update("CREATE KEYSPACE retrytestkeyspace WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}"); @@ -43,24 +43,24 @@ function testConnectionInitWithRetryPolicy() { } function testConnectionInitWithInvalidRetryPolicy() { - endpoint c:Client conn { + c:Client conn = new({ host: "localhost", port: 9142, username: "cassandra", password: "cassandra", options: { retryPolicy: "InvalidRetryPolicy" } - }; + }); conn.stop(); } function testConnectionInitWithReconnectionPolicy() { - endpoint c:Client conn { + c:Client conn = new({ host: "localhost", port: 9142, username: "cassandra", password: "cassandra", options: { reconnectionPolicy: "ConstantReconnectionPolicy", constantReconnectionPolicyDelay: 500 } - }; + }); _ = conn->update("CREATE KEYSPACE reconnectiontestkeyspace WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}"); @@ -68,41 +68,41 @@ function testConnectionInitWithReconnectionPolicy() { } function testConnectionInitWithInvalidReconnectionPolicy() { - endpoint c:Client conn { + c:Client conn = new({ host: "localhost", port: 9142, username: "cassandra", password: "cassandra", options: { reconnectionPolicy: "InvalidReconnectionPolicy", constantReconnectionPolicyDelay: 500 } - }; + }); } function testConnectionInitWithInvalidConsistencyLevel() { - endpoint c:Client conn { + c:Client conn = new({ host: "localhost", port: 9142, username: "cassandra", password: "cassandra", options: { queryOptionsConfig: { consistencyLevel: "INVALID_LEVEL" } } - }; + }); } function testConnectionInitWithInvalidSerialConsistencyLevel() { - endpoint c:Client conn { + c:Client conn = new({ host: "localhost", port: 9142, username: "cassandra", password: "cassandra", options: { queryOptionsConfig: { serialConsistencyLevel: "ONE" } } - }; + }); } function testConnectionInitWithPoolingOptions() { - endpoint c:Client conn { + c:Client conn = new({ host: "localhost", port: 9142, username: "cassandra", @@ -112,7 +112,7 @@ function testConnectionInitWithPoolingOptions() { poolTimeoutMillis: 100, maxQueueSize: 256, heartbeatIntervalSeconds: 30, coreConnectionsPerHostLocal: 2, maxConnectionsPerHostLocal: 2, newConnectionThresholdLocal: 100, coreConnectionsPerHostRemote: 1, maxConnectionsPerHostRemote: 8, - newConnectionThresholdRemote: 100 } } }; + newConnectionThresholdRemote: 100 } } }); _ = conn->update("CREATE KEYSPACE poolingoptionstestkeyspace WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}"); conn.stop(); @@ -121,21 +121,21 @@ function testConnectionInitWithPoolingOptions() { function testConnectionInitWithSocketOptions() { - endpoint c:Client conn { + c:Client conn = new({ host: "localhost", port: 9142, username: "cassandra", password: "cassandra", options: { socketOptionsConfig: { connectTimeoutMillis: 5000, readTimeoutMillis: 12000, soLinger: 0 } } - }; + }); _ = conn->update("CREATE KEYSPACE socketoptionstestkeyspace WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}"); conn.stop(); } function testConnectionInitWithQueryOptions() { - endpoint c:Client conn { + c:Client conn = new({ host: "localhost", port: 9142, username: "cassandra", @@ -145,14 +145,14 @@ function testConnectionInitWithQueryOptions() { true, reprepareOnUp: true, prepareOnAllHosts: true, fetchSize: 5000, maxPendingRefreshNodeListRequests: 20, maxPendingRefreshNodeRequests: 20, maxPendingRefreshSchemaRequests: 20, refreshNodeListIntervalMillis: 1000, refreshNodeIntervalMillis: 1000, refreshSchemaIntervalMillis: 1000 } } - }; + }); _ = conn->update("CREATE KEYSPACE queryoptionstestkeyspace WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}"); conn.stop(); } function testConnectionInitWithProtocolOptions() { - endpoint c:Client conn { + c:Client conn = new({ host: "localhost", port: 9142, username: "cassandra", @@ -160,7 +160,7 @@ function testConnectionInitWithProtocolOptions() { options: { protocolOptionsConfig: { sslEnabled: false, noCompact: false, maxSchemaAgreementWaitSeconds: 10, compression: "NONE", initialProtocolVersion: "V4" } } - }; + }); _ = conn->update("CREATE KEYSPACE protocoloptionstestkeyspace WITH replication = {'class': 'SimpleStrategy', 'replication_factor' :1}"); @@ -168,14 +168,14 @@ function testConnectionInitWithProtocolOptions() { } function testConnectionInitWithAdditionalConnectionParams() { - endpoint c:Client conn { + c:Client conn = new({ host: "localhost", port: 9142, username: "cassandra", password: "cassandra", options: { clusterName: "Maze", withoutMetrics: false, withoutJMXReporting: false, allowRemoteDCsForLocalConsistencyLevel: false } - }; + }); _ = conn->update("CREATE KEYSPACE conparamtestkeyspace WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}"); From 9b881c91f04e53eee1357316791d41efdf82cfa5 Mon Sep 17 00:00:00 2001 From: Manuri Date: Sat, 24 Nov 2018 16:40:51 +0530 Subject: [PATCH 3/7] Update README.md and Module.md --- README.md | 59 +++++++++---------- .../src/main/ballerina/cassandra/Module.md | 20 ++++--- 2 files changed, 40 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 9047b39..c6f4bc9 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ type Person record { }; public function main() { - endpoint c:Client conn { + c:Client conn = new({ host: "localhost", port: 9042, username: "cassandra", @@ -48,7 +48,7 @@ public function main() { protocolOptionsConfig: { sslEnabled: false }, socketOptionsConfig: { connectTimeoutMillis: 500, readTimeoutMillis: 1000 }, poolingOptionsConfig: { maxConnectionsPerHostLocal: 5, newConnectionThresholdLocal: 10 } } - }; + }); var returned = conn->update("CREATE KEYSPACE testballerina WITH replication = {'class':'SimpleStrategy', 'replication_factor' : 3}"); @@ -67,45 +67,43 @@ public function main() { pID, pName, pSalary, pIncome, pMarried); handleUpdate(returned, "Insert One Row to Table person"); - table dt; var selectRet = conn->select("select id, name, salary from testballerina.person where id = ?", Person, pID); - match selectRet { - table tableReturned => dt = tableReturned; - error e => io:println("Select data from person table failed: " + e.message); - } - foreach row in dt { - io:println("Person:" + row.id + "|" + row.name + "|" + row.salary); + if (selectRet is table) { + foreach row in selectRet { + io:println("Person:" + row.id + "|" + row.name + "|" + row.salary); + } + } else if (selectRet is error) { + io:println("Select data from person table failed: " + selectRet.detail().message); } selectRet = conn->select("select id, name, salary from testballerina.person where id = ? and name = ? ALLOW FILTERING", Person, pID, pName); - match selectRet { - table tableReturned => dt = tableReturned; - error e => io:println("Select data from person table failed: " + e.message); - } - var jsonRet = dt; - match jsonRet { - json j => { + + if (selectRet is table) { + var jsonRet = selectRet; + if (jsonRet is json) { io:print("JSON: "); - io:println(io:sprintf("%s", j)); + io:println(io:sprintf("%s", jsonRet)); + } else { + io:println("Error in table to json conversion"); } - error e => io:println("Error in table to json conversion"); + } else if (selectRet is error) { + io:println("Select data from person table failed: " + selectRet.detail().message); } selectRet = conn->select("select id, name, salary from testballerina.person where salary = ? ALLOW FILTERING", Person, pSalary); - match selectRet { - table tableReturned => dt = tableReturned; - error e => io:println("Select data from person table failed: " + e.message); - } - var xmlRet = dt; - match xmlRet { - xml x => { + if (selectRet is table) { + var xmlRet = selectRet; + if (xmlRet is xml) { io:print("XML: "); - io:println(io:sprintf("%s", x)); + io:println(io:sprintf("%s", xmlRet)); + } else { + io:println("Error in table to xml conversion"); } - error e => io:println("Error in table to xml conversion"); + } else if (selectRet is error) { + io:println("Select data from person table failed: " + selectRet.detail().message); } returned = conn->update("DROP KEYSPACE testballerina"); @@ -116,9 +114,10 @@ public function main() { } function handleUpdate(()|error returned, string message) { - match returned { - () => io:println(message + " success "); - error e => io:println(message + " failed: " + e.message); + if (returned is ()) { + io:println(message + " success "); + } else if (returned is error) { + io:println(message + " failed: " + returned.detail().message); } } ``` diff --git a/component/src/main/ballerina/cassandra/Module.md b/component/src/main/ballerina/cassandra/Module.md index 9389fcc..fc88ad7 100644 --- a/component/src/main/ballerina/cassandra/Module.md +++ b/component/src/main/ballerina/cassandra/Module.md @@ -14,7 +14,7 @@ Once the endpoint is created, database operations can be executed through that e ### Creating an endpoint ```ballerina -endpoint c:Client conn { +cassandra:Client conn = new({ host: "localhost", port: 9042, username: "cassandra", @@ -24,7 +24,7 @@ endpoint c:Client conn { protocolOptionsConfig: { sslEnabled: false }, socketOptionsConfig: { connectTimeoutMillis: 500, readTimeoutMillis: 1000 }, poolingOptionsConfig: { maxConnectionsPerHostLocal: 5, newConnectionThresholdLocal: 10 } } -}; +}); ``` For the full list of available configuration options refer the API docs of the endpoint. @@ -34,9 +34,10 @@ For the full list of available configuration options refer the API docs of the e var returned = conn->update("CREATE TABLE testballerina.person(id int PRIMARY KEY,name text,salary float,income double, married boolean)"); -match returned { - () => io:println("Table creation success "); - error e => io:println("Table creation failed: " + e.message); +if (returned is ()) { + io:println("Table creation success "); +} else if (returned is error) { + io:println("Table creation failed: " + returned.reason()); } ``` @@ -44,11 +45,12 @@ match returned { ```ballerina -table dt; var selectRet = conn->select("select id, name, salary from testballerina.person where salary = ? ALLOW FILTERING", Person, pSalary); -match selectRet { - table tableReturned => dt = tableReturned; - error e => io:println("Select data from person table failed: " + e.message); +if (selectRet is table) { + table dt = selectRet; + // Processing logic +} else if (selectRet is error) { + io:println("Select data from person table failed: " + selectRet.reason()); } ``` \ No newline at end of file From f0c375ac9cd3d61fc2ee48057e824e77e1f5b7e7 Mon Sep 17 00:00:00 2001 From: Manuri Date: Thu, 6 Dec 2018 22:04:28 +0530 Subject: [PATCH 4/7] Sync with latest ballerina changes --- README.md | 18 ++++----- .../src/main/ballerina/cassandra/endpoint.bal | 2 +- .../src/main/ballerina/cassandra/types.bal | 8 ++-- .../actions/AbstractCassandraAction.java | 38 +++++++++---------- .../cassandra/actions/Select.java | 4 +- .../cassandra/actions/Update.java | 4 +- .../samples/cassandra-actions-test.bal | 32 +++++++--------- 7 files changed, 48 insertions(+), 58 deletions(-) diff --git a/README.md b/README.md index c6f4bc9..31364e2 100644 --- a/README.md +++ b/README.md @@ -70,39 +70,39 @@ public function main() { var selectRet = conn->select("select id, name, salary from testballerina.person where id = ?", Person, pID); if (selectRet is table) { - foreach row in selectRet { + foreach var row in selectRet { io:println("Person:" + row.id + "|" + row.name + "|" + row.salary); } - } else if (selectRet is error) { + } else { io:println("Select data from person table failed: " + selectRet.detail().message); } selectRet = conn->select("select id, name, salary from testballerina.person where id = ? and name = ? ALLOW FILTERING", Person, pID, pName); - if (selectRet is table) { - var jsonRet = selectRet; + if (selectRet is table) { + var jsonRet = json.convert(selectRet); if (jsonRet is json) { io:print("JSON: "); io:println(io:sprintf("%s", jsonRet)); } else { io:println("Error in table to json conversion"); } - } else if (selectRet is error) { + } else { io:println("Select data from person table failed: " + selectRet.detail().message); } selectRet = conn->select("select id, name, salary from testballerina.person where salary = ? ALLOW FILTERING", Person, pSalary); - if (selectRet is table) { - var xmlRet = selectRet; + if (selectRet is table) { + var xmlRet = xml.convert(selectRet); if (xmlRet is xml) { io:print("XML: "); io:println(io:sprintf("%s", xmlRet)); } else { io:println("Error in table to xml conversion"); } - } else if (selectRet is error) { + } else { io:println("Select data from person table failed: " + selectRet.detail().message); } @@ -116,7 +116,7 @@ public function main() { function handleUpdate(()|error returned, string message) { if (returned is ()) { io:println(message + " success "); - } else if (returned is error) { + } else { io:println(message + " failed: " + returned.detail().message); } } diff --git a/component/src/main/ballerina/cassandra/endpoint.bal b/component/src/main/ballerina/cassandra/endpoint.bal index ed639ef..df78963 100644 --- a/component/src/main/ballerina/cassandra/endpoint.bal +++ b/component/src/main/ballerina/cassandra/endpoint.bal @@ -30,7 +30,7 @@ public type Client client object { # + recordType - The Type result should be mapped to # + return - `table` representing the result of the select action or `error` if an error occurs public remote extern function select(string queryString, typedesc recordType, Param... parameters) - returns (table|error); + returns (table|error); # Execute update query on cassandra datasource. diff --git a/component/src/main/ballerina/cassandra/types.bal b/component/src/main/ballerina/cassandra/types.bal index a9f5b75..7029c6a 100644 --- a/component/src/main/ballerina/cassandra/types.bal +++ b/component/src/main/ballerina/cassandra/types.bal @@ -61,10 +61,10 @@ public type Param string|int|boolean|float|Parameter; # + password - Password for the database connection # + options - Properties for the connection configuration public type ClientEndpointConfig record { - string host = ""; - int port = 0; - string username = ""; - string password = ""; + string host; + int port; + string username; + string password; ConnectionProperties options = {}; !... }; diff --git a/component/src/main/java/org/ballerinalang/cassandra/actions/AbstractCassandraAction.java b/component/src/main/java/org/ballerinalang/cassandra/actions/AbstractCassandraAction.java index 1d781bc..9b6b4b7 100644 --- a/component/src/main/java/org/ballerinalang/cassandra/actions/AbstractCassandraAction.java +++ b/component/src/main/java/org/ballerinalang/cassandra/actions/AbstractCassandraAction.java @@ -35,20 +35,16 @@ import org.ballerinalang.model.types.TypeKind; import org.ballerinalang.model.types.TypeTags; import org.ballerinalang.model.values.BBoolean; -import org.ballerinalang.model.values.BBooleanArray; import org.ballerinalang.model.values.BFloat; -import org.ballerinalang.model.values.BFloatArray; -import org.ballerinalang.model.values.BIntArray; import org.ballerinalang.model.values.BInteger; import org.ballerinalang.model.values.BMap; import org.ballerinalang.model.values.BNewArray; import org.ballerinalang.model.values.BRefType; -import org.ballerinalang.model.values.BRefValueArray; import org.ballerinalang.model.values.BString; -import org.ballerinalang.model.values.BStringArray; import org.ballerinalang.model.values.BTable; import org.ballerinalang.model.values.BTypeDescValue; import org.ballerinalang.model.values.BValue; +import org.ballerinalang.model.values.BValueArray; import org.ballerinalang.util.codegen.PackageInfo; import org.ballerinalang.util.codegen.StructureTypeInfo; import org.ballerinalang.util.exceptions.BallerinaException; @@ -67,8 +63,8 @@ public abstract class AbstractCassandraAction extends BlockingNativeCallableUnit { public BTable executeSelect(Context context, CassandraDataSource dataSource, String query, - BRefValueArray parameters, BStructureType type) { - BRefValueArray uniformParams = constructUniformArrayOfParameters(parameters, context); + BValueArray parameters, BStructureType type) { + BValueArray uniformParams = constructUniformArrayOfParameters(parameters, context); String processedQuery = createProcessedQueryString(query, uniformParams); PreparedStatement preparedStatement = dataSource.getSession().prepare(processedQuery); BoundStatement stmt = createBoundStatement(preparedStatement, uniformParams); @@ -77,8 +73,8 @@ public BTable executeSelect(Context context, CassandraDataSource dataSource, Str } public void executeUpdate(Context context, CassandraDataSource dataSource, String query, - BRefValueArray parameters) { - BRefValueArray uniformParams = constructUniformArrayOfParameters(parameters, context); + BValueArray parameters) { + BValueArray uniformParams = constructUniformArrayOfParameters(parameters, context); String processedQuery = createProcessedQueryString(query, uniformParams); PreparedStatement preparedStatement = dataSource.getSession().prepare(processedQuery); BoundStatement stmt = createBoundStatement(preparedStatement, uniformParams); @@ -99,11 +95,11 @@ protected BStructureType getStructType(Context context) { return structType; } - private BRefValueArray constructUniformArrayOfParameters(BRefValueArray inputParams, Context context) { - BRefValueArray uniformParams = new BRefValueArray(); + private BValueArray constructUniformArrayOfParameters(BValueArray inputParams, Context context) { + BValueArray uniformParams = new BValueArray(); int count = (int) inputParams.size(); for (int i = 0; i < count; i++) { - BRefType typeValue = inputParams.get(i); + BRefType typeValue = inputParams.getRefValue(i); BMap param; if (typeValue.getType().getTag() == TypeTags.RECORD_TYPE_TAG) { param = (BMap) typeValue; @@ -185,7 +181,7 @@ private TypeKind convert(DataType type) { * If there are any arrays of parameter for types other than sql array, the given query is expanded by adding "?" s * to match with the array size. */ - private String createProcessedQueryString(String query, BRefValueArray parameters) { + private String createProcessedQueryString(String query, BValueArray parameters) { String currentQuery = query; if (parameters != null) { int start = 0; @@ -193,7 +189,7 @@ private String createProcessedQueryString(String query, BRefValueArray parameter int count; int paramCount = (int) parameters.size(); for (int i = 0; i < paramCount; i++) { - BMap paramStruct = (BMap) parameters.get(i); + BMap paramStruct = (BMap) parameters.getBValue(i); if (paramStruct != null) { String cqlType = getCQLType(paramStruct); BValue value = paramStruct.get(Constants.VALUE_FIELD); @@ -250,7 +246,7 @@ private String generateQuestionMarks(int n) { return builder.toString(); } - private BoundStatement createBoundStatement(PreparedStatement stmt, BRefValueArray params) { + private BoundStatement createBoundStatement(PreparedStatement stmt, BValueArray params) { ArrayList dataList = new ArrayList<>(); BoundStatement boundStmt = stmt.bind(); if (params == null) { @@ -258,7 +254,7 @@ private BoundStatement createBoundStatement(PreparedStatement stmt, BRefValueArr } int paramCount = (int) params.size(); for (int index = 0; index < paramCount; index++) { - BMap paramStruct = (BMap) params.get(index); + BMap paramStruct = (BMap) params.getBValue(index); if (paramStruct != null) { String cqlType = getCQLType(paramStruct); BValue value = paramStruct.get(Constants.VALUE_FIELD); @@ -271,19 +267,19 @@ private BoundStatement createBoundStatement(PreparedStatement stmt, BRefValueArr BValue paramValue; switch (typeTag) { case TypeTags.INT_TAG: - paramValue = new BInteger(((BIntArray) value).get(i)); + paramValue = new BInteger(((BValueArray) value).getInt(i)); break; case TypeTags.FLOAT_TAG: - paramValue = new BFloat(((BFloatArray) value).get(i)); + paramValue = new BFloat(((BValueArray) value).getFloat(i)); break; case TypeTags.STRING_TAG: - paramValue = new BString(((BStringArray) value).get(i)); + paramValue = new BString(((BValueArray) value).getString(i)); break; case TypeTags.BOOLEAN_TAG: - paramValue = new BBoolean(((BBooleanArray) value).get(i) > 0); + paramValue = new BBoolean(((BValueArray) value).getBoolean(i) > 0); break; case TypeTags.ARRAY_TAG: - BValue array = ((BRefValueArray) value).get(i); + BValue array = ((BValueArray) value).getBValue(i); if (((BArrayType) value.getType()).getElementType().getTag() == TypeTags.BYTE_TAG) { paramValue = array; break; diff --git a/component/src/main/java/org/ballerinalang/cassandra/actions/Select.java b/component/src/main/java/org/ballerinalang/cassandra/actions/Select.java index 63a5d53..6047d59 100644 --- a/component/src/main/java/org/ballerinalang/cassandra/actions/Select.java +++ b/component/src/main/java/org/ballerinalang/cassandra/actions/Select.java @@ -24,9 +24,9 @@ import org.ballerinalang.model.types.BStructureType; import org.ballerinalang.model.types.TypeKind; import org.ballerinalang.model.values.BMap; -import org.ballerinalang.model.values.BRefValueArray; import org.ballerinalang.model.values.BTable; import org.ballerinalang.model.values.BValue; +import org.ballerinalang.model.values.BValueArray; import org.ballerinalang.natives.annotations.Argument; import org.ballerinalang.natives.annotations.BallerinaFunction; import org.ballerinalang.natives.annotations.Receiver; @@ -53,7 +53,7 @@ public class Select extends AbstractCassandraAction { public void execute(Context context) { BMap bConnector = (BMap) context.getRefArgument(0); String query = context.getStringArgument(0); - BRefValueArray parameters = (BRefValueArray) context.getNullableRefArgument(2); + BValueArray parameters = (BValueArray) context.getNullableRefArgument(2); BStructureType structType = getStructType(context); CassandraDataSource dataSource = (CassandraDataSource) bConnector.getNativeData(Constants.CLIENT); try { diff --git a/component/src/main/java/org/ballerinalang/cassandra/actions/Update.java b/component/src/main/java/org/ballerinalang/cassandra/actions/Update.java index b58bde1..d66c299 100644 --- a/component/src/main/java/org/ballerinalang/cassandra/actions/Update.java +++ b/component/src/main/java/org/ballerinalang/cassandra/actions/Update.java @@ -23,8 +23,8 @@ import org.ballerinalang.cassandra.Constants; import org.ballerinalang.model.types.TypeKind; import org.ballerinalang.model.values.BMap; -import org.ballerinalang.model.values.BRefValueArray; import org.ballerinalang.model.values.BValue; +import org.ballerinalang.model.values.BValueArray; import org.ballerinalang.natives.annotations.Argument; import org.ballerinalang.natives.annotations.BallerinaFunction; import org.ballerinalang.natives.annotations.Receiver; @@ -49,7 +49,7 @@ public class Update extends AbstractCassandraAction { public void execute(Context context) { BMap bConnector = (BMap) context.getRefArgument(0); String query = context.getStringArgument(0); - BRefValueArray parameters = (BRefValueArray) context.getNullableRefArgument(1); + BValueArray parameters = (BValueArray) context.getNullableRefArgument(1); CassandraDataSource dataSource = (CassandraDataSource) bConnector.getNativeData(Constants.CLIENT); try { executeUpdate(context, dataSource, query, parameters); diff --git a/component/src/test/resources/samples/cassandra-actions-test.bal b/component/src/test/resources/samples/cassandra-actions-test.bal index aabb777..9f6b558 100644 --- a/component/src/test/resources/samples/cassandra-actions-test.bal +++ b/component/src/test/resources/samples/cassandra-actions-test.bal @@ -115,15 +115,13 @@ function testSelectWithParamArray() returns (int, string, float, boolean) { float salary = -1; boolean married = false; - if (dt is table) { + if (dt is table) { while (dt.hasNext()) { var rs = dt.getNext(); - if (rs is RS) { - id = rs.id; - name = rs.name; - salary = rs.salary; - married = rs.married; - } + id = rs.id; + name = rs.name; + salary = rs.salary; + married = rs.married; } } conn.stop(); @@ -145,14 +143,12 @@ function testSelect() returns (int, string, float) { string name = ""; float salary = -1; - if (dt is table) { + if (dt is table) { while (dt.hasNext()) { var rs = dt.getNext(); - if (rs is RS) { - id = rs.id; - name = rs.name; - salary = rs.salary; - } + id = rs.id; + name = rs.name; + salary = rs.salary; } } conn.stop(); @@ -203,14 +199,12 @@ function testSelectWithNilParams() returns (int, string, float) { string name = ""; float salary = -1; - if (dt is table) { + if (dt is table) { while (dt.hasNext()) { var rs = dt.getNext(); - if (rs is RS) { - id = rs.id; - name = rs.name; - salary = rs.salary; - } + id = rs.id; + name = rs.name; + salary = rs.salary; } } conn.stop(); From 19b723bf61d1fde1d686b13ba0a633438f613ef5 Mon Sep 17 00:00:00 2001 From: Manuri Date: Mon, 10 Dec 2018 09:52:17 +0530 Subject: [PATCH 5/7] Update README.md and Module.md --- README.md | 4 ++-- component/src/main/ballerina/cassandra/Module.md | 14 +++++++------- pom.xml | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 31364e2..b22f905 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ [![Build Status](https://travis-ci.org/wso2-ballerina/module-cassandra.svg?branch=master)](https://travis-ci.org/wso2-ballerina/module-cassandra) -# Ballerina Cassandra Client Endpoint +# Ballerina Cassandra Client -Ballerina Cassandra Client Endpoint is used to connect Ballerina with Cassandra data source. With the Ballerina Cassandra client endpoint following actions are supported. +Ballerina Cassandra Client is used to connect Ballerina with Cassandra data source. With the Ballerina Cassandra client following operations are supported. 1. update - To execute a data or schema update query 2. select - To select data from the datasource diff --git a/component/src/main/ballerina/cassandra/Module.md b/component/src/main/ballerina/cassandra/Module.md index fc88ad7..4ba1f69 100644 --- a/component/src/main/ballerina/cassandra/Module.md +++ b/component/src/main/ballerina/cassandra/Module.md @@ -2,17 +2,17 @@ This module provides the functionality required to access and manipulate data stored in an Cassandra datasource. -### Endpoint +### Client -To access a Cassandra datasource, you must first create an `endpoint`, which is a virtual representation of the physical endpoint of the Cassandra database that you are trying to connect to. Create an endpoint of the cassandra client type (i.e., `cassandra:Client`) and provide the necessary connection parameters. This will create a pool of connections to the given Cassandra database. A sample for creating an endpoint with a Cassandra client can be found below. +To access a Cassandra datasource, you must first create a `client` object. Create a client object of the cassandra client type (i.e., `cassandra:Client`) and provide the necessary connection parameters. This will create a pool of connections to the given Cassandra database. A sample for creating a client with a Cassandra client can be found below. ### Database operations -Once the endpoint is created, database operations can be executed through that endpoint. This module provides support for updating data/schema and select data. +Once the client is created, database operations can be executed through that client. This module provides support for updating data/schema and select data. ## Samples -### Creating an endpoint +### Creating a Client ```ballerina cassandra:Client conn = new({ host: "localhost", @@ -26,7 +26,7 @@ cassandra:Client conn = new({ poolingOptionsConfig: { maxConnectionsPerHostLocal: 5, newConnectionThresholdLocal: 10 } } }); ``` -For the full list of available configuration options refer the API docs of the endpoint. +For the full list of available configuration options refer the API docs of the client. ### Update data @@ -36,7 +36,7 @@ var returned = conn->update("CREATE TABLE testballerina.person(id int PRIMARY KE married boolean)"); if (returned is ()) { io:println("Table creation success "); -} else if (returned is error) { +} else { io:println("Table creation failed: " + returned.reason()); } ``` @@ -50,7 +50,7 @@ var selectRet = conn->select("select id, name, salary from testballerina.person if (selectRet is table) { table dt = selectRet; // Processing logic -} else if (selectRet is error) { +} else { io:println("Select data from person table failed: " + selectRet.reason()); } ``` \ No newline at end of file diff --git a/pom.xml b/pom.xml index 425c249..c839703 100644 --- a/pom.xml +++ b/pom.xml @@ -353,7 +353,7 @@ my-scm-server - 0.983.1-SNAPSHOT + 0.990.0 3.6.0 19.0 3.1.2 From 19c36b81b87f9d3a8debd05e3e536f2724def5b8 Mon Sep 17 00:00:00 2001 From: Manuri Date: Mon, 10 Dec 2018 09:53:22 +0530 Subject: [PATCH 6/7] Remove unnecessary dependencies --- pom.xml | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/pom.xml b/pom.xml index c839703..43edbe8 100644 --- a/pom.xml +++ b/pom.xml @@ -168,16 +168,6 @@ ballerina-log-api ${ballerina.version} - - org.ballerinax.docker - docker-extension - ${ballerina.version} - - - org.ballerinax.kubernetes - kubernetes-extension - ${ballerina.version} - org.ballerinalang @@ -207,20 +197,6 @@ ballerina-binary-repo ${ballerina.version} - - org.ballerinax.docker - docker-extension - zip - ballerina-binary-repo - ${ballerina.version} - - - org.ballerinax.kubernetes - kubernetes-extension - zip - ballerina-binary-repo - ${ballerina.version} - com.datastax.cassandra cassandra-driver-core From 2ffbccd58f0b8b77a6f83fa1d513584969f61a78 Mon Sep 17 00:00:00 2001 From: Manuri Date: Mon, 10 Dec 2018 10:29:52 +0530 Subject: [PATCH 7/7] Remove unnecessary dependencies --- component/pom.xml | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/component/pom.xml b/component/pom.xml index 27a629b..97b18e5 100644 --- a/component/pom.xml +++ b/component/pom.xml @@ -64,14 +64,6 @@ org.ballerinalang ballerina-log-api - - org.ballerinax.docker - docker-extension - - - org.ballerinax.kubernetes - kubernetes-extension - org.ballerinalang ballerina-builtin @@ -96,18 +88,6 @@ zip ballerina-binary-repo - - org.ballerinax.docker - docker-extension - zip - ballerina-binary-repo - - - org.ballerinax.kubernetes - kubernetes-extension - zip - ballerina-binary-repo - com.datastax.cassandra cassandra-driver-core