com.day.cq.rewriter.linkchecker.impl
Class LinkInfoStorageImpl

java.lang.Object
  extended by com.day.cq.rewriter.linkchecker.impl.LinkInfoStorageImpl
All Implemented Interfaces:
LinkInfoStorage, Runnable, EventListener

public class LinkInfoStorageImpl
extends Object
implements LinkInfoStorage, Runnable, EventListener

Stores LinkInfo objects in the repository.


Field Summary
protected  Session readSession
          The session to read the link infos from.
protected  String storageRootPath
          path to the storage root node
protected  Session writeSession
          The session to write the link infos from.
 
Constructor Summary
LinkInfoStorageImpl()
           
 
Method Summary
protected  void activate(org.osgi.service.component.ComponentContext context)
          Activates the LinkChecker service.
protected  void deactivate(org.osgi.service.component.ComponentContext componentContext)
          Deactivates the LinkChecker service.
 void deleteLinkInfo(LinkInfo info)
          Removes link validity information from the repository.
 void deleteLinkInfo(String url)
          Removes link validity information from the repository.
 LinkInfo getLinkInfo(String url)
          Returns validity information for a specific link.
 String[] getLinks()
          Returns a list of links about which validity information is stored in the repository.
protected  void init()
          initializes the storge root
 void onEvent(EventIterator eventIterator)
          
 void putLinkInfo(LinkInfo info)
          Stores validity information about a link in the repository.
 void run()
          write backs the modified entries.
 void sync()
          Forces the storageg to flush it's caches to the repository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

storageRootPath

protected String storageRootPath
path to the storage root node


readSession

protected Session readSession
The session to read the link infos from.


writeSession

protected Session writeSession
The session to write the link infos from.

Constructor Detail

LinkInfoStorageImpl

public LinkInfoStorageImpl()
Method Detail

activate

protected void activate(org.osgi.service.component.ComponentContext context)
                 throws RepositoryException
Activates the LinkChecker service.

Parameters:
context - The component context providing startup information
Throws:
RepositoryException - if a repository error during activation occurs

init

protected void init()
             throws RepositoryException
initializes the storge root

Throws:
RepositoryException - if an error occurs

deactivate

protected void deactivate(org.osgi.service.component.ComponentContext componentContext)
Deactivates the LinkChecker service.

Parameters:
componentContext - The component context

getLinks

public String[] getLinks()
Returns a list of links about which validity information is stored in the repository.

Specified by:
getLinks in interface LinkInfoStorage
Returns:
A list of links

getLinkInfo

public LinkInfo getLinkInfo(String url)
Returns validity information for a specific link.

Specified by:
getLinkInfo in interface LinkInfoStorage
Parameters:
url - link to retrieve the information for
Returns:
A LinkInfo object describing the link or null if no validity information exists for the link

putLinkInfo

public void putLinkInfo(LinkInfo info)
Stores validity information about a link in the repository.

Specified by:
putLinkInfo in interface LinkInfoStorage
Parameters:
info - The validity information to be stored

deleteLinkInfo

public void deleteLinkInfo(LinkInfo info)
Removes link validity information from the repository.

Specified by:
deleteLinkInfo in interface LinkInfoStorage
Parameters:
info - The validity information to be removed

deleteLinkInfo

public void deleteLinkInfo(String url)
Removes link validity information from the repository.

Specified by:
deleteLinkInfo in interface LinkInfoStorage
Parameters:
url - The URL for which the validity information is to be removed

sync

public void sync()
Forces the storageg to flush it's caches to the repository. This should only be invoked by the external linkchecker task.

Specified by:
sync in interface LinkInfoStorage

run

public void run()
write backs the modified entries. called by event scheduler

Specified by:
run in interface Runnable

onEvent

public void onEvent(EventIterator eventIterator)

Specified by:
onEvent in interface EventListener


Copyright © 2008 Day Management AG. All Rights Reserved.