ome.services
Class RawFileBean

java.lang.Object
  extended by ome.services.AbstractStatefulBean
      extended by ome.services.RawFileBean
All Implemented Interfaces:
Serializable, RawFileStore, ServiceInterface, StatefulServiceInterface, SelfConfigurableService

@Transactional(readOnly=true)
public class RawFileBean
extends AbstractStatefulBean
implements RawFileStore

Raw file gateway which provides access to the OMERO file repository.

Since:
OMERO3.0
Version:
3.0 (Internal version: $Revision$ $Date: 2005/06/08 15:21:59 $)
Author:
Chris Allan      callan@blackcat.ca
See Also:
Serialized Form

Field Summary
 
Fields inherited from class ome.services.AbstractStatefulBean
iQuery, iUpdate, modified, sec
 
Constructor Summary
RawFileBean()
          default constructor
RawFileBean(boolean checking)
          overriden to allow Spring to set boolean
 
Method Summary
 void activate()
          Completely restore this service for active use from whatever passivation it has implemented.
 void clean()
           
 void close()
          signals the end of the service lifecycle.
 boolean exists()
          Checks to see if a raw file exists with the file ID that the service was initialized with.
 Class<? extends ServiceInterface> getServiceInterface()
           
 boolean isDiskSpaceChecking()
          getter disk overflow checking
 void passivate()
          Perform whatever passivation is possible or throw an exception.
 byte[] read(long position, int length)
          Delegates to FileBuffer
 ome.model.core.OriginalFile save()
          Saves the OriginalFile associated with the service if it has been modified.
 void setDiskSpaceChecking(boolean diskSpaceChecking)
          setter disk overflow checking
 void setFileId(long fileId)
          This method manages the state of the service.
 void setIRepositoryInfo(IRepositoryInfo iRepositoryInfo)
          Disk Space Usage service Bean injector
 void setOriginalFilesService(OriginalFilesService ioService)
          I/O service (OriginalFilesService) Bean injector.
 long size()
          Returns the size of the file on disk (not as stored in the database since that value will only be updated on RawFileStore.save().
 boolean truncate(long length)
          Limits the size of a file to the given length.
 void write(byte[] buf, long position, int length)
          Delegates to FileBuffer
 
Methods inherited from class ome.services.AbstractStatefulBean
getBeanHelper, getCurrentEventContext, isModified, modified, selfConfigure, setQueryService, setSecuritySystem, setUpdateService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ome.api.StatefulServiceInterface
getCurrentEventContext
 

Constructor Detail

RawFileBean

public RawFileBean()
default constructor


RawFileBean

public RawFileBean(boolean checking)
overriden to allow Spring to set boolean

Parameters:
checking -
Method Detail

getServiceInterface

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

setOriginalFilesService

public final void setOriginalFilesService(OriginalFilesService ioService)
I/O service (OriginalFilesService) Bean injector.

Parameters:
ioService - an OriginalFileService.

setIRepositoryInfo

public final void setIRepositoryInfo(IRepositoryInfo iRepositoryInfo)
Disk Space Usage service Bean injector

Parameters:
iRepositoryInfo - an IRepositoryInfo

passivate

@Transactional(readOnly=true)
public void passivate()
Description copied from interface: StatefulServiceInterface
Perform whatever passivation is possible or throw an exception. A good passivation method will free up as much memory as possible, most likely by storing it to disk. A call to passivate should be safe even if the service is already passivated.

Specified by:
passivate in interface StatefulServiceInterface

activate

@Transactional(readOnly=true)
public void activate()
Description copied from interface: StatefulServiceInterface
Completely restore this service for active use from whatever passivation it has implemented. A call to activate should be safe even if the service is already activated.

Specified by:
activate in interface StatefulServiceInterface

save

@Transactional(readOnly=false)
public ome.model.core.OriginalFile save()
Description copied from interface: RawFileStore
Saves the OriginalFile associated with the service if it has been modified. The returned valued should replace all instances of the OriginalFile in the client. If save has not been called, RawFileStore instances will save the OriginalFile object associated with it on StatefulServiceInterface.close().

Specified by:
save in interface RawFileStore
See Also:
2161

close

@Transactional(readOnly=false)
public void close()
Description copied from interface: StatefulServiceInterface
signals the end of the service lifecycle. Resources such as Sessions can be released. All further calls will throw an exception.

Specified by:
close in interface StatefulServiceInterface

clean

public void clean()

setFileId

@Transactional(readOnly=true)
public void setFileId(long fileId)
Description copied from interface: RawFileStore
This method manages the state of the service.

Specified by:
setFileId in interface RawFileStore
Parameters:
fileId - an OriginalFile id.

exists

public boolean exists()
Description copied from interface: RawFileStore
Checks to see if a raw file exists with the file ID that the service was initialized with.

Specified by:
exists in interface RawFileStore
Returns:
true if there is an accessible file within the original file repository with the correct ID. Otherwise false.

read

public byte[] read(long position,
                   int length)
Description copied from interface: RawFileStore
Delegates to FileBuffer

Specified by:
read in interface RawFileStore
See Also:
FileBuffer.read(java.nio.ByteBuffer, long)

truncate

public boolean truncate(long length)
Description copied from interface: RawFileStore
Limits the size of a file to the given length. If the file is already shorter than length, no action is taken in which case false is returned.

Specified by:
truncate in interface RawFileStore

size

public long size()
Description copied from interface: RawFileStore
Returns the size of the file on disk (not as stored in the database since that value will only be updated on RawFileStore.save().

Specified by:
size in interface RawFileStore

write

public void write(byte[] buf,
                  long position,
                  int length)
Description copied from interface: RawFileStore
Delegates to FileBuffer

Specified by:
write in interface RawFileStore
See Also:
FileBuffer.write(java.nio.ByteBuffer, long)

isDiskSpaceChecking

public boolean isDiskSpaceChecking()
getter disk overflow checking

Returns:

setDiskSpaceChecking

public void setDiskSpaceChecking(boolean diskSpaceChecking)
setter disk overflow checking

Parameters:
diskSpaceChecking - a boolean


OmeroJava Api

Version: 4.3.4-dbcbce5a-b4

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