Document storage strategy for Java web apps - java

We have multiple web applications for different functional areas. There is no overlap of functionality between these apps and hence they are fairly independent. All these apps generate content like PDF and XML data. Currently all these apps are storing these documents in a path relative to their web root. The documents are accessed using url relative to the app specific web root.
Now we want to move to a design where these apps store the data/files in one central location and these documents can be accessed thru a URL outside of the specific application web root. Also we want these documents to be available even if the specific application is down.
We experimented with Apache Jackrabbit etc, but most of these are CMS tools that provide a lot more than what we want. We don't need full CMC capabilities since we don't really intend to do any web publishing, editing etc. We just need a simple way for multiple apps to store files in one single location and later access them thru a URL. Some thing probably like cloud storage.
Are there any tools out there that could help us implement this? Or Design pattern?
We need
beans from multiple apps to be able to save files in one central location (we can't use fixed disk drive location)
common url based access to these resources
We use: Java web apps on Tomcat 7 using JSF/Myfaces

Use an Apache web server (or other web server). Save the files in a folder published through HTTP by the server. To save them you can use any protocol that allows file transfer (FTP, SCP...).

Related

Implementing authentication in uploaded files in java

I have application where various files are uploaded in server. And the application has various users. Now, I want to implement authentication so that only privileged users can access to those uploaded documents. So, is there any document manager api in java to manage these documents. I have looked into alfresco, knowledgetree but those are separate applications. I want an api to implement in my application.
We do not have enough information to suggest a solution, but I think that you can still think to use Alfresco if you embed it in your application.
Look at the following url: Deployment options that shows some deployment options.
Of course, this makes sense only if you need all the power of Alfresco.

File storage for Java based web application

I'm in the processing of designing a Java based web application (Spring based to be specific). One of the key requirement is that, this application has to accept many files of various formats (pdf, jpeg, dwg, png etc.) uploaded by the user. Also, to be able to download back to user's local computer. There will be thousands of files being uploaded/downloaded.
I am thinking of two approaches:
Upload the documents to the same box where server is running. Mostly all the documents will be uploaded to, and downloaded from box where Tomcat is running. I'm worried that, as the documents grow in number, this may impact overall performance.
Upload/download documents to another server dedicated for storing/retrieving of documents.
If 2nd approach is taken, how Spring application can upload/download files to/from remote server? Or which approach is being used in the similar applications.
Or could you suggest any other optimal way of handling this requirement.
Thanks in advance.
Ganesh
Many modern applications built like this are going to use an external storage system like Amazon S3 to store these files, which buys you all kinds of nice features - high availability for downloads, an effectively unlimited pool of disk space, data replication, and so on.
There's a tutorial available for integrating spring with Amazon S3. You should check that out. Regardless of whether you choose S3 or something else, the approach will be similar.
Have you thought about using a DB. You could store those files as BLOBs. Here is a tutorial for this: link
"This tutorial walks you through the steps of building an interesting Spring MVC web application that allows the user to upload files from her computer to the server. The files are stored in database using Hibernate."
As to two approaches you consider:
Either way you will have to manage those files, back them up and check if there is enough space to store more files. Also this may cause some security issues as you accept all files.
I recommend you using a JCR like Apache Sling or Apache Jackrabbit.
Apache Sling™ is a framework for RESTful web-applications based on an extensible content tree with the following feautures:
Content resolution that maps a request URL to a content node in the content repository
Servlet resolution that maps a content node and a request method to a Servlet handling the request
Default servlets supporting WebDAV, content creation from web forms and JSON representation
A Javascript client library, allowing access to the content repository through AJAX
Support for server-side scripting with Javascript, JSP, Ruby, Velocity and Scala
OSGi-based extensibility through Apache Felix – the Felix Web Console was originally developed by the Apache Sling project

Library or jar that displays the remote system process list in Java

I am searching a library or jar file for making a system monitoring program. I found that Java provides jConsole, but I need some other jar file name.
actually i am making a web service in which i have ip address and port no of remote computer and based on that i need a system process list of that computer, and that web service i will call from the google apps engine that will display the whole process list. so i need name of jar file that can i place on server and that give me the process list.
I've built such a system before and JMX (java management extensions) was very useful.
http://www.oracle.com/technetwork/java/javase/tech/javamanagement-140525.html
examples and tutorials:
http://docs.oracle.com/javase/6/docs/technotes/guides/jmx/
You can install small agents on the machines you wish to monitor. These will gather information and either push it to a main monitoring server or the monitoring server will pull data whenever it wants from those monitored clients.
You will also need to have a database to store which attributes on which machines nodes you are monitoring. You can serialize the attributes with xstream, which creates an xml out of java objects and vice versa. You can store these in the database.
The attributes can be monitored by creating beans on the monitored machines.
You might also want to give Nagios a try - a commercial solution.
There is no jar file that you can get for free and just add it to your project (at least none that I know of right now).
It's a bit hard to understand what you are looking for, given that you din't provide much information. It sounds like you might be interested in JMX.

Is it typical for an enterprise Java Web App to need access to the filesystem?

Most of the Java web application we run in our shop for software development purposes need to have some kind of an APP_HOME directory created where the web application can do work. The applications I am thinking of here are things like Hudson, Nexus, Confluence, JIRA, etc. Perhaps these applications are special because they are for software development (with Confluence perhaps the notable exception).
However, it our own web application we are striving to avoid this requirement and thus saving all the configuration information in a database, whose access can be provided via a JNDI database and/or entity manager factory. NOTE: Our application does NOT have a requirement to do any heavy duty file management.
What are the pros/cons of have an enterprise web application that uses the filesystem for work. Is this typical?
Putting configuration in files makes it easy to put into version control; logging out to files is also pretty darn useful.
File systems are really, really good at storing large blobs of data and providing super fast access and manipulation for them (including fine-grained, byte level manipulation). If you need that, you can wrap the file system storage in a JNDI resource... Using a database for these things may have advantages (backup requirements are crystal clear), but the performance will be quite poor compared to direct file system access. That said, unless your app is actually performance limited by how quickly it can interact with the database for those specific activities, it's probably not worth second guessing yourself.

Efficient way to implement a client multiple file upload service

What is an efficient way to implement a multiple file client upload service?
Are there any popular libraries for that?
Basically I'm looking at a Web view, served a client, that would allow them to upload files: i.e browse their file system and choose say up to 6 files.
Is implementing the above service better than a single file upload-service. i.e allowing only one upload at a time?
If so what is an efficient way to implement that or again what popular libraries are there to use.
I'm building a Java Dynamic Web to be deployed on Tomcat.
Thanks
If you're looking to do multiple file uploads on the web, I would strongly recommend SWFUpload. It's totally customizable, and it can use whatever back end technology you'd like. Take a look at some of the demos on the site for some use cases involving multiple files at once. I've only used it in one project so far, but it beats some of the other third party upload controls I've used hands down.
If your clients can use modern builds of browsers, you can use multiple file upload field support that mozilla/webkit offers. Otherwise, YUIUpload from latest YUI3. Much cleaner/faster/easier than SWFUpload.

Categories

Resources