Helper method that implements the logic to look up an
        application.
321444
def get_app(self, reference_app=None):
        """"""

        if reference_app is not None:
            return reference_app

        if current_app:
            return current_app._get_current_object()

        if self.app is not None:
            return self.app

        raise RuntimeError(
            'No application found. Either work inside a view function or push'
            ' an application context. See'
            ' http://flask-sqlalchemy.pocoo.org/contexts/.'
        )
186128
public static Collection<TemplateEntry> findTemplatesForApplication( String appName, Collection<TemplateEntry> templates ) {

		final Collection<TemplateEntry> result = new ArrayList<> ();
		for( TemplateEntry te : templates ) {
			// TE.appName == null => OK. It applies to this application.
			// TE.appName == appName => OK. It also applies.
			if( te.getAppName() == null || te.getAppName().equals( appName ))
				result.add( te );
		}

		return result;
	}
645614
def _can_process_application(self, app):
        
        return (self.LOCATION_KEY in app.properties and
                isinstance(app.properties[self.LOCATION_KEY], dict) and
                self.APPLICATION_ID_KEY in app.properties[self.LOCATION_KEY] and
                self.SEMANTIC_VERSION_KEY in app.properties[self.LOCATION_KEY])
36956
public Optional<Application> show(long applicationId)
    {
        return HTTP.GET(String.format("/v2/applications/%d.json", applicationId), APPLICATION);
    }
796105
function findAppPath() {
    if (oars._appPath) return oars._appPath;

    var cwd = process.cwd();
    var argv = process.argv;

    var index = _.findIndex(argv, function(value) {
      return _.startsWith(value, cwd);
    });

    if (index === -1) {
      return cwd;
    } else {
      return path.dirname(argv[index]);
    }
  }
1130617
public void addToApplications(final Application application) {
		if (null == getApplications()) {
			setApplications(new java.util.TreeSet<Application>());
		}
		getApplications().add(application);
	}
684148
function App() {
    require('colors');

    /**
     * All of the developer defined middlewares.
     *
     * @var {Array}
     * @protected
     */
    this.__middlewares = [];

    /**
     * The filter instance
     * @var {Object}
     */
    this.filter;

    /**
     * The list of loaded service providers.
     *
     * @var {Object}
     * @protected
     */
    this.__loadedProviders = {};

    /**
     * Indicates if the application has "booted".
     *
     * @var {Boolean}
     * @protected
     */
    this.__booted = false;

    /**
     * The array of booting callbacks.
     *
     * @var {Array}
     * @protected
     */
    this.__bootingCallbacks = [];

    /**
     * The array of booted callbacks.
     *
     * @var {Array}
     * @protected
     */
    this.__bootedCallbacks = [];

    /**
     * Node HTTP server reference.
     *
     * @var {Object}
     * @protected
     */
    this.__server;

    /**
     * The application locals object.
     *
     * @var {Object}
     */
    this.locals = {};

    /**
     * Aliases for internal Positron module
     *
     * @type {Object}
     * @protected
     */
    this.__aliases = {};

    var self = this;

    /**
     * Run the application and send the response.
     *
     * @param  request
     * @param  response
     * @return {void}
     */
    this.run = function (request, response) {
        var reqDomain = domain.create();

        reqDomain
            .on('error', self.handleError.bind(self, request, response))
            .run(function () {
                self.__getStackedClient().handle(request, response);
            });
    };

}
1357623
def find_apps(name=None, name_mode='exact', category=None,
              all_versions=None, published=None,
              billed_to=None, created_by=None, developer=None,
              created_after=None, created_before=None,
              modified_after=None, modified_before=None,
              describe=False, limit=None, return_handler=False, first_page_size=100, **kwargs):
    
    return find_global_executables(dxpy.api.system_find_apps,
                                   name=name, name_mode=name_mode, category=category,
                                   all_versions=all_versions, published=published,
                                   billed_to=billed_to, created_by=created_by, developer=developer,
                                   created_after=created_after, created_before=created_before,
                                   modified_after=modified_after, modified_before=modified_before,
                                   describe=describe, limit=limit, return_handler=return_handler,
                                   first_page_size=first_page_size, **kwargs)
899061
private ApplicationDefinition getApplicationDefinition(Tenant tenant, String appName) {
        Iterator<DColumn> colIter =
            DBService.instance(tenant).getAllColumns(SchemaService.APPS_STORE_NAME, appName).iterator();
        if (!colIter.hasNext()) {
            return null;
        }
        return loadAppRow(tenant, getColumnMap(colIter));
    }
