1 /* 2 * The contents of this file are subject to the terms 3 * of the Common Development and Distribution License 4 * (the License). You may not use this file except in 5 * compliance with the License. 6 * 7 * You can obtain a copy of the license at 8 * https://glassfish.dev.java.net/public/CDDLv1.0.html or 9 * glassfish/bootstrap/legal/CDDLv1.0.txt. 10 * See the License for the specific language governing 11 * permissions and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL 14 * Header Notice in each file and include the License file 15 * at glassfish/bootstrap/legal/CDDLv1.0.txt. 16 * If applicable, add the following below the CDDL Header, 17 * with the fields enclosed by brackets [] replaced by 18 * you own identifying information: 19 * "Portions Copyrighted [year] [name of copyright owner]" 20 * 21 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 22 */ 23 24 package com.sun.enterprise.admin.common.domains.registry; 25 import java.util.Iterator; 26 public interface DomainRegistryI 27 { 28 29 /** 30 Register the given domain information. 31 <p> 32 Precondition - the domain entry's name and location are unique 33 within the registry 34 <p> 35 Postcondition - the entry is registered under the domain 36 entry's name within the registry. 37 @param de the domain entry to be registered. The name and 38 location of this entry must be unique within the registry. 39 @throws NullPointerException if de is null 40 @throws DomainRegistryException if there's a problem with 41 registering the domain entry. 42 */ 43 44 void registerDomain(DomainEntry de) throws DomainRegistryException; 45 46 /** 47 Remove the registration of the domain with the given name. 48 <p> 49 Precondition - a domain is registered within the registry 50 with the given name 51 <p> 52 Postcondition - the registry contains no entry for the given 53 name 54 @param domain_name the name of the domain to be unregistered 55 @throws NullPointerException if the domain_name is null 56 @throws DomainRegistryException if the domain_name is unknown 57 with the registry, or if there's a problem in deleting the 58 registry entry 59 */ 60 void unregisterDomain(String domain_name) throws DomainRegistryException; 61 62 /** 63 Remove the registration of the given domain entry. 64 <p> 65 Precondition - a domain with the same name and location as 66 the given domain is registered in the registry 67 <p> 68 Postcondition - the registry contains no entry for the given 69 name 70 @param de the domain entry to be unregistered 71 @throws NullPointerException if de is null 72 @throws DomainRegistryException if de is not registered 73 within the registry, or if there's a problem in deleting the 74 registry entry 75 */ 76 void unregisterDomain(DomainEntry de) throws DomainRegistryException; 77 /** 78 Re-register the given domain entry with the registry. 79 <p> 80 Precondition - a domain with the same name and location as 81 the given domain entry is already registered in the 82 registry or no domain is registered which has either the 83 same name or the same location (or both). 84 <p> 85 Postcondition - the domain entry registered against the given 86 domain entry's name is the given domain entry. 87 @param de the domain entry to be re-registered 88 @throws DomainRegistryException if no domain with the given 89 domain entry's name is registered, or if there are other 90 problems with updating the registry 91 */ 92 void reregisterDomain(DomainEntry de) throws DomainRegistryException; 93 /** 94 Obtain an iterator over the entries in the 95 registry. The entries will appear in alphabetically sorted 96 order by name. This iterator will operate on a snapshot of the 97 registry obtained at the time this method is executed - 98 changes to the registry during the lifetime of the iterator returned from 99 this method will not affect the iterator. 100 @return an iterator (whose contents are all instances of 101 {@link DomainEntry} 102 @throws DomainRegistryException if there's a problem in 103 obtaining the iterator. 104 */ 105 Iterator iterator() throws DomainRegistryException; 106 /** 107 Indicate if the registry contains the given entry. 108 <p> 109 precondition - entry is not null 110 <p> 111 postcondition - registry has not been modified 112 @param de the entry whose presence in the registry is to be determined 113 @return true iff the entry is in the registry 114 @throws DomainRegistryException if there's a problem in accessing the registry 115 */ 116 boolean containsDomain(DomainEntry de) throws DomainRegistryException; 117 /** 118 Return the domain entry given a domain entry name. 119 <p> 120 precondition - the given name is not null 121 <p> 122 postcondition - the registry has not been modified 123 @param name - the name of the domain whose entry is to be obtained 124 @return DomainEntry from the registry whose name is that 125 given. Returns null if no match. 126 @throws DomainRegistryException if there's a problem accessing the 127 registry 128 */ 129 DomainEntry getDomain(String name) throws DomainRegistryException; 130 /** 131 Get the number of entries in the registry. 132 @return Return the number of items in the registry 133 @throws DomainRegistryException if there's a problem 134 accessing the registry 135 */ 136 int size() throws DomainRegistryException; 137 } 138