本文整理汇总了Java中org.opennms.netmgt.model.OnmsNode.getLabel方法的典型用法代码示例。如果您正苦于以下问题:Java OnmsNode.getLabel方法的具体用法?Java OnmsNode.getLabel怎么用?Java OnmsNode.getLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opennms.netmgt.model.OnmsNode
的用法示例。
在下文中一共展示了OnmsNode.getLabel方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSuitableRancidNode
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
private RancidNode getSuitableRancidNode(OnmsNode node) {
//The group should be the foreign source of the node
String group = node.getForeignSource();
if (group == null) return null;
RancidNode r_node = new RancidNode(group, node.getLabel());
String ipaddress = m_onmsNodeIpMap.get(node.getId());
if (m_rancidAdapterConfig.useCategories(ipaddress)) {
log().debug("getSuitableRancidNode: Using Categories to get Rancid devicetype for node: " + node.getLabel());
r_node.setDeviceType(getTypeFromCategories(node));
} else {
log().debug("getSuitableRancidNode: Using Sysoid to get Rancid devicetype for node: " + node.getLabel());
r_node.setDeviceType(getTypeFromSysObjectId(node.getSysObjectId()));
}
r_node.setStateUp(false);
r_node.setComment(RANCID_COMMENT);
r_node.setAuth(getSuitableRancidNodeAuthentication(node));
return r_node;
}
示例2: DnsRecord
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
DnsRecord(OnmsNode node) {
OnmsIpInterface primaryInterface = node.getPrimaryInterface();
if (primaryInterface == null) {
log().debug("Constructor: no primary interface found for nodeid: " + node.getNodeId());
Set<OnmsIpInterface> ipInterfaces = node.getIpInterfaces();
for (OnmsIpInterface onmsIpInterface : ipInterfaces) {
m_ip = onmsIpInterface.getIpAddress();
break;
}
} else {
log().debug("Constructor: primary interface found for nodeid: " + node.getNodeId());
m_ip = primaryInterface.getIpAddress();
}
log().debug("Constructor: set ip address: " + m_ip);
m_hostname = node.getLabel() + ".";
log().debug("Constructor: set hostname: " + m_hostname);
m_zone = m_hostname.substring(m_hostname.indexOf('.') + 1);
log().debug("Constructor: set zone: " + m_zone);
}
示例3: parseString
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
/**
* Parses the string.
*
* <p>Valid placeholders are:</p>
* <ul>
* <li><b>ipaddr</b>, The Node IP Address</li>
* <li><b>step</b>, The Collection Step in seconds</li>
* <li><b>nodeId</b>, The Node ID</li>
* <li><b>nodeLabel</b>, The Node Label</li>
* <li><b>foreignId</b>, The Node Foreign ID</li>
* <li><b>foreignSource</b>, The Node Foreign Source</li>
* <li>Any asset property defined on the node.</li>
* </ul>
*
* @param reference the reference
* @param unformattedString the unformatted string
* @param node the node
* @param ipAddress the IP address
* @return the string
* @throws IllegalArgumentException the illegal argument exception
*/
protected String parseString(final String reference, final String unformattedString, final OnmsNode node, final String ipAddress) throws IllegalArgumentException {
if (unformattedString == null)
return null;
String formattedString = unformattedString.replaceAll("[{](?i)(ipAddr|ipAddress)[}]", ipAddress);
formattedString = formattedString.replaceAll("[{](?i)nodeId[}]", node.getNodeId());
if (node.getLabel() != null)
formattedString = formattedString.replaceAll("[{](?i)nodeLabel[}]", node.getLabel());
if (node.getForeignId() != null)
formattedString = formattedString.replaceAll("[{](?i)foreignId[}]", node.getForeignId());
if (node.getForeignSource() != null)
formattedString = formattedString.replaceAll("[{](?i)foreignSource[}]", node.getForeignSource());
if (node.getAssetRecord() != null) {
BeanWrapper wrapper = new BeanWrapperImpl(node.getAssetRecord());
for (PropertyDescriptor p : wrapper.getPropertyDescriptors()) {
Object obj = wrapper.getPropertyValue(p.getName());
if (obj != null)
formattedString = formattedString.replaceAll("[{](?i)" + p.getName() + "[}]", obj.toString());
}
}
if (formattedString.matches(".*[{].+[}].*"))
throw new IllegalArgumentException("The " + reference + " " + formattedString + " contains unknown placeholders.");
return formattedString;
}
示例4: createChildResource
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
/**
* <p>createChildResource</p>
*
* @param node a {@link org.opennms.netmgt.model.OnmsNode} object.
* @return a {@link org.opennms.netmgt.model.OnmsResource} object.
*/
public OnmsResource createChildResource(OnmsNode node) {
NodeChildResourceLoader loader = new NodeChildResourceLoader(node.getId(), node.getForeignSource(), node.getForeignId());
OnmsResource r = new OnmsResource(node.getId().toString(), node.getLabel(), this, s_emptyAttributeSet, new LazyList<OnmsResource>(loader));
r.setEntity(node);
loader.setParent(r);
return r;
}
示例5: createChildResource
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
/**
* <p>createChildResource</p>
*
* @param nodeSource a {@link java.lang.String} object.
* @return a {@link org.opennms.netmgt.model.OnmsResource} object.
*/
public OnmsResource createChildResource(String nodeSource) {
String[] ident = nodeSource.split(":");
OnmsNode node = m_nodeDao.findByForeignId(ident[0], ident[1]);
String label = ident[0] + ":" + node.getLabel();
NodeSourceChildResourceLoader loader = new NodeSourceChildResourceLoader(nodeSource, node.getId());
OnmsResource resource = new OnmsResource(nodeSource, label, this, s_emptyAttributeSet, new LazyList<OnmsResource>(loader));
loader.setParent(resource);
return resource;
}
示例6: getNodeLabel
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Transactional(readOnly=true)
public String getNodeLabel(int nodeId) {
OnmsNode node = m_nodeDao.get(nodeId);
if(node != null){
return node.getLabel();
}
return null;
}
示例7: NodeEntry
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
public NodeEntry(final OnmsNode node) {
final OnmsAssetRecord assetRecord = node.getAssetRecord();
if (assetRecord != null && assetRecord.getGeolocation() != null) {
final OnmsGeolocation geolocation = assetRecord.getGeolocation();
m_longitude = geolocation.getLongitude();
m_latitude = geolocation.getLatitude();
}
m_nodeId = node.getId();
m_nodeLabel = node.getLabel();
m_foreignSource = node.getForeignSource();
m_foreignId = node.getForeignId();
if (assetRecord != null) {
m_maintcontract = assetRecord.getMaintcontract();
m_description = assetRecord.getDescription();
}
if (node.getPrimaryInterface() != null) {
m_ipAddress = InetAddressUtils.str(node.getPrimaryInterface().getIpAddress());
}
if (node.getCategories() != null && node.getCategories().size() > 0) {
for (final OnmsCategory category : node.getCategories()) {
m_categories.add(category.getName());
}
}
}
示例8: getRancidNodeBase
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
/**
* <p>getRancidNodeBase</p>
*
* @param nodeid a int.
* @return a java$util$Map object.
*/
public Map<String, Object> getRancidNodeBase(int nodeid) {
log().debug("getRancidNodeBase start for nodeid: " + nodeid);
Map<String, Object> nodeModel = new TreeMap<String, Object>();
nodeModel.put("RWSStatus","OK");
OnmsNode node = m_nodeDao.get(nodeid);
String rancidName = node.getLabel();
log().debug("getRancidNodeBase rancid node name: " + rancidName);
nodeModel.put("id", rancidName);
nodeModel.put("db_id", nodeid);
nodeModel.put("status_general", ElementUtil.getNodeStatusString(node.getType().charAt(0)));
// TODO find a method to get root service for URL
nodeModel.put("url", m_cp.getUrl()+m_cp.getDirectory());
String rancidIntegrationUseOnlyRancidAdapterProperty = Vault.getProperty("opennms.rancidIntegrationUseOnlyRancidAdapter");
log().debug("getRancidNodeBase opennms.rancidIntegrationUseOnlyRancidAdapter: " + rancidIntegrationUseOnlyRancidAdapterProperty);
if (rancidIntegrationUseOnlyRancidAdapterProperty != null && "true".equalsIgnoreCase(rancidIntegrationUseOnlyRancidAdapterProperty.trim())) {
log().debug("getRancidNodeBase permitModifyClogin: false");
nodeModel.put("permitModifyClogin",false);
} else {
log().debug("getRancidNodeBase permitModifyClogin: true");
nodeModel.put("permitModifyClogin",true);
}
String foreignSource = node.getForeignSource();
if (foreignSource != null ) {
nodeModel.put("foreignSource", foreignSource);
} else {
nodeModel.put("foreignSource", "");
}
return nodeModel;
}
示例9: getNodeLabel
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
@Override
public String getNodeLabel(int nodeId) {
OnmsCriteria criteria = new OnmsCriteria(OnmsNode.class);
criteria.add(Restrictions.eq("id", nodeId));
List<OnmsNode> nodes = m_nodeDao.findMatching(criteria);
if(nodes.size() > 0) {
OnmsNode node = nodes.get(0);
return node.getLabel();
}else {
return null;
}
}
示例10: testFilteredResourceAttributeFilteringWithNoMatch
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
public void testFilteredResourceAttributeFilteringWithNoMatch() throws Exception {
final OnmsNode node = new OnmsNode();
node.setId(1);
node.setLabel("Node One");
EasyMock.expect(m_nodeDao.load(1)).andReturn(node);
MockResourceType resourceType = new MockResourceType();
resourceType.setName("interfaceSnmp");
OnmsAttribute attribute = new RrdGraphAttribute("IfInOctets", "something", "something else");
OnmsResource resource = new OnmsResource(node.getId().toString(), node.getLabel(), resourceType, Collections.singleton(attribute));
ReportDefinition def = createReportDefinition();
def.getReport().getPackage().setFilter("");
def.setResourceAttributeKey("ifSpeed");
def.setResourceAttributeValueMatch("100000000");
ReportInstance report = def.createReport(m_nodeDao, m_resourceDao, m_rrdDao, m_filterDao);
SortedMap<Integer,String> sortedNodeMap = new TreeMap<Integer, String>();
sortedNodeMap.put(node.getId(), node.getLabel());
EasyMock.expect(m_filterDao.getNodeMap("")).andReturn(sortedNodeMap);
EasyMock.expect(m_resourceDao.getResourceForNode(node)).andReturn(resource);
m_mocks.replayAll();
report.walk();
assertEquals("results size", 0, report.getResults().size());
}
示例11: testFilteredResourceAttributeFilteringWithMatch
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
public void testFilteredResourceAttributeFilteringWithMatch() throws Exception {
OnmsAttribute rrdAttribute = new RrdGraphAttribute("IfInOctets", "something", "something else");
ExternalValueAttribute externalValueAttribute = new ExternalValueAttribute("ifSpeed", "100000000");
Set<OnmsAttribute> attributes = new HashSet<OnmsAttribute>();
attributes.add(rrdAttribute);
attributes.add(externalValueAttribute);
final OnmsNode node = new OnmsNode();
node.setId(1);
node.setLabel("Node One");
EasyMock.expect(m_nodeDao.load(1)).andReturn(node);
MockResourceType resourceType = new MockResourceType();
resourceType.setName("interfaceSnmp");
OnmsResource resource = new OnmsResource(node.getId().toString(), node.getLabel(), resourceType, attributes);
ReportDefinition def = createReportDefinition();
def.getReport().getPackage().setFilter("");
def.setResourceAttributeKey(externalValueAttribute.getName());
def.setResourceAttributeValueMatch(externalValueAttribute.getValue());
ReportInstance report = def.createReport(m_nodeDao, m_resourceDao, m_rrdDao, m_filterDao);
SortedMap<Integer,String> sortedNodeMap = new TreeMap<Integer, String>();
sortedNodeMap.put(node.getId(), node.getLabel());
EasyMock.expect(m_filterDao.getNodeMap("")).andReturn(sortedNodeMap);
EasyMock.expect(m_resourceDao.getResourceForNode(node)).andReturn(resource);
EasyMock.expect(m_rrdDao.getPrintValue(rrdAttribute, def.getConsolidationFunction(), report.getStartTime(), report.getEndTime())).andReturn(1.0);
m_mocks.replayAll();
report.walk();
assertEquals("results size", 1, report.getResults().size());
}
示例12: declareBeans
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
private void declareBeans(BSFManager bsfManager) throws BSFException {
NodeDao nodeDao = Notifd.getInstance().getNodeDao();
Integer nodeId;
try {
nodeId = Integer.valueOf(m_notifParams.get(NotificationManager.PARAM_NODE));
} catch (NumberFormatException nfe) {
nodeId = null;
}
OnmsNode node = null;
OnmsAssetRecord assets = null;
List<String> categories = new ArrayList<String>();
String nodeLabel = null;
String foreignSource = null;
String foreignId = null;
if (nodeId != null) {
node = nodeDao.get(nodeId);
nodeLabel = node.getLabel();
assets = node.getAssetRecord();
for (OnmsCategory cat : node.getCategories()) {
categories.add(cat.getName());
}
foreignSource = node.getForeignSource();
foreignId = node.getForeignId();
}
bsfManager.declareBean("bsf_notif_strategy", this, BSFNotificationStrategy.class);
retrieveParams();
bsfManager.declareBean("notif_params", m_notifParams, Map.class);
bsfManager.declareBean("node_label", nodeLabel, String.class);
bsfManager.declareBean("foreign_source", foreignSource, String.class);
bsfManager.declareBean("foreign_id", foreignId, String.class);
bsfManager.declareBean("node_assets", assets, OnmsAssetRecord.class);
bsfManager.declareBean("node_categories", categories, List.class);
bsfManager.declareBean("node", node, OnmsNode.class);
for (Argument arg : m_arguments) {
if (NotificationManager.PARAM_TEXT_MSG.equals(arg.getSwitch())) bsfManager.declareBean("text_message", arg.getValue(), String.class);
if (NotificationManager.PARAM_NUM_MSG.equals(arg.getSwitch())) bsfManager.declareBean("numeric_message", arg.getValue(), String.class);
if (NotificationManager.PARAM_NODE.equals(arg.getSwitch())) bsfManager.declareBean("node_id", arg.getValue(), String.class);
if (NotificationManager.PARAM_INTERFACE.equals(arg.getSwitch())) bsfManager.declareBean("ip_addr", arg.getValue(), String.class);
if (NotificationManager.PARAM_SERVICE.equals(arg.getSwitch())) bsfManager.declareBean("svc_name", arg.getValue(), String.class);
if (NotificationManager.PARAM_SUBJECT.equals(arg.getSwitch())) bsfManager.declareBean("subject", arg.getValue(), String.class);
if (NotificationManager.PARAM_EMAIL.equals(arg.getSwitch())) bsfManager.declareBean("email", arg.getValue(), String.class);
if (NotificationManager.PARAM_PAGER_EMAIL.equals(arg.getSwitch())) bsfManager.declareBean("pager_email", arg.getValue(), String.class);
if (NotificationManager.PARAM_XMPP_ADDRESS.equals(arg.getSwitch())) bsfManager.declareBean("xmpp_address", arg.getValue(), String.class);
if (NotificationManager.PARAM_TEXT_PAGER_PIN.equals(arg.getSwitch())) bsfManager.declareBean("text_pin", arg.getValue(), String.class);
if (NotificationManager.PARAM_NUM_PAGER_PIN.equals(arg.getSwitch())) bsfManager.declareBean("numeric_pin", arg.getValue(), String.class);
if (NotificationManager.PARAM_WORK_PHONE.equals(arg.getSwitch())) bsfManager.declareBean("work_phone", arg.getValue(), String.class);
if (NotificationManager.PARAM_HOME_PHONE.equals(arg.getSwitch())) bsfManager.declareBean("home_phone", arg.getValue(), String.class);
if (NotificationManager.PARAM_MOBILE_PHONE.equals(arg.getSwitch())) bsfManager.declareBean("mobile_phone", arg.getValue(), String.class);
if (NotificationManager.PARAM_TUI_PIN.equals(arg.getSwitch())) bsfManager.declareBean("phone_pin", arg.getValue(), String.class);
if (NotificationManager.PARAM_MICROBLOG_USERNAME.equals(arg.getSwitch())) bsfManager.declareBean("microblog_username", arg.getValue(), String.class);
}
}