JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Remote Administration Daemon Developer Guide     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information

Preface

1.  Introduction

2.  Concepts

3.  Abstract Data Representation

4.  libadr

5.  Client Libraries

Java/JMX Client

Connecting to the rad Server

RadConnector.PROTOCOL_UNIX

RadConnector.PROTOCOL_TCP

RadConnector.PROTOCOL_TLS

RadConnector.PROTOCOL_PRIVATE

RadConnector.PROTOCOL_ZONESBRIDGE

radadrgen Usage

Enums

Structured Types

Unions

Interfaces

Caveats

Python Client

Modules

client

util

6.  Module Development

7.  rad Best Practices

A.  rad Binary Protocol

Python Client

Modules

The rad Python implementation provides the modules described in this section to facilitate client implementation.

client

Provides classes and methods which fully implement the rad protocol in Python.

util

Provides an Authentication class and utility methods for connecting a Python client to rad.

rad.util RadAuth

A class which fetches and caches a handle to an authentication object along with some convenience methods for manipulating it.

The following methods can be used to connect to a rad instance using variety of transports.

RadConnection connect_unix (string path ,
     string locale);
RadConnection connect_private (string list modules ,
     boolean debug ,
     string map env ,
     string root ,
     string list auxargs ,
     string locale);
 
RadConnection connect_tls (string host ,
     integer port ,
     string locale);
 

RadConnection connect_zone(RadConnection rc ,
     string zone ,
     string user ,
     string locale);

The resulting RadConnection can be used to:

Example 5-6 Method Invocation

import rad.util

# Connect to a local rad instance.
with rad.util.connect_unix() as rc:

    # Obtain a remote reference to the desired target.
    obj= rc.get_object_s("com.example", [("type", "GrabBag")])

    # Invoke a method on the target.
    res = obj.parseString("a test string")

    # Print the result.
    print "length: " + str(res.length)

Example 5-7 Attribute Access

import rad.util

# Connect to a local rad instance.
with rad.util.connect_unix() as rc:

    # Obtain a remote reference to the desired target.
    obj= rc.get_object_s("com.example", [("type", "GrabBag")])

    # Print the object attribute.
    print "Mood: " + str(obj.mood)

Example 5-8 Event Subscription

import rad.util

with rad.util.connect_unix() as rc:

    # Obtain a remote reference to the desired target.
    obj= rc.get_object_s("com.example", [("type", "GrabBag")])

    # Subscribe to the "moodswings" event
    rc.subscribe(obj, "moodswings")

    while True:
        # Perform a (blocking) read of an event
        ev_obj = obj.read_event()

        print "Received Event:"
        print "mood: " +str(ev_obj.mood)
        print "changed: " +str(ev_obj.changed)