brf.j2me.dynaworks.env
Class Environment

java.lang.Object
  |
  +--brf.j2me.dynaworks.env.Environment

public final class Environment
extends java.lang.Object

The Environment is an class to allow static access to the base functionality in different J2ME implementations.

It provides access to the four parts of the environment relevant for DynaWorks applications:

1) Graphics: access to the screen
2) Audio: access to the audio subsystem
3) Events: user-interaction events

4) Persistence: access to data storage The class can also register EventQueue objects that will receive user events and allows static access to Graphics and Audio by the following calls; the "setImpl()" method must be called before any of the other calls will work:

Environent.setImpl (...); // set a new environment (Platform/Config/Profile) 1) Graphics g = Environment.getGraphics (); 2) Audio a = Environment.getAudio (); 3) Environment.register (...); // register an EventQueue instance 4) Database db = Environment.getDatabase (String id); It can return a Database object based on a String that identifies the database and its context. A database can add, get, put and delete records.

Version:
1.0
Author:
Bernd R. Fix
See Also:
EventQueue, Graphics, Audio, Database, Dataset

Field Summary
private static Audio audio
          Audio attribute.
private static Graphics canvas
          Graphics attribute.
private static Implementation impl
          reference to Implementation (interface).
 
Constructor Summary
Environment()
           
 
Method Summary
(package private) static void ()
          static initialization
static int decodeIdString(java.lang.String str)
          Decode a four-letter-String into a 32-bit-Integer used as an identifier for applications and databases.
static void dispose()
          clean-up an implementation instance.
static Audio getAudio()
          get access to the Audio implementation.
static Database getDatabase(java.lang.String id)
          return a requested database object.
static Graphics getGraphics()
          get access to the Graphics implementation.
static void register(EventQueue queue)
          registration of EventQueue.
static void setImpl(Implementation sys)
          set an implementation instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

impl

private static Implementation impl
reference to Implementation (interface).


canvas

private static Graphics canvas
Graphics attribute.

audio

private static Audio audio
Audio attribute.
Constructor Detail

Environment

public Environment()
Method Detail

setImpl

public static void setImpl(Implementation sys)
set an implementation instance.

Parameters:
sys - Implementation - implementation to be used.

dispose

public static void dispose()
clean-up an implementation instance.


register

public static void register(EventQueue queue)
registration of EventQueue. The environment is going to dispatch all events to a registered EventQueue instance.

Parameters:
queue - EventQueue - handler for system events.

getGraphics

public static Graphics getGraphics()
get access to the Graphics implementation.

Returns:
Graphics - the canvas object

getAudio

public static Audio getAudio()
get access to the Audio implementation.

Returns:
Audio - the audio object

getDatabase

public static Database getDatabase(java.lang.String id)
return a requested database object.

Parameters:
id - String - identifying name of the database.
Returns:
Database - a database handler.

decodeIdString

public static final int decodeIdString(java.lang.String str)
Decode a four-letter-String into a 32-bit-Integer used as an identifier for applications and databases.

Parameters:
str - String - four-letter name
Returns:
int - identifier

static void ()
static initialization