An InCharge::object reference is required to access the properties or methods of a Domain Manager object. This reference is returned from the object() or create() methods of the InCharge::sessionmodule. Both methods allow access to preexisting objects, but the create() method will also create the object if it does not already exist. While create()always accesses the Domain Manager, object() may or may not depending on the invocation technique.

 $obj = $session->object( "Router", "edgert1" );
 $obj = $session->object( "Router::edgert1" );
 $obj = $session->create( "Router", "newrouter" );

If you do not know the class to which an object belongs, you can either use a class argument of undef, or a string with nothing before the double-colon (::). For example,

 $obj = $session->object( undef, "edgert1" );
 $obj = $session->object( "::edgert1" );

The option of omitting the class name does not work with the InCharge::session->create() method because the Domain Manager cannot create an object without knowing which class to use. It does work with InCharge::session->object() and related calls because the process of referring to an existing instance can legitimately include a query to identify the object's class.

Note:

If you choose not to provide the class name in these calls, the API does additional work to determine the object's class, which imposes a slight performance penalty.

Once an object reference has been created, it can be used to invoke the object's operations or access its properties. Access to an object's attributes or properties can be obtained by using calls shown in the following example.

 $vendor = $obj->get( "Vendor" );
 $vendor = $obj->{Vendor};
 ($vendor,$model) = $obj->get( "Vendor", "Model" );
 %properties = $obj->get( );
 $obj->put( "Vendor", "Cisco" );
 $obj->{Vendor} = "Cisco";
 $obj->put(Vendor => "Cisco", Model => "2010" );

These examples show that object properties can be accessed by using either the get() and put() methods or the psuedo-hash syntax. The latter syntax is preferred because it is closer to the original built-in ASL language logic.

Two special internal properties can be accessed by using the hash syntax only. These give the name of the class and instance to which the object reference refers. Treat them as read-only fields.

 $obj->{_class}           BUT NOT: $obj->get("_class")
 $obj->{_instance}        BUT NOT: $obj->get("_instance")

Object operations can be invoked by using the invoke() method, or directly, as in the example:

 @ports = $obj->invoke( "findPorts" );
 @ports = $obj->findPorts();
 $port = $obj->
  invoke( "makePort", "1.0", "PORT-rt1/1.0", "Port" );
 $port = $obj->makePort( "1.0", "PORT-rt1/1.0", "Port" );

Again, the latter syntax, calling the operation directly, is preferred.

Use the invoke() method to access an object operation that duplicates the name of any of the built-in methods of the InCharge::object class.

  • The first of these calls the new()operation of the object in the repository.

  • The second calls the built-in new() method of the InCharge::object class.

     $obj->invoke( "new", "qtable" );
     $obj->new( "qtable" );
    

    Note that InCharge::object is used for accessing ICIM instance operations and properties only. If you make other ICIM calls that refer to instances, such as subscribe(), use the features of InCharge::session directly. The following line of code is invalid:

     $obj->propertySubscribe( "Vendor" );
    

    Instead, use one of the following:

  • The first alternative:

     $session->propertySubscribe($class, $instance, "Vendor");
    
  • The second alternative:

     $session->propertySubscribe( $obj, ``Vendor'' );
    

    The reason you have to use one of these two alternative methods is because the propertySubscribe is not a repository class operation, but rather it is a primitive.

     dmctl -s <domain> getOperations <classname> | more
    

    Likewise, to determine what properties can be accessed by using the InCharge::object module use:

     dmctl -s <domain> getProperties <classname>