if (dumpDir.exists() == true || dumpDir.mkdirs()) {
String dumpCacheFile = dumpDir + fs + dumpFileName;
// create file
FileOutputStream fos = new FileOutputStream(dumpDir + fs + dumpFileName);
// create xml writer and start dump
XMLDumpWriter writer = new XMLDumpWriter(fos);
writer.startDocument();
writer.writeStartElement("sc-dump");
writer.writeComment(" *************** APPCONTEXT INFOS ************ ");
AppContext.dumpAppContextInfos(writer);
writer.writeComment(" *************** CONFIGURATION *************** ");
AppContext.getBasicConfiguration().dump(writer);
writer.writeComment(" *************** RESPONDERS ****************** ");
AppContext.getResponderRegistry().dump(writer);
writer.writeComment(" *************** SERVICES ******************** ");
AppContext.getServiceRegistry().dump(writer);
writer.writeComment(" *************** SESSIONS ******************** ");
AppContext.getSessionRegistry().dump(writer);
writer.writeComment(" *************** SUBSCRIPTIONS *************** ");
AppContext.getSubscriptionRegistry().dump(writer);
writer.writeComment(" *************** SC CACHE ******************** ");
AppContext.getSCCache().dump(writer);
writer.writeComment(" *************** CACHE MODULES *************** ");
AppContext.getCacheModuleRegistry().dump(writer);
// end dump
writer.writeEndElement(); // end of sc-dump
writer.endDocument();
fos.close();
LOGGER.info("SC dump created into file=" + dumpCacheFile);
return dumpFileName;
} else {
LOGGER.error("Creating SC dump file =" + dumpPath + " failed, can not create directory");