Package twisted :: Package internet :: Module app :: Class Application

[show private | hide private]
[frames | no frames]

## Class Application

                        Logger --+
                                 |
                     Versioned --+
                                 |
              OriginalAccessor --+
                                 |
    _AbstractServiceCollection --+
                                 |
                                Application

I am the `root object' in a Twisted process.

I represent a set of persistent, potentially interconnected listening TCP ports, delayed event schedulers, and service.Services.

Method Summary
| ``__init__`(self, name, uid, gid, authorizer, authorizer_)` Initialize me.
| `__delattr__(self, k)` (inherited from `OriginalAccessor`)
| `__getattr__(self, k)` (inherited from `OriginalAccessor`)
| `__getstate__(self)`
| `__repr__(self)`
| `__setattr__(self, k, v)` (inherited from `OriginalAccessor`)
| `__setstate__(self, state)` (inherited from `Versioned`)
| ``addDelayed`(self, delayed)` Adds an object implementing delay.IDelayed for execution in my event loop.
| `bindPorts(self)`
| ``connectSSL`(self, host, port, factory, ctxFactory, timeout, bindAddress)` Connect a given client protocol factory to a specific SSL server.
| ``connectTCP`(self, host, port, factory, timeout, bindAddress)` Connect a given client protocol factory to a specific TCP server.
| ``connectUDP`(self, remotehost, remoteport, protocol, localport, interface, maxPacketSize)` Connects a `ConnectedDatagramProtocol`instance to a UDP port.
| ``connectUNIX`(self, address, factory, timeout)` Connect a given client protocol factory to a specific UNIX socket.
| ``connectWith`(self, connectorType, *args, **kw)` Start an instance of the given `connectorType`connecting.
| `get_authorizer(self)`
| ``listenSSL`(self, port, factory, ctxFactory, backlog, interface)` Connects a given protocol factory to the given numeric TCP/IP port.
| ``listenTCP`(self, port, factory, backlog, interface)` Connects a given protocol factory to the given numeric TCP/IP port.
| ``listenUDP`(self, port, factory, interface, maxPacketSize)` Connects a given protocol factory to the given numeric UDP port.
| ``listenUNIX`(self, filename, factory, backlog)` Connects a given protocol factory to the UNIX socket with the given filename.
| ``listenWith`(self, portType, *args, **kw)` Start an instance of the given `portType`listening.
| `log(self, bytes)` (inherited from `Logger`)
| ``logPrefix`(self)` A log prefix which describes me.
| ``reallyDel`(self, k)` *actually* del self.k without incurring side-effects. (inherited from `OriginalAccessor`)
| ``reallySet`(self, k, v)` *actually* set self.k to v without incurring side-effects. (inherited from `OriginalAccessor`)
| ``removeDelayed`(self, delayed)` Remove a Delayed previously added to the main event loop with addDelayed.
| ``run`(self, save, installSignalHandlers)` run(save=1, installSignalHandlers=1) Run this application, running the main loop if necessary.
| ``save`(self, tag, filename, passphrase)` Save a pickle of this application to a file in the current directory.
| ``setEUID`(self)` Retrieve persistent uid/gid pair (if possible) and set the current process's euid/egid.
| ``setUID`(self)` Retrieve persistent uid/gid pair (if possible) and set the current process's uid/gid
| `unlistenTCP(self, port, interface)`
| ``unlistenUDP`(self, port, interface)` Stop a DatagramProtocol listening on the given local port and interface.
| `unlistenUNIX(self, filename)`
| `unlistenWith(self, portType, *args, **kw)`
| ``upgradeToVersion1`(self)` Version 1 Persistence Upgrade
| `upgradeToVersion10(self)`
| `upgradeToVersion11(self)`
| ``upgradeToVersion2`(self)` Version 2 Persistence Upgrade
| ``upgradeToVersion3`(self)` Version 3 Persistence Upgrade
| ``upgradeToVersion4`(self)` Version 4 Persistence Upgrade
| `upgradeToVersion5(self)`
| `upgradeToVersion6(self)`
| `upgradeToVersion7(self)`
| `upgradeToVersion8(self)`
| `upgradeToVersion9(self)`
| ``versionUpgrade`(self)` (internal) Do a version upgrade. (inherited from `Versioned`)

Class Variable Summary
`int` | `persistenceVersion`
`string` | `persistStyle`
`int` | `running`

Method Details

### __init__(self, name, uid=None, gid=None, authorizer=None, authorizer_=None)
(Constructor)

Initialize me.

If uid and gid arguments are not provided, this application will default to having the uid and gid of the user and group who created it.

  Parameters:
    `name` - a name
    `uid` - (optional) a POSIX user-id. Only used on POSIX systems.
    `gid` - (optional) a POSIX group-id. Only used on POSIX systems.

### addDelayed(self, delayed)

Adds an object implementing delay.IDelayed for execution in my event loop.

The timeout for select() will be calculated based on the sum of all Delayed instances attached to me, using their 'timeout' method. In this manner, delayed instances should have their various callbacks called approximately when they're supposed to be (based on when they were registered).

This is not hard realtime by any means; depending on server load, the callbacks may be called in more or less time. However, 'simulation time' for each Delayed instance will be monotonically increased on a regular basis.

See the documentation for twisted.python.delay.Delayed and IDelayed for details.

### connectSSL(self, host, port, factory, ctxFactory, timeout=30, bindAddress=None)

Connect a given client protocol factory to a specific SSL server.

### connectTCP(self, host, port, factory, timeout=30, bindAddress=None)

Connect a given client protocol factory to a specific TCP server.

### connectUDP(self, remotehost, remoteport, protocol, localport=0, interface='', maxPacketSize=8192)

Connects a `ConnectedDatagramProtocol` instance to a UDP port.

EXPERIMENTAL.

### connectUNIX(self, address, factory, timeout=30)

Connect a given client protocol factory to a specific UNIX socket.

### connectWith(self, connectorType, *args, **kw)

Start an instance of the given `connectorType` connecting.

  Parameters:
    `connectorType`
    (type=type which implements `IConnector`)

### listenSSL(self, port, factory, ctxFactory, backlog=5, interface='')

Connects a given protocol factory to the given numeric TCP/IP port. The connection is a SSL one, using contexts created by the context factory.

### listenTCP(self, port, factory, backlog=5, interface='')

Connects a given protocol factory to the given numeric TCP/IP port.

### listenUDP(self, port, factory, interface='', maxPacketSize=8192)

Connects a given protocol factory to the given numeric UDP port.

### listenUNIX(self, filename, factory, backlog=5)

Connects a given protocol factory to the UNIX socket with the given filename.

### listenWith(self, portType, *args, **kw)

Start an instance of the given `portType` listening.

  Parameters:
    `portType`
    (type=type which implements `IListeningPort`)

### logPrefix(self)

A log prefix which describes me.

### removeDelayed(self, delayed)

Remove a Delayed previously added to the main event loop with addDelayed.

### run(self, save=1, installSignalHandlers=1)

run(save=1, installSignalHandlers=1) Run this application, running the main loop if necessary. If 'save' is true, then when this Application is shut down, it will be persisted to a pickle. 'installSignalHandlers' is passed through to main.run(), the function that starts the mainloop.

### save(self, tag=None, filename=None, passphrase=None)

Save a pickle of this application to a file in the current directory.

### setEUID(self)

Retrieve persistent uid/gid pair (if possible) and set the current process's euid/egid.

### setUID(self)

Retrieve persistent uid/gid pair (if possible) and set the current process's uid/gid

### unlistenUDP(self, port, interface='')

Stop a DatagramProtocol listening on the given local port and interface.

### upgradeToVersion1(self)

Version 1 Persistence Upgrade

### upgradeToVersion2(self)

Version 2 Persistence Upgrade

### upgradeToVersion3(self)

Version 3 Persistence Upgrade

### upgradeToVersion4(self)

Version 4 Persistence Upgrade

Class Variable Details

### persistenceVersion

  Type:
    `int`
  Value:

        11

### persistStyle

  Type:
    `string`
  Value:

        'pickle'

### running

  Type:
    `int`
  Value:

        0

Generated by Epydoc 1.1 on Sat Feb 15 21:17:51 2003 | http://epydoc.sf.net