# Jini(TM) Landlord Utilities
v2.0_002 Release Notes

## Description

The com.sun.jini.landlord package provides implementations of the `net.jini.core.lease.Lease` and `net.jini.core.lease.LeaseMap` interfaces. It also provides various utilities helpful in implementing the server side of the Jini(TM) technology leasing model.

## Changes since the v1.2.X release

The version of the landlord package included in this release of the Jini Technology Starter Kit (starter kit) has the following new features :

- Support for the new `net.jini.core.constraint` model. This support includes a sub-class, `com.sun.jini.landlord.ConstrainableLandlordLease`, of `com.sun.jini.landlord.LandlordLease` that implements `net.jini.core.constraint.MethodConstraints` and an accompanying sub-class, `com.sun.jini.landlord.ConstrainableLandlordLeaseMap`, of `com.sun.jini.landlord.LandlordLeaseMap` that inherits constraints from the `ConstrainableLandlordLease` that created it.
- Support for verification of `ConstrainableLandlordLease` through the proxy trust mechanism using `com.sun.jini.landlord.LandlordProxyVerifier`.
- Robust implementations of the `equals`, `hashCode`, `Lease.canBatch`, and `LeaseMap.canContainKey` methods in the face of `com.sun.jini.landlord.Landlord` implementations that don't provide reference equality.
- Utilities for calculating lease grants and renewals that work well with the `net.jini.config` configuration model.
- Addition of `readObject` and `readObjectNoData` methods to `LandlordLease` to enforce class invariants.

To support these new features extensive changes were made to the landlord package. Various classes and interfaces were added, incompatibly changed, and removed. Also, incompatible changes were made to the serialized form of `LandlordLease`. Because of the magnitude of the changes, the package name was changed from `com.sun.jini.lease.landlord` to `com.sun.jini.landlord`.

### Changes to Proxies Classes and `Landlord` Interface

The primary visible change to `LandlordLease` was to change the type of the `cookie` from `Object` to `net.jini.id.Uuid`. This had a cascade effect on `LandlordLease`'s constructor and the methods declared in the `Landlord` interface. This change was made so `LandlordLease`s could be treated as capabilities and to ensure that the implementation of `LandlordLease`'s `equals` and `hashCode` methods was not dependent on the nature of the implementation of the `equals` and `hashCode` methods in the underlying `Landlord` reference.

Another significant change to `LandlordLease` was the addition of a landlord Uuid. The landlord Uuid is a `Uuid` that must universally and uniquely identify the granter of the lease. This had a cascade effect on `LandlordLease`'s constructor. A similar addition was made to `LandlordLeaseMap`. This change was made so their implementation of the `canBatch` and `canContainKey` methods would not be dependent on the nature of the implementation of the `equals` and `hashCode` methods in the underlying `Landlord` reference.

`LandlordLeaseMap` was changed to no longer be serializable. In practice there is little reason to serialize `LeaseMap`s and having `LandlordLeaseMap` be serializable added additional complications in the development of `ConstrainableLandlordLeaseMap`.

Finally, various unused protected and package scope methods were removed from `LandlordLease` along with a nested factory class.

### Changes to Server Side Utilities

Changing the type of lease cookies from `Object` to `Uuid` necessitated changes in :

- `com.sun.jini.landlord.LocalLandlord`
- `com.sun.jini.landlord.LandlordUtil`
- `com.sun.jini.landlord.LeasedResource`

In the v1.2.X starter kit there existed a `LeasePolicy` abstraction that encapsulated lease creation (controlled thorough a pluggable factory interface, `LandlordLeaseFactory`), the calculation of lease grants and renewals, the updating of `LeasedResource`s, and hooks for plugging in custom code to be run when a lease was granted or renewed (specified using objects that implemented the `LeaseManager` interface). The `LeasePolicy`, `LandlordLeaseFactory`, and `LeaseManager` abstractions and any accompanying implementations have been removed from the landlord package. `LeasePolicy` and the associated abstractions were too rigid for the value they added. A simpler more flexible set of abstractions that requires a few more lines of boilerplate code has been added in their place.

The old `LandlordLeaseFactory` abstraction and associated implementations have been replaced with a single concrete factory class, `com.sun.jini.landlord.LeaseFactory`. The new factory will create `ConstrainableLandlordLease` instances when the factory is created with a `Landlord` that implements `MethodConstraints`. In addition to creating leases it can also be used to create `net.jini.security.TrustVerifier`s for any securable proxies that the factory produces.

The new `com.sun.jini.landlord.LeasePeriodPolicy` interface provides a simple abstraction for objects that calculate lease grants and renewals. Unlike `LeasePolicy` which, depending on the operation, either created the lease or updated the `LeasedResource`, the methods of `LeaseDurationPolicy` just return a pair of `long`s representing the new expiration and duration of the lease. Because it is simpler, the new abstraction should be more broadly applicable and is suitable for fetching from a `Configuration`. A simple implementation of `LeaseDurationPolicy`, `com.sun.jini.landlord.FixedLeasePeriodPolicy` is provided. `FixedLeasePeriodPolicy` implements a grant and renewal policy similar to the old `LeasePolicy` implementation `LeaseDurationPolicy`.

### Migrating from v1.2.X to v2.0_002

Because of the package name change, services using the old and new versions of the landlord package should be able to co-exist in the same Jini technology federation in spite of the changes that have been made to `LandlordLease`'s serialized form. Similarly, it should be possible to start using other features from the v2.0_002 starter kit in a service implementation that still uses the v1.2.X landlord package, though it will be necessary to obtain the older version of the landlord classes from a v1.2.X starter kit.

Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.