guarana.framework.process
Class Process

java.lang.Object
  extended by guarana.util.observer.smart.SmartObservable
      extended by guarana.framework.process.Process
All Implemented Interfaces:
ISource, ITaskContainer, guarana.util.observer.smart.ISmartObserver

public class Process
extends guarana.util.observer.smart.SmartObservable
implements ITaskContainer, ISource

Processes serve two purposes, namely: there are processes that allow to wrap applications and processes that allow to integrate them. The former are reusable processes that endow an application with a message-oriented API that simplifies interacting with it. Implementing such a wrapping process may range from using a JDBC driver to interact with a database to implementing a scrapper that emulates the behaviour of a person who interacts with a user interface. Generally speaking, this is known as wrapping an application in the literature.
Integration processes, on the contrary, are intended to orchestrate the interactions with a number of wrapping processes and other integration processes.
Processes rely on tasks to perform their wrapping or their orchestration activities. Simply put, a process can be viewed as a message processor.


Graphical notation:


Since:
Guaranį SDK 1.0.0
Author:
Rafael Z. Frantz

Constructor Summary
Process(String name)
          Constructs a new process with a given name.
 
Method Summary
 Port addPort(Port port)
          Adds a port to this process.
 Task addTask(Task task)
          Adds a given task to this task container.
 boolean containsPort(String name)
          Checks if this process contains a specific port.
 boolean containsTask(String name)
          Searches for a given task name inside this task container.
 int countTask()
          Counts the tasks inside this task container.
 Collection<Port> getAllPorts()
          Returns all ports from this process.
 Collection<Task> getAllTasks()
          Returns all tasks inside this task container.
 Map<String,EntryPort> getEntryPorts()
          Returns all EntryPorts from the current process.
 Map<String,ExitPort> getExitPorts()
          Returns all ExitPorts from the current process.
 String getName()
          Returns the name of this source.
 Port getPort(String name)
          Returns an specific port from this process.
 Map<String,ResponderPort> getResponderPorts()
          Returns all ResponderPorts from the current process.
 Map<String,SolicitorPort> getSolicitorPorts()
          Returns all solicitor ports from the current process.
 Task getTask(String name)
          Searches for a task with a given name inside this task container.
 boolean hasEntryPort()
          Checks if this process has any EntryPort.
 boolean hasExitPort()
          Checks if this process has any ExitPort.
 boolean hasResponderPort()
          Checks if this process has any ResponderPort.
 boolean hasSolicitorPort()
          Checks if this process has any solicitor port.
 Port removePort(String name)
          Removes a port from this process.
 Task removeTask(String name)
          Removes a given task from this task container.
 void setName(String name)
          Sets the name of this source.
 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

Process

public Process(String name)
Constructs a new process with a given name.

Parameters:
name - The name of this process.
Method Detail

addPort

public Port addPort(Port port)
             throws InvalidParameterException
Adds a port to this process.

Parameters:
port - The port to be added.
Returns:
a previous port already added to this process if the new one has the same name. The new port replaces the old one.
Throws:
InvalidParameterException - if this method receives a null port.

removePort

public Port removePort(String name)
Removes a port from this process.

Parameters:
name - The name of the port.
Returns:
the removed port.

containsPort

public boolean containsPort(String name)
Checks if this process contains a specific port.

Parameters:
name - The name of the port.
Returns:
True if this process contains the port; otherwise, False.

hasEntryPort

public boolean hasEntryPort()
Checks if this process has any EntryPort.

Returns:
True if there is at least one EntryPort; otherwise, False.

hasExitPort

public boolean hasExitPort()
Checks if this process has any ExitPort.

Returns:
True if there is at least one ExitPort; otherwise, False.

hasResponderPort

public boolean hasResponderPort()
Checks if this process has any ResponderPort.

Returns:
True if there is at least one ResponderPort; otherwise, False.

hasSolicitorPort

public boolean hasSolicitorPort()
Checks if this process has any solicitor port.

Returns:
True if there is at least one solicitor port; otherwise, False.

setName

public void setName(String name)
Sets the name of this source.

Specified by:
setName in interface ISource
Specified by:
setName in interface guarana.util.observer.smart.ISmartObserver
Parameters:
name - The name of this source.

getName

public String getName()
Returns the name of this source.

Specified by:
getName in interface ISource
Specified by:
getName in interface guarana.util.observer.smart.ISmartObserver
Returns:
the name of this source.

getPort

public Port getPort(String name)
Returns an specific port from this process.

Parameters:
name - The name of the port.
Returns:
the port or null if there is no port associated with the given name.

getEntryPorts

public Map<String,EntryPort> getEntryPorts()
Returns all EntryPorts from the current process.

Returns:
a Map with all EntryPorts or an empty map if none.

getExitPorts

public Map<String,ExitPort> getExitPorts()
Returns all ExitPorts from the current process.

Returns:
a Map with all ExitPorts or an empty map if none.

getResponderPorts

public Map<String,ResponderPort> getResponderPorts()
Returns all ResponderPorts from the current process.

Returns:
a Map with all ResponderPorts or an empty map if none.

getSolicitorPorts

public Map<String,SolicitorPort> getSolicitorPorts()
Returns all solicitor ports from the current process.

Returns:
a Map with all solicitor ports or an empty map if none.

getAllPorts

public Collection<Port> getAllPorts()
Returns all ports from this process.

Returns:
a collection with all ports.

addTask

public Task addTask(Task task)
             throws InvalidParameterException
Adds a given task to this task container.

Specified by:
addTask in interface ITaskContainer
Parameters:
task - The task to be added.
Returns:
the previous task already in the container if the new one has the same name or null if there is no previous task.
Throws:
InvalidParameterException - if the task parameter is null.

containsTask

public boolean containsTask(String name)
Searches for a given task name inside this task container.

Specified by:
containsTask in interface ITaskContainer
Parameters:
name - The task name to be searched.
Returns:
True if there is a corresponding task to the given name; otherwise, False.

countTask

public int countTask()
Counts the tasks inside this task container.

Specified by:
countTask in interface ITaskContainer
Returns:
the number of tasks.

getAllTasks

public Collection<Task> getAllTasks()
Returns all tasks inside this task container.

Specified by:
getAllTasks in interface ITaskContainer
Returns:
a collection with all tasks.

getTask

public Task getTask(String name)
Searches for a task with a given name inside this task container.

Specified by:
getTask in interface ITaskContainer
Parameters:
name - The task name.
Returns:
the task associated with the given name or null if none.

removeTask

public Task removeTask(String name)
Removes a given task from this task container.

Specified by:
removeTask in interface ITaskContainer
Parameters:
name - The name of the task to remove.
Returns:
the removed task or null if there is no task associated with this name.

update

public void update(guarana.util.observer.smart.SmartObservable obj,
                   Object task)
            throws IllegalStateException
This method is automatically called by the observable task to notify the task is ready to be executed. Please, do not call this method by yourself.

Specified by:
update in interface guarana.util.observer.smart.ISmartObserver
Parameters:
obj - THIS PARAMETHER IS NOT USED.
task - The observable task.
Throws:
IllegalStateException


Guaranį DSL Home