本文整理汇总了Java中de.hshannover.f4.trust.ifmapj.identifier.Identifiers类的典型用法代码示例。如果您正苦于以下问题:Java Identifiers类的具体用法?Java Identifiers怎么用?Java Identifiers使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Identifiers类属于de.hshannover.f4.trust.ifmapj.identifier包,在下文中一共展示了Identifiers类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:trustathsh,项目名称:irongpm,代码行数:21,代码来源:PolicyPublisher.java
示例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;
}
开发者ID:trustathsh,项目名称:ironvas,代码行数:22,代码来源:EventUpdateConverter.java
示例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);
}
开发者ID:trustathsh,项目名称:ironvas,代码行数:24,代码来源:SelfPublisher.java
示例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());
}
开发者ID:trustathsh,项目名称:ironvas,代码行数:25,代码来源:SelfPublisher.java
示例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());
}
开发者ID:trustathsh,项目名称:ironvas,代码行数:22,代码来源:SelfPublisher.java
示例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);
}
开发者ID:trustathsh,项目名称:ifmapcli,代码行数:19,代码来源:FeatureSingle.java
示例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;
}
开发者ID:trustathsh,项目名称:visitmeta,代码行数:24,代码来源:EditPolicyNodeContextMenuItem.java
示例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;
}
开发者ID:trustathsh,项目名称:visitmeta,代码行数:22,代码来源:EditPolicyNodeContextMenuItem.java
示例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);
}
开发者ID:trustathsh,项目名称:visitmeta,代码行数:19,代码来源:InMemoryIdentifierFactoryTest.java
示例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());
}
开发者ID:trustathsh,项目名称:visitmeta,代码行数:24,代码来源:PollTaskTest.java
示例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());
}
开发者ID:trustathsh,项目名称:visitmeta,代码行数:24,代码来源:PollTaskTest.java
示例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))));
}
开发者ID:trustathsh,项目名称:visitmeta,代码行数:25,代码来源:ExtensiveSingleMultivalueTest.java
示例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))));
}
开发者ID:trustathsh,项目名称:visitmeta,代码行数:25,代码来源:GraphDeleteTest.java
示例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))));
}
开发者ID:trustathsh,项目名称:visitmeta,代码行数:17,代码来源:RareNotifyTest.java
示例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))));
}
开发者ID:trustathsh,项目名称:visitmeta,代码行数:17,代码来源:SimpleSingleMultiValueDeleteTest.java
示例16: buildSingleValueTwoIdentifierPollResult
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入依赖的package包/类
private PollResult buildSingleValueTwoIdentifierPollResult() {
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))));
}
开发者ID:trustathsh,项目名称:visitmeta,代码行数:17,代码来源:SimpleSingleMultiValueDeleteTest.java
示例17: createExtendedIdentifier
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入依赖的package包/类
/**
* Creates an Extended Identifier.
*
* @param namespaceUri
* URI of the namespace of the inner XML of the Extended Identifier
* @param namespacePrefix
* prefix of the namespace of the inner XML of the Extended Identifier
* @param identifierName
* the name value of the Extended Identifier (will be the root node of the inner XML)
* @param attributeValue
* a value for the attribute <i>name</i>
* @param administrativeDomain
* the value of the administrativeDomain attribute
* @return an {@link Identity} instance encapsulating the Extended Identifier
*/
public static Identity createExtendedIdentifier(String namespaceUri, String namespacePrefix, String identifierName,
String attributeValue,
String administrativeDomain) {
Document doc = mDocumentBuilder.newDocument();
Element e = doc.createElementNS(namespaceUri,
namespacePrefix
+ ":" + identifierName);
if (attributeValue != null) {
e.setAttribute("name", attributeValue);
}
e.setAttribute("administrative-domain", administrativeDomain);
doc.appendChild(e);
try {
return Identifiers.createExtendedIdentity(doc);
} catch (MarshalException e1) {
IfmapJLog.error("document that contains the extended identifier can't be handled");
throw new RuntimeException(e1);
}
}
开发者ID:trustathsh,项目名称:ifmapj,代码行数:35,代码来源:ExtendedIdentifiers.java
示例18: 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
示例19: publishRules
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入依赖的package包/类
/**
* @param ruleLoaderMapping
* @throws IfmapErrorResult
* @throws IfmapException
*/
public static void publishRules(Map<String, List<RuleWrapper>> ruleLoaderMapping)
throws IfmapErrorResult, IfmapException {
LOGGER.trace("Method publishRules(Map<String, List<RuleWrapper>> ruleLoaderMapping) called");
LOGGER.info("Trying to publish irongpm rules.");
PublishRequest request = Requests.createPublishReq();
List<PublishElement> rulePublishElements = new ArrayList<>();
String startIdentifierDeviceName;
if (mConfig.getBoolean("irongpm.publisher.selfpublish.enabled", true)) {
startIdentifierDeviceName = mConfig.getString("irongpm.publisher.selfpublish.devicename", "irongpm");
} else {
startIdentifierDeviceName = mConfig.getString("irongpm.publisher.policy.devicename", "irongpm-policy");
}
Identifier startDeviceIdentifier = Identifiers.createDev(startIdentifierDeviceName);
Identifier ironGpmPolicyIdentifier;
for (String ruleLoaderName : ruleLoaderMapping.keySet()) {
ironGpmPolicyIdentifier = createPolicyIdentifier(ruleLoaderName);
PublishElement deviceToPolicy = createDeviceToPolicy(startDeviceIdentifier, ironGpmPolicyIdentifier);
request.addPublishElement(deviceToPolicy);
rulePublishElements.addAll(createPublishElementsFromRuleWrappers(ruleLoaderMapping.get(ruleLoaderName),
ironGpmPolicyIdentifier));
for (PublishElement publishElement : rulePublishElements) {
request.addPublishElement(publishElement);
}
}
IfmapPublishUtil.publish(request);
}
开发者ID:trustathsh,项目名称:irongpm,代码行数:37,代码来源:PolicyPublisher.java
示例20: createPolicyIdentifier
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers; //导入依赖的package包/类
private static Identifier createPolicyIdentifier(String ruleLoaderName) throws MarshalException {
LOGGER.trace("Method createPolicyIdentifier(String ruleLoaderName) called");
String policyIdentifierDocument = "<"
+ IDENTIFIER_NAMESPACE_PREFIX + ":" + POLICY_IDENTIFIER + " "
+ "administrative-domain=\"" + POLICY_ADMINSTRATIVE_DOMAIN + "\" "
+ "xmlns:" + IDENTIFIER_NAMESPACE_PREFIX + "=\"" + POLICY_IDENTIFIER_NS_URI + "\" >"
+ "<name>" + ruleLoaderName + "</name>"
+ "</" + IDENTIFIER_NAMESPACE_PREFIX + ":" + POLICY_IDENTIFIER + ">";
return Identifiers.createExtendedIdentity(policyIdentifierDocument);
}
开发者ID:trustathsh,项目名称:irongpm,代码行数:13,代码来源:PolicyPublisher.java
注:本文中的de.hshannover.f4.trust.ifmapj.identifier.Identifiers类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论