org.apache.vinci.transport.vns.client
Class ResolveResult

java.lang.Object
  extended by org.apache.vinci.transport.FrameComponent
      extended by org.apache.vinci.transport.Frame
          extended by org.apache.vinci.transport.vns.client.ResolveResult
All Implemented Interfaces:
Transportable

public class ResolveResult
extends Frame

Specialized document (Frame) for representing the result of resolving a service name to host/port through VNS. Also provides utility methods for manipulating qualified/unqualified service names. This class is used by VinciClient to locate the physical location of the requested service from its logical service name.


Nested Class Summary
static class ResolveResult.ServiceLocator
           
 
Field Summary
static TransportableFactory factory
           
 int priority
           
 
Constructor Summary
ResolveResult()
           
 
Method Summary
 void add(java.lang.String key, FrameComponent val)
          Implement the frame add() callback.
static Frame composeQuery(java.lang.String service_name)
          Create a document representing the VNS resolve query for the specified service.
static Frame composeQuery(java.lang.String service_name, int mypriority)
          Create a document representing the VNS resolve query for the highest priority service(s) whose priority is strictly below the specified priority.
 Frame createSubFrame(java.lang.String key, int capacity)
          Override the Frame createSubFrame method to create a ServiceLocator.
 ResolveResult.ServiceLocator getNext()
          Fetch the next service listing.
 boolean hasMore()
          Determine if there are more service listing to be fetched.
 void initializeIterator()
          Initialize the service listing iterator.
static boolean isQualified(java.lang.String service_name)
          Check whether a service_name has qualifications (that is, any or all of level, host, instance are explicitly specified.)
static java.lang.String unqualifiedName(java.lang.String service_name)
          Strip the qualifications from this qualified service name.
 
Methods inherited from class org.apache.vinci.transport.Frame
createFrameLeaf, fadd, fadd, fadd, fadd, fadd, fadd, fadd, fadd, fadd, fadd, fadd, fadd, fadd, fadd, faddTrueBinary, fromStream, getFrameTransporter, getKeyValuePair, getKeyValuePairCount, setFrameTransporter, toRawXML, toRawXML, toRawXMLWork, toStream, toString, toXML, toXML, toXML
 
Methods inherited from class org.apache.vinci.transport.FrameComponent
getAttributes, setAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

priority

public int priority

factory

public static TransportableFactory factory
Constructor Detail

ResolveResult

public ResolveResult()
Method Detail

unqualifiedName

public static java.lang.String unqualifiedName(java.lang.String service_name)
Strip the qualifications from this qualified service name.


isQualified

public static boolean isQualified(java.lang.String service_name)
Check whether a service_name has qualifications (that is, any or all of level, host, instance are explicitly specified.)


composeQuery

public static Frame composeQuery(java.lang.String service_name)
Create a document representing the VNS resolve query for the specified service. This method accepts either qualified or unqualified service names.


composeQuery

public static Frame composeQuery(java.lang.String service_name,
                                 int mypriority)
Create a document representing the VNS resolve query for the highest priority service(s) whose priority is strictly below the specified priority. This method accepts either qualified or unqualified service names.


initializeIterator

public void initializeIterator()
Initialize the service listing iterator. This initializes to a random spot to implement simple load balancing across multiple equivalent service instances.


hasMore

public boolean hasMore()
Determine if there are more service listing to be fetched.


getNext

public ResolveResult.ServiceLocator getNext()
Fetch the next service listing.


add

public void add(java.lang.String key,
                FrameComponent val)
Implement the frame add() callback.

Overrides:
add in class Frame
Parameters:
key - The tag name with which to associate the value.
val - The (Frame | FrameLeaf) value to associate with the tag.

createSubFrame

public Frame createSubFrame(java.lang.String key,
                            int capacity)
Override the Frame createSubFrame method to create a ServiceLocator.

Overrides:
createSubFrame in class Frame
Returns:
the created sub-frame.


Copyright © 2012. All Rights Reserved.