Read a Excel from OSGI : The Right Approach | Community
Skip to main content
Level 4
November 6, 2015
Solved

Read a Excel from OSGI : The Right Approach

  • November 6, 2015
  • 2 replies
  • 1261 views

I need to read a key value pair (Stored in Excel) in one of the OSGi service.

I am thinking of three approaches:

  1. Store the Excel under Resources for Osgi bundle , and read the Excel using :

File file = File.createTempFile("test",".xls");

contentStream=class.getClassLoader().getResourceAsStream("TextExcel"); 

 

outputStream = new FileOutputStream(file);         

IOUtils.copy(contentStream, outputStream);

 

And then Parse the Excel to get the Value

 

2  Similar approach like 1 but store it as XML  and Parse it

 

3 Convert these Key Value Pairs (Excel) in to JCR Node Structure (It will be about 150 nodes) and then parse the node.

 

I feel option 1, 2 can consume relatively less number of operations than traversing the JCR nodes.

 

What should be the right approach for this?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Ratna_Kumar

Hi,

You you refer this article which says custom excel service using OSGI for your use case - Right approach!!!

https://helpx.adobe.com/experience-manager/using/creating-custom-excel-service-experience.html

Thanks,
Ratna Kumar.

2 replies

Ratna_Kumar
Ratna_KumarAccepted solution
Level 10
November 6, 2015

Hi,

You you refer this article which says custom excel service using OSGI for your use case - Right approach!!!

https://helpx.adobe.com/experience-manager/using/creating-custom-excel-service-experience.html

Thanks,
Ratna Kumar.

Radha_Krishna_N
Level 3
November 10, 2015

Hi,

Upload the excel to DAM (a predefined location) in the OSGI bundle.

Get an inputstream to the excel 'resource'.

Pass the stream to HSSF(.xls) or XSSF(.xlsx) POI API.

Read the cell values populate in a POJO then play with POJOs

Thanks,

Radhakrishna N