Mappa.Mundi Magazine
Rocket Science » SpaceKit for Java » Tutorial Rocket Science Index »

Olive Left Top Corner Spacer Image
SpaceKit for Java, page 7
Spacer Image
Olive Right Top Corner


1 Introduction
2 The Blocks SpaceKit for Java Client
3 Connecting and Channel Creation
4 Client Examples
5 The Blocks SpaceKit for Java Server: SpaceBxxd
6 SpaceBxxd - Responses
» Localization Class Structure and Utilities
8 Reference
ascii
html
xml
this article in RFC-2629 formats

Khaki Left Bottom Corner
Khaki Right Bottom Corner
Localization Class Structure
and Utilities
download the code | copyright | legal | join the discussion list

      Localization support can be added to the SpaceKit by creating a message class for the particular language to support. The class name is "SpaceMessage" followed by the language mnemonic with hyphens removed and capitalized. For example, the class name for "en-us" is "SpaceMessageENUS" and is an implemention of the "SpaceMessage" interface.

      The class contains one method get() with a single int argument specifying the message number. Error codes are considered message numbers.

      The class must be defined in the $CLASSPATH for the Java virtual machine.

A Localization Class Example

      This is the implementation of the "en-us" language as distributed with the Blocks SpaceKit for Java:

public class SpaceMessageENUS implements SpaceMessage {

//------------------------------------------------------------------------------
//  lookup message
//------------------------------------------------------------------------------
public String get(int messageCode) {
     if(messageCode == 421) return("service not available");
     if(messageCode == 450) return("requested action not taken");
     if(messageCode == 451) return("requested action aborted");
     if(messageCode == 454) return("temporary authentication failure");
     if(messageCode == 500) return("general syntax error");
     if(messageCode == 501) return("missing NUL separator");
     if(messageCode == 504) return("parameter not implemented");
     if(messageCode == 530) return("authentication required");
     if(messageCode == 534) return("authentication mechanism insufficient");
     if(messageCode == 535) return("authentication failure");
     if(messageCode == 537) return("action not authorized for user");
     if(messageCode == 538) return("authentication mechanism requires encryption");
     if(messageCode == 550) return("requested action not taken");
     if(messageCode == 553) return("parameter invalid");
     if(messageCode == 554) return("transaction failed");

     return(null);
     }
}

Utilities

SpaceKeyOtp: OTP Key Generation

      Each user defined in a user properties file contains an authorization key associated with the authorization mechanism. The SpaceKeyOtp utility arguments are algorithm, passphrase (not included in the user properties file), seed and count:

java SpaceKeyOtp sha1 secretpassphrase rwcsqa0120696 9911

      The key is sent to standard output:


Next » Reference.


 Copyright © 2000 Invisible Worlds. All Rights Reserved.

Invisible Worlds
contact | about | site map | home T-O