Package net.jini.discovery

Examples of net.jini.discovery.DiscoveryManagement


            logger.warn("JoinManager is null");
        }
    }

    public String[] getLookupGroups() {
        DiscoveryManagement dm;
        JoinManager mgr = service.getJoinManager();
        if(mgr!=null) {
            dm = mgr.getDiscoveryManager();
        } else {
            try {
View Full Code Here


    public void addLookupGroups(String[] groups) {
        JoinManager mgr = service.getJoinManager();
        if(mgr!=null) {
            try {
                DiscoveryManagement dm = mgr.getDiscoveryManager();
                DiscoveryGroupManagement dgm = (DiscoveryGroupManagement)dm;
                dgm.addGroups(groups);               
                if(snapshotHandler!=null) {
                    try {
                        snapshotHandler.takeSnapshot();
View Full Code Here

    public void removeLookupGroups(String[] groups) {
        JoinManager mgr = service.getJoinManager();
        if(mgr!=null) {
            try {
                DiscoveryManagement dm = mgr.getDiscoveryManager();
                DiscoveryGroupManagement dgm = (DiscoveryGroupManagement)dm;
                dgm.removeGroups(groups);
                if(snapshotHandler!=null) {
                    try {
                        snapshotHandler.takeSnapshot();
View Full Code Here

    public void setLookupGroups(String[] groups) {
        JoinManager mgr = service.getJoinManager();
        if(mgr!=null) {
            try {
                DiscoveryManagement dm = mgr.getDiscoveryManager();
                DiscoveryGroupManagement dgm = (DiscoveryGroupManagement)dm;
                dgm.setGroups(groups);
                if(snapshotHandler!=null) {
                    try {
                        snapshotHandler.takeSnapshot();
View Full Code Here

            }
        }
    }

    public LookupLocator[] getLookupLocators() {
        DiscoveryManagement dm;
        JoinManager mgr = service.getJoinManager();
        if(mgr!=null) {
            dm = mgr.getDiscoveryManager();
        } else {
            try {
View Full Code Here

    }

    public void addLookupLocators(LookupLocator[] locators) {
        JoinManager mgr = service.getJoinManager();
        if(mgr!=null) {
            DiscoveryManagement dm = mgr.getDiscoveryManager();
            DiscoveryLocatorManagement dlm = (DiscoveryLocatorManagement)dm;
            dlm.addLocators(locators);
            if(snapshotHandler!=null) {
                try {
                    snapshotHandler.takeSnapshot();
View Full Code Here

    }

    public void removeLookupLocators(LookupLocator[] locators) {
        JoinManager mgr = service.getJoinManager();
        if(mgr!=null) {
            DiscoveryManagement dm = mgr.getDiscoveryManager();
            DiscoveryLocatorManagement dlm = (DiscoveryLocatorManagement)dm;
            dlm.removeLocators(locators);
            if(snapshotHandler!=null) {
                try {
                    snapshotHandler.takeSnapshot();
View Full Code Here

    }

    public void setLookupLocators(LookupLocator[] locators) {
        JoinManager mgr = service.getJoinManager();
        if(mgr!=null) {
            DiscoveryManagement dm = mgr.getDiscoveryManager();
            DiscoveryLocatorManagement dlm = (DiscoveryLocatorManagement)dm;
            dlm.setLocators(locators);
            if(snapshotHandler!=null) {
                try {
                    snapshotHandler.takeSnapshot();
View Full Code Here

                                                            new BasicProxyPreparer());
        int serviceInfoPoolSize = (Integer) config.getEntry(CLI.CONFIG_COMPONENT, "serviceInfoPoolSize", int.class, 5);
        serviceInfoFetchPool = Executors.newFixedThreadPool(serviceInfoPoolSize);

        DiscoveryManagementPool discoPool = DiscoveryManagementPool.getInstance();
        DiscoveryManagement discoMgr = discoPool.getDiscoveryManager("cli", groups, locators, null, config);
        //LookupDiscoveryManager discoMgr =
        //    new LookupDiscoveryManager(groups, locators, null, lookupConfig);
        recordingDiscoveryListener = new RecordingDiscoveryListener(discoMgr);
        discoMgr.addDiscoveryListener(recordingDiscoveryListener);
        sdm = new ServiceDiscoveryManager(discoMgr, new LeaseRenewalManager());

        allServices = new ServiceTemplate(null, null, null);
        cybernodeServices = new ServiceTemplate(null, new Class[] {Cybernode.class}, null);
        monitorServices = new ServiceTemplate(null, new Class[] {ProvisionMonitor.class}, null);
View Full Code Here

                            groups = DiscoveryGroupManagement.ALL_GROUPS;
                        } else {
                            instance.settings.put(GROUPS, Formatter.toArray(value));
                            groups = Formatter.toArray(value);
                        }
                        DiscoveryManagement dMgr =
                            instance.getServiceFinder().getDiscoveryManagement();
                        if(dMgr instanceof DiscoveryGroupManagement) {
                            try {
                                ((DiscoveryGroupManagement)dMgr).setGroups(groups);
                            } catch(Throwable t) {
                                out.println("Exception setting groups : "+
                                            t.getMessage());
                            }
                        }
                    } else if(token.equals(LOCATORS)) {
                        String locator = tok.nextToken();
                        DiscoveryManagement dMgr =
                            instance.getServiceFinder().getDiscoveryManagement();
                        if(dMgr instanceof DiscoveryLocatorManagement) {
                            if(locator.equalsIgnoreCase("null")) {
                                ((DiscoveryLocatorManagement)dMgr).
                                    setLocators(new LookupLocator[0]);
                            } else {
                                try {
                                    ((DiscoveryLocatorManagement)dMgr).
                                        addLocators(new LookupLocator[]{
                                            new LookupLocator(locator)});
                                } catch(MalformedURLException e) {
                                    out.println("Bad locator format");
                                }
                            }
                        }
                    } else if(token.equals(SYS_PROPS)) {
                        String property = tok.nextToken();
                        StringTokenizer tok1 =
                            new StringTokenizer(property, "= ");
                        if(tok1.countTokens()<2)
                            return("Invalid system property definition "+
                                   property);
                        String name = tok1.nextToken();
                        String value = tok1.nextToken();
                        Properties props =
                            (Properties)instance.settings.get(SYS_PROPS);
                        props.put(name, value);
                        System.setProperty(name, value);
                        instance.settings.put(SYS_PROPS, props);

                    } else if(token.equals(DISCOVERY_TIMEOUT)) {
                        String timeout = tok.nextToken();
                        try {
                            long l = Long.parseLong(timeout);
                            instance.settings.put(DISCOVERY_TIMEOUT, l);
                        } catch (NumberFormatException e) {
                            return("Invalid discovery-timeout "+timeout);
                        }
                    } else {
                        out.println("Invalid property "+token);
                    }
                }
            } else {
                String[] groups = (String[])instance.settings.get(GROUPS);
                if(groups == DiscoveryGroupManagement.ALL_GROUPS)
                    groups = new String[]{"ALL_GROUPS"};

                buffer.append(GROUPS + "\t\t").append(Formatter.fromArray(groups));
                buffer.append("\n");
                DiscoveryManagement dMgr =
                    instance.getServiceFinder().getDiscoveryManagement();
                LookupLocator[] locators = null;
                if(dMgr instanceof DiscoveryLocatorManagement) {
                    locators =
                        ((DiscoveryLocatorManagement)dMgr).getLocators();
View Full Code Here

TOP

Related Classes of net.jini.discovery.DiscoveryManagement

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.