aspose file tools*
The moose likes OO, Patterns, UML and Refactoring and the fly likes design question: 2 application A & B; needs to be in sync when new data is created on B. howto? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "design question: 2 application A & B; needs to be in sync when new data is created on B. howto? " Watch "design question: 2 application A & B; needs to be in sync when new data is created on B. howto? " New topic
Author

design question: 2 application A & B; needs to be in sync when new data is created on B. howto?

Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
Hi all,

I have 2 applications: A & B; (I have full access to both of them DBwise)
application A is on a privet network and B is on the WWW

Some data from B is required on A; for example: when a new 'employee' on B is 'created', system A needs to know about it
(the date of creation and the employeeID) . Today, enduserB sends an email to enduserA and s/he insert
the emloyeeID and creationDate in application A.

I wish to have all this automatically (to bypass the users) ... obviously there's more data then creationDate and
empoyeeID (but just to keep it simple)

I thought of 2 approaches (and feel free to criticize and/or come up with new ideas)

1. XML
Every time a new employee is created on B, an XML file will be produced (automatically) and will include all data
relevant to the new employee.
This file will be stored in a local folder on B and every hour application A will access this folder
and retrieve those XML files (from here it's simple, A will read them and INSERT to dbA)

2. Direct SQL
every hour application A will make a SELECT statement to db_B and will look for newly created employee,
if the return result is not 0 - INSERT the new employees to A.

Am I on the right track? could anyone come with a better idea???

thank you!!
Omar Al Kababji
Ranch Hand

Joined: Jan 13, 2009
Posts: 357
If and only if you are sure that the underlying DB of your application will not change, I mean if you are using postgres the DB will not one day change to mysql i would suggest to use triggers, that will do all the work, so that when from application A you go and insert a new tuple to the DB a trigger will be invoked and we do all the needed stuff to add the data for the DB of application B.

again if and only if you are sure you will not change the DB. ;) or you will have to rewrite all your triggers for the new DB


Omar Al Kababji - Electrical & Computer Engineer
[SCJP - 90% - Story] [SCWCD - 94% - Story] [SCBCD - 80% - Story] | My Blog
Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
Thank you Omar for your thoughts, but Ben Franklin said it best:

In this world nothing is certain but death and taxes.




any other thoughts?
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
Please explain what you mean by "B is on the WWW."

This file will be stored in a local folder on B and every hour application A will access this folder
and retrieve those XML files (from here it's simple, A will read them and INSERT to dbA)


Does this statement mean that application A has direct access to the file-system of application B?

If this is true, what is the significance of specifying that "B is on the WWW"?

Application B could be designed to use a web service to send data to application A when new data is created. This is the easiest solution.

Every time a new employee is created on B, it sends data to A via web service. This data-oriented web service would serve as a communications bridge between application B and A.
Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
thank you James for your input

Please explain what you mean by "B is on the WWW."

It means that any user can access the application as it is open to the public on the internet.

Does this statement mean that application A has direct access to the file-system of application B?

YES!

So you suggest to user a Web Service for this...any idea where to start the research? (I'm an eclipse user, using apache)
Thank you!

Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
A good start would be to learn the concepts of "web services" technology and the different ways a "web service" can be implemented. At it's core, a web service connects two or more applications in some way, either processing or data-oriented. A key note that is often misunderstood is that humans do not use web services directly. Only applicatons use them to communicate with other applications.

Some businesses have marketed "web services" as some feature that is hosted on the WWW (accessible by a human and a web browser). This is only marketing jargon.

As far and implementation, visit the Apache Axis web sites to learn about implementation details.

Extract from the draft W3C specification:

"SOAP is a lightweight protocol for exchanging structured information in a decentralized, distributed environment. It is an XML based protocol that consists of three parts: an envelope that defines a framework for describing what is in a message and how to process it, a set of encoding rules for expressing instances of application-defined datatypes, and a convention for representing remote procedure calls and responses."


Good luck!
 
 
subject: design question: 2 application A & B; needs to be in sync when new data is created on B. howto?
 
Similar Threads
ICE Test 285 solved 100 %
Webspere 345 exam questions
Need Help
157 Question Help and Resourses
how to check for the new file created in a directory