Connect to the service object on DBus, return InterfaceProxy.
358561
async def connect_service(bus_name, object_path, interface):
    """"""
    proxy = await proxy_new_for_bus(
        Gio.BusType.SYSTEM,
        Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES |
        Gio.DBusProxyFlags.DO_NOT_CONNECT_SIGNALS,
        info=None,
        name=bus_name,
        object_path=object_path,
        interface_name=interface,
    )
    return InterfaceProxy(proxy)
1372236
@SuppressWarnings("unchecked")
    public static <T> T createProxyObject(Class<T> interfaceType, Object implementObject) {
        return (T) Proxy.newProxyInstance(
                implementObject.getClass().getClassLoader(),
                implementObject.getClass().getInterfaces(),
                new InvokeInterceptor(implementObject)
        );

    }
490191
protected void connectServiceUpIsRunning() {
        serviceProcessIsRunning = FunctionFeed.builder()
                .entity(this)
                .period(Duration.FIVE_SECONDS)
                .poll(new FunctionPollConfig<Boolean, Boolean>(SERVICE_PROCESS_IS_RUNNING)
                        .onException(Functions.constant(Boolean.FALSE))
                        .callable(new Callable<Boolean>() {
                            public Boolean call() {
                                return getDriver().isRunning();
                            }
                        }))
                .build();
    }
1030726
def connect(self, object, callback):
		""""""
		def signal_fired(sender, object, iface, signal, params):
			callback(*params)
		return object._bus.subscribe(sender=object._bus_name, object=object._path, iface=self._iface_name, signal=self.__name__, signal_fired=signal_fired)
799586
public Database get_db_obj(final DeviceProxy deviceProxy) throws DevFailed {
        checkIfUseDb(deviceProxy, "get_db_obj()");
        return ApiUtil.get_db_obj(deviceProxy.url.host, deviceProxy.url.strPort);
    }
703244
def indirect(self, interface):
        
        if interface is IBoxReceiver:
            router = Router()
            connector = self.connectorFactory(router)
            router.bindRoute(connector, None).connectTo(None)
            return router
        raise NotImplementedError()
1321080
def get_conn(service='SoftLayer_Virtual_Guest'):
    '''
    
    '''
    client = SoftLayer.Client(
        username=config.get_cloud_config_value(
            'user', get_configured_provider(), __opts__, search_global=False
        ),
        api_key=config.get_cloud_config_value(
            'apikey', get_configured_provider(), __opts__, search_global=False
        ),
    )
    return client[service]
884353
def connect(self):
        """"""
        self._client = self._create_client()
        self._db = getattr(self._client, self._db_name)
        self._generic_dao = GenericDAO(self._client, self._db_name)
266989
async def create_connection(self):
        ''''''
        connector = self.proxy or self.loop
        return await connector.create_connection(
            self.session_factory, self.host, self.port, **self.kwargs)
837370
def connect(cls, resource):
        
        from azure import storage as azure_storage
        file_info = cls.parse_remote(resource)
        return azure_storage.BlobService(file_info.storage)
55739
def get_connection(self, key, host, port, user, password, dbname, ssl, connect_fct, tags, use_cached=True):
        """"""
        if key in self.dbs and use_cached:
            return self.dbs[key]

        elif host != "" and user != "":
            try:
                if host == 'localhost' and password == '':
                    # Use ident method
                    connection = connect_fct("user=%s dbname=%s" % (user, dbname))
                elif port != '':
                    connection = connect_fct(
                        host=host, port=port, user=user, password=password, database=dbname, ssl=ssl
                    )
                elif host.startswith('/'):
                    # If the hostname starts with /, it's probably a path
                    # to a UNIX socket. This is similar behaviour to psql
                    connection = connect_fct(unix_sock=host, user=user, password=password, database=dbname)
                else:
                    connection = connect_fct(host=host, user=user, password=password, database=dbname, ssl=ssl)
                self.dbs[key] = connection
                return connection
            except Exception as e:
                message = u'Error establishing postgres connection: %s' % (str(e))
                service_check_tags = self._get_service_check_tags(host, port, tags)
                self.service_check(
                    self.SERVICE_CHECK_NAME, AgentCheck.CRITICAL, tags=service_check_tags, message=message
                )
                raise
        else:
            if not host:
                raise ConfigurationError('Please specify a Postgres host to connect to.')
            elif not user:
                raise ConfigurationError('Please specify a user to connect to Postgres as.')
8948
def _connect(self):
        """"""
        cls = self._get_manager_class(register_callables=False)
        ins = cls(address=self.addr, authkey=self.authkey)
        ins.connect()
        return ins
1181582
public static <T extends VersionedProtocol> T getProxy(
      Class<T> protocol,
      long clientVersion, InetSocketAddress addr,
      Configuration conf, SocketFactory factory) throws IOException {
    return getProtocolProxy(protocol, clientVersion,
        addr, conf, factory).getProxy();
  }
1110996
def getService(self, name, auto_execute=True):
        
        if not isinstance(name, basestring):
            raise TypeError('string type required')

        return ServiceProxy(self, name, auto_execute)
5740
public static Class getProxyFactory(Class persistentClass, Class[] interfaces) throws PersistenceException
    {
        Enhancer e = new Enhancer();
        e.setSuperclass(interfaces.length == 1 ? persistentClass : null);
        e.setInterfaces(interfaces);
        e.setCallbackTypes(new Class[] { InvocationHandler.class, NoOp.class, });
        e.setCallbackFilter(FINALIZE_FILTER);
        e.setUseFactory(false);
        e.setInterceptDuringConstruction(false);
        return e.createClass();
    }
1039223
def _get_connection(self, key, host='', port='', user='', password='', database_url='', tags=None, use_cached=True):
        ""
        if key in self.dbs and use_cached:
            return self.dbs[key]
        try:
            connect_kwargs = self._get_connect_kwargs(
                host=host, port=port, user=user, password=password, database_url=database_url
            )

            connection = pg.connect(**connect_kwargs)
            connection.set_isolation_level(pg.extensions.ISOLATION_LEVEL_AUTOCOMMIT)

        # re-raise the CheckExceptions raised by _get_connect_kwargs()
        except CheckException:
            raise

        except Exception:
            redacted_url = self._get_redacted_dsn(host, port, user, database_url)
            message = u'Cannot establish connection to {}'.format(redacted_url)

            self.service_check(
                self.SERVICE_CHECK_NAME,
                AgentCheck.CRITICAL,
                tags=self._get_service_checks_tags(host, port, database_url, tags),
                message=message,
            )
            raise

        self.dbs[key] = connection
        return connection
276941
def open_interface_async(self, conn_id, interface, callback, connection_string=None):
        """"""

        future = self._loop.launch_coroutine(self._adapter.open_interface(conn_id, interface))
        future.add_done_callback(lambda x: self._callback_future(conn_id, x, callback))