ome.logic
Class RepositoryInfoImpl

java.lang.Object
  extended by ome.logic.AbstractLevel2Service
      extended by ome.logic.RepositoryInfoImpl
All Implemented Interfaces:
IRepositoryInfo, ServiceInterface, SelfConfigurableService

@Transactional
public class RepositoryInfoImpl
extends AbstractLevel2Service
implements IRepositoryInfo

Class implementation of the IRepositoryInfo service interface.

Stateless ome.logic to determine disk space utilization at the server's data image mount point, e.g. /OMERO See source code documentation for more.

Copyright 2007 Glencoe Software Inc. All rights reserved. Use is subject to license terms supplied in LICENSE.txt

Since:
3.0
Version:
$Revision$
Author:
David L. Whitehurst      david@glencoesoftware.com
See Also:
IRepositoryInfo

Field Summary
static double CRITICAL_USAGE
          Percentage (100.0 - 0.0) of disk use which will cause an exception during sanityCheckRepository()
static long INITIAL_DELAY
          Time (2 minutes) between successive calls to sanityCheckRepository() needed to trigger an actual call to getUsageFraction()
 
Fields inherited from class ome.logic.AbstractLevel2Service
iQuery, iUpdate, metadata, queryFactory, sec
 
Constructor Summary
RepositoryInfoImpl()
           
 
Method Summary
 long getFreeSpaceInKilobytes()
          This method returns the free or available space on this file system including nested subdirectories.
 Class<? extends ServiceInterface> getServiceInterface()
           
 double getUsageFraction()
          Deprecated. 
 long getUsedSpaceInKilobytes()
          Deprecated. 
 boolean needsSanityCheck()
          Calculates based on the cached usage and the elapsed time whether or not a real sanityCheckRepository() should be calculated.
 void removeUnusedFiles()
          Removes all files from the server that do not have an OriginalFile complement in the database, all the Pixels that do not have a complement in the database and all the Thumbnail's that do not have a complement in the database.
 void sanityCheckRepository()
          Checks that image data repository has not exceeded 95% disk space use level.
 void setDatadir(String datadir)
          Bean injection setter for data repository directory
 void setFileService(OriginalFilesService fileService)
          Bean injection setter for ROMIO file service
 void setPixelsService(PixelsService pixelsService)
          Bean injection setter for ROMIO pixels service
 void setSqlAction(ome.util.SqlAction sql)
          Bean injection setter for SQL operations
 void setThumbnailService(ThumbnailService thumbnailService)
          Bean injection setter for ROMIO thumbnail service
 
Methods inherited from class ome.logic.AbstractLevel2Service
getBeanHelper, getExtendedMetadata, getQueryFactory, getSecuritySystem, selfConfigure, setExtendedMetadata, setQueryFactory, setQueryService, setSecuritySystem, setUpdateService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INITIAL_DELAY

public static final long INITIAL_DELAY
Time (2 minutes) between successive calls to sanityCheckRepository() needed to trigger an actual call to getUsageFraction()

See Also:
Constant Field Values

CRITICAL_USAGE

public static final double CRITICAL_USAGE
Percentage (100.0 - 0.0) of disk use which will cause an exception during sanityCheckRepository()

See Also:
Constant Field Values
Constructor Detail

RepositoryInfoImpl

public RepositoryInfoImpl()
Method Detail

setThumbnailService

public void setThumbnailService(ThumbnailService thumbnailService)
Bean injection setter for ROMIO thumbnail service

Parameters:
rootdir -

setPixelsService

public void setPixelsService(PixelsService pixelsService)
Bean injection setter for ROMIO pixels service

Parameters:
rootdir -

setFileService

public void setFileService(OriginalFilesService fileService)
Bean injection setter for ROMIO file service

Parameters:
rootdir -

setSqlAction

public void setSqlAction(ome.util.SqlAction sql)
Bean injection setter for SQL operations

Parameters:
rootdir -

getFreeSpaceInKilobytes

public long getFreeSpaceInKilobytes()
Description copied from interface: IRepositoryInfo
This method returns the free or available space on this file system including nested subdirectories. The Java 6 J2SE provides this functionality now using similar methods in the class java.io.File. A refactoring of related classes should be performed when the later SDK is adopted.

Specified by:
getFreeSpaceInKilobytes in interface IRepositoryInfo
Returns:
Free space on this file system in KB.

getUsedSpaceInKilobytes

@Deprecated
public long getUsedSpaceInKilobytes()
Deprecated. 

Description copied from interface: IRepositoryInfo
This method returns the total space in bytes for this file system including nested subdirectories. The Java 6 J2SE provides this functionality now using similar methods in the class java.io.File. A refactoring of related classes should be performed when the later SDK is adopted.

Specified by:
getUsedSpaceInKilobytes in interface IRepositoryInfo
Returns:
Total space used on this file system.

getUsageFraction

@Deprecated
public double getUsageFraction()
Deprecated. 

Description copied from interface: IRepositoryInfo
This method returns a double of the used space divided by the free space. This method will be called by a client to watch the repository filesystem so that it doesn't exceed 95% full.

Specified by:
getUsageFraction in interface IRepositoryInfo
Returns:
Fraction of used/free.

getServiceInterface

public final Class<? extends ServiceInterface> getServiceInterface()
Specified by:
getServiceInterface in interface SelfConfigurableService

setDatadir

public void setDatadir(String datadir)
Bean injection setter for data repository directory

Parameters:
datadir -

needsSanityCheck

public boolean needsSanityCheck()
Calculates based on the cached usage and the elapsed time whether or not a real sanityCheckRepository() should be calculated.


sanityCheckRepository

public void sanityCheckRepository()
                           throws ome.conditions.InternalException
Description copied from interface: IRepositoryInfo
Checks that image data repository has not exceeded 95% disk space use level.

Specified by:
sanityCheckRepository in interface IRepositoryInfo
Throws:
ome.conditions.InternalException - If there is a critical failure while sanity checking the repository.
See Also:
ome.api.IRepository#sanityCheckRepository()

removeUnusedFiles

public void removeUnusedFiles()
Description copied from interface: IRepositoryInfo
Removes all files from the server that do not have an OriginalFile complement in the database, all the Pixels that do not have a complement in the database and all the Thumbnail's that do not have a complement in the database.

Specified by:
removeUnusedFiles in interface IRepositoryInfo


OmeroJava Api

Version: 4.3.4-dbcbce5a-b4

Copyright © 2009 The University of Dundee. All Rights Reserved.