org.apache.cocoon.portal.coplets.basket
Class BasketManagerImpl

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.portal.coplets.basket.BasketManagerImpl
All Implemented Interfaces:
Disposable, Initializable, Component, Contextualizable, LogEnabled, Parameterizable, Serviceable, ThreadSafe, BasketManager, Receiver

public class BasketManagerImpl
extends AbstractLogEnabled
implements BasketManager, Serviceable, Receiver, Contextualizable, Initializable, Disposable, Parameterizable, ThreadSafe, Component

This is the implementation of the basket manager

Version:
CVS $Id: BasketManagerImpl.html 1304258 2012-03-23 10:09:27Z ilgrosso $

Nested Class Summary
protected static class BasketManagerImpl.BatchInfo
           
static class BasketManagerImpl.Job
           
 
Nested classes/interfaces inherited from interface org.apache.cocoon.portal.coplets.basket.BasketManager
BasketManager.ActionInfo
 
Field Summary
protected  List basketActions
          All actions for a basket
protected  String basketClassName
          The class name of the basket
protected  List batches
          All batches
protected  List briefcaseActions
          All actions for a briefcase
protected  String briefcaseClassName
          The class name of the briefcase
protected  Context context
          The component context
protected  String directory
          The configuration for storing baskets
protected  String folderClassName
          The class name of the folder
protected  ServiceManager manager
          The service manager
protected  JobScheduler scheduler
          Scheduler
 
Fields inherited from interface org.apache.cocoon.portal.coplets.basket.BasketManager
ALL_BRIEFCASES_KEY, BASKET_KEY, BRIEFCASE_KEY, FOLDER_KEY, ROLE
 
Constructor Summary
BasketManagerImpl()
           
 
Method Summary
 void addBatch(ContentItem item, int frequencyInDays, BasketManager.ActionInfo action)
           
 void contextualize(Context context)
           
protected  void deleteContentStore(String type, String userId)
          Delete the content store for a user
 void dispose()
           
 Basket getBasket()
          Return the basket of the current user
 BasketManager.ActionInfo getBasketAction(String name)
          Get the info
 List getBasketActions()
          Return all configured actions for a basket - this is a list of BasketManager.ActionInfos.
 Briefcase getBriefcase()
          Return the briefcase of the current user
 BasketManager.ActionInfo getBriefcaseAction(String name)
          Get the info
 List getBriefcaseActions()
          Return all configured actions for a briefcase - this is a list of BasketManager.ActionInfos.
 List getBriefcaseDescriptions()
          Return all briefcases.
 Folder getFolder()
          Return the folder of the current user
protected  String getUser()
          Get the current user
 void inform(ContentStoreEvent event, PortalService service)
           
 void initialize()
           
protected  List loadBriefcases()
          Get briefcases of all users
protected  ContentStore loadContentStore(String type)
          Load a content store
protected  ContentStore loadContentStore(String type, String userId)
          Load the content store for a single user
 void parameterize(Parameters parameters)
           
protected  void processAddItemEvent(AddItemEvent event)
          This method processes adding one item to a content store
protected  void processCleanBriefcaseEvent(CleanBriefcaseEvent event, Session session)
          Cleaning a briefcase or all
protected  void processRemoveItemEvent(RemoveItemEvent event)
          This method processes removing one item from a content store
protected  void processShowBasketEvent(ShowBasketEvent event, Session session)
          Show the selected basket
protected  void processShowItemEvent(ShowItemEvent event)
          Show one item of the basket
protected  void processUploadItemEvent(UploadItemEvent event)
          Process an upload and add the item to the content store
protected  void saveContentStore(ContentStore store)
          Save the content store if it is a briefcase or a folder
protected  void saveContentStore(String type, ContentStore store)
          Save the content store for a single user
protected  BasketManagerImpl.BatchInfo searchBatchInfo(ContentItem item, BasketManager.ActionInfo info)
           
 void service(ServiceManager manager)
           
 void update(ContentStore store)
          Update/save the content store
 
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
 

Field Detail

manager

protected ServiceManager manager
The service manager


context

protected Context context
The component context


directory

protected String directory
The configuration for storing baskets


basketClassName

protected String basketClassName
The class name of the basket


briefcaseClassName

protected String briefcaseClassName
The class name of the briefcase


folderClassName

protected String folderClassName
The class name of the folder


basketActions

protected List basketActions
All actions for a basket


briefcaseActions

protected List briefcaseActions
All actions for a briefcase


batches

protected List batches
All batches


scheduler

protected JobScheduler scheduler
Scheduler

