Search

Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Java EE6: Another major release from 2009

View Comments

There was a lot of eager and nervous anticipation from the Java developer committee about the release of Java Enterprise Edition 6. The focus of the nervousness has been Oracle's acquisition of Sun in April and how it would impact the future of Java. Java EE6 was finally released on December 10th but questions on the impact of Oracle buyout remain unanswered.



The key points made on this release are:

* Glassfish V3 is the reference implementation for EE6
* Java EE6 builds on the persistence and annotation features of EE5.
* This release is about right sizing:
Profiles:
In this release Sun introduces the concept of profiles. Instead of providing a single programming framework that may be used to build different architectures for different industry segments, this release will contain industry specific profiles.

Profiles may be licensed or created based on need. They will incorporate multiple technologies and will cater to different needs. The current release of EE6 contains a full profile and a web profile.

The web profile according to sun will be used to build 'modern apps' and will include security, transaction management and persistence tools. It includes a generic or 'plain vanilla api'.

The new technologies will include the following:
* Java Servlet 3.0
* EJB(Enterprise Java Beans) light 3.1
* Java Persistence Architecture 2.0
* JSP(Java Server Pages) 2.2
* Java Standard Template Library 1.2
* Java Transaction API 1.1
* Debugging for other languages(JSR 4.5)

* There is a lot of pruning of functionality in an effort to keep it light weight.
- The JSR-RPC modules had a lot of UDDI(Universal Data Discovery Functionality) functionality to discover web services. This has been pruned as it is clear now that industry is not heading that way.
In EJB 3.1, Container managed persistence beans are now replaced with the Java persistence API
This was done, according to Sun to keep the API simple and also have Java developers use a single standard API.

* Another goal of this release is to embrace open source frameworks.

* Another new feature introduced in Java EE6 is Webbeans to unify JSF, JPA and EJB 3.0 into a single unified platform.

* Zero configuration drag and drop web frameworks,

* Plugin library jars using web fragment: Here one may setup a framework and bootstrap it into a container. It is a mechanism to integrate 3rd party frameworks into a container. It is used in Glassfish v3.
e
* More use of extensions:
* EE6 will increase the use of extensions from EE5. It will eliminate the use of the deployment descriptor. Further the deployment descriptor has been eliminated and the @WebServices annotation is used instead.

* Another feature is the ability to package the ejb inside the war file. The old jar file is still supported.

Related Links
Java EE6 technologies
Rod Johnson: "Java EE 6 Gets it Right"
JSR 313
Apache votes no on Java EE 6
JEE 6: Extensibility, Profiles and Pruning


Read more...

Freemind: A great mind-management tool

View Comments


Freemind
I discovered a bit late in life that I was a visual person, thanks to my discovering mind mapping. Mind mapping is a brainstorming technique discovered by Tony Buzan and then evangelized by Michael Gelb.

The synopsis of this technique is that one starts with a main theme that he puts on the centre of a blank sheet of paper or, if you are using software, the centre of the screen.
 Next, you expand on the theme by adding branches(nodes)  and naming ideas on the branches. You continue the process as long as necessary or adequate. Mind mapping works on the premise that the mind does not think linearly or with words. It thinks in pictures and with thoughts that come randomly.

Mind mapping seeks to synthesize right brain creative thinking with left brain creative thinking. As far as I could tell, mindmapping works well, atleast for me.

At MIT I used Mindjet which was more than adequate for me. Then I discovered Freemind which is a decent open-source cross platform alternative(It is built with Java). Freemind is easy to use and has a great set of features like the ability to add images to your nodes which is a key to great mind maps.

With Freemind one can also export the file into several formats including image, xml, pdf and open office types. Mindmapping has saved me many hours of effort and pstimulates creative solutions quickly.

If you are new to mindmapping, try using Freemind and see if it works for you. Do you have a favourite mind mapping tool? Please share your ideas on this subject in the comments. I'd love to hear from you.


Read more...

J2ME and I

View Comments





One of the reasons I've not been blogging regularly recently is that I've been learning J2ME. The two books helped me a lot. The first is more organized and gives a good overview of J2ME. It clearly explains the differences between CLDC 1.1 and 1.0 and MIDP 2.0 and 2.1. It also covers security, deployment and the Push Registry in ample detail.

Knudsen's book is a more interesting read with chapters on Bluetooth and SMS Messaging. What's more I made it through the J2ME exam affectionately called Sun Certified Mobile Access Developer for the J2ME platform or sometimes called Sun Certified MAD exam. These books were a big help.


Read more...

MIDlet Methods

View Comments

  • startApp can fail in 2 ways
    • Transient
      • at a certain point in time(lack of conn, res,etc.)
      • javax.midlet.MIDletStateChangedException
    • Non-Transient
      • unexpected and uncaught runtime error
      • Such errors are propogated back to system that it will destroy midlet immediately and call destroyApp.


