本文整理汇总了Java中de.hshannover.f4.trust.ifmapj.messages.Requests类的典型用法代码示例。如果您正苦于以下问题:Java Requests类的具体用法?Java Requests怎么用?Java Requests使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Requests类属于de.hshannover.f4.trust.ifmapj.messages包,在下文中一共展示了Requests类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createDeviceToPolicy
import de.hshannover.f4.trust.ifmapj.messages.Requests; //导入依赖的package包/类
private static PublishElement createDeviceToPolicy(Identifier startDeviceIdentifier,
Identifier ironGpmPolicyIdentifier) {
LOGGER.trace(
"Method createDeviceToPolicy(Identifier startDeviceIdentifier, Identifier ironGpmPolicyIdentifier) called");
PublishUpdate result = Requests.createPublishUpdate();
result.setLifeTime(MetadataLifetime.session);
result.setIdentifier1(startDeviceIdentifier);
result.setIdentifier2(ironGpmPolicyIdentifier);
Document deviceToPolicyLinkMetadata = mMetadataFactory.create(DEVICE_TO_POLICY_LINK, POLICY_QUALIFIED_NAME,
POLICY_METADATA_NS_URI, Cardinality.singleValue);
result.addMetadata(deviceToPolicyLinkMetadata);
return result;
}
开发者ID:trustathsh,项目名称:irongpm,代码行数:17,代码来源:PolicyPublisher.java
示例2: createPolicyToRule
import de.hshannover.f4.trust.ifmapj.messages.Requests; //导入依赖的package包/类
private static PublishElement createPolicyToRule(Identifier ironGpmPolicyIdentifier,
Identifier ruleStartIdentifier) {
LOGGER.trace(
"Method createPolicyToRule(Identifier ironGpmPolicyIdentifier, Identifier ruleStartIdentifier) called");
PublishUpdate result = Requests.createPublishUpdate();
result.setLifeTime(MetadataLifetime.session);
result.setIdentifier1(ironGpmPolicyIdentifier);
result.setIdentifier2(ruleStartIdentifier);
Document policyToRuleLinkMetadata = mMetadataFactory.create(POLICY_TO_RULE_LINK, POLICY_QUALIFIED_NAME,
POLICY_METADATA_NS_URI, Cardinality.singleValue);
result.addMetadata(policyToRuleLinkMetadata);
return result;
}
开发者ID:trustathsh,项目名称:irongpm,代码行数:17,代码来源:PolicyPublisher.java
示例3: createRuleToFirstPatternVertex
import de.hshannover.f4.trust.ifmapj.messages.Requests; //导入依赖的package包/类
private static PublishElement createRuleToFirstPatternVertex(Identifier ruleStartIdentifier,
Identifier firstPatternVertexIdentifier) {
LOGGER.trace(
"Method createRuleToFirstPatternVertex(Identifier ruleStartIdentifier, Identifier firstPatternVertexIdentifier) called");
PublishUpdate result = Requests.createPublishUpdate();
result.setIdentifier1(ruleStartIdentifier);
result.setIdentifier2(firstPatternVertexIdentifier);
result.setLifeTime(MetadataLifetime.session);
Document ruleToFirstPatternVertexLinkMetadata =
mMetadataFactory.create(RULE_TO_FIRST_PATTERN_VERTEX_LINK, POLICY_QUALIFIED_NAME,
POLICY_METADATA_NS_URI, Cardinality.singleValue);
result.addMetadata(ruleToFirstPatternVertexLinkMetadata);
return result;
}
开发者ID:trustathsh,项目名称:irongpm,代码行数:18,代码来源:PolicyPublisher.java
示例4: createPublishElementForAttachedMetadata
import de.hshannover.f4.trust.ifmapj.messages.Requests; //导入依赖的package包/类
private static List<PublishElement> createPublishElementForAttachedMetadata(Identifier current,
List<Document> detachedMetadata) {
LOGGER.trace(
"Method createPublishElementForAttachedMetadata(Identifier current, List<Document> detachedMetadata) called");
List<PublishElement> result = new ArrayList<>();
for (Document doc : detachedMetadata) {
PublishUpdate publishUpdate = Requests.createPublishUpdate();
publishUpdate.setIdentifier1(current);
publishUpdate.setLifeTime(MetadataLifetime.session);
publishUpdate.addMetadata(doc);
result.add(publishUpdate);
}
return result;
}
开发者ID:trustathsh,项目名称:irongpm,代码行数:19,代码来源:PolicyPublisher.java
示例5: subscribeDelete
import de.hshannover.f4.trust.ifmapj.messages.Requests; //导入依赖的package包/类
void subscribeDelete(String[] keys) {
if (keys != null && keys.length > 0) {
SubscribeRequest req = Requests.createSubscribeReq();
for (String uuid : keys) {
SubscribeDelete delete = Requests.createSubscribeDelete(uuid);
req.addSubscribeElement(delete);
}
if (mSessionId != null) {
try {
mSsrc.subscribe(req);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
开发者ID:trustathsh,项目名称:irongui,代码行数:17,代码来源:IfmapCommunication.java
示例6: singleUpdate
import de.hshannover.f4.trust.ifmapj.messages.Requests; //导入依赖的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
示例7: createSelfPublishRequest
import de.hshannover.f4.trust.ifmapj.messages.Requests; //导入依赖的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
示例8: createServiceImplementationPubElement
import de.hshannover.f4.trust.ifmapj.messages.Requests; //导入依赖的package包/类
private static PublishElement createServiceImplementationPubElement(Identifier service, Identifier implementation) {
PublishUpdate result = Requests.createPublishUpdate();
String xmlString = "<"
+ SIMU_METADATA_PREFIX + ":service-implementation "
+ "ifmap-cardinality=\"singleValue\" "
+ "xmlns:" + SIMU_METADATA_PREFIX + "=\"" + SIMU_METADATA_URI + "\">"
+ "</" + SIMU_METADATA_PREFIX + ":service-implementation>";
Document link = VENDOR_FACTORY.createMetadata(xmlString);
result.setIdentifier1(service);
result.setIdentifier2(implementation);
result.addMetadata(link);
result.setLifeTime(MetadataLifetime.session);
return result;
}
开发者ID:trustathsh,项目名称:ironvas,代码行数:17,代码来源:SelfPublisher.java
示例9: createServiceIpPubElement
import de.hshannover.f4.trust.ifmapj.messages.Requests; //导入依赖的package包/类
private static PublishElement createServiceIpPubElement(Identifier service, Identifier ip) {
PublishUpdate result = Requests.createPublishUpdate();
String xmlString = "<"
+ SIMU_METADATA_PREFIX + ":service-ip "
+ "ifmap-cardinality=\"singleValue\" "
+ "xmlns:" + SIMU_METADATA_PREFIX + "=\"" + SIMU_METADATA_URI + "\">"
+ "</" + SIMU_METADATA_PREFIX + ":service-ip>";
Document link = VENDOR_FACTORY.createMetadata(xmlString);
result.setIdentifier1(service);
result.setIdentifier2(ip);
result.addMetadata(link);
result.setLifeTime(MetadataLifetime.session);
return result;
}
开发者ID:trustathsh,项目名称:ironvas,代码行数:17,代码来源:SelfPublisher.java
示例10: fork
import de.hshannover.f4.trust.ifmapj.messages.Requests; //导入依赖的package包/类
/**
* Creates the child nodes for the given parent {@link Identity}. The
* resulting {@link PublishUpdate}s for each child are added to
* <code>mPublishUpdates</code>.
*
* @param parent
* @param currentDepth
*/
private static void fork(Identity parent, int currentDepth, String[] path) {
if (currentDepth < treeDepth) {
int childCount = new Random().nextInt(maxChildsPerCategory) + 1;
for (int i = 0; i < childCount; i++) {
PublishUpdate update = Requests.createPublishUpdate();
String name = "category" + ((i % 4 == 0) ? ("X:" + (i / 4)) : i + "");
String fullNodeName = joinStrings(path) + "." + name;
Identity node = createCategory(fullNodeName, deviceIdentifier);
Document subCategoryOf = createCategoryLink("subcategory-of");
update.setIdentifier1(parent);
update.setIdentifier2(node);
update.addMetadata(subCategoryOf);
update.setLifeTime(MetadataLifetime.forever);
publishUpdates.add(update);
appendFeatures(node);
fork(node, currentDepth+1, append(name, path));
}
}
}
开发者ID:trustathsh,项目名称:ifmapcli,代码行数:34,代码来源:Feature.java
示例11: appendFeatures
import de.hshannover.f4.trust.ifmapj.messages.Requests; //导入依赖的package包/类
/**
* Appends random feature metadata to the given {@link Identity}.
* @param node
*/
private static void appendFeatures(Identity node) {
int featureCount = new Random().nextInt(maxFeaturePerCategory) + 1;
for (int i = 0; i < featureCount; i++) {
PublishUpdate update = Requests.createPublishUpdate();
Document feature = createFeature(Math.random() + "");
update.setIdentifier1(node);
update.addMetadata(feature);
update.setLifeTime(MetadataLifetime.forever);
publishUpdates.add(update);
}
}
开发者ID:trustathsh,项目名称:ifmapcli,代码行数:20,代码来源:Feature.java
示例12: addWlanInfo
import de.hshannover.f4.trust.ifmapj.messages.Requests; //导入依赖的package包/类
/**
* wlan-information metadata on the link between the access-request
* identifier and the device identifier of the PEP
*
* @param accessRequest
* @param pepDevice
*/
private static void addWlanInfo(Identifier accessRequest, Identifier pepDevice) {
// create and set wlan-information metadata
WlanSecurityType wlan1 = new WlanSecurityType(WlanSecurityEnum.ccmp, null);
WlanSecurityType wlan2 = new WlanSecurityType(WlanSecurityEnum.other, "my own wlan security type");
WlanSecurityType wlan3 = new WlanSecurityType(WlanSecurityEnum.tkip, null);
List<WlanSecurityType> unicastSec = new ArrayList<WlanSecurityType>();
unicastSec.add(wlan1);
List<WlanSecurityType> managementSec = new ArrayList<WlanSecurityType>();
managementSec.add(wlan3);
Document metadata = mf.createWlanInformation("eduroam", unicastSec, wlan2, managementSec);
PublishElement publishEl;
if(isUpdate){
publishEl = Requests.createPublishUpdate(accessRequest, pepDevice, metadata, MetadataLifetime.forever);
} else {
PublishDelete publishDelete = Requests.createPublishDelete(accessRequest, pepDevice, "meta:wlan-information");
publishDelete.addNamespaceDeclaration(IfmapStrings.STD_METADATA_PREFIX, IfmapStrings.STD_METADATA_NS_URI);
publishEl = publishDelete;
}
publishRequest.addPublishElement(publishEl);
}
开发者ID:trustathsh,项目名称:ifmapcli,代码行数:28,代码来源:Pdp.java
示例13: main
import de.hshannover.f4.trust.ifmapj.messages.Requests; //导入依赖的package包/类
public static void main(String[] args) {
command = "pdp";
ArgumentParser parser = createDefaultParser();
ParserUtil.addPublishOperation(parser);
ParserUtil.addIpv4Address(parser);
ParserUtil.addMacAddress(parser);
ParserUtil.addUsernameIdentity(parser);
parseParameters(parser, args);
printParameters(KEY_OPERATION, new String[] {KEY_IP, KEY_MAC, KEY_IDENTITY_USERNAME});
isUpdate = isUpdate(KEY_OPERATION);
ip = resource.getString(KEY_IP);
mac = resource.getString(KEY_MAC);
username = resource.getString(KEY_IDENTITY_USERNAME);
publishRequest = Requests.createPublishReq();
publish();
}
开发者ID:trustathsh,项目名称:ifmapcli,代码行数:22,代码来源:Pdp.java
示例14: preparePublishUpdatesOrDeletes
import de.hshannover.f4.trust.ifmapj.messages.Requests; //导入依赖的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
示例15: createUpdateRequest
import de.hshannover.f4.trust.ifmapj.messages.Requests; //导入依赖的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
示例16: createDeleteRequest
import de.hshannover.f4.trust.ifmapj.messages.Requests; //导入依赖的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
示例17: buildUpdateRequest
import de.hshannover.f4.trust.ifmapj.messages.Requests; //导入依赖的package包/类
public static SubscribeRequest buildUpdateRequest(SubscriptionData subscription) {
SubscribeRequest request = Requests.createSubscribeReq();
SubscribeUpdate subscribe = Requests.createSubscribeUpdate();
subscribe.setName(subscription.getName());
subscribe.setMaxDepth(subscription.getMaxDepth());
subscribe.setMaxSize(subscription.getMaxSize());
subscribe.setMatchLinksFilter(subscription.getMatchLinksFilter());
subscribe.setResultFilter(subscription.getResultFilter());
subscribe.setTerminalIdentifierTypes(subscription.getTerminalIdentifierTypes());
subscribe.setStartIdentifier(
createStartIdentifier(subscription.getIdentifierType(), subscription.getStartIdentifier()));
request.addSubscribeElement(subscribe);
return request;
}
开发者ID:trustathsh,项目名称:visitmeta,代码行数:18,代码来源:SubscriptionHelper.java
示例18: genericRequest
import de.hshannover.f4.trust.ifmapj.messages.Requests; //导入依赖的package包/类
@Override
public final Result genericRequest(Request req) throws IfmapErrorResult, IfmapException {
Document docReq;
Document docRes;
Element elBody;
Element content;
RequestHandler<? extends Request> reqhandler = Requests.getHandlerFor(req);
if (reqhandler == null) {
throw new MarshalException("No handler for " + req.getClass());
}
docReq = mDocumentBuilder.newDocument();
elBody = addSoapEnvelopeBody(docReq);
content = reqhandler.toElement(req, docReq);
elBody.appendChild(content);
docRes = parseDocument(doHttpRequest(DomHelpers.toInputStream(docReq)));
return reqhandler.fromElement(findResponseElement(docRes));
}
开发者ID:trustathsh,项目名称:ifmapj,代码行数:23,代码来源:AbstractChannel.java
示例19: poll
import de.hshannover.f4.trust.ifmapj.messages.Requests; //导入依赖的package包/类
@Override
public PollResult poll()
throws IfmapErrorResult, EndSessionException, IfmapException {
PollRequest pollReq = Requests.createPollReq();
Result res = genericRequestWithSessionId(pollReq);
if (res instanceof EndSessionException) {
throw (EndSessionException) res;
}
if (!(res instanceof PollResult)) {
throw new RuntimeException("Wrong result type for poll?");
}
return (PollResult) res;
}
开发者ID:trustathsh,项目名称:ifmapj,代码行数:17,代码来源:ArcImpl.java
示例20: performAction
import de.hshannover.f4.trust.ifmapj.messages.Requests; //导入依赖的package包/类
@Override
public void performAction(PatternRule rule, RuleMatch result) {
if (rule.getId() == result.getRuleId()) {
LOGGER.debug("Performing PublishEventAction for rule: " + rule.getId());
if (result.getPublishVertex() == null) {
LOGGER.warn("Publish not successful, PublishVertex is null for rule " + rule.getId());
return;
}
Identifier id = convertVertex(result.getPublishVertex());
if (id == null) {
LOGGER.warn("Publish not successful, converting the PublishVertex of rule " + rule.getId()
+ " to an ifmapj Identifier failed. Check above for other log entries.");
return;
}
Document updateEvent = mMf.createEvent(rule.getDescription(), result.getResultGraph().getLastUpdated()
.toString(), "GPM", 100, 100, Significance.critical, EventType.cve, "",
ResultUtil.buildRecommendation(rule.getRecommendation(), result), "");
PublishRequest update = Requests.createPublishReq();
update.addPublishElement(Requests.createPublishUpdate(id, updateEvent));
IfmapPublishUtil.publish(update);
boolean isPolicyPublisherEnabled = mConfig.getBoolean("irongpm.publisher.policy.enabled", false);
if (isPolicyPublisherEnabled) {
try {
PolicyPublisher.publishAction(rule, result);
} catch (IfmapErrorResult | IfmapException e) {
LOGGER.warn("Error at publishing pattern to matched identifier-link: " + e.getMessage());
}
}
} else {
LOGGER.warn("Failed performing action since rule (" + rule.getId() + ") and result (" + result.getRuleId()
+ ") id's did not match!");
}
}
开发者ID:trustathsh,项目名称:irongpm,代码行数:37,代码来源:PublishEventAction.java
注:本文中的de.hshannover.f4.trust.ifmapj.messages.Requests类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论