use of org.apache.axis2.corba.idl.PreProcessorInputStream in project axis-axis2-java-core by apache.
the class CorbaUtil method getIDL.
public static IDL getIDL(AxisService service, ORB orb, String dirName) throws CorbaException {
Parameter idlFile = service.getParameter(IDL_FILE);
if (idlFile == null) {
throw new CorbaInvocationException("Please specify the IDL file");
}
String idlFileName = ((String) idlFile.getValue()).trim();
String cacheKey = dirName + File.separator + idlFileName;
IDL idl = (IDL) IDL_CACHE.get(cacheKey);
if (idl == null) {
try {
/*File file = new File(dirName);
InputStream stream;
if (file.isDirectory()) {
stream = new FileInputStream(cacheKey);
} else {
ZipInputStream zin = new ZipInputStream(new FileInputStream(file));
ZipEntry entry;
boolean found = false;
while ((entry = zin.getNextEntry()) != null) {
if (entry.getName().equalsIgnoreCase(idlFileName)) {
found = true;
break;
}
}
if (!found)
new CorbaInvocationException("cannot find " + idlFileName + " in " + file.getPath());
stream = zin;
}*/
InputStream stream = new PreProcessorInputStream(dirName, idlFileName);
// TODO: Set pre-processor system and user input paths
IDLProcessor idlProcessor = new IDLProcessor(stream);
idl = idlProcessor.process();
stream.close();
IDL_CACHE.put(cacheKey, idl);
} catch (IOException e) {
throw new CorbaInvocationException("cannot process idl file", e);
}
}
Map types = idl.getCompositeDataTypes();
if (types != null) {
Iterator iter = types.values().iterator();
while (iter.hasNext()) {
DataType type = (DataType) iter.next();
if (type instanceof ValueType) {
StreamableValueFactory.register(orb, (ValueType) type);
}
}
}
return idl;
}
Aggregations