當前位置: 首頁>>代碼示例>>Java>>正文


Java IConfigurationContainerAware類代碼示例

本文整理匯總了Java中org.opendaylight.controller.configuration.IConfigurationContainerAware的典型用法代碼示例。如果您正苦於以下問題:Java IConfigurationContainerAware類的具體用法?Java IConfigurationContainerAware怎麽用?Java IConfigurationContainerAware使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


IConfigurationContainerAware類屬於org.opendaylight.controller.configuration包,在下文中一共展示了IConfigurationContainerAware類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: saveConfiguration

import org.opendaylight.controller.configuration.IConfigurationContainerAware; //導入依賴的package包/類
@Override
public Status saveConfiguration() {
    boolean success = true;
    for (IConfigurationContainerAware configurationAware : configurationAwareList) {
        logger.info("Save Config triggered for {}",
                  configurationAware.getClass().getSimpleName());

        Status status = configurationAware.saveConfiguration();
        if (!status.isSuccess()) {
            success = false;
            logger.info("Failed to save config for {}",
                            configurationAware.getClass().getSimpleName());
        }
    }
    if (success) {
        return new Status(StatusCode.SUCCESS, null);
    } else {
        return new Status(StatusCode.INTERNALERROR,
                    "Failed to Save All Configurations");
    }
}
 
開發者ID:lbchen,項目名稱:ODL,代碼行數:22,代碼來源:ConfigurationContainerImpl.java

示例2: configureInstance

import org.opendaylight.controller.configuration.IConfigurationContainerAware; //導入依賴的package包/類
/**
 * Function that is called when configuration of the dependencies
 * is required.
 *
 * @param c dependency manager Component object, used for
 * configuring the dependencies exported and imported
 * @param imp Implementation class that is being configured,
 * needed as long as the same routine can configure multiple
 * implementations
 * @param containerName The containerName being configured, this allow
 * also optional per-container different behavior if needed, usually
 * should not be the case though.
 */
public void configureInstance(Component c, Object imp, String containerName) {
    if (imp.equals(StaticRoutingImplementation.class)) {
        Dictionary<String, Set<String>> props = new Hashtable<String, Set<String>>();
        Set<String> propSet = new HashSet<String>();
        propSet.add("forwarding.staticrouting.configSaveEvent");
        props.put("cachenames", propSet);
        // export the service

        c.setInterface(new String[] { ICacheUpdateAware.class.getName(),
                IForwardingStaticRouting.class.getName(),
                IfNewHostNotify.class.getName(),
                IConfigurationContainerAware.class.getName() }, props);

        c.add(createContainerServiceDependency(containerName).setService(
                IClusterContainerServices.class).setCallbacks(
                "setClusterContainerService",
                "unsetClusterContainerService").setRequired(true));

        c.add(createContainerServiceDependency(containerName).setService(
                IfIptoHost.class).setCallbacks("setHostTracker",
                "unsetHostTracker").setRequired(true));

        // Static routing aware there could be many
        c.add(createContainerServiceDependency(containerName).setService(
                IStaticRoutingAware.class).setCallbacks(
                "setStaticRoutingAware", "unsetStaticRoutingAware")
                .setRequired(false));
    }
}
 
開發者ID:lbchen,項目名稱:ODL,代碼行數:43,代碼來源:Activator.java

示例3: configureInstance

import org.opendaylight.controller.configuration.IConfigurationContainerAware; //導入依賴的package包/類
/**
 * Function that is called when configuration of the dependencies
 * is required.
 *
 * @param c dependency manager Component object, used for
 * configuring the dependencies exported and imported
 * @param imp Implementation class that is being configured,
 * needed as long as the same routine can configure multiple
 * implementations
 * @param containerName The containerName being configured, this allow
 * also optional per-container different behavior if needed, usually
 * should not be the case though.
 */
public void configureInstance(Component c, Object imp, String containerName) {
    if (imp.equals(SwitchManagerImpl.class)) {
        Dictionary<String, Set<String>> props = new Hashtable<String, Set<String>>();
        Set<String> propSet = new HashSet<String>();
        propSet.add("switchmanager.configSaveEvent");
        props.put("cachenames", propSet);
        // export the service
        c.setInterface(new String[] {
                IListenInventoryUpdates.class.getName(),
                ISwitchManager.class.getName(),
                ICacheUpdateAware.class.getName(),
                IConfigurationContainerAware.class.getName() }, props);

        // Now lets add a service dependency to make sure the
        // provider of service exists
        c.add(createContainerServiceDependency(containerName).setService(
                IInventoryService.class).setCallbacks(
                "setInventoryService", "unsetInventoryService")
                .setRequired(false));
        c.add(createContainerServiceDependency(containerName).setService(
                ISwitchManagerAware.class).setCallbacks(
                "setSwitchManagerAware", "unsetSwitchManagerAware")
                .setRequired(false));
        c.add(createContainerServiceDependency(containerName).setService(
                IInventoryListener.class).setCallbacks(
                "setInventoryListener", "unsetInventoryListener")
                .setRequired(false));
        c.add(createContainerServiceDependency(containerName).setService(
                ISpanAware.class).setCallbacks("setSpanAware",
                "unsetSpanAware").setRequired(false));
        c.add(createContainerServiceDependency(containerName).setService(
                IClusterContainerServices.class).setCallbacks(
                "setClusterContainerService",
                "unsetClusterContainerService").setRequired(true));
    }
}
 
