XML mapping to objects - Model 2 architecture for config file.

2000-05-22 Thread Kevin Duffey

This may be a bit inappropriate for this group, but it follows on the heels
of me implementing the Model 2 architecture we all have been discussing so
much. I have a working Model 2, but, I want to read in my xml config file. I
am using the sun/xml parser because we use it in a couple of places on our
site. However, my first stab at reading in the XML into a DOM object, while
its being read in, trying to get each element and its value (not attribute)
has proven to be a pain in the butt.

So, my question is, is there any way I can just create a class and have the
XML parser map the right elements (by name) and place the values after those
tags directly into an instance of an object? It would also need to be able
to add items to a vector, or table of some sort. For example, my config file
looks like so:



Login
com.bm.ui.actions.Login





Enroll
com.bm.ui.actions.Enroll






So, if I have class like:

public class ActionObject
{
  private String  actionName = "";
  private String  actionClass = "";
  private Hashmap results = new Hashmap();

  public ActionObject()
  {
  }

  ... and so on ...
}

Is there a way to automatically get the XML document to map the ,
 and  tags and attributes and their values directly
to an instance of the object..so that I can do something like:

... read XML document in...
ActionObject ao = new ActionObject(XmlDoc);
while( ao.hasMoreActions() )
{
  Object o = ao.nextAction();
  mytable.add( o );
}


In sum, the few lines above would simply use my ContollerServlet
(ServletContext) hashtable object that stores each action, to cycle through
my own class (ActionObject) which when created was populated automatically
(perhaps through reflection of xml to the object) with the xml config data,
and now I am just looping through and adding it to the hash table.
OFcourse..if ao contains the entire config tree..there is no need to do
another table..this is all hypothetical..for the use to hopefully explain
what I am trying to do.

Thanks for anyone that can help.

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets



Re: XML mapping to objects - Model 2 architecture for config file.

2000-05-22 Thread Craig R. McClanahan

Kevin Duffey wrote:

> [snip]
> So, my question is, is there any way I can just create a class and have the
> XML parser map the right elements (by name) and place the values after those
> tags directly into an instance of an object? It would also need to be able
> to add items to a vector, or table of some sort. For example, my config file
> looks like so:
>
> 
> 
> Login
> com.bm.ui.actions.Login
> 
> 
> 
>
> 
> Enroll
> com.bm.ui.actions.Enroll
> 
> 
> 
> 
> 
>

I will (shortly) be able to help you with this issue, as well as several others.

I'm putting the finishing touches on a small Model 2 based framework that will be
open sourced, and will contain the following tools:

* Basic "model 2" servlet with action interfaces and some
  other support classes.

* Custom tag library for some common use cases in Model 2
  scenarios, including internationalization.

* Support for populating bean properties directly from request
  parameters (like JSP can do with the "*" wildcard).

* Processing XML files like the one above, and creating new
  objects (and populating properties) from them elegantly,
  based on simple processing rules that you define.

Look for an announcement of code availability for this for JavaOne.  In addition, I
will be present at many of the BOFs and Sessions (TS) related to servlet and JSP
technology, including speaking at some of them.  This code will be one of the case
study examples.  Hope to see you there!

Craig McClanahan

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets



Re: XML mapping to objects - Model 2 architecture for config file.

2000-05-22 Thread Jim Nicolson

hi Kevin

Pending the release of the Java XML Binding
implementation you could use DXML from ObjectSpace

http://www.objectspace.com/downloads/

regards
Jim Nicolson

-Original Message-
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Kevin Duffey
Sent: Tuesday, 23 May 2000 05:48
To: [EMAIL PROTECTED]
Subject: XML mapping to objects - Model 2 architecture for config file.


This may be a bit inappropriate for this group, but it follows on the heels
of me implementing the Model 2 architecture we all have been discussing so
much. I have a working Model 2, but, I want to read in my xml config file. I
am using the sun/xml parser because we use it in a couple of places on our
site. However, my first stab at reading in the XML into a DOM object, while
its being read in, trying to get each element and its value (not attribute)
has proven to be a pain in the butt.

So, my question is, is there any way I can just create a class and have the
XML parser map the right elements (by name) and place the values after those
tags directly into an instance of an object? It would also need to be able
to add items to a vector, or table of some sort. For example, my config file
looks like so:



Login
com.bm.ui.actions.Login





Enroll
com.bm.ui.actions.Enroll






So, if I have class like:

public class ActionObject
{
  private String  actionName = "";
  private String  actionClass = "";
  private Hashmap results = new Hashmap();

  public ActionObject()
  {
  }

  ... and so on ...
}

Is there a way to automatically get the XML document to map the ,
 and  tags and attributes and their values directly
to an instance of the object..so that I can do something like:

... read XML document in...
ActionObject ao = new ActionObject(XmlDoc);
while( ao.hasMoreActions() )
{
  Object o = ao.nextAction();
  mytable.add( o );
}


