Dataholder[] argv = new Dataholder[1];
argv[0] = Dataholder.create(list);
Database conn = CacheDatabase.getDatabase(con);
Dataholder res;
try
{
res = conn.runClassMethod("CM.methgetClassDefinition", "getClassDefinition", argv, Database.RET_OBJECT);
}
catch (CacheException e)
{
Statement stat = con.createStatement();
stat.executeUpdate
(
"CREATE METHOD CM.getClassDefinition(IN className %String)\n" +
"RETURNS Integer\n" +
"PROCEDURE\n" +
"LANGUAGE COS\n" +
"{\n" +
" new id,oref,oFile,file\n" +
" if $F($ZV,\"Linux\") \n" +
" set file = \"$HOME/CacheTemp\"_$job_\".xml\"\n" +
" else \n" +
" set file = \"c:\\\\temp\\\\$CacheTemp\"_$job_\".xml\" \n" +
" do $SYSTEM.OBJ.ExportCDL(className ,file, \"-d\")\n" +
" set oFile = ##class(%FileBinaryStream).%New()\n" +
" do oFile.LinkToFile(file)\n" +
"\n" +
" set outStream = ##class(%GlobalCharacterStream).%New()\n" +
" do outStream.CopyFrom(oFile)\n" +
" quit outStream\n" +
"}"
);
stat.close();
res = conn.runClassMethod("CM.methgetClassDefinition", "getClassDefinition", argv, Database.RET_OBJECT);
}
CacheObject cobj = res.getCacheObject();
CharacterStream characterStream = (CharacterStream) (cobj.newJavaInstance());
CacheReader reader = characterStream.getReader();
StringBuffer sb = new StringBuffer();