1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 package org.apache.directory.server.protocol.shared; 20 21 22 import org.apache.directory.server.core.DirectoryService; 23 24 import java.util.Set; 25 26 27 /** 28 * Minimum functionality required by an ApacheDS protocol service. 29 * 30 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 31 * @version $Rev$, $Date$ 32 */ 33 public interface ProtocolService 34 { 35 /** 36 * Stops this ProtocolService which unbinds acceptors on the protocol port. 37 * 38 * @throws Exception if there are problems stopping this service 39 */ 40 void stop() throws Exception; 41 42 43 /** 44 * Starts this ProtocolService which binds acceptors on the protocol port. 45 * 46 * @throws Exception if there are problems starting this service 47 */ 48 void start() throws Exception; 49 50 51 /** 52 * Gets whether or not this service has been started. 53 * 54 * @return true if the service has started, false otherwise 55 */ 56 boolean isStarted(); 57 58 59 /** 60 * If this protocol service supports UDP transport then this gets the 61 * non-null MINA DatagramAcceptor it uses. 62 * 63 * @return the MINA DatagramAcceptor used for UDP transports 64 */ 65 DatagramAcceptor getDatagramAcceptor(); 66 67 68 /** 69 * If this protocol service supports UDP transport then this sets the 70 * MINA DatagramAcceptor it uses. 71 * 72 * @param datagramAcceptor the MINA DatagramAcceptor used for UDP transport 73 */ 74 void setDatagramAcceptor( DatagramAcceptor datagramAcceptor ); 75 76 77 /** 78 * If this protocol service support TCP transport then this gets the 79 * MINA SocketAcceptor it uses. 80 * 81 * @return the MINA SocketAcceptor used for TCP transport 82 */ 83 SocketAcceptor getSocketAcceptor(); 84 85 86 /** 87 * If this protocol service support TCP transport then this sets the 88 * MINA SocketAcceptor it uses. 89 * 90 * @param socketAcceptor the MINA SocketAcceptor used for TCP transport 91 */ 92 void setSocketAcceptor( SocketAcceptor socketAcceptor ); 93 94 95 /** 96 * Services can be enabled or disabled. If enabled they will be started, if 97 * not they will not. 98 * 99 * @return true if this service is to be started, false otherwise 100 */ 101 boolean isEnabled(); 102 103 104 /** 105 * Sets whether or not this ProtocolService is enabled. 106 * 107 * @param enabled true to enable, false to disable 108 */ 109 void setEnabled( boolean enabled ); 110 111 112 /** 113 * Gets the instance identifier for this ProtocolService. 114 * 115 * @return the identifier for the service instance 116 */ 117 String getServiceId(); 118 119 120 /** 121 * Sets the instance identifier for this ProtocolService. 122 * 123 * @param serviceId an identifier for the service instance 124 */ 125 void setServiceId( String serviceId ); 126 127 128 /** 129 * Gets a descriptive name for the kind of service this represents. 130 * This name is constant across instances of this ProtocolService. 131 * 132 * @return a descriptive name for the kind of this service 133 */ 134 String getServiceName(); 135 136 137 /** 138 * Sets the descriptive name for the kind of service this represents. 139 * This name is constant across instances of this ProtocolService. 140 * 141 * @param name a descriptive name for the kind of this service 142 */ 143 void setServiceName( String name ); 144 145 146 /** 147 * Gets the IP address of this service. 148 * 149 * @return the IP address for this service. 150 */ 151 String getIpAddress(); 152 153 154 /** 155 * Gets the IP address of this service. 156 * 157 * @param ipAddress the Internet Protocol address for this service. 158 */ 159 void setIpAddress( String ipAddress ); 160 161 162 /** 163 * Gets the IP port for this service. 164 * 165 * @return the IP port for this service 166 */ 167 int getIpPort(); 168 169 170 /** 171 * Sets the IP port for this service. 172 * 173 * @param ipPort the ip port for this service 174 * @throws IllegalArgumentException if the port number is not within a valid range 175 */ 176 void setIpPort( int ipPort ); 177 178 179 /** 180 * Gets the transport protocols used by this service. At this point services 181 * which support more than one transport are configured to bind to that transport 182 * on the same port. 183 * 184 * @return the transport protocols used by this service 185 */ 186 Set<TransportProtocol> getTransportProtocols(); 187 188 189 /** 190 * Sets the transport protocols used by this service. 191 * 192 * @param transportProtocols the transport protocols to be used by this service 193 */ 194 void setTransportProtocols( Set<TransportProtocol> transportProtocols ); 195 196 197 /** 198 * Gets the DirectoryService assigned to this ProtocolService. 199 * 200 * @return the directory service core assigned to this service 201 */ 202 DirectoryService getDirectoryService(); 203 204 205 /** 206 * Sets the DirectoryService assigned to this ProtocolService. 207 * 208 * @param directoryService the directory service core assigned to this service 209 */ 210 void setDirectoryService( DirectoryService directoryService ); 211 }