org.jecars
Class CARS_DefaultMain

java.lang.Object
  extended by org.jecars.CARS_DefaultMain
All Implemented Interfaces:
CARS_Main

public class CARS_DefaultMain
extends java.lang.Object
implements CARS_Main

CARS_DefaultMain

Version:
$Id: CARS_DefaultMain.java,v 1.13 2008/02/06 12:27:06 weertj Exp $

Field Summary
protected static javax.xml.parsers.DocumentBuilder gBuilder
           
static java.util.logging.Logger gLog
           
 
Fields inherited from interface org.jecars.CARS_Main
DEFAULTAUTHOR, DEFAULTNS, DEFAULTNS1, DEFAULTRIGHTS, MAINFOLDER, VERSION
 
Constructor Summary
protected CARS_DefaultMain()
          Creates a new instance of CARS_DefaultMain
 
Method Summary
 void addContext(CARS_ActionContext pContext)
           
 javax.jcr.Node addGroup(java.lang.String pID, java.lang.String pFullname)
           
 javax.jcr.Node addGroup(java.lang.String pID, java.lang.String pFullname, java.lang.String pGroupNodeType)
           
static javax.jcr.Node addNode(javax.jcr.Node pParent, java.lang.String pName, java.lang.String pNodeType)
          Add node and also take care of all special cases
 javax.jcr.Node addNode(java.lang.String pFullPath, nl.msd.jdots.JD_Taglist pParamsTL, java.io.InputStream pBody, java.lang.String pBodyContentType)
          Add a node to the JeCARS repository
 javax.jcr.Node addPermission(javax.jcr.Node pParentNode, java.lang.String pGroupname, java.lang.String pUsername, java.lang.String pRights)
          Add permission object
 javax.jcr.Property addReference(javax.jcr.Node pNode, java.lang.String pProperty, javax.jcr.Node pReference)
          Add a node reference to a multivalued property
 javax.jcr.Node addUser(java.lang.String pID, char[] pPassword)
           
 javax.jcr.Node addUser(java.lang.String pID, char[] pPassword, java.lang.String pUserNodeType)
           
protected  boolean checkAndAddMixin(javax.jcr.Node pNode, java.lang.String pPropName)
          Check if the property is a known mixin type, if so then add the mixin
 void destroy()
           
 CARS_ActionContext getContext(int pNo)
           
 javax.jcr.Node getCurrentViewNode()
           
 CARS_Factory getFactory()
          Get the store CARS_Factory
protected  javax.jcr.Node getGroups()
          Get groups
 javax.jcr.Node getGroupSource(java.lang.String pGroupSource)
          Get one groupsource, return the external(!) node
 javax.jcr.Node getGroupSources()
          Get group sources
 long getId(javax.jcr.Node pNode)
          Retrieve the jecars:Id property from the node
static int getIndexParamFromTL(nl.msd.jdots.JD_Taglist pParamsTL, java.lang.String pTag, java.lang.String pValue)
          getIndexParamFromTL
 javax.jcr.Node getLoginUser()
           
 javax.jcr.Node getNode(java.lang.String pFullPath, nl.msd.jdots.JD_Taglist pTags)
          Get the full node using all possible resolving options
static java.lang.String getParamFromTL(nl.msd.jdots.JD_Taglist pParamsTL, java.lang.String pTag, int pIndex)
          getParamFromTL
 javax.jcr.Node getRoot()
          Get the root
 javax.jcr.Session getSession()
           
 javax.jcr.Node getUsers()
          Get users
 javax.jcr.Node getUserSource(java.lang.String pUserSource)
          Get one usersource, return the external(!) node
 javax.jcr.Node getUserSources()
          Get user sources
 void removeContext(CARS_ActionContext pContext)
           
 void removeNode(java.lang.String pFullPath, nl.msd.jdots.JD_Taglist pTags)
          Remove Node from the repository
 void setCurrentViewNode(javax.jcr.Node pNode)
           
protected  void setFactory(CARS_Factory pFactory)
           
 void setId(javax.jcr.Node pNode)
          Set the jecars:Id property on the given node
 javax.jcr.Property setParamProperty(javax.jcr.Node pNode, java.lang.String pPropName, java.lang.String pValue)
          Set a property of a node, multiple values are supported
protected  void setSession(javax.jcr.Session pSession)
           
protected  boolean streamToParamTL(nl.msd.jdots.JD_Taglist pParamsTL, java.io.InputStream pBody, java.lang.String pBodyContentType)
          Convert the body contents to paramtl (if possible)
 void synchronizeUserSource(java.lang.String pUserSource)
          Update the users
 javax.jcr.Node updateNode(java.lang.String pFullPath, nl.msd.jdots.JD_Taglist pParamsTL, java.io.InputStream pBody, java.lang.String pBodyContentType)
          Update node to the JeCARS repository
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gLog

