Example #1
0
    def registerPlugin(self, plugin):
        """Registers a plugin."""

        plugin_types = {
            'presence': IPresencePlugin,
            'chat': IChatPlugin,
            'population': IPopulationPlugin,
            'base_plugin': IPlugin,
        }

        # Everything is, at least, a base plugin.
        valid_types = ['baseplugin']
        # Loop through the types of plugins and check for implentation of each.
        for t, interface in plugin_types.iteritems():
            try:
                verified_plugin = verify_plugin(interface, plugin)
                # If the above succeeded, then `plugin` implementes `interface`.
                self.plugins[t].append(verified_plugin)
                self.plugins[t].sort()
                valid_types.append(t)
            except DoesNotImplement:
                # This means this plugin does not declare to  be a `t`.
                pass
            except PluginException:
                log.error('Plugin "%s" claims to be a %s, but is not!', plugin.name, t)

        plugin.setup(self)

        log.info('registered plugin %s as %s', plugin.name, valid_types)
Example #2
0
    def registerPlugin(self, plugin):
        """Registers a plugin."""

        plugin_types = {
            'presence': IPresencePlugin,
            'chat': IChatPlugin,
            'population': IPopulationPlugin,
            'base_plugin': IPlugin,
        }

        # Everything is, at least, a base plugin.
        valid_types = ['baseplugin']
        # Loop through the types of plugins and check for implentation of each.
        for t, interface in plugin_types.iteritems():
            try:
                verified_plugin = verify_plugin(interface, plugin)
                # If the above succeeded, then `plugin` implementes `interface`.
                self.plugins[t].append(verified_plugin)
                self.plugins[t].sort()
                valid_types.append(t)
            except DoesNotImplement:
                # This means this plugin does not declare to  be a `t`.
                pass
            except PluginException:
                log.error('Plugin %s claims to be a %s, but is not!', plugin.name, t)

        plugin.setup(self)

        log.info('registered plugin %s as %s', plugin.name, valid_types)
Example #3
0
    def start(self):
        """
        Load a world from disk.
        """

        world_url = configuration.get(self.config_name, "url")
        world_sf_name = configuration.get(self.config_name, "serializer")

        try:
            sf = retrieve_named_plugins(ISerializerFactory, [world_sf_name])[0]
            self.serializer = verify_plugin(ISerializer, sf(world_url))
        except PluginException, pe:
            log.msg(pe)
            raise RuntimeError("Fatal error: Couldn't set up serializer!")
Example #4
0
    def __init__(self, name):
        """
        Load a world from disk.

        :Parameters:
            name : str
                The configuration key to use to look up configuration data.
        """

        self.config_name = "world %s" % name
        world_url = configuration.get(self.config_name, "url")
        world_sf_name = configuration.get(self.config_name, "serializer")

        try:
            sf = retrieve_named_plugins(ISerializerFactory, [world_sf_name])[0]
            self.serializer = verify_plugin(ISerializer, sf(world_url))
        except PluginException, pe:
            log.msg(pe)
            raise RuntimeError("Fatal error: Couldn't set up serializer!")
Example #5
0
    def __init__(self, name):
        """
        Load a world from disk.

        :Parameters:
            name : str
                The configuration key to use to look up configuration data.
        """

        self.config_name = "world %s" % name
        world_url = configuration.get(self.config_name, "url")
        world_sf_name = configuration.get(self.config_name, "serializer")

        try:
            sf = retrieve_named_plugins(ISerializerFactory, [world_sf_name])[0]
            self.serializer = verify_plugin(ISerializer, sf(world_url))
        except PluginException, pe:
            log.msg(pe)
            raise RuntimeError("Fatal error: Couldn't set up serializer!")