steve mcdonald

Ranch Hand
+ Follow
since Nov 18, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by steve mcdonald

if adding XML "HOT" technologies to your resume has importance, then add that layer. Other-wise there is no need to make things complicated.

"Good design is always Simple and there are Simple solutions to complex problems"

The world is crazy, we add layers into s/w and every one keeps talking/blog about its benefits, how it might change the world, and no sooner we start removing them to keep it simple.
Well,

Has anyone developed J2EE based application, that is hosting serving multiple dynamically growing client's. At any time, the clients may be added or removed from hosted envoronment with out having to shutdown the application server.


Requirement :
1. Develop a J2EE application, that would work in a hosted environment.
2. Each user logged into the system is identified by the Company Name.
3. Each company has its own exclusive application database.
4. There are separate company based DB connection pool DataSource's configured in the EJB container, so as to enlist the transactions in the container managed transactions.

Assumptions :
Application is stateless and only Stateless session EJB's are used, that may use several tiers of functional compositions of Classes/objects/helpers/DAO etc.,

1. Say there are 5 clients hosting environment. Do i need to define the resource references of all the JNDI datasources for all the customer databases in the ejb-jar.xml file, for every EJB deployed ?

It is a pain, how do i get around that, so that the addition of new clients to the hosted environment is seamless with out having to redeploy the several ejb's by adding the new company.

Any better ideas are always welcome ?

All ideas are greately appreciated.
What i read about the dependency injection strategy was that
the classes are container managed and the helper or any other classes underneath the covers cannot be benefitted. This will not help me in propagating the extra data through the composed classes.

May be i need to read more about it and see if i could use some interceptor or some sort
[ March 22, 2006: Message edited by: steve mcdonald ]
thanks ya all for the replies.

Well, several users can have/share the same role so that wouldn't work

what is this "Dependency Injection strategy", where can i get more details.

using ThreadLocal and anything to do with threads is not an option.

It is too Bad in EJB architecture, that they wouldn't expose Transaction Context of some sort, where every service call is a transaction and any credentials that need propagation could be saved into the context and that context could be looked up at any application layer to get access.

Some times i believe Microsoft arch has some neat nifty things to solve such problems easily.

The whole point was that, Our application architecture was designed to be a standalone customer installation. Now we are trying to make it a hosted environment, where the same J2EE application, based on the supplied user credentials will work with different customer JDBC connection pools and security etc.,.
Hi All,

We have a J2EE based product that has had several production deployments.

I will describe our architecture to give you an idea to provide suggestions :


|------| |------|
|tomcat| - |JBoss |
| JVM | | JVM |
|------| |------|
| |
|----------| |-------------|
| Session | | Application |
| Database | | Database |
|----------| |-------------|



* Tomcat JVM deployed a MVC web application, that
- creates a Session, when a user is authenticated, and persisted in a separate session database

- A typical session object has the user authentication details,
a.) logged on user,
b.) assigned role,
c.) company name etc.,

* JBoss serves all remote functional services, used by the tomcat WEB container, via EJB Stateless session services
- Each EJB Stateless service calls several methods and functional services across application tiers
such as

calls calls calls
Stateless Session Bean A => Class A => Class B => DAO => JDBC calls to the DB


PROBLEM :

Given this scenario, the problem that i am facing is.

1.) How do i pass, and have access, the session object credential information from Tomcat to EJB container, with out having to pass as a parameter. Because there are hundreds of services that needs to get the signature change, if done the brute force way.

2.) Let's say, we could get the session object credential to the EJB bean in step 1.
How do i pass that information all the way through the method calls, from all the application tiers all the way through EJB to the DAO layer.


I know some people might suggest using Thread Local variable functionality for the problem 2. But it is not advised or j2ee compliant to use threads and thread local objects in EJB container because the results are not predictable and not guaranteed to work in different J2EE application servers.

Appreciate all the help and suggestions
well,
i have been using Jbuilder for couple of years and am very comfortable with it. Currently am using JBuilder 2006 for all development.
Having the ide is much handy in terms of refactoring with out having to spend much time.

- Steve
Alan,

It is a good thing, not mandatory per instructions.

It may get little complicated with several options to choose.
such as
1. do i implement centralized logging for entire application to one file ?
2. do i have separate files per mode ? GUI/NetWork/Database etc
3. what levels to choose, debug/ info / warning / error etc.,

As there is no specification requirement in the instructions, i am planning not to do.

Most of the messages (implemented via ListResourceBundle, parameterized, meaning dynamic messages formatted at runtime with replaceable parameter placeholder) i am handling properly by reporting to the user with actual possible handled recoverable situations. All unhandled situations goes to the stdout/stderr.

