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


Java Identifiers.createAr方法代码示例

本文整理汇总了Java中de.hshannover.f4.trust.ifmapj.identifier.Identifiers.createAr方法的典型用法代码示例。如果您正苦于以下问题:Java Identifiers.createAr方法的具体用法?Java Identifiers.createAr怎么用?Java Identifiers.createAr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在de.hshannover.f4.trust.ifmapj.identifier.Identifiers的用法示例。


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

示例1: convertVertex

import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入方法依赖的package包/类
/**
 * Converts an IF-MAP vertex to an ifmapj defined {@link Identifier}
 * 
 * @param vertex
 *            the vertex in internal format
 * @return the corresponding {@link Identifier}
 */
protected Identifier convertVertex(IfmapVertex vertex) {
	switch (vertex.getTypeName()) {
		case "device":
			return Identifiers.createDev(vertex.valueFor("/device/name"));
		case "ip-address":
			return Identifiers.createIp4(vertex.valueFor("/ip-address[@value]"));
		case "access-request":
			return Identifiers.createAr(vertex.valueFor("/access-request[@name]"));
		default:
			LOGGER.warn("Pu types than dev, ip and ar are not supported as entry points yet!");
			break;
	}
	return null;
}
 
开发者ID:trustathsh,项目名称:irongpm,代码行数:22,代码来源:PublishAction.java

示例2: 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);
}
 
开发者ID:trustathsh,项目名称:ifmapcli,代码行数:40,代码来源:ArMac.java

示例3: 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);
}
 
开发者ID:trustathsh,项目名称:ifmapcli,代码行数:40,代码来源:AuthAs.java

示例4: main

import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入方法依赖的package包/类
public static void main(String[] args) {
	command = "auth-by";
	
	ArgumentParser parser = createDefaultParser();
	ParserUtil.addPublishOperation(parser);
	ParserUtil.addAccessRequest(parser);
	ParserUtil.addDevice(parser);

	parseParameters(parser, args);
	
	printParameters(KEY_OPERATION, new String[] {KEY_ACCESS_REQUEST, KEY_DEVICE});
	
	String ar = resource.getString(KEY_ACCESS_REQUEST);
	String dev = resource.getString(KEY_DEVICE);
	
	// prepare identifiers
	Identifier arIdentifier = Identifiers.createAr(ar);
	Identifier devIdentifier = Identifiers.createDev(dev);

	// prepare metadata
	Document metadata = mf.createAuthBy();

	PublishRequest request;
	// update or delete
	if (isUpdate(KEY_OPERATION)) {
		PublishUpdate publishUpdate = Requests.createPublishUpdate(arIdentifier, devIdentifier,
				metadata, MetadataLifetime.forever);
		request = Requests.createPublishReq(publishUpdate);
	} else {
		String filter = "meta:authenticated-by";
		PublishDelete publishDelete = Requests.createPublishDelete(arIdentifier, devIdentifier, filter);
		publishDelete.addNamespaceDeclaration(IfmapStrings.STD_METADATA_PREFIX,
				IfmapStrings.STD_METADATA_NS_URI);
		request = Requests.createPublishReq(publishDelete);
	}

	// publish
	publishIfmapData(request);
}
 
开发者ID:trustathsh,项目名称:ifmapcli,代码行数:40,代码来源:AuthBy.java

示例5: main

import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入方法依赖的package包/类
public static void main(String[] args) {
	command = "ar-ip";
	
	ArgumentParser parser = createDefaultParser();
	ParserUtil.addPublishOperation(parser);
	ParserUtil.addAccessRequest(parser);
	ParserUtil.addIpv4Address(parser);

	parseParameters(parser, args);
	
	printParameters(KEY_OPERATION, new String[] {KEY_ACCESS_REQUEST, KEY_IP});

	String ar = resource.getString(KEY_ACCESS_REQUEST);
	String ip = resource.getString(KEY_IP);
	
	// prepare identifiers
	Identifier arIdentifier = Identifiers.createAr(ar);
	Identifier ipIdentifier = Identifiers.createIp4(ip);

	// prepare metadata
	Document metadata = mf.createArIp();

	PublishRequest request;
	// update or delete
	if (isUpdate(KEY_OPERATION)) {
		PublishUpdate publishUpdate = Requests.createPublishUpdate(arIdentifier, ipIdentifier,
				metadata, MetadataLifetime.forever);
		request = Requests.createPublishReq(publishUpdate);
	} else {
		String filter = "meta:access-request-ip";
		PublishDelete publishDelete = Requests.createPublishDelete(arIdentifier, ipIdentifier, filter);
		publishDelete.addNamespaceDeclaration(IfmapStrings.STD_METADATA_PREFIX,
				IfmapStrings.STD_METADATA_NS_URI);
		request = Requests.createPublishReq(publishDelete);
	}

	publishIfmapData(request);
}
 
