本文整理汇总了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;
}
示例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();
}
}
示例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;
}