開發者ID:lbchen,項目名稱:ODL,代碼行數:50,代碼來源:Activator.java

示例4: configureInstance

import org.opendaylight.controller.configuration.IConfigurationContainerAware; //導入依賴的package包/類
/**
 * Function that is called when configuration of the dependencies is
 * required.
 *
 * @param c
 *            dependency manager Component object, used for configuring the
 *            dependencies exported and imported
 * @param imp
 *            Implementation class that is being configured, needed as long
 *            as the same routine can configure multiple implementations
 * @param containerName
 *            The containerName being configured, this allow also optional
 *            per-container different behavior if needed, usually should not
 *            be the case though.
 */
@Override
public void configureInstance(Component c, Object imp, String containerName) {
    if (imp.equals(ForwardingRulesManager.class)) {
        String interfaces[] = null;
        Dictionary<String, Set<String>> props = new Hashtable<String, Set<String>>();
        Set<String> propSet = new HashSet<String>();
        propSet.add("frm.flowsSaveEvent");
        props.put("cachenames", propSet);

        // export the service
        interfaces = new String[] { IContainerListener.class.getName(), ISwitchManagerAware.class.getName(),
                IForwardingRulesManager.class.getName(), IInventoryListener.class.getName(),
                ICacheUpdateAware.class.getName(), IConfigurationContainerAware.class.getName(),
                IFlowProgrammerListener.class.getName() };

        c.setInterface(interfaces, props);

        c.add(createContainerServiceDependency(containerName).setService(IFlowProgrammerService.class)
                .setCallbacks("setFlowProgrammerService", "unsetFlowProgrammerService").setRequired(true));
        c.add(createContainerServiceDependency(containerName).setService(IClusterContainerServices.class)
                .setCallbacks("setClusterContainerService", "unsetClusterContainerService").setRequired(true));
        c.add(createContainerServiceDependency(containerName).setService(ISwitchManager.class)
                .setCallbacks("setSwitchManager", "unsetSwitchManager").setRequired(true));
        c.add(createContainerServiceDependency(containerName).setService(IForwardingRulesManagerAware.class)
                .setCallbacks("setFrmAware", "unsetFrmAware").setRequired(false));
        c.add(createContainerServiceDependency(containerName).setService(IContainer.class)
                .setCallbacks("setIContainer", "unsetIContainer").setRequired(true));
    }
}
 
開發者ID:lbchen,項目名稱:ODL,代碼行數:45,代碼來源:Activator.java

示例5: configureInstance

import org.opendaylight.controller.configuration.IConfigurationContainerAware; //導入依賴的package包/類
/**
 * Function that is called when configuration of the dependencies
 * is required.
 *
 * @param c dependency manager Component object, used for
 * configuring the dependencies exported and imported
 * @param imp Implementation class that is being configured,
 * needed as long as the same routine can configure multiple
 * implementations
 * @param containerName The containerName being configured, this allow
 * also optional per-container different behavior if needed, usually
 * should not be the case though.
 */
public void configureInstance(Component c, Object imp, String containerName) {
    if (imp.equals(ConfigurationContainerImpl.class)) {
        // export the service
        c.setInterface(new String[] {
                IConfigurationContainerService.class.getName(),
                IConfigurationAware.class.getName() }, null);

        c.add(createContainerServiceDependency(containerName).setService(
                IConfigurationContainerAware.class).setCallbacks(
                        "addConfigurationContainerAware",
                        "removeConfigurationContainerAware").setRequired(false));
    }
}
 
開發者ID:lbchen,項目名稱:ODL,代碼行數:27,代碼來源:Activator.java

示例6: configureInstance

import org.opendaylight.controller.configuration.IConfigurationContainerAware; //導入依賴的package包/類
/**
 * Function that is called when configuration of the dependencies
 * is required.
 *
 * @param c dependency manager Component object, used for
 * configuring the dependencies exported and imported
 * @param imp Implementation class that is being configured,
 * needed as long as the same routine can configure multiple
 * implementations
 * @param containerName The containerName being configured, this allow
 * also optional per-container different behavior if needed, usually
 * should not be the case though.
 */
