Hi Michael,

This is exactly what I use CORBA and most of my beans for. Here's how I
do
it, which is my no means the best way:

On the serverside (ie, CORBA server) I have a factory object that makes
my classes for me. On the client side (web server) I have a bean which
exposes methods, and is basically a mirror (with not functionallity) of
the server-side object:

public class StateBean {
  private NewUser _newUser = null;
  private ProductList _productList = null;

  private BrockerFactory factory = null;
  private String sessionID = "";

  public StateBean() {
    java.lang.String[] nothing = null;
    org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(nothing, null);
    factory = BrockerFactoryHelper.bind(orb);
  }

  public void id(String session) {
    sessionID = session;
  }

  public UserAccount userAccount() {
    if (_userAccount == null) {
      _userAccount = factory.getUserAccount(sessionID);
    }
    return _userAccount;
  }

  public ProductList productList() {
    if (_productList == null) {
      _productList = factory.getProductList(sessionID);
    }
    return _productList;
  }
...
}

(there's loads more to it, and the sessionID is the users UID for that
session, so I can clean up at the end).

Basically, when ever I need to reference an object on the server side,
I just call into this - if there is one already, it just gives it back,
otherwise, I get a new one from the other side. The StateBean itself it
just stored in the session, something like:

<USEBEAN NAME="clientState" TYPE="brocker.StateBean" LIFESPAN="session"
CREATE="yes">
</USEBEAN>

<%
  brocker.brockerEcommerce.ProductList productList =
clientState.productList();

..//use productlist like normal

%>

I dont think you can do a direct mapping thru, as you would then have to
somehow implement/inherit from your CORBA objects. I had seperate
objects for each one, but in general I found it more efficient/tidier to
do it this way.

Nic.


Michael Rumpf wrote:
>
> Hi !
>
> We have created a CORBA Document Object Model implementation in C++ which we
> use to parse XML documents very quickly. We want to keep the object (i.e. a
> parsed document) over several pages.
> What I have read so far is that we could create a bean to store the object
> reference so that we can access it frmo different pages.
> But this is not a very elegant way to do that. Is it possible to write a
> bean wrapper so that we can use the CORBA DOM object as a bean ?
> Or, what other ways do you see to keep a CORBA object over a session ?
>
> Any help would be highly appreciated....

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to