Search in sources :

Example 1 with UpdatePermissionConfigOperation

use of com.hazelcast.internal.management.operation.UpdatePermissionConfigOperation in project hazelcast by hazelcast.

the class OnJoinOp method run.

@Override
public void run() throws Exception {
    if (!operations.isEmpty()) {
        SecurityConfig securityConfig = getNodeEngine().getConfig().getSecurityConfig();
        boolean runPermissionUpdates = securityConfig.getOnJoinPermissionOperation() == OnJoinPermissionOperationName.RECEIVE;
        for (Operation op : operations) {
            if ((op instanceof UpdatePermissionConfigOperation) && !runPermissionUpdates) {
                continue;
            }
            try {
                // not running via OperationService since we don't want any restrictions like cluster state check etc.
                runDirect(op);
            } catch (Exception e) {
                getLogger().warning("Error while running post-join operation: " + op, e);
            }
        }
        final ClusterService clusterService = getService();
        // if executed on master, broadcast to all other members except sender (joining member)
        if (clusterService.isMaster()) {
            final OperationService operationService = getNodeEngine().getOperationService();
            for (Member member : clusterService.getMembers()) {
                if (!member.localMember() && !member.getUuid().equals(getCallerUuid())) {
                    OnJoinOp operation = new OnJoinOp(operations);
                    operationService.invokeOnTarget(getServiceName(), operation, member.getAddress());
                }
            }
        }
    }
}
Also used : ClusterService(com.hazelcast.internal.cluster.ClusterService) SecurityConfig(com.hazelcast.config.SecurityConfig) UpdatePermissionConfigOperation(com.hazelcast.internal.management.operation.UpdatePermissionConfigOperation) Operation(com.hazelcast.spi.impl.operationservice.Operation) UpdatePermissionConfigOperation(com.hazelcast.internal.management.operation.UpdatePermissionConfigOperation) UrgentSystemOperation(com.hazelcast.spi.impl.operationservice.UrgentSystemOperation) OperationService(com.hazelcast.spi.impl.operationservice.OperationService) Member(com.hazelcast.cluster.Member) IOException(java.io.IOException)

Example 2 with UpdatePermissionConfigOperation

use of com.hazelcast.internal.management.operation.UpdatePermissionConfigOperation in project hazelcast by hazelcast.

the class ManagementDataSerializerHook method createFactory.

@Override
@SuppressWarnings("unchecked")
public DataSerializableFactory createFactory() {
    ConstructorFunction<Integer, IdentifiedDataSerializable>[] constructors = new ConstructorFunction[LEN];
    constructors[UPDATE_MAP_CONFIG] = arg -> new UpdateMapConfigOperation();
    constructors[SET_LICENSE] = arg -> new SetLicenseOperation();
    constructors[CHANGE_CLUSTER_STATE] = arg -> new ChangeClusterStateOperation();
    constructors[UPDATE_PERMISSION_CONFIG_OPERATION] = arg -> new UpdatePermissionConfigOperation();
    constructors[RELOAD_CONFIG_OPERATION] = arg -> new ReloadConfigOperation();
    constructors[UPDATE_CONFIG_OPERATION] = arg -> new UpdateConfigOperation();
    return new ArrayDataSerializableFactory(constructors);
}
Also used : UpdatePermissionConfigOperation(com.hazelcast.internal.management.operation.UpdatePermissionConfigOperation) SetLicenseOperation(com.hazelcast.internal.management.operation.SetLicenseOperation) ReloadConfigOperation(com.hazelcast.internal.management.operation.ReloadConfigOperation) UpdateConfigOperation(com.hazelcast.internal.management.operation.UpdateConfigOperation) UpdateMapConfigOperation(com.hazelcast.internal.management.operation.UpdateMapConfigOperation) ArrayDataSerializableFactory(com.hazelcast.internal.serialization.impl.ArrayDataSerializableFactory) ConstructorFunction(com.hazelcast.internal.util.ConstructorFunction) ChangeClusterStateOperation(com.hazelcast.internal.management.operation.ChangeClusterStateOperation)

Aggregations

UpdatePermissionConfigOperation (com.hazelcast.internal.management.operation.UpdatePermissionConfigOperation)2 Member (com.hazelcast.cluster.Member)1 SecurityConfig (com.hazelcast.config.SecurityConfig)1 ClusterService (com.hazelcast.internal.cluster.ClusterService)1 ChangeClusterStateOperation (com.hazelcast.internal.management.operation.ChangeClusterStateOperation)1 ReloadConfigOperation (com.hazelcast.internal.management.operation.ReloadConfigOperation)1 SetLicenseOperation (com.hazelcast.internal.management.operation.SetLicenseOperation)1 UpdateConfigOperation (com.hazelcast.internal.management.operation.UpdateConfigOperation)1 UpdateMapConfigOperation (com.hazelcast.internal.management.operation.UpdateMapConfigOperation)1 ArrayDataSerializableFactory (com.hazelcast.internal.serialization.impl.ArrayDataSerializableFactory)1 ConstructorFunction (com.hazelcast.internal.util.ConstructorFunction)1 Operation (com.hazelcast.spi.impl.operationservice.Operation)1 OperationService (com.hazelcast.spi.impl.operationservice.OperationService)1 UrgentSystemOperation (com.hazelcast.spi.impl.operationservice.UrgentSystemOperation)1 IOException (java.io.IOException)1