Ensure that plugin will call current connection method when accessing
        as ``plugin.<public_method>(*args, **kwargs)``.
424083
def _wrap_public_method(self, attr):
        
        def wrapper(*args, **kwargs):
            return getattr(self.connection, attr)(*args, **kwargs)
        return wrapper
468869
function() {
		gui.TrackerPlugin.prototype.onconstruct.call(this);
		this._handlers = Object.create(null);
		this.plugins = Object.create(null);
	}
511928
def _prepare_connection(**kwargs):
    '''
    
    '''
    pyeapi_kwargs = __salt__['config.get']('pyeapi', {})
    pyeapi_kwargs.update(kwargs)  # merge the CLI args with the opts/pillar
    init_kwargs, fun_kwargs = __utils__['args.prepare_kwargs'](pyeapi_kwargs, PYEAPI_INIT_KWARGS)
    if 'transport' not in init_kwargs:
        init_kwargs['transport'] = 'https'
    conn = pyeapi.client.connect(**init_kwargs)
    node = pyeapi.client.Node(conn, enablepwd=init_kwargs.get('enablepwd'))
    return node, fun_kwargs
856759
def call(self, methodname, *args, **kwargs):
        """"""

        for plugin in self._plugins:
            method = getattr(plugin, methodname, None)
            if method is None:
                continue
            yield method(*args, **kwargs)
136454
def register(self, plugin, name=None):
        
        plugin_name = name or self.get_canonical_name(plugin)

        if plugin_name in self._name2plugin or plugin in self._plugin2hookcallers:
            if self._name2plugin.get(plugin_name, -1) is None:
                return  # blocked plugin, return None to indicate no registration
            raise ValueError(
                "Plugin already registered: %s=%s\n%s"
                % (plugin_name, plugin, self._name2plugin)
            )

        # XXX if an error happens we should make sure no state has been
        # changed at point of return
        self._name2plugin[plugin_name] = plugin

        # register matching hook implementations of the plugin
        self._plugin2hookcallers[plugin] = hookcallers = []
        for name in dir(plugin):
            hookimpl_opts = self.parse_hookimpl_opts(plugin, name)
            if hookimpl_opts is not None:
                normalize_hookimpl_opts(hookimpl_opts)
                method = getattr(plugin, name)
                hookimpl = HookImpl(plugin, plugin_name, method, hookimpl_opts)
                hook = getattr(self.hook, name, None)
                if hook is None:
                    hook = _HookCaller(name, self._hookexec)
                    setattr(self.hook, name, hook)
                elif hook.has_spec():
                    self._verify_hook(hook, hookimpl)
                    hook._maybe_apply_history(hookimpl)
                hook._add_hookimpl(hookimpl)
                hookcallers.append(hook)
        return plugin_name
147107
def open_required(func):
        
        @functools.wraps(func)
        def wrapper(self, *args, **kwargs):
            """Wrapper function to check that the given ``JLink`` has been
            opened.

            Args:
              self (JLink): the ``JLink`` instance
              args: list of arguments to pass to the wrapped function
              kwargs: key-word arguments dict to pass to the wrapped function

            Returns:
              The return value of the wrapped function.

            Raises:
              JLinkException: if the J-Link DLL is not open or the J-Link is
                  disconnected.
            """
            if not self.opened():
                raise errors.JLinkException('J-Link DLL is not open.')
            elif not self.connected():
                raise errors.JLinkException('J-Link connection has been lost.')
            return func(self, *args, **kwargs)
        return wrapper
798110
private function startPluginTraits()
    {
        foreach ($this->getPluginTraits() as $trait) {
            if (method_exists(get_called_class(), $method = 'start' . class_basename($trait) . 'Plugin')) {
                call_user_func([ $this, $method ], $this->app);
            }
        }
    }
725462
def method_missing(method_name, *args, &block)
      config = Loquacious::Configuration.for method_name, &block
      raise Adhearsion::Configuration::ConfigurationError.new "Invalid plugin #{method_name}" if config.nil?
      config
    end
194868
def register_plugin(self, plugin):
        
        if hasattr(plugin, 'initialise'):
            plugin.initialise()
        if self.valid_api_plugin(plugin):
            log.debug("Registering API plugin: {}".format(plugin))
            self._api_plugins[plugin.request] = plugin()
        elif self.valid_debugger_plugin(plugin):
            log.debug("Registering debugger plugin: {}".format(plugin))
            self._debugger_plugins[plugin.host] = plugin()
        elif self.valid_view_plugin(plugin):
            log.debug("Registering view plugin: {}".format(plugin))
            self._view_plugins[plugin.name] = plugin()
        elif self.valid_web_plugin(plugin):
            log.debug("Registering web plugin: {}".format(plugin))
            self._web_plugins[plugin.name] = plugin()
        elif self.valid_command_plugin(plugin):
            log.debug("Registering command plugin: {}".format(plugin))
            self._command_plugins[plugin.name] = plugin()
            if voltron.debugger:
                voltron.debugger.register_command_plugin(plugin.name, plugin.command_class)
        else:
            log.debug("Ignoring invalid plugin: {}".format(plugin))