开发者ID:trustathsh,项目名称:ifmapcli,代码行数:39,代码来源:ArIp.java

示例6: main

import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入方法依赖的package包/类
public static void main(String[] args) {
	command = "ar-dev";
	
	ArgumentParser parser = createDefaultParser();
	ParserUtil.addPublishOperation(parser);
	ParserUtil.addAccessRequest(parser);
	ParserUtil.addDevice(parser);

	parseParameters(parser, args);

	printParameters(KEY_OPERATION, new String[] {KEY_ACCESS_REQUEST, KEY_DEVICE});
	
	String ar = resource.getString(KEY_ACCESS_REQUEST);
	String dev = resource.getString(KEY_DEVICE);

	// prepare identifiers
	Identifier arIdentifier = Identifiers.createAr(ar);
	Identifier devIdentifier = Identifiers.createDev(dev);

	// prepare metadata
	Document metadata = mf.createArDev();

	PublishRequest request;
	// update or delete
	if (isUpdate(KEY_OPERATION)) {
		PublishUpdate publishUpdate = Requests.createPublishUpdate(arIdentifier, devIdentifier, metadata, MetadataLifetime.forever);
		request = Requests.createPublishReq(publishUpdate);
	} else {
		String filter = "meta:access-request-device";
		PublishDelete publishDelete = Requests.createPublishDelete(arIdentifier, devIdentifier, filter);
		publishDelete.addNamespaceDeclaration(IfmapStrings.STD_METADATA_PREFIX,
				IfmapStrings.STD_METADATA_NS_URI);
		request = Requests.createPublishReq(publishDelete);
	}

	// publish
	publishIfmapData(request);
}
 
开发者ID:trustathsh,项目名称:ifmapcli,代码行数:39,代码来源:ArDev.java

示例7: 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 + "'");
	}
}
 
开发者ID:trustathsh,项目名称:visitmeta,代码行数:28,代码来源:SubscriptionHelper.java

示例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;
}
 
开发者ID:trustathsh,项目名称:irongpm,代码行数:42,代码来源:PolicyPublisher.java

示例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);
	}
}
 
开发者ID:trustathsh,项目名称:ifmapcli,代码行数:47,代码来源:Pdp.java

示例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);
}
 
开发者ID:trustathsh,项目名称:ifmapcli,代码行数:45,代码来源:Role.java

示例11: main

import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入方法依赖的package包/类
public static void main(String[] args) {
	command = "wlan-info";
	
	ArgumentParser parser = createDefaultParser();
	ParserUtil.addPublishOperation(parser);
	ParserUtil.addAccessRequest(parser);
	ParserUtil.addDevice(parser);
	ParserUtil.addWlanInfoSsid(parser);
	ParserUtil.addWlanInfoUnicastSecurity(parser);
	ParserUtil.addWlanInfoGroupSecurity(parser);
	ParserUtil.addWlanInfoManagementSecurity(parser);
	
	parseParameters(parser, args);
	
	printParameters(KEY_OPERATION, new String[] {KEY_ACCESS_REQUEST, 
			KEY_DEVICE,
			KEY_WLAN_INFORMATION_SSID,
			KEY_WLAN_INFORMATION_UNICAST_SECURITY,
			KEY_WLAN_INFORMATION_GROUP_SECURITY,
			KEY_WLAN_INFORMATION_MANAGEMENT_SECURITY});
	
	String ar = resource.getString(KEY_ACCESS_REQUEST);
	String device = resource.getString(KEY_DEVICE);
	String ssid = resource.getString(KEY_WLAN_INFORMATION_SSID);
	List<WlanSecurityEnum> ssidUnicastSecurity = resource.get(KEY_WLAN_INFORMATION_UNICAST_SECURITY);
	WlanSecurityEnum ssidGroupSecurity = resource.get(KEY_WLAN_INFORMATION_GROUP_SECURITY);
	List<WlanSecurityEnum> ssidManagementSecurity = resource.get(KEY_WLAN_INFORMATION_MANAGEMENT_SECURITY);
	
	// prepare identifiers
	Identifier arIdentifier = Identifiers.createAr(ar);
	Identifier devIdentifier = Identifiers.createDev(device);

	// prepare metadata
	Document metadata = mf.createWlanInformation(ssid,
			IfmapjEnumConverter.ifmapjWlanSecurityTypeListFrom(ssidUnicastSecurity),
			new WlanSecurityType(IfmapjEnumConverter.ifmapjWlanSecurityTypeFrom(ssidGroupSecurity), null),
			IfmapjEnumConverter.ifmapjWlanSecurityTypeListFrom(ssidManagementSecurity));

	PublishRequest request;
	// update or delete
	if (isUpdate(KEY_OPERATION)) {
		PublishUpdate publishUpdate = Requests.createPublishUpdate(arIdentifier, devIdentifier,
				metadata, MetadataLifetime.forever);
		request = Requests.createPublishReq(publishUpdate);
	} else {
		String filter = "meta:wlan-information";
		PublishDelete publishDelete = Requests.createPublishDelete(arIdentifier, devIdentifier, filter);
		publishDelete.addNamespaceDeclaration(IfmapStrings.STD_METADATA_PREFIX,
				IfmapStrings.STD_METADATA_NS_URI);
		request = Requests.createPublishReq(publishDelete);
	}

	// publish
	publishIfmapData(request);
}
 
开发者ID:trustathsh,项目名称:ifmapcli,代码行数:56,代码来源:WlanInfo.java

示例12: main

import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入方法依赖的package包/类
public static void main(String[] args) {
	command = "layer2-info";
	
	ArgumentParser parser = createDefaultParser();
	ParserUtil.addPublishOperation(parser);
	ParserUtil.addAccessRequest(parser);
	ParserUtil.addDevice(parser);
	ParserUtil.addVlanNumber(parser);
	ParserUtil.addVlanName(parser);
	ParserUtil.addPort(parser);
	ParserUtil.addAdministrativeDomain(parser);
	
	parseParameters(parser, args);
	
	printParameters(KEY_OPERATION, new String[] {KEY_ACCESS_REQUEST, KEY_DEVICE, KEY_VLAN_NUMBER, KEY_VLAN_NAME, KEY_PORT, KEY_ADMINISTRATIVE_DOMAIN});

	String ar = resource.getString(KEY_ACCESS_REQUEST);
	String dev = resource.getString(KEY_DEVICE);
	Integer vlanNumber = resource.getInt(KEY_VLAN_NUMBER);
	String vlanName = resource.getString(KEY_VLAN_NAME);
	Integer port = resource.getInt(KEY_PORT);
	String administrativeDomain = resource.getString(KEY_ADMINISTRATIVE_DOMAIN);
	
	// prepare identifiers
	Identifier arIdentifier = Identifiers.createAr(ar);
	Identifier devIdentifier = Identifiers.createDev(dev);

	Document metadata = null;
	// prepare metadata
	metadata = mf.createLayer2Information(
			vlanNumber,
			vlanName,
			port,
			administrativeDomain);

	PublishRequest request;
	// update or delete
	if (isUpdate(KEY_OPERATION)) {
		PublishUpdate publishUpdate = Requests.createPublishUpdate(arIdentifier, devIdentifier,
				metadata, MetadataLifetime.forever);
		request = Requests.createPublishReq(publishUpdate);
	} else {
		// TODO check if values for VLAN_NUMBER, VLAN_NAME and PORT are available
		String filter = "meta:layer2-information[vlan=" + vlanNumber + " " +
												"and vlan-name='" + vlanName + "' " +
												"and port=" + port +
												"]";
		PublishDelete publishDelete = Requests.createPublishDelete(arIdentifier, devIdentifier, filter);
		publishDelete.addNamespaceDeclaration(IfmapStrings.STD_METADATA_PREFIX,
				IfmapStrings.STD_METADATA_NS_URI);
		request = Requests.createPublishReq(publishDelete);
	}

	// publish
	publishIfmapData(request);
}
 
