Java Work Framework

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Java Work Framework
Stable release 1.0.1 / February 18, 2009 (2009-02-18)
Operating system Cross-platform
Type Java Network Framework
License MIT license
Website http://subversion.itrustcam.com/thirdparty/javawork/1.0.1/javawork

Java Work Framework is a simple, but powerful Java framework providing Network(New I/O Socket), Database, Exception handling and System functionality. It is open source, object-oriented and event driven.

History[edit]

It was originally designed and implemented by Ivan Penev back in 2005 as a network layer capable to handle around 10,000 socket connections. Then it gradually included the most common functionality a programmer may need - socket communication, simple database access, reading external resources as files, URLs, etc.

Features[edit]

Its main focus is to hide behind simple wrappers existing Java functionality and to provide general application exception handling mechanism. In short it supports:

  • Java NIO Socket Framework
  • 15,000+ socket connections. Sending/receiving 5000 java objects per second between 2 computers works great.
  • Multicast
  • Unicast(UDP) support
  • Pluggable protocols through in and out filters
  • Easy-to-use database layer
  • Custom JAR files loader

Security[edit]

  • Securing socket communication through SSL
  • Exchanging data encrypted through XXTEA, XOR algorithms

Code snippets[edit]

Multicast:

Multicast.listen( "230.0.0.1", 35098, new IEventListener() { public void onEvent( IEvent evt ) {
       MulticastDataEvent dataEvt = (MulticastDataEvent)evt;
       System.out.println( "data-bytes:" + DebugUtil.toString(dataEvt.asByteArray()) );
} } );
Multicast.send( "Lorem ipsum dolor ...", "230.0.0.1", 35098 );

Database:

    Database db = Database.createInstance();
    db.setUrl("jdbc:postgresql://localhost/testdb");
    db.setUsername("testuser");
    db.setPassword("test123");

    SQLInsert insertOp = new SQLInsert("persons");
    insertOp.addData("person_fname", "Mike",
                     "person_lname", "Johnson",
                     "birthday", Convert.toDate("1971-08-01"),
                     "country_id", "de",
                     "single", true);

    int affectedRows = insertOp.execute();
    System.out.println("Affected rows = " + affectedRows);

Requirements[edit]

  • JDK 1.6 (Mustang)

External links[edit]