This is an automated email from the ASF dual-hosted git repository. rec pushed a commit to branch refactoring/UIMA-6373-Format-UIMA-Core-Java-SDK-codebase in repository https://gitbox.apache.org/repos/asf/uima-uimaj.git
commit 98207e608ef8a1e8f36b12b5dcb53c516f6ce3a3 Author: Richard Eckart de Castilho <[email protected]> AuthorDate: Thu Feb 10 15:36:22 2022 +0100 [UIMA-6373] Format UIMA Core Java SDK codebase - Auto-format --- .../main/java/org/apache/vinci/debug/Debug.java | 11 +- .../org/apache/vinci/debug/FatalException.java | 2 +- .../org/apache/vinci/transport/BaseClient.java | 246 ++++++++++++------- .../org/apache/vinci/transport/BaseServer.java | 26 +- .../apache/vinci/transport/BaseServerRunnable.java | 7 +- .../java/org/apache/vinci/transport/Frame.java | 34 ++- .../org/apache/vinci/transport/FrameComponent.java | 4 +- .../java/org/apache/vinci/transport/FrameLeaf.java | 29 ++- .../apache/vinci/transport/FrameTransporter.java | 9 +- .../org/apache/vinci/transport/KeyValuePair.java | 6 +- .../apache/vinci/transport/LeafCastException.java | 2 +- .../apache/vinci/transport/PooledVinciClient.java | 84 +++++-- .../vinci/transport/ServiceDownException.java | 2 +- .../vinci/transport/SimpleTransportable.java | 3 +- .../org/apache/vinci/transport/Transportable.java | 6 +- .../org/apache/vinci/transport/VNSException.java | 2 +- .../org/apache/vinci/transport/VinciClient.java | 262 +++++++++++++-------- .../org/apache/vinci/transport/VinciFrame.java | 64 +++-- .../org/apache/vinci/transport/VinciServer.java | 99 +++++--- .../apache/vinci/transport/XTalkTransporter.java | 205 ++++++++++------ .../vinci/transport/context/VinciContext.java | 206 ++++++++++------ .../apache/vinci/transport/document/AFrame.java | 127 ++++++---- .../vinci/transport/document/XMLToVinci.java | 16 +- .../vinci/transport/document/XMLToXTalk.java | 36 ++- .../vinci/transport/document/XTalkToSAX.java | 11 +- .../vinci/transport/util/Base64Converter.java | 54 +++-- .../vinci/transport/util/StreamMaterializer.java | 6 +- .../apache/vinci/transport/util/UTFConverter.java | 53 +++-- .../apache/vinci/transport/util/XMLConverter.java | 28 ++- .../vinci/transport/vns/client/ResolveResult.java | 16 +- .../vinci/transport/vns/client/ServeonResult.java | 27 ++- .../vinci/transport/vns/client/VNSConfig.java | 14 +- .../vinci/transport/vns/service/NameClient.java | 24 +- .../vinci/transport/vns/service/ServiceAlias.java | 4 +- .../transport/vns/service/ServiceRegistry.java | 9 +- .../apache/vinci/transport/vns/service/VNS.java | 30 +-- .../uima/tools/jcasgen/maven/JCasGenMojo.java | 19 +- .../uima/tools/jcasgen/maven/JCasGenMojoTest.java | 50 ++-- 38 files changed, 1178 insertions(+), 655 deletions(-) diff --git a/jVinci/src/main/java/org/apache/vinci/debug/Debug.java b/jVinci/src/main/java/org/apache/vinci/debug/Debug.java index 49a61cf..7109fa1 100644 --- a/jVinci/src/main/java/org/apache/vinci/debug/Debug.java +++ b/jVinci/src/main/java/org/apache/vinci/debug/Debug.java @@ -206,7 +206,9 @@ public class Debug { /** * Same function as {@link #printDebuggingMessage(String)} but easier to type. - * @param message - + * + * @param message + * - * @return - */ static public String p(String message) { @@ -215,8 +217,11 @@ public class Debug { /** * Same function as {@link #printDebuggingMessage(String,String)} but easier to type. - * @param location - - * @param message - + * + * @param location + * - + * @param message + * - */ static public void p(String location, String message) { printDebuggingMessage(location, message); diff --git a/jVinci/src/main/java/org/apache/vinci/debug/FatalException.java b/jVinci/src/main/java/org/apache/vinci/debug/FatalException.java index 5e5ebdc..cfdf473 100644 --- a/jVinci/src/main/java/org/apache/vinci/debug/FatalException.java +++ b/jVinci/src/main/java/org/apache/vinci/debug/FatalException.java @@ -25,7 +25,7 @@ package org.apache.vinci.debug; * */ public class FatalException extends RuntimeException { - + private static final long serialVersionUID = -8889142805115637932L; private Throwable original_exception; diff --git a/jVinci/src/main/java/org/apache/vinci/transport/BaseClient.java b/jVinci/src/main/java/org/apache/vinci/transport/BaseClient.java index 0a078e7..67cc349 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/BaseClient.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/BaseClient.java @@ -197,6 +197,7 @@ public class BaseClient { /** * Get the hostname/ip address to which this client is connected. + * * @return - */ public String getHost() { @@ -209,6 +210,7 @@ public class BaseClient { /** * Get the socket used for the connection. + * * @return - */ protected Socket getSocket() { @@ -218,6 +220,7 @@ public class BaseClient { /** * Get the default timeout value for the socket (0 indicates never timeout, which is the default, * but generally NOT a good setting). + * * @return - */ public int getSocketTimeout() { @@ -238,7 +241,9 @@ public class BaseClient { /** * Set the transportable factory used by this client. - * @param f - + * + * @param f + * - */ public void setTransportableFactory(TransportableFactory f) { factory = f; @@ -302,8 +307,8 @@ public class BaseClient { * * @pre getHost() != null */ - public Transportable sendAndReceive(Transportable in, int timeout) throws IOException, - ServiceException { + public Transportable sendAndReceive(Transportable in, int timeout) + throws IOException, ServiceException { try { try { if (!isOpen()) { @@ -337,15 +342,18 @@ public class BaseClient { * @pre in != null * * @pre getHost() != null - * @param in - + * @param in + * - * @param f * The factory to used to create the return document. * @return - - * @throws IOException - - * @throws ServiceException - + * @throws IOException + * - + * @throws ServiceException + * - */ - public Transportable sendAndReceive(Transportable in, TransportableFactory f) throws IOException, - ServiceException { + public Transportable sendAndReceive(Transportable in, TransportableFactory f) + throws IOException, ServiceException { try { try { if (!isOpen()) { @@ -374,12 +382,17 @@ public class BaseClient { * Same as sendAndReceive(Transportable, timeout) except the provided factory is used to create * the return document in place of the default factory. * - * @param in - - * @param f The factory to used to create the return document. - * @param timeout - + * @param in + * - + * @param f + * The factory to used to create the return document. + * @param timeout + * - * @return - - * @throws IOException - - * @throws ServiceException - + * @throws IOException + * - + * @throws ServiceException + * - * @pre in != null * @pre f != null * @pre getHost() != null @@ -417,10 +430,13 @@ public class BaseClient { * * @pre query != null * @pre getHost() != null - * @param query - + * @param query + * - * @return A VinciFrame representing the service result. - * @throws IOException - - * @throws ServiceException - + * @throws IOException + * - + * @throws ServiceException + * - */ public VinciFrame rpc(Transportable query) throws IOException, ServiceException { return (VinciFrame) sendAndReceive(query); @@ -430,11 +446,16 @@ public class BaseClient { * Same as sendAndReceive(Transportable, timeout) except for return type. Syntactic sugar method * for the case where return result is known to be VinciFrame (eliminates the need for casting in * the typical usage case). - * @param query - - * @param timeout - + * + * @param query + * - + * @param timeout + * - * @return A VinciFrame representing the service result. - * @throws IOException - - * @throws ServiceException - + * @throws IOException + * - + * @throws ServiceException + * - * * @pre query != null * @pre getHost() != null @@ -532,7 +553,9 @@ public class BaseClient { * Set connection restablishment on IOException to on/off, default is ON. This way, by default, * BaseClient attempts to reopen a connection at most once if it receives an IOException which can * happen, for example, from the connection timing out. - * @param to - + * + * @param to + * - */ public void setRetry(boolean to) { retry = to; @@ -540,6 +563,7 @@ public class BaseClient { /** * Fetch the header of the last Transportable received. + * * @return - */ public KeyValuePair getHeader() { @@ -553,13 +577,19 @@ public class BaseClient { * @pre f != null * @pre p ≥ 0 * @pre p < 65536 - * @param in - - * @param host_name - - * @param p - - * @param f - + * @param in + * - + * @param host_name + * - + * @param p + * - + * @param f + * - * @return - - * @throws IOException - - * @throws ServiceException - + * @throws IOException + * - + * @throws ServiceException + * - */ static public Transportable sendAndReceive(Transportable in, String host_name, int p, TransportableFactory f) throws IOException, ServiceException { @@ -580,14 +610,21 @@ public class BaseClient { * @pre f != null * @pre p ≥ 0 * @pre p < 65536 - * @param in - - * @param host_name - - * @param p - - * @param f - - * @param socket_timeout - + * @param in + * - + * @param host_name + * - + * @param p + * - + * @param f + * - + * @param socket_timeout + * - * @return - - * @throws IOException - - * @throws ServiceException - + * @throws IOException + * - + * @throws ServiceException + * - */ static public Transportable sendAndReceive(Transportable in, String host_name, int p, TransportableFactory f, int socket_timeout) throws IOException, ServiceException { @@ -602,7 +639,7 @@ public class BaseClient { } /** - * Convenience method for "one-shot" or "single-query" connections with socket timeout support + * Convenience method for "one-shot" or "single-query" connections with socket timeout support * & connect timeout support. * * @pre in != null @@ -610,19 +647,27 @@ public class BaseClient { * @pre f != null * @pre p ≥ 0 * @pre p < 65536 - * @param in - - * @param host_name - - * @param p - - * @param f - - * @param socket_timeout - - * @param connect_timeout - + * @param in + * - + * @param host_name + * - + * @param p + * - + * @param f + * - + * @param socket_timeout + * - + * @param connect_timeout + * - * @return - - * @throws IOException - - * @throws ServiceException - + * @throws IOException + * - + * @throws ServiceException + * - */ static public Transportable sendAndReceive(Transportable in, String host_name, int p, - TransportableFactory f, int socket_timeout, int connect_timeout) throws IOException, - ServiceException { + TransportableFactory f, int socket_timeout, int connect_timeout) + throws IOException, ServiceException { BaseClient tempClient = new BaseClient(host_name, p, f, connect_timeout); tempClient.setSocketTimeout(socket_timeout); tempClient.setRetry(false); @@ -641,15 +686,20 @@ public class BaseClient { * @pre host_name != null * @pre p ≥ 0 * @pre p < 65536 - * @param in - - * @param host_name - - * @param p - + * @param in + * - + * @param host_name + * - + * @param p + * - * @return - - * @throws IOException - - * @throws ServiceException - + * @throws IOException + * - + * @throws ServiceException + * - */ - static public VinciFrame rpc(Transportable in, String host_name, int p) throws IOException, - ServiceException { + static public VinciFrame rpc(Transportable in, String host_name, int p) + throws IOException, ServiceException { return (VinciFrame) sendAndReceive(in, host_name, p, VinciFrame.getVinciFrameFactory()); } @@ -661,13 +711,19 @@ public class BaseClient { * @pre in != null * @pre p ≥ 0 * @pre p < 65536 - * @param in - - * @param host_name - - * @param p - - * @param socket_timeout - + * @param in + * - + * @param host_name + * - + * @param p + * - + * @param socket_timeout + * - * @return - - * @throws IOException - - * @throws ServiceException - + * @throws IOException + * - + * @throws ServiceException + * - */ static public VinciFrame rpc(Transportable in, String host_name, int p, int socket_timeout) throws IOException, ServiceException { @@ -683,14 +739,21 @@ public class BaseClient { * @pre in != null * @pre p ≥ 0 * @pre p < 65536 - * @param in - - * @param host_name - - * @param p - - * @param socket_timeout - - * @param connect_timeout - + * @param in + * - + * @param host_name + * - + * @param p + * - + * @param socket_timeout + * - + * @param connect_timeout + * - * @return - - * @throws IOException - - * @throws ServiceException - + * @throws IOException + * - + * @throws ServiceException + * - */ static public VinciFrame rpc(Transportable in, String host_name, int p, int socket_timeout, int connect_timeout) throws IOException, ServiceException { @@ -704,11 +767,15 @@ public class BaseClient { * @pre getHost() != null * @pre os != null * @pre is != null - * @param in - - * @param f - + * @param in + * - + * @param f + * - * @return - - * @throws IOException - - * @throws ServiceException - + * @throws IOException + * - + * @throws ServiceException + * - */ protected Transportable sendAndReceiveWork(Transportable in, TransportableFactory f) throws IOException, ServiceException { @@ -726,12 +793,17 @@ public class BaseClient { * @pre in != null * @pre f != null * @pre socket != null - * @param in - - * @param f - - * @param timeout - + * @param in + * - + * @param f + * - + * @param timeout + * - * @return - - * @throws IOException - - * @throws ServiceException - + * @throws IOException + * - + * @throws ServiceException + * - */ protected Transportable sendAndReceiveWork(Transportable in, TransportableFactory f, int timeout) throws IOException, ServiceException { @@ -747,8 +819,10 @@ public class BaseClient { /** * @pre e != null * @pre getHost() != null - * @param e - - * @throws IOException - + * @param e + * - + * @throws IOException + * - */ protected void reopen(Exception e) throws IOException { Debug.p("Trying to reopen connection due to exception: " + e.getMessage()); @@ -794,7 +868,7 @@ public class BaseClient { socket.connect(socketAddress, connectTimeout); socket.setTcpNoDelay(true); // needed to avoid delays with Linux/loopback socket.setSoTimeout(socketTimeout); - socket.setKeepAlive(isSocketKeepAliveEnabled()); + socket.setKeepAlive(isSocketKeepAliveEnabled()); is = new BufferedInputStream(socket.getInputStream()); os = new BufferedOutputStream(socket.getOutputStream()); } @@ -816,15 +890,18 @@ public class BaseClient { setRetry(false); socket = use_me; socket.setSoTimeout(socketTimeout); - socket.setKeepAlive(isSocketKeepAliveEnabled()); + socket.setKeepAlive(isSocketKeepAliveEnabled()); is = new BufferedInputStream(socket.getInputStream()); os = new BufferedOutputStream(socket.getOutputStream()); } /** * Set the timeout value used by the underlying socket. Default is 2 minutes. - * @param millis - - * @throws IOException - + * + * @param millis + * - + * @throws IOException + * - */ public void setSocketTimeout(int millis) throws IOException { if (socket != null) { @@ -832,13 +909,12 @@ public class BaseClient { } socketTimeout = millis; } - + /** - * Gets whether keepAlive should be turned on for client sockets. - * Always returns true for BaseClient. Can be overridden in - * subclasses. + * Gets whether keepAlive should be turned on for client sockets. Always returns true for + * BaseClient. Can be overridden in subclasses. * - *@return whether socket keepAlive should be turned on + * @return whether socket keepAlive should be turned on */ protected boolean isSocketKeepAliveEnabled() { return true; diff --git a/jVinci/src/main/java/org/apache/vinci/transport/BaseServer.java b/jVinci/src/main/java/org/apache/vinci/transport/BaseServer.java index c537924..6690308 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/BaseServer.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/BaseServer.java @@ -161,6 +161,7 @@ public class BaseServer { /** * Get the servable object being used by this server. + * * @return - */ public VinciServable getServable() { @@ -175,7 +176,8 @@ public class BaseServer { * * @param millis * The socket timeout value in milliseconds. - * @throws IOException - + * @throws IOException + * - */ public void setSocketTimeout(int millis) throws IOException { socketTimeout = millis; @@ -220,8 +222,11 @@ public class BaseServer { /** * Set the intitial and maximum size of the threadpool used by this server. This should be called * before serving starts otherwise it has no effect. - * @param initial - - * @param max - + * + * @param initial + * - + * @param max + * - */ public void setThreadPoolSize(int initial, int max) { Debug.Assert(!isServing); @@ -318,7 +323,8 @@ public class BaseServer { * @return The server socket to be used by this server for accepting requests. * @param port * The port which is to be listened to by the created socket. - * @throws IOException - + * @throws IOException + * - * @pre port ≥ 0 * @pre port < 65536 */ @@ -385,7 +391,8 @@ public class BaseServer { * Get a runnable object to run within a pooled thread that will handle the request. * * @pre client != null - * @param client - + * @param client + * - * @return - */ protected Runnable getRunnable(Socket client) { @@ -397,7 +404,8 @@ public class BaseServer { * * @pre client != null * @pre threadPool != null - * @param client - + * @param client + * - */ protected void handleRequest(Socket client) { try { @@ -451,8 +459,10 @@ public class BaseServer { * the appropriate VinciServable. * * @pre in != null - * @param in - - * @param header - + * @param in + * - + * @param header + * - * @return - */ public Transportable eval(Transportable in, KeyValuePair header) { diff --git a/jVinci/src/main/java/org/apache/vinci/transport/BaseServerRunnable.java b/jVinci/src/main/java/org/apache/vinci/transport/BaseServerRunnable.java index bf7b645..9568f56 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/BaseServerRunnable.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/BaseServerRunnable.java @@ -42,6 +42,7 @@ public class BaseServerRunnable implements Runnable { /** * Allows anyone in the calling chain of the 'run' method to get access to the socket being used * in the Vinci connection via the ThreadLocal variable. + * * @return - */ public static Socket getSocket() { @@ -51,8 +52,10 @@ public class BaseServerRunnable implements Runnable { /** * @pre c != null * @pre p != null - * @param c - - * @param p - + * @param c + * - + * @param p + * - */ public BaseServerRunnable(Socket c, BaseServer p) { socket = c; diff --git a/jVinci/src/main/java/org/apache/vinci/transport/Frame.java b/jVinci/src/main/java/org/apache/vinci/transport/Frame.java index 1abe917..4b03fe9 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/Frame.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/Frame.java @@ -94,7 +94,8 @@ public abstract class Frame extends FrameComponent implements Transportable { * The tag name with which to associate the value. * @param val * The (Frame | FrameLeaf) value to associate with the tag. - * @throws UnsupportedOperationException not implemented + * @throws UnsupportedOperationException + * not implemented */ /* abstract */public void add(String tag, FrameComponent val) { throw new UnsupportedOperationException("not implemented"); @@ -111,7 +112,8 @@ public abstract class Frame extends FrameComponent implements Transportable { * * @param which * The index of the KeyValuePair to retrieve. - * @throws UnsupportedOperationException not implemented + * @throws UnsupportedOperationException + * not implemented * @return The requested KeyValuePair. */ /* abstract */public KeyValuePair getKeyValuePair(int which) { @@ -126,7 +128,8 @@ public abstract class Frame extends FrameComponent implements Transportable { * define it in cases where alternative getters are provided for querying the document, and the * object is never marshalled to a stream. * - * @throws UnsupportedOperationException not implemented + * @throws UnsupportedOperationException + * not implemented * @return The total number of key/value pairs in this frame. */ /* abstract */public int getKeyValuePairCount() { @@ -281,7 +284,8 @@ public abstract class Frame extends FrameComponent implements Transportable { * Factory method used by fromStream when it needs to create a frame leaf. Default implementation * creates a regular FrameLeaf. * - * @param array - + * @param array + * - * @return the created FrameLeaf. * * @pre array != null @@ -293,8 +297,11 @@ public abstract class Frame extends FrameComponent implements Transportable { /** * Factory method used by fromStream when it needs to create a sub-frame. Default implementation * creates a subframe of the same type as the current frame. - * @param tag_name - - * @param initialCapacity - + * + * @param tag_name + * - + * @param initialCapacity + * - * @return the created sub-frame. * @throws UnsupportedOperationException * if the getClass().newInstance() call on this object results in an exception. @@ -341,8 +348,10 @@ public abstract class Frame extends FrameComponent implements Transportable { * * @pre rval != null * @pre offset ≥ 0 - * @param rval - - * @param offset - + * @param rval + * - + * @param offset + * - */ protected void toXML(StringBuffer rval, int offset) { KeyValuePair keyVal = null; @@ -383,7 +392,8 @@ public abstract class Frame extends FrameComponent implements Transportable { * * @param key * The key to be associated with the value. - * @param val - + * @param val + * - * @return This frame * @throws UnsupportedOperationException * if this document model doesn't support key addition. @@ -400,7 +410,8 @@ public abstract class Frame extends FrameComponent implements Transportable { * * @param key * The key to be associated with the value. - * @param val - + * @param val + * - * @return This frame * @throws UnsupportedOperationException * if this document model doesn't support key addition. @@ -419,7 +430,8 @@ public abstract class Frame extends FrameComponent implements Transportable { * * @param key * The key to be associated with the value. - * @param val - + * @param val + * - * @throws UnsupportedOperationException * if this document model doesn't support key addition. * @return This frame diff --git a/jVinci/src/main/java/org/apache/vinci/transport/FrameComponent.java b/jVinci/src/main/java/org/apache/vinci/transport/FrameComponent.java index a5189f3..d7b4f6b 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/FrameComponent.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/FrameComponent.java @@ -29,7 +29,9 @@ public class FrameComponent { /** * Set the attributes (replacing any previous ones) assocated with this Frame component. Default * implementation does nothing since attributes are not supported by default. - * @param s - + * + * @param s + * - */ public void setAttributes(Attributes s) { Debug.p("WARNING: Attempt to set attributes of FrameComponent " diff --git a/jVinci/src/main/java/org/apache/vinci/transport/FrameLeaf.java b/jVinci/src/main/java/org/apache/vinci/transport/FrameLeaf.java index 30663cc..e96ad1b 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/FrameLeaf.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/FrameLeaf.java @@ -53,8 +53,10 @@ public class FrameLeaf extends FrameComponent { * cannot be modified by external code. * * @pre mydata != null - * @param mydata - - * @param encode - + * @param mydata + * - + * @param encode + * - */ public FrameLeaf(byte[] mydata, boolean encode) { if (encode) { @@ -67,7 +69,8 @@ public class FrameLeaf extends FrameComponent { /** * @pre mydata != null - * @param mydata - + * @param mydata + * - */ public FrameLeaf(String mydata) { this.data = UTFConverter.convertStringToUTF(mydata); @@ -77,9 +80,10 @@ public class FrameLeaf extends FrameComponent { * This method does NOT support null values in the array. * * @pre mystring != null - * @pre { for (int i = 0; i < mystring.length; i++) $assert(mystring[i] != null, "array elements - * are non-null"); } - * @param mystring - + * @pre { for (int i = 0; i < mystring.length; i++) $assert(mystring[i] != null, "array + * elements are non-null"); } + * @param mystring + * - */ public FrameLeaf(String[] mystring) { String separator = "#"; @@ -109,7 +113,8 @@ public class FrameLeaf extends FrameComponent { /** * @pre myfloat != null - * @param myfloat - + * @param myfloat + * - */ public FrameLeaf(float[] myfloat) { StringBuffer add_me = new StringBuffer(); @@ -128,7 +133,8 @@ public class FrameLeaf extends FrameComponent { /** * @pre mydouble != null - * @param mydouble - + * @param mydouble + * - */ public FrameLeaf(double[] mydouble) { StringBuffer add_me = new StringBuffer(); @@ -148,7 +154,8 @@ public class FrameLeaf extends FrameComponent { /** * @pre myint != null - * @param myint - + * @param myint + * - */ public FrameLeaf(int[] myint) { StringBuffer add_me = new StringBuffer(); @@ -168,7 +175,8 @@ public class FrameLeaf extends FrameComponent { /** * @pre mylong != null - * @param mylong - + * @param mylong + * - */ public FrameLeaf(long[] mylong) { StringBuffer add_me = new StringBuffer(); @@ -250,6 +258,7 @@ public class FrameLeaf extends FrameComponent { /** * Get the raw (usually UTF-8) frame data. + * * @return - */ public byte[] getData() { diff --git a/jVinci/src/main/java/org/apache/vinci/transport/FrameTransporter.java b/jVinci/src/main/java/org/apache/vinci/transport/FrameTransporter.java index 5475b9e..6fc5d16 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/FrameTransporter.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/FrameTransporter.java @@ -39,8 +39,10 @@ public interface FrameTransporter { * @param f * The Frame to be marshalled. * @return - - * @throws IOException - - * @throws EOFException - + * @throws IOException + * - + * @throws EOFException + * - */ KeyValuePair fromStream(InputStream is, Frame f) throws IOException, EOFException; @@ -51,7 +53,8 @@ public interface FrameTransporter { * The stream from where the data is read. * @param f * The Frame to be populated from the stream. - * @throws IOException - + * @throws IOException + * - */ void toStream(OutputStream os, Frame f) throws IOException; } diff --git a/jVinci/src/main/java/org/apache/vinci/transport/KeyValuePair.java b/jVinci/src/main/java/org/apache/vinci/transport/KeyValuePair.java index c6efa1f..6337c69 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/KeyValuePair.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/KeyValuePair.java @@ -38,8 +38,10 @@ public final class KeyValuePair { /** * @pre mykey != null * @pre myvalue != null - * @param mykey - - * @param myvalue - + * @param mykey + * - + * @param myvalue + * - */ public KeyValuePair(String mykey, FrameComponent myvalue) { this.key = mykey; diff --git a/jVinci/src/main/java/org/apache/vinci/transport/LeafCastException.java b/jVinci/src/main/java/org/apache/vinci/transport/LeafCastException.java index 65f7c3f..9ac4611 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/LeafCastException.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/LeafCastException.java @@ -24,7 +24,7 @@ package org.apache.vinci.transport; * errors. */ public class LeafCastException extends IllegalArgumentException { - + private static final long serialVersionUID = 2167774897716144428L; public LeafCastException() { diff --git a/jVinci/src/main/java/org/apache/vinci/transport/PooledVinciClient.java b/jVinci/src/main/java/org/apache/vinci/transport/PooledVinciClient.java index 030760e..c93ae13 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/PooledVinciClient.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/PooledVinciClient.java @@ -53,8 +53,11 @@ public class PooledVinciClient { /** * Create a PooledVinciClient that will establish at most maxPoolSize connections to the * designated service. - * @param serviceName - - * @param maxPoolSize - + * + * @param serviceName + * - + * @param maxPoolSize + * - */ public PooledVinciClient(String serviceName, int maxPoolSize) { this.serviceName = serviceName; @@ -67,7 +70,9 @@ public class PooledVinciClient { /** * Set a VinciContext that will be used by this PooledVinciClient instead of the default global * context. - * @param context - + * + * @param context + * - */ public void setContext(VinciContext context) { this.context = context; @@ -75,7 +80,9 @@ public class PooledVinciClient { /** * Set a connect timeout that will be used in place of BaseClient.DEFAULT_CONNECT_TIMEOUT - * @param connectTimeoutMillis - + * + * @param connectTimeoutMillis + * - */ public void setConnectTimeout(int connectTimeoutMillis) { this.connectTimeout = connectTimeoutMillis; @@ -83,7 +90,9 @@ public class PooledVinciClient { /** * Set a socket timeout that will be used in place of BaseClient.DEFAULT_SOCKET_TIMEOUT - * @param socketTimeoutMillis - + * + * @param socketTimeoutMillis + * - */ public void setSocketTimeout(int socketTimeoutMillis) { this.socketTimeout = socketTimeoutMillis; @@ -91,7 +100,9 @@ public class PooledVinciClient { /** * Set a transportable factory that will be used in place of the VinciFrame factory. - * @param factory - + * + * @param factory + * - */ public void setTransportableFactory(TransportableFactory factory) { this.factory = factory; @@ -99,6 +110,7 @@ public class PooledVinciClient { /** * Get the service name to which this client connects. + * * @return - */ public String getServiceName() { @@ -107,10 +119,14 @@ public class PooledVinciClient { /** * Send a request to the service and receive the response. This method is tread safe. - * @param in - + * + * @param in + * - * @return - - * @throws IOException - - * @throws ServiceException - + * @throws IOException + * - + * @throws ServiceException + * - */ public Transportable sendAndReceive(Transportable in) throws IOException, ServiceException { VinciClient c = getClientFromPool(); @@ -124,14 +140,19 @@ public class PooledVinciClient { /** * Send a request to the service and receive the response, using the provided transportable * factory in place of the client-provided one. This method is tread safe. - * @param in - - * @param f - + * + * @param in + * - + * @param f + * - * @return - - * @throws IOException - - * @throws ServiceException - + * @throws IOException + * - + * @throws ServiceException + * - */ - public Transportable sendAndReceive(Transportable in, TransportableFactory f) throws IOException, - ServiceException { + public Transportable sendAndReceive(Transportable in, TransportableFactory f) + throws IOException, ServiceException { VinciClient c = getClientFromPool(); try { return c.sendAndReceive(in, f); @@ -143,12 +164,18 @@ public class PooledVinciClient { /** * Send a request to the service and receive the response, using the provided transportable * factory and socketTimeout in place of the client-provided ones. This method is tread safe. - * @param in - - * @param f - - * @param socketTimeout - + * + * @param in + * - + * @param f + * - + * @param socketTimeout + * - * @return - - * @throws IOException - - * @throws ServiceException - + * @throws IOException + * - + * @throws ServiceException + * - */ public Transportable sendAndReceive(Transportable in, TransportableFactory f, int socketTimeout) throws IOException, ServiceException { @@ -163,14 +190,19 @@ public class PooledVinciClient { /** * Send a request to the service and receive the response, using the provided socketTimeout in * place of the client-provided one. This method is tread safe. - * @param in - - * @param socketTimeout - + * + * @param in + * - + * @param socketTimeout + * - * @return - - * @throws IOException - - * @throws ServiceException - + * @throws IOException + * - + * @throws ServiceException + * - */ - public Transportable sendAndReceive(Transportable in, int socketTimeout) throws IOException, - ServiceException { + public Transportable sendAndReceive(Transportable in, int socketTimeout) + throws IOException, ServiceException { VinciClient c = getClientFromPool(); try { return c.sendAndReceive(in, socketTimeout); diff --git a/jVinci/src/main/java/org/apache/vinci/transport/ServiceDownException.java b/jVinci/src/main/java/org/apache/vinci/transport/ServiceDownException.java index 7cd81f5..b083159 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/ServiceDownException.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/ServiceDownException.java @@ -26,7 +26,7 @@ import java.io.IOException; * not be established. */ public class ServiceDownException extends IOException { - + private static final long serialVersionUID = -6125121845524920235L; /** diff --git a/jVinci/src/main/java/org/apache/vinci/transport/SimpleTransportable.java b/jVinci/src/main/java/org/apache/vinci/transport/SimpleTransportable.java index 5ec57c8..969e40e 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/SimpleTransportable.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/SimpleTransportable.java @@ -39,7 +39,8 @@ public final class SimpleTransportable implements Transportable { * Create a SimpleTransportable that is an immutable copy of the provided Transportable object. * * @pre convert_me != null - * @param convert_me - + * @param convert_me + * - */ public SimpleTransportable(Transportable convert_me) { try { diff --git a/jVinci/src/main/java/org/apache/vinci/transport/Transportable.java b/jVinci/src/main/java/org/apache/vinci/transport/Transportable.java index 728526c..13087f2 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/Transportable.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/Transportable.java @@ -34,7 +34,8 @@ public interface Transportable { * @param is * The stream to read from. * @return - - * @exception IOException - + * @exception IOException + * - */ KeyValuePair fromStream(InputStream is) throws IOException; @@ -43,7 +44,8 @@ public interface Transportable { * * @param os * The stream to write into. - * @exception IOException - + * @exception IOException + * - */ void toStream(OutputStream os) throws IOException; diff --git a/jVinci/src/main/java/org/apache/vinci/transport/VNSException.java b/jVinci/src/main/java/org/apache/vinci/transport/VNSException.java index f8132ce..4e2f50c 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/VNSException.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/VNSException.java @@ -25,7 +25,7 @@ import java.io.IOException; * Special exception type thrown by VinciClient/VinciServer when VNS itself reports an error. */ public class VNSException extends IOException { - + private static final long serialVersionUID = -9150424759390586749L; public VNSException(String message) { diff --git a/jVinci/src/main/java/org/apache/vinci/transport/VinciClient.java b/jVinci/src/main/java/org/apache/vinci/transport/VinciClient.java index f215fbf..da141ed 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/VinciClient.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/VinciClient.java @@ -47,8 +47,10 @@ public class VinciClient extends BaseClient { * @param service_name * The name of the service to connect to. * - * @throws ServiceDownException - - * @throws VNSException - + * @throws ServiceDownException + * - + * @throws VNSException + * - * @throws IllegalStateException * if no VNS_HOST has been specified. * @@ -67,8 +69,10 @@ public class VinciClient extends BaseClient { * @param factory * The factory used for creating return documents of desired type. * - * @throws ServiceDownException - - * @throws VNSException - + * @throws ServiceDownException + * - + * @throws VNSException + * - * @throws IllegalStateException * if no VNS_HOST has been specified. * @@ -86,11 +90,16 @@ public class VinciClient extends BaseClient { * @pre factory != null * @pre myContext != null * - * @param service_name - - * @param factory - - * @param myContext - - * @throws ServiceDownException - - * @throws VNSException - + * @param service_name + * - + * @param factory + * - + * @param myContext + * - + * @throws ServiceDownException + * - + * @throws VNSException + * - * @throws IllegalStateException * if no VNS_HOST has been specified. */ @@ -104,15 +113,19 @@ public class VinciClient extends BaseClient { /** * @pre service_name != null * @pre myContext != null - * @param service_name - - * @param myContext - - * @throws ServiceDownException - - * @throws VNSException - + * @param service_name + * - + * @param myContext + * - + * @throws ServiceDownException + * - + * @throws VNSException + * - * @throws IllegalStateException * if no VNS_HOST has been specified. */ - public VinciClient(String service_name, VinciContext myContext) throws ServiceDownException, - VNSException { + public VinciClient(String service_name, VinciContext myContext) + throws ServiceDownException, VNSException { this(service_name, VinciFrame.getVinciFrameFactory(), myContext); } @@ -125,15 +138,17 @@ public class VinciClient extends BaseClient { * @param connectTimeout * The number of milliseconds that will elapse before a connect attempt fails. * - * @throws ServiceDownException - - * @throws VNSException - + * @throws ServiceDownException + * - + * @throws VNSException + * - * @throws IllegalStateException * if no VNS_HOST has been specified. * * @pre service_name != null */ - public VinciClient(String service_name, int connectTimeout) throws ServiceDownException, - VNSException { + public VinciClient(String service_name, int connectTimeout) + throws ServiceDownException, VNSException { this(service_name, VinciFrame.getVinciFrameFactory(), connectTimeout); } @@ -148,8 +163,10 @@ public class VinciClient extends BaseClient { * @param connectTimeout * The number of milliseconds that will elapse before a connect attempt fails. * - * @throws ServiceDownException - - * @throws VNSException - + * @throws ServiceDownException + * - + * @throws VNSException + * - * @throws IllegalStateException * if no VNS_HOST has been specified. * @@ -169,12 +186,18 @@ public class VinciClient extends BaseClient { * @pre factory != null * @pre myContext != null * - * @param service_name - - * @param factory - - * @param myContext - - * @param connectTimeout - - * @throws ServiceDownException - - * @throws VNSException - + * @param service_name + * - + * @param factory + * - + * @param myContext + * - + * @param connectTimeout + * - + * @throws ServiceDownException + * - + * @throws VNSException + * - * @throws IllegalStateException * if no VNS_HOST has been specified. */ @@ -190,11 +213,16 @@ public class VinciClient extends BaseClient { * * @pre service_name != null * @pre myContext != null - * @param service_name - - * @param myContext - - * @param connectTimeout - - * @throws ServiceDownException - - * @throws VNSException - + * @param service_name + * - + * @param myContext + * - + * @param connectTimeout + * - + * @throws ServiceDownException + * - + * @throws VNSException + * - * @throws IllegalStateException * if no VNS_HOST has been specified. */ @@ -213,7 +241,9 @@ public class VinciClient extends BaseClient { /** * Construct a new client WITHOUT opening a connection, using the specified factory to create * return documents. - * @param f - + * + * @param f + * - */ public VinciClient(TransportableFactory f) { super(f); @@ -222,6 +252,7 @@ public class VinciClient extends BaseClient { /** * Get the priority level of the service to which this client is connected. This method only works * after the connection has been opened. + * * @return - */ public int getLevel() { @@ -235,6 +266,7 @@ public class VinciClient extends BaseClient { * Services should have "non zero" instance numbers only when more than one instance of the * service is running on the same host. The unique instance value allows each instance to be * distinguished and uniquely addressed via a fully qualified service name. + * * @return - */ @@ -246,14 +278,21 @@ public class VinciClient extends BaseClient { * Convenience method for "one-shot"/single-query connections. Equivalent of manually creating a * new VinciClient(), calling (non-static) sendAndReceive, and then closing the client. * - * @param in - - * @param service_name - - * @param factory - + * @param in + * - + * @param service_name + * - + * @param factory + * - * @return - - * @throws IOException - - * @throws ServiceException - - * @throws ServiceDownException - - * @throws VNSException - + * @throws IOException + * - + * @throws ServiceException + * - + * @throws ServiceDownException + * - + * @throws VNSException + * - * @throws IllegalStateException * if the VNS host has not been specified. * @@ -262,8 +301,8 @@ public class VinciClient extends BaseClient { * @pre factory != null */ static public Transportable sendAndReceive(Transportable in, String service_name, - TransportableFactory factory) throws IOException, ServiceException, ServiceDownException, - VNSException { + TransportableFactory factory) + throws IOException, ServiceException, ServiceDownException, VNSException { return VinciContext.getGlobalContext().sendAndReceive(in, service_name, factory); } @@ -271,13 +310,19 @@ public class VinciClient extends BaseClient { * Convenience method for "one-shot"/single-query connections. Equivalent of manually creating a * new VinciClient(), calling (non-static) sendAndReceive, and then closing the client. * - * @param in - - * @param service_name - - * @param factory - - * @param socket_timeout - + * @param in + * - + * @param service_name + * - + * @param factory + * - + * @param socket_timeout + * - * @return - - * @throws IOException - - * @throws ServiceException - + * @throws IOException + * - + * @throws ServiceException + * - * @throws IllegalStateException * if the VNS host has not been specified. * @@ -288,22 +333,29 @@ public class VinciClient extends BaseClient { */ static public Transportable sendAndReceive(Transportable in, String service_name, TransportableFactory factory, int socket_timeout) throws IOException, ServiceException { - return VinciContext.getGlobalContext() - .sendAndReceive(in, service_name, factory, socket_timeout); + return VinciContext.getGlobalContext().sendAndReceive(in, service_name, factory, + socket_timeout); } /** * Convenience method for "one-shot"/single-query connections. Equivalent of manually creating a * new VinciClient(), calling (non-static) sendAndReceive, and then closing the client. * - * @param in - - * @param service_name - - * @param factory - - * @param socket_timeout - - * @param connect_timeout - + * @param in + * - + * @param service_name + * - + * @param factory + * - + * @param socket_timeout + * - + * @param connect_timeout + * - * @return - - * @throws IOException - - * @throws ServiceException - + * @throws IOException + * - + * @throws ServiceException + * - * @throws IllegalStateException * if the VNS host has not been specified. * @@ -315,13 +367,14 @@ public class VinciClient extends BaseClient { static public Transportable sendAndReceive(Transportable in, String service_name, TransportableFactory factory, int socket_timeout, int connect_timeout) throws IOException, ServiceException { - return VinciContext.getGlobalContext().sendAndReceive(in, service_name, factory, - socket_timeout, connect_timeout); + return VinciContext.getGlobalContext().sendAndReceive(in, service_name, factory, socket_timeout, + connect_timeout); } /** * Get the context associated with this client. By default clients use the global Vinci context, * though this can be overridden. + * * @return - */ public VinciContext getContext() { @@ -337,7 +390,9 @@ public class VinciClient extends BaseClient { * be used. You should set the context BEFORE a connection is open (e.g. ater using the no-arg * constructor), otherwise the global context parameters will be used to establish the connection * before you have a chance to change it. - * @param c - + * + * @param c + * - */ public void setContext(VinciContext c) { context = c; @@ -347,6 +402,7 @@ public class VinciClient extends BaseClient { * Get the fully qualified name of this service. This method is useful when for whatever reason a * connection needs to be re-established with this exact same service instance. This method only * works after connection has been established. + * * @return - * * @pre getHost() != null @@ -453,8 +509,8 @@ public class VinciClient extends BaseClient { Debug.p("Resolved " + serviceName + " to: " + locator.host + ":" + locator.port); return; } catch (IOException e) { - Debug.p("WARNING: Failed to connect to service at (" + locator.host + ":" - + locator.port + "):" + e.getMessage()); + Debug.p("WARNING: Failed to connect to service at (" + locator.host + ":" + locator.port + + "):" + e.getMessage()); connectFailed = true; if (alreadyTried == null) { alreadyTried = new ArrayList(); @@ -471,8 +527,8 @@ public class VinciClient extends BaseClient { } else if (response.priority != 0 && !ResolveResult.isQualified(serviceName)) { // If a service name was specified without qualifications, then // we allow fail-over to lower-priority services. - Debug.p("VinciClient.open(String)", "Resolving with lower priority than: " - + response.priority); + Debug.p("VinciClient.open(String)", + "Resolving with lower priority than: " + response.priority); myContext.flushFromCache(serviceName); int next_level = response.priority; if (next_level == -1) { @@ -498,11 +554,10 @@ public class VinciClient extends BaseClient { close(); open(serviceName); } - + /** - * Gets wheter socket keepAlive is enabled. This overrides the method - * in BaseClient, and makes this setting configurable through the - * VinciContext. + * Gets wheter socket keepAlive is enabled. This overrides the method in BaseClient, and makes + * this setting configurable through the VinciContext. * * @return whether socket keepAlive is enabled. */ @@ -516,21 +571,27 @@ public class VinciClient extends BaseClient { * method for the case where return result is known to be VinciFrame (eliminates the need for * casting in the typical usage case). * - * @param in - - * @param service_name - + * @param in + * - + * @param service_name + * - * @return A VinciFrame representing the service result. * @throws IllegalStateException * if the VNS host has not been specified. - * @throws IOException - - * @throws ServiceException - - * @throws ServiceDownException - - * @throws VNSException - + * @throws IOException + * - + * @throws ServiceException + * - + * @throws ServiceDownException + * - + * @throws VNSException + * - * * @pre in != null * @pre service_name != null */ - static public VinciFrame rpc(Transportable in, String service_name) throws IOException, - ServiceException, ServiceDownException, VNSException { + static public VinciFrame rpc(Transportable in, String service_name) + throws IOException, ServiceException, ServiceDownException, VNSException { return VinciContext.getGlobalContext().rpc(in, service_name); } @@ -545,14 +606,21 @@ public class VinciClient extends BaseClient { * @pre in != null * @pre service_name != null * @pre timeout ≥ 0 - * @param in - - * @param service_name - - * @param timeout - + * @param in + * - + * @param service_name + * - + * @param timeout + * - * @return A VinciFrame representing the service result. - * @throws IOException - - * @throws ServiceException - - * @throws ServiceDownException - - * @throws VNSException - + * @throws IOException + * - + * @throws ServiceException + * - + * @throws ServiceDownException + * - + * @throws VNSException + * - */ static public VinciFrame rpc(Transportable in, String service_name, int timeout) throws IOException, ServiceException, ServiceDownException, VNSException { @@ -571,19 +639,27 @@ public class VinciClient extends BaseClient { * @pre service_name != null * @pre timeout ≥ 0 * @pre connect_timeout > 0 - * @param in - - * @param service_name - - * @param timeout - - * @param connect_timeout - + * @param in + * - + * @param service_name + * - + * @param timeout + * - + * @param connect_timeout + * - * @return A VinciFrame representing the service result. - * @throws IOException - - * @throws ServiceException - - * @throws ServiceDownException - - * @throws VNSException - + * @throws IOException + * - + * @throws ServiceException + * - + * @throws ServiceDownException + * - + * @throws VNSException + * - */ static public VinciFrame rpc(Transportable in, String service_name, int timeout, - int connect_timeout) throws IOException, ServiceException, ServiceDownException, - VNSException { + int connect_timeout) + throws IOException, ServiceException, ServiceDownException, VNSException { return VinciContext.getGlobalContext().rpc(in, service_name, timeout, connect_timeout); } diff --git a/jVinci/src/main/java/org/apache/vinci/transport/VinciFrame.java b/jVinci/src/main/java/org/apache/vinci/transport/VinciFrame.java index 01abf51..e1127c1 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/VinciFrame.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/VinciFrame.java @@ -49,6 +49,7 @@ public class VinciFrame extends QueryableFrame { /** * Get a TransportableFactory that creates new VinciFrames. + * * @return - */ static public TransportableFactory getVinciFrameFactory() { @@ -66,7 +67,8 @@ public class VinciFrame extends QueryableFrame { * Create a VinciFrame that is a (deep) copy of the given transportable. * * @pre t != null - * @param t - + * @param t + * - * @return - */ public static VinciFrame toVinciFrame(Transportable t) { @@ -166,8 +168,10 @@ public class VinciFrame extends QueryableFrame { * * @pre key != null * @pre val != null - * @param key - - * @param val - + * @param key + * - + * @param val + * - * @return - */ public VinciFrame fset(String key, String val) { @@ -180,8 +184,10 @@ public class VinciFrame extends QueryableFrame { * doesn't exist, then the value is added. * * @pre key != null - * @param key - - * @param val - + * @param key + * - + * @param val + * - * @return - */ public VinciFrame fset(String key, long val) { @@ -194,8 +200,10 @@ public class VinciFrame extends QueryableFrame { * doesn't exist, then the value is added. * * @pre key != null - * @param key - - * @param val - + * @param key + * - + * @param val + * - * @return - */ public VinciFrame fset(String key, boolean val) { @@ -208,8 +216,10 @@ public class VinciFrame extends QueryableFrame { * doesn't exist, then the value is added. * * @pre key != null - * @param key - - * @param val - + * @param key + * - + * @param val + * - * @return - */ public VinciFrame fset(String key, int val) { @@ -223,8 +233,10 @@ public class VinciFrame extends QueryableFrame { * * @pre key != null * @pre val != null - * @param key - - * @param val - + * @param key + * - + * @param val + * - * @return - */ public VinciFrame fset(String key, int[] val) { @@ -240,8 +252,10 @@ public class VinciFrame extends QueryableFrame { * if val is null. * * @pre key != null - * @param key - - * @param val - + * @param key + * - + * @param val + * - * @return - */ public VinciFrame fset(String key, Frame val) { @@ -254,8 +268,10 @@ public class VinciFrame extends QueryableFrame { * doesn't exist, then the value is added. * * @pre key != null - * @param key - - * @param val - + * @param key + * - + * @param val + * - * @return - */ public VinciFrame fset(String key, double val) { @@ -272,8 +288,10 @@ public class VinciFrame extends QueryableFrame { * * @pre key != null * @pre bin != null - * @param key - - * @param bin - + * @param key + * - + * @param bin + * - * @return - */ public VinciFrame fset(String key, byte[] bin) { @@ -291,8 +309,10 @@ public class VinciFrame extends QueryableFrame { * * @pre key != null * @pre bin != null - * @param key - - * @param bin - + * @param key + * - + * @param bin + * - * @return - */ public VinciFrame fsetTrueBinary(String key, byte[] bin) { @@ -309,8 +329,10 @@ public class VinciFrame extends QueryableFrame { * if val is null. * * @pre key != null - * @param key - - * @param val - + * @param key + * - + * @param val + * - */ protected void set(String key, FrameComponent val) { if (val != null) { diff --git a/jVinci/src/main/java/org/apache/vinci/transport/VinciServer.java b/jVinci/src/main/java/org/apache/vinci/transport/VinciServer.java index 19168f6..0e16cb3 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/VinciServer.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/VinciServer.java @@ -60,8 +60,10 @@ public class VinciServer extends BaseServer { * * @param host_name * The DNS hostname of the machine running this server. - * @param service_name - - * @param servable - + * @param service_name + * - + * @param servable + * - * * @pre service_name != null * @pre host_name != null @@ -75,8 +77,10 @@ public class VinciServer extends BaseServer { * Create a new server that reports the current machine's IP address as the host. This should not * be used for DHCP-based hosts since IP address can change. * - * @param service_name - - * @param servable - + * @param service_name + * - + * @param servable + * - * @throws UnknownHostException * If there is an error determining machine IP address. * @@ -95,11 +99,16 @@ public class VinciServer extends BaseServer { * @pre servable != null * @pre myPriority ≥ -1 * @pre myInstance ≥ 0 - * @param service_name - - * @param host_name - - * @param servable - - * @param myPriority - - * @param myInstance - + * @param service_name + * - + * @param host_name + * - + * @param servable + * - + * @param myPriority + * - + * @param myInstance + * - */ public VinciServer(String service_name, String host_name, VinciServable servable, int myPriority, int myInstance) { @@ -115,12 +124,17 @@ public class VinciServer extends BaseServer { * @pre host_name != null * @pre servable != null * @pre myPriority ≥ -1 - * @param service_name - - * @param host_name - - * @param servable - - * @param myPriority - + * @param service_name + * - + * @param host_name + * - + * @param servable + * - + * @param myPriority + * - */ - public VinciServer(String service_name, String host_name, VinciServable servable, int myPriority) { + public VinciServer(String service_name, String host_name, VinciServable servable, + int myPriority) { this(service_name, host_name, servable, myPriority, 0); } @@ -128,10 +142,14 @@ public class VinciServer extends BaseServer { * @pre service_name != null * @pre servable != null * @pre myPriority ≥ -1 - * @param service_name - - * @param servable - - * @param myPriority - - * @throws UnknownHostException - + * @param service_name + * - + * @param servable + * - + * @param myPriority + * - + * @throws UnknownHostException + * - */ public VinciServer(String service_name, VinciServable servable, int myPriority) throws UnknownHostException { @@ -143,11 +161,16 @@ public class VinciServer extends BaseServer { * @pre servable != null * @pre myPriority ≥ -1 * @pre myInstance ≥ 0 - * @param service_name - - * @param servable - - * @param myPriority - - * @param myInstance - - * @throws UnknownHostException - + * @param service_name + * - + * @param servable + * - + * @param myPriority + * - + * @param myInstance + * - + * @throws UnknownHostException + * - */ public VinciServer(String service_name, VinciServable servable, int myPriority, int myInstance) throws UnknownHostException { @@ -156,7 +179,9 @@ public class VinciServer extends BaseServer { /** * servable != null - * @param servable - + * + * @param servable + * - */ public VinciServer(VinciServable servable) { super(servable); @@ -165,6 +190,7 @@ public class VinciServer extends BaseServer { /** * Get the context associated with this server. By default clients use the global Vinci context, * though this can be overridden. + * * @return - */ public VinciContext getContext() { @@ -205,7 +231,9 @@ public class VinciServer extends BaseServer { /** * Set the VinciContext to be used by this server. Set to null if you wish the global context to * be used. - * @param c - + * + * @param c + * - */ public void setContext(VinciContext c) { context = c; @@ -280,15 +308,17 @@ public class VinciServer extends BaseServer { * you want to stop the server call shutdownServing() -- this method should have probably been * declared "protected". You can override this method if you want the shutdown message to be * ignored in certain cases. - * @param shutdown_message - + * + * @param shutdown_message + * - * @return - */ public boolean shutdown(String shutdown_message) { // Override this method if shutdown is to be ignored in certain cases (by returning // false). Default implementation unconditionally halts serving, // and hence always returns true. - Debug.printDebuggingMessage("VinciServer.shutdown()", "Accepted shutdown request: " - + shutdown_message); + Debug.printDebuggingMessage("VinciServer.shutdown()", + "Accepted shutdown request: " + shutdown_message); new Thread(new Runnable() { @Override public void run() { @@ -306,17 +336,20 @@ public class VinciServer extends BaseServer { /** * @return - - * @throws ServiceDownException - - * @throws VNSException - + * @throws ServiceDownException + * - + * @throws VNSException + * - * @throws IllegalStateException * if VNS host isn't specified. */ protected int getPort() throws ServiceDownException, VNSException { try { VinciContext myContext = getContext(); - ServeonResult response = (ServeonResult) VinciClient.sendAndReceive(ServeonResult - .composeQuery(serviceName, hostName, priority, instance), myContext.getVNSHost(), - myContext.getVNSPort(), ServeonResult.factory, myContext.getVNSServeonTimeout()); + ServeonResult response = (ServeonResult) VinciClient.sendAndReceive( + ServeonResult.composeQuery(serviceName, hostName, priority, instance), + myContext.getVNSHost(), myContext.getVNSPort(), ServeonResult.factory, + myContext.getVNSServeonTimeout()); return response.port; } catch (IOException e) { Debug.reportException(e); diff --git a/jVinci/src/main/java/org/apache/vinci/transport/XTalkTransporter.java b/jVinci/src/main/java/org/apache/vinci/transport/XTalkTransporter.java index 4015cc0..1dafcb6 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/XTalkTransporter.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/XTalkTransporter.java @@ -49,8 +49,10 @@ public class XTalkTransporter implements FrameTransporter { /** * Parse the data-stream according to the XTalk protocol. * - * @param is input stream - * @param f frame + * @param is + * input stream + * @param f + * frame * @return If the first tag belongs to the Vinci namespace, then this tag/value combination is * returned. Otherwise returns null. Should there be a non-null return, then the value * object of the KeyValuePair can be either FrameLeaf or Frame. @@ -76,12 +78,15 @@ public class XTalkTransporter implements FrameTransporter { * * @pre is != null * @pre f != null - - * @param is input stream - * @param f frame + * + * @param is + * input stream + * @param f + * frame * @return the key value pair - * @throws IOException if the versions don't match, or have unexpected element marker - * */ + * @throws IOException + * if the versions don't match, or have unexpected element marker + */ public KeyValuePair fromStreamWork(InputStream is, Frame f) throws IOException { return fromStreamWork(is, f, new byte[128], new char[128]); } @@ -90,8 +95,8 @@ public class XTalkTransporter implements FrameTransporter { throws IOException { int version = is.read(); if ((byte) version != VERSION_CODE) { - throw new IOException("Xtalk version code doesn't match " + (int) VERSION_CODE + ": " - + version); + throw new IOException( + "Xtalk version code doesn't match " + (int) VERSION_CODE + ": " + version); } int top_field_count = readInt(is); // Skip over intro PI's. @@ -119,8 +124,10 @@ public class XTalkTransporter implements FrameTransporter { /** * - * @param is the input stream - * @throws IOException passthru + * @param is + * the input stream + * @throws IOException + * passthru * * @pre is != null */ @@ -140,8 +147,10 @@ public class XTalkTransporter implements FrameTransporter { /** * - * @param is the input stream - * @throws IOException passthru + * @param is + * the input stream + * @throws IOException + * passthru * * @pre is != null */ @@ -152,12 +161,17 @@ public class XTalkTransporter implements FrameTransporter { /** * - * @param is the input stream - * @param f frame - * @param buffer - - * @param cbuffer - - * @return key value - * @throws IOException passthru + * @param is + * the input stream + * @param f + * frame + * @param buffer + * - + * @param cbuffer + * - + * @return key value + * @throws IOException + * passthru * * @pre is != null * @pre f != null @@ -190,12 +204,17 @@ public class XTalkTransporter implements FrameTransporter { /** * - * @param is the input stream - * @param f the Frame - * @param buffer - - * @param cbuffer - + * @param is + * the input stream + * @param f + * the Frame + * @param buffer + * - + * @param cbuffer + * - * @return key value - * @throws IOException passthru + * @throws IOException + * passthru * * @pre is != null * @pre f != null @@ -246,13 +265,20 @@ public class XTalkTransporter implements FrameTransporter { /** * - * @param is input stream - * @param f frame - * @param field_count field count - * @param marker marker - * @param buffer - - * @param cbuffer - - * @throws IOException passthru + * @param is + * input stream + * @param f + * frame + * @param field_count + * field count + * @param marker + * marker + * @param buffer + * - + * @param cbuffer + * - + * @throws IOException + * passthru * * @pre is != null * @pre f != null @@ -300,8 +326,10 @@ public class XTalkTransporter implements FrameTransporter { /** * - * @param is input stream - * @throws IOException an EOFException if number to be skipped is bigger than the stream + * @param is + * input stream + * @throws IOException + * an EOFException if number to be skipped is bigger than the stream * * @pre is != null */ @@ -322,9 +350,11 @@ public class XTalkTransporter implements FrameTransporter { * Consume a string from the input stream. TODO: Make a faster version that exploits work buffers * to reduce allocations to a single string object. * - * @param is input stream + * @param is + * input stream * @return the string - * @throws IOException if key is longer than limit + * @throws IOException + * if key is longer than limit * * @pre is != null */ @@ -358,12 +388,18 @@ public class XTalkTransporter implements FrameTransporter { /** * Consume the string of bytesToRead utf-8 bytes. assumes buffers are big enough to hold * bytesToRead bytes/chars - * @param is input stream - * @param byteBuf a byte buffer - * @param charBuf a character buffer - * @param bytesToRead the number of bytes to read + * + * @param is + * input stream + * @param byteBuf + * a byte buffer + * @param charBuf + * a character buffer + * @param bytesToRead + * the number of bytes to read * @return the length of the converted characters - * @throws IOException passthru + * @throws IOException + * passthru */ static public int consumeCharacters(InputStream is, byte[] byteBuf, char[] charBuf, int bytesToRead) throws IOException { @@ -373,9 +409,12 @@ public class XTalkTransporter implements FrameTransporter { /** * - * @param is input stream - * @param f frame - * @throws IOExcetion if the key length is too large + * @param is + * input stream + * @param f + * frame + * @throws IOExcetion + * if the key length is too large * * @pre is != null * @pre f != null @@ -393,9 +432,12 @@ public class XTalkTransporter implements FrameTransporter { public static final byte[] HEADER = { DOCUMENT_MARKER, VERSION_CODE, 0, 0, 0, 1, ELEMENT_MARKER }; /** - * @param os output stream - * @param f frame - * @throws IOException passthru + * @param os + * output stream + * @param f + * frame + * @throws IOException + * passthru * @pre os != null * @pre f != null */ @@ -414,10 +456,14 @@ public class XTalkTransporter implements FrameTransporter { /** * - * @param os output stream - * @param f frame - * @param workbuf - - * @throws IOException passthru + * @param os + * output stream + * @param f + * frame + * @param workbuf + * - + * @throws IOException + * passthru * * @pre os != null * @pre f != null @@ -458,9 +504,13 @@ public class XTalkTransporter implements FrameTransporter { /** * Sends a string over, without the type byte. - * @param str the string to send - * @param os the output stream - * @throws IOException passthru + * + * @param str + * the string to send + * @param os + * the output stream + * @throws IOException + * passthru * * @pre str != null * @pre os != null @@ -474,10 +524,15 @@ public class XTalkTransporter implements FrameTransporter { /** * Sends a string as utf8, using the temporary buffer if it is big enough to avoid allocating new * memory. - * @param str the string to send - * @param os the output stream - * @param buffer a buffer - * @throws IOException passthru + * + * @param str + * the string to send + * @param os + * the output stream + * @param buffer + * a buffer + * @throws IOException + * passthru */ static public void stringToBin(String str, OutputStream os, byte[] buffer) throws IOException { byte[] newbuf; @@ -525,9 +580,12 @@ public class XTalkTransporter implements FrameTransporter { /** * - * @param write_me the integer to write - * @param out the output stream - * @throws IOException passthru + * @param write_me + * the integer to write + * @param out + * the output stream + * @throws IOException + * passthru * * @pre out != null */ @@ -540,9 +598,11 @@ public class XTalkTransporter implements FrameTransporter { /** * - * @param in the input stream + * @param in + * the input stream * @return the integer - * @throws IOException if any of the pieces read are negative + * @throws IOException + * if any of the pieces read are negative * * @pre in != null */ @@ -559,9 +619,12 @@ public class XTalkTransporter implements FrameTransporter { /** * - * @param b the byte array to read into - * @param in the input stream - * @throws IOException passthru + * @param b + * the byte array to read into + * @param in + * the input stream + * @throws IOException + * passthru * * @pre b != null * @pre in != null @@ -583,10 +646,14 @@ public class XTalkTransporter implements FrameTransporter { /** * - * @param os the output stream - * @param attributes attributes - * @param workbuf a working buffer - * @throws IOException passthru + * @param os + * the output stream + * @param attributes + * attributes + * @param workbuf + * a working buffer + * @throws IOException + * passthru * * @pre os != null * @pre attributes != null diff --git a/jVinci/src/main/java/org/apache/vinci/transport/context/VinciContext.java b/jVinci/src/main/java/org/apache/vinci/transport/context/VinciContext.java index 09e949f..03df0af 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/context/VinciContext.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/context/VinciContext.java @@ -113,7 +113,7 @@ public class VinciContext { private String host; private int port; - + private boolean socketKeepAliveEnabled = true; static class CachedVNSResult { @@ -150,8 +150,10 @@ public class VinciContext { /** * @pre myport ≥ 0 * @pre myport < 65536 - * @param myhost - - * @param myport - + * @param myhost + * - + * @param myport + * - */ public VinciContext(String myhost, int myport) { this.host = myhost; @@ -167,7 +169,7 @@ public class VinciContext { * Otherwise, you can set the hostname using the setVNSHost() method provided by this class. * * @return - - * @throws IllegalStateException + * @throws IllegalStateException * if the VNS host has not been specified. */ public String getVNSHost() { @@ -187,6 +189,7 @@ public class VinciContext { * System.setProperty("VNS_PORT", [hostname]) before ever invoking any Vinci client code. * Otherwise, the port will default to 9000. You can override this default (or any * property-specified value) by calling the setPort() method provided by this class. + * * @return - */ public int getVNSPort() { @@ -195,7 +198,9 @@ public class VinciContext { /** * Set the VNS hostname. - * @param h - + * + * @param h + * - */ public void setVNSHost(String h) { host = h; @@ -207,7 +212,8 @@ public class VinciContext { * * @pre port ≥ 0 * @pre port < 65536 - * @param p - + * @param p + * - */ public void setVNSPort(int p) { port = p; @@ -217,6 +223,7 @@ public class VinciContext { /** * Returns whether clients can use stale resolve cache entries for service location in the event * VNS is unreachable. + * * @return - */ public boolean areStaleLookupsAllowed() { @@ -226,7 +233,9 @@ public class VinciContext { /** * Set whether clients can use stale resolve cache entries for service location in the event VNS * is unreachable. Default is true. - * @param b - + * + * @param b + * - */ public void setAllowStaleLookups(boolean b) { allowStaleLookups = b; @@ -234,6 +243,7 @@ public class VinciContext { /** * Get the time-to-live of cached service locators (resolve results). + * * @return - */ public int getResolveCacheTTL() { @@ -243,7 +253,9 @@ public class VinciContext { /** * Set the time-to-live of cached service locators (resolve results). Default is 1 minute. Set to * 0 to disable caching completely. - * @param millis - + * + * @param millis + * - */ public void setResolveCacheTTL(int millis) { ttlMillis = millis; @@ -251,6 +263,7 @@ public class VinciContext { /** * Get the timeout setting of VNS resolve queries. + * * @return - */ public int getVNSResolveTimeout() { @@ -259,7 +272,9 @@ public class VinciContext { /** * Set the timeout of VNS resolve queries. Default is 20 seconds. - * @param millis - + * + * @param millis + * - */ public void setVNSResolveTimeout(int millis) { vnsResolveTimeout = millis; @@ -267,6 +282,7 @@ public class VinciContext { /** * Get the timeout setting of VNS serveon queries. + * * @return - */ public int getVNSServeonTimeout() { @@ -275,14 +291,17 @@ public class VinciContext { /** * Set the timeout of VNS serveon queries. Default is 60 seconds. - * @param millis - + * + * @param millis + * - */ public void setVNSServeonTimeout(int millis) { vnsServeonTimeout = millis; } - + /** * Returns whether socket keepAlive is enabled. + * * @see java.net.Socket#setKeepAlive(boolean) * @return - */ @@ -291,16 +310,19 @@ public class VinciContext { } /** - * Set whether socket keepAlive is enabled. Default is true. + * Set whether socket keepAlive is enabled. Default is true. + * * @see java.net.Socket#setKeepAlive(boolean) - * @param b - + * @param b + * - */ public void setSocketKeepAliveEnabled(boolean b) { socketKeepAliveEnabled = b; - } + } /** * Get the global VinciContext used by Vinci classes when no context is explicitly specified. + * * @return - */ static public VinciContext getGlobalContext() { @@ -310,7 +332,8 @@ public class VinciContext { /** * Get a cached resolve result (if any). * - * @param serviceName - + * @param serviceName + * - * @return the cached resolve result, or null if none is cached. * * @pre serviceName != null @@ -329,7 +352,8 @@ public class VinciContext { /** * Get a cached resolve result (if any), but allow returning stale cache entries. * - * @param serviceName - + * @param serviceName + * - * @return the cached resolve result, or null if none is cached. * * @pre serviceName != null @@ -347,8 +371,10 @@ public class VinciContext { * * @pre serviceName != null * @pre r != null - * @param serviceName - - * @param r - + * @param serviceName + * - + * @param r + * - */ synchronized public void cacheResolveResult(String serviceName, ResolveResult r) { CachedVNSResult c = (CachedVNSResult) vnsCache.get(serviceName); @@ -365,7 +391,8 @@ public class VinciContext { * Flush any cache entries pertaining to the specified service. * * @pre serviceName != null - * @param serviceName - + * @param serviceName + * - */ synchronized public void flushFromCache(String serviceName) { vnsCache.remove(serviceName); @@ -380,14 +407,21 @@ public class VinciContext { * * @see org.apache.vinci.transport.VinciClient * - * @param in - - * @param service_name - - * @param factory - + * @param in + * - + * @param service_name + * - + * @param factory + * - * @return - - * @throws IOException - - * @throws ServiceException - - * @throws ServiceDownException - - * @throws VNSException - + * @throws IOException + * - + * @throws ServiceException + * - + * @throws ServiceDownException + * - + * @throws VNSException + * - * @throws IllegalStateException * if the VNS host has not been specified. * @@ -396,8 +430,8 @@ public class VinciContext { * @pre factory != null */ public Transportable sendAndReceive(Transportable in, String service_name, - TransportableFactory factory) throws IOException, ServiceException, ServiceDownException, - VNSException { + TransportableFactory factory) + throws IOException, ServiceException, ServiceDownException, VNSException { VinciClient tempClient = new VinciClient(service_name, factory, this); try { return tempClient.sendAndReceive(in); @@ -411,13 +445,19 @@ public class VinciContext { * * @see org.apache.vinci.transport.VinciClient * - * @param in - - * @param service_name - - * @param factory - - * @param socket_timeout - + * @param in + * - + * @param service_name + * - + * @param factory + * - + * @param socket_timeout + * - * @return - - * @throws IOException - - * @throws ServiceException - + * @throws IOException + * - + * @throws ServiceException + * - * @throws IllegalStateException * if the VNS host has not been specified. * @@ -445,15 +485,22 @@ public class VinciContext { * * @see org.apache.vinci.transport.VinciClient * - * @param in - - * @param service_name - - * @param factory - - * @param socket_timeout - - * @param connect_timeout - + * @param in + * - + * @param service_name + * - + * @param factory + * - + * @param socket_timeout + * - + * @param connect_timeout + * - * @return - - * @throws IOException - - * @throws ServiceException - - * @throws IllegalStateException + * @throws IOException + * - + * @throws ServiceException + * - + * @throws IllegalStateException * if the VNS host has not been specified. * * @pre in != null @@ -478,21 +525,27 @@ public class VinciContext { * * @see org.apache.vinci.transport.VinciClient * - * @param in - - * @param service_name - + * @param in + * - + * @param service_name + * - * @return - - * @throws IOException - - * @throws ServiceException - - * @throws ServiceDownException - - * @throws VNSException - + * @throws IOException + * - + * @throws ServiceException + * - + * @throws ServiceDownException + * - + * @throws VNSException + * - * @throws IllegalStateException * if the VNS host has not been specified. * * @pre in != null * @pre service_name != null */ - public VinciFrame rpc(Transportable in, String service_name) throws IOException, - ServiceException, ServiceDownException, VNSException { + public VinciFrame rpc(Transportable in, String service_name) + throws IOException, ServiceException, ServiceDownException, VNSException { VinciClient tempClient = new VinciClient(service_name, this); try { return tempClient.rpc(in); @@ -506,14 +559,21 @@ public class VinciContext { * * @see org.apache.vinci.transport.VinciClient * - * @param in - - * @param service_name - - * @param timeout - + * @param in + * - + * @param service_name + * - + * @param timeout + * - * @return - - * @throws IOException - - * @throws ServiceException - - * @throws ServiceDownException - - * @throws VNSException - + * @throws IOException + * - + * @throws ServiceException + * - + * @throws ServiceDownException + * - + * @throws VNSException + * - * @throws IllegalStateException * if the VNS host has not been specified. * @@ -521,8 +581,8 @@ public class VinciContext { * @pre service_name != null * @pre timeout ≥ 0 */ - public VinciFrame rpc(Transportable in, String service_name, int timeout) throws IOException, - ServiceException, ServiceDownException, VNSException { + public VinciFrame rpc(Transportable in, String service_name, int timeout) + throws IOException, ServiceException, ServiceDownException, VNSException { VinciClient tempClient = new VinciClient(service_name, this); tempClient.setSocketTimeout(timeout); try { @@ -540,15 +600,23 @@ public class VinciContext { * * @see org.apache.vinci.transport.VinciClient * - * @param in - - * @param service_name - - * @param socket_timeout - - * @param connect_timeout - + * @param in + * - + * @param service_name + * - + * @param socket_timeout + * - + * @param connect_timeout + * - * @return - - * @throws IOException - - * @throws ServiceException - - * @throws ServiceDownException - - * @throws VNSException - + * @throws IOException + * - + * @throws ServiceException + * - + * @throws ServiceDownException + * - + * @throws VNSException + * - * @throws IllegalStateException * if the VNS host has not been specified. * @@ -557,8 +625,8 @@ public class VinciContext { * @pre timeout ≥ 0 */ public VinciFrame rpc(Transportable in, String service_name, int socket_timeout, - int connect_timeout) throws IOException, ServiceException, ServiceDownException, - VNSException { + int connect_timeout) + throws IOException, ServiceException, ServiceDownException, VNSException { VinciClient tempClient = new VinciClient(service_name, this, connect_timeout); tempClient.setSocketTimeout(socket_timeout); try { diff --git a/jVinci/src/main/java/org/apache/vinci/transport/document/AFrame.java b/jVinci/src/main/java/org/apache/vinci/transport/document/AFrame.java index 0e860b2..1e61091 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/document/AFrame.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/document/AFrame.java @@ -72,6 +72,7 @@ public class AFrame extends VinciFrame { /** * Get a TransportableFactory that creates new AFrames. + * * @return - */ static public TransportableFactory getAFrameFactory() { @@ -84,7 +85,8 @@ public class AFrame extends VinciFrame { /** * @pre capacity ≥ 0 - * @param capacity - + * @param capacity + * - */ public AFrame(int capacity) { super(capacity); @@ -94,7 +96,8 @@ public class AFrame extends VinciFrame { * Create an AFrame that is a (deep) copy of the given transportable. * * @pre t != null - * @param t - + * @param t + * - * @return - */ public static AFrame toAFrame(Transportable t) { @@ -166,7 +169,8 @@ public class AFrame extends VinciFrame { * * @param key * The key to be associated with the value. - * @param val - + * @param val + * - * @return The (empty) set of attributes associated with the added key. * * @pre key != null @@ -182,7 +186,8 @@ public class AFrame extends VinciFrame { * * @param key * The key to be associated with the value. - * @param val - + * @param val + * - * @return The (empty) set of attributes associated with the added key. * * @pre key != null @@ -201,7 +206,8 @@ public class AFrame extends VinciFrame { * * @param key * The key to be associated with the value. - * @param val - + * @param val + * - * @return The (empty) set of attributes associated with the added key. * * @pre key != null @@ -432,18 +438,24 @@ public class AFrame extends VinciFrame { * @pre in != null * @pre service_name != null * - * @param in - - * @param service_name - + * @param in + * - + * @param service_name + * - * @return - - * @throws IOException - - * @throws ServiceException - - * @throws ServiceDownException - - * @throws VNSException - + * @throws IOException + * - + * @throws ServiceException + * - + * @throws ServiceDownException + * - + * @throws VNSException + * - * @throws IllegalStateException * if VNS_HOST is not specified. */ - static public AFrame rpc(Transportable in, String service_name) throws IOException, - ServiceException, ServiceDownException, VNSException { + static public AFrame rpc(Transportable in, String service_name) + throws IOException, ServiceException, ServiceDownException, VNSException { return (AFrame) VinciClient.sendAndReceive(in, service_name, getAFrameFactory()); } @@ -452,21 +464,28 @@ public class AFrame extends VinciFrame { * @pre service_name != null * @pre socket_timeout ≥ 0 * - * @param in - - * @param service_name - - * @param socket_timeout - + * @param in + * - + * @param service_name + * - + * @param socket_timeout + * - * @return - - * @throws IOException - - * @throws ServiceException - - * @throws ServiceDownException - - * @throws VNSException - + * @throws IOException + * - + * @throws ServiceException + * - + * @throws ServiceDownException + * - + * @throws VNSException + * - * @throws IllegalStateException * if VNS_HOST is not specified. */ static public AFrame rpc(Transportable in, String service_name, int socket_timeout) throws IOException, ServiceException, ServiceDownException, VNSException { - return (AFrame) VinciClient - .sendAndReceive(in, service_name, getAFrameFactory(), socket_timeout); + return (AFrame) VinciClient.sendAndReceive(in, service_name, getAFrameFactory(), + socket_timeout); } /** @@ -474,26 +493,34 @@ public class AFrame extends VinciFrame { * @pre service_name != null * @pre socket_timeout ≥ 0 * - * WARNING: This method relies on JDK-1.4 specific functions. USE IT ONLY if you don't need to - * maintain JDK1.3 compatability. - * - * @param in - - * @param service_name - - * @param socket_timeout - - * @param connect_timeout - + * WARNING: This method relies on JDK-1.4 specific functions. USE IT ONLY if you don't need + * to maintain JDK1.3 compatability. + * + * @param in + * - + * @param service_name + * - + * @param socket_timeout + * - + * @param connect_timeout + * - * @return - - * @throws IOException - - * @throws ServiceException - - * @throws ServiceDownException - - * @throws VNSException - + * @throws IOException + * - + * @throws ServiceException + * - + * @throws ServiceDownException + * - + * @throws VNSException + * - * @throws IllegalStateException * if VNS_HOST is not specified. */ static public AFrame rpc(Transportable in, String service_name, int socket_timeout, - int connect_timeout) throws IOException, ServiceException, ServiceDownException, - VNSException { - return (AFrame) VinciClient.sendAndReceive(in, service_name, getAFrameFactory(), - socket_timeout, connect_timeout); + int connect_timeout) + throws IOException, ServiceException, ServiceDownException, VNSException { + return (AFrame) VinciClient.sendAndReceive(in, service_name, getAFrameFactory(), socket_timeout, + connect_timeout); } /* @@ -505,20 +532,18 @@ public class AFrame extends VinciFrame { * VinciFrame, thus we can use the standard "fadd()" methods to create the // attribute list. * f.aadd("KEY", "value1") // Add XML element and retrieve the attribute list object * .fadd("attr1", "aval1") // Add an attribute for the tag. .fadd("attr2", "aval2") // Add another - * attribute for the tag. .fadd("attr3", "you get the point"); - * // Note that with fadd() you can potentially create a duplicate attribute (an XML no-no), // - * so the "idiot proof" method is to instead use fset(): f.aadd("VALUELESS_KEY") // Add a - * valueless tag that has a couple of attributes .fset("foo", "bar") .fset("foo2", 2) .fset("foo", - * "replaced bar"); - * // Here's how to create a nested AFrame: AFrame nested = new AFrame(); - * nested.aadd("NESTED_KEY", 1234.567) .fadd("nested", "attribute"); f.aadd("NESTED_FRAME", - * nested) .fadd("attributename", new int[] {1,2,3}); - * // We can use either fadd() or aadd() to add attributeless tags, though fadd is // preferrable - * since it avoids creating the attributes object. nested.fadd("ATTRIBUTELESS_KEY", "done with - * fadd()"); nested.aadd("ANOTHER_ATTRIBUTELESS_KEY", "done with aadd()"); - * - * System.out.println(f.toXML()); System.out.println(); - * // Querying key values: String foo_value = f.aget("VALUELESS_KEY").fgetString("foo"); + * attribute for the tag. .fadd("attr3", "you get the point"); // Note that with fadd() you can + * potentially create a duplicate attribute (an XML no-no), // so the "idiot proof" method is to + * instead use fset(): f.aadd("VALUELESS_KEY") // Add a valueless tag that has a couple of + * attributes .fset("foo", "bar") .fset("foo2", 2) .fset("foo", "replaced bar"); // Here's how to + * create a nested AFrame: AFrame nested = new AFrame(); nested.aadd("NESTED_KEY", 1234.567) + * .fadd("nested", "attribute"); f.aadd("NESTED_FRAME", nested) .fadd("attributename", new int[] + * {1,2,3}); // We can use either fadd() or aadd() to add attributeless tags, though fadd is // + * preferrable since it avoids creating the attributes object. nested.fadd("ATTRIBUTELESS_KEY", + * "done with fadd()"); nested.aadd("ANOTHER_ATTRIBUTELESS_KEY", "done with aadd()"); + * + * System.out.println(f.toXML()); System.out.println(); // Querying key values: String foo_value = + * f.aget("VALUELESS_KEY").fgetString("foo"); * System.out.println("Attribute value of foo from VALUELESS_KEY: " + foo_value); * System.out.println("TEST: " + toAFrame(f).toXML()); } */ diff --git a/jVinci/src/main/java/org/apache/vinci/transport/document/XMLToVinci.java b/jVinci/src/main/java/org/apache/vinci/transport/document/XMLToVinci.java index f4d0a56..b09891e 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/document/XMLToVinci.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/document/XMLToVinci.java @@ -54,10 +54,12 @@ public class XMLToVinci { try { spf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); } catch (SAXNotRecognizedException | SAXNotSupportedException - | ParserConfigurationException e) { - System.err.println("Warning: SAXParserFactory didn't recognized the feature http://apache.org/xml/features/disallow-doctype-decl"); + | ParserConfigurationException e) { + System.err.println( + "Warning: SAXParserFactory didn't recognized the feature http://apache.org/xml/features/disallow-doctype-decl"); } } + /** * Utility class not intended to be instantiated. */ @@ -258,7 +260,7 @@ public class XMLToVinci { public static VinciFrame xmlToVinciFrame(Reader r) throws ServiceException { XMLReader xr; try { - synchronized(spf) { + synchronized (spf) { xr = spf.newSAXParser().getXMLReader(); } } catch (SAXException e) { @@ -271,9 +273,11 @@ public class XMLToVinci { try { xr.setFeature("http://xml.org/sax/features/namespaces", false); } catch (SAXNotRecognizedException e) { - System.err.println("Warning: XMLReader didn't recognize the feature http://xml.org/sax/features/namespaces"); + System.err.println( + "Warning: XMLReader didn't recognize the feature http://xml.org/sax/features/namespaces"); } catch (SAXNotSupportedException e) { - System.err.println("Warning: XMLReader doesn't support the feature http://xml.org/sax/features/namespaces"); + System.err.println( + "Warning: XMLReader doesn't support the feature http://xml.org/sax/features/namespaces"); } VinciFrameHandler handler = new VinciFrameHandler(); xr.setContentHandler(handler); @@ -292,7 +296,7 @@ public class XMLToVinci { * public static AFrame xmlToAFrame(Reader r) throws ServiceException { return (AFrame) * xmlToTransportable(r, new AFrame()); } */ - + /** * Convert the XML document (provided as a Reader) to the AFrame document model. Throws * ServiceException if the XML parser reports any error. WARNING: This method will silently ignore diff --git a/jVinci/src/main/java/org/apache/vinci/transport/document/XMLToXTalk.java b/jVinci/src/main/java/org/apache/vinci/transport/document/XMLToXTalk.java index 7f5956c..2c6cf0e 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/document/XMLToXTalk.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/document/XMLToXTalk.java @@ -197,19 +197,26 @@ public class XMLToXTalk { * representation of that data. If xml_filename is non-null, then this method will also create a * UTF-8 representation of the xml file, exactly mimicing the XTalk encoding (e.g. removing * irrelevant whitespace, expanding entity refs, etc). - * @param r - - * @param filename - - * @param purgeWhitespace - - * @param xml_filename - - * @throws ServiceException - - * @throws IOException - + * + * @param r + * - + * @param filename + * - + * @param purgeWhitespace + * - + * @param xml_filename + * - + * @throws ServiceException + * - + * @throws IOException + * - */ public static void xmlToXTalk(Reader r, String filename, boolean purgeWhitespace, String xml_filename) throws ServiceException, IOException { Writer xml_os = null; if (xml_filename != null) { - xml_os = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(xml_filename), - StandardCharsets.UTF_8)); + xml_os = new BufferedWriter( + new OutputStreamWriter(new FileOutputStream(xml_filename), StandardCharsets.UTF_8)); } File file = new File(filename); OutputStream os = new BufferedOutputStream(new FileOutputStream(file)); @@ -224,9 +231,11 @@ public class XMLToXTalk { try { spf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); } catch (SAXNotRecognizedException e) { - System.err.println("Warning: SAXParserFactory didn't recognized feature http://apache.org/xml/features/disallow-doctype-decl"); + System.err.println( + "Warning: SAXParserFactory didn't recognized feature http://apache.org/xml/features/disallow-doctype-decl"); } catch (SAXNotSupportedException e) { - System.err.println("Warning: SAXParserFactory doesn't support feature http://apache.org/xml/features/disallow-doctype-decl"); + System.err.println( + "Warning: SAXParserFactory doesn't support feature http://apache.org/xml/features/disallow-doctype-decl"); } xr = spf.newSAXParser().getXMLReader(); } catch (SAXException e) { @@ -296,10 +305,11 @@ public class XMLToXTalk { static private void skipString(RandomAccessFile raf) throws IOException { final int count = raf.readInt(); // Debug.p("Skipping string of size: " + count); - final int skipped = raf.skipBytes(count); + final int skipped = raf.skipBytes(count); if (count != skipped) { - throw new RuntimeException(String.format("%d bytes skipped when %d was requested, while reading from stream %s", - skipped, count, raf)); + throw new RuntimeException( + String.format("%d bytes skipped when %d was requested, while reading from stream %s", + skipped, count, raf)); } } diff --git a/jVinci/src/main/java/org/apache/vinci/transport/document/XTalkToSAX.java b/jVinci/src/main/java/org/apache/vinci/transport/document/XTalkToSAX.java index b4dc86d..a5c7f1d 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/document/XTalkToSAX.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/document/XTalkToSAX.java @@ -68,6 +68,7 @@ public class XTalkToSAX { * determine the size of these arrays with this method. This method in conjunction with * resetBuffers lets application implement their own buffer management. Buffers can be reset * during parsing, but not from another thread. + * * @return - */ public int bufferSize() { @@ -78,7 +79,9 @@ public class XTalkToSAX { * Resets buffers to their initial size... this is useful because buffers can grow during parsing * and this allows the space to be reclaimed without having to undo references to the parser * object. - * @param toSize - + * + * @param toSize + * - */ public void resizeBuffers(int toSize) { if (this.byteBuffer.length != toSize) { @@ -93,8 +96,10 @@ public class XTalkToSAX { * the document. Use bufferSize() and resizeBuffers to manage memory in applications where very * large strings may be encountered and the same object is used to parse many incoming documents. * - * @param is - - * @param handler - + * @param is + * - + * @param handler + * - * @throws IOException * if underlying IOException from the stream or if XTalk format is invalid. * @throws SAXException diff --git a/jVinci/src/main/java/org/apache/vinci/transport/util/Base64Converter.java b/jVinci/src/main/java/org/apache/vinci/transport/util/Base64Converter.java index 2d1950f..129cc28 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/util/Base64Converter.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/util/Base64Converter.java @@ -48,7 +48,8 @@ public class Base64Converter { /** * @pre from != null - * @param from - + * @param from + * - * @return - */ static public byte[] convertBinaryToBase64(byte[] from) { @@ -57,19 +58,22 @@ public class Base64Converter { /** * @pre convert_me != null - * @param convert_me - + * @param convert_me + * - * @return - */ - + static public String convertStringToBase64String(String convert_me) { return new String(convertBinaryToBase64(convert_me.getBytes())); } /** * @pre base64 != null - * @param base64 - + * @param base64 + * - * @return - - * @throws Base64FormatException - + * @throws Base64FormatException + * - */ static public String convertBase64StringToString(String base64) throws Base64FormatException { return new String(convertBase64ToBinary(base64.getBytes())); @@ -77,9 +81,12 @@ public class Base64Converter { /** * @pre count ≤ from.length - * @param from - - * @param count - - * @param line_breaks - + * @param from + * - + * @param count + * - + * @param line_breaks + * - * @return - */ static public byte[] convertBinaryToBase64(byte[] from, final int count, boolean line_breaks) { @@ -115,8 +122,11 @@ public class Base64Converter { /** * Calculates the size of the resulting Base64 string returned by this class for a binary byte * array of the specified length. Includes carriage returns and all. - * @param input_size - - * @param line_breaks - + * + * @param input_size + * - + * @param line_breaks + * - * @return - */ static public int calculateBase64OutputSize(int input_size, boolean line_breaks) { @@ -135,9 +145,11 @@ public class Base64Converter { /** * @pre input != null - * @param input - + * @param input + * - * @return - - * @throws Base64FormatException - + * @throws Base64FormatException + * - */ static public byte[] convertBase64ToBinary(byte[] input) throws Base64FormatException { return convertBase64ToBinary(input, input.length); @@ -146,10 +158,13 @@ public class Base64Converter { /** * @pre input != null * @pre input_size ≤ input.length - * @param input - - * @param input_size - + * @param input + * - + * @param input_size + * - * @return - - * @throws Base64FormatException - + * @throws Base64FormatException + * - */ static public byte[] convertBase64ToBinary(byte[] input, final int input_size) throws Base64FormatException { @@ -169,10 +184,13 @@ public class Base64Converter { * * @pre input != null * @pre input_size ≤ input.length - * @param input - - * @param input_size - + * @param input + * - + * @param input_size + * - * @return - - * @throws Base64FormatException - + * @throws Base64FormatException + * - */ static public int calculateBinaryOutputSize(byte[] input, final int input_size) throws Base64FormatException { diff --git a/jVinci/src/main/java/org/apache/vinci/transport/util/StreamMaterializer.java b/jVinci/src/main/java/org/apache/vinci/transport/util/StreamMaterializer.java index e295515..0807ac5 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/util/StreamMaterializer.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/util/StreamMaterializer.java @@ -40,9 +40,11 @@ public class StreamMaterializer { * Bring the entire contents of the provided stream into a memory-resident byte array. Does NOT * close the stream. * - * @param input_stream - + * @param input_stream + * - * @return - - * @throws IOException - + * @throws IOException + * - * @exception IOException * thrown by the input stream. * @pre input_stream != null diff --git a/jVinci/src/main/java/org/apache/vinci/transport/util/UTFConverter.java b/jVinci/src/main/java/org/apache/vinci/transport/util/UTFConverter.java index 6d10229..47d40b5 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/util/UTFConverter.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/util/UTFConverter.java @@ -42,11 +42,13 @@ public class UTFConverter { * @param bytearr * Array of bytes. * @return float. - * @throws UTFDataFormatException if the UTF-8 is encoded improperly - * @throws NumberFormatException if conversion to a number can't be done + * @throws UTFDataFormatException + * if the UTF-8 is encoded improperly + * @throws NumberFormatException + * if conversion to a number can't be done */ - static public float convertUTFToFloat(byte[] bytearr) throws UTFDataFormatException, - NumberFormatException { + static public float convertUTFToFloat(byte[] bytearr) + throws UTFDataFormatException, NumberFormatException { return Float.parseFloat(UTFConverter.convertUTFToString(bytearr)); } @@ -56,11 +58,13 @@ public class UTFConverter { * @param bytearr * Array of bytes. * @return double. - * @throws UTFDataFormatException if the UTF-8 is encoded improperly - * @throws NumberFormatException if conversion to a number can't be done + * @throws UTFDataFormatException + * if the UTF-8 is encoded improperly + * @throws NumberFormatException + * if conversion to a number can't be done */ - static public double convertUTFToDouble(byte[] bytearr) throws UTFDataFormatException, - NumberFormatException { + static public double convertUTFToDouble(byte[] bytearr) + throws UTFDataFormatException, NumberFormatException { return Double.parseDouble(UTFConverter.convertUTFToString(bytearr)); } @@ -70,7 +74,8 @@ public class UTFConverter { * @param bytearr * Array of bytes. * @return boolean. - * @throws UTFDataFormatException if the UTF-8 is encoded improperly + * @throws UTFDataFormatException + * if the UTF-8 is encoded improperly */ static public boolean convertUTFToBool(byte[] bytearr) throws UTFDataFormatException { return TRUE_VALUE.equals(UTFConverter.convertUTFToString(bytearr)); @@ -82,11 +87,13 @@ public class UTFConverter { * @param bytearr * Array of bytes. * @return int. - * @throws UTFDataFormatException if the UTF-8 is encoded improperly - * @throws NumberFormatException if conversion to a number can't be done + * @throws UTFDataFormatException + * if the UTF-8 is encoded improperly + * @throws NumberFormatException + * if conversion to a number can't be done */ - static public int convertUTFToInt(byte[] bytearr) throws UTFDataFormatException, - NumberFormatException { + static public int convertUTFToInt(byte[] bytearr) + throws UTFDataFormatException, NumberFormatException { return Integer.parseInt(UTFConverter.convertUTFToString(bytearr)); } @@ -96,11 +103,13 @@ public class UTFConverter { * @param bytearr * Array of bytes. * @return long. - * @throws UTFDataFormatException if the UTF-8 is encoded improperly - * @throws NumberFormatException if conversion to a number can't be done + * @throws UTFDataFormatException + * if the UTF-8 is encoded improperly + * @throws NumberFormatException + * if conversion to a number can't be done */ - static public long convertUTFToLong(byte[] bytearr) throws UTFDataFormatException, - NumberFormatException { + static public long convertUTFToLong(byte[] bytearr) + throws UTFDataFormatException, NumberFormatException { return Long.parseLong(UTFConverter.convertUTFToString(bytearr)); } @@ -110,7 +119,8 @@ public class UTFConverter { * @param bytearr * Array of bytes. * @return String. - * @throws UTFDataFormatException if the UTF-8 is encoded improperly + * @throws UTFDataFormatException + * if the UTF-8 is encoded improperly */ static public String convertUTFToString(byte[] bytearr) throws UTFDataFormatException { char[] result = new char[bytearr.length]; @@ -132,10 +142,11 @@ public class UTFConverter { * @param result * Character array containing the converted characters. * @return The length of the converted characters. - * @throws UTFDataFormatException if the UTF-8 is encoded improperly + * @throws UTFDataFormatException + * if the UTF-8 is encoded improperly */ - static public int convertUTFToString(byte[] bytearr, final int beginOffset, - final int inputLength, char[] result) throws UTFDataFormatException { + static public int convertUTFToString(byte[] bytearr, final int beginOffset, final int inputLength, + char[] result) throws UTFDataFormatException { int outputLength = 0; int count = beginOffset; int c1, c2, c3; diff --git a/jVinci/src/main/java/org/apache/vinci/transport/util/XMLConverter.java b/jVinci/src/main/java/org/apache/vinci/transport/util/XMLConverter.java index e362d96..8f6af7f 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/util/XMLConverter.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/util/XMLConverter.java @@ -35,7 +35,8 @@ public class XMLConverter { * Convert to XML string format. Uses CDATA encoding if there are more than 4 characters requiring * ampersand encoding. * - * @param convert_me - + * @param convert_me + * - * @return the converted string * @pre convert_me != null */ @@ -48,7 +49,8 @@ public class XMLConverter { /** * Convert to XML string format without ever using CDATA encoding. * - * @param convert_me - + * @param convert_me + * - * @return the converted string * * @pre convert_me != null @@ -61,8 +63,10 @@ public class XMLConverter { /** * - * @param convert_me - - * @param append_to_me - + * @param convert_me + * - + * @param append_to_me + * - * * @pre convert_me != null * @pre append_to_me != null @@ -92,8 +96,10 @@ public class XMLConverter { } /** - * @param convert_me - - * @param append_to_me - + * @param convert_me + * - + * @param append_to_me + * - * * @pre convert_me != null * @pre append_to_me != null @@ -131,7 +137,8 @@ public class XMLConverter { } /** - * @param convert_me - + * @param convert_me + * - * @return - * @pre convert_me != null */ @@ -143,8 +150,10 @@ public class XMLConverter { /** * - * @param convert_me - - * @param append_to_me - + * @param convert_me + * - + * @param append_to_me + * - * * @pre convert_me != null * @pre append_to_me != null @@ -182,4 +191,3 @@ public class XMLConverter { } } // class - diff --git a/jVinci/src/main/java/org/apache/vinci/transport/vns/client/ResolveResult.java b/jVinci/src/main/java/org/apache/vinci/transport/vns/client/ResolveResult.java index b1816e3..2e19560 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/vns/client/ResolveResult.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/vns/client/ResolveResult.java @@ -54,7 +54,8 @@ public class ResolveResult extends Frame { * Strip the qualifications from this qualified service name. * * @pre service_name != null - * @param service_name - + * @param service_name + * - * @return - */ static public String unqualifiedName(String service_name) { @@ -72,7 +73,8 @@ public class ResolveResult extends Frame { * are explicitly specified.) * * @pre service_name != null - * @param service_name - + * @param service_name + * - * @return - */ static public boolean isQualified(String service_name) { @@ -87,7 +89,8 @@ public class ResolveResult extends Frame { * accepts either qualified or unqualified service names. * * @pre service_name != null - * @param service_name - + * @param service_name + * - * @return - */ static public Frame composeQuery(String service_name) { @@ -128,8 +131,10 @@ public class ResolveResult extends Frame { * unqualified service names. * * @pre service_name != null - * @param service_name - - * @param mypriority - + * @param service_name + * - + * @param mypriority + * - * @return - */ static public Frame composeQuery(String service_name, int mypriority) { @@ -159,6 +164,7 @@ public class ResolveResult extends Frame { /** * Determine if there are more service listing to be fetched. + * * @return - */ public boolean hasMore() { diff --git a/jVinci/src/main/java/org/apache/vinci/transport/vns/client/ServeonResult.java b/jVinci/src/main/java/org/apache/vinci/transport/vns/client/ServeonResult.java index 79ff795..791b0c4 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/vns/client/ServeonResult.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/vns/client/ServeonResult.java @@ -49,10 +49,14 @@ public class ServeonResult extends Frame { * @pre host_name != null * @pre priority ≥ -1 * @pre instance ≥ 0 - * @param service_name - - * @param host_name - - * @param priority - - * @param instance - + * @param service_name + * - + * @param host_name + * - + * @param priority + * - + * @param instance + * - * @return - * */ @@ -70,9 +74,12 @@ public class ServeonResult extends Frame { * @pre service_name != null * @pre host_name != null * @pre priority ≥ -1 - * @param service_name - - * @param host_name - - * @param priority - + * @param service_name + * - + * @param host_name + * - + * @param priority + * - * @return - */ static public Transportable composeQuery(String service_name, String host_name, int priority) { @@ -87,8 +94,10 @@ public class ServeonResult extends Frame { * * @pre service_name != null * @pre host_name != null - * @param service_name - - * @param host_name - + * @param service_name + * - + * @param host_name + * - * @return - */ static public Transportable composeQuery(String service_name, String host_name) { diff --git a/jVinci/src/main/java/org/apache/vinci/transport/vns/client/VNSConfig.java b/jVinci/src/main/java/org/apache/vinci/transport/vns/client/VNSConfig.java index 4fef50c..ecbfe84 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/vns/client/VNSConfig.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/vns/client/VNSConfig.java @@ -42,7 +42,7 @@ public final class VNSConfig { * if no VNS host has been specified. */ @Deprecated -public String getHost() { + public String getHost() { return VinciContext.getGlobalContext().getVNSHost(); } @@ -59,7 +59,7 @@ public String getHost() { * @deprecated Use VinciContext.getVNSPort() instead. */ @Deprecated -public int getPort() { + public int getPort() { return VinciContext.getGlobalContext().getVNSPort(); } @@ -67,11 +67,12 @@ public int getPort() { * Set the VNS hostname. Explicitly setting the VNS hostname using this method will override any * hostname set via the VNS_HOST java property. * - * @param h - + * @param h + * - * @deprecated Use VinciContext.setVNSHost() instead. */ @Deprecated -public void setHost(String h) { + public void setHost(String h) { VinciContext.getGlobalContext().setVNSHost(h); } @@ -79,11 +80,12 @@ public void setHost(String h) { * Set the VNS port. Explicitly setting the VNS hostname using this method will override any port * number set via the VNS_PORT java property. * - * @param p - + * @param p + * - * @deprecated Use VinciContext.setVNSPort() instead. */ @Deprecated -public void setPort(int p) { + public void setPort(int p) { VinciContext.getGlobalContext().setVNSPort(p); } diff --git a/jVinci/src/main/java/org/apache/vinci/transport/vns/service/NameClient.java b/jVinci/src/main/java/org/apache/vinci/transport/vns/service/NameClient.java index cd86ce4..f5caffc 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/vns/service/NameClient.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/vns/service/NameClient.java @@ -62,8 +62,8 @@ public class NameClient { static Random R = new Random(); public NameClient() { - configure(VinciContext.getGlobalContext().getVNSHost(), VinciContext.getGlobalContext() - .getVNSPort()); + configure(VinciContext.getGlobalContext().getVNSHost(), + VinciContext.getGlobalContext().getVNSPort()); } public NameClient(String host, int port) { @@ -111,8 +111,9 @@ public class NameClient { public ServiceInfo[] lookup(String name, int level, String host, String instance, String ws) { VinciFrame req = new VinciFrame(); - req.fadd("vinci:COMMAND", VNSConstants.RESOLVE_COMMAND).fadd("SERVICE", name).fadd("LEVEL", - level).fadd("HOST", host).fadd("INSTANCE", instance).fadd("WORKSPACE", ws); + req.fadd("vinci:COMMAND", VNSConstants.RESOLVE_COMMAND).fadd("SERVICE", name) + .fadd("LEVEL", level).fadd("HOST", host).fadd("INSTANCE", instance) + .fadd("WORKSPACE", ws); System.out.println(req.toXML()); VinciFrame resp = (VinciFrame) transmit(req); @@ -177,8 +178,9 @@ public class NameClient { } public ServiceInfo resolve(String name, int level) { - VinciFrame req = (VinciFrame) new VinciFrame().fadd("vinci:COMMAND", - VNSConstants.RESOLVE_COMMAND).fadd("SERVICE", name).fadd("LEVEL", level); + VinciFrame req = (VinciFrame) new VinciFrame() + .fadd("vinci:COMMAND", VNSConstants.RESOLVE_COMMAND).fadd("SERVICE", name) + .fadd("LEVEL", level); VinciFrame resp = (VinciFrame) transmit(req); @@ -393,9 +395,9 @@ public class NameClient { } } - VinciFrame out = (VinciFrame) new VinciFrame().fadd("vinci:COMMAND", - VNSConstants.SERVEON_COMMAND).fadd("SERVICE", name).fadd("HOST", host).fadd("LEVEL", - level).fadd("INSTANCE", instance); + VinciFrame out = (VinciFrame) new VinciFrame() + .fadd("vinci:COMMAND", VNSConstants.SERVEON_COMMAND).fadd("SERVICE", name) + .fadd("HOST", host).fadd("LEVEL", level).fadd("INSTANCE", instance); VinciFrame resp = (VinciFrame) transmit(out); @@ -427,8 +429,8 @@ public class NameClient { QueryableFrame L; for (int i = 0; i < S.length; i++) { L = (QueryableFrame) A.get(i); - S[i] = new ServiceInfo(name, L.fgetString("HOST"), L.fgetString("PORT"), level, L - .fgetString("INSTANCE")); + S[i] = new ServiceInfo(name, L.fgetString("HOST"), L.fgetString("PORT"), level, + L.fgetString("INSTANCE")); } return S; diff --git a/jVinci/src/main/java/org/apache/vinci/transport/vns/service/ServiceAlias.java b/jVinci/src/main/java/org/apache/vinci/transport/vns/service/ServiceAlias.java index 8fbb24f..2a0cf87 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/vns/service/ServiceAlias.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/vns/service/ServiceAlias.java @@ -50,9 +50,9 @@ public class ServiceAlias implements ServiceInterface { StringBuffer indent = new StringBuffer(offset); while (offset > 0) { indent.append(' '); - offset --; + offset--; } - + StringBuffer result = new StringBuffer(50); result = result.append(indent).append("<SERVICE>\n"); diff --git a/jVinci/src/main/java/org/apache/vinci/transport/vns/service/ServiceRegistry.java b/jVinci/src/main/java/org/apache/vinci/transport/vns/service/ServiceRegistry.java index 3da770e..efbf793 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/vns/service/ServiceRegistry.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/vns/service/ServiceRegistry.java @@ -411,9 +411,10 @@ public class ServiceRegistry { try { dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); } catch (ParserConfigurationException e) { - System.err.println("Warning: DocumentBuilderFactory doesn't support the feature http://apache.org/xml/features/disallow-doctype-decl"); + System.err.println( + "Warning: DocumentBuilderFactory doesn't support the feature http://apache.org/xml/features/disallow-doctype-decl"); } - + DocumentBuilder docBuilder = dbf.newDocumentBuilder(); Document doc; @@ -452,8 +453,8 @@ public class ServiceRegistry { H.put(C.getNodeName(), C.getFirstChild().getNodeValue()); } else { // Complex elements - H.put(C.getNodeName(), XMLToVinci.xmlToVinciFrame(new StringReader(constructXMLString(C, - true)))); + H.put(C.getNodeName(), + XMLToVinci.xmlToVinciFrame(new StringReader(constructXMLString(C, true)))); } } // End for j diff --git a/jVinci/src/main/java/org/apache/vinci/transport/vns/service/VNS.java b/jVinci/src/main/java/org/apache/vinci/transport/vns/service/VNS.java index 698fce0..03e10b8 100644 --- a/jVinci/src/main/java/org/apache/vinci/transport/vns/service/VNS.java +++ b/jVinci/src/main/java/org/apache/vinci/transport/vns/service/VNS.java @@ -225,8 +225,8 @@ public class VNS extends VinciServableAdapter { System.out.println(" Set the ServerSocket backlog [default=" + backlog + "]"); System.out.println(" -m N --maxthreads N"); - System.out.println(" Set the maximum size of the VNS thread pool [default=" + maxThreads - + "]."); + System.out.println( + " Set the maximum size of the VNS thread pool [default=" + maxThreads + "]."); System.out.println(" -h --help"); System.out.println(" This help message"); @@ -574,12 +574,8 @@ public class VNS extends VinciServableAdapter { } catch (Exception e) { // Exact translation of the Python code [may not be necessary] out = new VinciFrame(); - out - .fadd( - "vinci:ERROR", - "Critical error :\n" - + e - + "\nThe server MAY not respond to further requests.\nPlease notify the administrator\n"); + out.fadd("vinci:ERROR", "Critical error :\n" + e + + "\nThe server MAY not respond to further requests.\nPlease notify the administrator\n"); e.printStackTrace(); } @@ -650,8 +646,8 @@ public class VNS extends VinciServableAdapter { cache(name + "[" + servicesList[0].level + "]", new CachedItem(servicesList)); // Have a proxy pointer to the entry created if it is not the same if (!servicesList[0].level.equals(level)) { - cache(name + "[" + level + "]", new ProxyCachedItem(name + "[" + servicesList[0].level - + "]")); + cache(name + "[" + level + "]", + new ProxyCachedItem(name + "[" + servicesList[0].level + "]")); } } } else @@ -797,8 +793,8 @@ public class VNS extends VinciServableAdapter { } VinciFrame resolve(VinciFrame in) { - logRequest(VNSConstants.RESOLVE_COMMAND, in.fgetString("vinci:REMOTEIP"), in - .fgetString("SERVICE")); + logRequest(VNSConstants.RESOLVE_COMMAND, in.fgetString("vinci:REMOTEIP"), + in.fgetString("SERVICE")); if (in.fgetString("WORKSPACE") == null) { return resolveDefaults(in); @@ -916,10 +912,8 @@ public class VNS extends VinciServableAdapter { public void run() { Debug.p("Trying to shutdown old service ..."); VinciFrame shutdown = new VinciFrame(); - shutdown - .fadd( - "vinci:SHUTDOWN", - "Identical service started on this host. Use the INSTANCE tag to run multiple instances of the same service on a single host."); + shutdown.fadd("vinci:SHUTDOWN", + "Identical service started on this host. Use the INSTANCE tag to run multiple instances of the same service on a single host."); try { VinciFrame f = BaseClient.rpc(shutdown, s_host, s_port, 10000); Debug.p("Shutdown response received: " + f.toXML()); @@ -985,8 +979,8 @@ public class VNS extends VinciServableAdapter { getFrame(false, "Malformed request"); else { synchronized (SR) { - ok = SR - .addAlias(new ServiceAlias(service.fgetString("NAME"), service.fgetString("TARGET"))); + ok = SR.addAlias( + new ServiceAlias(service.fgetString("NAME"), service.fgetString("TARGET"))); } } diff --git a/jcasgen-maven-plugin/src/main/java/org/apache/uima/tools/jcasgen/maven/JCasGenMojo.java b/jcasgen-maven-plugin/src/main/java/org/apache/uima/tools/jcasgen/maven/JCasGenMojo.java index 68a3f7c..753ea1a 100644 --- a/jcasgen-maven-plugin/src/main/java/org/apache/uima/tools/jcasgen/maven/JCasGenMojo.java +++ b/jcasgen-maven-plugin/src/main/java/org/apache/uima/tools/jcasgen/maven/JCasGenMojo.java @@ -69,8 +69,8 @@ import org.xml.sax.SAXException; */ @Mojo(name = "generate", defaultPhase = LifecyclePhase.PROCESS_RESOURCES, requiresDependencyResolution = ResolutionScope.COMPILE) public class JCasGenMojo extends AbstractMojo { - - @Parameter( defaultValue = "${project}", readonly = true ) + + @Parameter(defaultValue = "${project}", readonly = true) private MavenProject project; @Component @@ -111,7 +111,7 @@ public class JCasGenMojo extends AbstractMojo { // assemble the classpath StringBuilder classpathBuilder = new StringBuilder(); - + // Source roots for (String element : this.project.getCompileSourceRoots()) { if (classpathBuilder.length() > 0) { @@ -129,7 +129,7 @@ public class JCasGenMojo extends AbstractMojo { classpathBuilder.append(element.getDirectory()); getLog().debug("JCasGen: Adding resource root to classpath '" + element.getDirectory() + "'"); } - + // Dependencies List<String> elements; try { @@ -197,7 +197,7 @@ public class JCasGenMojo extends AbstractMojo { } finally { IOUtil.close(typeSystemOs); } - + // skip JCasGen if there are no changes in the type system file or the files it // references hasDelta resolves the imports! if (!contextDelta && !this.hasDelta(typeSystem, classpath)) { @@ -256,8 +256,8 @@ public class JCasGenMojo extends AbstractMojo { } /* - * called by the common JCasGen code when it detects an error - * If no exception, the "exception" parameter is null + * called by the common JCasGen code when it detects an error If no exception, the "exception" + * parameter is null */ @Override public void newError(int severity, String message, Exception exception) { @@ -269,7 +269,7 @@ public class JCasGenMojo extends AbstractMojo { } else if (severity == IError.ERROR) { String m = fullMessage; if (exception != null) { - m = m + "\nException: " + exception.getMessage(); + m = m + "\nException: " + exception.getMessage(); } throw new JCasGenException(m, exception); } else { @@ -360,7 +360,8 @@ public class JCasGenMojo extends AbstractMojo { } // for any type system file that is in the same project, return true if it has // changed - if (targetFile.getAbsolutePath().startsWith(this.project.getBasedir().getAbsolutePath())) { + if (targetFile.getAbsolutePath() + .startsWith(this.project.getBasedir().getAbsolutePath())) { if (this.buildContext.hasDelta(targetFile)) { this.getLog().info("Type system file " + sourceFile + " has changed"); return true; diff --git a/jcasgen-maven-plugin/src/test/java/org/apache/uima/tools/jcasgen/maven/JCasGenMojoTest.java b/jcasgen-maven-plugin/src/test/java/org/apache/uima/tools/jcasgen/maven/JCasGenMojoTest.java index 2d49001..7dce501 100644 --- a/jcasgen-maven-plugin/src/test/java/org/apache/uima/tools/jcasgen/maven/JCasGenMojoTest.java +++ b/jcasgen-maven-plugin/src/test/java/org/apache/uima/tools/jcasgen/maven/JCasGenMojoTest.java @@ -35,8 +35,8 @@ import org.junit.Test; public class JCasGenMojoTest extends AbstractMojoTestCase { - @Test - public void testInvalidFeature() throws Exception { + @Test + public void testInvalidFeature() throws Exception { Exception ee = null; try { this.test("invalidFeature"); @@ -44,38 +44,40 @@ public class JCasGenMojoTest extends AbstractMojoTestCase { ee = e; } assertTrue(ee != null); - assertEquals("JCasGen: The feature name 'type', specified in Type 'type.span.Sentence' is reserved. Please choose another name.", ee.getMessage()); + assertEquals( + "JCasGen: The feature name 'type', specified in Type 'type.span.Sentence' is reserved. Please choose another name.", + ee.getMessage()); } - - @Test - public void testSimple() throws Exception { + + @Test + public void testSimple() throws Exception { this.test("simple", "type.span.Sentence", "type.span.Token", "type.relation.Dependency"); } - @Test - public void testClasspath() throws Exception { + @Test + public void testClasspath() throws Exception { this.test("classpath", "type.span.Sentence", "type.span.Token", "type.relation.Dependency"); } - @Test - public void testWildcard() throws Exception { + @Test + public void testWildcard() throws Exception { this.test("wildcard", "type.span.Sentence", "type.span.Token"); } - @Test - public void testExclude() throws Exception { + @Test + public void testExclude() throws Exception { this.test("exclude", "type.span.Sentence"); } - @Test - public void test(String projectName, String... types) throws Exception { + @Test + public void test(String projectName, String... types) throws Exception { File projectSourceDirectory = getTestFile("src/test/resources/" + projectName); File projectDirectory = getTestFile("target/project-" + projectName + "-test"); // Stage project to target folder FileUtils.copyDirectoryStructure(projectSourceDirectory, projectDirectory); - + File pomFile = new File(projectDirectory, "/pom.xml"); assertNotNull(pomFile); assertTrue(pomFile.exists()); @@ -92,7 +94,7 @@ public class JCasGenMojoTest extends AbstractMojoTestCase { if (source.exists()) { FileUtils.copyDirectoryStructure(source, new File(project.getBuild().getOutputDirectory())); } - + // load the Mojo JCasGenMojo generate = (JCasGenMojo) this.lookupConfiguredMojo(project, "generate"); assertNotNull(generate); @@ -105,7 +107,7 @@ public class JCasGenMojoTest extends AbstractMojoTestCase { // check that the Java files have been generated File jCasGenDirectory = new File(project.getBasedir(), "target/generated-sources/jcasgen"); - + // Record all the files that were generated DirectoryScanner ds = new DirectoryScanner(); ds.setBasedir(jCasGenDirectory); @@ -115,20 +117,20 @@ public class JCasGenMojoTest extends AbstractMojoTestCase { for (String scannedFile : ds.getIncludedFiles()) { files.add(new File(ds.getBasedir(), scannedFile)); } - + for (String type : types) { File wrapperFile = new File(jCasGenDirectory + "/" + type.replace('.', '/') + ".java"); // no _type files in v3 -// File typeFile = new File(jCasGenDirectory + "/" + type.replace('.', '/') + "_Type.java"); - + // File typeFile = new File(jCasGenDirectory + "/" + type.replace('.', '/') + "_Type.java"); + Assert.assertTrue(files.contains(wrapperFile)); // no _type files in v3 -// Assert.assertTrue(files.contains(typeFile)); - + // Assert.assertTrue(files.contains(typeFile)); + files.remove(wrapperFile); -// files.remove(typeFile); + // files.remove(typeFile); } - + // check that no extra files were generated Assert.assertTrue(files.isEmpty());
