java application updator - java

I have a java application which is used many computers in my office network. This is a java swing application, and when there is an update most of the time I have to update each computer. Currently there is a mechanism to update these applications automatically but it seems like it is not working properly, that is I have a simple table in the database which hold the released versions number and when the application starting it checks its' versions against the database. If it is not tally then it downloads the whole application from the FTP server which we have installed in our network.
Recently thought to create a server to do this task. But, I don't know whether it is a good practice to do.
My idea is, there is a server which can get the md5 hashes of each file in the FTP server and send that hash list and file list to its' clients. When the clients (my swing application) get this lists it compares those hashes against its' files and if there is a mismatch client can download that file from the FTP server.
Please tell me that is this a good method to do for updating a java application?

You should use Java Webstart.
It's designed for exactly this scenario: automatic downloading and update of an application from the internet and/or intranet.
It even does clever stuff like application versioning and ensuring that new files only get downloaded when they are needed through intelligent caching.

Another option:
Since this is in an internal network. If you don't want to use webstart (best option).
Create a small front end application that use a URLClass loader and always load it on the fly. Since this is an internal network unless the application is huge. It should take less then a couple of seconds to launch.

Related

Strategies for deploying QA and Production versions of a JavaFX application

For a JavaFX application which connects to a rest web service to function, are there any obvious strategies for building a single version of your application which knows which server environment (QA/Prod) to connect to? How is this type of thing "typically" done? Are separate QA and Production builds recommended?
Obviously, you'd want to make it easy for users to hit production without hassles, but also prevent your testers from accidentally interacting with production instead of QA.
This would be for a web-start JavaFX application, so while ideally the binaries would be identical, the main difference is the server the application came from (which web-start page they logged into initially to initiate their server side session).
If you are using JNLP-files, you might wan't to add some start-parameter on-the-fly, which controlls the targeted system. You could implement some download-page, where you adjust the parameters inside the JNLP-file, but this does not prohibit users from using the wrong downloaded JNLP-file.
Why not making it possible to select the server inside some settings, locked behind some "I want to be part of BETA-testing"-flag?
This question is not really JavaFX-related, more a general thing i guess ;)

Creating Copy of file over a network share

We have an enterprise application which saves some files on a network share (\\physicalfileserver\files\). We need to use a network share because the application is installed on multiple application server instances distributed over multiple physical server connected via LAN. Sometimes, we need to create a copy of certain files on the network share itself and save it in same the directory (on the same network share) with a different name or in a new directory (Again on the same network share). What is the most efficient way to create a copy of the file? I do not want to create any IO traffic on the network as the source and destination files reside on the same server. It also increases the time taken to create a copy of the file. This however, is difficult from What I have seen so far.
Reading files in input stream and writing them back on the server through an output stream with a different path/name.
FileUtils.copyFile() from apache commons.
NIO Channels library of JAVA (java.nio.channels.FileChannel.transferFrom())
However, all of them seem to copy the file to the server executing the program and then copy the data back to network share which isn't really required.
What can the gurus suggest to be the best possible approach to handle this situation? I can only use JAVA 1.5/1.6 due to some restrictions but am open to suggestions using higher java version as well.
The application is installed on a Windows 2008 server and the network share is also present on a Windows 2008 server.
Thanks
If you want to avoid network traffic you could write a small server in Java that would allow you to copy files locally (this would run on file server itself). Securing this would be quite important as this could pose huge security risk if somebody could use it to overwrite system files.

Accessing MS Access hosted in Ubuntu server from Java in a windows based VPS?