In sum, the few lines above would simply use my ContollerServlet
(ServletContext) hashtable object that stores each action, to cycle through
my own class (ActionObject) which when created was populated automatically
(perhaps through reflection of xml to the object) with the xml config data,
and now I am just looping through and adding it to the hash table.
OFcourse..if ao contains the entire config tree..there is no need to do
another table..this is all hypothetical..for the use to hopefully explain
what I am trying to do.

Thanks for anyone that can help.

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets



Re: XML mapping to objects - Model 2 architecture for config file.

2000-05-22 Thread Kevin Duffey

Hi,


> I will (shortly) be able to help you with this issue, as well as
> several others.
>
> I'm putting the finishing touches on a small Model 2 based
> framework that will be
> open sourced, and will contain the following tools:
>
> * Basic "model 2" servlet with action interfaces and some
>   other support classes.
>
> * Custom tag library for some common use cases in Model 2
>   scenarios, including internationalization.
>
> * Support for populating bean properties directly from request
>   parameters (like JSP can do with the "*" wildcard).
>
> * Processing XML files like the one above, and creating new
>   objects (and populating properties) from them elegantly,
>   based on simple processing rules that you define.
>
> Look for an announcement of code availability for this for
> JavaOne.  In addition, I
> will be present at many of the BOFs and Sessions (TS) related to
> servlet and JSP
> technology, including speaking at some of them.  This code will
> be one of the case
> study examples.  Hope to see you there!

I'll be there!! Can you give me time/days you'll be speaking! I'll be sure
to attend those. I only get to go for two days, so I want to make sure I
make the most of my two days. My main focus/interest will be on servlets,
jsp, javabeans, and ejb use with the model/action framework we have been
discussing. You should put the framework on CD for the show! ;)


Sounds great. The open-source framework you are working on sounds right up
my alley. Any idea when it will be done and ready to be used?

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets



Re: XML mapping to objects - Model 2 architecture for config file .

2000-05-22 Thread Visweshwar Ghanakota

Hi,
you can also take a look at BeanMaker from IBM's alphaworks.

vishu

