本文整理汇总了Java中de.hshannover.f4.trust.ifmapj.identifier.Identifiers.createMac方法的典型用法代码示例。如果您正苦于以下问题:Java Identifiers.createMac方法的具体用法?Java Identifiers.createMac怎么用?Java Identifiers.createMac使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de.hshannover.f4.trust.ifmapj.identifier.Identifiers
的用法示例。
在下文中一共展示了Identifiers.createMac方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入方法依赖的package包/类
public static void main(String[] args) {
command = "ar-mac";
ArgumentParser parser = createDefaultParser();
ParserUtil.addPublishOperation(parser);
ParserUtil.addAccessRequest(parser);
ParserUtil.addMacAddress(parser);
parseParameters(parser, args);
printParameters(KEY_OPERATION, new String[] {KEY_ACCESS_REQUEST, KEY_MAC});
String ar = resource.getString(KEY_ACCESS_REQUEST);
String mac = resource.getString(KEY_MAC);
// prepare identifiers
Identifier arIdentifier = Identifiers.createAr(ar);
Identifier macIdentifier = Identifiers.createMac(mac);
// prepare metadata
Document metadata = mf.createArMac();
PublishRequest request;
// update or delete
if (isUpdate(KEY_OPERATION)) {
PublishUpdate publishUpdate = Requests.createPublishUpdate(arIdentifier, macIdentifier,
metadata, MetadataLifetime.forever);
request = Requests.createPublishReq(publishUpdate);
} else {
String filter = "meta:access-request-mac";
PublishDelete publishDelete = Requests.createPublishDelete(arIdentifier, macIdentifier, filter);
publishDelete.addNamespaceDeclaration(IfmapStrings.STD_METADATA_PREFIX,
IfmapStrings.STD_METADATA_NS_URI);
request = Requests.createPublishReq(publishDelete);
}
// publish
publishIfmapData(request);
}
示例2: createStartIdentifier
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入方法依赖的package包/类
private static Identifier createStartIdentifier(String sIdentifierType, String sIdentifier) {
switch (sIdentifierType) {
case "device":
return Identifiers.createDev(sIdentifier);
case "access-request":
return Identifiers.createAr(sIdentifier);
case "ip-address":
String[] split = sIdentifier.split(",");
switch (split[0]) {
case "IPv4":
return Identifiers.createIp4(split[1]);
case "IPv6":
return Identifiers.createIp6(split[1]);
default:
throw new RuntimeException("unknown IP address type '"
+ split[0] + "'");
}
case "mac-address":
return Identifiers.createMac(sIdentifier);
// TODO identity and extended identifiers
default:
throw new RuntimeException("unknown identifier type '"
+ sIdentifierType + "'");
}
}
示例3: createMatchedIdentifier
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入方法依赖的package包/类
private static Identifier createMatchedIdentifier(RuleMatch match) throws MarshalException {
LOGGER.trace("Method createMatchedIdentifier(RuleMatch match) called");
Identifier result = null;
IfmapVertex matchedVertex = match.getPublishVertex();
String typeName = matchedVertex.getTypeName();
String rawData = matchedVertex.getRawData();
LOGGER.trace("MatchedVertex ("
+ typeName + "): " + rawData);
// TODO will not support ALL possible identifier types ... e.g. IPv6
switch (typeName) {
case IfmapStrings.ACCESS_REQUEST_EL_NAME:
result = Identifiers.createAr(matchedVertex.valueFor("/access-request[@name]"));
break;
case IfmapStrings.DEVICE_EL_NAME:
result = Identifiers.createDev(matchedVertex.valueFor("/device/name"));
break;
case IfmapStrings.IP_ADDRESS_EL_NAME:
result = Identifiers.createIp4(matchedVertex.valueFor("/ip-address[@value]"));
break;
case IfmapStrings.MAC_ADDRESS_EL_NAME:
result = Identifiers.createMac(matchedVertex.valueFor("/mac-address[@value]"));
break;
case IfmapStrings.IDENTITY_EL_NAME:
if (matchedVertex.isExtendedIdentifier()) {
result = Identifiers.createExtendedIdentity(rawData);
} else {
String name = matchedVertex.valueFor("/identity[@name]");
String type = matchedVertex.valueFor("/identity[@type]");
result = Identifiers.createIdentity(IdentityType.valueOf(type), name);
}
break;
default:
break;
}
return result;
}
示例4: publish
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入方法依赖的package包/类
private static void publish() {
Identifier accessRequest;
Identifier macAddress, ipAddress;
Identifier identity;
Identifier pepDevice, pdpDevice, endpointDevice;
try {
// establish session
SSRC ssrc = createSSRC();
ssrc.newSession();
// create identifiers
accessRequest = Identifiers.createAr(ssrc.getPublisherId() + ":" + username.hashCode());
macAddress = Identifiers.createMac(mac);
ipAddress = Identifiers.createIp4(ip);
identity = Identifiers.createIdentity(IdentityType.userName, username);
pepDevice = Identifiers.createDev("example-pep-id:" + username.hashCode());
pdpDevice = Identifiers.createDev("example-pdp-id:" + username.hashCode());
endpointDevice = Identifiers.createDev("example-endpoint-id:" + username.hashCode());
// add mandatory metadata to publish request
addArDevice(accessRequest, endpointDevice);
addArMac(accessRequest, macAddress);
addArIp(accessRequest, ipAddress);
addAuthBy(accessRequest, pdpDevice);
// add optional metadata to publish request
addAuthAs(accessRequest, identity);
addCap(accessRequest);
addDevAttr(accessRequest, endpointDevice);
addDevChar(accessRequest, pdpDevice);
addRole(accessRequest, identity);
addLayer2(accessRequest, pepDevice);
addWlanInfo(accessRequest, pepDevice);
// do publish
ssrc.publish(publishRequest);
// clean up
ssrc.endSession();
ssrc.closeTcpConnection();
} catch (Exception e) {
e.printStackTrace();
System.exit(-1);
}
}
示例5: main
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入方法依赖的package包/类
public static void main(String[] args) {
command = "ip-mac";
// TODO choice for IPv4 and IPv6
ArgumentParser parser = createDefaultParser();
ParserUtil.addPublishOperation(parser);
ParserUtil.addIpv4Address(parser);
ParserUtil.addMacAddress(parser);
ParserUtil.addDhcpServer(parser);
// TODO start-time, end-time
parseParameters(parser, args);
printParameters(KEY_OPERATION, new String[] {KEY_IP, KEY_MAC, KEY_DHCP_SERVER});
String ip = resource.getString(KEY_IP);
String mac = resource.getString(KEY_MAC);
String dhcpServer = resource.getString(KEY_DHCP_SERVER);
// prepare identifiers
Identifier ipIdentifier = Identifiers.createIp4(ip);
Identifier macIdentifier = Identifiers.createMac(mac);
// prepare metadata
// TODO start-time, end-time and dhcp-server name from Parser
Date startTime = new Date(); // now
Date endTime = new Date(startTime.getTime() + (1000*60*60*8)); // 8 hours later
Document metadata = mf.createIpMac(Common.getTimeAsXsdDateTime(startTime),
Common.getTimeAsXsdDateTime(endTime), dhcpServer);
PublishRequest request;
// update or delete
if (isUpdate(KEY_OPERATION)) {
PublishUpdate publishUpdate = Requests.createPublishUpdate(ipIdentifier, macIdentifier,
metadata, MetadataLifetime.forever);
request = Requests.createPublishReq(publishUpdate);
} else {
String filter = "meta:ip-mac[dhcp-server='ip-mac-cli']";
PublishDelete publishDelete = Requests.createPublishDelete(ipIdentifier, macIdentifier, filter);
publishDelete.addNamespaceDeclaration(IfmapStrings.STD_METADATA_PREFIX,
IfmapStrings.STD_METADATA_NS_URI);
request = Requests.createPublishReq(publishDelete);
}
// publish
publishIfmapData(request);
}
示例6: getIdentifier
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入方法依赖的package包/类
protected static Identifier getIdentifier(IdType type, String name) {
switch (type) {
case ipv4:
return Identifiers.createIp4(name);
case ipv6:
return Identifiers.createIp6(name);
case mac:
return Identifiers.createMac(name);
case dev:
return Identifiers.createDev(name);
case ar:
return Identifiers.createAr(name);
case id:
return Identifiers.createIdentity(IdentityType.other, name);
case id_aik:
return Identifiers.createIdentity(IdentityType.aikName, name);
case id_dist:
return Identifiers.createIdentity(IdentityType.distinguishedName, name);
case id_dns:
return Identifiers.createIdentity(IdentityType.dnsName, name);
case id_email:
return Identifiers.createIdentity(IdentityType.emailAddress, name);
case id_hiphit:
return Identifiers.createIdentity(IdentityType.hipHit, name);
case id_kerberos:
return Identifiers.createIdentity(IdentityType.kerberosPrincipal, name);
case id_sip:
return Identifiers.createIdentity(IdentityType.sipUri, name);
case id_tel:
return Identifiers.createIdentity(IdentityType.telUri, name);
case id_user:
return Identifiers.createIdentity(IdentityType.userName, name);
case ics_bhi:
return IcsIdentifiers.createBackhaulInterface(name);
case ics_ovNetwGr:
return IcsIdentifiers.createOverlayNetworkGroup(name);
case ics_ovManagerGr:
return IcsIdentifiers.createOverlayManagerGroup(name);
default:
throw new RuntimeException("unknown identifier type '" + type + "'");
}
}
示例7: mac
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入方法依赖的package包/类
static MacAddress mac(String val, String ad) {
return Identifiers.createMac(val, ad);
}