Hi I have this little big problem I have a legacy VB6 desktop application that connects to a MS Access database hosted in a local Ubuntu server machine that is being shared to the LAN as a SMB share and I have a Tomcat web application hosted in a Windows based VPS, these are
Requirements
Read information from the MS Access db and show it in the webapp (On URL visit and almost real-time accuracy).
Update the MS Access db with information received through the website.
Facts
20Mb < db size
Shared with 15 ~ 25 users.
Constant local update and querying.
The file size is small because It is being truncated as it grows tool large( > 100Mb)
Now I know that the arquitecture isn't the best and that MS Access is at its limits, a migration to full Java and MySQL is on the way, but it's going to take a long time....in the meantime I need a way to implement that feature, here are my options.
Option 1
Access the db in ubuntu server through a VPN directly from the webapp.
Cons
Is it possible?.
Slow connection.
May lock the db MORE frequently as it happens quite often locally.
Option 2
Have a local webapp run in Ubuntu server that exposes the db as a REST API, so updates would be handled by the local webapp.
Cons:
Hard to use MS Access in a UNIX environment, looking at unixODBC and FreeTDS, but so far I haven't been able to use it.
Well, writing the whole app and securing the server.
Option 3
Any suggestions?
Thank you if you read this far, any help is really appreciated.
Unless I missed something in your description, I think you might be confusing the differences between an API and a library. Basically, ODBC is an API which is implemented as a library and commonly used on Windows based machines through additional data access libraries like ADO and ADO.NET. I mention this since you referred to unixODBC as a solution. It would not be a complete solution as there is more to it than just the API alone.
In simple terms, the database file you created with Microsoft Access is a .MDB flat file database (ok, there is a little bit more to it, but in terms of treating it as a database, that is all that matters here). If you know how the structure of the .MDB file works, you could write your own library that reads/writes to it. Of course, this is not trivial and on the Windows platforms, this is provided for you by Microsoft using the libraries included in the OS. This is also referred to as a JET driver and database. JET is the database format that the .MDB file implements and is used by Access and other applications via the correspondingly named JET drivers.
So to find an equivalent option for non-Windows platforms, you need some sort of library that knows how to natively read/write to the .MDB file directly. If you are trying to use the .MDB file at the same time from an Access application, then you need to make sure the library you choose supports simultaneous mutli-user access to the database.
In a quick search, there do appear to be some solutions that I could find. The first one appears that it might have some functional limitations. The second appears to be a commercial product.
MDB Tools
Easysoft JET/Access Driver

Java EE Application Server and Perl scripts

Can a cgi-bin perl script from one WAR access files in another WAR, such as a .properties file??
==== DETAILS
I'm putting together a presentation to submit to IT reasons why we should upgrade our internal web server to a real web application server.
If you have read some of my other questions, you'd know that we run Sun Java System Web Server SP9 and RedHat Java 1.4.2. I know this version of Java has been deprecated around 2008. The Sun Server seems to be supported still even though they have a version 7 (although this server doesn't support some newer Java EE technology.)
I am trying to find security issues with our setup and one issue I can see right now is that as developers, we are told by IT to store database credentials in a provided folder/file that is only readable by the webserver. I demonstrated that I could write both a JSP and cgi perl script to read the DB credentials of the other developer's applications. Therefore they could do the same and read mine. An argument for a real application server is that this issue goes away.
Unless crossContext is true, doesn't a real application server prevent one application from accessing the Class files, JSP and other resources of another WAR??
Will the Application server also prevent perl scripts from doing the same??
I'm looking for anything that supports reasons why IT needs to upgrade.
An app server is actually likely more dangerous than a normal web server.
Typically what will happen in a modern web server, is that when the server executes your CGI code, it'll switch over to the user who owns the code, and thereby adopt it's rights and privileges.
Those privileges combined with permissions will limit what your script can and can not do.
If, for example, your CGI bin scripts can see those of other users, the permissions of those other files may simply be TOO permissive. If you look at their setting, you may well see that they're set to allow anyone to read them. By changing those permissions, the owners of those files can better limit who can and can not do.
With an application server, this is much less likely. All of the applications deployed within the app server (talking generic, off the shelf Java app servers here) all have the same credential for an OS perspective. None of the app servers I'm familiar with demarcate requests or transactions at the user level outside of the user that actually launched the app server.
Typically you have the user that runs the app server, and then you might have a credential for the database pool, but in essence that's it.
The problem now is that once the code starts making file system calls, there's nothing to tell the operating system that the file read call from Application X can not see the files and read them for Application Y. Even though they are separate apps within the app server, they're not separate from the operating systems perspective, and it's the operating system that enforces file level permissions.
Your operators should better configure their web server and the user account default permissions if locking down that kind of access is important to your site.

How to distribute a Java desktop application?

What is the alternative to distributing Java?
I don't want to add JRE in my extracted files.
I don't want to give away my .jar file to the user.
The end user just install and use application.
Which database to use so that the user don't need to configure like SQL Server.
How to decrease execution time of my application? It takes more time to execute.
Edit
It is an application without a database.
There should be a setup file which installs in Program Files and shortcut on the desktop and some registry entry to start it with start up application.
You can deliver Java desktop apps as Applets and (more recently) Java Web Start apps. Using these technologies means that users don't need to manually handle files.
As for RDBMS, there is a pure Java RDBMS going by the names JavaDB and Derby which might meet your needs.
There are many ways to improve the execution time of a program, it depends on what you've coded and what it does, for a start. I think you'll need to ask a specific question on that to get a useful answer.
Java Web Start works well as a distribution mechanism. Host the .jar on your site and your clients can download (provided they have a JRE). It'll select the appropriate JRE to use and allow you to update the application at your end with automatic downloads.
If you want a database, check out JavaDB. It's pure Java and comes as standard with Java 6. Your application can check for an existing db on start-up, and initialise/configure if not present. That will then remain for future invocations.

Categories

Resources