> -Original Message-
> From: Jim Nicolson [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, May 23, 2000 4:08 AM
> To:   [EMAIL PROTECTED]
> Subject:      Re: XML mapping to objects - Model 2 architecture for config
> file.
>
> hi Kevin
>
> Pending the release of the Java XML Binding
> implementation you could use DXML from ObjectSpace
>
> http://www.objectspace.com/downloads/
>
> regards
> Jim Nicolson
>
> -Original Message-
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Kevin Duffey
> Sent: Tuesday, 23 May 2000 05:48
> To: [EMAIL PROTECTED]
> Subject: XML mapping to objects - Model 2 architecture for config file.
>
>
> This may be a bit inappropriate for this group, but it follows on the
> heels
> of me implementing the Model 2 architecture we all have been discussing so
> much. I have a working Model 2, but, I want to read in my xml config file.
> I
> am using the sun/xml parser because we use it in a couple of places on our
> site. However, my first stab at reading in the XML into a DOM object,
> while
> its being read in, trying to get each element and its value (not
> attribute)
> has proven to be a pain in the butt.
>
> So, my question is, is there any way I can just create a class and have
> the
> XML parser map the right elements (by name) and place the values after
> those
> tags directly into an instance of an object? It would also need to be able
> to add items to a vector, or table of some sort. For example, my config
> file
> looks like so:
>
> 
> 
> Login
> com.bm.ui.actions.Login
> 
> 
> 
>
> 
> Enroll
> com.bm.ui.actions.Enroll
> 
> 
> 
> 
> 
>
> So, if I have class like:
>
> public class ActionObject
> {
>   private String  actionName = "";
>   private String  actionClass = "";
>   private Hashmap results = new Hashmap();
>
>   public ActionObject()
>   {
>   }
>
>   ... and so on ...
> }
>
> Is there a way to automatically get the XML document to map the ,
>  and  tags and attributes and their values
> directly
> to an instance of the object..so that I can do something like:
>
> ... read XML document in...
> ActionObject ao = new ActionObject(XmlDoc);
> while( ao.hasMoreActions() )
> {
>   Object o = ao.nextAction();
>   mytable.add( o );
> }
>
>
> In sum, the few lines above would simply use my ContollerServlet
> (ServletContext) hashtable object that stores each action, to cycle
> through
> my own class (ActionObject) which when created was populated automatically
> (perhaps through reflection of xml to the object) with the xml config
> data,
> and now I am just looping through and adding it to the hash table.
> OFcourse..if ao contains the entire config tree..there is no need to do
> another table..this is all hypothetical..for the use to hopefully explain
> what I am trying to do.
>
> Thanks for anyone that can help.
>
> ==
> =
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
> ==
> =
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets



Re: XML mapping to objects - Model 2 architecture for config file.

2000-05-24 Thread Robert Nicholson

I have a question...

What is meant in this case by Model 2? Just a set of JSP pages that are
using servlets for their actions? If not what else constitutes model 2? Just
using servlets are "controllers?" ie. directing navigation, fetching data
etc?


> -Original Message-
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Kevin Duffey
> Sent: Monday, May 22, 2000 12:48 PM
> To: [EMAIL PROTECTED]
> Subject: XML mapping to objects - Model 2 architecture for config file.
>
>
> This may be a bit inappropriate for this group, but it follows on
> the heels
> of me implementing the Model 2 architecture we all have been discussing so
> much. I have a working Model 2, but, I want to read in my xml
> config file. I
> am using the sun/xml parser because we use it in a couple of places on our
> site. However, my first stab at reading in the XML into a DOM
> object, while
> its being read in, trying to get each element and its value (not
> attribute)
> has proven to be a pain in the butt.
>
> So, my question is, is there any way I can just create a class
> and have the
> XML parser map the right elements (by name) and place the values
> after those
> tags directly into an instance of an object? It would also need to be able
> to add items to a vector, or table of some sort. For example, my
> config file
> looks like so:
>
> 
> 
> Login
> com.bm.ui.actions.Login
> 
> 
> 
>
> 
> Enroll
> com.bm.ui.actions.Enroll
> 
> 
> 
> 
> 
>
> So, if I have class like:
>
> public class ActionObject
> {
>   private String  actionName = "";
>   private String  actionClass = "";
>   private Hashmap results = new Hashmap();
>
>   public ActionObject()
>   {
>   }
>
>   ... and so on ...
> }
>
> Is there a way to automatically get the XML document to map the ,
>  and  tags and attributes and their
> values directly
> to an instance of the object..so that I can do something like:
>
> ... read XML document in...
> ActionObject ao = new ActionObject(XmlDoc);
> while( ao.hasMoreActions() )
> {
>   Object o = ao.nextAction();
>   mytable.add( o );
> }
>
>
> In sum, the few lines above would simply use my ContollerServlet
> (ServletContext) hashtable object that stores each action, to
> cycle through
> my own class (ActionObject) which when created was populated automatically
> (perhaps through reflection of xml to the object) with the xml
> config data,
> and now I am just looping through and adding it to the hash table.
> OFcourse..if ao contains the entire config tree..there is no need to do
> another table..this is all hypothetical..for the use to hopefully explain
> what I am trying to do.
>
> Thanks for anyone that can help.
>
> ==
> =
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets



Re: XML mapping to objects - Model 2 architecture for config file.

2000-05-24 Thread Harry Foxwell - SE Sun McLean VA

have a look at

http://www.brainopolis.com/jsp/book/jspBook_Architectures.html

++--+
|  Harry J. Foxwell  |  VoiceMail: 703-204-4213 |
|  Area System Engineer for  |  FAX  : 703-208-5858 |
|   Java & Network Computing |  |
|  Sun Microsystems  |  |
|  7900 Westpark Drive   |  |
|Suite A110  |  Email:  |
|  McLean, VA 22102-4203 |  [EMAIL PROTECTED]  |
++--+
|  Internet Web Page: http://mason.gmu.edu/~hfoxwell/   |
+---+

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets



Re: XML mapping to objects - Model 2 architecture for config file.

2000-05-25 Thread you sheng chang

Hi, Craig:
  I am not able to attend JavaOne. I am wonding how I
can get your framework. My email is
[EMAIL PROTECTED]

 thanks
  you sheng



--- "Craig R. McClanahan"
<[EMAIL PROTECTED]> wrote:
> Kevin Duffey wrote:
>
> > [snip]
> > So, my question is, is there any way I can just
> create a class and have the
> > XML parser map the right elements (by name) and
> place the values after those
> > tags directly into an instance of an object? It
> would also need to be able
> > to add items to a vector, or table of some sort.
> For example, my config file
> > looks like so:
> >
> > 
> > 
> > Login
> >
> com.bm.ui.actions.Login
> >  page="/inside/home.jsp" />
> >  page="/outside/login_error.jsp" />
> > 
> >
> > 
> > Enroll
> >
> com.bm.ui.actions.Enroll
> >  page="/common/login_ok.jsp" />
> >  page="/common/enroll.jsp" />
> >  page="/outside/enroll_error.jsp" />
> > 
> > 
> >
>
> I will (shortly) be able to help you with this
> issue, as well as several others.
>
> I'm putting the finishing touches on a small Model 2
> based framework that will be
> open sourced, and will contain the following tools:
>
> * Basic "model 2" servlet with action interfaces and
> some
>   other support classes.
>
> * Custom tag library for some common use cases in
> Model 2
>   scenarios, including internationalization.
>
> * Support for populating bean properties directly
> from request
>   parameters (like JSP can do with the "*"
> wildcard).
>
> * Processing XML files like the one above, and
> creating new
>   objects (and populating properties) from them
> elegantly,
>   based on simple processing rules that you define.
>
> Look for an announcement of code availability for
> this for JavaOne.  In addition, I
> will be present at many of the BOFs and Sessions
> (TS) related to servlet and JSP
> technology, including speaking at some of them.
> This code will be one of the case
> study examples.  Hope to see you there!
>
> Craig McClanahan
>
>
===
> To unsubscribe: mailto [EMAIL PROTECTED] with
> body: "signoff JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets


__
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.com/

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets