Just my 2c. if I could:

we all could have different [valid] opinions about how to design this
and it could lead to very lengthy discussions (which could be very
entertaining to read) :-)

Cheers,
D.

P.S. BTW, I'm a big fan of Joda Time!

On Wed, Mar 14, 2012 at 9:20 AM, Marvin S. Addison
<marvin.addi...@gmail.com> wrote:
>> XML durations feels a complicated pill to swallow.  They'd end up looking
>> something like
>>
>> PT5M
>
>
> Yet, it's a standard and there is a precedent for its use for configuring
> time intervals in a Web SSO product,
> https://issues.shibboleth.net/jira/browse/SC-63.  But I'm not trying to push
> it; it's simply one option.
>
>
>> So maybe the former should be
>>
>>     <util:constant id="SECONDS"
>> static-field="java.util.concurrent.TimeUnit.SECONDS"/>
>>     <util:constant id="MINUTES"
>> static-field="java.util.concurrent.TimeUnit.MINUTES"/>
>>     <util:constant id="HOURS"
>> static-field="java.util.concurrent.TimeUnit.HOURS"/>
>>
>>     <bean id="grantingTicketExpirationPolicy"
>> class="org.jasig.cas.ticket.support.TicketGrantingTicketExpirationPolicy"
>>
>>      p:maxTimeToLiveUnit-ref="HOURS"
>>      p:maxTimeToLive="8"
>>      p:timeToKillUnit-ref="HOURS"
>>      p:timeToKill="2"/>
>
>
> We can do better.  The above would mean a significant growth in the number
> of arguments to components that need durations of time.  We should be
> shooting for a single property that can convey a time duration.  The Period
> abstraction from Joda Time and JSR-310 is ideal in that view.  And the
> Period class has convenient static methods for constructing an instance from
> seconds, hours, days, etc.  Using the JSR-310 Period class [1] as an
> example:
>
> <bean id="policy" class="o.j.c.t.s.SomePolicy">
>  <property name="maxTimeToLive">
>    <bean class="javax.time.Period" factory-method="ofHours">
>      <constructor-arg>8</constructor-arg>
>    </bean>
>  </property>
> </bean>
>
> The above is worst case.  Since support for parsing durations is in the
> scope of JSR-310, and something like p:maxTimeToLive="8H" is likely possible
> with the development of custom Spring Converter components and setting them
> up in the default applicationContext.xml.
>
> A solution based around Period and JSR-310 would address present needs with
> an eye toward the future when javax.time will be included as part of the JSE
> (possibly Java 8).
>
> M
>
> [1]
> https://github.com/ThreeTen/threeten/blob/master/src/main/java/javax/time/Period.java
>
>
> --
> You are currently subscribed to cas-dev@lists.jasig.org as:
> dmitriy.kopyle...@gmail.com
> To unsubscribe, change settings or access archives, see
> http://www.ja-sig.org/wiki/display/JSG/cas-dev

-- 
You are currently subscribed to cas-dev@lists.jasig.org as: 
arch...@mail-archive.com
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-dev

Reply via email to