private ResultMessage resultMessage(List<PermissionDetails> details) { if (details.isEmpty()) return new ResultMessage.Void(); ResultSet result = new ResultSet(metadata); for (PermissionDetails pd : details) { result.addColumnValue(UTF8Type.instance.decompose(pd.grantee)); result.addColumnValue(UTF8Type.instance.decompose(pd.grantee)); result.addColumnValue(UTF8Type.instance.decompose(pd.resource.toString())); result.addColumnValue(UTF8Type.instance.decompose(pd.permission.toString())); } return new ResultMessage.Rows(result); } }
public ResultMessage execute(QueryState state, QueryOptions options, long queryStartNanoTime) throws RequestValidationException { // If an IF [NOT] EXISTS clause was used, this may not result in an actual schema change. To avoid doing // extra work in the drivers to handle schema changes, we return an empty message in this case. (CASSANDRA-7600) Event.SchemaChange ce = announceMigration(state, false); if (ce == null) return new ResultMessage.Void(); // when a schema alteration results in a new db object being created, we grant permissions on the new // object to the user performing the request if: // * the user is not anonymous // * the configured IAuthorizer supports granting of permissions (not all do, AllowAllAuthorizer doesn't and // custom external implementations may not) AuthenticatedUser user = state.getClientState().getUser(); if (user != null && !user.isAnonymous() && ce.change == Event.SchemaChange.Change.CREATED) { try { grantPermissionsToCreator(state); } catch (UnsupportedOperationException e) { // not a problem, grant is an optional method on IAuthorizer } } return new ResultMessage.SchemaChange(ce); }
public ResultMessage execute(QueryState state, QueryOptions options, long queryStartNanoTime) throws RequestValidationException { // If an IF [NOT] EXISTS clause was used, this may not result in an actual schema change. To avoid doing // extra work in the drivers to handle schema changes, we return an empty message in this case. (CASSANDRA-7600) Event.SchemaChange ce = announceMigration(state, false); if (ce == null) return new ResultMessage.Void(); // when a schema alteration results in a new db object being created, we grant permissions on the new // object to the user performing the request if: // * the user is not anonymous // * the configured IAuthorizer supports granting of permissions (not all do, AllowAllAuthorizer doesn't and // custom external implementations may not) AuthenticatedUser user = state.getClientState().getUser(); if (user != null && !user.isAnonymous() && ce.change == Event.SchemaChange.Change.CREATED) { try { grantPermissionsToCreator(state); } catch (UnsupportedOperationException e) { // not a problem, grant is an optional method on IAuthorizer } } return new ResultMessage.SchemaChange(ce); }
public ResultMessage execute(QueryState state, QueryOptions options, long queryStartNanoTime) throws RequestValidationException { // If an IF [NOT] EXISTS clause was used, this may not result in an actual schema change. To avoid doing // extra work in the drivers to handle schema changes, we return an empty message in this case. (CASSANDRA-7600) Event.SchemaChange ce = announceMigration(state, false); if (ce == null) return new ResultMessage.Void(); // when a schema alteration results in a new db object being created, we grant permissions on the new // object to the user performing the request if: // * the user is not anonymous // * the configured IAuthorizer supports granting of permissions (not all do, AllowAllAuthorizer doesn't and // custom external implementations may not) AuthenticatedUser user = state.getClientState().getUser(); if (user != null && !user.isAnonymous() && ce.change == Event.SchemaChange.Change.CREATED) { try { grantPermissionsToCreator(state); } catch (UnsupportedOperationException e) { // not a problem, grant is an optional method on IAuthorizer } } return new ResultMessage.SchemaChange(ce); }
private ResultMessage resultMessage(List<PermissionDetails> details) { if (details.isEmpty()) return new ResultMessage.Void(); ResultSet result = new ResultSet(metadata); for (PermissionDetails pd : details) { result.addColumnValue(UTF8Type.instance.decompose(pd.grantee)); result.addColumnValue(UTF8Type.instance.decompose(pd.grantee)); result.addColumnValue(UTF8Type.instance.decompose(pd.resource.toString())); result.addColumnValue(UTF8Type.instance.decompose(pd.permission.toString())); } return new ResultMessage.Rows(result); } }
public ResultMessage executeInternal(QueryState state, QueryOptions options) { try { boolean didChangeSchema = announceMigration(true); return didChangeSchema ? new ResultMessage.SchemaChange(changeEvent()) : new ResultMessage.Void(); } catch (RequestValidationException e) { throw new RuntimeException(e); } } }
public ResultMessage executeInternal(QueryState state, QueryOptions options) { Event.SchemaChange ce = announceMigration(state, true); return ce == null ? new ResultMessage.Void() : new ResultMessage.SchemaChange(ce); } }
private ResultMessage execute(QueryState queryState, BatchQueryOptions options, boolean local, long now, long queryStartNanoTime) throws RequestExecutionException, RequestValidationException { if (options.getConsistency() == null) throw new InvalidRequestException("Invalid empty consistency level"); if (options.getSerialConsistency() == null) throw new InvalidRequestException("Invalid empty serial consistency level"); if (hasConditions) return executeWithConditions(options, queryState, queryStartNanoTime); executeWithoutConditions(getMutations(options, local, now, queryStartNanoTime), options.getConsistency(), queryStartNanoTime); return new ResultMessage.Void(); }
private ResultMessage execute(QueryState queryState, BatchQueryOptions options, boolean local, long now) throws RequestExecutionException, RequestValidationException { if (options.getConsistency() == null) throw new InvalidRequestException("Invalid empty consistency level"); if (options.getSerialConsistency() == null) throw new InvalidRequestException("Invalid empty serial consistency level"); if (hasConditions) return executeWithConditions(options, queryState); executeWithoutConditions(getMutations(options, local, now), options.getConsistency()); return new ResultMessage.Void(); }
private ResultMessage resultMessage(Set<RoleResource> roles) { if (roles.isEmpty()) return new ResultMessage.Void(); List<RoleResource> sorted = Lists.newArrayList(roles); Collections.sort(sorted); return formatResults(sorted); }
public ResultMessage processStatement(CQLStatement statement, QueryState queryState, QueryOptions options) throws RequestExecutionException, RequestValidationException { logger.trace("Process {} @CL.{}", statement, options.getConsistency()); ClientState clientState = queryState.getClientState(); statement.checkAccess(clientState); statement.validate(clientState); ResultMessage result = statement.execute(queryState, options); return result == null ? new ResultMessage.Void() : result; }
private ResultMessage resultMessage(List<PermissionDetails> details) { if (details.isEmpty()) return new ResultMessage.Void(); ResultSet result = new ResultSet(metadata); for (PermissionDetails pd : details) { result.addColumnValue(UTF8Type.instance.decompose(pd.grantee)); result.addColumnValue(UTF8Type.instance.decompose(pd.grantee)); result.addColumnValue(UTF8Type.instance.decompose(pd.resource.toString())); result.addColumnValue(UTF8Type.instance.decompose(pd.permission.toString())); } return new ResultMessage.Rows(result); } }
public ResultMessage processStatement(CQLStatement statement, QueryState queryState, QueryOptions options, long queryStartNanoTime) throws RequestExecutionException, RequestValidationException { logger.trace("Process {} @CL.{}", statement, options.getConsistency()); ClientState clientState = queryState.getClientState(); statement.checkAccess(clientState); statement.validate(clientState); ResultMessage result = statement.execute(queryState, options, queryStartNanoTime); return result == null ? new ResultMessage.Void() : result; }
public ResultMessage executeInternal(QueryState queryState, QueryOptions options) throws RequestValidationException, RequestExecutionException { if (hasConditions) return executeInternalWithConditions(BatchQueryOptions.withoutPerStatementVariables(options), queryState); executeInternalWithoutCondition(queryState, options, System.nanoTime()); return new ResultMessage.Void(); }
public ResultMessage execute(QueryState state, QueryOptions options) throws RequestValidationException { // If an IF [NOT] EXISTS clause was used, this may not result in an actual schema change. To avoid doing // extra work in the drivers to handle schema changes, we return an empty message in this case. (CASSANDRA-7600) boolean didChangeSchema = announceMigration(false); return didChangeSchema ? new ResultMessage.SchemaChange(changeEvent()) : new ResultMessage.Void(); }
private ResultMessage execute(QueryState queryState, BatchQueryOptions options, boolean local, long now, long queryStartNanoTime) throws RequestExecutionException, RequestValidationException { if (options.getConsistency() == null) throw new InvalidRequestException("Invalid empty consistency level"); if (options.getSerialConsistency() == null) throw new InvalidRequestException("Invalid empty serial consistency level"); if (hasConditions) return executeWithConditions(options, queryState, queryStartNanoTime); executeWithoutConditions(getMutations(options, local, now, queryStartNanoTime), options.getConsistency(), queryStartNanoTime); return new ResultMessage.Void(); }
public ResultMessage executeInternal(QueryState state, QueryOptions options) { Event.SchemaChange ce = announceMigration(state, true); return ce == null ? new ResultMessage.Void() : new ResultMessage.SchemaChange(ce); } }
private ResultMessage resultMessage(Set<RoleResource> roles) { if (roles.isEmpty()) return new ResultMessage.Void(); List<RoleResource> sorted = Lists.newArrayList(roles); Collections.sort(sorted); return formatResults(sorted); }
public ResultMessage executeInternal(QueryState queryState, QueryOptions options) throws RequestValidationException, RequestExecutionException { if (hasConditions) return executeInternalWithConditions(BatchQueryOptions.withoutPerStatementVariables(options), queryState); executeInternalWithoutCondition(queryState, options, System.nanoTime()); return new ResultMessage.Void(); }
public ResultMessage executeInternal(QueryState state, QueryOptions options) { Event.SchemaChange ce = announceMigration(state, true); return ce == null ? new ResultMessage.Void() : new ResultMessage.SchemaChange(ce); } }