directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r782980 [8/8] - in /directory/sandbox/slp/src/main/java/org/apache/directory/slp: ./ codec/ extensions/ impl/ impl/da/ impl/filter/ messages/
Date Tue, 09 Jun 2009 12:50:47 GMT
Modified: directory/sandbox/slp/src/main/java/org/apache/directory/slp/impl/filter/Filter.java
URL: http://svn.apache.org/viewvc/directory/sandbox/slp/src/main/java/org/apache/directory/slp/impl/filter/Filter.java?rev=782980&r1=782979&r2=782980&view=diff
==============================================================================
--- directory/sandbox/slp/src/main/java/org/apache/directory/slp/impl/filter/Filter.java (original)
+++ directory/sandbox/slp/src/main/java/org/apache/directory/slp/impl/filter/Filter.java Tue Jun  9 12:50:45 2009
@@ -23,19 +23,23 @@
 
 /**
  * a generic LDAP filter.
+ * 
  * @author Jan S. Rellermeyer
  */
 public interface Filter {
-    /**
-     * try to match a <code>Dictionary</code> of attributes.
-     * @param values a <code>Dictionary</code> of attributes.
-     * @return true if the filter evaluated to true;
-     */
-    boolean match(Dictionary values);
+	/**
+	 * try to match a <code>Dictionary</code> of attributes.
+	 * 
+	 * @param values
+	 *            a <code>Dictionary</code> of attributes.
+	 * @return true if the filter evaluated to true;
+	 */
+	boolean match(Dictionary values);
 
-    /**
-     * get a String representation of the filter.
-     * @return the String representation.
-     */
-    String toString();
+	/**
+	 * get a String representation of the filter.
+	 * 
+	 * @return the String representation.
+	 */
+	String toString();
 }

Modified: directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/AbstractSLPMessage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/AbstractSLPMessage.java?rev=782980&r1=782979&r2=782980&view=diff
==============================================================================
--- directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/AbstractSLPMessage.java (original)
+++ directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/AbstractSLPMessage.java Tue Jun  9 12:50:45 2009
@@ -29,8 +29,6 @@
 import org.apache.directory.slp.extensions.UnsupportedExtension;
 import org.apache.directory.slp.impl.SLPUtils;
 
-
-
 /**
  * abstract base class for all SLP messages.
  * 
@@ -43,7 +41,7 @@
 	protected final byte funcID;
 
 	protected short xid;
-	
+
 	protected String source;
 	protected int port;
 
@@ -51,9 +49,9 @@
 	protected boolean fresh = true;;
 
 	protected boolean tcp;
-	
-	protected AbstractExtension[] extensions = new AbstractExtension[]{};
-	
+
+	protected AbstractExtension[] extensions = new AbstractExtension[] {};
+
 	/**
 	 * the message funcID values according to RFC 2608, Service Request = 1.
 	 */
@@ -77,8 +75,8 @@
 	public static final byte SRVDEREG = 4;
 
 	/**
-	 * the message funcID values according to RFC 2608, Service Acknowledgement =
-	 * 5.
+	 * the message funcID values according to RFC 2608, Service Acknowledgement
+	 * = 5.
 	 */
 	public static final byte SRVACK = 5;
 
@@ -146,13 +144,12 @@
 	public final void setMulticast(final boolean multicast) {
 		this.multicast = multicast;
 	}