Read more...

Midlet States

View Comments

3 distinct phases

  • Paused:
    • Just been constructed and not yet entered startApp
    • Can be in paused state after a call to pauseApp or notifyPaused methods
    • Should hold as few resources in this state
    • Can receive asynchronous notifications like a timer firing
  • Active
    • After entry to startApp
    • moves from Paused to Active after a call to resumeRequest
    • Can allocate and hold all resources for active execution
  • Destroyed
    • After return from destroyApp or notifyDestroyed
    • Cannot reenter any other state.
    • Replaces System.exit which will throw a java.lang.SecurityException
  • Midlet states can be triggered by MIDP or requests from app.
  • All states except startApp complet after return from caller


Read more...

Midlet App Model

View Comments

  • MIDlet - basic unit of execution
  • Extends javax.microedition.midlet
  • Implements
    • startApp
    • pauseApp
    • destroyApp
  • Can have a constructor which CANNOT handle exceptions
  • Must implement the 3 abstract lifecycle methods
  • can implement Command Listener Interface (along with TextBox, Command and Display -part of javax.microedition.lcdui classes.


Read more...

Midlet Suite Security

View Comments

Assumptions on MIDlets

  • Need not be aware of security policy except for security exceptions
  • Subject to 1 protection domain and permissions
  • Internal representation of domain is implementation specific
  • UI and results of authentication attempts to user out of MIDP scope
  • Device must protect its security policy and domain info
  • For static security policies, unused security functions may be eliminated on device
  • Security policy not to be used for security sensitive functionality, merely to restrict access.
Sandboxes and Trust
  • MIDP 1.0 MIDlets operate as untrusted on MIDP 2.0 devices
  • Untrusted Midlets: Cannot access protected API/Functions. Restricted environment-untrusted domain,
  • javax.microedition.io.HttpConnection and HttpConnection APIs require confirmation from untrusted MIDlets.
  • Trust determination is device specific.
  • Trusted Apps have increased access to protected APIS

Permissions and APIS

Permissions Restricted API

Javax.microedition.io.Connector Java.microedition.io

http HttpConnection

https HttpsConnection

datagram UDPDatagram

datagramReceiver UDPDatagram

socket SocketConnection

serversocket ServerSocketConnection

ssl SecureSocketConnection

PushRegistry PushRegistry

Permission Names
  • Case sensitive
  • Each API defines its own permissions
Requesting permissions
  • MIDlet Permissions specified in JAD/ Jar manifest
  • MIDlet-Permission/MIDlet-Permisssion-Opt used to specify permissions
    • Comma separated, leading/trailing spaces ignored.
    • If both are set, their values must be identical.
  • All requested critical permissions must be known and present. Otherwise the suite is not installed.
Protection Domains
  • Defines permission sets, interaction modes.
  • 2 types
    • Allowed: All protection domain suites allowed access
    • User: Access only after user auth. - User prompt that user can allow/deny
Interaction Modes for User Permisssions
  • blanket: Grant perms for every interaction
  • session: Grant perms until MIDP terminates
  • oneshot: only current invocation- prompt user for each invocation of protected API.

  • Interaction determined by device security policy.

Non Security Sensitive APIs: javax.micoredition.rms, midlet, lcdui, lcdui.game, media, media.control


Read more...

Features not in the J2ME JVM

View Comments

  • User Defined Class Loaders
  • Thread Groups & Daemon Threads
  • Finalization
  • Asynchronous Exceptions


Read more...

CLDC (Connected Limited Device Configuration)

View Comments


CLDC Scope

  • JVM and Java Language
  • Internationalization
  • I/O
  • Networking
  • Security
  • Internationalization
Requirements
  • CLDC 1.1 requires 192K total memory(1.0 required 160K)
  • 16/32 bit processor
  • Low power OS
  • some sort of connectivity
CLDC libraries
  • System (java.lang)
    • Object
    • Class
    • Runtime
    • System
    • Thread
    • Runnable
    • String
    • String Buffer
    • Throwable
  • Data Type(java.lang)
    • Boolean
    • Byte
    • Short
    • Long
    • Integer
    • Character
    • Double*
    • Float*
*New in CLDC 1.1

  • Collections(util)
    • Vector
    • Stack
    • Hashtable
    • Enumeration
  • I/O(java.io)
    • InputStream
    • OutputStream
    • ByteArrayInputStream
    • ByteArrayOutputStream
    • DataInput
    • DataOutput
    • DataInputStream
    • DataOutputStream
    • Reader
    • Writer
    • InputStreamReader
    • OutputStreamReader
    • PrintStream
  • Calendar/Time(util)
    • Calendar
    • Date
    • TimeZone
  • CLDC1.1
    • Math(for floating pt ops.)
    • Random
  • References(java.lang.ref)
    • Reference
    • Weak Reference
  • Error Classes(java.lang)
    • Error
    • NoClassdefFoundError(new to CLDC 1.1)
    • OutOfMemoryError
    • Virtual Machine Error


Read more...

CLDC Generic Connection Framework framework

View Comments

  • Generalization of J2SE NW and I/O framework
  • Can map to low level hardware/J2SE classes
  • General Form

Connector.open(":
;");
    • Static function
  • No network protocols defined in CLDC
  • Bulk of App code stays same for diff protocols
  • Protocol Binding done at runtime.
  • Implemented as a hierarchy of connection interfaces(7)
  • One exception class: ConnectorNotFound
Classes and Interfaces
    • Interface Connection- Basic Connection
public void close() throws IOException;
    • Interface InputConnection- Device with data read capability
public InputStream openInputStream() throws IOException;
public DataInputStream openDataInputStream() throws IOException;
    • Interface OutputConnection- Device with Data write capability
public OutputStream openOutputStream() throws IOException;
DataOutputStream openDataOutputStream() throws IOException;

    • Interface StreamConnection-Combines InputConnection & OutputConnection
    • Interface ContentConnection -Sub interface of StreamConnection-Access to HTTP metadata
public String getType();
public String getEncoding();
public long getLength();
    • Interface StreamConnectionNotifier
public StreamConnection acceptAndOpen() throws IOException;
    • Interface DatagramConnection -Datagram endpoint
public int getMaximumLength() IOException;
public int getNominalLength() IOException;
    • Other functions for
      • send,
      • receive,
      • 4 newDatagram(with params byte, size, address)
Datagram type
  • has a data buffer associated with it.
  • Use DataInput and DataOutput.
  • Can behave like a stream


Read more...

CLDC Error Handling

View Comments

  • VM halts in implementation specific manner
  • VM throws error closest to nearest CLDC Error Superclass


Exceptions
  • Supports exception handling defined by JVM.
  • No Asynchronous exceptions


Read more...

Goals Requirements and Scope of J2ME

View Comments

  • JHighly portable, secure, small app. dev. env.

CLDC goals
  • Lowest common denominator platform
  • targets all kinds of small connected devices
  • Device category independent.
  • Generic Connection framework
MIDP goals
  • Wireless mobile communication devices
  • Meaningful high level abstractions
  • Mask lower level network transmission protocols(GSM, TDMA. CDMA PDC)
  • Build on Generic Framework
J2ME goals
  • Extensible customizable devices
  • Dynamic delivery of apps, content
CLDC Software Requirememts:
  • Assumes os/kernel available
  • OS provides atleast one schedulable entry.
  • No need- separate address spaces/processes
MIDP Software requirements
  • Kernel/OS
  • Mechanism to R/W non-volatile memory
  • R/W access to NW
  • Mechanism to provide time-base for timestamping records written to perm. storage
  • Ability to write to bit-mapped graphical display
  • Mechanism to capture user input
Scope of CLDC
  • Java language and VM features
  • Core libraries
  • I/O
  • Networking
  • Security
  • Internationalization
Does NOT address
  • App lifecycle mgmt.
  • UI functionality
  • Event handling
  • High level app model
MIDP Scope
  • App Model
  • UI
  • Persistent Storage
  • Networking
  • Timer
MIDP 2.0
  • Sounds
  • 2D games
  • MIDLet Signing
  • end-end HTTPS security
  • App delivery and installation
Also
  • System level APIs
  • Low level security
  • App level cryptography

  • rich dynamic interactive content from 3rd party developers, content providers
  • Secure development of dynamic content


Read more...

CLDC MIDP Packages

View Comments

CLDC 1.1

  • java.lang
  • java.lang.ref
  • java.util
  • javax.microeditiom.io
MIDP 2.0
  • javax.microedition.lcdui
  • javax.microedition.lcdui.game
  • javax.microedition.media
  • javax.microedition.media.control
  • javax.microedition.midlet
  • javax.microedition.pki
  • javax.microedition.rms


Read more...

J2ME

View Comments



  • J2ME made of profiles, configurations and optional APIs.(Together called a Stack)
  • Configuration
    • memory size and processing power
    • Subset of Java 2
    • JVM
  • Profiles
    • Additional APIs for UI, persistent storage, etc.
  • CLDC
    • 160-512K Total memory
    • Minimum 160K RAM, 32K ROM
  • JVM (KVM)Limitations
    • Native methods cannot be added at runtime.
    • Only has a subset of bytecode verification- The task of verifying classes -split between CLDC device and external mechanism
  • MIDP
    • >= 256K ROM
    • >= 128K RAM for Java runtime heap
    • >= 8K non volatile permanent storage
    • 96*54 pizel screen size
    • Some capacity for keypad, screen i/p
    • 2 way NW connection possibly intermittent.


Read more...

Understanding JSR 185 - Quick notes

View Comments

  • Reduces fragmentation
  • Improves interoperability
  • Foundation for next gen. devices.
  • Functionality
    • Required
      • CLDC 1.o
      • MIDP 2.0
      • WMA 1.1
    • Optional
      • MMAPI
  • Size
    • JAR 64KB
    • JAD 5KB
    • Persistent Storage 30KB
    • Devices can use more but one cannot expect more.
    • Heap size 128K required, 256K Recommended.
  • Tickers(wake-up timers)
    • Open ended in MIDP not required
  • UI
    • Screen size
      • 96X54 screen size, 1 bit color depth required
      • 125X125 required, 12 bit color depth recommended
      • JSR 185 jpeg support, MIDP png support
  • Text Messaging
    • SMS capability required on GSM/UMTS networks
    • Text box, Text field required.
    • Phone book capability required to fill text field required on MIDLet.
  • Multimedia
    • MMAPI
    • MIDI and tone sequence support
    • 8 bit 8Khz mono PCM WAV supprt required for audio capture
    • JPEG support
  • Security
    • Vague about protected domain defintion
    • Specifies GSM/UMTS device behavior on untrusted code


Read more...

Class File Verification

View Comments

Step1: Preverification-Typically done on developer workstation.

  • Move some bytecodes, augment Class files with Stack Map attributes
Step 2: Runtime Verification
  • Actual class verification done via Stack Map attrs. generated in Step 1
  • Execution only begins after runtime verification
  • Runtime verification guarantees type safety
  • Verification verifies that all bytecodes of class files are inlined.- makes verification faster.


Read more...

Other CLDC Security features

View Comments

  • Programmer cannot bypass standard class loading mechanisms on device while downloading
  • Programmer can use closed predefined Java API defined by J2ME and manufacturer specific classes
  • Programmer cannot download new native library functionality.
  • Programmer cannot override/modify system class packages(java.*, java.microedition.*), profile specific packages or class file lookup.
  • CLDC can load classes only from its jar file. - Java app cannot interfere or steal data from other apps. 3rd parties cannot gain access to private, protected classes that are provided by manufacturer.


Read more...

Internationalization Related

View Comments

I've been working on this Internationalization project for a while. Here are some useful links I picked up along the way.
Multilingual Web Application using JSPs

Struts Internationalization


Date and Time Formats on the Web.

UTF-8 on Wikipedia

UTF-16 on Wikipedia

Some XLIFF Links

Open tag Internationalization
XLiffs

DOM To Locale String

Locale Independant Comparisons


Java I18N examples

Java Internationalization FAQ


Java Developer's Almanac: Reading UTF-8 Encoded

Java Developer's Almanac:
Formatting and Parsing a Time for a Locale Using Default Formats Data

Translation removes barriers

Java and Unicode Character Validation

Languages, Characters and Encoding



Read more...

Useful Java Links

View Comments

A 'Lite' DOM Parser.

Best Practices: Exception

Microsoft Link on Best Practices for developing World Ready Applications


Java fundamentals for Non-C Programmers

Java Docs

Using Java Reflection


Java Threads
http://java.sun.com/docs/books/tutorial/essential/threads/

Java tutorial
http://java.sun.com/docs/books/tutorial/essential/TOC.html

JDBC API in a Nutshell
http://www.cs.unc.edu/Courses/wwwp-s98/members/thornett/jdbc/183.html

JDBC/MySQl Notes
http://www.cs.wcupa.edu/~rkline/JDBC_Notes.html



Read more...

EJB 3.0 Briefs

View Comments

  • Problems with Earlier versions of EJB
    • Handling of unnecessary exceptions
    • Required knowledge of JNDI
    • Several unnecessary callbacks
    • Limited use of Object oriented concepts
    • Container involved complex development and maintenance
    • Cannot be tested outside a container. Teing inside was a nightmare
    • Deployment developer maintenance complex and error prone
  • EJB 3.0
    • Uses metadata annotations to ask container to generate much of the boiler plate code
      • @Author("Debu Panda")
        @Bean
        public class MySessionBean
    • Uses Plain old Java Objects and Interfaces
    • Developer only needs to implement one
      interface (Entity, Session or Message) in javax.ejb.package.
    • Use stateless, stateful, message driven or Enity to annotate class
    • No need to implement EJBObject or EJBLocalObject
    • Can either supply bussiness interfaces to EJB or have them auto generated during deployment
  • Read more at http://www.theserverside.com/articles/article.tss?l=SimplifyingEJB3&News07_05_05-click


Read more...