1344203
@Override
	public HashMap<String, Object> getApplicationMap() {
		return (HashMap<String, Object>) JKThreadLocal.getValue(JKContextConstants.APPLICATION_MAP);
	}
360733
def retrieve(cls, *args, **kwargs):
        """"""
        return super(ApplicationFeeRefund, cls).retrieve(*args, **kwargs)
1242758
def _validate_applications(self, apps):
		""""""
		for application_id, application_config in apps.items():
			self._validate_config(application_id, application_config)

			application_config["APPLICATION_ID"] = application_id
564737
public String findDestinationByName(String application,
                                        String module,
                                        String link)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.entry(tc, "findDestinationByName : " + application + ":" +
                         module + ":" + link);

        String boundToJndiName = null;

        Map<String, Map<String, String>> appMap = ivMessageDestinationLinks.get(application);

        // if not null check
        if (appMap == null)
        {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                Tr.exit(tc, "findDestinationByName : application not found");
            return null;
        }

        int lindex = link.indexOf('#');
        if (lindex != -1)
        {
            String moduleName = null;
            // Module name may have path information... remove it.          d510405
            int mindex = link.lastIndexOf('/');
            if (mindex > -1 && mindex < lindex)
            {
                moduleName = link.substring(mindex + 1, lindex);
            }
            else
            {
                // If no path was specified, then the referenced module
                // is in the same location. Use first half of the link.
                moduleName = link.substring(0, lindex);
            }
            String newLink = link.substring(lindex + 1);

            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                Tr.debug(tc, "looking for module : " + moduleName);
            Map<String, String> moduleMap = appMap.get(moduleName);
            if (moduleMap != null)
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    Tr.debug(tc, "looking for link : " + newLink);
                boundToJndiName = moduleMap.get(newLink);
            }
        }
        else
        {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                Tr.debug(tc, "looking for module : " + module);
            Map<String, String> moduleMap = appMap.get(module);
            if (moduleMap != null)
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    Tr.debug(tc, "looking for link : " + link);
                boundToJndiName = moduleMap.get(link);
            }

            // If the link was not found in the current module, loop through
            // all the modules in the application
            if (boundToJndiName == null)
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    Tr.debug(tc, "not in specified module, looking in all modules");

                for (Map<String, String> curModuleMap : appMap.values())
                {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                        Tr.debug(tc, "looking for link : " + link);
                    boundToJndiName = curModuleMap.get(link);
                    if (boundToJndiName != null)
                    {
                        break;
                    }
                }
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.exit(tc, "findDestinationByName : " + boundToJndiName);

        return boundToJndiName;
    }
1369383
function getView(app, view) {
    if (typeof view !== 'string') {
      return view;
    }
    if (app.isCollection) {
      view = app.getView(view);

    } else if (app.isList) {
      view = app.getItem(view);

    } else {
      view = findView(app, view);
    }
    return view;
  }
37810
public GetAppResponse queryApp(String app) {
        GetAppRequest request = new GetAppRequest();
        request.setApp(app);
        return queryApp(request);
    }
357114
def bind(cls, app, *paths, methods=None, name=None, router=None, view=None):
        """"""
        cls.app = app
        if cls.app is not None:
            for _, m in inspect.getmembers(cls, predicate=inspect.isfunction):
                if not hasattr(m, ROUTE_PARAMS_ATTR):
                    continue
                paths_, methods_, name_ = getattr(m, ROUTE_PARAMS_ATTR)
                name_ = name_ or ("%s.%s" % (cls.name, m.__name__))
                delattr(m, ROUTE_PARAMS_ATTR)
                cls.app.register(*paths_, methods=methods_, name=name_, handler=cls)(m)

        @coroutine
        @functools.wraps(cls)
        def handler(request):
            return cls().dispatch(request, view=view)

        if not paths:
            paths = ["/%s" % cls.__name__]

        return routes_register(
            app, handler, *paths, methods=methods, router=router, name=name or cls.name)
643189
private ApplicationDefinition checkApplicationKey(ApplicationDefinition appDef) {
        Tenant tenant = Tenant.getTenant(appDef);
        ApplicationDefinition currAppDef = getApplication(tenant, appDef.getAppName());
        if (currAppDef == null) {
            m_logger.info("Defining application: {}", appDef.getAppName());
        } else {
            m_logger.info("Updating application: {}", appDef.getAppName());
            String appKey = currAppDef.getKey();
            Utils.require(Utils.isEmpty(appKey) || appKey.equals(appDef.getKey()),
                          "Application key cannot be changed: %s", appDef.getKey());
        }
        return currAppDef;
    }