beehive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kenneth Tam" <kentamina...@gmail.com>
Subject Re: Control Versioning
Date Tue, 28 Mar 2006 20:08:35 GMT
Hi Anthony,

Control interfaces (annotated with @ControlInterface) can have a
version # associated with them, using the @Version annotation. 
Control authors are expected to define version #s for interfaces in
terms of the semantics of the interface; ie, each distinct version #
is defined by a particular set of semantic behaviours.

Things that have a consumption dependency on control interfaces, such
as field references (@Control) and control extensions
(@ControlExtension) can use the @VersionRequired annotation which is
says that they _require_ a certain version of the control interface
(or greater) in order to get the semantics that they need.

Things that have an implementation dependency on control interfaces,
ie, control implementations (@ControlImplementation), can use the
@VersionSupported annotation, which says that this implementation
_supports_ the semantics defined by a certain version of the control
interface (or less).

Consider this example:

@ControlInterface
@Version( major=1 )
public interface Account
{
  // Semantics of v1 are that this method returns first name/last name
  String getCustomerFullName();
}

@ControlInterface
@Version( major=2 )
public interface Account
{
  // Semantics of v2 are that this method returns first name/middle
name/last name
  String getCustomerFullName();
}

@ControlImplementation
@VersionSupported( major=1 )
public class AccountImpl implements Account
{
    String getCustomerFullName() { return _firstName + " " +  _lastName; }
}

@ControlImplementation
@VersionSupported( major=2 )
public class AccountImpl implements Account
{
    String getCustomerFullName() { return _firstName + " " + _midName
+ " " + _lastName; }
}

// Client code needs to get the middle name if it's present, thus
requires v2 semantics
...
@Control
@VersionRequired( major=2)
public Account _account;
...

Now, if the client is compiling against an old distribution of the
control interface which only has the v1 version, then it'll get a
versioning error.  If it compiles against the v2 version, but at
deployment time is given only the v1 impl, it'll also get a versioning
error.

On 3/20/06, Antony Chien <antony.chien@gmail.com> wrote:
> Hi,
> Reading controls javadoc, it comes to me that Control can be versioned.
> However, there is currently no documentation, hence no way to play with it.
> Can someone direct me on how to use Control versioning?
>
> --
> Regards,
> Antony Chien
>
>

Mime
View raw message