admin@glassfish.java.net

Re: calendar component

From: Anissa Lam <Anissa.Lam_at_Sun.COM>
Date: Tue, 17 Apr 2007 18:06:46 -0700

The Timer event is one of the predefined events for triggering actions.  This is part of the self management framework that has been available since GlassFish v1.

Timer events

The event type is "timer". The Notification subclass is javax.management.timer.TimerNotification.
Required property:
"datestring", possible values: String - mm/dd/yyyy hh:mm:ss
Optional properties are
"pattern" if the date string is specified in any other format other than given above.
"period" - possible values are long/integer for timer period in milliseconds,
"numberofoccurrences" - possible values are long/integer,
"message" - possible value: String.

More info is available at
https://glassfish.dev.java.net/javaee5/selfmanagement/selfmanagementhome.html

Anissa

Senthil Chidambaram wrote:
Response inline...
Bill Shannon wrote:

Senthil Chidambaram wrote:

Bill Shannon wrote:

Senthil Chidambaram wrote:

Bill,
Calendar component allows us to pick the date based on the locale. This particular use case is when we create a timer event management rule, this takes a property called pattern where user can enter any kind of pattern he/she wants. In this case can we enforce the pattern to be locale specific, and don't even show the pattern textfield on the screen.



Why is it important that the user be able to enter a pattern?


Pattern is an optional property, as per the dtd management-rule (event) takes property <!ELEMENT event (description?, property*)>


Is the pattern defined by an existing java.* class, or do you define
and interpret the pattern yourself?


I don't define it. This is one of the optional properties used when we create a management rule of event type timer. I'm attaching the GUI screenshot with this, just for you to take a look at how the current UI is with Date String, and Pattern specified. Calendar component will be used for Date String. Once you create the management-rule, this is how the property (name=value) is written in domain.xml

<management-rule enabled="true" name="mgmtRule">             <event level="INFO" record-event="true" type="timer">
           <property name="datestring" value="12/12/07"/>
           <property name="pattern" value="mm/dd/yyyy"/>             </event>        </management-rule>


Perhaps I've forgotten how all this stuff works...

The timer rule is something we defined, and is new to GlassFish v2, right?

I think it's management-rule using timer event. It has a set of predefined events, and timer is one of them.


Why did we feel the need to define the timer rule to accept a date
pattern?  Just because we didn't want to force people to enter the
datestring property using a specific pre-defined locale-specific
format?

Backend folks should answer this. I like the locale specific format. I would appreciate if anyone can answer this, even I'm looking for an answer to this question.


Is the set of allowed patterns defined by the timer rule?  Or is it a
SimpleDateFormat pattern?

It's s SimpleDateFormat, as such timer event don't define any allowed patterns


Is the "datestring" property just a String-valued property on a bean?
How does the GUI know to use a calendar component for that String-valued
property?  Does the GUI have specific knowledge of the timer rule?  Is
the timer rule built-in or is it a pluggable component?  Can I write my
own timer rule that works in a similar manner, including date entry
using the calendar component?

It's not a pluggable thing in GUI. When you create a management-rule of timer event this screen is built in. The datestring property accepts date, so we've decided to use calendar component here. This screen is hard wired already for this event type. The problem we're facing here is due to the pattern property. The calendar component is rendered for a specified locale, or a pre-defined pattern specified before rendering. It's hard to change this behavior after rendering based on the pattern input by the user. I'm looking at other options here, may be disable the calendar until pattern is entered. I'll try my best to come up with a nice user interface for this.


---------------------------------------------------------------------
To unsubscribe, e-mail: admin-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: admin-help@glassfish.dev.java.net


---------------------------------------------------------------------
To unsubscribe, e-mail: admin-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: admin-help@glassfish.dev.java.net