com.gridsystems.nextgrid.api.builder
Class AbstractBuilder<T>

java.lang.Object
  extended by com.gridsystems.nextgrid.api.builder.AbstractBuilder<T>
Type Parameters:
T - The type of models to build
All Implemented Interfaces:
nextgrid.api.builder.POMBuilder<T>

public abstract class AbstractBuilder<T>
extends java.lang.Object
implements nextgrid.api.builder.POMBuilder<T>

Base class for POMBuilder implementations.

Author:
Rodrigo Ruiz

Field Summary
protected  nextgrid.api.pom.ProcessFactory factory
          Factory used for creating Process instances.
protected static org.apache.commons.logging.Log LOG
          Class logger.
protected static java.lang.String NS_PROFILE
          Namespace used for attributes storing profile (semantic) information.
 
Constructor Summary
AbstractBuilder(java.lang.Class<T> modelType, java.lang.String uri)
          Creates a new instance.
 
Method Summary
protected  void addMissingRefs(nextgrid.api.pom.Process p)
          Finds out missing references and creates them.
protected  void bindInputInput(nextgrid.api.pom.Process src, nextgrid.api.pom.Process dst, java.lang.String srcParamId, java.lang.String dstParamId)
          Binds a process input to another process input through a mapping.
protected  void bindOutputInput(nextgrid.api.pom.Process src, nextgrid.api.pom.Process dst, java.lang.String srcParamId, java.lang.String dstParamId)
          Binds a process output to another process input through a reference.
protected  void bindOutputOutput(nextgrid.api.pom.Process src, nextgrid.api.pom.Process dst, java.lang.String srcParamId, java.lang.String dstParamId)
          Binds a process output to another process output through a mapping.
protected  nextgrid.api.pom.Reference<?> createRef(java.lang.Class<?> type)
          Creates a reference of the specified type.
protected  java.lang.String findMappedInputName(nextgrid.api.pom.Process p, java.lang.String name)
          Searches for a given input name into a process ascendants input mappings.
 java.lang.Class<T> getModelType()
          
 java.net.URI getURI()
          
 java.util.Collection<nextgrid.api.pom.Process> importAllFrom(java.io.InputStream is)
          
 java.util.Collection<nextgrid.api.pom.Process> importAllFrom(java.net.URI src)
          
 nextgrid.api.pom.Process importFrom(java.io.File src)
          
 nextgrid.api.pom.Process importFrom(java.io.InputStream is)
          
 nextgrid.api.pom.Process importFrom(java.net.URI src)
          
 nextgrid.api.pom.Process importFrom(java.net.URL src)
          
protected abstract  java.util.List<T> loadFrom(java.io.InputStream src)
          Loads a workflow file.
protected abstract  java.util.List<T> loadFrom(java.net.URI src)
          Loads a workflow file.
protected  void setProfileAttribute(nextgrid.api.pom.Process p, java.lang.String name, java.lang.Object value)
          Sets a process attribute within the "profile" namespace.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface nextgrid.api.builder.POMBuilder
fromPOM, toPOM
 

Field Detail

LOG

protected static final org.apache.commons.logging.Log LOG
Class logger.


NS_PROFILE

protected static final java.lang.String NS_PROFILE
Namespace used for attributes storing profile (semantic) information.

See Also:
Constant Field Values

factory

protected final nextgrid.api.pom.ProcessFactory factory
Factory used for creating Process instances.

Constructor Detail

AbstractBuilder

public AbstractBuilder(java.lang.Class<T> modelType,
                       java.lang.String uri)
Creates a new instance.

Parameters:
modelType - The model type
uri - The implementation URI
Method Detail

getModelType

public final java.lang.Class<T> getModelType()

Specified by:
getModelType in interface nextgrid.api.builder.POMBuilder<T>

getURI

public final java.net.URI getURI()

Specified by:
getURI in interface nextgrid.api.builder.POMBuilder<T>

importFrom

public final nextgrid.api.pom.Process importFrom(java.io.File src)
                                          throws java.io.IOException,
                                                 nextgrid.api.builder.BuildException

Specified by:
importFrom in interface nextgrid.api.builder.POMBuilder<T>
Throws:
java.io.IOException
nextgrid.api.builder.BuildException

importFrom

public final nextgrid.api.pom.Process importFrom(java.net.URL src)
                                          throws java.io.IOException,
                                                 nextgrid.api.builder.BuildException

