Package com.hazelcast.client.impl

Examples of com.hazelcast.client.impl.ClientEngineImpl


    }

    public static SimpleClient newClient(Node node) throws IOException {
        if (node.isActive()) {
            if (TestEnvironment.isMockNetwork()) {
                ClientEngineImpl engine = node.clientEngine;
                return new MockSimpleClient(engine, node.getSerializationService());
            } else {
                return new SocketSimpleClient(node);
            }
        }
View Full Code Here


        this.sXid = sXid;
    }

    @Override
    public Object innerCall() throws Exception {
        ClientEngineImpl clientEngine = getService();
        ClientEndpoint endpoint = getEndpoint();
        TransactionManagerServiceImpl transactionManager =
                (TransactionManagerServiceImpl) clientEngine.getTransactionManagerService();
        TransactionContext context = transactionManager.newClientTransactionContext(options, endpoint.getUuid());
        if (sXid != null) {
            Transaction transaction = TransactionAccessor.getTransaction(context);
            transactionManager.addManagedTransaction(sXid, transaction);
        }
View Full Code Here

        this.clientUuid = clientUuid;
    }

    @Override
    public void run() throws Exception {
        ClientEngineImpl service = getService();
        String memberUuid = getCallerUuid();
        ClientEngineImpl engine = getService();
        Set<ClientEndpoint> endpoints = engine.getEndpointManager().getEndpoints(clientUuid);
        for (ClientEndpoint endpoint : endpoints) {
            ClientPrincipal principal = new ClientPrincipal(clientUuid, memberUuid);
            endpoint.authenticated(principal);
        }
        service.addOwnershipMapping(clientUuid, memberUuid);
View Full Code Here

    public void run() throws Exception {
        if (mappings == null) {
            return;
        }

        ClientEngineImpl engine = getService();
        for (Map.Entry<String, String> entry : mappings.entrySet()) {
            engine.addOwnershipMapping(entry.getKey(), entry.getValue());
        }
    }
View Full Code Here

        this.clientUuid = clientUuid;
    }

    @Override
    public void run() throws Exception {
        ClientEngineImpl engine = getService();
        final ClientEndpointManager endpointManager = engine.getEndpointManager();
        Set<ClientEndpoint> endpoints = endpointManager.getEndpoints(clientUuid);
        for (ClientEndpoint endpoint : endpoints) {
            endpointManager.removeEndpoint(endpoint, true);
        }
        engine.removeOwnershipMapping(clientUuid);

        NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
        nodeEngine.onClientDisconnected(clientUuid);
        Collection<ClientAwareService> services = nodeEngine.getServices(ClientAwareService.class);
        for (ClientAwareService service : services) {
View Full Code Here

            return handleUnauthenticated();
        }
    }

    private boolean authenticate() {
        ClientEngineImpl clientEngine = getService();
        Connection connection = endpoint.getConnection();
        ILogger logger = clientEngine.getLogger(getClass());
        boolean authenticated;
        if (credentials == null) {
            authenticated = false;
            logger.severe("Could not retrieve Credentials object!");
        } else if (clientEngine.getSecurityContext() != null) {
            authenticated = authenticate(clientEngine.getSecurityContext());
        } else if (credentials instanceof UsernamePasswordCredentials) {
            UsernamePasswordCredentials usernamePasswordCredentials = (UsernamePasswordCredentials) credentials;
            authenticated = authenticate(usernamePasswordCredentials);
        } else {
            authenticated = false;
View Full Code Here

                + ", " + (authenticated ? "successfully authenticated" : "authentication failed"));
        return authenticated;
    }

    private boolean authenticate(UsernamePasswordCredentials credentials) {
        ClientEngineImpl clientEngine = getService();
        GroupConfig groupConfig = clientEngine.getConfig().getGroupConfig();
        String nodeGroupName = groupConfig.getName();
        String nodeGroupPassword = groupConfig.getPassword();
        boolean usernameMatch = nodeGroupName.equals(credentials.getUsername());
        boolean passwordMatch = nodeGroupPassword.equals(credentials.getPassword());
        return usernameMatch && passwordMatch;
View Full Code Here

    private Object handleUnauthenticated() {
        return new AuthenticationException("Invalid credentials!");
    }

    private Object handleAuthenticated() {
        ClientEngineImpl clientEngine = getService();

        if (ownerConnection) {
            final String uuid = getUuid();
            principal = new ClientPrincipal(uuid, clientEngine.getLocalMember().getUuid());
            reAuthLocal();
            Collection<MemberImpl> members = clientEngine.getClusterService().getMemberList();
            for (MemberImpl member : members) {
                if (!member.localMember()) {
                    ClientReAuthOperation op = new ClientReAuthOperation(uuid);
                    op.setCallerUuid(clientEngine.getLocalMember().getUuid());
                    operationService.send(op, member.getAddress());
                }
            }
        }

        endpoint.authenticated(principal, credentials, ownerConnection);
        clientEngine.getEndpointManager().registerEndpoint(endpoint);
        clientEngine.bind(endpoint);
        return new SerializableCollection(serializationService.toData(clientEngine.getThisAddress())
                , serializationService.toData(principal));
    }
View Full Code Here

            nodeExtension.beforeStart(this);

            serializationService = nodeExtension.createSerializationService();
            securityContext = config.getSecurityConfig().isEnabled() ? nodeExtension.getSecurityContext() : null;
            nodeEngine = new NodeEngineImpl(this);
            clientEngine = new ClientEngineImpl(this);
            connectionManager = nodeContext.createConnectionManager(this, serverSocketChannel);
            partitionService = new InternalPartitionServiceImpl(this);
            clusterService = new ClusterServiceImpl(this);
            textCommandService = new TextCommandServiceImpl(this);
            nodeExtension.printNodeInfo(this);
View Full Code Here

TOP

Related Classes of com.hazelcast.client.impl.ClientEngineImpl

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.