Package com.trendmicro.mist.session

Examples of com.trendmicro.mist.session.Session


            else if(!SessionPool.pool.containsKey(sessId))
                res_builder.setSuccess(false).setException(String.format("invalid session id %d", sessId));
            else {
                Exchange exchange = new Exchange(client_config.getChannel().getName());

                Session sess = SessionPool.getOrCreateConcreteSession(sessId, client_config.getType() == GateTalk.Client.Type.CONSUMER ? GateTalk.Request.Role.SOURCE: GateTalk.Request.Role.SINK);
                if(client_config.getAction() == GateTalk.Client.Action.MOUNT) {
                    sess.addClient(client_config);
                    res_builder.setSuccess(true).setContext(String.format("exchange %s mounted", exchange.toString()));
                }
                else if(client_config.getAction() == GateTalk.Client.Action.UNMOUNT) {
                    sess.removeClient(client_config);
                    res_builder.setSuccess(true).setContext(String.format("exchange %s unmounted", exchange.getName()));
                }
            }
        }
        catch(MistException e) {
View Full Code Here


    }

    private void requestSessionDestroy(GateTalk.Request greq, GateTalk.Response.Builder res_builder) {
        int sess_id = Integer.parseInt(greq.getArgument());
        try {
            Session sess = SessionPool.getOrCreateConcreteSession(sess_id, null);
            if(sess != null) {
                if(sess instanceof ConsumerSession)
                    sess.detach(GateTalk.Request.Role.SOURCE);
                else if(sess instanceof ProducerSession)
                    sess.detach(GateTalk.Request.Role.SINK);
            }
            synchronized(SessionPool.pool) {
                SessionPool.pool.remove(sess_id);
            }
            res_builder.setSuccess(true).setContext(String.format("destroyed %d", sess_id));
View Full Code Here

    private void requestSessionCleanFree(GateTalk.Request greq, GateTalk.Response.Builder res_builder) {
        Iterator<Entry<Integer, Session>> iter = SessionPool.pool.entrySet().iterator();
        int ok_cnt = 0;
        try {
            while(iter.hasNext()) {
                Session sess = iter.next().getValue();
                if(sess == null) {
                    iter.remove();
                    ok_cnt++;
                }
                else if(!sess.isAttached()) {
                    iter.remove();
                    ok_cnt++;
                }
            }
        }
View Full Code Here

    }

    private void requestSessionInfo(GateTalk.Request greq, GateTalk.Response.Builder res_builder) {
        int sess_id = Integer.parseInt(greq.getArgument());
        try {
            Session sess = SessionPool.getOrCreateConcreteSession(sess_id, null);
            if(sess == null)
                throw new MistException("session " + sess_id + " has not been initialized yet!");
            String info = "";
            for(Client c : sess.getClientList())
                info += (c.getConnection().getActiveBroker() + " ");
            res_builder.setSuccess(true).setContext(info);
        }
        catch(MistException e) {
            res_builder.setSuccess(false).setException(e.getMessage());
View Full Code Here

    }

    private void requestClientDetach(GateTalk.Request greq, GateTalk.Response.Builder res_builder) {
        int sess_id = Integer.parseInt(greq.getArgument());
        try {
            Session sess = SessionPool.getOrCreateConcreteSession(sess_id, greq.getRole());
            sess.detach(greq.getRole());
            res_builder.setSuccess(true).setContext(String.format("detached %d", sess_id));
        }
        catch(MistException e) {
            res_builder.setSuccess(false).setException(e.getMessage());
        }
View Full Code Here

        int sess_id = Integer.parseInt(greq.getArgument());
        if(!SessionPool.pool.containsKey(sess_id))
            res_builder.setSuccess(false).setException("invalid session id " + sess_id);
        else {
            try {
                Session sess = SessionPool.getOrCreateConcreteSession(sess_id, greq.getRole());
                sess.attach(greq.getRole());
                res_builder.setSuccess(true).setContext(new Integer(sess.getCommPort()).toString());
            }
            catch(MistException e) {
                res_builder.setSuccess(false).setException(e.getMessage());
            }
        }
View Full Code Here

TOP

Related Classes of com.trendmicro.mist.session.Session

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.