org.ow2.weblab.iterator
Class FolderResourceIterator

java.lang.Object
  extended by org.ow2.weblab.iterator.FolderResourceIterator
All Implemented Interfaces:
org.ow2.weblab.core.services.QueueManager

public class FolderResourceIterator
extends java.lang.Object
implements org.ow2.weblab.core.services.QueueManager

This service is able to list resources from a folder. /!\ Only one folder is accessible at a time on a JVM (static variables to ensure thread safe execution)

Author:
CASSIDIAN WebLab team
Date:

Field Summary
protected static java.io.File folder
           
protected static java.lang.String folderPath
           
static org.apache.commons.logging.Log LOGGER
           
protected static java.lang.String PROPERTY_FILE
           
protected static java.lang.String PROPERTY_NAME
           
protected static java.util.LinkedList<java.lang.String> resourceList
           
protected  org.ow2.weblab.core.extended.jaxb.WebLabMarshaller webLabMarshaller
          folder containing WL resources
 
Constructor Summary
FolderResourceIterator()
           
 
Method Summary
static java.lang.String getFolderPath()
           
static int getNbResources()
           
protected  boolean hasNext()
           
 void init()
           
protected  org.ow2.weblab.core.model.Resource loadNextResource()
          Load the next resource in the list.
protected  int loadResources()
           
 org.ow2.weblab.core.services.queuemanager.NextResourceReturn nextResource(org.ow2.weblab.core.services.queuemanager.NextResourceArgs args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

public static org.apache.commons.logging.Log LOGGER

PROPERTY_FILE

protected static final java.lang.String PROPERTY_FILE
See Also:
Constant Field Values

PROPERTY_NAME

protected static final java.lang.String PROPERTY_NAME
See Also:
Constant Field Values

webLabMarshaller

protected org.ow2.weblab.core.extended.jaxb.WebLabMarshaller webLabMarshaller
folder containing WL resources


folder

protected static java.io.File folder

folderPath

protected static java.lang.String folderPath

resourceList

protected static java.util.LinkedList<java.lang.String> resourceList
Constructor Detail

FolderResourceIterator

public FolderResourceIterator()
Method Detail

loadResources

protected int loadResources()
                     throws java.io.IOException
Throws:
java.io.IOException

init

@PostConstruct
public void init()
          throws java.io.IOException
Throws:
java.io.IOException

loadNextResource

protected org.ow2.weblab.core.model.Resource loadNextResource()
Load the next resource in the list. If we face an error during loading, we try the next one until we find a valid resource or reach the end of the list.

Returns:
the loaded Resource or null if we reached the end of the list.

hasNext

protected boolean hasNext()

nextResource

public org.ow2.weblab.core.services.queuemanager.NextResourceReturn nextResource(org.ow2.weblab.core.services.queuemanager.NextResourceArgs args)
                                                                          throws org.ow2.weblab.core.services.AccessDeniedException,
                                                                                 org.ow2.weblab.core.services.ContentNotAvailableException,
                                                                                 org.ow2.weblab.core.services.EmptyQueueException,
                                                                                 org.ow2.weblab.core.services.InsufficientResourcesException,
                                                                                 org.ow2.weblab.core.services.InvalidParameterException,
                                                                                 org.ow2.weblab.core.services.ServiceNotConfiguredException,
                                                                                 org.ow2.weblab.core.services.UnexpectedException,
                                                                                 org.ow2.weblab.core.services.UnsupportedRequestException
Specified by:
nextResource in interface org.ow2.weblab.core.services.QueueManager
Throws:
org.ow2.weblab.core.services.AccessDeniedException
org.ow2.weblab.core.services.ContentNotAvailableException
org.ow2.weblab.core.services.EmptyQueueException
org.ow2.weblab.core.services.InsufficientResourcesException
org.ow2.weblab.core.services.InvalidParameterException
org.ow2.weblab.core.services.ServiceNotConfiguredException
org.ow2.weblab.core.services.UnexpectedException
org.ow2.weblab.core.services.UnsupportedRequestException

getFolderPath

public static java.lang.String getFolderPath()

getNbResources

public static int getNbResources()


Copyright © 2004-2011. All Rights Reserved.