public static java.util.logging.Logger gLog

gBuilder

protected static javax.xml.parsers.DocumentBuilder gBuilder
Constructor Detail

CARS_DefaultMain

protected CARS_DefaultMain()
Creates a new instance of CARS_DefaultMain

Method Detail

addNode

public static javax.jcr.Node addNode(javax.jcr.Node pParent,
                                     java.lang.String pName,
                                     java.lang.String pNodeType)
                              throws java.lang.Exception
Add node and also take care of all special cases

Parameters:
pParent -
pName -
pNodeType -
Returns:
Throws:
java.lang.Exception

addPermission

public javax.jcr.Node addPermission(javax.jcr.Node pParentNode,
                                    java.lang.String pGroupname,
                                    java.lang.String pUsername,
                                    java.lang.String pRights)
                             throws java.lang.Exception
Add permission object

Specified by:
addPermission in interface CARS_Main
Parameters:
pParentNode - the node under which the permission node is added
pGroupname - the group name (without the path), may be null
pUsername - the user name (without the path), may be null
pRights - the rights stored in a string e.g. "read,add_node"
Returns:
The created permission node
Throws:
java.lang.Exception - when an exception occurs

setCurrentViewNode

public void setCurrentViewNode(javax.jcr.Node pNode)
Specified by:
setCurrentViewNode in interface CARS_Main

getCurrentViewNode

public javax.jcr.Node getCurrentViewNode()
Specified by:
getCurrentViewNode in interface CARS_Main

addContext

public void addContext(CARS_ActionContext pContext)
Specified by:
addContext in interface CARS_Main

getContext

public CARS_ActionContext getContext(int pNo)
Specified by:
getContext in interface CARS_Main

removeContext

public void removeContext(CARS_ActionContext pContext)
Specified by:
removeContext in interface CARS_Main

getSession

public javax.jcr.Session getSession()
Specified by:
getSession in interface CARS_Main

setSession

protected void setSession(javax.jcr.Session pSession)

getLoginUser

public javax.jcr.Node getLoginUser()
Specified by:
getLoginUser in interface CARS_Main

setFactory

protected void setFactory(CARS_Factory pFactory)

getFactory

public CARS_Factory getFactory()
Get the store CARS_Factory

Specified by:
getFactory in interface CARS_Main

addReference

public javax.jcr.Property addReference(javax.jcr.Node pNode,
                                       java.lang.String pProperty,
                                       javax.jcr.Node pReference)
                                throws java.lang.Exception
Add a node reference to a multivalued property

Specified by:
addReference in interface CARS_Main
Parameters:
pNode - Property of this node
pProperty - The name of the property
pReference - The node reference
Returns:
the multivalued property
Throws:
java.lang.Exception - when an error occurs

addUser

public javax.jcr.Node addUser(java.lang.String pID,
                              char[] pPassword)
                       throws java.lang.Exception
Specified by:
addUser in interface CARS_Main
Throws:
java.lang.Exception

addUser

public javax.jcr.Node addUser(java.lang.String pID,
                              char[] pPassword,
                              java.lang.String pUserNodeType)
                       throws java.lang.Exception
Specified by:
addUser in interface CARS_Main
Throws:
java.lang.Exception

addGroup

public javax.jcr.Node addGroup(java.lang.String pID,
                               java.lang.String pFullname)
                        throws java.lang.Exception
Specified by:
addGroup in interface CARS_Main
Throws:
java.lang.Exception

addGroup

public javax.jcr.Node addGroup(java.lang.String pID,
                               java.lang.String pFullname,
                               java.lang.String pGroupNodeType)
                        throws java.lang.Exception
Specified by:
addGroup in interface CARS_Main
Throws:
java.lang.Exception

destroy

public void destroy()
Specified by:
destroy in interface CARS_Main

getGroups

protected javax.jcr.Node getGroups()
                            throws java.lang.Exception
Get groups

Throws:
java.lang.Exception

getRoot

public javax.jcr.Node getRoot()
                       throws java.lang.Exception
Get the root

Specified by:
getRoot in interface CARS_Main
Throws:
java.lang.Exception

checkAndAddMixin

protected boolean checkAndAddMixin(javax.jcr.Node pNode,
                                   java.lang.String pPropName)
                            throws javax.jcr.RepositoryException
Check if the property is a known mixin type, if so then add the mixin

Returns:
true if a mixin is added
Throws:
javax.jcr.RepositoryException

setParamProperty

public javax.jcr.Property setParamProperty(javax.jcr.Node pNode,
                                           java.lang.String pPropName,
                                           java.lang.String pValue)
                                    throws java.lang.Exception
Set a property of a node, multiple values are supported

