Expand my Community achievements bar.

SOLVED

Read a Excel from OSGI : The Right Approach

Avatar

Level 4

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?

1 Accepted Solution

Avatar

Correct answer by
Level 10

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.

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

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.

Avatar

Level 4

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