开发者ID:trustathsh,项目名称:ifmapcli,代码行数:57,代码来源:Layer2Info.java

示例13: main

import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入方法依赖的package包/类
public static void main(String[] args) {
	command = "cap";
	
	ArgumentParser parser = createDefaultParser();
	ParserUtil.addPublishOperation(parser);
	ParserUtil.addAccessRequest(parser);
	ParserUtil.addCapability(parser);
	ParserUtil.addAdministrativeDomain(parser);

	parseParameters(parser, args);
	
	printParameters(KEY_OPERATION, new String[] {KEY_ACCESS_REQUEST, KEY_CAP_NAME, KEY_ADMINISTRATIVE_DOMAIN});

	String ar = resource.getString(KEY_ACCESS_REQUEST);
	String cap = resource.getString(KEY_CAP_NAME);
	String administrativeDomain = resource.getString(KEY_ADMINISTRATIVE_DOMAIN);

	// prepare identifiers
	Identifier arIdentifier = Identifiers.createAr(ar);

	Document metadata = null;
	// prepare metadata
	if (administrativeDomain != null) {			
		metadata = mf.createCapability(cap, administrativeDomain);
	} else {			
		metadata = mf.createCapability(cap);
	}

	PublishRequest request;
	// update or delete
	if (isUpdate(KEY_OPERATION)) {
		PublishUpdate publishUpdate = Requests.createPublishUpdate(arIdentifier,
				metadata, MetadataLifetime.forever);
		request = Requests.createPublishReq(publishUpdate);
	} else {
		String filter = "meta:capability[name='" + cap + "']";
		PublishDelete publishDelete = Requests.createPublishDelete(arIdentifier, filter);
		publishDelete.addNamespaceDeclaration(IfmapStrings.STD_METADATA_PREFIX,
				IfmapStrings.STD_METADATA_NS_URI);
		request = Requests.createPublishReq(publishDelete);
	}

	// publish
	publishIfmapData(request);
}
 
开发者ID:trustathsh,项目名称:ifmapcli,代码行数:46,代码来源:Cap.java

示例14: 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 + "'");
	}
}
 
开发者ID:trustathsh,项目名称:ifmapcli,代码行数:43,代码来源:AbstractClient.java

示例15: main

import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入方法依赖的package包/类
public static void main(String[] args) {
	command = "dev-attr";
	
	ArgumentParser parser = createDefaultParser();
	ParserUtil.addPublishOperation(parser);
	ParserUtil.addAccessRequest(parser);
	ParserUtil.addDevice(parser);
	ParserUtil.addDeviceAttribute(parser);
	
	parseParameters(parser, args);
	
	printParameters(KEY_OPERATION, new String[] {KEY_ACCESS_REQUEST, KEY_DEVICE, KEY_ATTR});
	
	String ar = resource.getString(KEY_ACCESS_REQUEST);
	String dev = resource.getString(KEY_DEVICE);
	String attr = resource.getString(KEY_ATTR);

	// prepare identifiers
	Identifier arIdentifier = Identifiers.createAr(ar);
	Identifier devIdentifier = Identifiers.createDev(dev);

	// prepare metadata
	Document metadata = mf.createDevAttr(attr);

	PublishRequest request;
	// update or delete
	if (isUpdate(KEY_OPERATION)) {
		PublishUpdate publishUpdate = Requests.createPublishUpdate(arIdentifier, devIdentifier,
				metadata, MetadataLifetime.forever);
		request = Requests.createPublishReq(publishUpdate);
	} else {
		String filter = "meta:device-attribute[name='" + attr + "']";
		PublishDelete publishDelete = Requests.createPublishDelete(arIdentifier, devIdentifier, filter);
		publishDelete.addNamespaceDeclaration(IfmapStrings.STD_METADATA_PREFIX,
				IfmapStrings.STD_METADATA_NS_URI);
		request = Requests.createPublishReq(publishDelete);
	}

	// publish
	publishIfmapData(request);
}
 
开发者ID:trustathsh,项目名称:ifmapcli,代码行数:42,代码来源:DevAttr.java


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