This article summarizes the set of design patterns. All design patterns discussed in this article are included in the SolutionGlobal Open Source project.
Solution Global is hosted at Source Forge
https://sourceforge.net/projects/solutionsglobal/
The util package contains global classes used as common shared global services.
|
Class Summary |
|
|
Comparator implementation that uses JavaBean properties to compare two objects. |
|
|
Config |
This class provides read access to key/value pairs loaded from file properties (static implementation). |
|
Cryption |
Cryption provides a set of functions to encrypting and decrypting binary and ASCII text. |
|
Debugger |
Debugger provides a set of functions to handle application logger. |
|
JavaBean |
JavaBean provides a set of functions to manage JavaBeans. |
|
Organizer |
Organizer provides a set of functions to sort, filter and find elements in container objects such as collections, arrays and maps. |
|
Presenter |
Presenter message view helper. |
|
PROXY |
PROXY provides a set of functions to execute an operation on an object |
|
Setting |
This class provides read access to key/value pairs loaded from the properties file properties (non-static implementation). |
|
Text |
Text contains common functions for text strings. |
|
TextTest |
JUNIT test case |
|
Util |
Util contains common functions and constants used by the application |
The IO package contains object to manage file system input and output.
|
Interface Summary |
|
|
Fileable |
Represents the retrieval of a file |
|
Class Summary |
|
|
AbsolutePathFileableText |
Wrapper to return the absolute path of a Fileable object's file representation |
|
BackupDirectoryExecutable |
Backup the content of given file/folder |
|
CopyDirectoryExecutable |
Copy the content of the directory |
|
DeleteExecutable |
Deletes a given file/folders |
|
FileTokenizer |
Parses tokenizer from a given file name |
|
FolderFileTokenizer |
List the folders in a given folder. |
|
FolderFileTokenizerTest |
JUNIT test case |
|
FolderFilter |
IO file filter to list folders |
|
IO |
IO provides a set function related to system IO reads/writes. |
|
SynchronizedIO |
SynchronizedIO provides a thread safe way to write files. |
|
WildCardFilter |
WildCardFilter filter used when monitor files. |
The decorator pattern is used to format output text/information.
Decoration of a certain object is done at runtime. The Textable interface is typically used within the decoration pattern. The Textable interface has a method (getText) that returns a string. The TextDecorator is a Textable. It wraps the target Textable object and adds additional text as needed.
This pattern allows multiple decorators to be stacked on top of each other, each time adding new formatting options.
|
Interface Summary |
|
|
TextDecorator |
TextDecorator interface to wrap a target object with additional text |
|
TimeIntervalDecorator |
Decorate date/time |
|
Class Summary |
|
|
MacroTextDecorator |
Macro implement for text objects |
|
MappedTextFormatDecorator |
This object using a Free Marker template API (http:// http://freemarker.org/) to format mapped. Each value in the map is Textable object. The keys are replaced in the placeholders of a given text template. |
|
ParseTextDecorator |
Decorate the Textable by parsing out a given string token. |
|
ParseTextDecoratorTest |
JUNIT test case |
|
ReplaceRegExpTextDecorator |
Replaced a given Regular Expressions in the target Textable with a given output. |
|
StringText |
Simple Textable implementation to wrap a String variable. |
|
ToStringWrapperText |
Textable implementation interface to return the toString method of a target object. |
|
XmlReflection |
Converts any object to an XML string. |
|
XmlXslDecorator |
Transforms a given XML document using XSL and returns the text output. |
ServiceFactory defines an interface for creating service components.
The service factory is a framework that supports pluggable services.
The ServiceFactory default implementation uses the Spring Core dependency injection framework to construct objects (see Spring Framework details at http://www.springsource.org/).
This package contains a set of functions to perform XML based operations.
|
Interface Summary |
|
|
XMLInterpreter |
XMLInterpreter supports object to XML conversions |
|
XMLizable |
Interface that indicates that an object has a method to convert its data into an XML text. |
|
Class Summary |
|
|
XML |
XML utility class. |
|
XmlObjectTextable |
Textable implementation to converts objects to XML. |
|
XSL |
The objects is used to perform a transformation in the simplest manner possible (3 statements). |
|
Class Summary |
|
|
XStreamInterpreter |
XStreamInterpreter is an XMLInterface implementation. It is wrapper for the xstream XML API(s) (see http://xstream.codehaus.org/) |
This design pattern allows multiple threads to service any number of tasks. Each task is an instance of the Runner interface. A worker thread takes a task from a queue and executes it. All threads take tasks from the queue until all tasks are completed.

|
Interface Summary |
|
|
Supervisor |
Supervisor manages a list of workers |
|
Worker |
Worker interface for an object managed by the supervisor thread. |
|
WorkQueue |
Contains a list of tasks (each task is a Runner implementation). |
|
WorkState |
Represents a supervisor and work threads state. |
|
Class Summary |
|
|
Boss |
Boss worker thread supervisor implementation |
|
MemorizedQueue |
MemorizedQueue is an implementation of a WorkerQueue where all tasks are held in memory. |
|
StartState |
StartState starts a worker thread if it is not alive |
|
StopState |
StopState stops a worker thread |
|
WorkerThread |
WorkerThread is a thread based implementation of a worker. |
The Executable command is used to represent an operation. These objects create instances of Executable objects using the ServiceFactory implementation object. The client of the Executable is the object MainExecutable (usually for running standalone) or WebExecutableRESTfulService (used to running via web based service) objects. These clients objects are wired with an instance of the Executable object at runtime.
FileCommand is an implementation of a command for processing files and folders.
|
Class Summary |
|
|
BackupFileCommand |
Backup the content of given file/folder |
|
ConditionFileCommand |
Execute a given file command if the boolean expression is true |
|
ConditionFileCommandTest |
JUNIT test case |
|
FileCommandRunner |
Runner implementation of a file command. |
|
FileExecutable |
File executable implementation for modifying file content |
|
FileExecutableTest |
JUNIT test case |
|
FileFormatCommand |
Read the file content and applied text formatting |
|
MacroFileCommand |
The Macro file command |
|
ParseReplaceCommand |
Parse and replace content in a given file. |
|
PdfFileCommandTest |
JUNIT Test case for PdfFileCommand. |
|
ReLookupCommand |
Uses complex regular expressions to the determine nested FileCommand to execute |
|
ReplaceIncludeRelatedFileCommand |
This class includes the text content of a related file into the given file. |
|
ReplaceWithFormattedRelatedFileCommand |
This class includes the text content of a related file into the given file (also supports text formatting). |
|
ReplaceWithFormattedRelatedFileCommandTest |
Test case for ReplaceWithFormattedRelatedFileCommand |
|
ReplaceWithTextCommand |
Overwrite the file with textable.getText(). |
|
ReReplaceCommand |
This class using regular expressions to replace content in a file. |
|
WorkerThreadFileExecutable |
Implementation of the file executable based on the worker thread design pattern |
The system uses a RESTful web service implementation of the command design pattern. The RESTful service parameters are distributed to implementations of the RESTful commands. The command to execute is specified is in an input argument (default parameter name is "cmd"). The RESTful service uses the ServiceFactory to lookup the implementation of the indicated command.
The following are the list of core RESTful service commands.
|
Class Summary |
|
|
AbstractRESTfulCommand |
Abstract implement contain useful shared functions |
|
MacroRESTfulService |
Macro command implementation to run one or more RESTful services. |
|
RESTfulServlet |
Front controller for RESTFul web based services |
|
ScriptingRESTfulService |
Scripting based RESTful web service |
|
SendMailRESTFulCommand |
Service to send email messages |
|
SendMailRESTFulCommandTest |
JUNIT test cases |
|
WebExecutableRESTfulService |
execute executable for post operations |
|
WebLockSessionRESTfulCommand |
Wrap a call to the WebLock object to synchronize access to the web application. |
|
WebReleaseLockSessionRESTfulCommand |
Wrap a call to the WebLock object to synchronize access to the web application. |
This package encapsulates the execution of embedded scripting languages. Examples of scripting languages are JRUBY, Groovy, Apache Bean Scripting Framework and Spring Framework's SPEL.
|
Interface Summary |
|
|
Scripting |
Interface for using bean scripting frameworks (such as GROOVY, SpEL, JRuby, etc) |
|
Class Summary |
|
|
SpringExecutable |
Execute a spring expression (see Spring SPEL language at http://www.springsource.org/) |
|
SpringExecutableTest |
JUNIT test |
|
SpringFramework |
Script implement to execute a spring expression (see Spring SPEL language at http://www.springsource.org/) |
This package supports application caching for performance improvements.
|
Interface Summary |
|
|
Cache |
Interface to Cache of a collection of objects |
|
Class Summary |
|
|
CacheFarm |
Implementation of a Cache that maintains objects in a map |
The LoginAction is a JSF managed bean use to authenticate users.
The LoginAction uses an implementation of an Authentication interface to validate a username/password. The Authentication implementation is instantiated by the ServiceFactory object.
An implementation of the SecurityGuard object is used to determine if an authenticated user can access a web application resource. ConfigSecurityGuard is a SecurityGuard where the list of allowed users is configured through the config.properties file. The SessionIdAppSecurityGuard is a SecurityGuard where the request's session ID must exist in the web container's application scope (note this is often useful for securing web services, such as RESTful services).
SecurityFilter is an implementation of a J2EE web Filter. It uses Security Guard to protect a given request. The implementation of the SecurityGuard is obtained from the ServiceFactory.
A application needs to update process map content from a web Admin application. The process is performed in a series of steps. Each step in the process is displayed to the users in the web browser. This gives the users an idea of the progression of the content generation.
The following collaborations diagram explains the objects that are involved in each of the content generation steps.
Figure 8 Update Content Collaboration Diagram
The following table provides additional details for each process step.
|
# |
Step |
Description |
|
|
1. |
Step 1 |
The processing begins when the WebLockSessionRESTfulCommand is initiated. This will assert that no two people can update content at the same time. The request is then initiated to the WebExecutableRESTfulService. |
|
|
2. |
Step 2 |
WebExecutableRESTfulService initiates the SpringExecutable object. This encapsulates a Spring SPEL script that calls DisprocUtil.cacheProcessDocSummary's method. |
|
|
3. |
Step 3 |
WebExecutableRESTfulService is called as the first process in step 3 to initialize any needed directories. |
|
|
4. |
Step 3 |
The WebExecutableRESTfulService calls the SpringExecutable. This includes a Spring SPEL expression to create a directory specified by the configuration property for the rotated image output path. |
|
|
5. |
Step 4 |
WebExecutableRESTfulService is called as the first process in step 4 to copy content from the share drive to a configured output directory. |
|
|
6. |
Step 4 |
MacroExecutable is called to execute a delete and copy operation on the output directory. |
|
|
7. |
Step 4 |
DeleteExecutable deletes the last generated output. The CopyDirectoryExecutable copies the share directory content to the configured output directory |
|
|
8. |
Step 5 |
WebExecutableRESTfulService is called as the first process in step 5 to process content in the output directory. |
|
|
9. |
Step 5 |
WorkThreadFileExecutable is used to process the process map, RACI, guidance documents content via the worker thread design pattern. |
|
|
10. |
Step 5 |
ReLookupCommand is used to execute one ore more File Commands. The command execution is determined if the file names matches a given regular expression in the map key. The reference FileCommand object in the value of the map is executed for each regular expression in the key of the map that matches a file name (see Spring Dependency Framework for an explanation of the XML structure).
Sample Definitions
|
|
|
11. |
Step 6 |
WebExecutableRESTfulService is called as the first process in step 6 to process print content such as the process maps.
|
|
|
12. |
Step 6 |
WorkThreadFileExecutable is used to process the process map images via the worker thread design pattern. |
|
|
13. |
Step 6 |
MacroFileCommand is used to execute the rotation of image file commands. |
|
|
14. |
Step 6 |
RotateImageFileCommand is called to copy of each process map image and turn it 90 degrees. This is used for landscape printing of the process maps. |
|
|
15. |
Step 7 |
WebExecutableRESTfulService is called as the first process in step 7 to process Q/A page. |
|
|
16. |
Step 7 |
FileExecutable is called to process the qa.html file. |
|
|
17. |
Step 7 |
The ReplaceWithTextCommand is used to add the standard Discovery Process web header, menus and footer HTML. |
|
|
18. |
Step 8 |
WebExecutableRESTfulService is called as the first process in step 8 to clean the application cache that was locked in step one. |
|
|
19. |
Step 8 |
The SpringExecutable object is called with a configured Spring SPEL expression |
|
|
20. |
Step |
The SPEL expression calls the DiscProUtil.clearCacheProcessDocSummary method. |
The user is presented with the following view when all processing is complete.