if (!outputDir.exists() && !outputDir.mkdir())
Utils.rude("Failed to create directory " + outputDir);
// The class below is the one that will go through the header
// file(s)
Headers headers = new Headers();
if (null != interfaceHeaderFilename) {
Utils.postEvent(Utils.DEPLOYMENT_ARTEFACT_ENCOUNTERED, file
.getAbsolutePath());
Utils.postEvent(Utils.EVENT_TYPE_FILE_PARSED,
"Scagen processing C++ interface header "
+ file.getAbsolutePath());
headers.actOnFile(file, outputDir, 1);
Utils.outputDebugString("Parsing files...");
}
String nameOfSorR = null;
String referenceName = null;
String serviceName = null;
if (forReference) {
Object rn = parameters.get("/componentType/reference/@name");
if (rn instanceof String) {
referenceName = (String) rn;
nameOfSorR = referenceName;
}
} else {
Object sn = parameters.get("/componentType/service/@name");
if (sn instanceof String) {
serviceName = (String) sn;
nameOfSorR = serviceName;
}
}
String compositeXmlFileHeader = null;
String compositeXmlFileHeaderNoExt = null;
Object compositeh = parameters
.get("/composite/component/implementation.cpp/@header");
if (compositeh == null) {
compositeh = parameters
.get("/compositeFragment/component/implementation.cpp/@header");
}
if (compositeh instanceof String) {
File f = new File((String) compositeh);
compositeXmlFileHeader = (String) compositeh;
String fname = f.getName();
compositeXmlFileHeaderNoExt = fname.substring(0, fname
.lastIndexOf('.'));
}
String implClassNameAttrFromCompositeFile = (String) parameters
.get("implClass");
String implClassNamespaceAttrFromCompositeFile = (String) parameters
.get("implNamespace");
if(implClassNamespaceAttrFromCompositeFile == null || implClassNamespaceAttrFromCompositeFile.length() == 0)
{
implClassNamespaceAttrFromCompositeFile = "";
}
else
{
implClassNamespaceAttrFromCompositeFile += "::";
}
String interfaceClassNameAttrFromComponentTypeFile;
if (forReference) {
interfaceClassNameAttrFromComponentTypeFile = (String) parameters
.get("/componentType/reference/interface.cpp/@class");
} else {
interfaceClassNameAttrFromComponentTypeFile = (String) parameters
.get("/componentType/service/interface.cpp/@class");
}
List methods = headers.getAllMethods();
// Pull out one of the methods' namespace attributes.
String intfNamespace = null;
if (methods.size() > 0) {
Signature method = (Signature) methods.get(0);