org.apache.lenya.cms.usecase.impl
Class UsecaseInvokerImpl

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.lenya.cms.usecase.impl.UsecaseInvokerImpl
All Implemented Interfaces:
org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, UsecaseInvoker
Direct Known Subclasses:
TestUsecaseInvoker

public class UsecaseInvokerImpl
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements UsecaseInvoker, org.apache.avalon.framework.service.Serviceable

Usecase invoker implementation.

Version:
$Id: UsecaseInvokerImpl.java 556887 2007-07-17 11:31:09Z andreas $

Field Summary
 
Fields inherited from interface org.apache.lenya.cms.usecase.UsecaseInvoker
EXECUTION_CONDITIONS_FAILED, EXECUTION_FAILED, POSTCONDITIONS_FAILED, PRECONDITIONS_FAILED, ROLE, SUCCESS
 
Constructor Summary
UsecaseInvokerImpl()
           
 
Method Summary
 java.util.List getErrorMessages()
          Returns the error messages from the previous operation.
 java.util.List getInfoMessages()
          Returns the info messages from the previous operation.
 int getResult()
           
 java.lang.String getTargetUrl()
           
protected  org.apache.lenya.cms.repository.Session getTestSession()
           
 void invoke(java.lang.String webappUrl, java.lang.String usecaseName, java.util.Map parameters)
          Invokes a usecase.
protected  void logErrorMessages(java.lang.String usecaseName, java.lang.String headline, java.util.List errorMessages)
           
protected  void passParameters(Usecase usecase, java.util.Map parameters)
           
 void service(org.apache.avalon.framework.service.ServiceManager manager)
           
 void setTestSession(org.apache.lenya.cms.repository.Session session)
           
protected  boolean succeeded(int result, Usecase usecase)
           
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UsecaseInvokerImpl

public UsecaseInvokerImpl()
Method Detail

invoke

public void invoke(java.lang.String webappUrl,
                   java.lang.String usecaseName,
                   java.util.Map parameters)
            throws UsecaseException
Description copied from interface: UsecaseInvoker
Invokes a usecase.

Specified by:
invoke in interface UsecaseInvoker
Parameters:
webappUrl - The URL to invoke the usecase on.
usecaseName - The name of the usecase.
parameters - The parameters.
Throws:
UsecaseException - if an error occurs.
See Also:
UsecaseInvoker.invoke(java.lang.String, java.lang.String, java.util.Map)

getTestSession

protected org.apache.lenya.cms.repository.Session getTestSession()

succeeded

protected boolean succeeded(int result,
                            Usecase usecase)

passParameters

protected void passParameters(Usecase usecase,
                              java.util.Map parameters)
Parameters:
usecase - The usecase to pass the parameters to.
parameters - The parameters.

logErrorMessages

protected void logErrorMessages(java.lang.String usecaseName,
                                java.lang.String headline,
                                java.util.List errorMessages)
Parameters:
usecaseName - The name of the usecase.
headline - The headline of the messages.
errorMessages - The messages to log.

service

public void service(org.apache.avalon.framework.service.ServiceManager manager)
             throws org.apache.avalon.framework.service.ServiceException
Specified by:
service in interface org.apache.avalon.framework.service.Serviceable
Throws:
org.apache.avalon.framework.service.ServiceException
See Also:
Serviceable.service(org.apache.avalon.framework.service.ServiceManager)

getErrorMessages

public java.util.List getErrorMessages()
Description copied from interface: UsecaseInvoker
Returns the error messages from the previous operation. Error messages prevent the operation from being executed.

Specified by:
getErrorMessages in interface UsecaseInvoker
Returns:
A list of UsecaseMessage objects.

getInfoMessages

public java.util.List getInfoMessages()
Description copied from interface: UsecaseInvoker
Returns the info messages from the previous operation. Info messages do not prevent the operation from being executed.

Specified by:
getInfoMessages in interface UsecaseInvoker
Returns:
A list of UsecaseMessage objects.

getResult

public int getResult()
Specified by:
getResult in interface UsecaseInvoker
Returns:
The result of the invocation.

getTargetUrl

public java.lang.String getTargetUrl()
Specified by:
getTargetUrl in interface UsecaseInvoker
Returns:
The target URL of the usecase, based on the success. This method throws a RuntimeException if the usecase hasn't been executed yet.

setTestSession

public void setTestSession(org.apache.lenya.cms.repository.Session session)
Specified by:
setTestSession in interface UsecaseInvoker
Parameters:
session - The test session to use.


Copyright $ Apache Software Foundation. All Rights Reserved.