Specified by:
setParamProperty in interface CARS_Main
Parameters:
pNode - the node of which a property will be set
pPropName - property name
pValue - the value, for multi value; +.... (to add a value) -.... (to remove a value)
Throws:
java.lang.Exception - when an exception occurs.

setId

public void setId(javax.jcr.Node pNode)
           throws java.lang.Exception
Set the jecars:Id property on the given node

Specified by:
setId in interface CARS_Main
Parameters:
pNode - The node
Throws:
java.lang.Exception - when an exception occurs

getId

public long getId(javax.jcr.Node pNode)
           throws java.lang.Exception
Retrieve the jecars:Id property from the node

Specified by:
getId in interface CARS_Main
Parameters:
pNode - The node
Returns:
id
Throws:
java.lang.Exception

getIndexParamFromTL

public static int getIndexParamFromTL(nl.msd.jdots.JD_Taglist pParamsTL,
                                      java.lang.String pTag,
                                      java.lang.String pValue)
                               throws java.lang.Exception
getIndexParamFromTL

Parameters:
pParamsTL -
pTag -
pValue -
Returns:
Throws:
java.lang.Exception

getParamFromTL

public static java.lang.String getParamFromTL(nl.msd.jdots.JD_Taglist pParamsTL,
                                              java.lang.String pTag,
                                              int pIndex)
                                       throws java.lang.Exception
getParamFromTL

Parameters:
pParamsTL -
pTag -
pIndex -
Returns:
Throws:
java.lang.Exception

streamToParamTL

protected boolean streamToParamTL(nl.msd.jdots.JD_Taglist pParamsTL,
                                  java.io.InputStream pBody,
                                  java.lang.String pBodyContentType)
                           throws java.lang.Exception
Convert the body contents to paramtl (if possible)

Parameters:
pParamsTL - taglist in which the resulting paramaters are stored
pBody - the inputstream
pBodyContentType - the mime type
Returns:
true if the pBody contents was a parseable content, false if not
Throws:
java.lang.Exception - when an exception occurs

addNode

public javax.jcr.Node addNode(java.lang.String pFullPath,
                              nl.msd.jdots.JD_Taglist pParamsTL,
                              java.io.InputStream pBody,
                              java.lang.String pBodyContentType)
                       throws java.lang.Exception
Add a node to the JeCARS repository

Specified by:
addNode in interface CARS_Main
Parameters:
pFullPath -
pParamsTL -
pBody -
pBodyContentType -
Returns:
Throws:
java.lang.Exception

updateNode

public javax.jcr.Node updateNode(java.lang.String pFullPath,
                                 nl.msd.jdots.JD_Taglist pParamsTL,
                                 java.io.InputStream pBody,
                                 java.lang.String pBodyContentType)
                          throws java.lang.Exception
Update node to the JeCARS repository

Specified by:
updateNode in interface CARS_Main
Returns:
the updated node
Throws:
java.lang.Exception

getNode

public javax.jcr.Node getNode(java.lang.String pFullPath,
                              nl.msd.jdots.JD_Taglist pTags)
                       throws java.lang.Exception
Get the full node using all possible resolving options

Specified by:
getNode in interface CARS_Main
Parameters:
pFullPath - the path to be resolved
pTags - taglist for storing parameters; "InterfaceClass" = .. "CARS_Interface" = ..
Returns:
The node found
Throws:
java.lang.Exception

removeNode

public void removeNode(java.lang.String pFullPath,
                       nl.msd.jdots.JD_Taglist pTags)
                throws java.lang.Exception
Remove Node from the repository

Specified by:
removeNode in interface CARS_Main
Parameters:
pFullPath - the full path of the to be removed node
pTags -
Throws:
java.lang.Exception - when an exception occurs

getUsers

public javax.jcr.Node getUsers()
                        throws java.lang.Exception
Get users

Specified by:
getUsers in interface CARS_Main
Throws:
java.lang.Exception

getUserSources

public javax.jcr.Node getUserSources()
                              throws java.lang.Exception
Get user sources

Specified by:
getUserSources in interface CARS_Main
Throws:
java.lang.Exception

getUserSource

public javax.jcr.Node getUserSource(java.lang.String pUserSource)
                             throws java.lang.Exception
Get one usersource, return the external(!) node

Specified by:
getUserSource in interface CARS_Main
Throws:
java.lang.Exception

synchronizeUserSource

public void synchronizeUserSource(java.lang.String pUserSource)
                           throws java.lang.Exception
Update the users

Specified by:
synchronizeUserSource in interface CARS_Main
Throws:
java.lang.Exception

getGroupSources

public javax.jcr.Node getGroupSources()
                               throws java.lang.Exception
Get group sources

Throws:
java.lang.Exception

getGroupSource

public javax.jcr.Node getGroupSource(java.lang.String pGroupSource)
                              throws java.lang.Exception
Get one groupsource, return the external(!) node

Throws:
java.lang.Exception