Package org.apache.cassandra.exceptions

Examples of org.apache.cassandra.exceptions.InvalidRequestException


    }

    @Override
    public void alter(String username, Map<Option, Object> options) throws InvalidRequestException
    {
        throw new InvalidRequestException("ALTER USER operation is not supported by LegacyAuthenticator");
    }
View Full Code Here


    @Override
    public void grant(AuthenticatedUser performer, Set<Permission> permissions, IResource resource, String to)
    throws InvalidRequestException, UnauthorizedException
    {
        throw new InvalidRequestException("GRANT operation is not supported by LegacyAuthorizer");
    }
View Full Code Here

    @Override
    public void revoke(AuthenticatedUser performer, Set<Permission> permissions, IResource resource, String from)
    throws InvalidRequestException, UnauthorizedException
    {
        throw new InvalidRequestException("REVOKE operation is not supported by LegacyAuthorizer");
    }
View Full Code Here

    @Override
    public Set<PermissionDetails> list(AuthenticatedUser performer, Set<Permission> permissions, IResource resource, String of)
    throws InvalidRequestException, UnauthorizedException
    {
        throw new InvalidRequestException("LIST PERMISSIONS operation is not supported by LegacyAuthorizer");
    }
View Full Code Here

            {
                Term k = entry.left.prepare(keySpec);
                Term v = entry.right.prepare(valueSpec);

                if (k instanceof Term.NonTerminal || v instanceof Term.NonTerminal)
                    throw new InvalidRequestException(String.format("Invalid map literal for %s: bind variables are not supported inside collection literals", receiver));

                // We don't support values > 64K because the serialization format encode the length as an unsigned short.
                ByteBuffer keyBytes = ((Constants.Value)k).bytes;
                if (keyBytes == null)
                    throw new InvalidRequestException("null is not supported inside collections");
                if (keyBytes.remaining() > FBUtilities.MAX_UNSIGNED_SHORT)
                    throw new InvalidRequestException(String.format("Map key is too long. Map keys are limited to %d bytes but %d bytes keys provided",
                                                                    FBUtilities.MAX_UNSIGNED_SHORT,
                                                                    keyBytes.remaining()));

                ByteBuffer valueBytes = ((Constants.Value)v).bytes;
                if (valueBytes == null)
                    throw new InvalidRequestException("null is not supported inside collections");
                if (valueBytes.remaining() > FBUtilities.MAX_UNSIGNED_SHORT)
                    throw new InvalidRequestException(String.format("Map value is too long. Map values are limited to %d bytes but %d bytes value provided",
                                                                    FBUtilities.MAX_UNSIGNED_SHORT,
                                                                    valueBytes.remaining()));

                if (values.put(keyBytes, valueBytes) != null)
                    throw new InvalidRequestException(String.format("Invalid map literal: duplicate entry for key %s", entry.left));
            }
            return new Value(values);
        }
View Full Code Here

        }

        private void validateAssignableTo(ColumnSpecification receiver) throws InvalidRequestException
        {
            if (!(receiver.type instanceof MapType))
                throw new InvalidRequestException(String.format("Invalid map literal for %s of type %s", receiver, receiver.type.asCQL3Type()));

            ColumnSpecification keySpec = Maps.keySpecOf(receiver);
            ColumnSpecification valueSpec = Maps.valueSpecOf(receiver);
            for (Pair<Term.Raw, Term.Raw> entry : entries)
            {
                if (!entry.left.isAssignableTo(keySpec))
                    throw new InvalidRequestException(String.format("Invalid map literal for %s: key %s is not of type %s", receiver, entry.left, keySpec.type.asCQL3Type()));
                if (!entry.right.isAssignableTo(valueSpec))
                    throw new InvalidRequestException(String.format("Invalid map literal for %s: value %s is not of type %s", receiver, entry.right, valueSpec.type.asCQL3Type()));
            }
        }
View Full Code Here

        {
            ByteBuffer index = idx.bindAndGet(params.variables);
            ByteBuffer value = t.bindAndGet(params.variables);

            if (index == null)
                throw new InvalidRequestException("Invalid null value for list index");

            List<Pair<ByteBuffer, IColumn>> existingList = params.getPrefetchedList(rowKey, columnName.key);
            int idx = ByteBufferUtil.toInt(index);
            if (idx < 0 || idx >= existingList.size())
                throw new InvalidRequestException(String.format("List index %d out of bound, list has size %d", idx, existingList.size()));

            ByteBuffer elementName = existingList.get(idx).right.name();

            if (value == null)
            {
                cf.addColumn(params.makeTombstone(elementName));
            }
            else
            {
                // We don't support value > 64K because the serialization format encode the length as an unsigned short.
                if (value.remaining() > FBUtilities.MAX_UNSIGNED_SHORT)
                    throw new InvalidRequestException(String.format("List value is too long. List values are limited to %d bytes but %d bytes value provided",
                                                                    FBUtilities.MAX_UNSIGNED_SHORT,
                                                                    value.remaining()));

                cf.addColumn(params.makeColumn(elementName, value));
            }
View Full Code Here

        public void execute(ByteBuffer rowKey, ColumnFamily cf, ColumnNameBuilder prefix, UpdateParameters params) throws InvalidRequestException
        {
            Term.Terminal index = t.bind(params.variables);
            if (index == null)
                throw new InvalidRequestException("Invalid null value for list index");

            assert index instanceof Constants.Value;

            List<Pair<ByteBuffer, IColumn>> existingList = params.getPrefetchedList(rowKey, columnName.key);
            int idx = ByteBufferUtil.toInt(((Constants.Value)index).bytes);
            if (idx < 0 || idx >= existingList.size())
                throw new InvalidRequestException(String.format("List index %d out of bound, list has size %d", idx, existingList.size()));

            ByteBuffer elementName = existingList.get(idx).right.name();
            cf.addColumn(params.makeTombstone(elementName));
        }
View Full Code Here

    public static CFMetaData fromThrift(org.apache.cassandra.thrift.CfDef cf_def) throws InvalidRequestException, ConfigurationException
    {
        ColumnFamilyType cfType = ColumnFamilyType.create(cf_def.column_type);
        if (cfType == null)
        {
          throw new InvalidRequestException("Invalid column type " + cf_def.column_type);
        }

        applyImplicitDefaults(cf_def);

        try
View Full Code Here

     * @throws InvalidRequestException if there is no ring information available about keyspace
     */
    public List<TokenRange> describeRing(String keyspace) throws InvalidRequestException
    {
        if (keyspace == null || Table.open(keyspace).getReplicationStrategy() instanceof LocalStrategy)
            throw new InvalidRequestException("There is no ring for the keyspace: " + keyspace);

        List<TokenRange> ranges = new ArrayList<TokenRange>();
        Token.TokenFactory tf = getPartitioner().getTokenFactory();

        for (Map.Entry<Range<Token>, List<InetAddress>> entry : getRangeToAddressMap(keyspace).entrySet())
View Full Code Here

TOP

Related Classes of org.apache.cassandra.exceptions.InvalidRequestException

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.