Bees v0.5.0 API

bees.core.resource
Class Clock

java.lang.Object
  |
  +--bees.core.Capability
        |
        +--bees.core.resource.Clock
All Implemented Interfaces:
edu.utah.janosvm.kit.comm.jsi.JSIHandler

public final class Clock
extends Capability
implements edu.utah.janosvm.kit.comm.jsi.JSIHandler

The clock capability is used to read/write the system clock. The capability will also behave as an up time clock if the user doesn't have the permission to read the real time.


Field Summary
static PermissionSet DEFAULT_PERMISSIONS
          Default permissions.
static Permission GRANULARITY
          Permission to write the local time.
static Permission READ_LOCAL_TIME
          Permission to read the local time.
static Permission WRITE_LOCAL_TIME
          Permission to write the local time.
 
Fields inherited from class bees.core.Capability
DELETE_PERMISSION, id, INVALID_ID
 
Constructor Summary
Clock()
          Construct an empty Clock capability.
 
Method Summary
 long current()
           
 boolean expired(long time)
          Compare a time against the current time to determine if it is or isn't in the future.
protected  void fromBytes(byte[] flattened)
          Bind this capability to the given object.
 long getGranularity()
           
 void getSuites(edu.utah.janosvm.kit.comm.jsi.JSIMessage jm)
           
 void handleMessage(edu.utah.janosvm.kit.comm.jsi.JSIHandlerContext jhc, edu.utah.janosvm.kit.comm.jsi.JSIMessage jm)
           
 edu.utah.janosvm.kit.comm.jsi.JSIHandler resolveSpecifier(edu.utah.janosvm.kit.comm.jsi.JSIMessage jm, edu.utah.janosvm.kit.comm.jsi.JSIPair jp)
           
 void revoke()
          Revoke access to the capability.
 java.lang.String toString()
           
 
Methods inherited from class bees.core.Capability
checkPermission, clear, clonePermission, deleteCapability, equals, fromBytes, revokedPermission, revokePermission, revokePermissions, valid
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

READ_LOCAL_TIME

public static final Permission READ_LOCAL_TIME
Permission to read the local time.

WRITE_LOCAL_TIME

public static final Permission WRITE_LOCAL_TIME
Permission to write the local time.

GRANULARITY

public static final Permission GRANULARITY
Permission to write the local time.

DEFAULT_PERMISSIONS

public static final PermissionSet DEFAULT_PERMISSIONS
Default permissions.
Constructor Detail

Clock

public Clock()
Construct an empty Clock capability.
Method Detail

fromBytes

protected void fromBytes(byte[] flattened)
                  throws java.lang.Exception
Description copied from class: Capability
Bind this capability to the given object.
Overrides:
fromBytes in class Capability
See Also:
Capability.fromBytes(byte[])

revoke

public void revoke()
Description copied from class: Capability
Revoke access to the capability.
Overrides:
revoke in class Capability
See Also:
Capability.revoke()

getGranularity

public long getGranularity()
Returns:
The clock granularity.

current

public long current()
Returns:
The uptime for this object or the current time, if this capability has the appropriate permissions.

expired

public boolean expired(long time)
Compare a time against the current time to determine if it is or isn't in the future.
Parameters:
time - The time value to test.
Returns:
True if "time" is in the past, false if it is in the future.

resolveSpecifier

public edu.utah.janosvm.kit.comm.jsi.JSIHandler resolveSpecifier(edu.utah.janosvm.kit.comm.jsi.JSIMessage jm,
                                                                 edu.utah.janosvm.kit.comm.jsi.JSIPair jp)
Specified by:
resolveSpecifier in interface edu.utah.janosvm.kit.comm.jsi.JSIHandler
See Also:
JSIHandler.resolveSpecifier(JSIMessage, JSIPair)

handleMessage

public void handleMessage(edu.utah.janosvm.kit.comm.jsi.JSIHandlerContext jhc,
                          edu.utah.janosvm.kit.comm.jsi.JSIMessage jm)
Specified by:
handleMessage in interface edu.utah.janosvm.kit.comm.jsi.JSIHandler
See Also:
JSIHandler.handleMessage(JSIHandlerContext, JSIMessage)

getSuites

public void getSuites(edu.utah.janosvm.kit.comm.jsi.JSIMessage jm)
Specified by:
getSuites in interface edu.utah.janosvm.kit.comm.jsi.JSIHandler
See Also:
JSIHandler.getSuites(JSIMessage)

toString

public java.lang.String toString()
Overrides:
toString in class Capability
See Also:
Object.toString()

Bees v0.5.0 API

This documentation is Copyright (C) 2002 The University of Utah. All Rights Reserved. See the individual source files for distribution terms.
Documentation, software, and mailing lists for Bees v0.5.0 can be found at the Janos Project: http://www.cs.utah.edu/flux/janos/