Just An Application

June 12, 2009

What’s New In MIDP 3.0 ? Part 8: MIDletIdentity

Filed under: Java, JME, MIDP, MIDP3, MIDP3API, MIDP3Issues — Tags: , , , , , , — Simon Lewis @ 8:24 am

1. The Class

The class MIDletIdentity has been added to the package javax.microedition.midlet.

As the name suggests and the class documentation explicitly states

This class represents the identity of a MIDlet

An instance of MIDletIdentity is used to identify the source of an Event in the Event API.
and to identify clients and servers in the IMC API.

1.1 Methods

The class it very simple since an instance of MIDletIdentity is immutable. It has six methods

  • getName()
  • getVendor()
  • getVersion()
  • getSecurityDomain()
  • isAuthorized()
  • toString()

The methods

  • getName()
  • getVendor()
  • getVersion()

are defined to return

  • [the] Name of the MIDlet
  • [the] Version string of the MIDlet
  • [the] Vendor name of the MIDlet

respectively.

The method getSecurityDomain() is defined to return

  • [the] Name of the security domain that the MIDlet associated with this MIDletIdentity was bound to when it was installed.

If the security domain is one of the predefined ones, then the return value is guaranteed to be equal to one of the constants

  • IDENTIFIED_THIRD_PARTY
  • MANUFACTURER
  • OPERATOR
  • UNIDENTIFIED_THIRD_PARTY

The method isAuthorized() is defined to return

  • true if the MIDlet associated with the specified MIDletIdentity is authorized to the current MIDlet’s runtime execution environment, false otherwise.

The method toString() is defined to return

  • the String concatenation of getVendor() + “; ” + getName() + “; ” + getVersion().

2. Issues

Unfortunately an instance of MIDletInstance does not identify a MIDlet.

To begin with, while a MIDlet certainly has a name, it is has neither a vendor nor a version, although the
MIDlet Suite containing the MIDlet has both. In fact, the class documentation actually states

This class provides identity information for a specific MIDlet including suite name, vendor, version, …

which might suggest that the vendor and version being returned from getVendor(), and getVersion() are actually those of the MIDlet Suite containing the MIDlet, which would make sense. However it might also suggest that getName() returns the name of the MIDlet Suite containing the MIDlet.

If we assume, on the basis of the class documentation above, that the methods

  • getName()
  • getVendor()
  • getVersion()

actually return

  • the name
  • the vendor
  • the version

respectively, of the MIDlet Suite containing the MIDlet, we have a problem. There is now no MIDlet specific
information. What we have is a MIDlet Suite identity.

If we stick with the existing method documentation for getName() we have a different problem.
There is no MIDlet Suite name. What we have is a partial MIDlet identity.

3. The Solution(s)

3.1 Rename The Class

As it stands an instance of MIDletIdentity is a perfectly good MIDlet Suite identity, so
rename the class to MIDletSuiteIdentity and fix up all the documentation everywhere accordingly,

3.2 Fix The Class

Rename the methods

  • getName()
  • getVendor()
  • getVersion()

to

  • getMIDletSuiteName()
  • getMIDletSuiteVendor()
  • getMIDletSuiteVersion()

respectively

Add a

  • getMIDletClassName()

method, and update the documentation accordingly.


Copyright (c) 2009 By Simon Lewis. All Rights Reserved.

Advertisements

1 Comment »

  1. […] What’s New In MIDP 3.0: Redux – MIDletIdentity Filed under: JME, Java, MIDP, MIDP3, MIDP3Issues — Tags: Java, JME, JSR271, MIDP, MIDP3, MIDP3SpecIssues — Simon Lewis @ 6:58 pm Original Post […]

    Pingback by What’s New In MIDP 3.0: Redux – MIDletIdentity « Just An Application — December 13, 2009 @ 6:59 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: