|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.fhg.igd.semoa.service.AbstractService cbr.service.PictureDB
A class which implements the service that is used to advertise the pictures.
This class provides an iterator for the pictures in the
configured picture directory. This iterator attempts to
open and read line by line a file with the name "
ls.txt" in the picture directory. This file must
contain the names of the known pictures. Such a file
can be created simply by issuing the command ls
>ls.txt
in the picture directory.
Iterating through the picture names and loading pictures
requires that this class has privileges to read said
files and that the reading instance is created by a class
that has said privileges also. Malicious code can not
create an instance of this class and exploit it to access
said directories. See AbstractService
for details.
Be careful, this class contains a security hole that might allow untrusted code to delete files!
PrivilegedOpen
,
Service
Field Summary | |
protected File |
pictures_
The directory from which pictures are loaded. |
protected File |
thumbnails_
The directory from which thumbnails are loaded. |
Fields inherited from class de.fhg.igd.semoa.service.AbstractService |
REV_POSTFIX, REV_PREFIX |
Constructor Summary | |
PictureDB()
Creates an instance. |
|
PictureDB(File p,
File t)
Creates an instance which loads images from the given directories. |
Method Summary | |
String |
author()
Returns the name of the author of the service. |
byte[] |
getPicture(String name)
Retrieves a picture based on the name. |
byte[] |
getThumbnail(String name)
Retrieves a thumbnail based on the name. |
String |
info()
Returns the informative string which should describe the service's essence in a sentence. |
Iterator |
iterator()
Returns an iterator that iterates the names of the available pictures. |
private byte[] |
loadPicture(File file)
Loads a file into a byte array. |
String |
revision()
Returns the revision number of this class as a string. |
void |
setPictures(File file)
|
void |
setThumbnails(File file)
|
Methods inherited from class de.fhg.igd.semoa.service.AbstractService |
checkDependencies, dependencies, docs, doPrivileged, doPrivileged, getACC, getEnvironment, majorVersion, minorVersion, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected File pictures_
protected File thumbnails_
Constructor Detail |
public PictureDB()
public PictureDB(File p, File t)
p
- The directory containing the available
pictures.t
- The directory containing the thumbnails
for the available pictures.Method Detail |
public String author()
AbstractService
author
in interface Service
author
in class AbstractService
public String revision()
AbstractService
majorVersion()
, minorVersion
based on the assumption that this method returns a
revision string as generated by rcs(1) for the template
"$Revision: 1.7 $/$Date: 2007-08-08 04:41:53 +0200 (Wed, 08 Aug 2007) $".
revision
in class AbstractService
public String info()
AbstractService
info
in interface Service
info
in class AbstractService
public void setPictures(File file)
public void setThumbnails(File file)
public Iterator iterator()
iterator
in interface PicsSource
public byte[] getPicture(String name)
getPicture
in interface PicsSource
name
- The name of the picture. This name
must be locally unique.
public byte[] getThumbnail(String name)
getThumbnail
in interface PicsSource
name
- The name of the picture. This name
must be locally unique.
private byte[] loadPicture(File file)
file
- The file to load.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |