Previous Next Contents Index


GUID class (deprecated)

The GUID class is not necessary in the new application model. This class is deprecated and is provided for backward compatiblity only.

The GUID class represents a Globally Unique Identifier, or GUID, which uniquely identifies each application component under Netscape Application Server. This class provides methods for creating, specifying, and testing GUIDs within application components.

A GUID is a 128-bit hexadecimal number in the following printed format:

{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
Each X is a hexadecimal digit, and the braces and hyphens are required.

GUIDs provide a simple layer of security for your applications because they are not easily human-readable, as in the following example:

{E8128C30-6BF8-11cf-96FC-0020AFED9A65}
When calling an application component from a web page or from another application component, you must specify a GUID, usually in a string printed format, as shown in the examples in this section. When an application component is called, a request message notifies Netscape Application Server, which then runs the component.

You must assign and register a unique GUID for each application component you create. For more information about registering GUIDs, see the Programmer's Guide.

To instantiate the GUID class, use the Java new keyword, as shown in the following example:

GUID myGUID;

myGUID = new GUID();
Package
com.kivasoft.types

Methods
Method
Description
GUID( )
Creates a GUID object.
isNull( )
Determines whether the GUID object is null (all zeros).
reset( )
Resets the GUID object to null (all zeros).

Extends
Object.

Example
String str;

// Create a unique GUID string
str = runprogram("kguidgen", null, null, null);
if (str != null) {
//example: str = "{E8128C30-6BF8-11cf-96FC-0020AFED9A65}";
GUID guid;
guid = new GUID(str);
if (!guid.isNull()) {
return guid;
}
}
return null;
}
GUID( )
Creates a GUID object.

Syntax 1
This version, the default constructor method, creates a null GUID containing all zeros.

public guid()
Syntax 2
This version creates a GUID from a String representation.

public GUID(String guidString)

guidString. String representing the GUID, using hexadecimal numbers, in the following format:

{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
Return Value
A GUID object containing either all zeros (null) or a 128-bit hexadecimal number, or null for failure (such as the input string or values are not in the correct format).

Example
String str;

// Create a unique GUID string
str = runprogram("kguidgen", null, null, null);
if (str != null) {
// example: str = "{E8128C30-6BF8-11cf-96FC-0020AFED9A65}";
GUID guid;
guid = new GUID(str);
if (!guid.isNull()) {
return guid;
}
}
return null;
}
Related Topics
isNull( ), reset( )

isNull( )
Determines whether the GUID object is null (all zeros).

Syntax
public boolean isNull()
Usage
Use isNull( ) after calling GUID( ) to determine whether the GUID was created successfully. A null GUID object has the following format:

{00000000-0000-0000-0000-000000000000}
Return Value
A Boolean true if the specified GUID is null, or false if not.

Example
if (!guid.isNull()) {

return guid;
}
Related Topics
GUID( ), reset( )

reset( )
Resets the GUID object to null (all zeros). A null GUID object has the following format:

{00000000-0000-0000-0000-000000000000}
Syntax
public void reset()
Example
// Reset a GUID to null

guid.reset();
// At this point, guid.isNull() returns true
Related Topics
GUID( ), isNull( )

 

© Copyright 1999 Netscape Communications Corp.