-	
-		
-	public boolean isFresh(){
+
+	public boolean isFresh() {
 		return fresh;
 	}
-	
-	public void setFresh(boolean freshness){
+
+	public void setFresh(final boolean freshness) {
 		fresh = freshness;
 	}
 
@@ -183,36 +180,32 @@
 		return buffer.toString();
 	}
 
+	@Override
 	public abstract String toString();
-	
+
 	/**
 	 * 
 	 * @return
 	 */
 	public abstract int getSize();
-	
+
 	int getHeaderSize() {
 		return 14 + locale.getLanguage().length();
 	}
-	
-	
+
 	protected static String arrayToString(final String[] arr, final String delim) {
 		return SLPUtils.arrayToString(arr, delim);
 	}
 
-	protected static List<String> stringToList(final String str, final String delim) {
+	protected static List<String> stringToList(final String str,
+			final String delim) {
 		return SLPUtils.stringToList(str, delim);
 	}
-	
-	protected static List<String> arrayToList(final String[] arr){
+
+	protected static List<String> arrayToList(final String[] arr) {
 		return SLPUtils.arrayToList(arr);
 	}
-	
-	
-	
-	
-	
-	
+
 	/**
 	 * get the bytes from a SLPMessage. Processes the header and then calls the
 	 * getBody() method of the implementing subclass.
@@ -222,8 +215,8 @@
 	 * @throws ServiceLocationException
 	 *             in case of IOExceptions.
 	 */
-	protected void writeHeader(final DataOutputStream out, int msgSize, int mtu)
-			throws IOException {
+	protected void writeHeader(final DataOutputStream out, final int msgSize,
+			final int mtu) throws IOException {
 		byte flags = 0;
 		if (funcID == SRVREG) {
 			flags |= 0x40;
@@ -236,9 +229,9 @@
 		}
 		out.write(2);
 		out.write(funcID);
-		out.write((byte) ((msgSize) >> 16));
-		out.write((byte) (((msgSize) >> 8) & 0xFF));
-		out.write((byte) ((msgSize) & 0xFF));
+		out.write((byte) (msgSize >> 16));
+		out.write((byte) (msgSize >> 8 & 0xFF));
+		out.write((byte) (msgSize & 0xFF));
 		out.write(flags);
 		out.write(0);
 		out.write(0);
@@ -247,91 +240,89 @@
 		out.writeShort(xid);
 		out.writeUTF(locale.getLanguage());
 	}
-	
-	public abstract void writeTo(final DataOutputStream out, final int mtu) throws IOException;
-	
-	public String getSource(){
+
+	public abstract void writeTo(final DataOutputStream out, final int mtu)
+			throws IOException;
+
+	public String getSource() {
 		return source;
 	}
-	
-	public void setSource(String s){
-		source=s;
+
+	public void setSource(final String s) {
+		source = s;
 	}
-	
-	public int getPort(){
+
+	public int getPort() {
 		return port;
 	}
-	
-	public void setPort(int p){
-		port=p;
-	}
-	
-	
-	
+
+	public void setPort(final int p) {
+		port = p;
+	}
+
 	/**
 	 * Return the String corresponding to the FuncID
 	 * 
-	 * @param funcID the message type as int
+	 * @param funcID
+	 *            the message type as int
 	 * @return The String representation of that type
 	 */
-	public static String getType(int funcID){
+	public static String getType(final int funcID) {
 		return TYPES[funcID];
 	}
-	
-	
-	public AbstractExtension[] getExtensions(){
+
+	public AbstractExtension[] getExtensions() {
 		return extensions;
 	}
-	
-	public void setExtensions(AbstractExtension[] extensions){
+
+	public void setExtensions(final AbstractExtension[] extensions) {
 		this.extensions = extensions;
 	}
-	
-	public void addExtension(AbstractExtension extension){
-		AbstractExtension[] newExt = new AbstractExtension[extensions.length+1];
+
+	public void addExtension(final AbstractExtension extension) {
+		final AbstractExtension[] newExt = new AbstractExtension[extensions.length + 1];
 		int i = 0;
-		for (AbstractExtension ae : extensions){
-			newExt[i++]=ae;
+		for (final AbstractExtension ae : extensions) {
+			newExt[i++] = ae;
 		}
 		newExt[i] = extension;
 		extensions = newExt;
 	}
-	
-	public boolean hasExtensions(){
-		if (extensions == null){
+
+	public boolean hasExtensions() {
+		if (extensions == null) {
 			return false;
 		}
-		return (extensions.length>0);
+		return extensions.length > 0;
 	}
-	
-	public boolean hasExtensionType(short id){
-		for (AbstractExtension ae : extensions){
-			if (ae.getId()==id){
+
+	public boolean hasExtensionType(final short id) {
+		for (final AbstractExtension ae : extensions) {
+			if (ae.getId() == id) {
 				return true;
 			}
 		}
 		return false;
 	}
-	
-	public boolean hasUnsupportedExtensions(){
-		for (AbstractExtension ae : extensions){
-			if (ae instanceof UnsupportedExtension){
-				 return true;
+
+	public boolean hasUnsupportedExtensions() {
+		for (final AbstractExtension ae : extensions) {
+			if (ae instanceof UnsupportedExtension) {
+				return true;
 			}
 		}
 		return false;
 	}
-	
-	public boolean hasUnsupportedMandatoryExtensions(){
-		for (AbstractExtension ae : extensions){
-			if (ae instanceof UnsupportedExtension){
-				 if (ae.isMandatory()){
-					 return true;
-				 }
+
+	public boolean hasUnsupportedMandatoryExtensions() {
+		for (final AbstractExtension ae : extensions) {
+			if (ae instanceof UnsupportedExtension) {
+				if (ae.isMandatory()) {
+					return true;
+				}
 			}
 		}
 		return false;
 	}
-	
-}
 
+}

Modified: directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/AbstractSLPReplyMessage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/AbstractSLPReplyMessage.java?rev=782980&r1=782979&r2=782980&view=diff
==============================================================================
--- directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/AbstractSLPReplyMessage.java (original)
+++ directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/AbstractSLPReplyMessage.java Tue Jun  9 12:50:45 2009
@@ -33,7 +33,7 @@
 	 */
 	private short errorCode;
 
-	AbstractSLPReplyMessage(byte funcID) {
+	AbstractSLPReplyMessage(final byte funcID) {
 		super(funcID);
 	}
 
@@ -45,6 +45,7 @@
 		return errorCode;
 	}
 
+	@Override
 	public final String getHeaderString() {
 		final StringBuffer buffer = new StringBuffer();
 		buffer.append(super.getHeaderString());
@@ -52,24 +53,19 @@
 		buffer.append(errorCode);
 		return buffer.toString();
 	}
-	
-	
+
 	/**
 	 * get the results.
 	 * 
 	 * @return the Array of results.
 	 */
 	public abstract String[] getResult();
-	
+
 	/**
 	 * get the results.
 	 * 
 	 * @return the List of results.
 	 */
 	public abstract List<String> getResultAsList();
-	
-	
-	
-	
 
 }

Modified: directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/AbstractSLPRequestMessage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/AbstractSLPRequestMessage.java?rev=782980&r1=782979&r2=782980&view=diff
==============================================================================
--- directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/AbstractSLPRequestMessage.java (original)
+++ directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/AbstractSLPRequestMessage.java Tue Jun  9 12:50:45 2009
@@ -24,7 +24,6 @@
 import org.apache.directory.slp.impl.SLPCore;
 import org.apache.directory.slp.impl.SLPUtils;
 
-
 /**
  * Abstract base class for all request messages.
  * 
@@ -44,13 +43,13 @@
 	 */
 	protected String[] scopes = new String[] { "default" };
 
-	AbstractSLPRequestMessage(byte funcID) {
+	AbstractSLPRequestMessage(final byte funcID) {
 		super(funcID);
-		scopes = SLPUtils.stringToStringArray(SLPCore.CONFIG.getScopes(),",");
+		scopes = SLPUtils.stringToStringArray(SLPCore.CONFIG.getScopes(), ",");
 	}
 
 	public final void setPrevResponders(final String[] responders) {
-		this.prevResponders = responders;
+		prevResponders = responders;
 	}
 
 	public final String[] getPrevResponders() {
@@ -67,6 +66,7 @@
 		return scopes;
 	}
 
+	@Override
 	public final String getHeaderString() {
 		final StringBuffer buffer = new StringBuffer();
 		buffer.append(super.getHeaderString());
@@ -76,10 +76,10 @@
 		buffer.append(Arrays.asList(scopes));
 		return buffer.toString();
 	}
-	
-	public final boolean knowsResponder(String url) {
-		for (int i = 0;i<prevResponders.length;i++){
-			if (prevResponders[i].equals(url)){
+
+	public final boolean knowsResponder(final String url) {
+		for (int i = 0; i < prevResponders.length; i++) {
+			if (prevResponders[i].equals(url)) {
 				return true;
 			}
 		}

Modified: directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/AttributeReplyMessage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/AttributeReplyMessage.java?rev=782980&r1=782979&r2=782980&view=diff
==============================================================================
--- directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/AttributeReplyMessage.java (original)
+++ directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/AttributeReplyMessage.java Tue Jun  9 12:50:45 2009
@@ -19,7 +19,6 @@
  */
 package org.apache.directory.slp.messages;
 
-
 import java.io.ByteArrayOutputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
@@ -27,11 +26,10 @@
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.directory.slp.*;
+import org.apache.directory.slp.ServiceLocationException;
 import org.apache.directory.slp.impl.AuthenticationBlock;
 import org.apache.directory.slp.impl.SLPUtils;
 
-
 /**
  * abstract base class for all reply messages.
  * 
@@ -46,9 +44,9 @@
 
 	public static final String TYPE = "ATTRRPLY";
 
-	private String[] attributes = new String[]{};
+	private String[] attributes = new String[] {};
 
-	private AuthenticationBlock[] authBlocks = new AuthenticationBlock[]{};
+	private AuthenticationBlock[] authBlocks = new AuthenticationBlock[] {};
 
 	public AttributeReplyMessage() {
 		super(FUNC_ID);
@@ -87,8 +85,9 @@
 		return false;
 	}
 
+	@Override
 	public String toString() {
-		StringBuffer buffer = new StringBuffer();
+		final StringBuffer buffer = new StringBuffer();
 		buffer.append(TYPE);
 		buffer.append(" [");
 		buffer.append(getHeaderString());
@@ -97,21 +96,23 @@
 		buffer.append("]");
 		return buffer.toString();
 	}
-	
+
 	/**
 	 * get the length of the message.
 	 * 
 	 * @return the length of the message.
 	 * @see org.apache.directory.server.slp.messages.AbstractSLPMessage#getSize()
 	 */
+	@Override
 	public int getSize() {
-		int len = getHeaderSize() + 4 + arrayToString(attributes, ",").length() + 1;
-		for (int i=0; i<authBlocks.length; i++) {
+		int len = getHeaderSize() + 4 + arrayToString(attributes, ",").length()
+				+ 1;
+		for (int i = 0; i < authBlocks.length; i++) {
 			len += authBlocks[i].getLength();
 		}
 		return len;
 	}
-	
+
 	/**
 	 * get the bytes of the message body in the following RFC 2608 compliant
 	 * format:
@@ -129,38 +130,44 @@
 	 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 	 *   |# of AttrAuths |  Attribute Authentication Block (if present)  \
 	 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-	 * </pre>.
+	 * </pre>
+	 * 
+	 * .
 	 * </p>
 	 * 
 	 * @return array of bytes.
 	 * @throws ServiceLocationException
 	 *             if an IO Exception occurs.
-	 * @throws IOException 
+	 * @throws IOException
 	 */
-	public void writeTo(final DataOutputStream out, final int mtu) throws IOException {
-		super.writeHeader(out, getSize(),mtu);
-			out.writeShort(getErrorCode());
-			out.writeUTF(arrayToString(attributes, ","));
-			out.write(authBlocks.length);
-			for (int i = 0; i < authBlocks.length; i++) {
-				authBlocks[i].write(out);
-			}
+	@Override
+	public void writeTo(final DataOutputStream out, final int mtu)
+			throws IOException {
+		super.writeHeader(out, getSize(), mtu);
+		out.writeShort(getErrorCode());
+		out.writeUTF(arrayToString(attributes, ","));
+		out.write(authBlocks.length);
+		for (int i = 0; i < authBlocks.length; i++) {
+			authBlocks[i].write(out);
+		}
 	}
-	
+
 	/**
 	 * get the result.
 	 * 
 	 * @see ch.ethz.iks.slp.impl.ReplyMessage#getResult()
 	 * @return the <code>List</code> of results.
 	 */
+	@Override
 	public String[] getResult() {
 		return attributes;
 	}
-	
-	public List<String> getResultAsList(){
+
+	@Override
+	public List<String> getResultAsList() {
 		return AbstractSLPMessage.arrayToList(attributes);
 	}
-	
+
 	/**
 	 * sign this AttributeReply.
 	 * 
@@ -170,28 +177,28 @@
 	 *             in case of IO errors.
 	 */
 	public void sign(final String spiStr) throws ServiceLocationException {
-		List spiList = stringToList(spiStr, ",");
+		final List spiList = stringToList(spiStr, ",");
 		authBlocks = new AuthenticationBlock[spiList.size()];
 		for (int k = 0; k < spiList.size(); k++) {
-			int timestamp = SLPUtils.getTimestamp();
+			final int timestamp = SLPUtils.getTimestamp();
 
-			String spi = (String) spiList.get(k);
-			byte[] data = getAuthData(spi, timestamp);
+			final String spi = (String) spiList.get(k);
+			final byte[] data = getAuthData(spi, timestamp);
 			byte[] sig;
 			try {
-				sig = AuthenticationBlock.sign(spi,data);
-			} catch (Exception e) {
-				//SLPCore.platform.logError(e.getMessage(), e.fillInStackTrace());
+				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);
+
+			authBlocks[k] = new AuthenticationBlock(timestamp, spi, sig);
 		}
 	}
-	
+
 	/**
 	 * get the authentication data.
 	 * 
@@ -206,40 +213,38 @@
 	private byte[] getAuthData(final String spiStr, final int timestamp)
 			throws ServiceLocationException {
 		try {
-			ByteArrayOutputStream bos = new ByteArrayOutputStream();
-			DataOutputStream dos = new DataOutputStream(bos);
+			final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+			final DataOutputStream dos = new DataOutputStream(bos);
 			dos.writeUTF(spiStr);
 			dos.writeUTF(arrayToString(attributes, ","));
 			dos.writeInt(timestamp);
 			return bos.toByteArray();
-		} catch (IOException ioe) {
+		} catch (final IOException ioe) {
 			throw new ServiceLocationException(
 					ServiceLocationException.INTERNAL_SYSTEM_ERROR, ioe
 							.getMessage());
 		}
 	}
 
-	
-	private String[] fixAttributeArray(String[] attr){
-    	List<String> fixedAttrs = new ArrayList<String>();
-    	String combined = "";
-    	for (String s: attr){
-    		if (s.toLowerCase().trim().startsWith("(")){
-    			if (s.trim().endsWith(")")){
-    				fixedAttrs.add(s);
-    				continue;
-    			}
-    			combined = s;
-    		} else {
-    			if (s.trim().endsWith(")")){
-    				fixedAttrs.add(combined+", "+s.trim());
-    				continue;
-    			}
-    			combined = combined+","+s.trim();
-    		}
-    	}
-    	return fixedAttrs.toArray(new String[]{});
-    }
-	
+	private String[] fixAttributeArray(final String[] attr) {
+		final List<String> fixedAttrs = new ArrayList<String>();
+		String combined = "";
+		for (final String s : attr) {
+			if (s.toLowerCase().trim().startsWith("(")) {
+				if (s.trim().endsWith(")")) {
+					fixedAttrs.add(s);
+					continue;
+				}
+				combined = s;
+			} else {
+				if (s.trim().endsWith(")")) {
+					fixedAttrs.add(combined + ", " + s.trim());
+					continue;
+				}
+				combined = combined + "," + s.trim();
+			}
+		}
+		return fixedAttrs.toArray(new String[] {});
+	}
 
 }

Modified: directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/AttributeRequestMessage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/AttributeRequestMessage.java?rev=782980&r1=782979&r2=782980&view=diff
==============================================================================
--- directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/AttributeRequestMessage.java (original)
+++ directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/AttributeRequestMessage.java Tue Jun  9 12:50:45 2009
@@ -26,8 +26,6 @@
 import org.apache.directory.slp.ServiceLocationException;
 import org.apache.directory.slp.ServiceURL;
 
-
-
 /**
  * Attribute request message (ATTRRQST).
  * 
@@ -47,7 +45,6 @@
 	private String[] tags = EMPTY;
 
 	private String[] spis = EMPTY;
-	
 
 	public AttributeRequestMessage() {
 		super(FUNC_ID);
@@ -77,8 +74,9 @@
 		return spis;
 	}
 
+	@Override
 	public String toString() {
-		StringBuffer buffer = new StringBuffer();
+		final StringBuffer buffer = new StringBuffer();
 		buffer.append(TYPE);
 		buffer.append(" [");
 		buffer.append(getHeaderString());
@@ -88,19 +86,23 @@
 		buffer.append("]");
 		return buffer.toString();
 	}
-	
+
 	/**
 	 * get the length of the message.
 	 * 
 	 * @return the length of the message.
 	 * @see org.apache.directory.server.slp.messages.AbstractSLPMessage#getSize()
 	 */
+	@Override
 	public int getSize() {
-		return getHeaderSize() + 2 + arrayToString(prevResponders, ",").length()
-		+ 2 + url.getURL().length() + 2 + arrayToString(scopes, ",").length()
-		+ 2 + arrayToString(tags, ",").length() + 2 + arrayToString(spis,",").length();
+		return getHeaderSize() + 2
+				+ arrayToString(prevResponders, ",").length() + 2
+				+ url.getURL().length() + 2
+				+ arrayToString(scopes, ",").length() + 2
+				+ arrayToString(tags, ",").length() + 2
+				+ arrayToString(spis, ",").length();
 	}
-	
+
 	/**
 	 * get the bytes of the message body in the following RFC 2608 compliant
 	 * format:
@@ -122,7 +124,9 @@
 	 *        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 	 *        |   length of &lt;SLP SPI&gt; string  |        &lt;SLP SPI&gt; string       \
 	 *        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-	 * </pre>.
+	 * </pre>
+	 * 
+	 * .
 	 * </p>
 	 * 
 	 * @return array of bytes.
@@ -130,14 +134,15 @@
 	 * @throws ServiceLocationException
 	 *             if an IO Exception occurs.
 	 */
-	public void writeTo(final DataOutputStream out, final int mtu) throws IOException {
-		super.writeHeader(out, getSize(),mtu);
+	@Override
+	public void writeTo(final DataOutputStream out, final int mtu)
+			throws IOException {
+		super.writeHeader(out, getSize(), mtu);
 		out.writeUTF(arrayToString(prevResponders, ","));
 		out.writeUTF(url.toString());
 		out.writeUTF(arrayToString(scopes, ","));
 		out.writeUTF(arrayToString(tags, ","));
-		out.writeUTF(arrayToString(spis,","));
+		out.writeUTF(arrayToString(spis, ","));
 	}
 
-
 }

Modified: directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/DAAdvertisementMessage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/DAAdvertisementMessage.java?rev=782980&r1=782979&r2=782980&view=diff
==============================================================================
--- directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/DAAdvertisementMessage.java (original)
+++ directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/DAAdvertisementMessage.java Tue Jun  9 12:50:45 2009
@@ -30,8 +30,6 @@
 import org.apache.directory.slp.impl.AuthenticationBlock;
 import org.apache.directory.slp.impl.SLPUtils;
 
-
-
 /**
  * Directory Agent Advertisement Message (DAADVERT).
  * 
@@ -49,7 +47,7 @@
 	private int bootTimestamp;
 
 	private ServiceURL serviceURL;
-	
+
 	// For verification
 	private String origURL;
 
@@ -63,22 +61,22 @@
 
 	public DAAdvertisementMessage() {
 		super(FUNC_ID);
-		scopes=new String[]{"default"};
+		scopes = new String[] { "default" };
 	}
 
-	public void setStatelessBootTimestamp(int bootTimestamp) {
+	public void setStatelessBootTimestamp(final int bootTimestamp) {
 		this.bootTimestamp = bootTimestamp;
 	}
 
 	public int getStatelessBootTimestamp() {
 		return bootTimestamp;
 	}
-	
-	public void setOrigURL(String s){
-		origURL=s;
+
+	public void setOrigURL(final String s) {
+		origURL = s;
 	}
 
-	public void setServiceURL(ServiceURL serviceURL) {
+	public void setServiceURL(final ServiceURL serviceURL) {
 		this.serviceURL = serviceURL;
 	}
 
@@ -86,7 +84,7 @@
 		return serviceURL;
 	}
 
-	public void setScopes(String[] scopes) {
+	public void setScopes(final String[] scopes) {
 		this.scopes = scopes;
 	}
 
@@ -94,7 +92,7 @@
 		return scopes;
 	}
 
-	public void setAttributes(String[] attributes) {
+	public void setAttributes(final String[] attributes) {
 		this.attributes = attributes;
 	}
 
@@ -102,7 +100,7 @@
 		return attributes;
 	}
 
-	public void setSPIs(String[] spis) {
+	public void setSPIs(final String[] spis) {
 		this.spis = spis;
 	}
 
@@ -110,7 +108,7 @@
 		return spis;
 	}
 
-	public void setAuthBlocks(AuthenticationBlock[] authBlocks) {
+	public void setAuthBlocks(final AuthenticationBlock[] authBlocks) {
 		this.authBlocks = authBlocks;
 	}
 
@@ -118,8 +116,9 @@
 		return authBlocks;
 	}
 
+	@Override
 	public String toString() {
-		StringBuffer buffer = new StringBuffer();
+		final StringBuffer buffer = new StringBuffer();
 		buffer.append(TYPE);
 		buffer.append(" [");
 		buffer.append(getHeaderString());
@@ -133,24 +132,25 @@
 		buffer.append("]");
 		return buffer.toString();
 	}
-	
-	
+
 	/**
 	 * get the length of the message.
 	 * 
 	 * @return the length of the message.
 	 * @see org.apache.directory.server.slp.messages.AbstractSLPMessage#getSize()
 	 */
+	@Override
 	public int getSize() {
 		int len = getHeaderSize() + 8 + serviceURL.getURL().length() + 2
-				+ arrayToString(scopes,",").length() + 2 + arrayToString(attributes,",").length() + 2
-				+ arrayToString(spis,",").length() + 1;
+				+ arrayToString(scopes, ",").length() + 2
+				+ arrayToString(attributes, ",").length() + 2
+				+ arrayToString(spis, ",").length() + 1;
 		for (int i = 0; i < authBlocks.length; i++) {
 			len += authBlocks[i].getLength();
 		}
 		return len;
 	}
-	
+
 	/**
 	 * get the bytes of the message body in the following RFC 2608 compliant
 	 * format:
@@ -176,34 +176,39 @@
 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 	 * | # Auth Blocks |         Authentication block (if any)         \
 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-	 * </pre>.
+	 * </pre>
+	 * 
+	 * .
 	 * </p>
 	 * 
 	 * @return array of bytes.
 	 * @throws ServiceLocationException
 	 *             if an IO Exception occurs.
 	 */
-	public void writeTo(final DataOutputStream out, final int mtu) throws IOException {
+	@Override
+	public void writeTo(final DataOutputStream out, final int mtu)
+			throws IOException {
 		// this is never sent, since we are not a DA...
 	}
-	
 
+	@Override
 	public String[] getResult() {
-		if (origURL.equals("") || origURL==null){
-			return new String[]{serviceURL.toString()};
+		if (origURL.equals("") || origURL == null) {
+			return new String[] { serviceURL.toString() };
 		}
-		return new String[]{origURL};
+		return new String[] { origURL };
 	}
-	
-	public List<String> getResultAsList(){
-		if (origURL.equals("") || origURL==null){
-			return AbstractSLPMessage.arrayToList(new String[]{serviceURL.toString()});
+
+	@Override
+	public List<String> getResultAsList() {
+		if (origURL.equals("") || origURL == null) {
+			return AbstractSLPMessage.arrayToList(new String[] { serviceURL
+					.toString() });
 		}
-		
-		return AbstractSLPMessage.arrayToList(new String[]{origURL});
+
+		return AbstractSLPMessage.arrayToList(new String[] { origURL });
 	}
-	
-	
+
 	/**
 	 * verify the DAAdvertisement.
 	 * 
@@ -220,9 +225,7 @@
 		}
 		return false;
 	}
-	
-	
-	
+
 	/**
 	 * get the authentication data.
 	 * 
@@ -237,8 +240,8 @@
 	private byte[] getAuthData(final String spiStr, final int timestamp)
 			throws ServiceLocationException {
 		try {
-			ByteArrayOutputStream bos = new ByteArrayOutputStream();
-			DataOutputStream dos = new DataOutputStream(bos);
+			final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+			final DataOutputStream dos = new DataOutputStream(bos);
 
 			dos.writeUTF(spiStr);
 			dos.writeInt(bootTimestamp);
@@ -250,18 +253,18 @@
 			 * see bug #1346056
 			 */
 			dos.writeUTF(arrayToString(scopes, ","));
-			dos.writeUTF(arrayToString(attributes,","));
+			dos.writeUTF(arrayToString(attributes, ","));
 			dos.writeUTF(arrayToString(spis, ","));
 			dos.writeInt(timestamp);
 
 			return bos.toByteArray();
-		} catch (IOException ioe) {
+		} catch (final IOException ioe) {
 			throw new ServiceLocationException(
 					ServiceLocationException.INTERNAL_SYSTEM_ERROR, ioe
 							.getMessage());
 		}
 	}
-	
+
 	/**
 	 * sign this DAAdvert.
 	 * 
@@ -271,30 +274,26 @@
 	 *             in case of IO errors.
 	 */
 	public void sign(final String spiStr) throws ServiceLocationException {
-		List spiList = stringToList(spiStr, ",");
+		final List spiList = stringToList(spiStr, ",");
 		authBlocks = new AuthenticationBlock[spiList.size()];
 		for (int k = 0; k < spiList.size(); k++) {
-			int timestamp = SLPUtils.getTimestamp();
+			final int timestamp = SLPUtils.getTimestamp();
 
-			String spi = (String) spiList.get(k);
-			byte[] data = getAuthData(spi, timestamp);
+			final String spi = (String) spiList.get(k);
+			final byte[] data = getAuthData(spi, timestamp);
 			byte[] sig;
 			try {
-				sig = AuthenticationBlock.sign(spi,data);
-			} catch (Exception e) {
-				//SLPCore.platform.logError(e.getMessage(), e.fillInStackTrace());
+				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);
+
+			authBlocks[k] = new AuthenticationBlock(timestamp, spi, sig);
 		}
 	}
-	
-	
-
-	
 
 }

Modified: directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceAcknowledgementMessage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceAcknowledgementMessage.java?rev=782980&r1=782979&r2=782980&view=diff
==============================================================================
--- directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceAcknowledgementMessage.java (original)
+++ directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceAcknowledgementMessage.java Tue Jun  9 12:50:45 2009
@@ -25,7 +25,6 @@
 
 import org.apache.directory.slp.ServiceLocationException;
 
-
 /**
  * Service Acknowledgement Message (SRVACK).
  * 
@@ -34,8 +33,8 @@
 public class ServiceAcknowledgementMessage extends AbstractSLPReplyMessage {
 
 	/**
-	 * the message funcID values according to RFC 2608, Service Acknowledgement =
-	 * 5.
+	 * the message funcID values according to RFC 2608, Service Acknowledgement
+	 * = 5.
 	 */
 	public static final byte FUNC_ID = 5;
 
@@ -45,8 +44,9 @@
 		super(FUNC_ID);
 	}
 
+	@Override
 	public String toString() {
-		StringBuffer buffer = new StringBuffer();
+		final StringBuffer buffer = new StringBuffer();
 		buffer.append(TYPE);
 		buffer.append(" [");
 		buffer.append(getHeaderString());
@@ -54,17 +54,18 @@
 		buffer.append("]");
 		return buffer.toString();
 	}
-	
+
 	/**
 	 * get the length of the message.
 	 * 
 	 * @return the length of the message.
 	 * @see org.apache.directory.server.slp.messages.AbstractSLPMessage#getSize()
 	 */
+	@Override
 	public int getSize() {
 		return getHeaderSize() + 2;
 	}
-	
+
 	/**
 	 * get the bytes of the message body in the following RFC 2608 compliant
 	 * format:
@@ -78,24 +79,30 @@
 	 *      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 	 *      |          Error Code           |
 	 *      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-	 * </pre>.
+	 * </pre>
+	 * 
+	 * .
 	 * </p>
 	 * 
 	 * @return array of bytes.
 	 * @throws ServiceLocationException
 	 *             if an IO Exception occurs.
 	 */
-	public void writeTo(final DataOutputStream out, final int mtu) throws IOException {
-		super.writeHeader(out, getSize(),mtu);
+	@Override
+	public void writeTo(final DataOutputStream out, final int mtu)
+			throws IOException {
+		super.writeHeader(out, getSize(), mtu);
 		out.writeShort(getErrorCode());
 	}
-	
+
+	@Override
 	public String[] getResult() {
 		return null;
 	}
-	
-	public List<String> getResultAsList(){
-		
+
+	@Override
+	public List<String> getResultAsList() {
+
 		return null;
 	}
 

Modified: directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceDeregistrationMessage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceDeregistrationMessage.java?rev=782980&r1=782979&r2=782980&view=diff
==============================================================================
--- directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceDeregistrationMessage.java (original)
+++ directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceDeregistrationMessage.java Tue Jun  9 12:50:45 2009
@@ -29,7 +29,6 @@
 import org.apache.directory.slp.impl.SLPCore;
 import org.apache.directory.slp.impl.SLPUtils;
 
-
 /**
  * Service Derigistration Message (SRVDEREG).
  * 
@@ -57,17 +56,17 @@
 	}
 
 	public void setScopes(final String[] scopes) {
-		if (scopes!=null){
+		if (scopes != null) {
 			this.scopes = scopes;
 		}
-		
+
 	}
 
 	public String[] getScopes() {
 		return scopes;
 	}
 
-	public void setServiceURL(ServiceURL url) {
+	public void setServiceURL(final ServiceURL url) {
 		this.url = url;
 	}
 
@@ -75,7 +74,7 @@
 		return url;
 	}
 
-	public void setTags(String[] tags) {
+	public void setTags(final String[] tags) {
 		this.tags = tags;
 	}
 
@@ -83,8 +82,9 @@
 		return tags;
 	}
 
+	@Override
 	public String toString() {
-		StringBuffer buffer = new StringBuffer();
+		final StringBuffer buffer = new StringBuffer();
 		buffer.append(TYPE);
 		buffer.append(" [");
 		buffer.append(getHeaderString());
@@ -94,19 +94,19 @@
 		buffer.append("]");
 		return buffer.toString();
 	}
-	
+
 	/**
 	 * get the length of the message.
 	 * 
 	 * @return the length of the message.
 	 * @see org.apache.directory.server.slp.messages.AbstractSLPMessage#getSize()
 	 */
+	@Override
 	public int getSize() {
 		return getHeaderSize() + 2 + arrayToString(scopes, ",").length()
-				+ url.getLength() + 2
-				+ arrayToString(tags, ",").length();
+				+ url.getLength() + 2 + arrayToString(tags, ",").length();
 	}
-	
+
 	/**
 	 * get the bytes from a ServiceDeregistration:
 	 * <p>
@@ -123,20 +123,24 @@
 	 *         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 	 *         |      Length of &lt;tag-list&gt;     |            &lt;tag-list&gt;         \
 	 *         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-	 * </pre>.
+	 * </pre>
+	 * 
+	 * .
 	 * </p>
 	 * 
 	 * @return the bytes.
 	 * @throws ServiceLocationException
 	 *             in case of IO errors.
 	 */
-	public void writeTo(final DataOutputStream out, final int mtu) throws IOException {
-		super.writeHeader(out, getSize(),mtu);
+	@Override
+	public void writeTo(final DataOutputStream out, final int mtu)
+			throws IOException {
+		super.writeHeader(out, getSize(), mtu);
 		out.writeUTF(arrayToString(scopes, ","));
 		url.writeTo(out);
 		out.writeUTF(arrayToString(tags, ","));
 	}
-	
+
 	/**
 	 * sign this ServiceDeregistration.
 	 * 
@@ -148,7 +152,7 @@
 	public void sign(final List spiList) throws ServiceLocationException {
 		url.sign(spiList);
 	}
-	
+
 	/**
 	 * verify the ServiceDeregistration.
 	 * 
@@ -160,10 +164,12 @@
 		try {
 			url.verify();
 			return true;
-		} catch (Exception e){
-			throw new ServiceLocationException(ServiceLocationException.AUTHENTICATION_FAILED,e.getMessage());
+		} catch (final Exception e) {
+			throw new ServiceLocationException(
+					ServiceLocationException.AUTHENTICATION_FAILED, e
+							.getMessage());
 		}
-		
+
 	}
 
 }

Modified: directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceRegistrationMessage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceRegistrationMessage.java?rev=782980&r1=782979&r2=782980&view=diff
==============================================================================
--- directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceRegistrationMessage.java (original)
+++ directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceRegistrationMessage.java Tue Jun  9 12:50:45 2009
@@ -34,9 +34,6 @@
 import org.apache.directory.slp.impl.SLPCore;
 import org.apache.directory.slp.impl.SLPUtils;
 
-
-
-
 /**
  * Service Registration Message (SRVREG)
  * 
@@ -51,7 +48,7 @@
 	public static final byte FUNC_ID = 3;
 
 	public static final String TYPE = "SRVREG";
-	
+
 	private ServiceURL serviceURL;
 
 	private ServiceType serviceType;
@@ -59,7 +56,7 @@
 	private String[] scopes = EMPTY;
 
 	private String[] attrList = EMPTY;
-	
+
 	private String verbatimAttrList = "";
 
 	private AuthenticationBlock[] authBlocks;
@@ -90,10 +87,10 @@
 	}
 
 	public void setScopes(final String[] scopes) {
-		if (scopes!=null){
+		if (scopes != null) {
 			this.scopes = scopes;
 		}
-		
+
 	}
 
 	public String[] getAttrList() {
@@ -103,14 +100,14 @@
 	public void setAttrList(final String[] attrList) {
 		this.attrList = attrList;
 	}
-	
-	public void setAttributes(final String verbatim){
+
+	public void setAttributes(final String verbatim) {
 		verbatimAttrList = verbatim;
 		attrList = makeAttributeArray(verbatim);
-		
+
 	}
-	
-	public String getVerbatimAttributeList(){
+
+	public String getVerbatimAttributeList() {
 		return verbatimAttrList;
 	}
 
@@ -122,9 +119,6 @@
 		return authBlocks;
 	}
 
-	
-	
-
 	/**
 	 * sign this ServiceRegistration.
 	 * 
@@ -138,23 +132,22 @@
 
 		authBlocks = new AuthenticationBlock[spis.length];
 		for (int k = 0; k < spis.length; k++) {
-			int timestamp = SLPUtils.getTimestamp();
+			final int timestamp = SLPUtils.getTimestamp();
 
-			String spi = (String) spis[k];
-			
-			byte[] data = getAuthData(spi, timestamp);
+			final String spi = spis[k];
+
+			final byte[] data = getAuthData(spi, timestamp);
 			byte[] sig;
 			try {
-				sig = AuthenticationBlock.sign(spi,data);
-			} catch (Exception e) {
-				//SLPCore.platform.logError(e.getMessage(), e.fillInStackTrace());
+				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);
-				
-				
+			authBlocks[k] = new AuthenticationBlock(timestamp, spi, sig);
 
 		}
 	}
@@ -176,10 +169,8 @@
 		}
 		return false;
 	}
-	
-	
-	
 
+	@Override
 	public String toString() {
 		final StringBuffer buffer = new StringBuffer();
 		buffer.append(TYPE);
@@ -193,26 +184,27 @@
 		buffer.append("]");
 		return buffer.toString();
 	}
-	
+
 	/**
 	 * get the length of the message.
 	 * 
 	 * @return the length of the message.
 	 * @see org.apache.directory.server.slp.messages.AbstractSLPMessage#getSize()
 	 */
+	@Override
 	public int getSize() {
 		int len = getHeaderSize() + serviceURL.getLength() + 2
 				+ serviceType.toString().length() + 2
 				+ arrayToString(scopes, ",").length() + 2
 				+ arrayToString(attrList, ",").length() + 1;
-		if (authBlocks!=null){
+		if (authBlocks != null) {
 			for (int i = 0; i < authBlocks.length; i++) {
 				len += authBlocks[i].getLength();
 			}
 		}
 		return len;
 	}
-	
+
 	/**
 	 * get the bytes of the message body in the following RFC 2608 compliant
 	 * format:
@@ -234,15 +226,19 @@
 	 *        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 	 *        |# of AttrAuths |(if present) Attribute Authentication Blocks...\
 	 *        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-	 * </pre>.
+	 * </pre>
+	 * 
+	 * .
 	 * </p>
 	 * 
 	 * @return array of bytes.
 	 * @throws ServiceLocationException
 	 *             if an IO Exception occurs.
 	 */
-	public void writeTo(final DataOutputStream out, final int mtu) throws IOException {
-		super.writeHeader(out, getSize(),mtu);
+	@Override
+	public void writeTo(final DataOutputStream out, final int mtu)
+			throws IOException {
+		super.writeHeader(out, getSize(), mtu);
 		serviceURL.writeTo(out);
 		out.writeUTF(serviceType.toString());
 		out.writeUTF(arrayToString(scopes, ","));
@@ -251,10 +247,9 @@
 		for (int i = 0; i < authBlocks.length; i++) {
 			authBlocks[i].write(out);
 		}
-		
-		
+
 	}
-	
+
 	/**
 	 * get the authentication data.
 	 * 
@@ -269,90 +264,86 @@
 	private byte[] getAuthData(final String spi, final int timestamp)
 			throws ServiceLocationException {
 		try {
-			ByteArrayOutputStream bos = new ByteArrayOutputStream();
-			DataOutputStream dos = new DataOutputStream(bos);
+			final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+			final DataOutputStream dos = new DataOutputStream(bos);
 
 			dos.writeUTF(spi);
 			dos.writeUTF(arrayToString(attrList, ","));
 			dos.writeInt(timestamp);
 			return bos.toByteArray();
-		} catch (IOException ioe) {
+		} catch (final IOException ioe) {
 			throw new ServiceLocationException(
 					ServiceLocationException.INTERNAL_SYSTEM_ERROR, ioe
 							.getMessage());
 		}
 	}
-	
-	
-	
-	
-	public boolean checkAttributeListValidity(){
+
+	public boolean checkAttributeListValidity() {
 		boolean valid = true;
 		int pos = 0;
 		String initialType;
 		String type;
-		for (String s : attrList){
+		for (final String s : attrList) {
 			pos = s.indexOf("=");
-			if (pos<0){
+			if (pos < 0) {
 				// it's just a keyword
 				continue;
 			}
-			String value = s.substring(pos+1,s.length()-1);
-			StringTokenizer tokenizer = new StringTokenizer(value,",");
-			if (tokenizer.countTokens()==1){
-				//single-valued, no worries
+			final String value = s.substring(pos + 1, s.length() - 1);
+			final StringTokenizer tokenizer = new StringTokenizer(value, ",");
+			if (tokenizer.countTokens() == 1) {
+				// single-valued, no worries
 				continue;
 			}
 			initialType = "";
-			while (tokenizer.hasMoreTokens()){
-				type="";
-				String token = tokenizer.nextToken().trim();
-				if (token.startsWith("\\FF")){
+			while (tokenizer.hasMoreTokens()) {
+				type = "";
+				final String token = tokenizer.nextToken().trim();
+				if (token.startsWith("\\FF")) {
 					type = "opaque";
-				} else if (token.toLowerCase().trim().equals("true") || token.toLowerCase().trim().equals("false") ){ 
-					type="boolean";
+				} else if (token.toLowerCase().trim().equals("true")
+						|| token.toLowerCase().trim().equals("false")) {
+					type = "boolean";
 				} else {
 					try {
 						Integer.parseInt(token.trim());
 						type = "integer";
-					} catch (NumberFormatException e){
-						type= "string";
+					} catch (final NumberFormatException e) {
+						type = "string";
 					}
 				}
-				if (initialType.equals("")){
-					//first round
+				if (initialType.equals("")) {
+					// first round
 					initialType = type;
 					continue;
 				}
-				if (!type.equals(initialType)){
+				if (!type.equals(initialType)) {
 					valid = false;
 				}
 			}
 		}
 		return valid;
 	}
-	
-	
-	private String[] makeAttributeArray(String attrString){
-    	List<String> fixedAttrs = new ArrayList<String>();
-    	String combined = "";
-    	for (String s: SLPUtils.stringToStringArray(attrString, ",")){
-    		if (s.toLowerCase().trim().startsWith("(")){
-    			if (s.trim().endsWith(")")){
-    				fixedAttrs.add(s);
-    				continue;
-    			}
-    			combined = s;
-    		} else {
-    			if (s.trim().endsWith(")")){
-    				fixedAttrs.add(combined+", "+s.trim());
-    				continue;
-    			}
-    			combined = combined+","+s.trim();
-    		}
-    	}
-    	return fixedAttrs.toArray(new String[]{});
-    }
-	
-	
+
+	private String[] makeAttributeArray(final String attrString) {
+		final List<String> fixedAttrs = new ArrayList<String>();
+		String combined = "";
+		for (final String s : SLPUtils.stringToStringArray(attrString, ",")) {
+			if (s.toLowerCase().trim().startsWith("(")) {
+				if (s.trim().endsWith(")")) {
+					fixedAttrs.add(s);
+					continue;
+				}
+				combined = s;
+			} else {
+				if (s.trim().endsWith(")")) {
+					fixedAttrs.add(combined + ", " + s.trim());
+					continue;
+				}
+				combined = combined + "," + s.trim();
+			}
+		}
+		return fixedAttrs.toArray(new String[] {});
+	}
+
 }

Modified: directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceReplyMessage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceReplyMessage.java?rev=782980&r1=782979&r2=782980&view=diff
==============================================================================
--- directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceReplyMessage.java (original)
+++ directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceReplyMessage.java Tue Jun  9 12:50:45 2009
@@ -28,8 +28,6 @@
 import org.apache.directory.slp.ServiceLocationException;
 import org.apache.directory.slp.ServiceURL;
 
-
-
 /**
  * Service Reply Message (SRVRPLY).
  * 
@@ -50,7 +48,7 @@
 		super(FUNC_ID);
 	}
 
-	public void setServiceURLs(ServiceURL[] serviceURLs) {
+	public void setServiceURLs(final ServiceURL[] serviceURLs) {
 		this.serviceURLs = serviceURLs;
 	}
 
@@ -58,6 +56,7 @@
 		return serviceURLs;
 	}
 
+	@Override
 	public String toString() {
 		final StringBuffer buffer = new StringBuffer();
 		buffer.append(TYPE);
@@ -67,13 +66,14 @@
 		buffer.append(Arrays.asList(serviceURLs));
 		return buffer.toString();
 	}
-	
+
 	/**
 	 * get the length of the message.
 	 * 
 	 * @return the length of the message.
 	 * @see org.apache.directory.server.slp.messages.AbstractSLPMessage#getSize()
 	 */
+	@Override
 	public int getSize() {
 		int len = getHeaderSize() + 2 + 2;
 		for (int i = 0; i < serviceURLs.length; i++) {
@@ -81,7 +81,7 @@
 		}
 		return len;
 	}
-	
+
 	/**
 	 * get the bytes of the message body in the following RFC 2608 compliant
 	 * format:
@@ -106,35 +106,35 @@
 	 * @throws ServiceLocationException
 	 *             if an IO Exception occurs.
 	 */
-	public void writeTo(final DataOutputStream out, final int mtu) throws IOException {
-		super.writeHeader(out, getSize(),mtu);
+	@Override
+	public void writeTo(final DataOutputStream out, final int mtu)
+			throws IOException {
+		super.writeHeader(out, getSize(), mtu);
 		out.writeShort(getErrorCode());
 		out.writeShort(serviceURLs.length);
 		for (int i = 0; i < serviceURLs.length; i++) {
-			((ServiceURL) serviceURLs[i]).writeTo(out);
+			(serviceURLs[i]).writeTo(out);
 		}
 	}
-	
+
+	@Override
 	public String[] getResult() {
-		String[] res = new String[serviceURLs.length];
-		for (int i=0;i<serviceURLs.length;i++){
-			res[i]=serviceURLs[i].getURL();
+		final String[] res = new String[serviceURLs.length];
+		for (int i = 0; i < serviceURLs.length; i++) {
+			res[i] = serviceURLs[i].getURL();
 		}
 		return res;
 	}
-	
-	
-	public List<String> getResultAsList(){
-		List<String> result = new ArrayList<String>();
-		for (int i=0;i<serviceURLs.length;i++){
+
+	@Override
+	public List<String> getResultAsList() {
+		final List<String> result = new ArrayList<String>();
+		for (int i = 0; i < serviceURLs.length; i++) {
 			result.add(serviceURLs[i].toString());
 		}
 		return result;
 	}
-	
-	
-	
-	
+
 	/**
 	 * sign the ServiceReply.
 	 * 
@@ -144,16 +144,16 @@
 	 *             in case of IO errors.
 	 */
 	public void sign(final String spiStr) throws ServiceLocationException {
-		List spiList = stringToList(spiStr, ",");
-		for (int i=0;i<serviceURLs.length;i++) {
-			ServiceURL url = serviceURLs[i];
+		final List spiList = stringToList(spiStr, ",");
+		for (int i = 0; i < serviceURLs.length; i++) {
+			final ServiceURL url = serviceURLs[i];
 			url.sign(spiList);
 		}
-		for (int i=0;i<extensions.length;i++){
+		for (int i = 0; i < extensions.length; i++) {
 			extensions[i].sign(spiStr);
 		}
 	}
-	
+
 	/**
 	 * verify the ServiceReply.
 	 * 
@@ -162,8 +162,8 @@
 	 *             in case of IO errors.
 	 */
 	public boolean verify() throws ServiceLocationException {
-		for (int i = 0; i<serviceURLs.length;i++) {
-			ServiceURL url = serviceURLs[i];
+		for (int i = 0; i < serviceURLs.length; i++) {
+			final ServiceURL url = serviceURLs[i];
 			url.verify();
 		}
 		return true;

Modified: directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceRequestMessage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceRequestMessage.java?rev=782980&r1=782979&r2=782980&view=diff
==============================================================================
--- directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceRequestMessage.java (original)
+++ directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceRequestMessage.java Tue Jun  9 12:50:45 2009
@@ -26,7 +26,6 @@
 import org.apache.directory.slp.ServiceLocationException;
 import org.apache.directory.slp.ServiceType;
 
-
 /**
  * Service Request Message (SRVRQST).
  * 
@@ -69,7 +68,7 @@
 		return predicate;
 	}
 
-	public void setSPIs(String[] spis) {
+	public void setSPIs(final String[] spis) {
 		this.spis = spis;
 	}
 
@@ -77,8 +76,9 @@
 		return spis;
 	}
 
+	@Override
 	public String toString() {
-		StringBuffer buffer = new StringBuffer();
+		final StringBuffer buffer = new StringBuffer();
 		buffer.append(TYPE);
 		buffer.append(" [");
 		buffer.append(getHeaderString());
@@ -88,21 +88,23 @@
 		buffer.append("]");
 		return buffer.toString();
 	}
-	
+
 	/**
 	 * get the length of the message.
 	 * 
 	 * @return the length of the message.
 	 * @see org.apache.directory.server.slp.messages.AbstractSLPMessage#getSize()
 	 */
+	@Override
 	public int getSize() {
-		return getHeaderSize() + 2 + arrayToString(prevResponders, ",").length()
-				+ 2 + serviceType.toString().length() + 2
+		return getHeaderSize() + 2
+				+ arrayToString(prevResponders, ",").length() + 2
+				+ serviceType.toString().length() + 2
 				+ arrayToString(scopes, ",").length() + 2
 				+ (predicate == null ? 0 : predicate.toString().length()) + 2
 				+ arrayToString(spis, ",").length();
 	}
-	
+
 	/**
 	 * get the bytes of the message body in the following RFC 2608 compliant
 	 * format:
@@ -124,7 +126,9 @@
 	 *        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 	 *        |  length of &lt;SLP SPI&gt; string   |       &lt;SLP SPI&gt; String        \
 	 *        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-	 * </pre>.
+	 * </pre>
+	 * 
+	 * .
 	 * </p>
 	 * 
 	 * @return array of bytes.
@@ -132,13 +136,15 @@
 	 * @throws ServiceLocationException
 	 *             if an IO Exception occurs.
 	 */
-	public void writeTo(final DataOutputStream out, final int mtu) throws IOException {
-		super.writeHeader(out, getSize(),mtu);
+	@Override
+	public void writeTo(final DataOutputStream out, final int mtu)
+			throws IOException {
+		super.writeHeader(out, getSize(), mtu);
 		out.writeUTF(arrayToString(prevResponders, ","));
 		out.writeUTF(serviceType.toString());
 		out.writeUTF(arrayToString(scopes, ","));
 		out.writeUTF(predicate == null ? "" : predicate.toString());
-		out.writeUTF(arrayToString(spis,","));
+		out.writeUTF(arrayToString(spis, ","));
 	}
 
 }

Modified: directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceTypeReplyMessage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceTypeReplyMessage.java?rev=782980&r1=782979&r2=782980&view=diff
==============================================================================
--- directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceTypeReplyMessage.java (original)
+++ directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceTypeReplyMessage.java Tue Jun  9 12:50:45 2009
@@ -28,7 +28,6 @@
 import org.apache.directory.slp.ServiceLocationException;
 import org.apache.directory.slp.ServiceType;
 
-
 /**
  * Service Type Reply Message (SRVTYPEREPLY)
  * 
@@ -49,7 +48,7 @@
 		super(FUNC_ID);
 	}
 
-	public void setServiceTypes(ServiceType[] serviceTypes) {
+	public void setServiceTypes(final ServiceType[] serviceTypes) {
 		this.serviceTypes = serviceTypes;
 	}
 
@@ -57,8 +56,9 @@
 		return serviceTypes;
 	}
 
+	@Override
 	public String toString() {
-		StringBuffer buffer = new StringBuffer();
+		final StringBuffer buffer = new StringBuffer();
 		buffer.append(TYPE);
 		buffer.append(" [");
 		buffer.append(getHeaderString());
@@ -67,22 +67,22 @@
 		buffer.append("]");
 		return buffer.toString();
 	}
-	
+
 	/**
 	 * get the length of the message.
 	 * 
 	 * @return the length of the message.
 	 * @see org.apache.directory.server.slp.messages.AbstractSLPMessage#getSize()
 	 */
+	@Override
 	public int getSize() {
 		int len = 0;
-		for (int i=0;i<serviceTypes.length;i++){
-			len+=serviceTypes[i].toString().length();
+		for (int i = 0; i < serviceTypes.length; i++) {
+			len += serviceTypes[i].toString().length();
 		}
-		return getHeaderSize() + 2 + 2
-				+ len;
+		return getHeaderSize() + 2 + 2 + len;
 	}
-	
+
 	/**
 	 * get the bytes of the message body in the following RFC 2608 compliant
 	 * format:
@@ -98,59 +98,67 @@
 	 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 	 *   |                       &lt;srvtype--list&gt;                         \
 	 *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-	 * </pre>.
+	 * </pre>
+	 * 
+	 * .
 	 * </p>
 	 * 
 	 * @return array of bytes.
 	 * @throws ServiceLocationException
 	 *             if an IO Exception occurs.
 	 */
-	public void writeTo(final DataOutputStream out, final int mtu) throws IOException {
-		super.writeHeader(out, getSize(),mtu);
+	@Override
+	public void writeTo(final DataOutputStream out, final int mtu)
+			throws IOException {
+		super.writeHeader(out, getSize(), mtu);
 		out.writeShort(getErrorCode());
-		for (int i=0;i<serviceTypes.length-1;i++){
-			out.writeUTF(serviceTypes[i].toString()+",");
+		for (int i = 0; i < serviceTypes.length - 1; i++) {
+			out.writeUTF(serviceTypes[i].toString() + ",");
 		}
 		out.writeUTF(serviceTypes[serviceTypes.length].toString());
 	}
-	
+
 	/**
 	 * get the result of the reply message.
 	 * 
 	 * @return the <code>List</code> of results.
 	 * @see ch.ethz.iks.slp.impl.ReplyMessage#getResult()
 	 */
+	@Override
 	public String[] getResult() {
-		String[] res = new String[serviceTypes.length];
-		for (int i=0;i<serviceTypes.length;i++){
-			res[i]=serviceTypes[i].toString();
+		final String[] res = new String[serviceTypes.length];
+		for (int i = 0; i < serviceTypes.length; i++) {
+			res[i] = serviceTypes[i].toString();
 		}
 		return res;
 	}
-	
-	public List<String> getResultAsList(){
-		List<String> result = new ArrayList<String>();
-		for (int i=0;i<serviceTypes.length;i++){
+
+	@Override
+	public List<String> getResultAsList() {
+		final List<String> result = new ArrayList<String>();
+		for (int i = 0; i < serviceTypes.length; i++) {
 			result.add(serviceTypes[i].toString());
 		}
 		return result;
 	}
-	
-	/** 
+
+	/**
 	 * 
-	 * Converts a <code>List</code> of <code>ServiceType</code> objects to an array of such.
+	 * Converts a <code>List</code> of <code>ServiceType</code> objects to an
+	 * array of such.
 	 * 
-	 * @param list The <code>List</code> of <code>ServiceType</code>
+	 * @param list
+	 *            The <code>List</code> of <code>ServiceType</code>
 	 * 
 	 * @return array of <code>ServiceType</code>.
 	 * 
 	 */
-	public static ServiceType[] listToServiceTypeArray(final List list){
-		ServiceType[] result = new ServiceType[list.size()];
-		for (int i=0;i<result.length;i++){
-			result[i]=(ServiceType) list.get(i);
+	public static ServiceType[] listToServiceTypeArray(final List list) {
+		final ServiceType[] result = new ServiceType[list.size()];
+		for (int i = 0; i < result.length; i++) {
+			result[i] = (ServiceType) list.get(i);
 		}
 		return result;
 	}
-	
+
 }

Modified: directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceTypeRequestMessage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceTypeRequestMessage.java?rev=782980&r1=782979&r2=782980&view=diff
==============================================================================
--- directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceTypeRequestMessage.java (original)
+++ directory/sandbox/slp/src/main/java/org/apache/directory/slp/messages/ServiceTypeRequestMessage.java Tue Jun  9 12:50:45 2009
@@ -24,7 +24,6 @@
 
 import org.apache.directory.slp.ServiceLocationException;
 
-
 /**
  * Service Type Request Message (SRVTYPERQST)
  * 
@@ -41,17 +40,16 @@
 	public static final String TYPE = "SRVTYPERQST";
 
 	private String namingAuthority;
-	
-	
+
 	private static final String NA_ALL = "*";
 	private static final String NA_DEFAULT = "";
 
 	public ServiceTypeRequestMessage() {
 		super(FUNC_ID);
-		scopes=new String[]{"default"};
+		scopes = new String[] { "default" };
 	}
 
-	public void setNamingAuthority(String namingAuthority) {
+	public void setNamingAuthority(final String namingAuthority) {
 		this.namingAuthority = namingAuthority;
 	}
 
@@ -59,8 +57,9 @@
 		return namingAuthority;
 	}
 
+	@Override
 	public String toString() {
-		StringBuffer buffer = new StringBuffer();
+		final StringBuffer buffer = new StringBuffer();
 		buffer.append(TYPE);
 		buffer.append(" [");
 		buffer.append(getHeaderString());
@@ -68,17 +67,19 @@
 		buffer.append("]");
 		return buffer.toString();
 	}
-	
+
 	/**
 	 * get the length of the message.
 	 * 
 	 * @return the length of the message.
 	 * @see org.apache.directory.server.slp.messages.AbstractSLPMessage#getSize()
 	 */
+	@Override
 	public int getSize() {
 		int len = getHeaderSize() + 2
 				+ arrayToString(prevResponders, ",").length();
-		if(namingAuthority.equals(NA_DEFAULT) || namingAuthority.equals(NA_ALL)) {
+		if (namingAuthority.equals(NA_DEFAULT)
+				|| namingAuthority.equals(NA_ALL)) {
 			len += 2;
 		} else {
 			len += 2 + namingAuthority.length();
@@ -86,7 +87,7 @@
 		len += 2 + arrayToString(scopes, ",").length();
 		return len;
 	}
-	
+
 	/**
 	 * get the bytes of the message body in the following RFC 2608 compliant
 	 * format:
@@ -104,7 +105,9 @@
 	 *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 	 *  |     length of &lt;scope-list&gt;    |      &lt;scope-list&gt; String      \
 	 *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-	 * </pre>.
+	 * </pre>
+	 * 
+	 * .
 	 * </p>
 	 * 
 	 * @return array of bytes.
@@ -113,8 +116,10 @@
 	 * @throws ServiceLocationException
 	 *             if an IO Exception occurs.
 	 */
-	public void writeTo(final DataOutputStream out, final int mtu) throws IOException {
-		super.writeHeader(out, getSize(),mtu);
+	@Override
+	public void writeTo(final DataOutputStream out, final int mtu)
+			throws IOException {
+		super.writeHeader(out, getSize(), mtu);
 		out.writeUTF(arrayToString(prevResponders, ","));
 		if (namingAuthority.equals(NA_ALL)) {
 			out.writeShort(0xFFFF);



Mime
View raw message