RE: A modification to ejbtags.jar

2001-04-07 Thread Dan North

I had a quick look through and I have an observation if you're interested 
in performance stuff:

(One of) the slowest aspects of reflection is Class.forName().  When I've 
used reflection in the past, I created a static Map classes = new 
HashMap(), which I use as a cache, with the class name as the key and the 
class itself as the value.

Hmm - the amount of time it's taking me to explain this I might as well 
code it myself :o)

Here you go (attached).  Haven't tested it, so usual caveats apply.

Cheers,
Dan/tastapod

At 18:14 06/04/2001 -0400, you wrote:
Since I had already modified the Iterate tag to support sliding windows, I
went ahead and incorporated Rafael's sorting tag and enhanced it to support
descending order.  I've only attached the IterateTag.java and a sample tld
if anyone would like to use it.

Michael

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Rafael Alvarez
Sent: Tuesday, March 06, 2001 9:42 AM
To: Orion-Interest
Subject: Re: A modification to ejbtags.jar


Ok. that resolve it :)
I made two mistakes:
1) This mail was intended for Karl, but I misclicked in my email
manager.
2) The version I sent is not a working one. I just realized that I
lost the last version in the last crash of our CVS... Mea culpa not
having a backup.

Anyway, here is the working version.


I'm interested in performance metrics, since it uses reflection...


--
Best regards,
  Rafaelmailto:[EMAIL PROTECTED]



--
Dan North
VP Development  -  Cadrion Software Ltd  -  +44 (0)20 7440 9550

CONFIDENTIALITY
This e-mail and any attachments are confidential
and may also be privileged. If you are not the named recipient,
please notify the sender immediately and do not disclose the
contents to another person, use it for any purpose, or store
or copy the information in any medium


package com.evermind.ejb.taglib;

import java.util.*;
import javax.ejb.*;
import javax.naming.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import javax.servlet.http.*;

import java.lang.reflect.*;

/**
 *  IterateTag
 *
 *@author Magnus Stenman
 *@createdApril 6, 2001
 */
public class IterateTag extends BodyTagSupport {
// iterator
private PagedIterator it = new PagedIterator();

// temporary variables
private Vector vector = null;
private String type = null;
private int startRow = 1;
private int displayRows = 1000;
private String orderBy = null;
private boolean descending = false;


/**
 *  Sets the Collection attribute of the IterateTag object
 *
 *@param  collection  The new Collection value
 */
public void setCollection(Collection collection) {
this.vector = new Vector(collection);
}


/**
 *  Sets the Type attribute of the IterateTag object
 *
 *@param  type  The new Type value
 */
public void setType(String type) {
this.type = type;
}


/**
 *  Sets the StartRow attribute of the IterateTag object
 *
 *@param  startRow  The new StartRow value
 */
public void setStartRow(int startRow) {
this.startRow = startRow;
}


/**
 *  Sets the DisplayRows attribute of the IterateTag object
 *
 *@param  displayRows  The new DisplayRows value
 */
public void setDisplayRows(int displayRows) {
this.displayRows = displayRows;
}


/**
 *  Sets the OrderBy attribute of the IterateTag object
 *
 *@param  orderBy  The new OrderBy value
 */
public void setOrderBy(String orderBy) {
this.orderBy = orderBy;
}


/**
 *  Sets the Descending attribute of the IterateTag object
 *
 *@param  descending  The new Descending value
 */
public void setDescending(boolean descending) {
this.descending = descending;
}


/**
 *  Description of the Method
 *
 *@return   Description of the Returned Value
 *@exception  JspException  Description of Exception
 */
public int doStartTag() throws JspException {

if (this.orderBy != null) {
System.out.println("Order by = " + orderBy);
CompareInstances compare = new CompareInstances(this.type,
this.orderBy, this.descending);
Collections.sort(vector, compare);
}

it.setIterator(vector.iterator());
it.setStartRow(startRow);
it.setDisplayRows(displayRows);

return doAfterBody();
}


/**
 *  Description of the Method
 *
   

Re: A modification to ejbtags.jar

2001-04-07 Thread Rian Schmidt

Consider this a friendly pat on the back...

I had this on my list of things to get done for a big, nasty internal
project, and this fits the bill perfectly.  Maybe I'll send you a
netcentive, or possibly a been, or even a flooz... unit?  Uh... nah...
nevermind.

Thanks,
Rian

- Original Message -
From: Michael A Third [EMAIL PROTECTED]
To: Orion-Interest [EMAIL PROTECTED]
Sent: Friday, April 06, 2001 3:14 PM
Subject: RE: A modification to ejbtags.jar


 Since I had already modified the Iterate tag to support sliding windows, I
 went ahead and incorporated Rafael's sorting tag and enhanced it to
support
 descending order.  I've only attached the IterateTag.java and a sample tld
 if anyone would like to use it.

 Michael

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]]On Behalf Of Rafael Alvarez
 Sent: Tuesday, March 06, 2001 9:42 AM
 To: Orion-Interest
 Subject: Re: A modification to ejbtags.jar


 Ok. that resolve it :)
 I made two mistakes:
 1) This mail was intended for Karl, but I misclicked in my email
 manager.
 2) The version I sent is not a working one. I just realized that I
 lost the last version in the last crash of our CVS... Mea culpa not
 having a backup.

 Anyway, here is the working version.


 I'm interested in performance metrics, since it uses reflection...


 --
 Best regards,
  Rafaelmailto:[EMAIL PROTECTED]






Re: A modification to ejbtags.jar

2001-04-06 Thread Rafael Alvarez

Ok. that resolve it :)
I made two mistakes:
1) This mail was intended for Karl, but I misclicked in my email
manager.
2) The version I sent is not a working one. I just realized that I
lost the last version in the last crash of our CVS... Mea culpa not
having a backup.

Anyway, here is the working version.


I'm interested in performance metrics, since it uses reflection...


-- 
Best regards,
 Rafaelmailto:[EMAIL PROTECTED]
 mtags.jar


RE: A modification to ejbtags.jar

2001-04-06 Thread Michael A Third

Since I had already modified the Iterate tag to support sliding windows, I
went ahead and incorporated Rafael's sorting tag and enhanced it to support
descending order.  I've only attached the IterateTag.java and a sample tld
if anyone would like to use it.

Michael

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Rafael Alvarez
Sent: Tuesday, March 06, 2001 9:42 AM
To: Orion-Interest
Subject: Re: A modification to ejbtags.jar


Ok. that resolve it :)
I made two mistakes:
1) This mail was intended for Karl, but I misclicked in my email
manager.
2) The version I sent is not a working one. I just realized that I
lost the last version in the last crash of our CVS... Mea culpa not
having a backup.

Anyway, here is the working version.


I'm interested in performance metrics, since it uses reflection...


--
Best regards,
 Rafaelmailto:[EMAIL PROTECTED]

 IterateTag.java
 iterate.tld