Package com.trendmicro.codi

Examples of com.trendmicro.codi.ZNode


            }

            myConsole.logResponse("starting `%s' ... ", broker_ip);
            String lockPath = "/locks/brk_" + broker_ip;
            ZLock brokerLock = new ZLock(lockPath);
            ZNode brokerNode = new ZNode("/broker/" + broker_ip);
            try{

                brokerLock.acquire(LockType.WRITE_LOCK);
                ZooKeeperInfo.Broker.Builder brkBuilder = ZooKeeperInfo.Broker.newBuilder();
                TextFormat.merge(new String(brokerNode.getContent()), brkBuilder);
                brkBuilder.clearStatus().setStatus(ZooKeeperInfo.Broker.Status.ONLINE);
                brokerNode.setContent(brkBuilder.build().toString().getBytes());
                myConsole.logResponseNL("success");
            }
            catch(Exception e){
                myConsole.logResponseNL("failed");
                myConsole.logResponseNL(e.toString());
View Full Code Here


            }

            myConsole.logResponse("stopping `%s' ...%n", broker_ip);
            String lockPath = "/locks/brk_" + broker_ip;
            ZLock brokerLock = new ZLock(lockPath);
            ZNode brokerNode = new ZNode("/broker/" + broker_ip);
            try {
                brokerLock.acquire(LockType.WRITE_LOCK);
                ZooKeeperInfo.Broker.Builder brkBuilder = ZooKeeperInfo.Broker.newBuilder();
                TextFormat.merge(new String(brokerNode.getContent()), brkBuilder);
                brkBuilder.clearStatus().setStatus(ZooKeeperInfo.Broker.Status.OFFLINE);
                brokerNode.setContent(brkBuilder.build().toString().getBytes());

                if(availBrkCnt > 1) {
                    BrokerSpy brokerSpy = new BrokerSpy(broker_ip);
                    ArrayList<Exchange> exchangeList = brokerSpy.getAllExchangeMetadata();
View Full Code Here

                return;
            }
            broker = builder.build();

            try {
                new ZNode("/broker/" + broker_ip).setContent(broker.toString().getBytes());
                myConsole.logResponse("broker `%s' reserved = %b%n", broker_ip, broker.getReserved());
            }
            catch(Exception e) {
                myConsole.logResponseNL(e.getMessage());
            }
View Full Code Here

    public String toSubgraph() throws JsonSyntaxException, CODIException {
        StringBuilder sb = new StringBuilder();

        for(String processorName : processors) {
            ZNode node = new ZNode("/global/graph/processor/" + processorName);
            ProcessorModel processor = new Gson().fromJson(node.getContentString(), ProcessorModel.class);
            sb.append(processor.toSubgraph(RenderView.GRAPH_EDITOR));
        }

        for(String rule : rules) {
            String[] tmpArray = rule.split("-");
View Full Code Here

        }

        private void bridge() {
            try {
                myConsole.logResponseNL("==> all tme-bridge(s)");
                List<String> all_bridge = new ZNode("/bridge").getChildren();
                boolean showed = false;
                for(String b: all_bridge) {
                    List<String> masters = new ZNode("/bridge/" + b + "/master").getChildren();
                    List<String> slaves = new ZNode("/bridge/" + b + "/slave").getChildren();
                    if(masters.size() + slaves.size() > 0) {
                        myConsole.logResponse("    %s:%n", b);
                        for(String m: masters)
                            myConsole.logResponse("        %s (master)%n", m);
                        for(String m: slaves)
View Full Code Here

        }

        private void mistd() {
            try {
                myConsole.logResponseNL("==> all mistd clients");
                List<String> all_mistd = new ZNode("/local/mist_client").getChildren();
                if(all_mistd.size() == 0)
                    myConsole.logResponseNL("    no clients");
                else {
                    for(String m: all_mistd)
                        myConsole.logResponse("    %s%n", m);
View Full Code Here

            if(!Utils.checkSocketConnectable(host))
                return false;
            String zkPath = "/ZK_TEST_NODE";
            String zkData = "02a7e44daac8046f43de84b2546a4d63";
            try {
                ZNode node = new ZNode(zkPath);
                node.create(false, zkData.getBytes());
                String res = new String(node.getContent());
                node.delete();
                if(res.compareTo(zkData) == 0)
                    return true;
                else
                    return false;
            }
View Full Code Here

            configs.add(ZNODE_MAIL_SENDER);

            boolean showed = false;
            for(String key: configs) {
                try {
                    String value = new String(new ZNode(key).getContent()).trim();
                    if(value.length() > 0) {
                        if(key.equals(ZNODE_PORTAL_DB))
                            myConsole.logResponseNL("%-24s => %s", key, "{ " + value.replace("\n", "; ") + " }");
                        else
                            myConsole.logResponseNL("%-24s => %s", key, value);
View Full Code Here

    @InjectParam GraphEditorMain graphEditor;

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public List<String> getProcessorList() throws CODIException {
        return new ZNode("/global/graph/processor").getChildren();
    }
View Full Code Here

   
    @Path("/{name}")
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public ProcessorModel getProcessor(@PathParam("name") String name) throws JAXBException, CODIException {
        ZNode node = new ZNode("/global/graph/processor/" + name);
        return new Gson().fromJson(node.getContentString(), ProcessorModel.class);
    }
View Full Code Here

TOP

Related Classes of com.trendmicro.codi.ZNode

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.