本文整理汇总了Java中de.hshannover.f4.trust.ifmapj.identifier.Identifiers.createIdentity方法的典型用法代码示例。如果您正苦于以下问题:Java Identifiers.createIdentity方法的具体用法?Java Identifiers.createIdentity怎么用?Java Identifiers.createIdentity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de.hshannover.f4.trust.ifmapj.identifier.Identifiers
的用法示例。
在下文中一共展示了Identifiers.createIdentity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setup
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入方法依赖的package包/类
@Before
public void setup() throws Exception {
DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
f.setNamespaceAware(true);
DocumentBuilder builder = f.newDocumentBuilder();
mIdentifierFactory = new InMemoryIdentifierFactory();
mIpAddress = Identifiers.createIp4("10.1.1.1");
mIpAddressDocument = builder.newDocument();
Element e1 = Identifiers.tryToElement(mIpAddress, mIpAddressDocument);
mIpAddressDocument.appendChild(e1);
mIdentity = Identifiers.createIdentity(
IdentityType.other, "smartphone.os.android", "smartphone:01", "32939:category");
mIdentityDocument = builder.newDocument();
Element e2 = Identifiers.tryToElement(mIdentity, mIdentityDocument);
mIdentityDocument.appendChild(e2);
}
示例2: main
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入方法依赖的package包/类
/**
* main method
*/
public static void main(String[] args) {
command = "bhi-cert";
ArgumentParser parser = createDefaultParser();
ParserUtil.addPublishOperation(parser);
ParserUtil.addDistinguishedNameIdentity(parser);
ParserUtil.addIcsCertificate(parser);
parseParameters(parser, args);
printParameters(KEY_OPERATION, new String[] {KEY_IDENTITY_DISTINGUISHED_NAME, KEY_ICS_CERTIFICATE});
String distName = resource.getString(KEY_IDENTITY_DISTINGUISHED_NAME);
// prepare identifiers
Identifier distNameIdentifier = Identifiers.createIdentity(IdentityType.distinguishedName, distName);
// prepare metadata
String certificate = resource.getString(KEY_ICS_CERTIFICATE);
Document metadata = icsmf.createBhiCert(certificate);
PublishRequest request;
// update or delete
if (isUpdate(KEY_OPERATION)) {
PublishUpdate publishUpdate = Requests.createPublishUpdate(distNameIdentifier,
metadata, MetadataLifetime.forever);
request = Requests.createPublishReq(publishUpdate);
} else {
String filter = "ics-meta:bhi-certificate";
PublishDelete publishDelete = Requests.createPublishDelete(distNameIdentifier, filter);
publishDelete.addNamespaceDeclaration(IfmapStrings.ICS_METADATA_PREFIX,
IfmapStrings.ICS_METADATA_NS_URI);
request = Requests.createPublishReq(publishDelete);
}
// publish
publishIfmapData(request);
}
示例3: createCategory
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入方法依赖的package包/类
private static Identity createCategory(String name, String admDomain) {
return Identifiers.createIdentity(
IdentityType.other,
name,
admDomain,
OTHER_TYPE_DEFINITION);
}
示例4: main
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入方法依赖的package包/类
public static void main(String[] args) {
command = "auth-as";
ArgumentParser parser = createDefaultParser();
ParserUtil.addPublishOperation(parser);
ParserUtil.addAccessRequest(parser);
ParserUtil.addUsernameIdentity(parser);
parseParameters(parser, args);
printParameters(KEY_OPERATION, new String[] {KEY_ACCESS_REQUEST, KEY_IDENTITY_USERNAME});
String ar = resource.getString(KEY_ACCESS_REQUEST);
String id = resource.getString(KEY_IDENTITY_USERNAME);
// prepare identifiers
Identifier arIdentifier = Identifiers.createAr(ar);
Identifier idIdentifier = Identifiers.createIdentity(IdentityType.userName, id);
// prepare metadata
Document metadata = mf.createAuthAs();
PublishRequest request;
// update or delete
if (isUpdate(KEY_OPERATION)) {
PublishUpdate publishUpdate = Requests.createPublishUpdate(arIdentifier, idIdentifier,
metadata, MetadataLifetime.forever);
request = Requests.createPublishReq(publishUpdate);
} else {
String filter = "meta:authenticated-as";
PublishDelete publishDelete = Requests.createPublishDelete(arIdentifier, idIdentifier, filter);
publishDelete.addNamespaceDeclaration(IfmapStrings.STD_METADATA_PREFIX,
IfmapStrings.STD_METADATA_NS_URI);
request = Requests.createPublishReq(publishDelete);
}
// publish
publishIfmapData(request);
}
示例5: createCategory
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入方法依赖的package包/类
private static Identity createCategory(String name) {
return Identifiers.createIdentity(
IdentityType.other,
name,
mDevice,
OTHER_TYPE_DEFINITION);
}
示例6: main
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入方法依赖的package包/类
/**
* main method
*/
public static void main(String[] args) {
command = "dn-hit";
ArgumentParser parser = createDefaultParser();
ParserUtil.addPublishOperation(parser);
ParserUtil.addDistinguishedNameIdentity(parser);
ParserUtil.addHipHitIdentity(parser);
parseParameters(parser, args);
printParameters(KEY_OPERATION, new String[] {KEY_IDENTITY_DISTINGUISHED_NAME, KEY_IDENTITY_HIP_HIT});
String distName = resource.getString(KEY_IDENTITY_DISTINGUISHED_NAME);
String hipHit = resource.getString(KEY_IDENTITY_HIP_HIT);
// prepare identifiers
Identifier distNameIdentifier = Identifiers.createIdentity(IdentityType.distinguishedName, distName);
Identifier hipHitIdentifier = Identifiers.createIdentity(IdentityType.hipHit, hipHit);
// prepare metadata
Document metadata = icsmf.createDnHit();
PublishRequest request;
// update or delete
if (isUpdate(KEY_OPERATION)) {
PublishUpdate publishUpdate = Requests.createPublishUpdate(distNameIdentifier, hipHitIdentifier,
metadata, MetadataLifetime.forever);
request = Requests.createPublishReq(publishUpdate);
} else {
String filter = "ics-meta:dn-hit";
PublishDelete publishDelete = Requests.createPublishDelete(distNameIdentifier, hipHitIdentifier, filter);
publishDelete.addNamespaceDeclaration(IfmapStrings.ICS_METADATA_PREFIX, IfmapStrings.ICS_METADATA_NS_URI);
request = Requests.createPublishReq(publishDelete);
}
// publish
publishIfmapData(request);
}
示例7: main
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入方法依赖的package包/类
/**
* main method
*/
public static void main(String[] args) {
command = "bhi-id";
ArgumentParser parser = createDefaultParser();
ParserUtil.addPublishOperation(parser);
ParserUtil.addIcsBackhaulInterface(parser);
ParserUtil.addDistinguishedNameIdentity(parser);
parseParameters(parser, args);
printParameters(KEY_OPERATION, new String[] {KEY_ICS_BACKHAUL_INTERFACE, KEY_IDENTITY_DISTINGUISHED_NAME});
String bhi = resource.getString(KEY_ICS_BACKHAUL_INTERFACE);
String distName = resource.getString(KEY_IDENTITY_DISTINGUISHED_NAME);
// prepare identifiers
Identifier bhiIdentifier = IcsIdentifiers.createBackhaulInterface(bhi);
Identifier distNameIdentifier = Identifiers.createIdentity(IdentityType.distinguishedName, distName);
// prepare metadata
Document metadata = icsmf.createBhiIdent();
PublishRequest request;
// update or delete
if (isUpdate(KEY_OPERATION)) {
PublishUpdate publishUpdate = Requests.createPublishUpdate(bhiIdentifier, distNameIdentifier,
metadata, MetadataLifetime.forever);
request = Requests.createPublishReq(publishUpdate);
} else {
String filter = "ics-meta:bhi-id";
PublishDelete publishDelete = Requests.createPublishDelete(bhiIdentifier, distNameIdentifier, filter);
publishDelete.addNamespaceDeclaration(IfmapStrings.ICS_METADATA_PREFIX, IfmapStrings.ICS_METADATA_NS_URI);
request = Requests.createPublishReq(publishDelete);
}
// publish
publishIfmapData(request);
}
示例8: 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;
}
示例9: 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);
}
}
示例10: main
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入方法依赖的package包/类
public static void main(String[] args) {
command = "role";
ArgumentParser parser = createDefaultParser();
ParserUtil.addPublishOperation(parser);
ParserUtil.addAccessRequest(parser);
ParserUtil.addUsernameIdentity(parser);
ParserUtil.addRole(parser);
ParserUtil.addAdministrativeDomain(parser);
parseParameters(parser, args);
printParameters(KEY_OPERATION, new String[] {KEY_ACCESS_REQUEST, KEY_IDENTITY_USERNAME, KEY_ROLE, KEY_ADMINISTRATIVE_DOMAIN});
String ar = resource.getString(KEY_ACCESS_REQUEST);
String id = resource.getString(KEY_IDENTITY_USERNAME);
String role = resource.getString(KEY_ROLE);
String administrativeDomain = resource.getString(KEY_ADMINISTRATIVE_DOMAIN);
// prepare identifiers
Identifier arIdentifier = Identifiers.createAr(ar);
Identifier idIdentifier = Identifiers.createIdentity(IdentityType.userName, id);
Document metadata = null;
// prepare metadata
metadata = mf.createRole(role, administrativeDomain);
PublishRequest request;
// update or delete
if (isUpdate(KEY_OPERATION)) {
PublishUpdate publishUpdate = Requests.createPublishUpdate(arIdentifier, idIdentifier,
metadata, MetadataLifetime.forever);
request = Requests.createPublishReq(publishUpdate);
} else {
String filter = "meta:role[name='" + role + "']";
PublishDelete publishDelete = Requests.createPublishDelete(arIdentifier, idIdentifier, filter);
publishDelete.addNamespaceDeclaration(IfmapStrings.STD_METADATA_PREFIX,
IfmapStrings.STD_METADATA_NS_URI);
request = Requests.createPublishReq(publishDelete);
}
// publish
publishIfmapData(request);
}
示例11: main
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入方法依赖的package包/类
/**
* main method
*/
public static void main(String[] args) {
command = "ifmap-client-has-task";
ArgumentParser parser = createDefaultParser();
ParserUtil.addPublishOperation(parser);
ParserUtil.addDistinguishedNameIdentity(parser);
ParserUtil.addIcsOverlayNetworkGroup(parser);
ParserUtil.addContAutchRelationship(parser);
parseParameters(parser, args);
printParameters(KEY_OPERATION, new String[] {KEY_IDENTITY_DISTINGUISHED_NAME,
KEY_ICS_OVERLAY_NETWORK_GROUP, KEY_CONTAUTH_RELATIONSHIP});
String distName = resource.getString(KEY_IDENTITY_DISTINGUISHED_NAME);
String ovNetwGr = resource.getString(KEY_ICS_OVERLAY_NETWORK_GROUP);
// prepare identifiers
Identifier distNameIdentifier = Identifiers.createIdentity(IdentityType.distinguishedName, distName);
Identifier ovNetwGrIdentifier = IcsIdentifiers.createOverlayNetworkGroup(ovNetwGr);
// prepare metadata
String relationship = resource.getString(KEY_CONTAUTH_RELATIONSHIP);
Document metadata = conauthmf.creatIfmapClientHasTask(relationship);
PublishRequest request;
// update or delete
if (isUpdate(KEY_OPERATION)) {
PublishUpdate publishUpdate = Requests.createPublishUpdate(distNameIdentifier,
ovNetwGrIdentifier, metadata, MetadataLifetime.forever);
request = Requests.createPublishReq(publishUpdate);
} else {
String filter = "contauth-meta:ifmap-client-has-task";
PublishDelete publishDelete = Requests.createPublishDelete(distNameIdentifier, ovNetwGrIdentifier, filter);
publishDelete.addNamespaceDeclaration(IfmapStrings.CONTAUTH_METADATA_PREFIX,
IfmapStrings.CONTAUTH_METADATA_NS_URI);
request = Requests.createPublishReq(publishDelete);
}
// publish
publishIfmapData(request);
}
示例12: main
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入方法依赖的package包/类
/**
* main method
*/
public static void main(String[] args) {
command = "dev-char-ics";
ArgumentParser parser = createDefaultParser();
ParserUtil.addPublishOperation(parser);
ParserUtil.addDistinguishedNameIdentity(parser);
ParserUtil.addManufacturer(parser);
ParserUtil.addModel(parser);
ParserUtil.addOs(parser);
ParserUtil.addOsVersion(parser);
ParserUtil.addDeviceType(parser);
ParserUtil.addDiscoveredTime(parser);
ParserUtil.addDiscovererId(parser);
ParserUtil.addDiscoveryMethod(parser);
parseParameters(parser, args);
printParameters(KEY_OPERATION, new String[] {KEY_IDENTITY_DISTINGUISHED_NAME,
KEY_MANUFACTURER, KEY_MODEL, KEY_OS, KEY_OS_VERSION, KEY_DEVICE_TYPE,
KEY_DISCOVERED_TIME, KEY_DISCOVERER_ID, KEY_DISCOVERY_METHOD});
String distName = resource.getString(KEY_IDENTITY_DISTINGUISHED_NAME);
// prepare identifiers
Identifier distNameIdentifier = Identifiers.createIdentity(IdentityType.distinguishedName, distName);
Identifier ifmapClientCatalog = ContentAuthorizationIdentifiers.createIfmapClientCatalog();
// prepare metadata
String manufacturer = resource.getString(KEY_MANUFACTURER);
String model = resource.getString(KEY_MODEL);
String os = resource.getString(KEY_OS);
String osVersion = resource.getString(KEY_OS_VERSION);
String deviceType = resource.getString(KEY_DEVICE_TYPE);
String discovererTime = resource.getString(KEY_DISCOVERED_TIME);
String discovererId = resource.getString(KEY_DISCOVERER_ID);
String discoveryMethod = resource.getString(KEY_DISCOVERY_METHOD);
Document metadata = mf.createDevChar(manufacturer, model, os, osVersion, deviceType, discovererTime,
discovererId, discoveryMethod);
PublishRequest request;
// update or delete
if (isUpdate(KEY_OPERATION)) {
PublishUpdate publishUpdate = Requests.createPublishUpdate(distNameIdentifier, ifmapClientCatalog,
metadata, MetadataLifetime.forever);
request = Requests.createPublishReq(publishUpdate);
} else {
String filter = "meta:device-characteristic";
// String filter = String.format(
// "meta:device-characteristic[discovered-time='%s' and discoverer-id='%s' and discovery-method='%s']",
// discovererTime, discovererId, discoveryMethod);
PublishDelete publishDelete = Requests.createPublishDelete(distNameIdentifier, ifmapClientCatalog, filter);
publishDelete.addNamespaceDeclaration(IfmapStrings.STD_METADATA_PREFIX,
IfmapStrings.STD_METADATA_NS_URI);
request = Requests.createPublishReq(publishDelete);
}
// publish
publishIfmapData(request);
}
示例13: 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 + "'");
}
}
示例14: main
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入方法依赖的package包/类
public static void main(String[] args) {
command = "perf1";
long maxBytes = Runtime.getRuntime().maxMemory();
System.out.println("Max memory: " + maxBytes / 1024 / 1024 + "M");
ArgumentParser parser = createDefaultParser();
ParserUtil.addPerf1NumberRequests(parser);
ParserUtil.addPerf1NumberUpdates(parser);
ParserUtil.addPerf1NumberSprints(parser);
parseParameters(parser, args);
printParameters(new String[] {KEY_NUMBER_REQUESTS, KEY_NUMBER_UPDATES, KEY_NUMBER_SPRINTS});
int numberRequests = resource.getInt(KEY_NUMBER_REQUESTS);
int numberUpdates = resource.getInt(KEY_NUMBER_UPDATES);
int sizeSprint = resource.getInt(KEY_NUMBER_SPRINTS);
int numberOfSprints;
if (sizeSprint > numberRequests){
// there is only one sprint
numberOfSprints = 1;
sizeSprint = numberRequests;
} else {
numberOfSprints = numberRequests / sizeSprint;
}
Device rootNode = Identifiers.createDev("parentNode");
Document authBy = mf.createAuthBy();
ArrayList<PublishRequest> publishRequests = new ArrayList<PublishRequest>(1000);
PublishRequest pr;
PublishUpdate pu;
Identifier id;
// create a certain number of publish requests
for (int i = 0; i < numberRequests; i++) {
pr = Requests.createPublishReq();
// create a certain number of publish updates
for (int j = 0; j < numberUpdates; j++) {
pu = Requests.createPublishUpdate();
// generate new Identifier
id = Identifiers.createIdentity(IdentityType.userName,
new Integer(Perf1.counter++).toString());
pu.setIdentifier1(rootNode);
pu.setIdentifier2(id);
pu.addMetadata(authBy);
pr.addPublishElement(pu);
}
publishRequests.add(pr);
}
try {
SSRC ssrc = createSSRC();
ssrc.newSession();
long start = System.currentTimeMillis();
for (int i = 0; i < numberOfSprints; i++) {
System.out.print("Do publish sprint " + i);
long startSprint = System.currentTimeMillis();
for (int j = i * sizeSprint; j < (i * sizeSprint) + sizeSprint; j++) {
pr = publishRequests.get(j);
ssrc.publish(pr);
}
long endSprint = System.currentTimeMillis();
System.out.print(" done! -> ");
System.out.println("Duration: " + (endSprint - startSprint) + "ms");
}
long end = System.currentTimeMillis();
System.out.println("Total Duration: " + (end - start) + "ms");
ssrc.endSession();
} catch (Exception e) {
e.printStackTrace();
System.exit(-1);
}
}
示例15: createCategory
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入方法依赖的package包/类
/**
* Creates a identity-category node.
*
* @param name
* the name of the category
* @param admDomain
* the device name
* @return
*/
private Identity createCategory(String name, String admDomain) {
return Identifiers.createIdentity(IdentityType.other, name, admDomain,
OTHER_TYPE_DEFINITION);
}