Already i spent way too much time on this and want to put an end to it.

Re-reading the instructions get's me thinking into more complex problems and issues that i may have to code to handle as real application scenarios.

So i think i just put an end to some things that ought to be done and not necessarily nice to have.

Any comments/suggestions please

Andrew may have some insight on this

Thanks ya all for the excellent responses
- Steve
Guys,

I am not implementing any logging to the file. If in unhandled, catastrophic situations i just do a stdout, stderr. that's all

Am i fine getting away with out using logging API ?

Steve
Hi guys,
how ya all doing.
I am onto the partII-III thingy after a long laid back attitude of completing part I 2 yrs ago. I just started to read the instructions and will have many more questions/queries/clarifications to ask.

please bear with me and offer any possible help.
First i guess i need to start with the SCEA faq

thanks
Steve
thanks Andrew, it made simple for the assignment. that's what i have been struggling to decide the scope in my assignment. In reality we need to handle different transaction isolations, locks such as shared locks, row level, table level and what not .... etc.

well i just don't want to be hasty in making decisions. because i only have somuch patience and don't want to revisit this assignment over again.
not that haven't enjoyed the process. I am already seasoned professional and just want to get through this one.

Again thanks for your replies and i know it takes a great deal and effort to moderate.
just thought to let you guys know

10% Off a Sun Certification through December, 2005!
if any one interested and care.

http://www.sun.com/training/savings/cert_web.xml
> Thats a pretty difficult problem - and i beleive its out of scope
> of the assignment (at least for URLyBird)

Well I am doing the URLYBird also, the DBMain interface says to implement lock/unlock by this client.

// Locks a record so that it can only be updated or deleted by this client.
// If the specified record is already locked, the current thread gives up
// the CPU and consumes no CPU cycles until the record is unlocked.
public void lock(int recNo) throws RecordNotFoundException;

that means the client can call lock/unlock in any order, either in the business logic at the server or client. so if for some reason the client is exposed with this interface, then the business logic should protect from any other user from making changes while a record is locked.

in any case you can justify in your choices about your decisions.
Hi Alan,

> So instead of wait() call wait(time) to avoid deadlock.
> My question is how long I should wait ?
> The examples I have seen use 1000 but I'm not sure how to decide.

well there are 2 issues i think.

1. Transaction Max threshold - how long is too long ? for the current transaction to run. Actual processing time not including the wait on resource.

2. How long to wait for resource to be available and how and who is responsible to release resources that are held by abandoned clients.

The wait(time), will only address the issue of not waiting forlong if the resource is not available and let the user know that he/she cannot process because of ..... user friendly message. This will not address the core problem of releasing locked resources infinitely by abandoned clients.

On the other hand, this wait(time) call keeps consuming CPU intermittently, until the wait condition is satisfied, which i thought would not satisfy Sun's requirements "consuming no CPU cycles ". that's why i am not using the wait(time) call, though i coded initially and posted questions on this forum.

Having said that, implementing a mechanism of cleaning of unused/stale resources with a Transaction MAX Threshold and notifing waiting clients will provide solution to potential deadlocks.

Anyway, atleast this is my opinion.
> Do you use a Data instace for each client ?

Yes, to pass the client identifier with out changing the the interface DBMain implementation.
Andrew,

Actually i meant the Application layer, sorry i typed as Database layer

My design has the following :

1. GUI uses BusinessDelegate for application facade services

2. BusinessDelegate - Shields GUI from where services are implemented,
like a facade and serves GUI. This essentially provides GUI with rich coarse grained functional services using AppServer Services

3. ServiceLocator - used by BusinessDelegate to locate Local or Remote implementation, under the covers, based on the mode, that implements BusinessServiceInterface

Note.: BusinessServiceInterface is what i defined that are basic coarse grained services that GUI definetly need. BusinessDelegate may develop more higher level services based on these basic services

4. ServiceLocator - locates Local or Remote service based on the mode of startup

5. BusinessServiceImpl - Actual implementation of AppServer side Business logic that implements BusinessServicesInterface. (currently this works in the same JVM as the data access classes, no middle tier, but will support if needed.)

6. BusinessServiceImpl uses Data class (that implements DBMain interface)

7. Data Class uses DataFileHandler class. DataFileHandler class is actually a handle to the specified datafile that is responsible for Navigation of the filepointer and reading and writing bytes (raw data) in and out to the file. Also has enough synchronization to provide concurrent access and protect data integrity. Because i am just using one fileHandle/FilePointer to navigate and perform specified actions.

8. Data class uses Lock Manager handling the logic to lock unlock, clearing stale locks.