Kommons: reusable objects for j2me


Antonio Terreno

Mobile Development
Fluidtime DataServices GmbH

info@java2me.org
htt...
Long-term Goal
    To have a collection of J2ME classes
●

        Stable
    –
        Easy to use, to integrate
    –
  ...
Kommons logging
    Logger “like” log4j
●

        Appenders
    –
             Console
         ●

             Bluetooth...
Kommons logging
private final static Logger logger =
   Logger.getLogger(quot;LoggerExampleMIDletquot;);

  protected void...
Midp Worker
    Before/After pattern simple implementation
●



public abstract class MIDPWorker extends TimerTask

    pu...
ISO helpers
    IsoDate Helper
●

        IsoDate parser for ISO 8601 format
    –
        http://www.w3.org/TR/xmlschema-...
ISO helpers
    IsoDate Helper
●

        IsoDate parser for ISO 8601 format
    –
        http://www.w3.org/TR/xmlschema-...
I/O
    Bluetooth
●

        A simple send & receive client
    –
             Needs your help! :-)
         ●

          ...
Http example
 try {
    String xml = XMLAdapter.getInstance().toXML(msg);
    logger.debug(quot;Postingquot;, xml);
    xm...
The cache
    A persistence cache for MIDP 2.0
●




        save(PersistentObject e)
    –
        delete(PersistentObjec...
RMS-xml cache
    Runtime cache:
●

        An hash table containing objects
    –
    Shutting down?
●

        Storing o...
Problems
    How to retrive the objects in cache?
●

        EntityRecordMapping idea
    –
        It contains the refere...
RMS-xml cache


Model

           Cache




                    E.R.
                             RMS
                   m...
Benefits
    Possibility to store any kind of object
●

    Possibility to store collection of objects
●
Next Steps of Action
    Involve developers
●

    Merge other interesting project into
●

    Javadoc
●

    Website
●

 ...
Credits to
    Alberto Lagna (CTO Fluidtime GmbH)
●

    Jean-Marie Dautelle (Javolution.org)
●

    Fluidtime GmbH
●

   ...
Q&A
    Questions? Suggestions?
●
Upcoming SlideShare
Loading in...5
×

Kommons

881

Published on

My speech at the first Java mobile developer forum event about the kommons project.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
881
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Kommons

  1. 1. Kommons: reusable objects for j2me Antonio Terreno Mobile Development Fluidtime DataServices GmbH info@java2me.org http://kommons.java2me.org/
  2. 2. Long-term Goal To have a collection of J2ME classes ● Stable – Easy to use, to integrate – Tested (j2meunit) – Open – Well coded –
  3. 3. Kommons logging Logger “like” log4j ● Appenders – Console ● Bluetooth ● Http ● Debugging levels – Enabled/Disabled ● Debug level ● Info level ● Easy to use – Perfect integration with Log4E ●
  4. 4. Kommons logging private final static Logger logger = Logger.getLogger(quot;LoggerExampleMIDletquot;); protected void startApp() { logger.addAppender(AppenderType.CONSOLE); logger.addAppender(AppenderType.PHONE); logger.setDebugEnabled(true); if (logger.isDebugEnabled()) { logger.debug(quot;startApp() - startquot;); } initDisplay();
  5. 5. Midp Worker Before/After pattern simple implementation ● public abstract class MIDPWorker extends TimerTask public final void run() { before(); try { doWork(); } catch (LogicalException e) { doCatch(e); } finally { after();
  6. 6. ISO helpers IsoDate Helper ● IsoDate parser for ISO 8601 format – http://www.w3.org/TR/xmlschema-2/#date – – IsoDuration Helper ● IsoDuration parser for ISO 8601 format. – http://www.w3.org/TR/xmlschema-2/#duration – IsoDuration format is (-)PnYnMnDTnHnMnS –
  7. 7. ISO helpers IsoDate Helper ● IsoDate parser for ISO 8601 format – http://www.w3.org/TR/xmlschema-2/#date – – IsoDuration Helper ● IsoDuration parser for ISO 8601 format. – http://www.w3.org/TR/xmlschema-2/#duration – IsoDuration format is (-)PnYnMnDTnHnMnS –
  8. 8. I/O Bluetooth ● A simple send & receive client – Needs your help! :-) ● Integration with BtFree??? Federico Paparoni??? ● HTTP ● A complete http client (post/get) – URL encoding – Cookie auth supported – Easy parameters use –
  9. 9. Http example try { String xml = XMLAdapter.getInstance().toXML(msg); logger.debug(quot;Postingquot;, xml); xml = HttpClient.URLencode(xml); HttpClient httpClient = new HttpClient(); String[][] params = { { quot;sXmlMobileRequestquot;, xml }, { quot;userNamequot;, UserPropertiesWrapper.currentUser() }, }; String response = httpClient.post(Fluidtime.ENDPOINT + quot;TimeWindow/update.actionquot;, params); msg = (Message) XMLAdapter.getInstance().fromXML(response); } catch (LogicalException e) { logger.debug(e);
  10. 10. The cache A persistence cache for MIDP 2.0 ● save(PersistentObject e) – delete(PersistentObject e) – PersistentObject find(String id) – reset() – boolean isEmpty() –
  11. 11. RMS-xml cache Runtime cache: ● An hash table containing objects – Shutting down? ● Storing objects in xml format – Starting up? ● Retrive of the objects from the rms –
  12. 12. Problems How to retrive the objects in cache? ● EntityRecordMapping idea – It contains the reference from an Entity id and – Its Record Store Id How to find an object? ● 1. in the runtime cache ● 2. in the rms ● 3. if found it will be putted on the cache & used ●
  13. 13. RMS-xml cache Model Cache E.R. RMS mapping
  14. 14. Benefits Possibility to store any kind of object ● Possibility to store collection of objects ●
  15. 15. Next Steps of Action Involve developers ● Merge other interesting project into ● Javadoc ● Website ● Licence ● Junit testing ● Receive feedbacks ● ... ●
  16. 16. Credits to Alberto Lagna (CTO Fluidtime GmbH) ● Jean-Marie Dautelle (Javolution.org) ● Fluidtime GmbH ● Java2me.org forum :-) ● Jmdf of course! ●
  17. 17. Q&A Questions? Suggestions? ●
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×