es.upv.dsic.gti_ia.trace
Class TracingEntity

java.lang.Object
  extended by es.upv.dsic.gti_ia.trace.TracingEntity
All Implemented Interfaces:
Serializable

public class TracingEntity
extends Object
implements Serializable

Definition of Tracing Entity TODO: Artifacts and aggregations are not yet supported far beyond the constants defined in the class

Author:
L Burdalo (lburdalo@dsic.upv.es)
See Also:
Serialized Form

Field Summary
static int AGENT
          Constant to identify the tracing entity as an agent
static int AGGREGATION
          Constant to identify the tracing entity as an agent
static int ARTIFACT
          Constant to identify the tracing entity as an agent
 
Constructor Summary
TracingEntity()
          Constructor which creates an empty tracing entity, with its type attribute set to -1, its aid set to null and without published tracing services nor subscriptions
TracingEntity(int type, AgentID aid)
          Constructor which creates a new tracing entity without published tracing services nor subscriptions.
 
Method Summary
 boolean addSubscription(TracingServiceSubscription newSubscription)
          Add a new subscription to the tracing entity
 AgentID getAid()
          Get the AgentID of the tracing entity
 TracingServiceList getPublishedTS()
          Get the list of tracing services published by the tracing entity
 TracingServiceSubscriptionList getSubscribedToTS()
          Get the list of subscriptions made by the tracing entity
 int getType()
          Get the type of the tracing entity
 boolean hasTheSameAidAs(AgentID aid)
          Determine if a tracing entity has the same AgentID as the specified
 boolean removeSubscription(TracingServiceSubscription TSSubscription)
          Remove a tracing service subscription from the list
 int setType(int type)
          Set the type of the tracing entity
 String toReadableString()
          Converts the identifying data of the tracing entity to a human readable string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AGENT

public static final int AGENT
Constant to identify the tracing entity as an agent

See Also:
Constant Field Values

ARTIFACT

public static final int ARTIFACT
Constant to identify the tracing entity as an agent

See Also:
Constant Field Values

AGGREGATION

public static final int AGGREGATION
Constant to identify the tracing entity as an agent

See Also:
Constant Field Values
Constructor Detail

TracingEntity

public TracingEntity()
Constructor which creates an empty tracing entity, with its type attribute set to -1, its aid set to null and without published tracing services nor subscriptions


TracingEntity

public TracingEntity(int type,
                     AgentID aid)
Constructor which creates a new tracing entity without published tracing services nor subscriptions.

Only agents are supported; so, if the tracing entity is an artifact or an aggregation, aid is set to null

Method Detail

getType

public int getType()
Get the type of the tracing entity

Returns:
Type of the tracing entity: AGENT, ARTIFACT or AGGREGATION

getAid

public AgentID getAid()
Get the AgentID of the tracing entity

Returns:
AgentID of the tracing entity if it is an agent or null otherwise

getPublishedTS

public TracingServiceList getPublishedTS()
Get the list of tracing services published by the tracing entity

Returns:
List of published tracing services
See Also:
TracingService, TracingServiceList

getSubscribedToTS

public TracingServiceSubscriptionList getSubscribedToTS()
Get the list of subscriptions made by the tracing entity

Returns:
List of subscriptions
See Also:
TracingServiceSubscription, TracingServiceSubscriptionList

setType

public int setType(int type)
Set the type of the tracing entity

Parameters:
type - Allowed types are AGENT, ARTIFACT and AGGREGATION}
Returns:
Returns -1 if the type is not valid or 0 otherwise

addSubscription

public boolean addSubscription(TracingServiceSubscription newSubscription)
Add a new subscription to the tracing entity

Parameters:
newSubscription - TracingServiceSubscription to be added to the list

removeSubscription

public boolean removeSubscription(TracingServiceSubscription TSSubscription)
Remove a tracing service subscription from the list

Parameters:
TSSubscription - Subscription to be removed
Returns:
Return values:

0 : Success. The tracing service subscription has been removed from the end of the list

-1 : Internal values of the list are not correct. There is something really wrong if this happens :-S

-2 : Subscription not found

See Also:
TracingServiceSubscriptionList

hasTheSameAidAs

public boolean hasTheSameAidAs(AgentID aid)
Determine if a tracing entity has the same AgentID as the specified

Parameters:
aid - AgentID to compare with the tracing entity
Returns:
Returns true if the tracing entity is an agent and has the same AgentID as the one specified in the parameters or false otherwise.

toReadableString

public String toReadableString()
Converts the identifying data of the tracing entity to a human readable string. The present version only supports agents; so, the method will return null if invoked for a different tracing entity type.

Returns:
String with identifying information in human readable format or null if the tracing entity is an artifact or an aggregation.
See Also:
AgentID.toString()


Copyright © 2012 GTI-IA. All Rights Reserved.