com.neeve.toa.service
Class ToaService

java.lang.Object
  extended by com.neeve.toa.service.ToaService

public class ToaService
extends Object

Models a Topic Oriented Application service.


Field Summary
protected static Tracer _tracer
           
static String PROP_PREFIX_CHANNEL_NAMES
          Runtime property name to override whether or not channel names are prefixed with their service name.
 
Constructor Summary
ToaService(Date lastModified, String namespace, String name, boolean prefixChannelNames)
           
 
Method Summary
 void addMessageModel(com.neeve.adm.AdmModel model)
          Adds an ADM model to this service.
 boolean equals(Object other)
          Returns true if the provided object is a ToaService with the same fully qualified name.
 boolean equals(ToaService other)
          Returns true if the provided service has the same fully qualified name.
 Collection<com.neeve.adm.AdmFactory> getAdmFactories()
          Returns the collection of factories used by the service.
 Collection<ToaServiceChannel> getChannels()
          Returns the collection of channels defined for the service The caller should not modify the returned collection.
 ToaServiceChannel getDefaultChannel()
           
 Date getLastModified()
          Returns the last modification time for this service.
 Collection<com.neeve.adm.AdmModel> getMessageModels()
          Returns the collection of ADM Message models declared by the service.
 String getName()
          Returns the fully qualified name of this service.
 String getNameSpace()
          Returns the service's namespace.
 String getSimpleName()
          Returns the service's simple name.
 ToaServiceToRole getToRole(String roleName)
          Looks up a 'To' role by name.
 Collection<ToaServiceToRole> getToRoles()
          Returns the collection of 'To' roles defined for the service The caller should not modify the returned collection.
 int hashCode()
          The hashCode for a ToaService is the same as the hashcode for its fully qualifed name.
 boolean isPrefixChannelNames()
           
 String toString()
           
static ToaService unmarshal(URL url)
          Unmarshals a toa service model from the service xml at the given url.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

PROP_PREFIX_CHANNEL_NAMES

public static final String PROP_PREFIX_CHANNEL_NAMES
Runtime property name to override whether or not channel names are prefixed with their service name.

When an application uses multiple services there is a risk that channels with the same in two different services would conflict with one another. To reduce the chances of this happening the service xml defaults to prefixing the channel name with the service name. For example consider teh following two service definition snippets:

 <Service xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
            xmlns="http://www.neeveresearch.com/schema/x-tsml" 
            namespace="com.neeve.toa.example.orders" 
            name="OrderProcessorService">
     <Models>
       <Model file="com/neeve/toa/example/orders/orderMessages.xml"/>
     </Models>
     <Channels>
       <Channel name="Rejects" key="orderprocessing/rejects"/>
     </Channels>
     <Messages>
     </Messages>
   </Service>
     
 
and
 <Service xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
            xmlns="http://www.neeveresearch.com/schema/x-tsml" 
            namespace="com.neeve.toa.example.shipping" 
            name="ShippingService">
     <Models>
       <Model file="com/neeve/toa/example/orders/shippingMessages.xml"/>
     </Models>
     <Channels>
       <Channel name="Rejects" key="shipping/rejects"/>
     </Channels>
   </Service>
     
 
In the above case both services define a channel named 'Rejects' which map to different underling topics. To avoid a conflict between the 2 channels, Hornet, by default will prefix the channel names with the unqualified service name in lower case so that one ends up with:

Property name: "nv.toa.prefixchannelnames"
Default value: Value read from service definition.

See Also:
Constant Field Values

_tracer

protected static final Tracer _tracer
Constructor Detail

ToaService

public ToaService(Date lastModified,
                  String namespace,
                  String name,
                  boolean prefixChannelNames)
Method Detail

getLastModified

public Date getLastModified()
Returns the last modification time for this service.

Returns:
The last modification time of the service (or the time this class was created if unkown);

addMessageModel

public void addMessageModel(com.neeve.adm.AdmModel model)
Adds an ADM model to this service.

Parameters:
model - The model to add.

getSimpleName

public String getSimpleName()
Returns the service's simple name.

Returns:
The service's unqualified name.

getNameSpace

public String getNameSpace()
Returns the service's namespace.

Returns:
The service's namespace.

getName

public String getName()
Returns the fully qualified name of this service.

Returns:
The service's fully qualified name.

getDefaultChannel

public ToaServiceChannel getDefaultChannel()
Returns:
The default 'To' channel for this service.

isPrefixChannelNames

public boolean isPrefixChannelNames()
Returns:
True if channels defined in this service should prefix their names with the lowercase, unqualified name of the service.

getMessageModels

public Collection<com.neeve.adm.AdmModel> getMessageModels()
Returns the collection of ADM Message models declared by the service.

The caller should not modify the returned collection.

Returns:
The service's ADM messaging models

getAdmFactories

public Collection<com.neeve.adm.AdmFactory> getAdmFactories()
Returns the collection of factories used by the service.

The caller should not modify the returned collection.

Returns:
The ADM factories used by the service.

getChannels

public Collection<ToaServiceChannel> getChannels()
Returns the collection of channels defined for the service

The caller should not modify the returned collection.

Returns:
The collection of channels defined for the service

getToRoles

public Collection<ToaServiceToRole> getToRoles()
Returns the collection of 'To' roles defined for the service

The caller should not modify the returned collection.

Returns:
The collection of 'To' roles defined for the service

getToRole

public ToaServiceToRole getToRole(String roleName)
Looks up a 'To' role by name.

Parameters:
roleName - the role name.
Returns:
The role for the given name or null if none exists.

equals

public boolean equals(Object other)
Returns true if the provided object is a ToaService with the same fully qualified name.

Overrides:
equals in class Object
Parameters:
other - the object with which to compare.

hashCode

public int hashCode()
The hashCode for a ToaService is the same as the hashcode for its fully qualifed name.

Overrides:
hashCode in class Object

equals

public final boolean equals(ToaService other)
Returns true if the provided service has the same fully qualified name.

Parameters:
other - the object with which to compare.

unmarshal

public static final ToaService unmarshal(URL url)
                                  throws Exception
Unmarshals a toa service model from the service xml at the given url.

Parameters:
url - The url pointing to an
Returns:
An unmarshalled ToaService
Throws:
Exception - If there is an error unmarshalling the xml.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.