当前位置: 首页>>代码示例>>Java>>正文


Java ForeignSource.getPolicies方法代码示例

本文整理汇总了Java中org.opennms.netmgt.provision.persist.foreignsource.ForeignSource.getPolicies方法的典型用法代码示例。如果您正苦于以下问题:Java ForeignSource.getPolicies方法的具体用法?Java ForeignSource.getPolicies怎么用?Java ForeignSource.getPolicies使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.opennms.netmgt.provision.persist.foreignsource.ForeignSource的用法示例。


在下文中一共展示了ForeignSource.getPolicies方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPluginsForForeignSource

import org.opennms.netmgt.provision.persist.foreignsource.ForeignSource; //导入方法依赖的package包/类
/**
 * <p>getPluginsForForeignSource</p>
 *
 * @param pluginClass a {@link java.lang.Class} object.
 * @param foreignSourceName a {@link java.lang.String} object.
 * @param <T> a T object.
 * @return a {@link java.util.List} object.
 */
public <T> List<T> getPluginsForForeignSource(final Class<T> pluginClass, final String foreignSourceName) {
	final ForeignSource foreignSource = m_foreignSourceRepository.getForeignSource(foreignSourceName);
    assertNotNull(foreignSource, "Expected a foreignSource with name %s", foreignSourceName);
    
    final List<PluginConfig> configs = foreignSource.getPolicies();
    if (configs == null) {
        return Collections.emptyList(); 
    }
    
    final List<T> plugins = new ArrayList<T>(configs.size());
    for(final PluginConfig config : configs) {
        final T plugin = m_pluginRegistry.getPluginInstance(pluginClass, config);
        if (plugin == null) {
            LogUtils.tracef(this, "Configured plugin is not appropropriate for policy class %s: %s", pluginClass, config);
        } else {
            plugins.add(plugin);
        }
    }

    return plugins;
    
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:31,代码来源:DefaultProvisionService.java

示例2: deletePolicy

import org.opennms.netmgt.provision.persist.foreignsource.ForeignSource; //导入方法依赖的package包/类
/**
 * <p>deletePolicy</p>
 *
 * @param foreignSource a {@link java.lang.String} object.
 * @param policy a {@link java.lang.String} object.
 * @return a {@link javax.ws.rs.core.Response} object.
 */
@DELETE
@Path("{foreignSource}/policies/{policy}")
@Transactional
public Response deletePolicy(@PathParam("foreignSource") String foreignSource, @PathParam("policy") String policy) {
    writeLock();
    try {
        ForeignSource fs = getActiveForeignSource(foreignSource);
        List<PluginConfig> policies = fs.getPolicies();
        PluginConfig removed = removeEntry(policies, policy);
        if (removed != null) {
            fs.updateDateStamp();
            fs.setPolicies(policies);
            m_pendingForeignSourceRepository.save(fs);
            return Response.ok().build();
        }
        return Response.notModified().build();
    } finally {
        writeUnlock();
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:28,代码来源:ForeignSourceRestService.java

示例3: deletePolicy

import org.opennms.netmgt.provision.persist.foreignsource.ForeignSource; //导入方法依赖的package包/类
/** {@inheritDoc} */
public ForeignSource deletePolicy(String foreignSource, String name) {
    ForeignSource fs = getForeignSource(foreignSource);
    List<PluginConfig> policies = fs.getPolicies();
    for (Iterator<PluginConfig> i = policies.iterator(); i.hasNext(); ) {
        PluginConfig pc = i.next();
        if (pc.getName().equals(name)) {
            i.remove();
            break;
        }
    }
    m_pendingForeignSourceRepository.save(fs);
    return fs;
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:15,代码来源:DefaultForeignSourceService.java


注:本文中的org.opennms.netmgt.provision.persist.foreignsource.ForeignSource.getPolicies方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。