001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: *
017: */
018:
019: /* $Id: IPRange.java 473861 2006-11-12 03:51:14Z gregor $ */
020:
021: package org.apache.lenya.ac;
022:
023: import java.net.InetAddress;
024:
025: /**
026: * An IP range.
027: */
028: public interface IPRange extends Accreditable, Item, Groupable {
029:
030: /**
031: * Sets the network address.
032: *
033: * @param address A string, e.g. 192.168.0.32
034: *
035: * @throws AccessControlException when the conversion of the String to an
036: * InetAddress failed.
037: */
038: void setNetworkAddress(String address)
039: throws AccessControlException;
040:
041: /**
042: * Sets the network address.
043: *
044: * @param address A byte array of the length 4.
045: *
046: * @throws AccessControlException when the conversion of the byte array to an
047: * InetAddress failed.
048: */
049: void setNetworkAddress(byte[] address)
050: throws AccessControlException;
051:
052: /**
053: * Returns the network address.
054: * @return An InetAddress value.
055: */
056: InetAddress getNetworkAddress();
057:
058: /**
059: * Sets the subnet mask.
060: *
061: * @param mask A string, e.g. 192.168.0.32
062: *
063: * @throws AccessControlException when the conversion of the String to an
064: * InetAddress failed.
065: */
066: void setSubnetMask(String mask) throws AccessControlException;
067:
068: /**
069: * Sets the subnet mask.
070: *
071: * @param mask A byte array of the length 4.
072: *
073: * @throws AccessControlException when the conversion of the byte array to an
074: * InetAddress failed.
075: */
076: void setSubnetMask(byte[] mask) throws AccessControlException;
077:
078: /**
079: * Returns the subnet mask.
080: * @return An InetAddress value.
081: */
082: InetAddress getSubnetMask();
083:
084: /**
085: * Checks if this IP range contains a certain machine.
086: * @param machine The machine to check for.
087: * @return A boolean value.
088: */
089: boolean contains(Machine machine);
090:
091: /**
092: * Save the IP range.
093: * @throws AccessControlException if the save failed
094: */
095: void save() throws AccessControlException;
096:
097: /**
098: * Delete an IP range.
099: * @throws AccessControlException if the delete failed
100: */
101: void delete() throws AccessControlException;
102: }
|