|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectguarana.util.observer.smart.SmartObservable
guarana.framework.port.Port
public abstract class Port
A generic communication port. A port is to abstract away from the details required to interact
with an application or with a process. Note that an application is usually composed of several layers, and that
usually one or more of them are available, e.g., data layer, data access layer, business logic layer, or user
interface layer. Ports can be either entry, exit, solicitor or responder ports, depending on whether they were
designed to read messages from a process or an application, or to write messages to them, and to respond or query
an application for data.
Note that ports usually need to transform the messages they transfer, which implies that they are composed of tasks,
as well. This implies that they also need slots to help their tasks work as much asynchronously as possible.
Another subtle implication is that there must be a slot to communicate a task in a port to a task in the process
to which the port belongs. We refer to such slots interslots.
Constructor Summary | |
---|---|
Port(String name)
Constructs a new port with the given name. |
|
Port(String name,
Process process)
Constructs a port with the given name and associates it with the given process. |
Method Summary | |
---|---|
void |
addPreScheduledTask(Task task)
Adds a trigger task as a pre-scheduled task to this task reporter. |
Task |
addTask(Task task)
Adds a given task to this task container. |
boolean |
containsPreScheduledTasks()
Checks if this object contains a pre-scheduled task. |
boolean |
containsTask(String name)
Searches for a given task name inside this task container. |
int |
countTask()
Counts the tasks inside this task container. |
Collection<Task> |
getAllTasks()
Returns all tasks inside this task container. |
Task |
getCommunicator()
Returns the communicator for this port. |
String |
getName()
Returns the name of this source. |
Process |
getProcess()
Return this process to which belongs this port. |
Task |
getTask(String name)
Searches for a task with a given name inside this task container. |
void |
initialise()
A syntactic sugar method to create anonymous classes for this port. |
List<Task> |
pollPreScheduledTasks()
Polls all pre-scheduled tasks from this object. |
Task |
removeTask(String name)
Removes a given task from this task container. |
void |
setCommunicator(Task communicator)
Sets the communicator for this port. |
void |
setName(String name)
Sets the name of this source. |
void |
setProcess(Process process)
Sets this process to which belongs this port. |
void |
update(guarana.util.observer.smart.SmartObservable obj,
Object task)
This method is automatically called by the observable task to notify the task is ready to be executed. |
Methods inherited from class guarana.util.observer.smart.SmartObservable |
---|
addSmartObserver, containsSmartObserver, containsSmartObserver, countSmartObservers, deleteSmartObserver, deleteSmartObservers, hasChanged, notifySmartObservers, notifySmartObservers |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Port(String name)
name
- The name of this new port.public Port(String name, Process process)
name
- The name of this new port.process
- The process to which the port will belong.Method Detail |
---|
public void initialise()
public void addPreScheduledTask(Task task)
task
- The trigger task to pre-schedulepublic boolean containsPreScheduledTasks()
public List<Task> pollPreScheduledTasks()
public Process getProcess()
public void setProcess(Process process)
process
- The process.public void setName(String name)
setName
in interface ISource
setName
in interface guarana.util.observer.smart.ISmartObserver
name
- The name of this source.public String getName()
getName
in interface ISource
getName
in interface guarana.util.observer.smart.ISmartObserver
public Task addTask(Task task) throws InvalidParameterException
addTask
in interface ITaskContainer
task
- The task to be added.
null
if there is no previous task.
InvalidParameterException
- if the task parameter is null
.public boolean containsTask(String name)
containsTask
in interface ITaskContainer
name
- The task name to be searched.
public int countTask()
countTask
in interface ITaskContainer
public Collection<Task> getAllTasks()
getAllTasks
in interface ITaskContainer
public Task getTask(String name)
getTask
in interface ITaskContainer
name
- The task name.
null
if none.public Task removeTask(String name)
removeTask
in interface ITaskContainer
name
- The name of the task to remove.
null
if there is no task associated with this name.public void setCommunicator(Task communicator) throws InvalidParameterException
communicator
- The communicator task.
InvalidParameterException
- if the communicator parameter is null
.public Task getCommunicator()
public void update(guarana.util.observer.smart.SmartObservable obj, Object task) throws IllegalStateException
update
in interface guarana.util.observer.smart.ISmartObserver
obj
- THIS PARAMETHER IS NOT USED.task
- The observable task.
IllegalStateException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |