Class Index | File Index

Classes


Class baja.Ord


Extends baja.Simple.
Object Resolution Descriptor.

An ORD is how we can access Objects in the Server from BajaScript. It's similar to a URI but is much more powerful and extensible. For more information, please see the Niagara developer documentation on ORDs and how they're used.

  // Resolve an ORD
  baja.Ord.make("station:|slot:/Folder/NumericWritable").get({
    ok: function () {
      baja.outln(this.getOutDisplay());
    },
    lease: true
  });

If more than one ORD needs to be resolved then use a baja.BatchResolve.

This Constructor shouldn't be invoked directly. Please use the 'make' methods to create an instance of an ORD.
Defined in: ord.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Field Summary
Field Attributes Field Name and Description
<static>  
baja.Ord.DEFAULT
Default ORD instance.
Fields borrowed from class baja.Value:
newCopy
Fields borrowed from class baja.Object:
equivalent, getIcon
Method Summary
Method Attributes Method Name and Description
 
Decode an ORD from a String.
 
Encode an ORD to a String.
 
get(object)
Resolve the ORD and get the resolved Object from the ORD Target.
<static>  
baja.Ord.make(ord)
Make an ORD.
 
make(ord)
Make an ORD.
 
Return a normalized version of the ORD.
 
Parse an ORD to a number of ORD Query objects.
 
Relativize is used to extract the relative portion of this ord within an session:
  1. First the ord is normalized.
 
resolve(obj)
Resolve an ORD.
 
Return an String representation of the object.
 
Return the ORD as URI that can be used in a browser.
 
Return the inner value of this Object.
Methods borrowed from class baja.Simple:
equals
Class Detail
baja.Ord()
See:
baja.Ord.make
baja.BatchResolve
Field Detail
<static> baja.Ord.DEFAULT
Default ORD instance.
Method Detail
{baja.Ord} decodeFromString(str)
Decode an ORD from a String.
Parameters:
{String} str
the ORD String.
Returns:
{baja.Ord} the decoded ORD.

{String} encodeToString()
Encode an ORD to a String.
Returns:
{String} the ORD encoded to a String.

get(object)
Resolve the ORD and get the resolved Object from the ORD Target.

This method calls baja.Ord#resolve and calls 'get' on the ORD Target to pass the object onto the ok function callback.

An Object Literal is used to to specify the method's arguments. For more information on how to use this method please see baja.Ord#resolve.

  baja.Ord.make("service:baja:UserService|slot:jack").get({
    ok: function (user) {
      // Do something with the user...
    },
    lease: true
  });
Parameters:
{Object} object Optional
Returns:
the value resolved from the ORD.
See:
OrdTarget#resolve

<static> {baja.Ord} baja.Ord.make(ord)
Make an ORD.

The argument can be a String, baja.Ord or an Object. If an Object is passed in then if there's a base and child Property, this will be used to construct the ORD (by calling 'toString' on each). Otherwise 'toString' will be called on the Object for the ORD.

  // Resolve an ORD
  baja.Ord.make("station:|slot:/Folder/NumericWritable").get({
    ok: function () {
      baja.outln(this.getOutDisplay());
    },
    lease: true
  });
Parameters:
{String|Object} ord
Returns:
{baja.Ord}

{baja.Ord} make(ord)
Make an ORD.
Parameters:
{String} ord
Returns:
{baja.Ord}
See:
baja.Ord.make

{baja.Ord} normalize()
Return a normalized version of the ORD.
Returns:
{baja.Ord}

{baja.OrdQueryList} parse()
Parse an ORD to a number of ORD Query objects.
Returns:
{baja.OrdQueryList} a list of ORDs to resolve.

{baja.Ord} relativizeToSession()
Relativize is used to extract the relative portion of this ord within an session:
  1. First the ord is normalized.
  2. Starting from the left to right, if any queries are found which return true for isSession(), then remove everything from that query to the left.
Returns:
{baja.Ord}

resolve(obj)
Resolve an ORD.

Resolving an ORD consists of parsing and processing it to get a result. The result is an ORD Target.

Any network calls that result from processing an ORD are always asynchronous.

The resolve method requires an ok function callback or an Object Literal that contains the method's arguments...

  baja.Ord.make("station:|slot:/").resolve(function ok(target) {
    // process the ORD Target
  });

  //...or use an Object Literal to specify multiple arguments...
  
  baja.Ord.make("station:|slot:/").resolve({
    ok: function (target) {
      // process the ORD target
    },
    fail: function (err) {
      // process the failure
    },
    lease: true // ensure any resolved Components are leased before calling 'ok'
  });

Please note that unlike other methods that require network calls, no batch object can be specified!

Parameters:
{Object} obj Optional
the Object Literal that contains the method's arguments.
{Function} obj.ok Optional
the ok function called once the ORD has been successfully resolved. The ORD Target is passed to this function when invoked.
{Function} obj.fail Optional
the fail function called if the ORD fails to resolve. An error cause is passed to this function when invoked.
obj.base Optional
the base Object to resolve the ORD against.
{Boolean} obj.lease Optional
if defined and true, any Components are temporarily subscribed.
{Number|baja.RelTime} obj.leaseTime Optional
the amount of time in milliseconds to lease for (lease argument must be true). As well as a Number, this can also a baja.RelTime.
{baja.Subscriber} obj.subscriber Optional
if defined the Component is subscribed using this Subscriber.
{Object} obj.cursor Optional
if defined, this specifies parameters for iterating through a Cursor (providing the ORD resolves to a Collection or Table). For more information, please see baja.coll.Collection#cursor.
See:
OrdTarget
baja.Ord#get
baja.RelTime

{String} toString()
Return an String representation of the object.
Returns:
{String} a String representation of an ORD.

{String} toUri()
Return the ORD as URI that can be used in a browser.
Returns:
{String}

{String} valueOf()
Return the inner value of this Object.
Returns:
{String} a String representation of an ORD.

Documentation generated by JsDoc Toolkit 2.3.2