org.backsource.amsterdam.service.protocol
Class SimpleDirProtocolHandler

java.lang.Object
  extended byorg.backsource.amsterdam.service.protocol.ProtocolHandlerSupport
      extended byorg.backsource.amsterdam.service.protocol.GETProtocolHandlerSupport
          extended byorg.backsource.amsterdam.service.protocol.SimpleDirProtocolHandler
All Implemented Interfaces:
GETProtocolHandler, ProtocolHandler, Remover, Servable

public class SimpleDirProtocolHandler
extends GETProtocolHandlerSupport
implements Remover

Get files from a directory.

This is a simple test and demo protocol handler, use the ones in the plugins package for real work.

This class may be used to guard a directory or a specifyed file in a directory. When guarding directory its is possible to specify a partcular file extension to look for.

It is possible to use in basically two ways.

Either by having BaseUrl point out the full path to a directory or file (if it point to a file the configuration option IsFile must be set to true) and let the url in the ContentMapEntry be empty or set to ".".

Or by letting BaseUrl point out the base path to a directory and setting url in ContentMapEntry to either a sub directory or a file.

It is possible to configure the following stuff in the <protocol-conf> element:

    <protocol-conf>
      <conf name="BaseUrl">/home/pra/indata/</conf>
      <conf name="Extension">xml</conf>
      <conf name="IsFile">false</conf>
    </protocol-conf>
  

Version:
$Revision $
Author:
Peter Antman

Field Summary
 
Fields inherited from class org.backsource.amsterdam.service.protocol.ProtocolHandlerSupport
invoker
 
Constructor Summary
SimpleDirProtocolHandler(ProtocolConfigure conf)
           
 
Method Summary
 void close()
           
 ServiceMessage get(ListEntry entry)
          Get actually fetches the object.
 java.util.Iterator list(java.lang.String url)
          Lists the content.
 void remove(java.lang.String url)
           
 
Methods inherited from class org.backsource.amsterdam.service.protocol.ProtocolHandlerSupport
destroy, getServiceInvoker, importXml, init, setServiceInvoker, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.backsource.amsterdam.service.protocol.ProtocolHandler
getServiceInvoker, setServiceInvoker
 
Methods inherited from interface org.backsource.amsterdam.service.Servable
destroy, init, start, stop
 

Constructor Detail

SimpleDirProtocolHandler

public SimpleDirProtocolHandler(ProtocolConfigure conf)
                         throws ServiceException
Method Detail

close

public void close()
Specified by:
close in interface ProtocolHandler
Specified by:
close in class ProtocolHandlerSupport

list

public java.util.Iterator list(java.lang.String url)
                        throws ServiceException
Description copied from interface: GETProtocolHandler
Lists the content. Its is upp to the protocol to make an efficient and acurate list, for example HTTP may use HEAD to get the list. The Iterator returned should contain zero or more ListEntry objects

Specified by:
list in interface GETProtocolHandler
Specified by:
list in class GETProtocolHandlerSupport
Throws:
ServiceException

get

public ServiceMessage get(ListEntry entry)
                   throws ServiceException
Description copied from interface: GETProtocolHandler
Get actually fetches the object. It is up to the implementing protocol to realy see to it that the stuff it fetches are complete.

Specified by:
get in interface GETProtocolHandler
Specified by:
get in class GETProtocolHandlerSupport
Throws:
ServiceException

remove

public void remove(java.lang.String url)
            throws ServiceException
Specified by:
remove in interface Remover
Throws:
ServiceException


Copyright © 2001-2004 Backsource. All Rights Reserved.