org.inria.ns.reflex.modules.rdbms
Class ConnectAction

java.lang.Object
  extended by org.inria.ns.reflex.processor.core.AbstractAction
      extended by org.inria.ns.reflex.processor.core.AbstractSetAction
          extended by org.inria.ns.reflex.modules.rdbms.ConnectAction
All Implemented Interfaces:
Computable, Executable, Presentable, NamespaceContextFactory

public class ConnectAction
extends AbstractSetAction

At runtime, the <rdbms:connect> element opens a connection with the database.

A new variable with the name specified in the name attribute is added to the data set.

<rdbms:connect name="connection"
               url="{Expression}"
               driver="{Expression}"
               user="{Expression}"
               password="{Expression}"
    xmlns:rdbms="http://ns.inria.org/active-tags/rdbms"/>
The <rdbms:connect> element can be used without user-id and password elements,
<rdbms:connect name="connection"
               url="{Expression}"
               driver="{Expression}"
    xmlns:rdbms="http://ns.inria.org/active-tags/rdbms"/>

Author:
Philippe Poulard

Nested Class Summary
 
Nested classes/interfaces inherited from class org.inria.ns.reflex.processor.core.AbstractAction
AbstractAction.ParameterAdapter, AbstractAction.UselessAction
 
Field Summary
 
Fields inherited from class org.inria.ns.reflex.processor.core.AbstractSetAction
NO_VALUE
 
Fields inherited from class org.inria.ns.reflex.processor.core.AbstractAction
actions, parent, processorInstance
 
Constructor Summary
ConnectAction(Expression url, String driver, Element element, AbstractAction parent)
          Create a new instance of ConnectAction.
 
Method Summary
 Object getComputedValue(DataSet dataSet)
          Return the computed value of the property, by opening a connection to the database.
static AbstractAction unmarshal(AbstractAction parent, Element element)
          XML unmarshaller for ConnectAction.
 
Methods inherited from class org.inria.ns.reflex.processor.core.AbstractSetAction
addProperty, getComputedName, getName, getValue, runAction, scope, unmarshalScope
 
Methods inherited from class org.inria.ns.reflex.processor.core.AbstractAction
addAction, addFallbackAction, createContext, getCanonicalPath, getFallbackAction, getLocalFallbackAction, getLogger, getNamespaceContext, getNode, getParent, recover, recover, removeFallbackAction, reorganize, run, runActions, toPrettyString, toPrettyString, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConnectAction

public ConnectAction(Expression url,
                     String driver,
                     Element element,
                     AbstractAction parent)
              throws XMLException
Create a new instance of ConnectAction.

Parameters:
url - The url of the database to open, that will be the value of the property, as an Expression.
driver - The driver used for opening the connection.
userId - The login of the user to connect to the database, as an Expression.
password - The password of the user to connect to the database, as an Expression.
element - The element from which the action has been unmarshalled. Used for namespace prefix resolution when performing XPath expressions.
parent - The action depending from.
Throws:
XMLException
Method Detail

unmarshal

public static AbstractAction unmarshal(AbstractAction parent,
                                       Element element)
                                throws XMLException
XML unmarshaller for ConnectAction.

Parameters:
parent - The action depending from.
element - The XML element to unmarshall.
Returns:
The ConnectAction created.
Throws:
XMLException - When the element and its content is not those expected.

getComputedValue

public Object getComputedValue(DataSet dataSet)
                        throws ExecutionException
Return the computed value of the property, by opening a connection to the database.

Specified by:
getComputedValue in interface Computable
Specified by:
getComputedValue in class AbstractSetAction
Parameters:
dataSet - The set of datas used when the name is computed.
Returns:
The computed value of the property.
Throws:
ExecutionException - If the computation can't be performed.