Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2006

Tip: Looking for answers? Try searching our database.

Application wide variables with Tomcat/Axis

Thread view: 
pitthekid - 20 Sep 2006 14:01 GMT
Hello,

I have installed axis on Tomcat and a few WebServices.

My Problem: I want to have a >>APPLICATION WIDE OBJECT<<, which you can
reach from a WebService as well as a Java Application which is running
on this server.

I would like to have something similar to the Session Object on a Web
Page where you can add and remove items.

Scenario:
-------------
The Programm Codes who share a Class called MyQueue, which is a Class
which holdes
all the processes.

WebService1(Pseudo Code)/**Fills Queque with new Datasets*/
 public boolean fillQueue(int GUID, String ProcId){
        MyQueue myqueue = getLivingQueue(); //This function shell give
me the actual queque,

//NOT a new one!!
      MyQueueDataset  oneDataSet= myqueue.create() ;//Create a new
DataSet

                           //in the Queue.
      oneDataSet.setProcId(ProcId);
      oneDataSet.setGUID(GUID);
      oneDataSet.setStatus("InQueue");
      ...
     return true;
}

WebService2:(Pseudo Code)/*Find out Status of certain Queque*/
public String getStatusOfGUID(int GUID){
      MyQueue myqueue = getLivingQueue(); //This function shell give
me the actual queque,

//NOT a new one!!
      MyQueueDataset  oneDataSet = myqueue.getByGUID(GUID);
      return oneDataSet .status;
}

A Job:(Pseudo Code)/*Try to proceed DataSets which havent proceede
yet*/
Class Watcher(){
int static main(){
...
MyQueue myqueue = getLivingQueue();
while(1==1){
  ArrayList allJobsNotDone =
myqueue.getAllDataSetsWhichAreNotSuccessFullProceedd()
 while(allJobsNotDone.hasNext() ){
      MyQueueDataset  notJetSuccesfullProceedeJob =
allJobsNotDone.next();
     //Now we call a function which lets say try to put the values

    //of notJetSuccesfullProceedeJob into a database.
    proceed(notJetSuccesfullProceedeJob );

 }
}
}
}

Is this possible just with Tomcat?
Do I need a Messaging System (JMS) or something?

I would appreciate help very much.

Thanks in advanced,
Peter
Matt Humphrey - 20 Sep 2006 19:39 GMT
> Hello,
>
[quoted text clipped - 6 lines]
> I would like to have something similar to the Session Object on a Web
> Page where you can add and remove items.

I'm not entirely sure what you mean, but presuming that your web service
executes in a separate JVM (e.g. Tomcat) from your Java application you will
not be able to have a directly shared object.  You can, however, host the
object on a web service and have your standalone application access it via a
request or you can setup the object as an RMI service which is accessed from
both the application and the web service.

Matt Humphrey matth@ivizNOSPAM.com http://www.iviz.com/
Arne Vajhøj - 21 Sep 2006 00:58 GMT
> I have installed axis on Tomcat and a few WebServices.
>
[quoted text clipped - 4 lines]
> I would like to have something similar to the Session Object on a Web
> Page where you can add and remove items.

If the app is a GUI app or console app, then it should call
the web service too.

If it is a web app, then if the web app and the web service
is bundled and loaded with the same classloader, then they
can share objects (like a singleton).

Arne


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.