public void configureInstance(Component c, Object imp, String containerName) {
    if (imp.equals(TopologyManagerImpl.class)) {
        // export the service needed to listen to topology updates
        Dictionary<String, Set<String>> props = new Hashtable<String, Set<String>>();
        Set<String> propSet = new HashSet<String>();
        propSet.add("topologymanager.configSaveEvent");
        props.put("cachenames", propSet);

        c.setInterface(new String[] { IListenTopoUpdates.class.getName(),
                ITopologyManager.class.getName(),
                IConfigurationContainerAware.class.getName() }, props);

        c.add(createContainerServiceDependency(containerName).setService(
                ITopologyService.class).setCallbacks("setTopoService",
                "unsetTopoService").setRequired(true));

        // These are all the listeners for a topology manager
        // updates, there could be many or none
        c.add(createContainerServiceDependency(containerName).setService(
                ITopologyManagerAware.class).setCallbacks(
                "setTopologyManagerAware", "unsetTopologyManagerAware")
                .setRequired(false));

        c.add(createContainerServiceDependency(containerName).setService(
                IClusterContainerServices.class).setCallbacks(
                "setClusterContainerService",
                "unsetClusterContainerService").setRequired(true));
    }
}
 
開發者ID:lbchen,項目名稱:ODL,代碼行數:43,代碼來源:Activator.java

示例7: addConfigurationContainerAware

import org.opendaylight.controller.configuration.IConfigurationContainerAware; //導入依賴的package包/類
public void addConfigurationContainerAware(
        IConfigurationContainerAware configurationAware) {
    if (!this.configurationAwareList.contains(configurationAware)) {
        this.configurationAwareList.add(configurationAware);
    }
}
 
開發者ID:lbchen,項目名稱:ODL,代碼行數:7,代碼來源:ConfigurationContainerImpl.java

示例8: removeConfigurationContainerAware

import org.opendaylight.controller.configuration.IConfigurationContainerAware; //導入依賴的package包/類
public void removeConfigurationContainerAware(
        IConfigurationContainerAware configurationAware) {
    this.configurationAwareList.remove(configurationAware);
}
 
開發者ID:lbchen,項目名稱:ODL,代碼行數:5,代碼來源:ConfigurationContainerImpl.java

示例9: testAddRemoveSaveConfiguration

import org.opendaylight.controller.configuration.IConfigurationContainerAware; //導入依賴的package包/類
@Test
public void testAddRemoveSaveConfiguration() {

        ConfigurationContainerImpl configurationContainerImpl = new ConfigurationContainerImpl();
        IConfigurationContainerAware testConfigurationContainerAware = new ConfigurationContainerAwareTest();

        configurationContainerImpl.addConfigurationContainerAware(testConfigurationContainerAware);
        configurationContainerImpl.addConfigurationContainerAware(testConfigurationContainerAware);

        Assert.assertEquals(1, configurationContainerImpl.getConfigurationAwareListSize());

        IConfigurationContainerAware testConfigurationAware1 = new ConfigurationContainerAwareTest();
        configurationContainerImpl.addConfigurationContainerAware(testConfigurationAware1);

        Assert.assertEquals(2, configurationContainerImpl.getConfigurationAwareListSize());

        IConfigurationContainerAware testConfigurationAware2 = new ConfigurationContainerAwareTest();
        configurationContainerImpl.addConfigurationContainerAware(testConfigurationAware2);

        Assert.assertEquals(3, configurationContainerImpl.getConfigurationAwareListSize());

        IConfigurationContainerAware testConfigurationAware3 = new ConfigurationContainerAwareTest();
        configurationContainerImpl.addConfigurationContainerAware(testConfigurationAware3);

        Assert.assertEquals(4, configurationContainerImpl.getConfigurationAwareListSize());

        configurationContainerImpl.removeConfigurationContainerAware(testConfigurationContainerAware);
        Assert.assertEquals(3, configurationContainerImpl.getConfigurationAwareListSize());

        configurationContainerImpl.removeConfigurationContainerAware(testConfigurationContainerAware);
        Assert.assertEquals(3, configurationContainerImpl.getConfigurationAwareListSize());

        configurationContainerImpl.removeConfigurationContainerAware(testConfigurationAware3);
        Assert.assertEquals(2, configurationContainerImpl.getConfigurationAwareListSize());

        configurationContainerImpl.removeConfigurationContainerAware(testConfigurationAware2);
        Assert.assertEquals(1, configurationContainerImpl.getConfigurationAwareListSize());

        configurationContainerImpl.removeConfigurationContainerAware(testConfigurationAware1);
        Assert.assertEquals(0, configurationContainerImpl.getConfigurationAwareListSize());


}
 
開發者ID:lbchen,項目名稱:ODL,代碼行數:44,代碼來源:ConfigurationContainerImplTest.java


注:本文中的org.opendaylight.controller.configuration.IConfigurationContainerAware類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。