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


Java OnmsNode.visit方法代码示例

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


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

示例1: insertNode

import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Transactional
public void insertNode(final OnmsNode node) {
    
    node.setDistPoller(createDistPollerIfNecessary("localhost", "127.0.0.1"));
    m_nodeDao.save(node);
    m_nodeDao.flush();

    final EntityVisitor eventAccumlator = new AddEventVisitor(m_eventForwarder);

    node.visit(eventAccumlator);

    if (node.getCategories().size() > 0) {
        final EventBuilder bldr = new EventBuilder(EventConstants.NODE_CATEGORY_MEMBERSHIP_CHANGED_EVENT_UEI, "OnmsNode.mergeNodeAttributes");
        bldr.setNode(node);
        bldr.addParam(EventConstants.PARM_NODE_LABEL, node.getLabel());
        m_eventForwarder.sendNow(bldr.getEvent());
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:20,代码来源:DefaultProvisionService.java

示例2: getRequisitionedNode

import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
/** {@inheritDoc} */
 @Transactional
 public OnmsNode getRequisitionedNode(final String foreignSource, final String foreignId) throws ForeignSourceRepositoryException {
 	final OnmsNodeRequisition nodeReq = m_foreignSourceRepository.getNodeRequisition(foreignSource, foreignId);
     if (nodeReq == null) {
warnf(this, "nodeReq for node %s:%s cannot be null!", foreignSource, foreignId);
         return null;
     }
     final OnmsNode node = nodeReq.constructOnmsNodeFromRequisition();
     
     // fill in real database categories
     final HashSet<OnmsCategory> dbCategories = new HashSet<OnmsCategory>();
     for(final OnmsCategory category : node.getCategories()) {
         dbCategories.add(createCategoryIfNecessary(category.getName()));
     }
     
     node.setCategories(dbCategories);
     
     // fill in real service types
     node.visit(new ServiceTypeFulfiller());
     
     return node;
 }
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:24,代码来源:DefaultProvisionService.java

示例3: updateNode

import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Transactional
public void updateNode(final OnmsNode node, boolean rescanExisting) {

	final OnmsNode dbNode = m_nodeDao.getHierarchy(node.getId());

    final Set<OnmsCategory> existingCategories = dbNode.getCategories();
    final Set<OnmsCategory> newCategories = node.getCategories();

    dbNode.mergeNode(node, m_eventForwarder, false);

    m_nodeDao.update(dbNode);
    m_nodeDao.flush();

    final EntityVisitor eventAccumlator = new UpdateEventVisitor(m_eventForwarder, rescanExisting);

    node.visit(eventAccumlator);
    
    boolean categoriesChanged = false;
    if (existingCategories.size() != newCategories.size()) categoriesChanged = true;
    if (!categoriesChanged && !existingCategories.containsAll(newCategories)) categoriesChanged = true;
    if (!categoriesChanged && !newCategories.containsAll(existingCategories)) categoriesChanged = true;

    if (categoriesChanged) {
        final EventBuilder bldr = new EventBuilder(EventConstants.NODE_CATEGORY_MEMBERSHIP_CHANGED_EVENT_UEI, "OnmsNode.mergeNodeAttributes");
        bldr.setNode(dbNode);
        bldr.addParam(EventConstants.PARM_NODE_LABEL, dbNode.getLabel());
        m_eventForwarder.sendNow(bldr.getEvent());
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:31,代码来源:DefaultProvisionService.java

示例4: visitNodes

import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
private void visitNodes(Collection<OnmsNode> nodes,
        AggregateStatusVisitor statusVisitor) {

    if (nodes == null) {
        return;
    }

    for (OnmsNode node : nodes) {
        node.visit(statusVisitor);
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:12,代码来源:AggregateStatus.java

示例5: scheduleNode

import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
private void scheduleNode(final int nodeId, final boolean existing) {
	
       getCollectorConfigDao().rebuildPackageIpListMap();
	
	OnmsNode node = m_nodeDao.getHierarchy(nodeId);
	node.visit(new AbstractEntityVisitor() {

		@Override
		public void visitMonitoredService(OnmsMonitoredService monSvc) {
			scheduleInterface(monSvc.getIpInterface(), monSvc.getServiceName(), existing);
		}
		
	});
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:15,代码来源:Collectd.java

示例6: persist

import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
/**
 * <p>persist</p>
 *
 * @return a {@link java.util.List} object.
 */
public List<Event> persist() {

	//TODO: whatif node comes back as null?  can this happend?
	OnmsNode node = m_nodeDao.get(m_nodeId);
	if (node == null) return new ArrayList<Event>(0);

	m_nodeDao.delete(node);

	final List<Event> events = new LinkedList<Event>();

	EntityVisitor eventAccumlator = new DeleteEventVisitor(events);

	node.visit(eventAccumlator);

	return events;
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:22,代码来源:DeleteOperation.java

示例7: createOutageForNodeInCategory

import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
private void createOutageForNodeInCategory(String categoryName){
    OnmsCategory category = m_categoryDao.findByName(categoryName);
    Collection<OnmsNode> nodes = m_nodeDao.findByCategory(category);
    
    assertNotNull(nodes);
    assertFalse(nodes.isEmpty());
    
    OnmsNode node = nodes.iterator().next();
    
    node.visit(new AbstractEntityVisitor() {

        @Override
        public void visitMonitoredService(OnmsMonitoredService monSvc) {
            createOutageForService(monSvc);
        }
        
                  
    });
    
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:21,代码来源:DefaultSiteStatusServiceIntegrationTest.java

示例8: deleteNode

import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Transactional
public void deleteNode(final Integer nodeId) {
    
	final OnmsNode node = m_nodeDao.get(nodeId);

	if (node != null && shouldDelete(node)) {
        m_nodeDao.delete(node);
        node.visit(new DeleteEventVisitor(m_eventForwarder));
    }
    

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


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