117287
def pluginkit_beforerequest():
    """"""
    authMethod = current_app.config.get("PLUGINKIT_AUTHMETHOD")
    authResult = dict(msg=None, code=1, method=authMethod)

    def authTipmsg(authResult, code=403):
        """make response message"""
        return "%s Authentication failed [%s]: %s [%s]" % (code, authResult["method"], authResult["msg"], authResult["code"])

    if authMethod == "BOOL":
        """Boolean Auth"""
        PLUGINKIT_AUTHFIELD = current_app.config.get("PLUGINKIT_AUTHFIELD")
        if PLUGINKIT_AUTHFIELD:
            if PLUGINKIT_AUTHFIELD is True:
                authResult.update(code=0)
        else:
            if hasattr(g, "signin") and g.signin is True:
                authResult.update(code=0)
        authResult.update(code=10000, msg="Invalid authentication field")

    elif authMethod == "BASIC":
        """HTTP Basic Auth"""

        #: the realm parameter is reserved for defining protection spaces and
        #: it's used by the authentication schemes to indicate a scope of protection.
        #:
        #: .. versionadded:: 1.2.0
        authRealm = current_app.config.get("PLUGINKIT_AUTHREALM") or "Flask-PluginKit Login Required"

        #: User and password configuration, format {user:pass, user:pass},
        #: if format error, all authentication failure by default.
        #:
        #: .. versionadded:: 1.2.0
        authUsers = current_app.config.get("PLUGINKIT_AUTHUSERS")

        def verify_auth(username, password):
            """Check the user and password"""
            if isinstance(authUsers, dict) and username in authUsers:
                return password == authUsers[username]
            return False

        def not_authenticated():
            """Sends a 401 response that enables basic auth"""
            return Response(authTipmsg(authResult, 401), 401,
                            {'WWW-Authenticate': 'Basic realm="%s"' % authRealm})

        #: Intercepts authentication and denies access if it fails
        auth = request.authorization
        if not auth or not verify_auth(auth.username, auth.password):
            authResult.update(code=10001, msg="Invalid username or password")
            return not_authenticated()
        else:
            authResult.update(code=0)

    else:
        authResult.update(code=0, msg="No authentication required", method=None)

    #: return response if code != 0
    if authResult["code"] != 0:
        return make_response(authTipmsg(authResult)), 403

    #: get all plugins based flask-pluginkit
    if hasattr(current_app, "extensions") and "pluginkit" in current_app.extensions:
        g.plugin_manager = current_app.extensions["pluginkit"]
        g.plugins = g.plugin_manager.get_all_plugins
953898
def call_plugins(plugins, method, *arg, **kw):
    
    for plug in plugins:
        func = getattr(plug, method, None)
        if func is None:
            continue
        #LOG.debug("call plugin %s: %s", plug.name, method)
        result = func(*arg, **kw)
        if result is not None:
            return result
    return None
1263808
function (data, method, path) {
        self.status('plugin-data', {
          plugin: pluginName,
          data: data,
          method: method,
          path: path
        });
      }
664660
def register_auth_method(self, auth_method):
        
        if not self._loaded:
            raise PluginManagerNotLoadedException()
        self._user_manager.register_auth_method(auth_method)
968547
def db_access_point(func):
    
    @wraps(func)
    def wrapper(self, *args, **kwargs):
        """
        Wrapper responsible for handling
        sessions
        """
        session = self.session_handler.get_session()
        try:
            resp = func(self, session, *args, **kwargs)
        except Exception as exc:
            self.session_handler.handle_session(session, exc=exc)
            raise exc
        else:
            self.session_handler.handle_session(session)
            return resp
    return wrapper
130525
def activate(name):
    
    if name in plugins:
        plugins[name].activate()
    else:
        raise Exception("plugin {} not found".format(name))
898001
def register_plugin(self, name, plugin):
        
        if self.has_plugin(name):
            self.release_plugin(name)
        self._active_plugins[name] = plugin
        setattr(self, name, plugin)
        return plugin
875976
def conn_has_method(conn, method_name):
    '''
    
    '''
    if method_name in dir(conn):
        return True

    log.error('Method \'%s\' not yet supported!', method_name)
    return False