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

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.lenya.cms.usecase.impl.UsecaseResolverImpl
All Implemented Interfaces:
org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, org.apache.avalon.framework.thread.ThreadSafe, UsecaseResolver

public class UsecaseResolverImpl
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements UsecaseResolver, org.apache.avalon.framework.service.Serviceable, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.thread.ThreadSafe

Usecase resolver implementation.

Version:
$Id: UsecaseResolverImpl.java 568041 2007-08-21 09:47:23Z andreas $

Field Summary
 
Fields inherited from interface org.apache.lenya.cms.usecase.UsecaseResolver
ROLE
 
Constructor Summary
UsecaseResolverImpl()
          Ctor.
 
Method Summary
 void dispose()
           
protected  org.apache.lenya.cms.publication.Publication getPublication(java.lang.String webappUrl)
          Returns the publication the usecase was invoked in.
protected  org.apache.avalon.framework.service.ServiceSelector getSelector()
           
protected  java.lang.String getUsecaseName(java.lang.String webappUrl, java.lang.String name)
          Returns the name of the publication-overridden usecase to be resolved.
 java.lang.String[] getUsecaseNames()
           
 boolean isRegistered(java.lang.String webappUrl, java.lang.String name)
          Checks if a certain usecase is registered.
 void register(java.lang.String usecaseName)
           
 void release(Usecase usecase)
          Releases a usecase object.
 Usecase resolve(java.lang.String webappUrl, java.lang.String name)
          Resolves a usecase object.
 void service(org.apache.avalon.framework.service.ServiceManager _manager)
           
 
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

UsecaseResolverImpl

public UsecaseResolverImpl()
Ctor.

Method Detail

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)

getSelector

protected org.apache.avalon.framework.service.ServiceSelector getSelector()
                                                                   throws org.apache.avalon.framework.service.ServiceException
Throws:
org.apache.avalon.framework.service.ServiceException

release

public void release(Usecase usecase)
             throws org.apache.avalon.framework.service.ServiceException
Description copied from interface: UsecaseResolver
Releases a usecase object.

Specified by:
release in interface UsecaseResolver
Parameters:
usecase - The usecase object.
Throws:
org.apache.avalon.framework.service.ServiceException - if an error occurs.
See Also:
UsecaseResolver.release(org.apache.lenya.cms.usecase.Usecase)

dispose

public void dispose()
Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable
See Also:
Disposable.dispose()

getUsecaseName

protected java.lang.String getUsecaseName(java.lang.String webappUrl,
                                          java.lang.String name)
                                   throws org.apache.avalon.framework.service.ServiceException
Returns the name of the publication-overridden usecase to be resolved.

Parameters:
webappUrl - The web application URL.
name - The plain usecase name.
Returns:
A string.
Throws:
org.apache.avalon.framework.service.ServiceException - if an error occurs.

getPublication

protected org.apache.lenya.cms.publication.Publication getPublication(java.lang.String webappUrl)
Returns the publication the usecase was invoked in.

Parameters:
webappUrl - The web application URL.
Returns:
A publication.

resolve

public Usecase resolve(java.lang.String webappUrl,
                       java.lang.String name)
                throws org.apache.avalon.framework.service.ServiceException
Description copied from interface: UsecaseResolver
Resolves a usecase object.

Specified by:
resolve in interface UsecaseResolver
Parameters:
webappUrl - The web application URL.
name - The name of the usecase.
Returns:
A usecase object.
Throws:
org.apache.avalon.framework.service.ServiceException - if the object could not be created.
See Also:
UsecaseResolver.resolve(java.lang.String, java.lang.String)

isRegistered

public boolean isRegistered(java.lang.String webappUrl,
                            java.lang.String name)
                     throws org.apache.avalon.framework.service.ServiceException
Description copied from interface: UsecaseResolver
Checks if a certain usecase is registered.

Specified by:
isRegistered in interface UsecaseResolver
Parameters:
webappUrl - The web application URL.
name - The usecase name.
Returns:
A boolean value.
Throws:
org.apache.avalon.framework.service.ServiceException - if an error occurs.
See Also:
UsecaseResolver.isRegistered(java.lang.String, java.lang.String)

getUsecaseNames

public java.lang.String[] getUsecaseNames()
Specified by:
getUsecaseNames in interface UsecaseResolver
Returns:
The names of all registered usecases in alphabetical order.

register

public void register(java.lang.String usecaseName)
Specified by:
register in interface UsecaseResolver
Parameters:
usecaseName - The usecase to register.


Copyright $ Apache Software Foundation. All Rights Reserved.