public class MetadataConverter extends Object
Modifier and Type | Field and Description |
---|---|
protected static String |
DEFAULT_XSLT
FIXME public as generic resource
|
protected org.apache.log4j.Logger |
logger |
protected Map<String,String> |
schemaNameId
Schema name to XSLT generic resource id map.
|
protected boolean |
setup |
protected Map<String,String> |
xsltCache
Id to XSLT map cache.
|
Constructor and Description |
---|
MetadataConverter(org.apache.log4j.Logger logger)
Create a new MetadataConverter.
|
Modifier and Type | Method and Description |
---|---|
String |
convert(String schemaName,
String xml,
org.gcube.application.framework.core.session.ASLSession aslSession)
Convert the given metadata XML to HTML.
|
String |
convertUsingDefault(String xml,
org.gcube.application.framework.core.session.ASLSession aslSession)
Convert the given XML to HTML using the default XSLT.
|
protected String |
getDefaultXSLT() |
protected String |
getXSL(String xsltId,
org.gcube.application.framework.core.session.ASLSession aslSession)
Get a XSLT from is id.
|
void |
isReady() |
protected String |
retrieveXSLT(String xslId,
org.gcube.application.framework.core.session.ASLSession aslSession)
Retrieve a schema from his generic resource.
|
protected void |
retrieveXSLTIds(org.gcube.application.framework.core.session.ASLSession aslSession)
Retrieve from user profile all transformation schemas id.
|
void |
setup(org.gcube.application.framework.core.session.ASLSession aslSession)
Load user xslt.
|
protected String |
transform(String xml,
String xslt)
Transform an XML string to HTML string using an XSLT processor.
|
protected org.apache.log4j.Logger logger
protected static final String DEFAULT_XSLT
protected boolean setup
public MetadataConverter(org.apache.log4j.Logger logger)
public void setup(org.gcube.application.framework.core.session.ASLSession aslSession)
aslSession
- public void isReady()
public String convert(String schemaName, String xml, org.gcube.application.framework.core.session.ASLSession aslSession) throws Exception
schemaName
- xml
- aslSession
- Exception
public String convertUsingDefault(String xml, org.gcube.application.framework.core.session.ASLSession aslSession) throws Exception
xml
- the XML to convert.aslSession
- the user session.Exception
protected void retrieveXSLTIds(org.gcube.application.framework.core.session.ASLSession aslSession)
aslSession
- protected String getXSL(String xsltId, org.gcube.application.framework.core.session.ASLSession aslSession) throws RemoteException
xsltId
- the XSLT id.aslSession
- RemoteException
protected String retrieveXSLT(String xslId, org.gcube.application.framework.core.session.ASLSession aslSession) throws RemoteException
xslId
- the schema id.aslSession
- RemoteException
protected String transform(String xml, String xslt) throws TransformerException
xml
- the XML to convert.xslt
- the XML used for the conversion.TransformerException
- if an error occurs.protected String getDefaultXSLT() throws IOException
IOException
Copyright © 2015. All Rights Reserved.