Jumpi v1.2.0

org.jumpi.impl
Class AbstractDestination

java.lang.Object
  |
  +--org.jumpi.impl.AbstractDestination
All Implemented Interfaces:
Destination, Destination
Direct Known Subclasses:
DestinationImpl, DummyDestination, HttpDestination, LoopbackDestination

public abstract class AbstractDestination
extends java.lang.Object
implements Destination

General implementation of a generic Destination based on a simple String Url.


Field Summary
protected  Connector connector_
          The Connector associated with the Destination.
protected  Controller controller_
          The Controller associated with the Destination.
protected  java.util.Hashtable props_
          Internal properties associated with the Destination.
protected  java.lang.String url_
          The Destination's Url.
protected  boolean wildcard_
          Whether the Destination is a wildcard Destination.
 
Fields inherited from interface org.jumpi.Destination
PROTOCOL_SEPARATOR, SEPARATOR
 
Constructor Summary
AbstractDestination(java.lang.String url)
          Creates a new AbstractDestination object.
AbstractDestination(java.lang.String url, Controller controller, Connector connector, boolean wildcard)
          Creates a new AbstractDestination object.
 
Method Summary
 boolean equals(java.lang.Object o)
          Whether the Destination's Urls are equal.
 Connector getConnector()
          Return the Connector associated with the Destination.
 Controller getController()
          Return the Controller associated with the Destination.
 java.lang.String getControllerName()
          Return the fully qualified name of the Controller associated with the Destination.
 java.util.Hashtable getProperties()
          Return the internal properties associated with the Destination.
abstract  java.lang.String getUrl()
          Return the Destination's Url.
 int hashCode()
          The hashcode of the Destination's Url, since the equality function is based on the Url.
 boolean isWildcard()
           Whether the Destination instance represents a set of individual Destinations.
 boolean matches(Destination dest)
          Default implementation matches a wildcard Destination with any other specific Destination.
 void setProperties(java.util.Hashtable props)
          Set the internal properties associated with the Destination.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

url_

protected java.lang.String url_
The Destination's Url.


props_

protected java.util.Hashtable props_
Internal properties associated with the Destination.


controller_

protected Controller controller_
The Controller associated with the Destination.


connector_

protected Connector connector_
The Connector associated with the Destination.


wildcard_

protected boolean wildcard_
Whether the Destination is a wildcard Destination.

Constructor Detail

AbstractDestination

public AbstractDestination(java.lang.String url)
Creates a new AbstractDestination object.

Parameters:
url - the Url.

AbstractDestination

public AbstractDestination(java.lang.String url,
                           Controller controller,
                           Connector connector,
                           boolean wildcard)
Creates a new AbstractDestination object.

Parameters:
url - the Url.
controller - the Controller.
connector - the Connector.
wildcard - whether the Destination is a wildcard Destination.
Throws:
java.lang.IllegalArgumentException - if url is null.
Method Detail

getControllerName

public java.lang.String getControllerName()
Return the fully qualified name of the Controller associated with the Destination. If no Controller is associated then return null.

Specified by:
getControllerName in interface Destination
Returns:
the fully qualified name of the Destination's Controller, or null if no Controller exists.

getUrl

public abstract java.lang.String getUrl()
Return the Destination's Url.

Specified by:
getUrl in interface Destination
Returns:
the Destination's Url.

getProperties

public java.util.Hashtable getProperties()
Return the internal properties associated with the Destination.

Specified by:
getProperties in interface Destination
Returns:
the internal properties associated with the Destination, or null if not existing.
See Also:
setProperties(java.util.Hashtable)

setProperties

public void setProperties(java.util.Hashtable props)
Set the internal properties associated with the Destination.

Parameters:
props - the internal properties associated with the Destination. May be null.
See Also:
getProperties()

getController

public Controller getController()
Return the Controller associated with the Destination.

Specified by:
getController in interface Destination
Returns:
the Controller associated with the Destination.

getConnector

public Connector getConnector()
Return the Connector associated with the Destination.

Specified by:
getConnector in interface Destination
Returns:
the Connector associated with the Destination.

isWildcard

public boolean isWildcard()

Whether the Destination instance represents a set of individual Destinations. Wildcard Destinations may match more than one unique destination.

The matches(org.jumpi.spi.Destination) method is used to determine if this wildcard Destination instance matches a non wildcard destination. Wildcard destinations are never matched against themselves.

Destination equality is determined through the equals method of a Destination Url Destination.getUrl(). This is possible since the Destination Url's are normalized.

Specified by:
isWildcard in interface Destination
Returns:
true if this instance is a wildcard Destination.

matches

public boolean matches(Destination dest)
Default implementation matches a wildcard Destination with any other specific Destination.

Specified by:
matches in interface Destination
Parameters:
dest - the other Destination.
Returns:
true if this instance is wildcard, otherwise true only if the other Url is equal to this instance's.
See Also:
Destination.isWildcard()

equals

public boolean equals(java.lang.Object o)
Whether the Destination's Urls are equal.

Overrides:
equals in class java.lang.Object
Parameters:
o - the other object.
Returns:
true if the other object is a Destination with an equal Url.

hashCode

public int hashCode()
The hashcode of the Destination's Url, since the equality function is based on the Url.

Overrides:
hashCode in class java.lang.Object
Returns:
the hashcode of the Destination's Url.

Jumpi v1.2.0

Copyright 2003, Peter Jonathan Klauser.