How to create a package with excel sheet data in AEM? - java

So, I have to make a package using the package manager of CRXDE. I need to add hundreds of paths to the filter by copying each of them one by one and it takes a lot of time by doing so. Is there any way I can upload a data file such as excel or CSV where the file contains all the paths and I can just build a package with it?

If the paths are query-able via AEM, you may try using the Query Packager tool from ACS AEM Commons.
Alternatively, you can write code to read through the CSV file and create the package programmatically.
Similar tools have already been created by a few people which you can leverage (see below) or build your own
Create Package in AEM from Excel File
Selective content packaging

Related

Adding custom metadata to binary files

How to include a custom metadata with a files without using a database to extract later using Apache Tika The files extension are *.doc .docx .pdf .txt .... *
this can be dong using PDFBox
this is an example on github with it's description on medium
https://github.com/enisinanaj/pdfbox-metadata-example
https://medium.com/#enisinanaj/how-to-write-custom-metadata-to-a-pdf-document-in-java-with-pdfbox-f52a82ab1b09
just add the Main method and call insertMetadata()
to set a costume metadata use
info.setCustomMetadataValue("ispublished", "true");

Upload JAR into database

Is it possible to upload jar as a file into database ? I need to upload jars into mongodb. I don't know how to do that. I know about file upload with Spring Boot.
I know it is possible to upload zip in database. But not finding information about JAR/WAR files.
JAR and WAR files are nothing more than a renamed ZIP file. If you want to see it yourself rename something.jar to something.zip and open it using archive manager.
Since you said you know how to upload a ZIP you should follow the same procedure. If the file is small (e.g. less than 4MB) perhaps using BSON is the best approach. See Storing Large Objects and Files in MongoDB.
If you mean saving a jar file into a database - it is depends on the database's support of BLOB data types.
And if you mean use Java language based stored procedures from JAR file - with Oracle and PostgreSQL this is possible. MongoDB supports server side JavaScript stored procedures only.

How can I add a file to another file which is such as named store.dat in Java?

All data must be stored in one single persistent file name secure_store.dat.
The following command should add new files to the Secure Store realm:
put [path_on_OS] [file_name]
How can I do this ?
How can I add a file that in my PC to secure.store ? Thank you.
If you don't mind that secure_store.dat will be a zipped file then you can use standard Java handling for zipped files...
Edit:
When you add multiple files together into one single file you must store them in such a way to preserve their boundaries, if you fail to do that the two or more files will become garbled mess.
java.util.zip functionality provides all features that you seem to need, it will create a zipped archive file with separate entries for each file that you add. It provides functionality to add/extract/remove files from the archive too.

Export Eclipse NAT Table to CSV/Excel

I am currently working on a project that uses a nat table to display data to a user. I am wanting to add an option to export this nat table to a csv file or an excel document. Is there an easy way to export to excel or must I find a way to do it manually? If I must do it "the hard way" can anyone point me somewhere to help me get started on exporting to Excel?
Thanks.
NatTable itself comes with a default exporter to Excel.
The exporter class is ExcelExporter (in package org.eclipse.nebula.widgets.nattable.export.excel).
An easy way to use this would be with ExportCommand (in package org.eclipse.nebula.widgets.nattable.export.command). With the default bindings, this results in a file chooser in which the user can specify a *.xls file.
ExportCommand cmd = new ExportCommand( m_table.getConfigRegistry(), m_table.getShell());
m_table.doCommand( cmd );
With version NatTable 0.9 on my system, when opening the file, Excel shows a warning that the file is in a different format than specified by the file extension.
NatTable comes with an Excel Exporter based on Apache POI already. You need to add the POI extension from the NatTable project to your project for this.
Doing this gives you the opportunity to use the HSSFExcelExporter which produces a valid Excel file (the default ExcelExporter simply creates a XML format) and comes with additional configuration possibilities.
configRegistry.registerConfigAttribute(ExportConfigAttributes.EXPORTER, new HSSFExcelExporter());
for reading / writing to excel you can use Apache POI http://poi.apache.org/
for how to get started with Apache POI look at http://viralpatel.net/blogs/java-read-write-excel-file-apache-poi/ might help

Update data documents for JWS deployed app

I have a swing application that uses many data files, these data files will change time to time. How can I load these data files on client's machine? Is there any way to create a folder like structure and run a batch file or so? Any help is appreciated.
There are several ways to do this:
Assume you want to ship your application with the datafiles, you may embed them as a zip/jar in your application-jar-file.
Extract the embedded zip to a temporary local file and use ZipFileSystemProvider to extract the content to some place on the disc.
Here is an example how to extract some content from zip/jar-file embedded in a .jar-file downloaded by JWS.
Same as 1, but skip the zip stuff and instead provide a list of all the resources you want to extract
One other way is to create the files pragmatically using either java.nio.file (java 7+) or java.io.File

Categories

Resources