5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * CDDL HEADER START
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * The contents of this file are subject to the terms of the
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Common Development and Distribution License, Version 1.0 only
4bc1bbf45f30ff3ca38c2ad006836e490972c7ccvboxsync * (the "License"). You may not use this file except in compliance
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * with the License.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * See the License for the specific language governing permissions
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * and limitations under the License.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * When distributing Covered Code, include this CDDL HEADER in each
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * file and include the License file at legal-notices/CDDLv1_0.txt.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * If applicable, add the following below this CDDL HEADER, with the
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * fields enclosed by brackets "[]" replaced with your own identifying
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * information:
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Portions Copyright [yyyy] [name of copyright owner]
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * CDDL HEADER END
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Copyright 2008 Sun Microsystems, Inc.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Portions Copyright 2014-2015 ForgeRock AS
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * IP address property definition.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncpublic final class IPAddressPropertyDefinition extends
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * An interface for incrementally constructing IP address property
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * definitions.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync AbstractBuilder<InetAddress, IPAddressPropertyDefinition> {
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync /** Private constructor. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync /** {@inheritDoc} */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync protected IPAddressPropertyDefinition buildInstance(
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync AbstractManagedObjectDefinition<?, ?> d, String propertyName,
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync DefaultBehaviorProvider<InetAddress> defaultBehavior) {
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync return new IPAddressPropertyDefinition(d, propertyName, options,
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Create a IP address property definition builder.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * The managed object definition associated with this
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * property definition.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param propertyName
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * The property name.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @return Returns the new IP address property definition builder.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync /** Private constructor. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync AbstractManagedObjectDefinition<?, ?> d, String propertyName,
b28fef07fef379ecc179e0bc0d5d1be753e482b5vboxsync DefaultBehaviorProvider<InetAddress> defaultBehavior) {
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync super(d, InetAddress.class, propertyName, options, adminAction,
24a8dd4360c4b4588fd2c340dd7687379a45e02evboxsync /** {@inheritDoc} */
1d17a5f9688f3622ffe088b664588629b1e95801vboxsync // No additional validation required.
4bc1bbf45f30ff3ca38c2ad006836e490972c7ccvboxsync /** {@inheritDoc} */
73e8df2e481cb3697372a3cf4acffd068a7f1296vboxsync // TODO: it would be nice to throw the cause.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync throw PropertyException.illegalPropertyValueException(this, value);
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync /** {@inheritDoc} */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync // We should return the host name if it is available, or the IP
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync // address if not.
9704f1d0180960069e2c4eb8fe2ddee350910e5dvboxsync // Unforunately, there is no InetAddress method for doing this, so
73e8df2e481cb3697372a3cf4acffd068a7f1296vboxsync // we have to resort to hacking at the toString() encoding.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync if (i > 0) {
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync // Host address is before the forward slash.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync /** {@inheritDoc} */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync public <R, P> R accept(PropertyDefinitionVisitor<R, P> v, P p) {
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync return v.visitIPAddress(this, p);
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync /** {@inheritDoc} */
58b7773f17a933ab8d53f450bed0afcf2f003508vboxsync public <R, P> R accept(PropertyValueVisitor<R, P> v, InetAddress value, P p) {
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync /** {@inheritDoc} */
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync public int compare(InetAddress o1, InetAddress o2) {