You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by rj...@apache.org on 2009/06/09 14:50:47 UTC
svn commit: r782980 [1/8] - in
/directory/sandbox/slp/src/main/java/org/apache/directory/slp: ./ codec/
extensions/ impl/ impl/da/ impl/filter/ messages/
Author: rjan
Date: Tue Jun 9 12:50:45 2009
New Revision: 782980
URL: http://svn.apache.org/viewvc?rev=782980&view=rev
Log:
code style cleanup
Modified:
directory/sandbox/slp/src/main/java/org/apache/directory/slp/Advertiser.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/AttributeReplyFuture.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/AuthenticatedServiceURL.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/DirectoryAgent.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/Locator.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/OpaqueValue.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/ReplyFuture.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/SLPAttribute.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/Service.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/ServiceLocationException.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/ServiceReplyFuture.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/ServiceStore.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/ServiceType.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/ServiceURL.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/codec/AbstractSLPMessageCodec.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/codec/AttributeReplyMessageCodec.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/codec/AttributeRequestMessageCodec.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/codec/DAAdvertisementMessageCodec.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/codec/SLPProtocolCodecFactory.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/codec/ServiceAcknowledgementMessageCodec.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/codec/ServiceDeregistrationMessageCodec.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/codec/ServiceRegistrationMessageCodec.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/codec/ServiceReplyMessageCodec.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/codec/ServiceRequestMessageCodec.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/codec/ServiceTypeReplyMessageCodec.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/codec/ServiceTypeRequestMessageCodec.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/extensions/AbstractExtension.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/extensions/AttributeListExtension.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/extensions/SelectExtension.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/extensions/SortExtension.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/extensions/UnsupportedExtension.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/impl/Activator.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/impl/AdvertiserImpl.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/impl/AttributeReplyFutureImpl.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/impl/AuthenticatedServiceURL.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/impl/AuthenticationBlock.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/impl/LocatorImpl.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/impl/NonThreadedReplyFuture.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/impl/OSGiPlatformAbstraction.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/impl/SLPAttributeImpl.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/impl/SLPConfiguration.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/impl/SLPCore.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/impl/SLPDaemon.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/impl/SLPDaemonImpl.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/impl/SLPHandler.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/impl/SLPUtils.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/impl/ServiceLocationEnumerationImpl.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/impl/ServiceReplyFutureImpl.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/impl/ThreadedReplyFuture.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/impl/da/DirectoryAgentDaemon.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/impl/da/DirectoryAgentDaemonImpl.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/impl/da/DirectoryAgentImpl.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/impl/da/SimpleServiceStore.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/impl/filter/Filter.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/AbstractSLPMessage.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/AbstractSLPReplyMessage.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/AbstractSLPRequestMessage.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/AttributeReplyMessage.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/AttributeRequestMessage.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/DAAdvertisementMessage.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceAcknowledgementMessage.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceDeregistrationMessage.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceRegistrationMessage.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceReplyMessage.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceRequestMessage.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceTypeReplyMessage.java
directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceTypeRequestMessage.java
Modified: directory/sandbox/slp/src/main/java/org/apache/directory/slp/Advertiser.java
URL: http://svn.apache.org/viewvc/directory/sandbox/slp/src/main/java/org/apache/directory/slp/Advertiser.java?rev=782980&r1=782979&r2=782980&view=diff
==============================================================================
--- directory/sandbox/slp/src/main/java/org/apache/directory/slp/Advertiser.java (original)
+++ directory/sandbox/slp/src/main/java/org/apache/directory/slp/Advertiser.java Tue Jun 9 12:50:45 2009
@@ -57,8 +57,8 @@
* @param attributes
* a <code>Dictionary</code> of attributes for the service. RFC
* 2614 proposes a <code>Vector</code> of attribute-value-pairs
- * here but the <code>Dictionary</code> makes this
- * implementation more close to <code>OSGi</code>.
+ * here but the <code>Dictionary</code> makes this implementation
+ * more close to <code>OSGi</code>.
* @throws ServiceLocationException
* in case that the registration failed for any reason.
*/
@@ -77,20 +77,18 @@
* @param attributes
* a <code>Dictionary</code> of attributes for the service. RFC
* 2614 proposes a <code>Vector</code> of attribute-value-pairs
- * here but the <code>Dictionary</code> makes this
- * implementation more close to <code>OSGi</code>
+ * here but the <code>Dictionary</code> makes this implementation
+ * more close to <code>OSGi</code>
* @throws ServiceLocationException
* in case that the registration failed for any reason.
*/
void register(ServiceURL url, List<String> scopes, Dictionary attributes)
throws ServiceLocationException;
-
-
-
- /**
- * update an existing registration using scopes.
- * This will replace all attributes that are already registered and add those that are not.
- * If security is enabled, this will fail.
+
+ /**
+ * update an existing registration using scopes. This will replace all
+ * attributes that are already registered and add those that are not. If
+ * security is enabled, this will fail.
*
* @param url
* the ServiceURL of the service.
@@ -102,9 +100,8 @@
* if the registration has failed for any reason.
* @see Advertiser#register(ServiceURL, List, Dictionary)
*/
- public void update(ServiceURL url, List<String> scopes, Dictionary attributes)
- throws ServiceLocationException;
-
+ public void update(ServiceURL url, List<String> scopes,
+ Dictionary attributes) throws ServiceLocationException;
/**
* Unregister a service with the SLP framework. The service will be
@@ -160,9 +157,9 @@
void deleteAttributes(ServiceURL url, Dictionary attributeIds)
throws ServiceLocationException;
-
/**
- * Shut down the SA (SLPCore remains initialized, but no messages are handled by the SA)
+ * Shut down the SA (SLPCore remains initialized, but no messages are
+ * handled by the SA)
*/
public void shutdown();
Modified: directory/sandbox/slp/src/main/java/org/apache/directory/slp/AttributeReplyFuture.java
URL: http://svn.apache.org/viewvc/directory/sandbox/slp/src/main/java/org/apache/directory/slp/AttributeReplyFuture.java?rev=782980&r1=782979&r2=782980&view=diff
==============================================================================
--- directory/sandbox/slp/src/main/java/org/apache/directory/slp/AttributeReplyFuture.java (original)
+++ directory/sandbox/slp/src/main/java/org/apache/directory/slp/AttributeReplyFuture.java Tue Jun 9 12:50:45 2009
@@ -22,28 +22,25 @@
import java.util.List;
/**
- *
+ *
* @author Lorenz Breu
*/
-public interface AttributeReplyFuture extends ReplyFuture{
+public interface AttributeReplyFuture extends ReplyFuture {
/**
- * Get the contents of the next attribute reply as a List of SLPAttributes, blocks if there are none available at the time
+ * Get the contents of the next attribute reply as a List of SLPAttributes,
+ * blocks if there are none available at the time
*
- * @return
- * A List of SLPAttributes.
+ * @return A List of SLPAttributes.
*/
public SLPAttribute nextAttribute();
-
-
+
/**
- * Block and get the result of the complete SLP request/reply process as a List of SLPAttributes
+ * Block and get the result of the complete SLP request/reply process as a
+ * List of SLPAttributes
*
- * @return
- * A List of SLPAttributes.
+ * @return A List of SLPAttributes.
*/
public List<SLPAttribute> getResultAttributes();
-
-
-
+
}
Modified: directory/sandbox/slp/src/main/java/org/apache/directory/slp/AuthenticatedServiceURL.java
URL: http://svn.apache.org/viewvc/directory/sandbox/slp/src/main/java/org/apache/directory/slp/AuthenticatedServiceURL.java?rev=782980&r1=782979&r2=782980&view=diff
==============================================================================
--- directory/sandbox/slp/src/main/java/org/apache/directory/slp/AuthenticatedServiceURL.java (original)
+++ directory/sandbox/slp/src/main/java/org/apache/directory/slp/AuthenticatedServiceURL.java Tue Jun 9 12:50:45 2009
@@ -23,11 +23,9 @@
import java.io.IOException;
import java.util.List;
-import org.apache.directory.slp.ServiceLocationException;
import org.apache.directory.slp.impl.AuthenticationBlock;
import org.apache.directory.slp.impl.SLPUtils;
-
/**
* Authentication support for service URLs.
*
@@ -35,156 +33,156 @@
*/
public class AuthenticatedServiceURL {
- /**
- * The lifetime of the ServiceURL i.e., how long authentication remains valid.
- */
-int lifetime = 0;
-
- /**
- * the authentication blocks.
- */
- private AuthenticationBlock[] authBlocks;
-
- /**
- * set the authentication blocks.
- *
- * @param authBlocks
- * the authentication blocks.
- */
- public void setAuthBlocks(final AuthenticationBlock[] authBlocks) {
- this.authBlocks = authBlocks;
- }
-
- /**
- * Returns the Authentication Blocks of this service url
- *
- * @return
- * array of <code>AuthenticationBlock</code>
- */
-public AuthenticationBlock[] getAuthBlocks() {
- return authBlocks;
- }
-
-
-
-
- /**
- * verify the authentication blocks.
- *
- * Copied over to the MINA port from the original jSLP implementation, untested
- */
- public void verify() throws ServiceLocationException {
- if (authBlocks.length == 0) {
- return;
- }
- for (int i = 0; i < authBlocks.length; i++) {
- byte[] data = getAuthData(authBlocks[i].getSpi(), authBlocks[i]
- .getTimestamp());
- if (authBlocks[i].verify(data)) {
- return;
- }
- }
- // TODO: improve
- throw new ServiceLocationException(
- ServiceLocationException.AUTHENTICATION_FAILED, "");
- }
-
- /**
- * get the byte representation of the authentication data.
- *
- * @param spi
- * the SPI string as defined in RFC 2608
- * @param timestamp
- * a timestamp as defined in RFC 2608
- * @return a byte array.
- * @throws ServiceLocationException
- * in case of internal errors.
- */
- private byte[] getAuthData(final String spi, final int timestamp)
- throws ServiceLocationException {
- try {
- final ByteArrayOutputStream bos = new ByteArrayOutputStream();
- final DataOutputStream dos = new DataOutputStream(bos);
-
- byte[] temp = spi.getBytes();
- dos.writeShort(temp.length);
- dos.write(temp);
- temp = toString().getBytes();
- dos.writeShort(temp.length);
- dos.write(temp);
- dos.writeInt(timestamp);
- return bos.toByteArray();
- } catch (IOException ioe) {
- throw new ServiceLocationException(
- ServiceLocationException.INTERNAL_SYSTEM_ERROR, ioe
- .getMessage());
- }
- }
-
- /**
- * sign the ServiceURL.
- *
- * @param spiList
- * the List of SPIs
- * @throws ServiceLocationException
- * in case of IO errors.
- */
- public final void sign(final List spiList)
- throws ServiceLocationException {
- authBlocks = new AuthenticationBlock[spiList.size()];
- for (int k = 0; k < spiList.size(); k++) {
- int timestamp = SLPUtils.getTimestamp();
- timestamp += lifetime;
-
- String spi = (String) spiList.get(k);
- byte[] data = getAuthData(spi, timestamp);
- byte[] sig;
- try {
- sig = AuthenticationBlock.sign(spi,data);
- } catch (Exception e) {
- //SLPCore.platform.logError(e.getMessage(), e.fillInStackTrace());
- throw new ServiceLocationException(
- ServiceLocationException.AUTHENTICATION_FAILED,
- "Could not sign data");
- }
- authBlocks[k] = new AuthenticationBlock(timestamp,spi,sig);
-
- }
- }
-
- /**
- * sign the ServiceURL.
- *
- * Copied over to the MINA port from the original jSLP implementation, untested
- *
- * Type mismatch between the original jSLP (all Lists) and the MINA codecs (all String[])
- * required this overload.
- *
- * @param spiList
- * the String[] of SPIs
- * @throws ServiceLocationException
- * in case of IO errors.
- */
- public final void sign (final String[] spiList) throws ServiceLocationException{
- authBlocks = new AuthenticationBlock[spiList.length];
- for (int k = 0; k< spiList.length;k++){
- int timestamp = SLPUtils.getTimestamp();
- timestamp += lifetime;
-
- String spi = (String) spiList[k];
- byte[] data = getAuthData(spi, timestamp);
- byte[] sig;
- try {
- sig = AuthenticationBlock.sign(spi,data);
- } catch (Exception e) {
- //SLPCore.platform.logError(e.getMessage(), e.fillInStackTrace());
- throw new ServiceLocationException(
- ServiceLocationException.AUTHENTICATION_FAILED,
- "Could not sign data");
- }
- authBlocks[k] = new AuthenticationBlock(timestamp,spi,sig);
- }
- }
-
+ /**
+ * The lifetime of the ServiceURL i.e., how long authentication remains
+ * valid.
+ */
+ int lifetime = 0;
+
+ /**
+ * the authentication blocks.
+ */
+ private AuthenticationBlock[] authBlocks;
+
+ /**
+ * set the authentication blocks.
+ *
+ * @param authBlocks
+ * the authentication blocks.
+ */
+ public void setAuthBlocks(final AuthenticationBlock[] authBlocks) {
+ this.authBlocks = authBlocks;
+ }
+
+ /**
+ * Returns the Authentication Blocks of this service url
+ *
+ * @return array of <code>AuthenticationBlock</code>
+ */
+ public AuthenticationBlock[] getAuthBlocks() {
+ return authBlocks;
+ }
+
+ /**
+ * verify the authentication blocks.
+ *
+ * Copied over to the MINA port from the original jSLP implementation,
+ * untested
+ */
+ public void verify() throws ServiceLocationException {
+ if (authBlocks.length == 0) {
+ return;
+ }
+ for (int i = 0; i < authBlocks.length; i++) {
+ final byte[] data = getAuthData(authBlocks[i].getSpi(),
+ authBlocks[i].getTimestamp());
+ if (authBlocks[i].verify(data)) {
+ return;
+ }
+ }
+ // TODO: improve
+ throw new ServiceLocationException(
+ ServiceLocationException.AUTHENTICATION_FAILED, "");
+ }
+
+ /**
+ * get the byte representation of the authentication data.
+ *
+ * @param spi
+ * the SPI string as defined in RFC 2608
+ * @param timestamp
+ * a timestamp as defined in RFC 2608
+ * @return a byte array.
+ * @throws ServiceLocationException
+ * in case of internal errors.
+ */
+ private byte[] getAuthData(final String spi, final int timestamp)
+ throws ServiceLocationException {
+ try {
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final DataOutputStream dos = new DataOutputStream(bos);
+
+ byte[] temp = spi.getBytes();
+ dos.writeShort(temp.length);
+ dos.write(temp);
+ temp = toString().getBytes();
+ dos.writeShort(temp.length);
+ dos.write(temp);
+ dos.writeInt(timestamp);
+ return bos.toByteArray();
+ } catch (final IOException ioe) {
+ throw new ServiceLocationException(
+ ServiceLocationException.INTERNAL_SYSTEM_ERROR, ioe
+ .getMessage());
+ }
+ }
+
+ /**
+ * sign the ServiceURL.
+ *
+ * @param spiList
+ * the List of SPIs
+ * @throws ServiceLocationException
+ * in case of IO errors.
+ */
+ public final void sign(final List spiList) throws ServiceLocationException {
+ authBlocks = new AuthenticationBlock[spiList.size()];
+ for (int k = 0; k < spiList.size(); k++) {
+ int timestamp = SLPUtils.getTimestamp();
+ timestamp += lifetime;
+
+ final String spi = (String) spiList.get(k);
+ final byte[] data = getAuthData(spi, timestamp);
+ byte[] sig;
+ try {
+ sig = AuthenticationBlock.sign(spi, data);
+ } catch (final Exception e) {
+ // SLPCore.platform.logError(e.getMessage(),
+ // e.fillInStackTrace());
+ throw new ServiceLocationException(
+ ServiceLocationException.AUTHENTICATION_FAILED,
+ "Could not sign data");
+ }
+ authBlocks[k] = new AuthenticationBlock(timestamp, spi, sig);
+
+ }
+ }
+
+ /**
+ * sign the ServiceURL.
+ *
+ * Copied over to the MINA port from the original jSLP implementation,
+ * untested
+ *
+ * Type mismatch between the original jSLP (all Lists) and the MINA codecs
+ * (all String[]) required this overload.
+ *
+ * @param spiList
+ * the String[] of SPIs
+ * @throws ServiceLocationException
+ * in case of IO errors.
+ */
+ public final void sign(final String[] spiList)
+ throws ServiceLocationException {
+ authBlocks = new AuthenticationBlock[spiList.length];
+ for (int k = 0; k < spiList.length; k++) {
+ int timestamp = SLPUtils.getTimestamp();
+ timestamp += lifetime;
+
+ final String spi = spiList[k];
+ final byte[] data = getAuthData(spi, timestamp);
+ byte[] sig;
+ try {
+ sig = AuthenticationBlock.sign(spi, data);
+ } catch (final Exception e) {
+ // SLPCore.platform.logError(e.getMessage(),
+ // e.fillInStackTrace());
+ throw new ServiceLocationException(
+ ServiceLocationException.AUTHENTICATION_FAILED,
+ "Could not sign data");
+ }
+ authBlocks[k] = new AuthenticationBlock(timestamp, spi, sig);
+ }
+ }
}
\ No newline at end of file
Modified: directory/sandbox/slp/src/main/java/org/apache/directory/slp/DirectoryAgent.java
URL: http://svn.apache.org/viewvc/directory/sandbox/slp/src/main/java/org/apache/directory/slp/DirectoryAgent.java?rev=782980&r1=782979&r2=782980&view=diff
==============================================================================
--- directory/sandbox/slp/src/main/java/org/apache/directory/slp/DirectoryAgent.java (original)
+++ directory/sandbox/slp/src/main/java/org/apache/directory/slp/DirectoryAgent.java Tue Jun 9 12:50:45 2009
@@ -30,121 +30,123 @@
* External interface of the jSLP Directory Agent.
*
* @author Lorenz Breu
- *
+ *
*/
public interface DirectoryAgent {
-
/**
* list all services currently managed by this DA
*
- * @return
- * List of Services registered on this DA
+ * @return List of Services registered on this DA
*/
public List<Service> listServices();
-
+
/**
- * Shut the DA down by sending out a DAADVERT with statelessBoottimestamp of 0 and deregistering it from the jSLP core
+ * Shut the DA down by sending out a DAADVERT with statelessBoottimestamp of
+ * 0 and deregistering it from the jSLP core
*/
public void shutdown();
-
+
/**
* Register a service with the DA.
*
* @param reg
- * The ServiceRegistrationMessage received that contains the Service information
+ * The ServiceRegistrationMessage received that contains the
+ * Service information
* @throws ServiceLocationException
*/
- public void registerService(ServiceRegistrationMessage reg) throws ServiceLocationException;
-
-
-
+ public void registerService(ServiceRegistrationMessage reg)
+ throws ServiceLocationException;
+
/**
* Register a service with the DA.
*
* @param service
- * The Service to be registered.
+ * The Service to be registered.
* @throws ServiceLocationException
*/
- public void registerService(Service service) throws ServiceLocationException;
-
-
-
+ public void registerService(Service service)
+ throws ServiceLocationException;
+
/**
- * Parses a static registration file in which services are registered as in OpenSLP 1.x and 2.x:
+ * Parses a static registration file in which services are registered as in
+ * OpenSLP 1.x and 2.x:
*
- * #comment
- * ;comment
+ * #comment ;comment
* service-url,language-tag,lifetime,[service-type]<newline>
- * "scopes="[scope-list]<newline>
- * [attrid]"="val1<newline>
- * [attrid]"="val1,val2,val3<newline>
- * <newline>
+ * "scopes="[scope-list]<newline> [attrid]"="val1<newline>
+ * [attrid]"="val1,val2,val3<newline> <newline>
*
* @param file
- * The file which contains the static registrations in the format listed above
+ * The file which contains the static registrations in the format
+ * listed above
*/
public void registerServicesFromFile(File file);
-
+
/**
- * Exports all services in the service store to a static registration file with the following format
- * identical to OpenSLP 1.x and 2.x
+ * Exports all services in the service store to a static registration file
+ * with the following format identical to OpenSLP 1.x and 2.x
*
* @param path
- * The string to the path where the file is located. If no file is located there, one will be created.
+ * The string to the path where the file is located. If no file
+ * is located there, one will be created.
* @param append
- * Set to true if an existing file is to be appended to, or false if an existing file is to be overwritten
- */
+ * Set to true if an existing file is to be appended to, or false
+ * if an existing file is to be overwritten
+ */
public void exportServicesToFile(String path, boolean append);
-
+
/**
* Deregister a service from the DA.
*
* @param dereg
- * The ServiceDeregistrationMessage received that contains the Service information
+ * The ServiceDeregistrationMessage received that contains the
+ * Service information
* @throws ServiceLocationException
*/
- public void deregisterService(ServiceDeregistrationMessage dereg) throws ServiceLocationException;
-
-
-
-
-
-
+ public void deregisterService(ServiceDeregistrationMessage dereg)
+ throws ServiceLocationException;
+
/**
* Deregeister a service from the DA.
*
* @param service
* @throws ServiceLocationException
*/
- public void deregisterService(Service service) throws ServiceLocationException;
-
-
+ public void deregisterService(Service service)
+ throws ServiceLocationException;
+
/**
- * Set the backend for service storage. Set flush to false if existing services are to be kept.
+ * Set the backend for service storage. Set flush to false if existing
+ * services are to be kept.
*
* @param store
- * The ServiceStore to use
+ * The ServiceStore to use
* @param flush
- * true: create a fresh service store, no existing entries are kept.
- * false: Keep existing registrations
+ * true: create a fresh service store, no existing entries are
+ * kept. false: Keep existing registrations
* @throws ServiceLocationException
*/
- public void setServiceStore(ServiceStore store, boolean flush) throws ServiceLocationException;
-
-
+ public void setServiceStore(ServiceStore store, boolean flush)
+ throws ServiceLocationException;
+
/**
- * Returns the attribute type registry of the DA. ServiceStore implementations should keep track of attribute types and
- * are encouraged to use a mapping of <abstract_service_type>.<attribute_name> -> Integer using the types staticaly provided by the ServiceStore interface.
+ * Returns the attribute type registry of the DA. ServiceStore
+ * implementations should keep track of attribute types and are encouraged
+ * to use a mapping of <abstract_service_type>.<attribute_name> -> Integer
+ * using the types staticaly provided by the ServiceStore interface.
+ *
+ * The result is a copy of the data in the registry and does not provide
+ * write access to the actual registry.
*
- * The result is a copy of the data in the registry and does not provide write access to the actual registry.
- *
*
- * @return
- * A <code>Map</code> representing the mapping of attributes to types (Integer, String, Boolean, Opaque, Keyword)
+ * @return A <code>Map</code> representing the mapping of attributes to
+ * types (Integer, String, Boolean, Opaque, Keyword)
* @throws ServiceLocationException
- * If a ServiceStore implementation does not support this feature
+ * If a ServiceStore implementation does not support this
+ * feature
*/
- public Map<String, Integer> getAttributeTypes() throws ServiceLocationException;
-
+ public Map<String, Integer> getAttributeTypes()
+ throws ServiceLocationException;
+
}
Modified: directory/sandbox/slp/src/main/java/org/apache/directory/slp/Locator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/slp/src/main/java/org/apache/directory/slp/Locator.java?rev=782980&r1=782979&r2=782980&view=diff
==============================================================================
--- directory/sandbox/slp/src/main/java/org/apache/directory/slp/Locator.java (original)
+++ directory/sandbox/slp/src/main/java/org/apache/directory/slp/Locator.java Tue Jun 9 12:50:45 2009
@@ -22,6 +22,8 @@
import java.util.List;
import java.util.Locale;
+import org.osgi.framework.InvalidSyntaxException;
+
//import com.sun.slamd.stat.CategoricalTracker;
/**
@@ -39,7 +41,7 @@
* @return the current Locale.
*/
Locale getLocale();
-
+
/**
* Get the locale of this instance.
*
@@ -50,64 +52,66 @@
void setLocale(final Locale locale);
/**
- * Find all services types that are currently
- * registered in the network.
+ * Find all services types that are currently registered in the network.
*
* @param namingAuthority
- * the naming authority for the service type. If omitted,
- * ALL Service Types are returned, regardless of Naming Authority.
- * With the empty <code>String</code> (""), <code>IANA</code> will be assumed.
+ * the naming authority for the service type. If omitted, ALL
+ * Service Types are returned, regardless of Naming Authority.
+ * With the empty <code>String</code> (""), <code>IANA</code>
+ * will be assumed.
* @param scopes
- * a <code>List</code> of scopes in that service types are to
- * be discovered.
+ * a <code>List</code> of scopes in that service types are to be
+ * discovered.
* @return a ReplyFuture with the discovered ServiceTypes.
* @throws ServiceLocationException
* whenever called.
*/
- ReplyFuture findServiceTypes(String namingAuthority,
- List<String> scopes) throws ServiceLocationException;
-
+ ReplyFuture findServiceTypes(String namingAuthority, List<String> scopes)
+ throws ServiceLocationException;
+
/**
* Find all services that match a certain service type.
*
* @param type
* the ServiceType.
* @param scopes
- * A <code>List</code> of scope <code>Strings</code>, RFC
- * 2614 uses <code>Vector</code> here but jSLP prefers the
- * Collection Framework.
+ * A <code>List</code> of scope <code>Strings</code>, RFC 2614
+ * uses <code>Vector</code> here but jSLP prefers the Collection
+ * Framework.
* @param searchFilter
* an RFC 1960 compliant <code>String</code> of a LDAP filter.
* RFC 2614 proposes the newer RFC 2254 style filters that adds
* support for extensible matches.
- * @return a ReplyFuture with the <code>ServiceURLs</code>
- * of the found services.
+ * @return a ReplyFuture with the <code>ServiceURLs</code> of the found
+ * services.
* @throws ServiceLocationException
* in case of an exception in the underlying framework.
- * @throws InvalidSyntaxException
+ * @throws InvalidSyntaxException
*/
ServiceReplyFuture findServices(ServiceType type, List<String> scopes,
- String searchFilter) throws ServiceLocationException, IllegalArgumentException;
-
+ String searchFilter) throws ServiceLocationException,
+ IllegalArgumentException;
+
/**
* Find all services that match a ServiceURL.
*
* @param url
* the ServiceURL.
* @param scopes
- * A <code>List</code> of scopes <code>Strings</code>, RFC
- * 2614 uses <code>Vector</code> here but jSLP prefers the
- * Collection Framework.
+ * A <code>List</code> of scopes <code>Strings</code>, RFC 2614
+ * uses <code>Vector</code> here but jSLP prefers the Collection
+ * Framework.
* @param attributeIds
* A List of attribute-value-pairs like
*
- * <pre>
+ * <pre>
* (key = value)
* </pre>
*
- * that must match. If null, no attribute constraints are applied.
- * @return a RepyFuture with the <code>ServiceURLs</code>
- * of the found services.
+ * that must match. If null, no attribute constraints are
+ * applied.
+ * @return a RepyFuture with the <code>ServiceURLs</code> of the found
+ * services.
* @throws ServiceLocationException
* in case of an exception in the underlying framework.
*/
@@ -120,45 +124,45 @@
* @param type
* the ServiceType.
* @param scopes
- * A <code>List</code> of scope <code>Strings</code>, RFC
- * 2614 uses <code>Vector</code> here but jSLP prefers the
- * Collection Framework.
+ * A <code>List</code> of scope <code>Strings</code>, RFC 2614
+ * uses <code>Vector</code> here but jSLP prefers the Collection
+ * Framework.
* @param attributeIds
* A List of attribute-value-pairs like
*
- * <pre>
+ * <pre>
* (key = value)
* </pre>
*
- * that must match. If null, no attribute constraints are applied.
- * @return a ReplyFuture with the ServiceURLs of the found
- * services.
+ * that must match. If null, no attribute constraints are
+ * applied.
+ * @return a ReplyFuture with the ServiceURLs of the found services.
* @throws ServiceLocationException
* in case of an exception in the underlying framework.
*/
AttributeReplyFuture findAttributes(ServiceType type, List<String> scopes,
List attributeIds) throws ServiceLocationException;
-
-
+
/**
* Start the Acceptors in the core and have them listen on the SLP_PORT.
*
- * By default a Locator will not be listening on the SLP_PORT in order to allow a UA to be
- * used by non-root users. Therefor the UA will not receive DAADVERTS and the like sent as
- * multicast packets to the SLP_PORT.
+ * By default a Locator will not be listening on the SLP_PORT in order to
+ * allow a UA to be used by non-root users. Therefor the UA will not receive
+ * DAADVERTS and the like sent as multicast packets to the SLP_PORT.
*
* @throws ServiceLocationException
- * in case the MINA framework could no tbe initialized on the SLP_PORT (e.g. as non-root on the default port 427)
- */
+ * in case the MINA framework could no tbe initialized on the
+ * SLP_PORT (e.g. as non-root on the default port 427)
+ */
public void listenOnSLPPort() throws ServiceLocationException;
-
+
public boolean isUseAttributeListExtension();
public void setUseAttributeListExtension(boolean useAttributeListExtension);
-
- //FOR BENCHMARKING, REMOVE!!
- //TODO: REMOVE!!
- //public void addDATracker(CategoricalTracker daTracker);
-
- //public void forceDAs(String[] das);
+
+ // FOR BENCHMARKING, REMOVE!!
+ // TODO: REMOVE!!
+ // public void addDATracker(CategoricalTracker daTracker);
+
+ // public void forceDAs(String[] das);
}
Modified: directory/sandbox/slp/src/main/java/org/apache/directory/slp/OpaqueValue.java
URL: http://svn.apache.org/viewvc/directory/sandbox/slp/src/main/java/org/apache/directory/slp/OpaqueValue.java?rev=782980&r1=782979&r2=782980&view=diff
==============================================================================
--- directory/sandbox/slp/src/main/java/org/apache/directory/slp/OpaqueValue.java (original)
+++ directory/sandbox/slp/src/main/java/org/apache/directory/slp/OpaqueValue.java Tue Jun 9 12:50:45 2009
@@ -22,291 +22,286 @@
import java.util.StringTokenizer;
/**
- * A wrapper used for the SLP Opaque attribute type. Provides access to the String representation
- * as well as the raw bytes. Also provides equality, comparison and toString methods
+ * A wrapper used for the SLP Opaque attribute type. Provides access to the
+ * String representation as well as the raw bytes. Also provides equality,
+ * comparison and toString methods
*
* @author Lorenz Breu
- *
+ *
*/
-public class OpaqueValue implements Comparable<OpaqueValue>{
-
+public class OpaqueValue implements Comparable<OpaqueValue> {
+
private String opaqueString;
-
+
private Byte[] opaqueBytes;
-
-
-
-
+
/**
- * Create a new OpaqueValue with a String representing an opaque attribute in SLP.
+ * Create a new OpaqueValue with a String representing an opaque attribute
+ * in SLP.
*
* @param opaque
- * A String representing an SLP opaque type i.e., starting with "\FF" (or "\\FF" in actual Java notation)
+ * A String representing an SLP opaque type i.e., starting with
+ * "\FF" (or "\\FF" in actual Java notation)
*/
- public OpaqueValue(String opaque){
+ public OpaqueValue(final String opaque) {
opaqueString = opaque.toUpperCase();
opaqueBytes = opaqueStringToByteArray(opaque);
}
-
+
/**
* Create a new OpaqueValue with raw bytes.
*
* @param bytes
- * The raw bytes as <code>byte[]</code>
+ * The raw bytes as <code>byte[]</code>
*/
- public OpaqueValue(byte[] bytes){
+ public OpaqueValue(final byte[] bytes) {
opaqueString = byteArrayToOpaqueString(bytes);
- Byte[] ba = new Byte[bytes.length];
- for (int i = 0; i < ba.length; i++){
+ final Byte[] ba = new Byte[bytes.length];
+ for (int i = 0; i < ba.length; i++) {
ba[i] = bytes[i];
}
opaqueBytes = ba;
}
-
+
/**
* Create a new OpaqueValue with raw bytes.
*
* @param bytes
- * The raw bytes as <code>Byte[]</code>
+ * The raw bytes as <code>Byte[]</code>
*/
- public OpaqueValue(Byte[] bytes){
+ public OpaqueValue(final Byte[] bytes) {
opaqueString = byteArrayToOpaqueString(bytes);
opaqueBytes = bytes;
}
-
-
-
-
+
/**
* Converts a Byte array to its corresponding SLP string representation
*
* @param ba
- * The raw bytes as <code>Byte[]</code>
- * @return
- * The SLP string representation without the leading "\FF" if it is not explicitly present in the byte array
+ * The raw bytes as <code>Byte[]</code>
+ * @return The SLP string representation without the leading "\FF" if it is
+ * not explicitly present in the byte array
*/
- public static String byteArrayToOpaqueString(Byte[] ba){
+ public static String byteArrayToOpaqueString(final Byte[] ba) {
String result = "";
- for (Byte b : ba){
- result+="\\"+byteToHex(b);
+ for (final Byte b : ba) {
+ result += "\\" + byteToHex(b);
}
return result;
}
-
-
+
/**
* Converts a byte array to its corresponding SLP string representation
*
* @param bar
- * The raw bytes as <code>byte[]</code>
- * @return
- * The SLP string representation without adding the leading "\FF" if it is not explicitly present in the byte array
- */
- public static String byteArrayToOpaqueString(byte[] bar){
- Byte[] ba = new Byte[bar.length];
- for (int i = 0; i < ba.length; i++){
+ * The raw bytes as <code>byte[]</code>
+ * @return The SLP string representation without adding the leading "\FF" if
+ * it is not explicitly present in the byte array
+ */
+ public static String byteArrayToOpaqueString(final byte[] bar) {
+ final Byte[] ba = new Byte[bar.length];
+ for (int i = 0; i < ba.length; i++) {
ba[i] = bar[i];
}
String result = "";
- for (Byte b : ba){
- result+="\\"+byteToHex(b);
+ for (final Byte b : ba) {
+ result += "\\" + byteToHex(b);
}
return result;
}
-
-
-
+
/**
- * Converts an SLP string representing an opaque value to its corresponding Byte[]
+ * Converts an SLP string representing an opaque value to its corresponding
+ * Byte[]
*
* @param os
- * The SLP string representation
- *
- * @return
- * The raw bytes as <code>Byte[]</code>
- */
- public static Byte[] opaqueStringToByteArray(String os){
- StringTokenizer tokenizer = new StringTokenizer(os,"\\");
- Byte[] result = new Byte[tokenizer.countTokens()];
+ * The SLP string representation
+ *
+ * @return The raw bytes as <code>Byte[]</code>
+ */
+ public static Byte[] opaqueStringToByteArray(final String os) {
+ final StringTokenizer tokenizer = new StringTokenizer(os, "\\");
+ final Byte[] result = new Byte[tokenizer.countTokens()];
int i = 0;
- while (tokenizer.hasMoreTokens()){
- result[i++] = (byte) Integer.parseInt(tokenizer.nextToken(),16);
+ while (tokenizer.hasMoreTokens()) {
+ result[i++] = (byte) Integer.parseInt(tokenizer.nextToken(), 16);
}
return result;
}
-
-
-
+
/**
* Converts a single byte to its hexadecimal string representation.
- * Examples: 1->"01", 12->"0C", 255->"FF", ...
+ * Examples: 1->"01", 12->"0C", 255->"FF", ...
*
* @param b
- * The single byte
- * @return
- * Hexadecimal value as a string (no leading "0x")
+ * The single byte
+ * @return Hexadecimal value as a string (no leading "0x")
*/
- public static String byteToHex(byte b){
+ public static String byteToHex(final byte b) {
String result = Integer.toHexString(b);
- if (result.length()>2){
- result = result.substring(result.length()-2);
- } else if (result.length()==1){
- result = "0"+result;
+ if (result.length() > 2) {
+ result = result.substring(result.length() - 2);
+ } else if (result.length() == 1) {
+ result = "0" + result;
}
return result.toUpperCase();
-
+
}
-
-
+
/**
* Converts a hexadecimal string representation to a byte.
- *
+ *
* @param h
- * The string representation of a byte e.g. "FF"
- * @return
- * The Byte that value represents
+ * The string representation of a byte e.g. "FF"
+ * @return The Byte that value represents
*/
- public static Byte hexToByte(String h){
- return (byte) Integer.parseInt(h,16);
+ public static Byte hexToByte(final String h) {
+ return (byte) Integer.parseInt(h, 16);
}
/**
- * Returns the raw byte contents of this value
+ * Returns the raw byte contents of this value
*
- * @return
- * The raw bytes as <code>Byte[]</code>
+ * @return The raw bytes as <code>Byte[]</code>
*/
public Byte[] getOpaqueBytes() {
return opaqueBytes;
}
-
/**
- * Set the raw byte contents of this value
+ * Set the raw byte contents of this value
*
* @param opaqueBytes
- * The raw bytes as <code>Byte[]</code>
+ * The raw bytes as <code>Byte[]</code>
*/
- public void setOpaqueBytes(Byte[] opaqueBytes) {
+ public void setOpaqueBytes(final Byte[] opaqueBytes) {
this.opaqueBytes = opaqueBytes;
}
/**
- * Returns the SLP string representation of the raw byte contents of this value
+ * Returns the SLP string representation of the raw byte contents of this
+ * value
*
- * @return
- * SLP String representing the raw byte value
+ * @return SLP String representing the raw byte value
*/
public String getOpaqueString() {
return opaqueString;
}
/**
- * Sets the SLP string representation of the raw byte contents of this value
+ * Sets the SLP string representation of the raw byte contents of this value
*
* @param opaqueString
- * SLP String representing the raw byte value
+ * SLP String representing the raw byte value
*/
- public void setOpaqueString(String opaqueString) {
+ public void setOpaqueString(final String opaqueString) {
this.opaqueString = opaqueString;
}
-
+
/**
- * Returns the SLP string representation of the raw byte contents of this value
+ * Returns the SLP string representation of the raw byte contents of this
+ * value
*
- * @return
- * SLP String representing the raw byte value
+ * @return SLP String representing the raw byte value
*/
- public String toString(){
+ @Override
+ public String toString() {
return opaqueString;
}
-
-
-
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
- public int compareTo(OpaqueValue o) {
- if (o.getOpaqueString().equals(opaqueString)){
+ public int compareTo(final OpaqueValue o) {
+ if (o.getOpaqueString().equals(opaqueString)) {
return 0;
}
-
- if (o.getOpaqueBytes().length>opaqueBytes.length){
+
+ if (o.getOpaqueBytes().length > opaqueBytes.length) {
return -1;
}
return 1;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#equals(java.lang.Object)
*/
- public boolean equals(Object obj){
- if (obj instanceof OpaqueValue){
- OpaqueValue ov = (OpaqueValue) obj;
+ @Override
+ public boolean equals(final Object obj) {
+ if (obj instanceof OpaqueValue) {
+ final OpaqueValue ov = (OpaqueValue) obj;
return opaqueString.equals(ov.getOpaqueString());
}
- if (obj instanceof String){
- String os = (String) obj;
+ if (obj instanceof String) {
+ final String os = (String) obj;
return opaqueString.equals(os.toUpperCase());
}
- if (obj instanceof Byte[]){
- Byte[] ba = (Byte[]) obj;
+ if (obj instanceof Byte[]) {
+ final Byte[] ba = (Byte[]) obj;
return equals(ba);
}
return false;
}
-
+
/**
- * Override of the equals() method to check if this OpaqueValue equals another.
+ * Override of the equals() method to check if this OpaqueValue equals
+ * another.
*
* @param ov
- * The other OpaqueValue this one is to be compared to
- * @return
- * True on equality, else false
+ * The other OpaqueValue this one is to be compared to
+ * @return True on equality, else false
*/
- public boolean equals(OpaqueValue ov){
+ public boolean equals(final OpaqueValue ov) {
return opaqueString.equals(ov.getOpaqueString());
}
-
+
/**
- * Override of the equals() method to check if this OpaqueValue equals an SLP representation of an opaque value.
+ * Override of the equals() method to check if this OpaqueValue equals an
+ * SLP representation of an opaque value.
*
* @param os
- * The string representation of the opaque value this one is to be compared to
- * @return
- * True on equality, else false
+ * The string representation of the opaque value this one is to
+ * be compared to
+ * @return True on equality, else false
*/
- public boolean equals(String os){
+ public boolean equals(final String os) {
return os.toUpperCase().equals(opaqueString);
}
-
+
/**
- * Override of the equals() method to check if this OpaqueValue equals raw Byte data
+ * Override of the equals() method to check if this OpaqueValue equals raw
+ * Byte data
*
* @param ba
- * The raw bytes as <code>Byte[]</code> of the opaque value this one is to be compared to
- * @return
- * True on equality, else false
- */
- public boolean equals(Byte[] ba){
- return byteArrayToOpaqueString(ba).equals(byteArrayToOpaqueString(opaqueBytes));
+ * The raw bytes as <code>Byte[]</code> of the opaque value this
+ * one is to be compared to
+ * @return True on equality, else false
+ */
+ public boolean equals(final Byte[] ba) {
+ return byteArrayToOpaqueString(ba).equals(
+ byteArrayToOpaqueString(opaqueBytes));
}
-
+
/**
- * Override of the equals() method to check if this OpaqueValue equals raw byte data
+ * Override of the equals() method to check if this OpaqueValue equals raw
+ * byte data
*
* @param bar
- * The raw bytes as <code>byte[]</code> of the opaque value this one is to be compared to
- * @return
- * True on equality, else false
- */
- public boolean equals(byte[] bar){
- Byte[] ba = new Byte[bar.length];
- for (int i = 0; i < ba.length; i++){
+ * The raw bytes as <code>byte[]</code> of the opaque value this
+ * one is to be compared to
+ * @return True on equality, else false
+ */
+ public boolean equals(final byte[] bar) {
+ final Byte[] ba = new Byte[bar.length];
+ for (int i = 0; i < ba.length; i++) {
ba[i] = bar[i];
}
- return byteArrayToOpaqueString(ba).equals(byteArrayToOpaqueString(opaqueBytes));
+ return byteArrayToOpaqueString(ba).equals(
+ byteArrayToOpaqueString(opaqueBytes));
}
-
+
}
Modified: directory/sandbox/slp/src/main/java/org/apache/directory/slp/ReplyFuture.java
URL: http://svn.apache.org/viewvc/directory/sandbox/slp/src/main/java/org/apache/directory/slp/ReplyFuture.java?rev=782980&r1=782979&r2=782980&view=diff
==============================================================================
--- directory/sandbox/slp/src/main/java/org/apache/directory/slp/ReplyFuture.java (original)
+++ directory/sandbox/slp/src/main/java/org/apache/directory/slp/ReplyFuture.java Tue Jun 9 12:50:45 2009
@@ -21,78 +21,65 @@
import java.util.List;
-import org.apache.directory.slp.ServiceLocationEnumeration;
import org.apache.directory.slp.messages.AbstractSLPReplyMessage;
-
/**
- * The future returned when performing SLP lookups. It can be accessed while results still come in using next(),
- * or after all results have arrived using getResult().
+ * The future returned when performing SLP lookups. It can be accessed while
+ * results still come in using next(), or after all results have arrived using
+ * getResult().
*
* @author Lorenz Breu
- *
+ *
*/
public interface ReplyFuture extends ServiceLocationEnumeration {
-
-
-
/**
- * Adds the result of an SLP reply message to the list of responses and the sender of the
- * reply to the list of responders, if the error code is 0.
+ * Adds the result of an SLP reply message to the list of responses and the
+ * sender of the reply to the list of responders, if the error code is 0.
*
* @param reply
- * An AbstractSLPReplyMessage obtained through unicast or multicast
+ * An AbstractSLPReplyMessage obtained through unicast or
+ * multicast
*/
public void add(AbstractSLPReplyMessage reply);
-
+
/**
- * Close the future.
- * If the override flag is set, the future will be closed directly.
- * If override is false, then the defined scopes will be removed from the list of unhandled scopes
- * and the future will be closed only if no scopes remain unhandled. Else it will remain open.
+ * Close the future. If the override flag is set, the future will be closed
+ * directly. If override is false, then the defined scopes will be removed
+ * from the list of unhandled scopes and the future will be closed only if
+ * no scopes remain unhandled. Else it will remain open.
*
* @param scopes
- * The scopes to mark as done.
+ * The scopes to mark as done.
* @param override
- * Set to true if the future should be closed even if scopes remain unhandled (e.g. timeout)
+ * Set to true if the future should be closed even if scopes
+ * remain unhandled (e.g. timeout)
*/
public void setDone(String[] scopes, boolean override);
-
-
-
-
+
/**
* Returns the status of the future.
*
- * @return
- * True if done, false if results can still be added.
+ * @return True if done, false if results can still be added.
*/
public boolean isDone();
-
+
/**
- * Blocking call that waits until the future is marked as "done" before returning all available responses.
+ * Blocking call that waits until the future is marked as "done" before
+ * returning all available responses.
*
- * @return
- * A list of all results obtained during the unicast or multicast SLP operation in the form of Strings.
+ * @return A list of all results obtained during the unicast or multicast
+ * SLP operation in the form of Strings.
*/
public List<String> getResult();
-
-
+
/**
- * Returns the sources of all reply messages with error code 0 passed on to this future.
+ * Returns the sources of all reply messages with error code 0 passed on to
+ * this future.
*
- * @return
- * Array of IP addresses as Strings in dot notation of the sources of reply messages.
+ * @return Array of IP addresses as Strings in dot notation of the sources
+ * of reply messages.
*/
public String[] getResponders();
-
-
-
-}
-
-
-
-
-
+}
Modified: directory/sandbox/slp/src/main/java/org/apache/directory/slp/SLPAttribute.java
URL: http://svn.apache.org/viewvc/directory/sandbox/slp/src/main/java/org/apache/directory/slp/SLPAttribute.java?rev=782980&r1=782979&r2=782980&view=diff
==============================================================================
--- directory/sandbox/slp/src/main/java/org/apache/directory/slp/SLPAttribute.java (original)
+++ directory/sandbox/slp/src/main/java/org/apache/directory/slp/SLPAttribute.java Tue Jun 9 12:50:45 2009
@@ -20,13 +20,13 @@
package org.apache.directory.slp;
/**
- * A wrapper around the SLP attributes. Used by the Locator for attribute requests.
- * As jSLP does not enforce or use service templates, situations may occur when attribute
- * requests lead to inconsistent answers. This wrapper prevents this by keeping track
- * of name and type of a specific attribute.
+ * A wrapper around the SLP attributes. Used by the Locator for attribute
+ * requests. As jSLP does not enforce or use service templates, situations may
+ * occur when attribute requests lead to inconsistent answers. This wrapper
+ * prevents this by keeping track of name and type of a specific attribute.
*
* @author Lorenz Breu
- *
+ *
*/
public interface SLPAttribute {
@@ -37,30 +37,29 @@
public static final int INTEGER_AT = 2;
public static final int BOOLEAN_AT = 3;
public static final int OPAQUE_AT = 4;
- public static final int KEYWORD_AT = 5;
-
+ public static final int KEYWORD_AT = 5;
+
public static final String STRING_AT_STRING = "String";
public static final String INTEGER_AT_STRING = "Integer";
public static final String BOOLEAN_AT_STRING = "Boolean";
public static final String OPAQUE_AT_STRING = "Opaque";
public static final String KEYWORD_AT_STRING = "Keyword";
-
-
+
public int getType();
-
+
public String getTypeString();
-
+
public String getName();
-
+
public Boolean[] getBooleanValues();
-
+
public String[] getStringValues();
-
+
public Integer[] getIntegerValues();
-
+
public OpaqueValue[] getOpaqueValues();
-
+
public int count();
-
+
public boolean isKeyword();
}
Modified: directory/sandbox/slp/src/main/java/org/apache/directory/slp/Service.java
URL: http://svn.apache.org/viewvc/directory/sandbox/slp/src/main/java/org/apache/directory/slp/Service.java?rev=782980&r1=782979&r2=782980&view=diff
==============================================================================
--- directory/sandbox/slp/src/main/java/org/apache/directory/slp/Service.java (original)
+++ directory/sandbox/slp/src/main/java/org/apache/directory/slp/Service.java Tue Jun 9 12:50:45 2009
@@ -44,34 +44,32 @@
/**
* the service attributes.
*/
- Dictionary<String,Object> attributes;
-
+ Dictionary<String, Object> attributes;
+
/**
- * The attribute list as it is received, must be stored and given back in this way when an SPI is included, as DAs are not to
- * sign reply messages, only pass on authentication information as received.
+ * The attribute list as it is received, must be stored and given back in
+ * this way when an SPI is included, as DAs are not to sign reply messages,
+ * only pass on authentication information as received.
*/
String verbatimAttributeList = "";
-
-
+
/**
* the service attribute authentication blocks.
*/
private AuthenticationBlock[] authenticationBlocks;
-
-
+
/**
* the scopes this service is intended for.
*/
private List<String> scopes;
-
/**
* Added to support replication on Cirrostratus
*/
- public Service(){
-
+ public Service() {
+
}
-
+
/**
* creates a new Service instance by parsing a registration message.
*
@@ -84,25 +82,24 @@
url = sreg.getServiceURL();
attributes = SLPUtils.stringArrayToDict(sreg.getAttrList());
scopes = new ArrayList<String>();
- for (String scope : sreg.getScopes()){
+ for (final String scope : sreg.getScopes()) {
scopes.add(scope.toLowerCase().trim());
}
authenticationBlocks = sreg.getAuthBlocks();
verbatimAttributeList = sreg.getVerbatimAttributeList();
}
-
+
/**
* creates a new Service instance from a ServiceURL hsing default scope.
*
* @param url
* the service url for this Service instance.
*/
- public Service(ServiceURL url){
+ public Service(final ServiceURL url) {
this.url = url;
scopes = new ArrayList<String>();
scopes.add("default");
}
-
/**
* @param obj
@@ -112,28 +109,23 @@
* properties.
* @see java.lang.Object#equals(java.lang.Object)
*/
+ @Override
public boolean equals(final Object obj) {
if (obj instanceof Service) {
- Service service = (Service) obj;
+ final Service service = (Service) obj;
return attributes.equals(service.attributes)
&& url.equals(service.url);
}
return false;
}
-
-
-
-
-// public boolean equals(final Object obj) {
-// if (obj instanceof Service) {
-// Service service = (Service) obj;
-// return url.equals(service.url);
-// }
-// return false;
-// }
-
-
-
+
+ // public boolean equals(final Object obj) {
+ // if (obj instanceof Service) {
+ // Service service = (Service) obj;
+ // return url.equals(service.url);
+ // }
+ // return false;
+ // }
/**
* get the hash code.
@@ -141,136 +133,142 @@
* @return the hash code.
* @see java.lang.Object#hashCode()
*/
+ @Override
public int hashCode() {
return url.hashCode();
}
-
/**
* get the ServiceURL of this Service
*
* @return the ServiceURL
*/
- public ServiceURL getURL(){
+ public ServiceURL getURL() {
return url;
}
-
+
/**
- * Get the attributes as a Dictionary mapping attribute name (String) to values (Integer, Boolean, String, OpaqueValue or array of the aforementioned)
+ * Get the attributes as a Dictionary mapping attribute name (String) to
+ * values (Integer, Boolean, String, OpaqueValue or array of the
+ * aforementioned)
*
* @return The attributes as Dictionary String->Object
*/
- public Dictionary<String,Object> getAttributes(){
+ public Dictionary<String, Object> getAttributes() {
return attributes;
}
-
+
/**
- * Set the Service's attributes, overwriting any existing attributes
- * jSLP expects the values to be of type String, Integer, Boolean or OpaqueValue or an array of these types.
+ * Set the Service's attributes, overwriting any existing attributes jSLP
+ * expects the values to be of type String, Integer, Boolean or OpaqueValue
+ * or an array of these types.
*
* @param attr
- * The attributes as a Dictionary String->Object.
+ * The attributes as a Dictionary String->Object.
*/
- public void setAttributes(Dictionary<String,Object> attr){
+ public void setAttributes(final Dictionary<String, Object> attr) {
attributes = attr;
}
-
+
/**
- * Gets the attributes but converts all values to their string representation
+ * Gets the attributes but converts all values to their string
+ * representation
*
- * @return
- * The attributes as a Dictionary String->String
+ * @return The attributes as a Dictionary String->String
*/
- public Dictionary<String,String> getAttributesAsStringDict(){
- if (attributes==null){
- return new Hashtable<String,String>();
+ public Dictionary<String, String> getAttributesAsStringDict() {
+ if (attributes == null) {
+ return new Hashtable<String, String>();
}
- Enumeration keys = attributes.keys();
- Dictionary<String,String> result = new Hashtable<String,String>();
- while (keys.hasMoreElements()){
- Object key = keys.nextElement();
+ final Enumeration keys = attributes.keys();
+ final Dictionary<String, String> result = new Hashtable<String, String>();
+ while (keys.hasMoreElements()) {
+ final Object key = keys.nextElement();
Object value = attributes.get(key);
- String combined="";
- if (value instanceof Object[]){
- Object[] valueArray = (Object[]) value;
+ String combined = "";
+ if (value instanceof Object[]) {
+ final Object[] valueArray = (Object[]) value;
combined = valueArray[0].toString();
- for (int i=1;i<valueArray.length;i++){
- combined = combined + ", "+valueArray[i].toString().trim();
+ for (int i = 1; i < valueArray.length; i++) {
+ combined = combined + ", "
+ + valueArray[i].toString().trim();
}
- value=combined;
+ value = combined;
}
- result.put(key.toString(),value.toString());
+ result.put(key.toString(), value.toString());
}
return result;
}
-
+
/**
* Get the scopes as a List
*
- * @return
- * The scopes
+ * @return The scopes
*/
- public List<String> getScopes(){
+ public List<String> getScopes() {
return scopes;
}
-
+
/**
* Sets the scope list
*
* @param scopes
- * The scopes as a List of String
+ * The scopes as a List of String
*/
- public void setScopes(List<String> scopes){
+ public void setScopes(final List<String> scopes) {
this.scopes = scopes;
}
-
+
/**
* Get the authentication blocks
*
- * @return
- * The Authentication Blocks as an array
+ * @return The Authentication Blocks as an array
*/
- public AuthenticationBlock[] getAuthBlocks(){
+ public AuthenticationBlock[] getAuthBlocks() {
return authenticationBlocks;
}
-
+
/**
* Set the authentication blocks
*
* @param blocks
- * The Authentication Blocks as an array
+ * The Authentication Blocks as an array
*/
- public void setAuthBlocks(AuthenticationBlock[] blocks){
+ public void setAuthBlocks(final AuthenticationBlock[] blocks) {
authenticationBlocks = blocks;
}
-
+
/**
* Get the verbatim attribute list as it arrives in a registration message.
- * Required for DAs as they do not sign the replies but simply pass on authentication information as received
+ * Required for DAs as they do not sign the replies but simply pass on
+ * authentication information as received
*
- * @return
- * String representation of the attributes as arrived in the registration
+ * @return String representation of the attributes as arrived in the
+ * registration
*/
- public String getVerbatimAttributeList(){
+ public String getVerbatimAttributeList() {
return verbatimAttributeList;
}
-
+
/**
* Set the verbatim attribute list as it arrives in a registration message.
- * Required for DAs as they do not sign the replies but simply pass on authentication information as received
+ * Required for DAs as they do not sign the replies but simply pass on
+ * authentication information as received
*
* @param v
- * String representation of the attributes as arrived in the registration
+ * String representation of the attributes as arrived in the
+ * registration
*/
- public void setVerbatimAttributeList(String v){
- verbatimAttributeList=v;
+ public void setVerbatimAttributeList(final String v) {
+ verbatimAttributeList = v;
}
-
+
/**
* get a string representation.
*
* @return a string.
*/
+ @Override
public String toString() {
return url.toString();
}
Modified: directory/sandbox/slp/src/main/java/org/apache/directory/slp/ServiceLocationException.java
URL: http://svn.apache.org/viewvc/directory/sandbox/slp/src/main/java/org/apache/directory/slp/ServiceLocationException.java?rev=782980&r1=782979&r2=782980&view=diff
==============================================================================
--- directory/sandbox/slp/src/main/java/org/apache/directory/slp/ServiceLocationException.java (original)
+++ directory/sandbox/slp/src/main/java/org/apache/directory/slp/ServiceLocationException.java Tue Jun 9 12:50:45 2009
@@ -24,141 +24,132 @@
/**
* This exception is thrown whenever a part of the SLP framework causes an
* exception. The error code is a hint why the exception occured.
- *
+ *
* @author Jan S. Rellermeyer
*/
-public class ServiceLocationException extends Exception
- implements Serializable {
+public class ServiceLocationException extends Exception implements Serializable {
- /**
- * @serial for serialization.
- */
- private static final long serialVersionUID = 5718658752610460537L;
-
- /**
- * There is data for the service type in the scope in the AttrRqst or
- * SrvRqst, but not in the requested language.
- */
- public static final short LANGUAGE_NOT_SUPPORTED = 1;
-
- /**
- * The message fails to obey SLP syntax.
- */
- public static final short PARSE_ERROR = 2;
-
- /**
- * The SrvReg has problems -- e.g., a zero lifetime or an omitted Language
- * Tag.
- */
- public static final short INVALID_REGISTRATION = 3;
-
- /**
- * The SLP message did not include a scope in its scope-list supported by
- * the SA or DA.
- */
- public static final short SCOPE_NOT_SUPPORTED = 4;
-
- /**
- * The DA or SA receives a request for an unsupported SLP SPI.
- */
- public static final short AUTHENTICATION_UNKNOWN = 5;
-
- /**
- * The DA expected URL and ATTR authentication in the SrvReg and did not
- * receive it.
- */
- public static final short AUTHENTICATION_ABSENT = 6;
-
- /**
- * Unsupported version number in message header. INTERNAL_ERROR = 10: The DA
- * (or SA) is too sick to respond.
- */
- public static final short AUTHENTICATION_FAILED = 7;
-
-
- /**
- * DA or SA received a request with a mandatory but unsupported extension
- */
- public static final short OPTION_NOT_UNDERSTOOD = 12;
-
-
- /**
- * The DA received a SrvReg without FRESH set, for an unregistered service
- * or with inconsistent Service Types.
- */
- public static final short INVALID_UPDATE = 13;
-
- /**
- * The DA rejected the update because it was within the minimal update
- * intervall.
- */
- public static final short REFRESH_REJECTED = 15;
-
- /**
- * The feature or extension is not implemented.
- */
- public static final short NOT_IMPLEMENTED = 16;
-
- /**
- * The initialization of the framework failed.
- */
- public static final short NETWORK_INIT_FAILED = 17;
-
- /**
- * The network timed out while the framework tried to send a message.
- */
- public static final short NETWORK_TIMED_OUT = 18;
-
- /**
- * The network encountered an error.
- */
- public static final short NETWORK_ERROR = 19;
-
- /**
- * The framework encountered an internal system error.
- */
- public static final short INTERNAL_SYSTEM_ERROR = 20;
-
- /**
- * The type was not well formed.
- */
- public static final short TYPE_ERROR = 21;
-
- /**
- * The framework encountered a buffer overflow.
- */
- public static final short BUFFER_OVERFLOW = 22;
-
- /**
- * the error code of this exception instance.
- */
- private short errorCode;
-
- /**
- * hidden constructor.
- */
- private ServiceLocationException() {
- }
-
- /**
- * Create a new ServiceLocation instance.
- *
- * @param errcode
- * the error code, one of the statically defined.
- * @param message
- * the message of the exception.
- */
- public ServiceLocationException(final short errcode, final String message) {
- super(message);
- errorCode = errcode;
- }
-
- /**
- * Get the error code of the exception.
- *
- * @return the error code.
- */
- public final short getErrorCode() {
- return errorCode;
- }
+ /**
+ * @serial for serialization.
+ */
+ private static final long serialVersionUID = 5718658752610460537L;
+
+ /**
+ * There is data for the service type in the scope in the AttrRqst or
+ * SrvRqst, but not in the requested language.
+ */
+ public static final short LANGUAGE_NOT_SUPPORTED = 1;
+
+ /**
+ * The message fails to obey SLP syntax.
+ */
+ public static final short PARSE_ERROR = 2;
+
+ /**
+ * The SrvReg has problems -- e.g., a zero lifetime or an omitted Language
+ * Tag.
+ */
+ public static final short INVALID_REGISTRATION = 3;
+
+ /**
+ * The SLP message did not include a scope in its scope-list supported by
+ * the SA or DA.
+ */
+ public static final short SCOPE_NOT_SUPPORTED = 4;
+
+ /**
+ * The DA or SA receives a request for an unsupported SLP SPI.
+ */
+ public static final short AUTHENTICATION_UNKNOWN = 5;
+
+ /**
+ * The DA expected URL and ATTR authentication in the SrvReg and did not
+ * receive it.
+ */
+ public static final short AUTHENTICATION_ABSENT = 6;
+
+ /**
+ * Unsupported version number in message header. INTERNAL_ERROR = 10: The DA
+ * (or SA) is too sick to respond.
+ */
+ public static final short AUTHENTICATION_FAILED = 7;
+
+ /**
+ * DA or SA received a request with a mandatory but unsupported extension
+ */
+ public static final short OPTION_NOT_UNDERSTOOD = 12;
+
+ /**
+ * The DA received a SrvReg without FRESH set, for an unregistered service
+ * or with inconsistent Service Types.
+ */
+ public static final short INVALID_UPDATE = 13;
+
+ /**
+ * The DA rejected the update because it was within the minimal update
+ * intervall.
+ */
+ public static final short REFRESH_REJECTED = 15;
+
+ /**
+ * The feature or extension is not implemented.
+ */
+ public static final short NOT_IMPLEMENTED = 16;
+
+ /**
+ * The initialization of the framework failed.
+ */
+ public static final short NETWORK_INIT_FAILED = 17;
+
+ /**
+ * The network timed out while the framework tried to send a message.
+ */
+ public static final short NETWORK_TIMED_OUT = 18;
+
+ /**
+ * The network encountered an error.
+ */
+ public static final short NETWORK_ERROR = 19;
+
+ /**
+ * The framework encountered an internal system error.
+ */
+ public static final short INTERNAL_SYSTEM_ERROR = 20;
+
+ /**
+ * The type was not well formed.
+ */
+ public static final short TYPE_ERROR = 21;
+
+ /**
+ * The framework encountered a buffer overflow.
+ */
+ public static final short BUFFER_OVERFLOW = 22;
+
+ /**
+ * the error code of this exception instance.
+ */
+ private short errorCode;
+
+ /**
+ * Create a new ServiceLocation instance.
+ *
+ * @param errcode
+ * the error code, one of the statically defined.
+ * @param message
+ * the message of the exception.
+ */
+ public ServiceLocationException(final short errcode, final String message) {
+ super(message);
+ errorCode = errcode;
+ }
+
+ /**
+ * Get the error code of the exception.
+ *
+ * @return the error code.
+ */
+ public final short getErrorCode() {
+ return errorCode;
+ }
}
Modified: directory/sandbox/slp/src/main/java/org/apache/directory/slp/ServiceReplyFuture.java
URL: http://svn.apache.org/viewvc/directory/sandbox/slp/src/main/java/org/apache/directory/slp/ServiceReplyFuture.java?rev=782980&r1=782979&r2=782980&view=diff
==============================================================================
--- directory/sandbox/slp/src/main/java/org/apache/directory/slp/ServiceReplyFuture.java (original)
+++ directory/sandbox/slp/src/main/java/org/apache/directory/slp/ServiceReplyFuture.java Tue Jun 9 12:50:45 2009
@@ -22,31 +22,30 @@
import java.util.List;
/**
- * The reply future returned by service lookups. Provides access to the results not only
- * as Strings but also as Service objects.
+ * The reply future returned by service lookups. Provides access to the results
+ * not only as Strings but also as Service objects.
*
- * If the Attribute List Extension is used, the attributes in the returned Service objects are set, else they remain null.
+ * If the Attribute List Extension is used, the attributes in the returned
+ * Service objects are set, else they remain null.
*
* @author Lorenz Breu
*/
-public interface ServiceReplyFuture extends ReplyFuture{
+public interface ServiceReplyFuture extends ReplyFuture {
/**
- * Get the next Service object returned by the SLP request process. Blocks until a Service is available
- * or the process times out (e.g. MCC).
+ * Get the next Service object returned by the SLP request process. Blocks
+ * until a Service is available or the process times out (e.g. MCC).
*
- * @return
- * The next Service object
+ * @return The next Service object
*/
public Service nextService();
-
+
/**
- * Get the complete List of Service objects returned by the SLP request process.
- * Blocks until the process times out (e.g. end of MCC).
+ * Get the complete List of Service objects returned by the SLP request
+ * process. Blocks until the process times out (e.g. end of MCC).
*
- * @return
- * List of Service objects
+ * @return List of Service objects
*/
public List<Service> getResultServices();
-
+
}
Modified: directory/sandbox/slp/src/main/java/org/apache/directory/slp/ServiceStore.java
URL: http://svn.apache.org/viewvc/directory/sandbox/slp/src/main/java/org/apache/directory/slp/ServiceStore.java?rev=782980&r1=782979&r2=782980&view=diff
==============================================================================
--- directory/sandbox/slp/src/main/java/org/apache/directory/slp/ServiceStore.java (original)
+++ directory/sandbox/slp/src/main/java/org/apache/directory/slp/ServiceStore.java Tue Jun 9 12:50:45 2009
@@ -23,17 +23,16 @@
import java.util.Map;
/**
- * The interface that backends of the DA have to implement. Provides methods
- * to store and retrieve services, attributes and service types.
- * Implementations of this interface are encouraged to keep track of attribute types
- * for abstract service types to enforce consistency.
+ * The interface that backends of the DA have to implement. Provides methods to
+ * store and retrieve services, attributes and service types. Implementations of
+ * this interface are encouraged to keep track of attribute types for abstract
+ * service types to enforce consistency.
*
* @author Lorenz Breu
- *
+ *
*/
public interface ServiceStore {
-
/**
* The types of the corresponding SLP attributes
*/
@@ -41,150 +40,170 @@
public static final int INTEGER_AT = 2;
public static final int BOOLEAN_AT = 3;
public static final int OPAQUE_AT = 4;
- public static final int KEYWORD_AT = 5;
-
+ public static final int KEYWORD_AT = 5;
+
/**
* Fetches a list of all services currently registered with this DA
*
- * @return
- * List<Service>: all services
+ * @return List<Service>: all services
* @throws ServiceLocationException
*/
public List<Service> listServices() throws ServiceLocationException;
-
+
/**
- * Stores a service in the backend. Should throw a ServiceLocationException if the service already exists.
+ * Stores a service in the backend. Should throw a ServiceLocationException
+ * if the service already exists.
*
* @param service
- * The service to store
+ * The service to store
* @throws ServiceLocationException
*/
public void storeService(Service service) throws ServiceLocationException;
-
+
/**
* Get attributes of registered services.
*
* @param service
- * Can be either a full service url (e.g. "service:osgi://gantenbein:123") in which case only attributes of thsi specific service are returned.
- * Alternatively a service type can also be used (e.g. "service:osgi") in which case attributes of all services that match that service type are returned.
+ * Can be either a full service url (e.g.
+ * "service:osgi://gantenbein:123") in which case only attributes
+ * of thsi specific service are returned. Alternatively a service
+ * type can also be used (e.g. "service:osgi") in which case
+ * attributes of all services that match that service type are
+ * returned.
*
* @param tagList
- * If this list is empty or null, all attributes are returned, otherwise only the ones in this list are returned.
+ * If this list is empty or null, all attributes are returned,
+ * otherwise only the ones in this list are returned.
*
* @param scopeList
- * The scopes in which to search for matching services
+ * The scopes in which to search for matching services
*
- * @return
- * An array of attributes in the form "(attribute=value)"
+ * @return An array of attributes in the form "(attribute=value)"
*/
- public String[] getAttributes(String service, String[] tagList, String[] scopeList);
-
+ public String[] getAttributes(String service, String[] tagList,
+ String[] scopeList);
+
/**
* Get service types of services registered with this DA
*
* @param scopes
- * The scopes in which to search
+ * The scopes in which to search
*
* @param namingAuthority
- * The naming authority defining the service types. can be "" or null, in which case all service types are returned.
+ * The naming authority defining the service types. can be "" or
+ * null, in which case all service types are returned.
*
- * @return
- * An array of available service types
+ * @return An array of available service types
*/
public ServiceType[] getServiceTypes(String[] scopes, String namingAuthority);
-
+
/**
- * Get services that match the specified predicate/filter-string of the specified service type
+ * Get services that match the specified predicate/filter-string of the
+ * specified service type
*
* @param serviceType
- * The service type of the services to be looked up
+ * The service type of the services to be looked up
*
* @param attributeFilter
- * The predicate to be used when searching, e.g. (attribute=foo)
- *
- * @return
- * List of services that match the given type and predicate
+ * The predicate to be used when searching, e.g. (attribute=foo)
+ *
+ * @return List of services that match the given type and predicate
*
* @throws ServiceLocationException
*/
- public List<Service> getServices(String serviceType, String attributeFilter) throws ServiceLocationException;
-
+ public List<Service> getServices(String serviceType, String attributeFilter)
+ throws ServiceLocationException;
+
/**
- * Get services that match the specified predicate/filter-string of the specified service type and in addition are in at least one of the specified scopes.
+ * Get services that match the specified predicate/filter-string of the
+ * specified service type and in addition are in at least one of the
+ * specified scopes.
*
* @param serviceType
- * The service type of the services to be looked up
+ * The service type of the services to be looked up
*
* @param attributeFilter
- * The predicate to be used when searching, e.g. (attribute=foo)
- *
+ * The predicate to be used when searching, e.g. (attribute=foo)
+ *
* @param scopes
- * An array of scopes. A service must be in at least one of these scopes to be found.
- * If null or empty, services in all scopes are returned.
+ * An array of scopes. A service must be in at least one of these
+ * scopes to be found. If null or empty, services in all scopes
+ * are returned.
*
- * @return
- * List of services that match the given type and predicate
+ * @return List of services that match the given type and predicate
*
* @throws ServiceLocationException
*/
- public List<Service> getServices(String serviceType, String attributeFilter, String[] scopes) throws ServiceLocationException;
-
+ public List<Service> getServices(String serviceType,
+ String attributeFilter, String[] scopes)
+ throws ServiceLocationException;
+
/**
* Fetch a specific service identified with the unique service URL.
*
* @param serviceUrl
- * The service url (e.g. "service:osgi://gantenbein:123" of the requested service.
+ * The service url (e.g. "service:osgi://gantenbein:123" of the
+ * requested service.
*
- * @return
- * The service if it is found, null else.
+ * @return The service if it is found, null else.
*
* @throws ServiceLocationException
*/
- public Service getService(String serviceUrl) throws ServiceLocationException;
-
+ public Service getService(String serviceUrl)
+ throws ServiceLocationException;
+
/**
- * Remove a specific service identified by its unique service url from the service store.
+ * Remove a specific service identified by its unique service url from the
+ * service store.
*
* @param serviceurl
- * The service url (e.g. "service:osgi://gantenbein:123" of the requested service.
- *
+ * The service url (e.g. "service:osgi://gantenbein:123" of the
+ * requested service.
+ *
* @throws ServiceLocationException
*/
- public void deleteService(String serviceurl) throws ServiceLocationException;
-
+ public void deleteService(String serviceurl)
+ throws ServiceLocationException;
+
/**
* Checks if a service with that service url is in the service store.
*
* @param service
- * The service url (as a string) of the requested service, e.g. "service:osgi://gantenbein:123"
+ * The service url (as a string) of the requested service, e.g.
+ * "service:osgi://gantenbein:123"
*
- * @return
- * TRUE if the service was found, FALSE else
+ * @return TRUE if the service was found, FALSE else
*/
public boolean containsService(String service);
-
+
/**
- * Remove all services from the store. Should be done at startup if an implementation keeps registered services in persistent storage.
+ * Remove all services from the store. Should be done at startup if an
+ * implementation keeps registered services in persistent storage.
*/
public void clear();
-
-
+
/**
- * Perform any cleanup steps necessary. Normally the SLP service is killed, so this may never be called...
+ * Perform any cleanup steps necessary. Normally the SLP service is killed,
+ * so this may never be called...
*/
public void shutdown();
-
+
/**
- * Returns the attribute type registry of the ServiceStore. Implementations should keep track of attribute types and
- * are encouraged to use a mapping of <abstract_service_type>.<attribute_name> -> Integer using the types staticaly provided by the ServiceStore interface.
+ * Returns the attribute type registry of the ServiceStore. Implementations
+ * should keep track of attribute types and are encouraged to use a mapping
+ * of <abstract_service_type>.<attribute_name> -> Integer using the types
+ * staticaly provided by the ServiceStore interface.
+ *
+ * The result is a copy of the data in the registry and does not provide
+ * write access to the actual registry.
*
- * The result is a copy of the data in the registry and does not provide write access to the actual registry.
- *
*
- * @return
- * A <code>Map</code> representing the mapping of attributes to types (Integer, String, Boolean, Opaque, Keyword)
+ * @return A <code>Map</code> representing the mapping of attributes to
+ * types (Integer, String, Boolean, Opaque, Keyword)
* @throws ServiceLocationException
- * If a ServiceStore implementation does not support this feature
+ * If a ServiceStore implementation does not support this
+ * feature
*/
- public Map<String, Integer> getAttributeTypes() throws ServiceLocationException;
+ public Map<String, Integer> getAttributeTypes()
+ throws ServiceLocationException;
}
Modified: directory/sandbox/slp/src/main/java/org/apache/directory/slp/ServiceType.java
URL: http://svn.apache.org/viewvc/directory/sandbox/slp/src/main/java/org/apache/directory/slp/ServiceType.java?rev=782980&r1=782979&r2=782980&view=diff
==============================================================================
--- directory/sandbox/slp/src/main/java/org/apache/directory/slp/ServiceType.java (original)
+++ directory/sandbox/slp/src/main/java/org/apache/directory/slp/ServiceType.java Tue Jun 9 12:50:45 2009
@@ -69,44 +69,48 @@
* @param serviceType
* the string representation of a ServiceType, e.g.
*
- * <pre>
+ * <pre>
* service:osgi:remote
* </pre>
*/
public ServiceType(final String serviceType) {
type = serviceType;
- if (type.equals("service") || type.equals("service:")){
- // quick fix by Lorenz to make service: an abstract service type for searches...
+ if (type.equals("service") || type.equals("service:")) {
+ // quick fix by Lorenz to make service: an abstract service type for
+ // searches...
isService = true;
isAbstract = true;
abstractType = "service";
concreteType = "";
principleType = "";
-
+
} else {
if (type.startsWith("service:")) {
isService = true;
-
- int principleStart = 8;
- int principleEnd = type.indexOf(":", principleStart);
-
+
+ final int principleStart = 8;
+ final int principleEnd = type.indexOf(":", principleStart);
+
if (principleEnd != -1) {
isAbstract = false;
- principleType = type.substring(principleStart, principleEnd);
+ principleType = type
+ .substring(principleStart, principleEnd);
abstractType = type.substring(0, principleEnd);
concreteType = type.substring(principleEnd + 1);
} else {
isAbstract = true;
principleType = type.substring(principleStart);
- // added by lorenz, seems like a service of type service:printer should return abstract type printer as well
- abstractType=type.substring(principleStart);
- //abstractType = "";
+ // added by lorenz, seems like a service of type
+ // service:printer should return abstract type printer as
+ // well
+ abstractType = type.substring(principleStart);
+ // abstractType = "";
concreteType = "";
}
-
- int namingStart = type.indexOf(".") + 1;
+
+ final int namingStart = type.indexOf(".") + 1;
if (namingStart != 0) {
- int namingEnd = type.indexOf(":", namingStart);
+ final int namingEnd = type.indexOf(":", namingStart);
String na = "";
if (namingEnd == -1) {
na = type.substring(namingStart);
@@ -114,10 +118,13 @@
na = type.substring(namingStart, namingEnd);
}
// 1954772: isNADefault returns false for "IANA"
- if("IANA".equalsIgnoreCase(na)) {
+ if ("IANA".equalsIgnoreCase(na)) {
namingAuthority = "";
// remove "iana" from type so toString() is consistent
- type = type.substring(0, namingStart - 1) + type.substring(namingStart + 4, type.length());
+ type = type.substring(0, namingStart - 1)
+ + type
+ .substring(namingStart + 4, type
+ .length());
} else {
namingAuthority = na;
}
@@ -198,22 +205,22 @@
* another ServiceType.
* @return true if they equal.
*/
+ @Override
public boolean equals(final Object obj) {
if (!(obj instanceof ServiceType)) {
return false;
}
- ServiceType t = (ServiceType) obj;
-
- if (!isAbstract && t.isAbstract){
+ final ServiceType t = (ServiceType) obj;
+
+ if (!isAbstract && t.isAbstract) {
return toString().startsWith(t.toString());
}
-
-
- return (isService == t.isService && isAbstract == t.isAbstract
+
+ return isService == t.isService && isAbstract == t.isAbstract
&& concreteType.equals(t.concreteType)
&& principleType.equals(t.principleType)
- && abstractType.equals(t.abstractType) && namingAuthority
- .equals(t.namingAuthority));
+ && abstractType.equals(t.abstractType)
+ && namingAuthority.equals(t.namingAuthority);
}
/**
@@ -227,7 +234,7 @@
if (!(obj instanceof ServiceType)) {
return false;
}
- ServiceType t = (ServiceType) obj;
+ final ServiceType t = (ServiceType) obj;
if (!isAbstract) {
return equals(t);
} else {
@@ -240,6 +247,7 @@
*
* @return the String representation.
*/
+ @Override
public String toString() {
return type;
}
@@ -249,20 +257,21 @@
*
* @return the int value of the hashCode.
*/
+ @Override
public int hashCode() {
int code = 0;
if (concreteType != null) {
- code ^= (concreteType.hashCode());
+ code ^= concreteType.hashCode();
}
if (principleType != null) {
- code ^= (principleType.hashCode() << 8);
+ code ^= principleType.hashCode() << 8;
}
if (abstractType != null) {
- code ^= (abstractType.hashCode() << 16);
+ code ^= abstractType.hashCode() << 16;
}
if (namingAuthority != null) {
- code ^= (namingAuthority.hashCode() << 24);
+ code ^= namingAuthority.hashCode() << 24;
}
return code;
}