Краткое содержание страницы № 1
Dumpleton
Software
Consulting
Pty Limited
OSE
Version 7.0pl5
Python Manual
19 January 2003
Copyright 2001-2003 Dumpleton Software Consulting Pty Limited
http://www.dscpl.com.au
Краткое содержание страницы № 2
2
Краткое содержание страницы № 3
Table of Contents Unique Identifiers............................ 22 Table of Contents........................... 3 Process Identity ............................... 23 Manual Overview ..........................7 Event Framework......................... 25 Python Modules ............................. 9 Scheduling a Job ............................. 25 Module Descriptions .......................10 Real Time Events ............................ 28 Installation and Setup...................... 10 Destr
Краткое содержание страницы № 4
Table of Contents Service Lookup ...............................44 Handling Structured Types..............85 Service Reports.............................47 Servlet Framework .......................87 Publishing Reports ..........................48 Framework Overview......................87 Monitoring Reports .........................48 The HTTP Daemon .........................88 Lifetime of Reports .........................50 The File Server ................................89 Identity of Subscri
Краткое содержание страницы № 5
Managing User Sessions ............... 116 The SOAP Gateway ...................... 121 The XML-RPC Gateway...............118 Using Multiple Gateways.............. 123 5
Краткое содержание страницы № 6
Table of Contents 6
Краткое содержание страницы № 7
Manual Overview This manual covers the Python wrappers around the OSE C++ class library. The wrappers make avail- able functionality related to the logging system, the real time events system, the service agent frame- work for creating distributed applications, the HTTP servlet framework and the RPC over HTTP interfaces. Python Modules Lists the available Python modules and their pur- pose. Includes brief details regarding installation and setup of the users environment. Logging Facility Describ
Краткое содержание страницы № 8
Manual Overview Service Agents Describes how to create service agents, add them to groups, subscribe to announcements regarding specific services or membership of specific serv- ice groups. Service Reports Describes how to subscribe to reports published by specific services. Ie., describes the publish/ subscribe functionality provided by the service agent framework. Service Requests Describes how to send requests to remote or local service agents and how to handle any response or error which res
Краткое содержание страницы № 9
Python Modules OSE includes a number of Python modules. The main module is a wrapper around functionality pro- vided in the OSE C++ class library. Those parts of the OSE C++ class library for which a Python wrap- per are provided are the logging system, the real time events system, the service agent framework for creating distributed applications and the HTTP servlet framework. Additional modules provide access to the OSE service agent framework using an RPC over HTTP pro- tocol called NET-RPC a
Краткое содержание страницы № 10
Python Modules Module Descriptions The Python modules, their names and their purpose are described below. Module Purpose netsvc This is the main module and provides wrappers around the functionality of the OSE C++ class library. It includes all that is required for building distributed applications using the service agent framework. netrpc This module provides a client implementation of the RPC over HTTP protocol implemented by OSE called NET-RPC. netsvc.xmlrpc This module includes the XML-RPC g
Краткое содержание страницы № 11
Additional Information An OSE installation supports libraries for different architectures. In order that the shared libraries for your specific platform can be found by the Python module, you should ensure that theOSE_HOST var- iable is set to the same value it was set to when OSE was installed. For example: OSE_HOST=X86_LINUX If you want to be able to run the "spyon" debugger, yourPATH environment variable should include the OSE bin directory. For OSE 7.0, if installed into its standard locatio
Краткое содержание страницы № 12
Python Modules 12
Краткое содержание страницы № 13
Logging Facility The logging facility provides you with a mechanism for generating and capturing messages generated by your application. These can be automatically saved to a log file, or intercepted and dealt with in some other way. The majority of functionality for this feature is provided by theOTC_Logger class in the OSE C++ class library. Some of the features of the logging facility are optional and controlled via environment variables. You should consult the manual page for theOTC_Logger c
Краткое содержание страницы № 14
Logging Facility Level Usage LOG_NOTICE Conditions that are not error conditions, but that may require special handling. LOG_INFO Informational messages. LOG_DEBUG Message that contain information normally of use only when debugging a program. To log a message, a handle to an instance of theLogger class is acquired and the "notify()"mem- ber function is called. import netsvc logger = netsvc.Logger() logger.notify(netsvc.LOG_DEBUG,"message") The format of a message when displayed will be: DEBUG:
Краткое содержание страницы № 15
Specifying a Log File The string used to specify the name of a log file may incorporate the following special tags. Tag Purpose %h Will encode the hostname of the machine into the name of the log file. %p Will encode the process ID into the name of the log file. %Y Will encode the current year as 4 digits into the name of the log file. %y Will encode the current year as 2 digits into the name of the log file. %m Will encode the current month of the year as a zero padded 2 digit number into the n
Краткое содержание страницы № 16
Logging Facility Specifying a Log Channel When logging a message, a log channel may also be specified. If the name of a log channel starts with a character other than an alphanumeric character, the message will not be displayed on the standard error output or appear in the log file. If it is displayed or captured in the log file, the name of the log channel does not appear anywhere in the message. The intent of the log channel is to allow one part of an application to capture specific messages p
Краткое содержание страницы № 17
Exceptions in a Callback try: function() except SystemExit: raise except: netsvc.logException() sys.exit() The details of the exception are logged with level "LOG_ERROR" and a specific log channel is not specified. If you wanted to log the details of the exception to a specific log channel, or vary the level, you can use the "exceptionDetails()" function of the "netsvc" module to obtain the same in- formation that would be logged by the "logException()" function and then call the "notify()" memb
Краткое содержание страницы № 18
Logging Facility 18
Краткое содержание страницы № 19
Program Setup As Python is an interpreted language, configuration of an application can be carried out by editing the actual scripts. In some circumstances however, it is still easier or more practical to rely upon a config- uration database or environment variables. When using OSE this is especially the case, as an applica- tion can be a mix of C++ and Python code and configuration data may need to be accessible from code written in both languages. To support this the Python wrappers provide an
Краткое содержание страницы № 20
Program Setup import netsvc import os netsvc.loadConfig("database.cfg") netsvc.mergeConfig("PWD",os.getcwd()) print netsvc.lookupConfig("PWD") A single configuration item can be removed from the database using the "removeConfig()" func- tion. The configuration database can be completely emptied using the function "removeAllCon- fig()". The contents of the configuration database can be saved to a file using the "saveConfig()" function. netsvc.removeConfig("PWD") netsvc.saveConfig("database.cfg")