本文整理汇总了Java中de.hshannover.f4.trust.ifmapj.identifier.Identifiers类的典型用法代码示例。如果您正苦于以下问题:Java Identifiers类的具体用法?Java Identifiers怎么用?Java Identifiers使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Identifiers类属于de.hshannover.f4.trust.ifmapj.identifier包,在下文中一共展示了Identifiers类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createRuleStartIdentifier
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入依赖的package包/类
private static Identifier createRuleStartIdentifier(RuleWrapper rule) throws MarshalException {
LOGGER.trace("Method createRuleStartIdentifier(RuleWrapper rule) called");
String name = rule.getName();
long id = rule.getId();
String description = rule.getDescription();
String recommendation = rule.getRecommendation();
String ruleIdentifierDocument = "<"
+ IDENTIFIER_NAMESPACE_PREFIX + ":" + RULE_IDENTIFIER + " "
+ "administrative-domain=\"" + POLICY_ADMINSTRATIVE_DOMAIN + "\" "
+ "xmlns:" + IDENTIFIER_NAMESPACE_PREFIX + "=\"" + POLICY_IDENTIFIER_NS_URI + "\" >"
+ "<name>" + name + "</name>"
+ "<id>" + id + "</id>"
+ "<description>" + description + "</description>"
+ "<recommendation>" + recommendation + "</recommendation>"
+ "</" + IDENTIFIER_NAMESPACE_PREFIX + ":" + RULE_IDENTIFIER + ">";
return Identifiers.createExtendedIdentity(ruleIdentifierDocument);
}
示例2: singleUpdate
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入依赖的package包/类
public PublishElement singleUpdate(Vulnerability v) {
IpAddress ip = Identifiers.createIp4(v.getHost());
Document metadata = mMetadataFactory.createEvent(v.getNvt().getName(), // name
mDateFormat.format(v.getTimestamp()), // discovered-time
mContext.getOpenVasServerId(), // discoverer-id
(int) (v.getNvt().getCvssBase() * 10 + 0.5), // magnitude
// (0-100)
0, // confidence TODO define
mapSignificance(v.getNvt().getRiskFactor()), // significance
EventType.cve, // type
v.getId(), // other-type-definition
v.getDescription(), // information
v.getNvt().getCve() // vulnerability-uri
);
PublishUpdate update = Requests.createPublishUpdate();
update.setIdentifier1(ip);
update.addMetadata(metadata);
return update;
}
示例3: createSelfPublishRequest
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入依赖的package包/类
public static PublishRequest createSelfPublishRequest(String ipValue, String deviceName,
String serviceName, String serviceType, String servicePort, String implementationName,
String implementationVersion, String implementationPlatform, String implementationPatch,
String administrativeDomain) {
List<PublishElement> publishElements = new ArrayList<PublishElement>();
Identifier ip = Identifiers.createIp4(ipValue);
Identifier device = Identifiers.createDev(deviceName);
publishElements.add(createDeviceIpPubElement(device, ip));
try {
Identifier service = createService(serviceName, serviceType, servicePort, administrativeDomain);
Identifier implementation = createImplementation(implementationName, implementationVersion,
implementationPlatform, implementationPatch, administrativeDomain);
publishElements.add(createServiceIpPubElement(service, ip));
publishElements.add(createServiceImplementationPubElement(service, implementation));
} catch (MarshalException e) {
e.printStackTrace();
}
return Requests.createPublishReq(publishElements);
}
示例4: createImplementation
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入依赖的package包/类
private static Identifier createImplementation(String implementationName, String implementationVersion,
String implementationPatch, String implementationPlatform, String administrativeDomain)
throws MarshalException {
StringBuilder implementationDocument = new StringBuilder();
implementationDocument.append("<"
+ SIMU_IDENTIFIER_PREFIX + ":implementation ");
implementationDocument.append("administrative-domain=\""
+ administrativeDomain + "\" ");
implementationDocument.append("xmlns:"
+ SIMU_IDENTIFIER_PREFIX + "=\"" + SIMU_IDENTIFIER_URI + "\" ");
implementationDocument.append("name=\""
+ implementationName + "\" ");
implementationDocument.append("version=\""
+ implementationVersion + "\" ");
implementationDocument.append("local-version=\""
+ implementationPatch + "\" ");
implementationDocument.append("platform=\""
+ implementationPlatform + "\" ");
implementationDocument.append(">");
implementationDocument.append("</"
+ SIMU_IDENTIFIER_PREFIX + ":implementation>");
return Identifiers.createExtendedIdentity(implementationDocument.toString());
}
示例5: createService
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入依赖的package包/类
private static Identifier createService(String serviceName, String serviceType, String servicePort,
String administrativeDomain) throws MarshalException {
StringBuilder serviceDocument = new StringBuilder();
serviceDocument.append("<"
+ SIMU_IDENTIFIER_PREFIX + ":service ");
serviceDocument.append("administrative-domain=\""
+ administrativeDomain + "\" ");
serviceDocument.append("xmlns:"
+ SIMU_IDENTIFIER_PREFIX + "=\"" + SIMU_IDENTIFIER_URI + "\" ");
serviceDocument.append("type=\""
+ serviceType + "\" ");
serviceDocument.append("name=\""
+ serviceName + "\" ");
serviceDocument.append("port=\""
+ servicePort + "\" ");
serviceDocument.append(">");
serviceDocument.append("</"
+ SIMU_IDENTIFIER_PREFIX + ":service>");
return Identifiers.createExtendedIdentity(serviceDocument.toString());
}
示例6: preparePublishUpdatesOrDeletes
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入依赖的package包/类
private static void preparePublishUpdatesOrDeletes() {
PublishElement publishUpdateOrDelete;
DummyCategory root = prepareCategoriesAndFeature();
String nodeName = root.localId;
Device dev = Identifiers.createDev(mDevice);
Identity rootCategory = createCategory(nodeName);
Document deviceCategory = createCategoryLink("device-category");
if (mIsUpdate) {
publishUpdateOrDelete = Requests.createPublishUpdate(dev, rootCategory, deviceCategory, MetadataLifetime.forever);
mPublishElements.add(publishUpdateOrDelete);
} else {
publishUpdateOrDelete = Requests.createPublishDelete(dev, rootCategory);
mPublishElements.add(publishUpdateOrDelete);
}
fork(rootCategory, root.features, root.subCategories);
}
示例7: createUpdateRequest
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入依赖的package包/类
private PublishRequest createUpdateRequest(Document signatureDocument, Document conditionDocument) {
PublishRequest request = Requests.createPublishReq();
de.hshannover.f4.trust.ifmapj.identifier.Identifier signatureIdentifier;
de.hshannover.f4.trust.ifmapj.identifier.Identifier conditionIdentifier;
try {
signatureIdentifier = Identifiers.createExtendedIdentity(signatureDocument);
conditionIdentifier = Identifiers.createExtendedIdentity(conditionDocument);
PublishUpdate publishUpdate = Requests.createPublishUpdate();
publishUpdate.setIdentifier1(signatureIdentifier);
publishUpdate.setIdentifier2(conditionIdentifier);
publishUpdate.addMetadata(createMetadata());
publishUpdate.setLifeTime(MetadataLifetime.forever);
request.addPublishElement(publishUpdate);
} catch (MarshalException e) {
DialogHelper.showErrorDialog(e.getMessage(), "Marshal Exception");
logger.error(e.getMessage());
}
return request;
}
示例8: createDeleteRequest
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入依赖的package包/类
private PublishRequest createDeleteRequest(Document signatureDocument, Document conditionDocument) {
PublishRequest request = Requests.createPublishReq();
de.hshannover.f4.trust.ifmapj.identifier.Identifier signatureIdentifier;
de.hshannover.f4.trust.ifmapj.identifier.Identifier conditionIdentifier;
try {
signatureIdentifier = Identifiers.createExtendedIdentity(signatureDocument);
conditionIdentifier = Identifiers.createExtendedIdentity(conditionDocument);
PublishDelete publishDelete = Requests.createPublishDelete();
publishDelete.setIdentifier1(signatureIdentifier);
publishDelete.setIdentifier2(conditionIdentifier);
request.addPublishElement(publishDelete);
} catch (MarshalException e) {
DialogHelper.showErrorDialog(e.getMessage(), "Marshal Exception");
logger.error(e.getMessage());
}
return request;
}
示例9: 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);
}
示例10: thePollResultShouldContainAllReceivedUpdates
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入依赖的package包/类
@Test
public void thePollResultShouldContainAllReceivedUpdates() throws Exception {
PollResult pollResult = PollResultMock(
SearchResultMock(mSearchResultName, Type.updateResult,
ResultItemMock(
Identifiers.createIp4("10.1.1.1"),
Identifiers.createMac("ee:ee:ee:ee:ee:ee"),
CreateIpMac(FIRST_TIMESTAMP)),
ResultItemMock(
Identifiers.createIp4("10.1.1.9"),
Identifiers.createMac("ee:ee:ee:ee:ee:ee"),
CreateIpMac(FIRST_TIMESTAMP))),
SearchResultMock(mSearchResultName, Type.updateResult,
ResultItemMock(
Identifiers.createAr("111:33"),
Identifiers.createDev("device42"),
CreateArDev(FIRST_TIMESTAMP))));
when(mConnection.poll()).thenReturn(pollResult);
de.hshannover.f4.trust.visitmeta.ifmap.PollResult p = mPollTask.call();
assertEquals(3, p.getUpdates().size());
}
示例11: thePollResultShouldContainAllReceivedDeletes
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入依赖的package包/类
@Test
public void thePollResultShouldContainAllReceivedDeletes() throws Exception {
PollResult pollResult = PollResultMock(
SearchResultMock(mSearchResultName, Type.deleteResult,
ResultItemMock(
Identifiers.createIp4("10.1.1.1"),
Identifiers.createMac("ee:ee:ee:ee:ee:ee"),
CreateIpMac(FIRST_TIMESTAMP)),
ResultItemMock(
Identifiers.createIp4("10.1.1.9"),
Identifiers.createMac("ee:ee:ee:ee:ee:ee"),
CreateIpMac(FIRST_TIMESTAMP))),
SearchResultMock(mSearchResultName, Type.deleteResult,
ResultItemMock(
Identifiers.createAr("111:33"),
Identifiers.createDev("device42"),
CreateArDev(FIRST_TIMESTAMP))));
when(mConnection.poll()).thenReturn(pollResult);
de.hshannover.f4.trust.visitmeta.ifmap.PollResult p = mPollTask.call();
assertEquals(3, p.getDeletes().size());
}
示例12: buildSecondPollResult
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入依赖的package包/类
private PollResult buildSecondPollResult() {
return PollResultMock(
SearchResultMock(SUB2, Type.updateResult,
ResultItemMock(
Identifiers.createAr(ACCESS_REQUEST),
CreateCapability(CAP1, FIRST_TIMESTAMP)),
ResultItemMock(
Identifiers.createAr(ACCESS_REQUEST),
Identifiers.createMac(MAC1),
CreateArMac(FIRST_TIMESTAMP)),
ResultItemMock(
Identifiers.createAr(ACCESS_REQUEST),
CreateCapability(CAP2, FIRST_TIMESTAMP),
CreateCapability(CAP3, FIRST_TIMESTAMP)),
ResultItemMock(
Identifiers.createAr(ACCESS_REQUEST),
Identifiers.createMac(MAC2),
CreateArMac(SECOND_TIMESTAMP))),
SearchResultMock(SUB1, Type.updateResult,
ResultItemMock(
Identifiers.createAr(ACCESS_REQUEST),
Identifiers.createMac(MAC2),
CreateArMac(SECOND_TIMESTAMP))));
}
示例13: buildStartingGraphPollResult
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入依赖的package包/类
private PollResult buildStartingGraphPollResult() {
return PollResultMock(
SearchResultMock(Type.updateResult,
ResultItemMock(
Identifiers.createAr(ACCESS_REQUEST),
Identifiers.createMac(MAC1),
CreateArMac(FIRST_TIMESTAMP)),
ResultItemMock(
Identifiers.createAr(ACCESS_REQUEST),
Identifiers.createMac(MAC2),
CreateArMac(FIRST_TIMESTAMP)),
ResultItemMock(
Identifiers.createAr(ACCESS_REQUEST),
Identifiers.createMac(MAC3),
CreateArMac(FIRST_TIMESTAMP)),
ResultItemMock(
Identifiers.createAr(ACCESS_REQUEST),
Identifiers.createDev(DEV45),
CreateDevAttr(DEV45 + "-Attribute", FIRST_TIMESTAMP)),
ResultItemMock(
Identifiers.createAr(ACCESS_REQUEST),
CreateArDev(FIRST_TIMESTAMP),
CreateCapability(CAP1, FIRST_TIMESTAMP))));
}
示例14: buildFirstPollResult
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入依赖的package包/类
private PollResult buildFirstPollResult() {
return PollResultMock(
SearchResultMock(Type.updateResult,
ResultItemMock(
Identifiers.createAr(ACCESS_REQUEST),
Identifiers.createMac(MAC1),
CreateArMac(FIRST_TIMESTAMP)),
ResultItemMock(
Identifiers.createAr(ACCESS_REQUEST),
Identifiers.createMac(MAC2),
CreateArMac(FIRST_TIMESTAMP)),
ResultItemMock(
Identifiers.createAr(ACCESS_REQUEST),
CreateArDev(FIRST_TIMESTAMP),
CreateIpMac(FIRST_TIMESTAMP))));
}
示例15: buildMultiValueTwoIdentifierPollResult
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入依赖的package包/类
private PollResult buildMultiValueTwoIdentifierPollResult() {
return PollResultMock(
SearchResultMock(Type.updateResult,
ResultItemMock(
Identifiers.createAr(ACCESS_REQUEST),
Identifiers.createMac(MAC1),
CreateArMac(FIRST_TIMESTAMP)),
ResultItemMock(
Identifiers.createAr(ACCESS_REQUEST),
Identifiers.createMac(MAC2),
CreateArMac(FIRST_TIMESTAMP)),
ResultItemMock(
Identifiers.createAr(ACCESS_REQUEST),
Identifiers.createDev(DEV45),
CreateDevAttr(DEV45 + "-Attribute", FIRST_TIMESTAMP))));
}