/** * Checks the protocol version of an incoming multicast request, announcement, or unicast * discovery attempt, throwing an {@link UnsupportedConstraintException} if handling of the * given protocol does not satisfy the constraints of this instance. * * @param version protocol version to check * @throws UnsupportedConstraintException if handling of the given protocol does not satisfy the * constraints of this instance */ public void checkProtocolVersion(int version) throws UnsupportedConstraintException { if (!(protocolVersions.isEmpty() || protocolVersions.contains( DiscoveryProtocolVersion.getInstance(version)))) { throw new UnsupportedConstraintException( "disallowed protocol: " + version); } }
/** * Checks the protocol version of an incoming multicast request, * announcement, or unicast discovery attempt, throwing an {@link * UnsupportedConstraintException} if handling of the given protocol does * not satisfy the constraints of this instance. * * @param version protocol version to check * @throws UnsupportedConstraintException if handling of the given protocol * does not satisfy the constraints of this instance */ public void checkProtocolVersion(int version) throws UnsupportedConstraintException { if (!(protocolVersions.isEmpty() || protocolVersions.contains( DiscoveryProtocolVersion.getInstance(version)))) { throw new UnsupportedConstraintException( "disallowed protocol: " + version); } }
/** * Returns normally if the given constraints can be satisfied by a plaintext-based * format/protocol (such as net.jini.discovery.plaintext, or version 1 of the discovery * protocols); otherwise, throws an UnsupportedConstraintException . Null constraints are * considered equivalent to empty constraints. */ public static void checkConstraints(InvocationConstraints constraints) throws UnsupportedConstraintException { if (constraints == null) { return; } for (Iterator i = constraints.requirements().iterator(); i.hasNext(); ) { InvocationConstraint c = (InvocationConstraint) i.next(); if (!supported(c)) { throw new UnsupportedConstraintException( "unsupported constraint: " + c); } } }
/** * Returns normally if the given constraints can be satisfied by a * plaintext-based format/protocol (such as net.jini.discovery.plaintext, * or version 1 of the discovery protocols); otherwise, throws an * UnsupportedConstraintException . Null constraints are considered * equivalent to empty constraints. */ public static void checkConstraints(InvocationConstraints constraints) throws UnsupportedConstraintException { if (constraints == null) { return; } for (Iterator i = constraints.requirements().iterator(); i.hasNext(); ) { InvocationConstraint c = (InvocationConstraint) i.next(); if (!supported(c)) { throw new UnsupportedConstraintException( "unsupported constraint: " + c); } } }
private Set reduce(Set reduced, Set constraints, boolean required) throws UnsupportedConstraintException { for (Iterator i = constraints.iterator(); i.hasNext(); ) { InvocationConstraint c = (InvocationConstraint) i.next(); Set toReduce = Collections.EMPTY_SET; if (targetClass.isInstance(c)) { toReduce = Collections.singleton(c); } else if (c instanceof ConstraintAlternatives) { toReduce = getTargetInstances( ((ConstraintAlternatives) c).elements()); } if (!toReduce.isEmpty()) { Set s = reduce0(reduced, toReduce); if (!s.isEmpty()) { reduced = s; } else if (required) { throw new UnsupportedConstraintException( "constraints conflict: " + constraints); } } } return reduced; }
@SuppressWarnings("unchecked") private Set<T> reduce(Set<T> reduced, Set<InvocationConstraint> constraints, boolean required) throws UnsupportedConstraintException { for (Iterator<InvocationConstraint> i = constraints.iterator(); i.hasNext(); ) { InvocationConstraint c = i.next(); Set<T> toReduce = Collections.EMPTY_SET; if (targetClass.isInstance(c)) { toReduce = Collections.singleton((T) c); } else if (c instanceof ConstraintAlternatives) { toReduce = getTargetInstances( ((ConstraintAlternatives) c).elements()); } if (!toReduce.isEmpty()) { Set<T> s = reduce0(reduced, toReduce); if (!s.isEmpty()) { reduced = s; } else if (required) { throw new UnsupportedConstraintException( "constraints conflict: " + constraints); } } } return reduced; }
((AtomicValidationEnforcement)o).enforced()) throw new UnsupportedConstraintException( "Unsupported constraint: " + AtomicInputValidation.YES
((AtomicValidationEnforcement)o).enforced()) throw new UnsupportedConstraintException( "Constraint not supported: " + AtomicInputValidation.YES
throw new UnsupportedConstraintException( "underlying proxy does not implement RemoteMethodControl");
if (!protocolVersions.isEmpty() && intersect(protocolVersions, supportedProtocols).isEmpty()) { throw new UnsupportedConstraintException( "no supported protocols: " + protocolVersions);
intersect(protocolVersions, supportedProtocols).isEmpty()) throw new UnsupportedConstraintException( "no supported protocols: " + protocolVersions);