|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fhg.igd.semoa.service.AbstractService
cbr.service.URLPicsSource
A class which implements the service that is used to advertise pictures loaded remotely from a base URL.
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" relative to the base URL of this plugin.
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 access the network. Malicious code can not create an instance of this class and exploit it to access the network.
PrivilegedOpen
,
Service
Field Summary | |
static int |
BUFFER_SIZE
The size of the buffer that is used to load images. |
protected URL |
pictures_
The URL from which pictures are loaded. |
protected URL |
thumbnails_
The URL from which thumbnails are loaded. |
private boolean |
warned_
A flag that surpresses multiple warnings. |
Fields inherited from class de.fhg.igd.semoa.service.AbstractService |
REV_POSTFIX, REV_PREFIX |
Constructor Summary | |
URLPicsSource()
Creates an instance to be registered on the given level using the given name. |
|
URLPicsSource(URL p,
URL t)
Creates an instance which loads images from the given URLs. |
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(URL url)
Loads a file into a byte array. |
String |
revision()
Returns the revision number of this class as a string. |
void |
setPictures(String url)
|
void |
setThumbnails(String url)
|
private void |
warn()
|
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 |
public static final int BUFFER_SIZE
protected URL pictures_
protected URL thumbnails_
private volatile boolean warned_
Constructor Detail |
public URLPicsSource()
public URLPicsSource(URL p, URL t)
p
- The URL containing the available
pictures.t
- The URL containing the thumbnails
for the available pictures.Method Detail |
public void setPictures(String url) throws MalformedURLException
MalformedURLException
public void setThumbnails(String url) throws MalformedURLException
MalformedURLException
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 Iterator iterator()
The way the path is formed is unsecure. Do not use in the field.
iterator
in interface PicsSource
public byte[] getPicture(String name)
The way the path is formed is unsecure. Do not use in the field.
getPicture
in interface PicsSource
name
- The name of the picture. This name
must be locally unique.
public byte[] getThumbnail(String name)
The way the path is formed is unsecure. Do not use in the field.
getThumbnail
in interface PicsSource
name
- The name of the picture. This name
must be locally unique.
private byte[] loadPicture(URL url)
private void warn()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |