2 Replies Latest reply on Sep 27, 2012 5:15 AM by justin_at_adobe

    what is the best practise to provide a text file for a Java class in a OSGi bundle in CQ?

    adobe30022

      This is probably a very basic question so please bear with me.

       

      What is the best way to provide a .txt file to be read by a Java class in a OSGi bundle in CQ 5.5?

       

      I have been able to read a file called "test.txt" that I put in a structure like this /src/resources/<any-sub-folder>/test.txt  from my java class  at /src/main/java/com/test/mytest/Test.java using the bundle's getResource and getEntry calls but I was not able to use the context.getDataFile. How is this getDataFile method call to be used?

       

      And what if I want to read the file located in another bundle, is it possible? or can I add the file to some repository and then access it - but I am not clear how to do this.

       

      And I would also like to know what is the best practise if I need to provide a large  data set in a flat file to be read by a Java class in CQ5.

       

      Please provide detailed steps or point me to a how to guide or other helpful resources as I am a novice.

       

      Thank you in advance for your time and help.

       

      VS