The generateBinFiles() method does not return the actual generated business object definitions. For Business Object Wizard to be able to access the generated content, the ODA class must implement the content-retrieval method for files. Business Object Wizard uses the information in the content-metadata object (which generateBinFiles() does return) to determine which content-retrieval method to call. For file content, Business Object Wizard calls the getBinFile() method to retrieve the generated business object definitions.
Regardless of the content protocol your ODA supports for generation of files, the ODA class must implement the getBinFile() method. This method is defined as part of the IGeneratesBinFiles interface. The method accepts as an argument an index, which identifies the number of files to return. It accesses these files in the generated-content structure and returns an array of the retrieved file (File) objects. The number of files in this array depends on the value of the index argument, as Table 48 shows.
For the sample Roman Army ODA, the FileCreator.run() method (defined in the ArmyAgent5 class) populates the m_files array with the generated files. Therefore, the getBinFile() method (also defined in ArmyAgent5) retrieves the specified number of files from this array. The following code shows the getBinFile() method for the sample Roman Army ODA:
public File[] getBinFile(long index) throws ODKException { if (index == ODKConstant.GET_ALL_OBJECTS) return m_files; else return new File[] {m_files[(int)index]}; }