Returns the application instance for the given id.
@param applicationId The application id
@param instanceId The application instance id
@return The application instance
779595
public Optional<ApplicationInstance> show(long applicationId, long instanceId)
    {
        return HTTP.GET(String.format("/v2/applications/%d/instances/%d.json", applicationId, instanceId), APPLICATION_INSTANCE);
    }
862617
protected function getInstanceConfig($instanceId = 0)
    {
        /** @var \Rcm\Service\PluginManager $pluginManager */
        $pluginManager = $this->getServiceLocator()->get(
            'Rcm\Service\PluginManager'
        );

        $instanceConfig = [];

        $pluginName = $this->getRcmPluginName();

        if ($instanceId > 0) {
            try {
                $instanceConfig = $pluginManager->getInstanceConfig($instanceId);
            } catch (PluginInstanceNotFoundException $e) {
                // ignore error
            }
        }

        if (empty($instanceConfig)) {
            $instanceConfig = $pluginManager->getDefaultInstanceConfig(
                $pluginName
            );
        }

        return $instanceConfig;
    }
45149
func (scope *Scope) InstanceID() string {
	if scope.instanceID == "" {
		scope.instanceID = fmt.Sprintf("%v%v", &scope, &scope.db)
	}
	return scope.instanceID
}
818836
func (m *MockMachine) InstanceId() (instance.Id, error) {
	ret := m.ctrl.Call(m, "InstanceId")
	ret0, _ := ret[0].(instance.Id)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}
1100370
public static RequestContext create(String projectId, String instanceId, String appProfileId) {
    return new AutoValue_RequestContext(projectId, instanceId, appProfileId);
  }
821112
public static Object getBean(String id) {
        ApplicationContext appContext = getAppContext();
        return appContext == null ? null : appContext.containsBean(id) ? appContext.getBean(id) : null;
    }
28156
public SipApplicationSession getApplicationSessionById(String applicationSessionId, boolean isContainerManaged) {
		if(logger.isDebugEnabled()) {
			logger.debug("getApplicationSessionById - applicationSessionId=" + applicationSessionId);
		}
		if(applicationSessionId == null) {
			throw new NullPointerException("the given id is null !");
		}
		SipApplicationSessionKey applicationSessionKey;
		try {
			applicationSessionKey = SessionManagerUtil.parseSipApplicationSessionKey(applicationSessionId);
		} catch (ParseException e) {
			logger.error("the given application session id : " + applicationSessionId + 
					" couldn't be parsed correctly ",e);
			return null;
		}
		if(applicationSessionKey.getApplicationName().equals(sipContext.getApplicationName())) {
			MobicentsSipApplicationSession sipApplicationSession = sipContext.getSipManager().getSipApplicationSession(applicationSessionKey, false);
			if(sipApplicationSession == null) {
				return null;
			} else {
				// make sure to acquire this app session and add it to the set of app sessions we monitor in the context of the application
				// to release them all when we exit application code
				sipContext.enterSipApp(sipApplicationSession, null, true, isContainerManaged);
				return sipApplicationSession.getFacade();
			}
		} else {
			logger.warn("the given application session id : " + applicationSessionId + 
					" tried to be retrieved from incorret application " + sipContext.getApplicationName());
			return null;
		}
	}
572834
public ApplicationField getField(int appId, int fieldId) {
		return getResourceFactory().getApiResource(
				"/app/" + appId + "/field/" + fieldId).get(
				ApplicationField.class);
	}
1042649
public Optional<MobileApplication> show(long applicationId)
    {
        return HTTP.GET(String.format("/v2/mobile_applications/%d.json", applicationId), MOBILE_APPLICATION);
    }
1296699
public Optional<BrowserApplication> show(long applicationId)
    {
        QueryParameterList queryParams = new QueryParameterList();
        queryParams.add("filter[ids]", new Long(applicationId));
        return Optional.of(HTTP.GET("/v2/browser_applications.json", null, queryParams, BROWSER_APPLICATIONS).get().iterator().next());
    }
1067063
public function getCredentialsByApplicationId($applicationId)
    {
        return $this->createCommand()
            ->setRequest(
                $this->client->get(Url::factory('application')->setQuery(array('applicationId' => $applicationId)))
            )
            ->setResponseClass('Maba\OAuthCommerceInternalClient\Entity\ApplicationPassword[]')
        ;
    }
627533
public static AVIMClient getInstance(String clientId) {
    if (StringUtil.isEmpty(clientId)) {
      return null;
    }
    AVIMClient client = clients.get(clientId);
    if (null == client) {
      client = new AVIMClient(clientId);
      AVIMClient elderClient = clients.putIfAbsent(clientId, client);
      if (null != elderClient) {
        client = elderClient;
      }
    }
    return client;
  }
799902
public List<Database> listDatabases(String instanceId) {
    // [START listDatabases]
    Page<Database> page = dbAdminClient.listDatabases(instanceId, Options.pageSize(1));
    List<Database> dbs = new ArrayList<>();
    while (page != null) {
      Database db = Iterables.getOnlyElement(page.getValues());
      dbs.add(db);
      page = page.getNextPage();
    }
    // [END listDatabases]
    return dbs;
  }
1295580
@VisibleForTesting
	@Nullable
	public Instance getInstance(ResourceID resourceId) {
		for (Instance instance : allInstances) {
			if (Objects.equals(resourceId, instance.getTaskManagerID())) {
				return instance;
			}
		}
		return null;
	}
259414
public static ApplicationRequest createApplicationRequest(String applicationName) {
		ApplicationRequest applicationRequest = new ApplicationRequest();
		applicationRequest.setApplicationName(applicationName);

		return applicationRequest;
	}
514995
@GetMapping(path = "/instances/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
    public Mono<ResponseEntity<Instance>> instance(@PathVariable String id) {
        LOGGER.debug("Deliver registered instance with ID '{}'", id);
        return registry.getInstance(InstanceId.of(id))
                       .filter(Instance::isRegistered)
                       .map(ResponseEntity::ok)
                       .defaultIfEmpty(ResponseEntity.notFound().build());
    }
438259
@Override
	public List<Instance> listChildrenInstances( String applicationName, String instancePath, boolean allChildren ) {

		List<Instance> result = new ArrayList<> ();
		Application app = this.manager.applicationMngr().findApplicationByName( applicationName );

		// Log
		if( instancePath == null )
			this.logger.fine( "Request: list " + (allChildren ? "all" : "root") + " instances for " + applicationName + "." );
		else
			this.logger.fine( "Request: list " + (allChildren ? "all" : "direct") + " children instances for " + instancePath + " in " + applicationName + "." );

		// Find the instances
		Instance inst;
		if( app != null ) {
			if( instancePath == null ) {
				if( allChildren )
					result.addAll( InstanceHelpers.getAllInstances( app ));
				else
					result.addAll( app.getRootInstances());
			}

			else if(( inst = InstanceHelpers.findInstanceByPath( app, instancePath )) != null ) {
				if( allChildren ) {
					result.addAll( InstanceHelpers.buildHierarchicalList( inst ));
					result.remove( inst );
				} else {
					result.addAll( inst.getChildren());
				}
			}
		}

		// Bug #64: sort instance paths for the clients
		Collections.sort( result, new InstanceComparator());
		return result;
	}