コード例 #1
0
ファイル: example.py プロジェクト: awesome-python/Pyro4
import Pyro4
from Pyro4.naming import type_meta

from resources import LaserPrinter, MatrixPrinter, PhotoPrinter, TapeStorage, DiskStorage, Telephone, Faxmachine


# register various objects with some metadata describing their resource class
ns = Pyro4.locateNS()
d = Pyro4.Daemon()
uri = d.register(LaserPrinter)
ns.register("example.resource.laserprinter", uri,
            metadata=type_meta(LaserPrinter) | {"resource:printer", "performance:fast"})
uri = d.register(MatrixPrinter)
ns.register("example.resource.matrixprinter", uri,
            metadata=type_meta(MatrixPrinter) | {"resource:printer", "performance:slow"})
uri = d.register(PhotoPrinter)
ns.register("example.resource.photoprinter", uri,
            metadata=type_meta(PhotoPrinter) | {"resource:printer", "performance:slow"})
uri = d.register(TapeStorage)
ns.register("example.resource.tapestorage", uri,
            metadata=type_meta(TapeStorage) | {"resource:storage", "performance:slow"})
uri = d.register(DiskStorage)
ns.register("example.resource.diskstorage", uri,
            metadata=type_meta(DiskStorage) | {"resource:storage", "performance:fast"})
uri = d.register(Telephone)
ns.register("example.resource.telephone", uri,
            metadata=type_meta(Telephone) | {"resource:communication"})
uri = d.register(Faxmachine)
ns.register("example.resource.faxmachine", uri,
            metadata=type_meta(Faxmachine) | {"resource:communication"})
コード例 #2
0
import Pyro4
from Pyro4.naming import type_meta

from resources import LaserPrinter, MatrixPrinter, PhotoPrinter, TapeStorage, DiskStorage, Telephone, Faxmachine

# register various objects with some metadata describing their resource class
ns = Pyro4.locateNS()
d = Pyro4.Daemon()
uri = d.register(LaserPrinter)
ns.register("example.resource.laserprinter",
            uri,
            metadata=type_meta(LaserPrinter)
            | {"resource:printer", "performance:fast"})
uri = d.register(MatrixPrinter)
ns.register("example.resource.matrixprinter",
            uri,
            metadata=type_meta(MatrixPrinter)
            | {"resource:printer", "performance:slow"})
uri = d.register(PhotoPrinter)
ns.register("example.resource.photoprinter",
            uri,
            metadata=type_meta(PhotoPrinter)
            | {"resource:printer", "performance:slow"})
uri = d.register(TapeStorage)
ns.register("example.resource.tapestorage",
            uri,
            metadata=type_meta(TapeStorage)
            | {"resource:storage", "performance:slow"})
uri = d.register(DiskStorage)
ns.register("example.resource.diskstorage",
            uri,
コード例 #3
0
ファイル: example.py プロジェクト: ClearBlade/OPC-Adapter
import Pyro4
from Pyro4.naming import type_meta

from resources import LaserPrinter, MatrixPrinter, PhotoPrinter, TapeStorage, DiskStorage, Telephone, Faxmachine


# register various objects with some metadata describing their resource class
ns = Pyro4.locateNS()
d = Pyro4.Daemon()
uri = d.register(LaserPrinter)
ns.register("example.resource.laserprinter", uri,
            metadata=type_meta(LaserPrinter) | {"resource:printer", "performance:fast"})
uri = d.register(MatrixPrinter)
ns.register("example.resource.matrixprinter", uri,
            metadata=type_meta(MatrixPrinter) | {"resource:printer", "performance:slow"})
uri = d.register(PhotoPrinter)
ns.register("example.resource.photoprinter", uri,
            metadata=type_meta(PhotoPrinter) | {"resource:printer", "performance:slow"})
uri = d.register(TapeStorage)
ns.register("example.resource.tapestorage", uri,
            metadata=type_meta(TapeStorage) | {"resource:storage", "performance:slow"})
uri = d.register(DiskStorage)
ns.register("example.resource.diskstorage", uri,
            metadata=type_meta(DiskStorage) | {"resource:storage", "performance:fast"})
uri = d.register(Telephone)
ns.register("example.resource.telephone", uri,
            metadata=type_meta(Telephone) | {"resource:communication"})
uri = d.register(Faxmachine)
ns.register("example.resource.faxmachine", uri,
            metadata=type_meta(Faxmachine) | {"resource:communication"})
コード例 #4
0
ファイル: example.py プロジェクト: pombredanne/Pyro4
import Pyro4
from Pyro4.naming import type_meta

from resources import LaserPrinter, MatrixPrinter, PhotoPrinter, TapeStorage, DiskStorage


# register various objects with some metadata describing their resource class
ns = Pyro4.locateNS()
d = Pyro4.Daemon()
uri = d.register(LaserPrinter)
ns.register(
    "example.resource.laserprinter", uri, metadata=type_meta(LaserPrinter) | {"resource:printer", "performance:fast"}
)
uri = d.register(MatrixPrinter)
ns.register(
    "example.resource.matrixprinter", uri, metadata=type_meta(MatrixPrinter) | {"resource:printer", "performance:slow"}
)
uri = d.register(PhotoPrinter)
ns.register(
    "example.resource.photoprinter", uri, metadata=type_meta(PhotoPrinter) | {"resource:printer", "performance:slow"}
)
uri = d.register(TapeStorage)
ns.register(
    "example.resource.tapestorage", uri, metadata=type_meta(TapeStorage) | {"resource:storage", "performance:slow"}
)
uri = d.register(DiskStorage)
ns.register(
    "example.resource.diskstorage", uri, metadata=type_meta(DiskStorage) | {"resource:storage", "performance:fast"}
)