Specified by:
importFrom in interface nextgrid.api.builder.POMBuilder<T>
Throws:
java.io.IOException
nextgrid.api.builder.BuildException

importFrom

public final nextgrid.api.pom.Process importFrom(java.net.URI src)
                                          throws java.io.IOException,
                                                 nextgrid.api.builder.BuildException

Specified by:
importFrom in interface nextgrid.api.builder.POMBuilder<T>
Throws:
java.io.IOException
nextgrid.api.builder.BuildException

importFrom

public final nextgrid.api.pom.Process importFrom(java.io.InputStream is)
                                          throws java.io.IOException,
                                                 nextgrid.api.builder.BuildException

Specified by:
importFrom in interface nextgrid.api.builder.POMBuilder<T>
Throws:
java.io.IOException
nextgrid.api.builder.BuildException

importAllFrom

public final java.util.Collection<nextgrid.api.pom.Process> importAllFrom(java.net.URI src)
                                                                   throws java.io.IOException,
                                                                          nextgrid.api.builder.BuildException

Specified by:
importAllFrom in interface nextgrid.api.builder.POMBuilder<T>
Throws:
java.io.IOException
nextgrid.api.builder.BuildException

importAllFrom

public final java.util.Collection<nextgrid.api.pom.Process> importAllFrom(java.io.InputStream is)
                                                                   throws java.io.IOException,
                                                                          nextgrid.api.builder.BuildException

Specified by:
importAllFrom in interface nextgrid.api.builder.POMBuilder<T>
Throws:
java.io.IOException
nextgrid.api.builder.BuildException

loadFrom

protected abstract java.util.List<T> loadFrom(java.net.URI src)
                                       throws java.io.IOException
Loads a workflow file.

Parameters:
src - The file to import
Returns:
The workflow root Process instance
Throws:
java.io.IOException - If an error occurs

loadFrom

protected abstract java.util.List<T> loadFrom(java.io.InputStream src)
                                       throws java.io.IOException
Loads a workflow file.

Parameters:
src - A stream to read from
Returns:
The workflow root Process instance
Throws:
java.io.IOException - If an error occurs

createRef

protected final nextgrid.api.pom.Reference<?> createRef(java.lang.Class<?> type)
Creates a reference of the specified type.

Parameters:
type - The reference type
Returns:
A reference

findMappedInputName

protected final java.lang.String findMappedInputName(nextgrid.api.pom.Process p,
                                                     java.lang.String name)
Searches for a given input name into a process ascendants input mappings.

Parameters:
p - The process where the search starts
name - The input name
Returns:
An existing input name that can be mapped to the specified one

addMissingRefs

protected final void addMissingRefs(nextgrid.api.pom.Process p)
Finds out missing references and creates them.

Parameters:
p - The process to search

bindOutputInput

protected final void bindOutputInput(nextgrid.api.pom.Process src,
                                     nextgrid.api.pom.Process dst,
                                     java.lang.String srcParamId,
                                     java.lang.String dstParamId)
Binds a process output to another process input through a reference.

Parameters:
src - The source process
dst - The destination process
srcParamId - The source output
dstParamId - The destination input

bindInputInput

protected final void bindInputInput(nextgrid.api.pom.Process src,
                                    nextgrid.api.pom.Process dst,
                                    java.lang.String srcParamId,
                                    java.lang.String dstParamId)
Binds a process input to another process input through a mapping.

This method is used to map child process inputs to parent process ones.

Parameters:
src - The source process
dst - The destination process
srcParamId - The source output
dstParamId - The destination input

bindOutputOutput

protected final void bindOutputOutput(nextgrid.api.pom.Process src,
                                      nextgrid.api.pom.Process dst,
                                      java.lang.String srcParamId,
                                      java.lang.String dstParamId)
Binds a process output to another process output through a mapping.

This method is used to map child process outputs to parent process ones.

Parameters:
src - The source process
dst - The destination process
srcParamId - The source output
dstParamId - The destination input

setProfileAttribute

protected final void setProfileAttribute(nextgrid.api.pom.Process p,
                                         java.lang.String name,
                                         java.lang.Object value)
Sets a process attribute within the "profile" namespace.

Parameters:
p - A Process
name - The attribute local name
value - The attribute value


Copyright © 2006-2008 Grid Systems, S.A.. All Rights Reserved.