You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2009/08/05 19:53:20 UTC
svn commit: r801338 [3/3] - in /directory/apacheds/trunk:
protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/messages/
protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/
protocol-dhcp/src/main/java/org/apache/directory/serv...
Modified: directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/store/Subnet.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/store/Subnet.java?rev=801338&r1=801337&r2=801338&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/store/Subnet.java (original)
+++ directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/store/Subnet.java Wed Aug 5 17:53:19 2009
@@ -1,167 +1,167 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.dhcp.store;
-
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Arrays;
-
-
-/**
- * The definition of a Subnet.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev: 545042 $, $Date: 2007-06-06 22:32:01 -0500 (Mi, 06 Jun 2007) $
- */
-public class Subnet extends DhcpConfigElement
-{
- /** the subnet's address */
- private final InetAddress address;
-
- /** the subnet's netmask */
- private final InetAddress netmask;
-
- /** the subnet's range: minimum address in range */
- private InetAddress rangeMin;
-
- /** the subnet's range: maximum address in range */
- private InetAddress rangeMax;
-
-
- public Subnet(InetAddress address, InetAddress netmask, InetAddress rangeMin, InetAddress rangeMax)
- {
- // mask address to match subnet
- byte masked[] = netmask.getAddress();
- byte addrBytes[] = netmask.getAddress();
- for ( int i = 0; i < addrBytes.length; i++ )
- masked[i] &= addrBytes[i];
-
- if ( !Arrays.equals( masked, addrBytes ) )
- try
- {
- address = InetAddress.getByAddress( masked );
- }
- catch ( UnknownHostException e )
- {
- // ignore - doesn't happen.
- }
-
- this.address = address;
- this.netmask = netmask;
- this.rangeMin = rangeMin;
- this.rangeMax = rangeMax;
- }
-
-
- public InetAddress getAddress()
- {
- return address;
- }
-
-
- public InetAddress getNetmask()
- {
- return netmask;
- }
-
-
- public InetAddress getRangeMax()
- {
- return rangeMax;
- }
-
-
- public void setRangeMax( InetAddress rangeMax )
- {
- this.rangeMax = rangeMax;
- }
-
-
- public InetAddress getRangeMin()
- {
- return rangeMin;
- }
-
-
- public void setRangeMin( InetAddress rangeMin )
- {
- this.rangeMin = rangeMin;
- }
-
-
- /**
- * Check whether the given client address resides within this subnet and
- * possibly range.
- *
- * @param clientAddress
- * @return boolean
- */
- public boolean contains( InetAddress clientAddress )
- {
- // check address type
- if ( !clientAddress.getClass().equals( address.getClass() ) )
- return false;
-
- byte client[] = clientAddress.getAddress();
- byte masked[] = netmask.getAddress();
- for ( int i = 0; i < masked.length; i++ )
- masked[i] &= client[i];
-
- return Arrays.equals( masked, address.getAddress() );
- }
-
-
- /**
- * Check whether the specified address is within the range for this subnet.
- *
- * @param clientAddress
- * @return boolean
- */
- public boolean isInRange( InetAddress clientAddress )
- {
- byte client[] = clientAddress.getAddress();
- byte masked[] = netmask.getAddress();
- for ( int i = 0; i < masked.length; i++ )
- masked[i] &= client[i];
-
- if ( null != rangeMin )
- if ( arrayComp( masked, rangeMin.getAddress() ) < 0 )
- return false;
-
- if ( null != rangeMin )
- if ( arrayComp( masked, rangeMax.getAddress() ) > 0 )
- return false;
-
- return true;
- }
-
-
- private static int arrayComp( byte a1[], byte a2[] )
- {
- for ( int i = 0; i < a1.length && i < a2.length; i++ )
- {
- if ( a1[i] != a2[i] )
- return ( a1[i] & 0xff ) - ( a2[i] & 0xff );
- }
-
- return a1.length - a2.length;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.server.dhcp.store;
+
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Arrays;
+
+
+/**
+ * The definition of a Subnet.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 545042 $, $Date: 2007-06-06 22:32:01 -0500 (Mi, 06 Jun 2007) $
+ */
+public class Subnet extends DhcpConfigElement
+{
+ /** the subnet's address */
+ private final InetAddress address;
+
+ /** the subnet's netmask */
+ private final InetAddress netmask;
+
+ /** the subnet's range: minimum address in range */
+ private InetAddress rangeMin;
+
+ /** the subnet's range: maximum address in range */
+ private InetAddress rangeMax;
+
+
+ public Subnet(InetAddress address, InetAddress netmask, InetAddress rangeMin, InetAddress rangeMax)
+ {
+ // mask address to match subnet
+ byte masked[] = netmask.getAddress();
+ byte addrBytes[] = netmask.getAddress();
+ for ( int i = 0; i < addrBytes.length; i++ )
+ masked[i] &= addrBytes[i];
+
+ if ( !Arrays.equals( masked, addrBytes ) )
+ try
+ {
+ address = InetAddress.getByAddress( masked );
+ }
+ catch ( UnknownHostException e )
+ {
+ // ignore - doesn't happen.
+ }
+
+ this.address = address;
+ this.netmask = netmask;
+ this.rangeMin = rangeMin;
+ this.rangeMax = rangeMax;
+ }
+
+
+ public InetAddress getAddress()
+ {
+ return address;
+ }
+
+
+ public InetAddress getNetmask()
+ {
+ return netmask;
+ }
+
+
+ public InetAddress getRangeMax()
+ {
+ return rangeMax;
+ }
+
+
+ public void setRangeMax( InetAddress rangeMax )
+ {
+ this.rangeMax = rangeMax;
+ }
+
+
+ public InetAddress getRangeMin()
+ {
+ return rangeMin;
+ }
+
+
+ public void setRangeMin( InetAddress rangeMin )
+ {
+ this.rangeMin = rangeMin;
+ }
+
+
+ /**
+ * Check whether the given client address resides within this subnet and
+ * possibly range.
+ *
+ * @param clientAddress
+ * @return boolean
+ */
+ public boolean contains( InetAddress clientAddress )
+ {
+ // check address type
+ if ( !clientAddress.getClass().equals( address.getClass() ) )
+ return false;
+
+ byte client[] = clientAddress.getAddress();
+ byte masked[] = netmask.getAddress();
+ for ( int i = 0; i < masked.length; i++ )
+ masked[i] &= client[i];
+
+ return Arrays.equals( masked, address.getAddress() );
+ }
+
+
+ /**
+ * Check whether the specified address is within the range for this subnet.
+ *
+ * @param clientAddress
+ * @return boolean
+ */
+ public boolean isInRange( InetAddress clientAddress )
+ {
+ byte client[] = clientAddress.getAddress();
+ byte masked[] = netmask.getAddress();
+ for ( int i = 0; i < masked.length; i++ )
+ masked[i] &= client[i];
+
+ if ( null != rangeMin )
+ if ( arrayComp( masked, rangeMin.getAddress() ) < 0 )
+ return false;
+
+ if ( null != rangeMin )
+ if ( arrayComp( masked, rangeMax.getAddress() ) > 0 )
+ return false;
+
+ return true;
+ }
+
+
+ private static int arrayComp( byte a1[], byte a2[] )
+ {
+ for ( int i = 0; i < a1.length && i < a2.length; i++ )
+ {
+ if ( a1[i] != a2[i] )
+ return ( a1[i] & 0xff ) - ( a2[i] & 0xff );
+ }
+
+ return a1.length - a2.length;
+ }
+}
Modified: directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/AbstractProtocolService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/AbstractProtocolService.java?rev=801338&r1=801337&r2=801338&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/AbstractProtocolService.java (original)
+++ directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/AbstractProtocolService.java Wed Aug 5 17:53:19 2009
@@ -1,187 +1,187 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.directory.server.protocol.shared;
-
-
-import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.protocol.shared.transport.Transport;
-import org.apache.mina.transport.socket.DatagramAcceptor;
-import org.apache.mina.transport.socket.SocketAcceptor;
-
-
-/**
- * An abstract base class for a ProtocolService. The start/stop methods have
- * not been implemented.
- *
- * @org.apache.xbean.XBean
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public abstract class AbstractProtocolService implements ProtocolService
-{
- /** A flag set to indicate if the server is started or not */
- private boolean started;
-
- /** A flag set to tell if the server is enabled or not */
- private boolean enabled;
-
- /** The server ID */
- private String serviceId;
-
- /** The service name */
- private String serviceName;
-
- /** The service transports. We may have more than one */
- protected Transport[] transports;
-
- /** directory service core where protocol data is backed */
- private DirectoryService directoryService;
-
-
- public DirectoryService getDirectoryService()
- {
- return directoryService;
- }
-
-
- /**
- * @org.apache.xbean.Property hidden="true"
- */
- public void setDirectoryService( DirectoryService directoryService )
- {
- this.directoryService = directoryService;
- }
-
-
- public boolean isStarted()
- {
- return started;
- }
-
-
- /**
- * @org.apache.xbean.Property hidden="true"
- *
- * @param started The state of this server
- */
- protected void setStarted( boolean started )
- {
- this.started = started;
- }
-
-
- public boolean isEnabled()
- {
- return enabled;
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void setEnabled( boolean enabled )
- {
- this.enabled = enabled;
- }
-
-
- public String getServiceId()
- {
- return serviceId;
- }
-
-
- /**
- * @org.apache.xbean.Property hidden="true"
- */
- public void setServiceId( String serviceId )
- {
- this.serviceId = serviceId;
- }
-
-
- /**
- * @return The server name
- */
- public String getServiceName()
- {
- return serviceName;
- }
-
-
- /**
- * @org.apache.xbean.Property hidden="true"
- *
- * Set the current server's name.
- * @param name The server name
- */
- public void setServiceName( String name )
- {
- this.serviceName = name;
- }
-
-
- /**
- * @return the transport
- */
- public Transport[] getTransports()
- {
- return transports;
- }
-
-
- /**
- * Set the underlying transports
- * @param transport The transports
- */
- public void setTransports( Transport... transports )
- {
- if ( transports != null )
- {
- this.transports = new Transport[ transports.length ];
- System.arraycopy( transports, 0, this.transports, 0, transports.length );
-
- for ( Transport transport:transports )
- {
- if ( transport.getAcceptor() == null )
- {
- transport.init();
- }
- }
- }
- }
-
-
- /**
- * {@inheritDoc}
- */
- public DatagramAcceptor getDatagramAcceptor( Transport udpTransport )
- {
- return (DatagramAcceptor)udpTransport.getAcceptor();
- }
-
-
- /**
- * {@inheritDoc}
- */
- public SocketAcceptor getSocketAcceptor( Transport tcpTransport )
- {
- return (SocketAcceptor)tcpTransport.getAcceptor();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.directory.server.protocol.shared;
+
+
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.protocol.shared.transport.Transport;
+import org.apache.mina.transport.socket.DatagramAcceptor;
+import org.apache.mina.transport.socket.SocketAcceptor;
+
+
+/**
+ * An abstract base class for a ProtocolService. The start/stop methods have
+ * not been implemented.
+ *
+ * @org.apache.xbean.XBean
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public abstract class AbstractProtocolService implements ProtocolService
+{
+ /** A flag set to indicate if the server is started or not */
+ private boolean started;
+
+ /** A flag set to tell if the server is enabled or not */
+ private boolean enabled;
+
+ /** The server ID */
+ private String serviceId;
+
+ /** The service name */
+ private String serviceName;
+
+ /** The service transports. We may have more than one */
+ protected Transport[] transports;
+
+ /** directory service core where protocol data is backed */
+ private DirectoryService directoryService;
+
+
+ public DirectoryService getDirectoryService()
+ {
+ return directoryService;
+ }
+
+
+ /**
+ * @org.apache.xbean.Property hidden="true"
+ */
+ public void setDirectoryService( DirectoryService directoryService )
+ {
+ this.directoryService = directoryService;
+ }
+
+
+ public boolean isStarted()
+ {
+ return started;
+ }
+
+
+ /**
+ * @org.apache.xbean.Property hidden="true"
+ *
+ * @param started The state of this server
+ */
+ protected void setStarted( boolean started )
+ {
+ this.started = started;
+ }
+
+
+ public boolean isEnabled()
+ {
+ return enabled;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setEnabled( boolean enabled )
+ {
+ this.enabled = enabled;
+ }
+
+
+ public String getServiceId()
+ {
+ return serviceId;
+ }
+
+
+ /**
+ * @org.apache.xbean.Property hidden="true"
+ */
+ public void setServiceId( String serviceId )
+ {
+ this.serviceId = serviceId;
+ }
+
+
+ /**
+ * @return The server name
+ */
+ public String getServiceName()
+ {
+ return serviceName;
+ }
+
+
+ /**
+ * @org.apache.xbean.Property hidden="true"
+ *
+ * Set the current server's name.
+ * @param name The server name
+ */
+ public void setServiceName( String name )
+ {
+ this.serviceName = name;
+ }
+
+
+ /**
+ * @return the transport
+ */
+ public Transport[] getTransports()
+ {
+ return transports;
+ }
+
+
+ /**
+ * Set the underlying transports
+ * @param transport The transports
+ */
+ public void setTransports( Transport... transports )
+ {
+ if ( transports != null )
+ {
+ this.transports = new Transport[ transports.length ];
+ System.arraycopy( transports, 0, this.transports, 0, transports.length );
+
+ for ( Transport transport:transports )
+ {
+ if ( transport.getAcceptor() == null )
+ {
+ transport.init();
+ }
+ }
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public DatagramAcceptor getDatagramAcceptor( Transport udpTransport )
+ {
+ return (DatagramAcceptor)udpTransport.getAcceptor();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public SocketAcceptor getSocketAcceptor( Transport tcpTransport )
+ {
+ return (SocketAcceptor)tcpTransport.getAcceptor();
+ }
+}
Modified: directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/ProtocolService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/ProtocolService.java?rev=801338&r1=801337&r2=801338&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/ProtocolService.java (original)
+++ directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/ProtocolService.java Wed Aug 5 17:53:19 2009
@@ -1,143 +1,143 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.directory.server.protocol.shared;
-
-
-import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.protocol.shared.transport.Transport;
-import org.apache.mina.transport.socket.DatagramAcceptor;
-import org.apache.mina.transport.socket.SocketAcceptor;
-
-
-/**
- * Minimum functionality required by an ApacheDS protocol service.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public interface ProtocolService
-{
- /**
- * Stops this ProtocolService which unbinds acceptors on the protocol port.
- *
- * @throws Exception if there are problems stopping this service
- */
- void stop() throws Exception;
-
-
- /**
- * Starts this ProtocolService which binds acceptors on the protocol port.
- *
- * @throws Exception if there are problems starting this service
- */
- void start() throws Exception;
-
-
- /**
- * Gets whether or not this service has been started.
- *
- * @return true if the service has started, false otherwise
- */
- boolean isStarted();
-
-
- /**
- * If this protocol service supports UDP transport then this gets the
- * non-null MINA DatagramAcceptor it uses.
- *
- * @return the MINA DatagramAcceptor used for UDP transports
- */
- DatagramAcceptor getDatagramAcceptor( Transport transport );
-
-
- /**
- * If this protocol service support TCP transport then this gets the
- * MINA SocketAcceptor it uses.
- *
- * @return the MINA SocketAcceptor used for TCP transport
- */
- SocketAcceptor getSocketAcceptor( Transport transport );
-
-
- /**
- * Services can be enabled or disabled. If enabled they will be started, if
- * not they will not.
- *
- * @return true if this service is to be started, false otherwise
- */
- boolean isEnabled();
-
-
- /**
- * Sets whether or not this ProtocolService is enabled.
- *
- * @param enabled true to enable, false to disable
- */
- void setEnabled( boolean enabled );
-
-
- /**
- * Gets the instance identifier for this ProtocolService.
- *
- * @return the identifier for the service instance
- */
- String getServiceId();
-
-
- /**
- * Sets the instance identifier for this ProtocolService.
- *
- * @param serviceId an identifier for the service instance
- */
- void setServiceId( String serviceId );
-
-
- /**
- * Gets a descriptive name for the kind of service this represents.
- * This name is constant across instances of this ProtocolService.
- *
- * @return a descriptive name for the kind of this service
- */
- String getServiceName();
-
-
- /**
- * Sets the descriptive name for the kind of service this represents.
- * This name is constant across instances of this ProtocolService.
- *
- * @param name a descriptive name for the kind of this service
- */
- void setServiceName( String name );
-
-
- /**
- * Gets the DirectoryService assigned to this ProtocolService.
- *
- * @return the directory service core assigned to this service
- */
- DirectoryService getDirectoryService();
-
-
- /**
- * Sets the DirectoryService assigned to this ProtocolService.
- *
- * @param directoryService the directory service core assigned to this service
- */
- void setDirectoryService( DirectoryService directoryService );
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.directory.server.protocol.shared;
+
+
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.protocol.shared.transport.Transport;
+import org.apache.mina.transport.socket.DatagramAcceptor;
+import org.apache.mina.transport.socket.SocketAcceptor;
+
+
+/**
+ * Minimum functionality required by an ApacheDS protocol service.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface ProtocolService
+{
+ /**
+ * Stops this ProtocolService which unbinds acceptors on the protocol port.
+ *
+ * @throws Exception if there are problems stopping this service
+ */
+ void stop() throws Exception;
+
+
+ /**
+ * Starts this ProtocolService which binds acceptors on the protocol port.
+ *
+ * @throws Exception if there are problems starting this service
+ */
+ void start() throws Exception;
+
+
+ /**
+ * Gets whether or not this service has been started.
+ *
+ * @return true if the service has started, false otherwise
+ */
+ boolean isStarted();
+
+
+ /**
+ * If this protocol service supports UDP transport then this gets the
+ * non-null MINA DatagramAcceptor it uses.
+ *
+ * @return the MINA DatagramAcceptor used for UDP transports
+ */
+ DatagramAcceptor getDatagramAcceptor( Transport transport );
+
+
+ /**
+ * If this protocol service support TCP transport then this gets the
+ * MINA SocketAcceptor it uses.
+ *
+ * @return the MINA SocketAcceptor used for TCP transport
+ */
+ SocketAcceptor getSocketAcceptor( Transport transport );
+
+
+ /**
+ * Services can be enabled or disabled. If enabled they will be started, if
+ * not they will not.
+ *
+ * @return true if this service is to be started, false otherwise
+ */
+ boolean isEnabled();
+
+
+ /**
+ * Sets whether or not this ProtocolService is enabled.
+ *
+ * @param enabled true to enable, false to disable
+ */
+ void setEnabled( boolean enabled );
+
+
+ /**
+ * Gets the instance identifier for this ProtocolService.
+ *
+ * @return the identifier for the service instance
+ */
+ String getServiceId();
+
+
+ /**
+ * Sets the instance identifier for this ProtocolService.
+ *
+ * @param serviceId an identifier for the service instance
+ */
+ void setServiceId( String serviceId );
+
+
+ /**
+ * Gets a descriptive name for the kind of service this represents.
+ * This name is constant across instances of this ProtocolService.
+ *
+ * @return a descriptive name for the kind of this service
+ */
+ String getServiceName();
+
+
+ /**
+ * Sets the descriptive name for the kind of service this represents.
+ * This name is constant across instances of this ProtocolService.
+ *
+ * @param name a descriptive name for the kind of this service
+ */
+ void setServiceName( String name );
+
+
+ /**
+ * Gets the DirectoryService assigned to this ProtocolService.
+ *
+ * @return the directory service core assigned to this service
+ */
+ DirectoryService getDirectoryService();
+
+
+ /**
+ * Sets the DirectoryService assigned to this ProtocolService.
+ *
+ * @param directoryService the directory service core assigned to this service
+ */
+ void setDirectoryService( DirectoryService directoryService );
+}
Modified: directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/TransportProtocol.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/TransportProtocol.java?rev=801338&r1=801337&r2=801338&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/TransportProtocol.java (original)
+++ directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/TransportProtocol.java Wed Aug 5 17:53:19 2009
@@ -1,59 +1,59 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.directory.server.protocol.shared;
-
-
-/**
- * Type safe enumeration for the transport protocol.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public enum TransportProtocol
-{
- TCP( 0, "TCP" ), UDP( 1, "UDP" );
-
-
- private final int intValue;
- private final String stringValue;
-
-
- private TransportProtocol( int intValue, String stringValue )
- {
- this.intValue = intValue;
- this.stringValue = stringValue;
- }
-
-
- /**
- * Gets an integer value for switches.
- *
- * @return ordinal integer value
- */
- public int getIntValue()
- {
- return intValue;
- }
-
-
- public String toString()
- {
- return stringValue;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.directory.server.protocol.shared;
+
+
+/**
+ * Type safe enumeration for the transport protocol.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public enum TransportProtocol
+{
+ TCP( 0, "TCP" ), UDP( 1, "UDP" );
+
+
+ private final int intValue;
+ private final String stringValue;
+
+
+ private TransportProtocol( int intValue, String stringValue )
+ {
+ this.intValue = intValue;
+ this.stringValue = stringValue;
+ }
+
+
+ /**
+ * Gets an integer value for switches.
+ *
+ * @return ordinal integer value
+ */
+ public int getIntValue()
+ {
+ return intValue;
+ }
+
+
+ public String toString()
+ {
+ return stringValue;
+ }
+}