Constructor Detail

BasketManagerImpl

public BasketManagerImpl()
Method Detail

parameterize

public void parameterize(Parameters parameters)
                  throws ParameterException
Specified by:
parameterize in interface Parameterizable
Throws:
ParameterException

contextualize

public void contextualize(Context context)
                   throws ContextException
Specified by:
contextualize in interface Contextualizable
Throws:
ContextException

service

public void service(ServiceManager manager)
             throws ServiceException
Specified by:
service in interface Serviceable
Throws:
ServiceException

dispose

public void dispose()
Specified by:
dispose in interface Disposable

initialize

public void initialize()
                throws Exception
Specified by:
initialize in interface Initializable
Throws:
Exception

inform

public void inform(ContentStoreEvent event,
                   PortalService service)
See Also:
Receiver

processUploadItemEvent

protected void processUploadItemEvent(UploadItemEvent event)
Process an upload and add the item to the content store

Parameters:
event - The event triggering the action

processShowItemEvent

protected void processShowItemEvent(ShowItemEvent event)
Show one item of the basket

Parameters:
event - The event triggering the action

processShowBasketEvent

protected void processShowBasketEvent(ShowBasketEvent event,
                                      Session session)
Show the selected basket


processCleanBriefcaseEvent

protected void processCleanBriefcaseEvent(CleanBriefcaseEvent event,
                                          Session session)
Cleaning a briefcase or all

Parameters:
event - The triggering event
session - The session

processRemoveItemEvent

protected void processRemoveItemEvent(RemoveItemEvent event)
This method processes removing one item from a content store

Parameters:
event - The event triggering the action

processAddItemEvent

protected void processAddItemEvent(AddItemEvent event)
This method processes adding one item to a content store

Parameters:
event - The event triggering the action

saveContentStore

protected void saveContentStore(ContentStore store)
Save the content store if it is a briefcase or a folder


loadContentStore

protected ContentStore loadContentStore(String type,
                                        String userId)
Load the content store for a single user

Parameters:
type - The type of the content store (briefcase or folder)
Returns:
The content store or null

loadContentStore

protected ContentStore loadContentStore(String type)
Load a content store

Parameters:
type - The type of the content store (briefcase or folder)

deleteContentStore

protected void deleteContentStore(String type,
                                  String userId)
Delete the content store for a user


saveContentStore

protected void saveContentStore(String type,
                                ContentStore store)
Save the content store for a single user


loadBriefcases

protected List loadBriefcases()
Get briefcases of all users


getBasket

public Basket getBasket()
Description copied from interface: BasketManager
Return the basket of the current user

Specified by:
getBasket in interface BasketManager

getBriefcase

public Briefcase getBriefcase()
Description copied from interface: BasketManager
Return the briefcase of the current user

Specified by:
getBriefcase in interface BasketManager

getFolder

public Folder getFolder()
Description copied from interface: BasketManager
Return the folder of the current user

Specified by:
getFolder in interface BasketManager

getBriefcaseDescriptions

public List getBriefcaseDescriptions()
Description copied from interface: BasketManager
Return all briefcases. This is a list of ContentStoreDescription objects.

Specified by:
getBriefcaseDescriptions in interface BasketManager

getUser

protected String getUser()
Get the current user


getBasketActions

public List getBasketActions()
Description copied from interface: BasketManager
Return all configured actions for a basket - this is a list of BasketManager.ActionInfos.

Specified by:
getBasketActions in interface BasketManager

getBriefcaseActions

public List getBriefcaseActions()
Description copied from interface: BasketManager
Return all configured actions for a briefcase - this is a list of BasketManager.ActionInfos.

Specified by:
getBriefcaseActions in interface BasketManager

addBatch

public void addBatch(ContentItem item,
                     int frequencyInDays,
                     BasketManager.ActionInfo action)
Specified by:
addBatch in interface BasketManager

searchBatchInfo

protected BasketManagerImpl.BatchInfo searchBatchInfo(ContentItem item,
                                                      BasketManager.ActionInfo info)

getBasketAction

public BasketManager.ActionInfo getBasketAction(String name)
Description copied from interface: BasketManager
Get the info

Specified by:
getBasketAction in interface BasketManager

getBriefcaseAction

public BasketManager.ActionInfo getBriefcaseAction(String name)
Description copied from interface: BasketManager
Get the info

Specified by:
getBriefcaseAction in interface BasketManager

update

public void update(ContentStore store)
Description copied from interface: BasketManager
Update/save the content store

Specified by:
update in interface BasketManager


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.