// Check if our Crosswalk actually wraps another Packager Plugin
if(xwalk instanceof AbstractPackagerWrappingCrosswalk)
{
// If this crosswalk wraps another Packager Plugin, we can pass it our Packaging Parameters
// (which essentially allow us to customize the output of the crosswalk)
AbstractPackagerWrappingCrosswalk wrapper = (AbstractPackagerWrappingCrosswalk) xwalk;
wrapper.setPackagingParameters(params);
}
//For a normal DisseminationCrosswalk, we will be expecting an XML (DOM) based result.
// So, we are going to wrap this XML result in an <mdWrap> element
MdWrap mdWrap = new MdWrap();
setMdType(mdWrap, metsName);
XmlData xmlData = new XmlData();
if (crosswalkToMetsElement(xwalk, dso, xmlData) != null)
{
mdWrap.getContent().add(xmlData);
mdSec.getContent().add(mdWrap);
return mdSec;
}
else
{
return null;
}
}
else
{
return null;
}
}
// If we didn't find the correct crosswalk, we will check to see if this is
// a StreamDisseminationCrosswalk -- a Stream crosswalk disseminates to an OutputStream
else
{
StreamDisseminationCrosswalk sxwalk = (StreamDisseminationCrosswalk)
PluginManager.getNamedPlugin(StreamDisseminationCrosswalk.class, xwalkName);
if (sxwalk != null)
{
if (sxwalk.canDisseminate(context, dso))
{
// Check if our Crosswalk actually wraps another Packager Plugin
if(sxwalk instanceof AbstractPackagerWrappingCrosswalk)
{
// If this crosswalk wraps another Packager Plugin, we can pass it our Packaging Parameters
// (which essentially allow us to customize the output of the crosswalk)
AbstractPackagerWrappingCrosswalk wrapper = (AbstractPackagerWrappingCrosswalk) sxwalk;
wrapper.setPackagingParameters(params);
}
// Disseminate crosswalk output to an outputstream
ByteArrayOutputStream disseminateOutput = new ByteArrayOutputStream();
sxwalk.disseminate(context, dso, disseminateOutput);