try
{
if (m_keystoreFile != null)
{
boolean bHasKeyStore = false;
Param param = null;
if (m_paramList != null)
{
for (Iterator paramItr = m_paramList.iterator(); paramItr.hasNext();)
{
param = (Param)paramItr.next();
if (param.getName().equals("clusterKeyStore") && param.shouldUse())
{
bHasKeyStore = true;
break;
}
}
}
if (!bHasKeyStore)
{
param = new Param();
fis = new BufferedInputStream(new FileInputStream(m_keystoreFile));
ByteArrayOutputStream dataStream = new ByteArrayOutputStream();
IOUtil.copy(dataStream, fis);
param.setName("clusterKeyStore");
param.setExpression(Base64Util.encode(dataStream.toByteArray()));
addConfiguredParam(param);
IOUtil.close(fis);
}
}
fis = new BufferedInputStream(new FileInputStream(m_propFile));
encReader = new InputStreamReader(fis, "UTF-8");
Object cipher = dispatcher.create(encReader);
Reader decReader = null;
if (cipher instanceof CharacterStreamCipher)
{
decReader = ((CharacterStreamCipher)cipher).createDecryptedReader(encReader);
}
else
{
IOUtil.close(encReader);
IOUtil.close(fis);
fis = null;
encReader = new StringReader((String)cipher);
decReader = encReader;
cipher = dispatcher;
// The file was not encrypted at all
props.setProperty("cipher.scheme",
props.getProperty("cipher.scheme", CharacterStreamCipherDispatcher.SCHEME_TEXT));
dispatcher.init(props);
}
// Read from disk, applying XSLT transformation if necessary
Document doc;
if (m_styleFile != null)
{
TransformerFactory factory = (TransformerFactory)Class.forName(
"org.apache.xalan.processor.TransformerFactoryImpl").newInstance();
FileInputStream styleStream = new FileInputStream(m_styleFile);
Transformer transformer = factory.newTransformer(new StreamSource(styleStream));
// Read and set the transformation parameters
if (m_paramList != null)
{
for (int i = 0; i < m_paramList.size(); i++)
{
XSLTProcess.Param param = (XSLTProcess.Param)m_paramList.get(i);
if (param.shouldUse())
{
transformer.setParameter(param.getName(), param.getExpression());
}
}
}
Source source = new StreamSource(decReader);