本文整理汇总了Java中com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.NamespaceVersion.getLatestVersion方法的典型用法代码示例。如果您正苦于以下问题:Java NamespaceVersion.getLatestVersion方法的具体用法?Java NamespaceVersion.getLatestVersion怎么用?Java NamespaceVersion.getLatestVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.NamespaceVersion
的用法示例。
在下文中一共展示了NamespaceVersion.getLatestVersion方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Policy
import com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.NamespaceVersion; //导入方法依赖的package包/类
/**
* Constructor that should be overridden by child implementation. The constructor allows for easy toString() output
* customization.
*
* @param toStringName a general name of the object (such as 'policy' or 'nested policy') that will be used in the
* toString() method to identify the object.
* @param sets represents the collection of policy alternatives of the policy object created. During the creation of
* the new policy object, the content of the alternatives collection is copied into an internal policy object structure,
* thus any subsequent operations on the collection will have no impact on the newly constructed policy object. The
* collection may be {@code null} or empty. In such case a 'NULL' policy object is constructed.
*/
Policy(final String toStringName, final Collection<AssertionSet> sets) {
this.nsVersion = NamespaceVersion.getLatestVersion();
this.toStringName = toStringName;
if (sets == null || sets.isEmpty()) {
this.assertionSets = NULL_POLICY_ASSERTION_SETS;
this.vocabulary = EMPTY_VOCABULARY;
this.immutableVocabulary = EMPTY_VOCABULARY;
} else {
this.assertionSets = new LinkedList<AssertionSet>();
this.vocabulary = new TreeSet<QName>(PolicyUtils.Comparison.QNAME_COMPARATOR);
this.immutableVocabulary = Collections.unmodifiableCollection(this.vocabulary);
addAll(sets);
}
}
示例2: intersect
import com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.NamespaceVersion; //导入方法依赖的package包/类
/**
* Performs intersection on the input collection of policies and returns the resulting (intersected) policy. If input policy
* collection contains only a single policy instance, no intersection is performed and the instance is directly returned
* as a method call result.
*
* @param policies collection of policies to be intersected. Must not be {@code null} nor empty, otherwise exception is thrown.
* @return intersected policy as a result of perfromed policy intersection. A {@code null} value is never returned.
*
* @throws IllegalArgumentException in case {@code policies} argument is either {@code null} or empty collection.
*/
public Policy intersect(final Policy... policies) {
if (policies == null || policies.length == 0) {
throw LOGGER.logSevereException(new IllegalArgumentException(LocalizationMessages.WSP_0056_NEITHER_NULL_NOR_EMPTY_POLICY_COLLECTION_EXPECTED()));
} else if (policies.length == 1) {
return policies[0];
}
// check for "null" and "empty" policy: if such policy is found return "null" policy,
// or if all policies are "empty", return "empty" policy
boolean found = false;
boolean allPoliciesEmpty = true;
NamespaceVersion latestVersion = null;
for (Policy tested : policies) {
if (tested.isEmpty()) {
found = true;
} else {
if (tested.isNull()) {
found = true;
}
allPoliciesEmpty = false;
}
if (latestVersion == null) {
latestVersion = tested.getNamespaceVersion();
} else if (latestVersion.compareTo(tested.getNamespaceVersion()) < 0) {
latestVersion = tested.getNamespaceVersion();
}
if (found && !allPoliciesEmpty) {
return Policy.createNullPolicy(latestVersion, null, null);
}
}
latestVersion = (latestVersion != null) ? latestVersion : NamespaceVersion.getLatestVersion();
if (allPoliciesEmpty) {
return Policy.createEmptyPolicy(latestVersion, null, null);
}
// simple tests didn't lead to final answer => let's performe some intersecting ;)
final List<AssertionSet> finalAlternatives = new LinkedList<AssertionSet>(policies[0].getContent());
final Queue<AssertionSet> testedAlternatives = new LinkedList<AssertionSet>();
final List<AssertionSet> alternativesToMerge = new ArrayList<AssertionSet>(2);
for (int i = 1; i < policies.length; i++) {
final Collection<AssertionSet> currentAlternatives = policies[i].getContent();
testedAlternatives.clear();
testedAlternatives.addAll(finalAlternatives);
finalAlternatives.clear();
AssertionSet testedAlternative;
while ((testedAlternative = testedAlternatives.poll()) != null) {
for (AssertionSet currentAlternative : currentAlternatives) {
if (testedAlternative.isCompatibleWith(currentAlternative, this.mode)) {
alternativesToMerge.add(testedAlternative);
alternativesToMerge.add(currentAlternative);
finalAlternatives.add(AssertionSet.createMergedAssertionSet(alternativesToMerge));
alternativesToMerge.clear();
}
}
}
}
return Policy.createPolicy(latestVersion, null, null, finalAlternatives);
}
示例3: createNullPolicy
import com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.NamespaceVersion; //导入方法依赖的package包/类
/**
* The factory method creates an <b>immutable</b> policy instance which represents a <emph>'nothing allowed'</emph>
* policy expression. The policy is created using the latest namespace version supported.
*
* @param nsVersion Policy namespace version to be used when marshalling the policy expression
* @param name global URI of the policy. May be {@code null}.
* @param policyId local URI of the policy. May be {@code null}.
* @return policy instance which represents a <emph>'nothing allowed'</emph> (no policy alternatives).
*/
public static Policy createNullPolicy(final NamespaceVersion nsVersion, final String name, final String policyId) {
if ((nsVersion == null || nsVersion == NamespaceVersion.getLatestVersion()) && name == null && policyId == null) {
return ANONYMOUS_NULL_POLICY;
} else {
return new Policy(nsVersion, name, policyId, NULL_POLICY_ASSERTION_SETS, EMPTY_VOCABULARY);
}
}
示例4: createEmptyPolicy
import com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.NamespaceVersion; //导入方法依赖的package包/类
/**
* The factory method creates an <b>immutable</b> policy instance which represents a <emph>'anything allowed'</emph>
* policy expression. The policy is created using the latest namespace version supported.
*
* @param nsVersion Policy namespace version to be used when marshalling the policy expression
* @param name global URI of the policy. May be {@code null}.
* @param policyId local URI of the policy. May be {@code null}.
*
* @return policy instance which represents a <emph>'anything allowed'</emph> (empty policy alternative with no plicy
* assertions prescribed).
*/
public static Policy createEmptyPolicy(final NamespaceVersion nsVersion, final String name, final String policyId) {
if ((nsVersion == null || nsVersion == NamespaceVersion.getLatestVersion()) && name == null && policyId == null) {
return ANONYMOUS_EMPTY_POLICY;
} else {
return new Policy(nsVersion, name, policyId, EMPTY_POLICY_ASSERTION_SETS, EMPTY_VOCABULARY);
}
}