Package org.apache.cassandra.config

Examples of org.apache.cassandra.config.ConfigurationException


    {
        super(System.nanoTime());

        KSMetaData ksm = Schema.instance.getTableDefinition(ksName);
        if (ksm == null)
            throw new ConfigurationException("Can't drop ColumnFamily: No such keyspace '" + ksName + "'.");
        else if (!ksm.cfMetaData().containsKey(cfName))
            throw new ConfigurationException(String.format("Can't drop ColumnFamily (ks=%s, cf=%s) : Not defined in that keyspace.", ksName, cfName));

        this.ksName = ksName;
        this.cfName = cfName;
    }
View Full Code Here


    public AddKeyspace(KSMetaData ksm) throws ConfigurationException
    {
        super(System.nanoTime());

        if (Schema.instance.getTableDefinition(ksm.name) != null)
            throw new ConfigurationException(String.format("Can't add Keyspace '%s': Already exists.", ksm.name));
        else if (!Migration.isLegalName(ksm.name))
            throw new ConfigurationException(String.format("Can't add Keyspace '%s': Invalid name.", ksm.name));
        for (CFMetaData cfm : ksm.cfMetaData().values())
            if (!Migration.isLegalName(cfm.cfName))
                throw new ConfigurationException(String.format("Can't add Keyspace '%s': Invalid ColumnFamily name '%s'.", ksm.name, cfm.cfName));

        this.ksm = ksm;
    }
View Full Code Here

    {
        super(System.nanoTime());

        KSMetaData ksm = Schema.instance.getTableDefinition(name);
        if (ksm == null)
            throw new ConfigurationException("Can't drop keyspace '" + name + "' because it does not exist.");

        this.name = name;
    }
View Full Code Here

    public UpdateColumnFamily(CfDef newState) throws ConfigurationException
    {
        super(System.nanoTime());

        if (Schema.instance.getCFMetaData(newState.keyspace, newState.name) == null)
            throw new ConfigurationException(String.format("(ks=%s, cf=%s) cannot be updated because it doesn't exist.", newState.keyspace, newState.name));

        this.newState = newState;
    }
View Full Code Here

    public UpdateKeyspace(KsDef newState) throws ConfigurationException
    {
        super(System.nanoTime());

        if (newState.isSetCf_defs() && newState.getCf_defs().size() > 0)
            throw new ConfigurationException("Updated keyspace must not contain any column families.");

        if (Schema.instance.getKSMetaData(newState.name) == null)
            throw new ConfigurationException(newState.name + " cannot be updated because it doesn't exist.");

        this.newState = newState;
    }
View Full Code Here

        super(System.nanoTime());

        KSMetaData ksm = Schema.instance.getTableDefinition(cfm.ksName);

        if (ksm == null)
            throw new ConfigurationException(String.format("Can't add ColumnFamily '%s' to Keyspace '%s': Keyspace does not exist.", cfm.cfName, cfm.ksName));
        else if (ksm.cfMetaData().containsKey(cfm.cfName))
            throw new ConfigurationException(String.format("Can't add ColumnFamily '%s' to Keyspace '%s': Already exists.", cfm.cfName, cfm.ksName));
        else if (!Migration.isLegalName(cfm.cfName))
            throw new ConfigurationException("Can't add ColumnFamily '%s' to Keyspace '%s': Invalid ColumnFamily name.");

        this.cfm = cfm;
    }
View Full Code Here

        {
            return (Class<? extends ICompressor>)Class.forName(className);
        }
        catch (Exception e)
        {
            throw new ConfigurationException("Could not create Compression for type " + className, e);
        }
    }
View Full Code Here

            Method method = compressorClass.getMethod("create", Map.class);
            return (ICompressor)method.invoke(null, compressionOptions);
        }
        catch (NoSuchMethodException e)
        {
            throw new ConfigurationException("create method not found", e);
        }
        catch (SecurityException e)
        {
            throw new ConfigurationException("Access forbiden", e);
        }
        catch (IllegalAccessException e)
        {
            throw new ConfigurationException("Cannot access method create in " + compressorClass.getName(), e);
        }
        catch (InvocationTargetException e)
        {
            Throwable cause = e.getCause();
            throw new ConfigurationException(String.format("%s.create() threw an error: %s",
                                             compressorClass.getSimpleName(),
                                             cause == null ? e.getClass().getName() + " " + e.getMessage() : cause.getClass().getName() + " " + cause.getMessage()),
                                             e);
        }
        catch (ExceptionInInitializerError e)
        {
            throw new ConfigurationException("Cannot initialize class " + compressorClass.getName());
        }
    }
View Full Code Here

        try
        {
            int parsed = Integer.parseInt(chLengthKB);
            if (parsed > Integer.MAX_VALUE / 1024)
                throw new ConfigurationException("Value of " + CHUNK_LENGTH_KB + " is too large (" + parsed + ")");
            return 1024 * parsed;
        }
        catch (NumberFormatException e)
        {
            throw new ConfigurationException("Invalid value for " + CHUNK_LENGTH_KB, e);
        }
    }
View Full Code Here

    {
        // if chunk length was not set (chunkLength == null), this is fine, default will be used
        if (chunkLength != null)
        {
            if (chunkLength <= 0)
                throw new ConfigurationException("Invalid negative or null " + CHUNK_LENGTH_KB);

            int c = chunkLength;
            boolean found = false;
            while (c != 0)
            {
                if ((c & 0x01) != 0)
                {
                    if (found)
                        throw new ConfigurationException(CHUNK_LENGTH_KB + " must be a power of 2");
                    else
                        found = true;
                }
                c >>= 1;
            }
        }

        if (crcChance > 1.0d || crcChance < 0.0d)
            throw new ConfigurationException("crc_check_chance should be between 0.0 to 1.0");
    }
View Full Code Here

TOP

Related Classes of org.apache.cassandra.config.ConfigurationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.