|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectverinec.adaptation.repository.XSLFileRepository
public class XSLFileRepository
Implementation of the interface for managing the XSL translation stylesheets.
The translators and restrictors are stored in a directory named after
the service they translate, the filename is the name of the implementation
with the extension .xsl.
The top directory is defined by the system property
verinec.adaptation.repository.xslfile_basedir which should
denote either an absolute path or one relative to the current working
directory. If the property is not defined, ./translation is
used.
The directory structure is created as
{basedir}/{service-name}/translators/{name}.xsl
{basedir}/{service-name}/restrictors/{name}.xsl
A service-name could be 'packet-filters' or 'ethernet' (if hardware has children ethernet|wlan|serial, they are treated as service). A name could be 'iptables' or 'linux-redhat'.
If a restrictor is not present, the file {basedir}/unrestricted.xsl is used instead.
All translators and restrictors get cached. The cache never gets emptied,
because we assume there is only a limited diversity of translators that gets
ever used.
Translators are never re-read from file after they
have been used for the first time!
(Unless you restart the application, that is)
If a translator is not found in the directory, the repository tries to load it as a resource from location /res/translation/{service-name}/translators/{name}.xsl. To provide such a resource, place the file under that location into one of the jars in the classpath.
| Field Summary | |
|---|---|
private static File |
fileRoot
The directory under which repository looks for xsl files. |
private Logger |
log
|
private static String |
RESTRICT_DIR
Directory name inside fileRoot for restrictors |
private Hashtable |
restrictors
Cache for the restrictors |
private static String |
TRANSLATE_DIR
Directory name inside fileRoot for translators |
private Hashtable |
translators
Cache for the translators |
| Constructor Summary | |
|---|---|
XSLFileRepository()
Instantiate the repository, creating the necessary files. |
|
| Method Summary | |
|---|---|
XSLTransformer |
getRestrictor(String service,
String name)
Get a restriction analyzer. |
String[] |
getServiceNames()
Get the names of all existing services. |
XSLTransformer |
getTranslator(String service,
String name)
Get a translator. |
String[] |
getTranslatorNames(String service)
Get all available translators for this service |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final File fileRoot
This is set by the system property verinec.adaptation.repository.xslfile_basedir and defaults to ./translation if not set.
If the files are not there, looks also in the classpath to load it as a resource from /res/translation
private static final String TRANSLATE_DIR
private static final String RESTRICT_DIR
private Hashtable translators
private Hashtable restrictors
private Logger log
| Constructor Detail |
|---|
public XSLFileRepository()
| Method Detail |
|---|
public String[] getServiceNames()
getServiceNames in interface ITranslationRepository
public String[] getTranslatorNames(String service)
throws VerinecException
getTranslatorNames in interface ITranslationRepositoryservice - Name of the service to retreive translators for
VerinecException - if there is no such service
public XSLTransformer getTranslator(String service,
String name)
throws VerinecException
The translator transforms a abstract xml configuration into concrete configuration for a target system.
getTranslator in interface ITranslationRepositoryservice - Name of the service the desired translator should be forname - Type of target system for the translation
VerinecException - If there is no translator
public XSLTransformer getRestrictor(String service,
String name)
throws VerinecException
getRestrictor in interface ITranslationRepositoryservice - Name of the service this translator is forname - Name of translation to retreive
VerinecException - If there is no translator
|
Copyright © 2005 Verinec, DIUF | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||