All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.stratio.deep.config.ICassandraDeepJobConfig Maven / Gradle / Ivy

There is a newer version: 0.8.0
Show newest version
/*
 * Copyright 2014, Stratio.
 *
 * Licensed 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 com.stratio.deep.config;

import com.datastax.driver.core.Session;

import java.io.Serializable;

/**
 * Created by luca on 23/06/14.
 */
public interface ICassandraDeepJobConfig extends IDeepJobConfig {

    /**
     * {@inheritDoc}
     */
    @Override
    public abstract ICassandraDeepJobConfig pageSize(int pageSize);

    /**
     * Returns the partitioner class name.
     *
     * @return the partitioner class name.
     */
    public abstract String getPartitionerClassName();

    /**
     * Let's the user specify an alternative partitioner class. The default partitioner is
     * org.apache.cassandra.dht.Murmur3Partitioner.
     *
     * @param partitionerClassName the partitioner class name.
     * @return this object.
     */
    public abstract ICassandraDeepJobConfig partitioner(String partitionerClassName);

    /**
     * Returns the session opened to the cassandra server.
     *
     * @return the Session opened by this configuration object to the cassandra server.
     */
    public abstract Session getSession();

    /**
     * Returns the name of the keyspace.
     *
     * @return the name of the configured keyspace.
     */
    public abstract String getKeyspace();

    /**
     * RPC port where the remote Cassandra cluster is listening to.
     * Defaults to 9160.
     *
     * @return the thrift port.
     */
    public abstract Integer getRpcPort();

    /**
     * CQL port where the remote Cassandra cluster is listening to.
     * Defaults to 9042.
     *
     * @return the cql port.
     */
    public abstract Integer getCqlPort();

    /**
     * Sets Cassandra Keyspace.
     *
     * @param keyspace the keyspace to use.
     * @return this object.
     */
    public abstract ICassandraDeepJobConfig keyspace(String keyspace);


    /**
     * Sets cassandra host rpcPort.
     *
     * @param port the thrift port number.
     * @return this object.
     */
    public abstract ICassandraDeepJobConfig rpcPort(Integer port);

    /**
     * Sets cassandra host rpcPort.
     *
     * @param port the cql port number.
     * @return this object.
     */
    public abstract ICassandraDeepJobConfig cqlPort(Integer port);

    /**
     * Sets read consistency level. 
* Can be one of those consistency levels defined in {@link org.apache.cassandra.db.ConsistencyLevel}.
* Defaults to {@link org.apache.cassandra.db.ConsistencyLevel#LOCAL_ONE}. * * @param level the read consistency level to use. * @return this configuration object. */ public abstract ICassandraDeepJobConfig readConsistencyLevel(String level); /** * Sets write consistency level.
* Can be one of those consistency levels defined in {@link org.apache.cassandra.db.ConsistencyLevel}.
* Defaults to {@link org.apache.cassandra.db.ConsistencyLevel#LOCAL_ONE}. * * @param level the write consistency level to use. * @return this configuration object. */ public abstract ICassandraDeepJobConfig writeConsistencyLevel(String level); /** * Returns the configured read consistency level. * * @return the read consistency level. */ public abstract String getReadConsistencyLevel(); /** * Returns the configured write consistency level. * * @return the write consistency level. */ public abstract String getWriteConsistencyLevel(); /** * Sets the token range bisect factor. * The provided number must be a power of two. * Defaults to 1. * * @param bisectFactor the bisect factor to use. * @return this configuration object. */ public abstract ICassandraDeepJobConfig bisectFactor(int bisectFactor); /** * @return the configured bisect factor. */ public int getBisectFactor(); /** * Sets the underlying datastore table or collection from which data will be read from. * * @param table the table name. * @return this configuration object. */ public abstract ICassandraDeepJobConfig table(String table); /** * Returns the name of the configured column family. * Column family name is case sensitive. * * @return the table name. */ public abstract String getTable(); /** * Sets the cassandra CF from which data will be read from. * Column family name is case sensitive. * * @param columnFamily the table name data will be fetched from. * @return this configuration object. */ public abstract ICassandraDeepJobConfig columnFamily(String columnFamily); /** * Returns whether this configuration config is suitable for writing out data to the datastore. * * @return true if this configuratuon object is suitable for writing to cassandra, false otherwise. */ public abstract Boolean getIsWriteConfig(); /** * Sets the batch size used to write to Cassandra. * * @return this object. */ public abstract ICassandraDeepJobConfig batchSize(int batchSize); /** * Returns the batch size used for writing objects to the underying Cassandra datastore. * * @return the batch size. */ public abstract int getBatchSize(); /** * Returns whether or not in this configuration object we specify to automatically create * the output column family. * * @return true if this configuration object has been configured to create missing tables on writes. */ public abstract Boolean isCreateTableOnWrite(); /** * Whether or not to create the output column family on write.
. *

* Defaults to FALSE. * * @param createTableOnWrite a boolean that tells this configuration obj to create missing tables on write. * @return this configuration object. */ public abstract ICassandraDeepJobConfig createTableOnWrite(Boolean createTableOnWrite); /** * Returns the name of the configured column family. * * @return the configured column family. */ public abstract String getColumnFamily(); /** * {@inheritDoc} */ @Override public abstract ICassandraDeepJobConfig host(String hostname); /** * {@inheritDoc} */ @Override public abstract ICassandraDeepJobConfig password(String password); /** * {@inheritDoc} */ @Override public abstract ICassandraDeepJobConfig username(String username); /** * {@inheritDoc} */ @Override public abstract ICassandraDeepJobConfig inputColumns(String... columns); /** * {@inheritDoc} */ @Override public abstract ICassandraDeepJobConfig initialize(); /** * {@inheritDoc} */ @Override public abstract ICassandraDeepJobConfig filterByField(String filterColumnName, Serializable filterValue); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy