Netflix specific impl so we can load from eureka.
@param appName
@return
@throws IOException
330182
private Map<ServerGroup, EVCacheServerGroupConfig> bootstrapFromEureka(String appName) throws IOException {
        
        if(env == null || region == null) return Collections.<ServerGroup, EVCacheServerGroupConfig> emptyMap();
        
        final String url = "http://discoveryreadonly." + region + ".dyn" + env + ".netflix.net:7001/v2/apps/" + appName;
        final CloseableHttpClient httpclient = HttpClients.createDefault();
        final long start = System.currentTimeMillis();
        CloseableHttpResponse httpResponse = null;
        try {
            final RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout).build();
            HttpGet httpGet = new HttpGet(url);
            httpGet.addHeader("Accept", "application/json");
            httpGet.setConfig(requestConfig);
            httpResponse = httpclient.execute(httpGet);
            final int statusCode = httpResponse.getStatusLine().getStatusCode();
            if (!(statusCode >= 200 && statusCode < 300)) {
                log.error("Status Code : " + statusCode + " for url " + url);
                return Collections.<ServerGroup, EVCacheServerGroupConfig> emptyMap();
            }
            
            final InputStreamReader in = new InputStreamReader(httpResponse.getEntity().getContent(), Charset.defaultCharset());
            final JSONTokener js = new JSONTokener(in);
            final JSONObject jsonObj = new JSONObject(js);
            final JSONObject application = jsonObj.getJSONObject("application");
            final JSONArray instances = application.getJSONArray("instance");
            final Map<ServerGroup, EVCacheServerGroupConfig> serverGroupMap = new HashMap<ServerGroup, EVCacheServerGroupConfig>();
            final ChainedDynamicProperty.BooleanProperty useBatchPort = EVCacheConfig.getInstance().getChainedBooleanProperty(appName + ".use.batch.port", "evcache.use.batch.port", Boolean.FALSE, null);
            for(int i = 0; i < instances.length(); i++) {
                final JSONObject instanceObj = instances.getJSONObject(i);
                final JSONObject metadataObj = instanceObj.getJSONObject("dataCenterInfo").getJSONObject("metadata");

                final String asgName = instanceObj.getString("asgName");
                final DynamicBooleanProperty asgEnabled = EVCacheConfig.getInstance().getDynamicBooleanProperty(asgName + ".enabled", true);
                if (!asgEnabled.get()) {
                    if(log.isDebugEnabled()) log.debug("ASG " + asgName + " is disabled so ignoring it");
                    continue;
                }
                
                final String zone = metadataObj.getString("availability-zone");
                final ServerGroup rSet = new ServerGroup(zone, asgName);
                final String localIp = metadataObj.getString("local-ipv4");
                final JSONObject instanceMetadataObj = instanceObj.getJSONObject("metadata");
                final String evcachePortString = instanceMetadataObj.optString("evcache.port", "11211");
                final String rendPortString = instanceMetadataObj.optString("rend.port", "0");
                final String rendBatchPortString = instanceMetadataObj.optString("rend.batch.port", "0");
                final int rendPort = Integer.parseInt(rendPortString);
                final int rendBatchPort = Integer.parseInt(rendBatchPortString);
                final String rendMemcachedPortString = instanceMetadataObj.optString("rend.memcached.port", "0");
                final String rendMementoPortString = instanceMetadataObj.optString("rend.memento.port", "0");
                final int evcachePort = Integer.parseInt(evcachePortString);
                final int port = rendPort == 0 ? evcachePort : ((useBatchPort.get().booleanValue()) ? rendBatchPort : rendPort);

                EVCacheServerGroupConfig config = serverGroupMap.get(rSet);
                if(config == null) {
                    config = new EVCacheServerGroupConfig(rSet, new HashSet<InetSocketAddress>(), Integer.parseInt(rendPortString), 
                            Integer.parseInt(rendMemcachedPortString), Integer.parseInt(rendMementoPortString));
                    serverGroupMap.put(rSet, config);
//                    final ArrayList<Tag> tags = new ArrayList<Tag>(2);
//                    tags.add(new BasicTag(EVCacheMetricsFactory.CACHE, appName));
//                    tags.add(new BasicTag(EVCacheMetricsFactory.SERVERGROUP, rSet.getName()));
//                    EVCacheMetricsFactory.getInstance().getLongGauge(EVCacheMetricsFactory.CONFIG, tags).set(Long.valueOf(port));
                }

                final InetAddress add = InetAddresses.forString(localIp);
                final InetAddress inetAddress = InetAddress.getByAddress(localIp, add.getAddress());
                final InetSocketAddress address = new InetSocketAddress(inetAddress, port);
                config.getInetSocketAddress().add(address);
            }
            if (log.isDebugEnabled()) log.debug("Returning : " + serverGroupMap);
            return serverGroupMap;
        } catch (Exception e) {
            if (log.isDebugEnabled()) log.debug("URL : " + url + "; Timeout " + timeout, e);
        } finally {
            if (httpResponse != null) {
                try {
                    httpResponse.close();
                } catch (IOException e) {

                }
            }
            if (log.isDebugEnabled()) log.debug("Total Time to execute " + url + " " + (System.currentTimeMillis() - start) + " msec.");
        }
        return Collections.<ServerGroup, EVCacheServerGroupConfig> emptyMap();
    }
951288
@Programmatic
    public ApplicationTenancy findByNameCached(final String name) {
        return queryResultsCache.execute(new Callable<ApplicationTenancy>() {
            @Override
            public ApplicationTenancy call() throws Exception {
                return findByName(name);
            }
        }, ApplicationTenancyRepository.class, "findByNameCached", name);
    }
1269101
def app_view(name, **kwargs):
    
    ctx = Context(**kwargs)
    ctx.execute_action('app:view', **{
        'storage': ctx.repo.create_secure_service('storage'),
        'name': name,
    })
981726
@GwtIncompatible("java.io.File")
  public static VariableMap load(String filename) throws IOException {
    try {
      return fromBytes(Files.toByteArray(new File(filename)));
    } catch (ParseException e) {
      // Wrap parse exception for backwards compatibility.
      throw new IOException(e);
    }
  }
162518
public final void setApplicationName(String applicationName) {
        synchronized (lock) {
            if (applicationName == null) {
                serviceProperties.remove(APPLICATION_NAME);
                bundleAnalysingComponentInstantiationListener = null;
            } else {
                serviceProperties.put(APPLICATION_NAME, applicationName);
                bundleAnalysingComponentInstantiationListener =
                    new BundleAnalysingComponentInstantiationListener(bundleContext, injectionSource, factoryTracker);
            }

            if (serviceRegistration != null) {
                serviceRegistration.setProperties(serviceProperties);
            }
        }
    }
597544
public SubscriptionBuilder subscription(String applicationName, Set<String> eventNames) throws IOException {
        return new SubscriptionBuilder(this, applicationName, eventNames);
    }
765274
public void cancel(final String appName, final String id) throws Exception {
        long expiryTime = System.currentTimeMillis() + maxProcessingDelayMs;
        batchingDispatcher.process(
                taskId("cancel", appName, id),
                new InstanceReplicationTask(targetHost, Action.Cancel, appName, id) {
                    @Override
                    public EurekaHttpResponse<Void> execute() {
                        return replicationClient.cancel(appName, id);
                    }

                    @Override
                    public void handleFailure(int statusCode, Object responseEntity) throws Throwable {
                        super.handleFailure(statusCode, responseEntity);
                        if (statusCode == 404) {
                            logger.warn("{}: missing entry.", getTaskName());
                        }
                    }
                },
                expiryTime
        );
    }
1246286
@Override
	public Response bindApplication( String applicationName, String externalExportPrefix, String boundApp ) {

		this.logger.fine( "Binding " + boundApp  + " to the " + externalExportPrefix + " prefix in application " + applicationName + "." );
		String lang = lang( this.manager );
		Response response;
		try {
			ManagedApplication ma = this.manager.applicationMngr().findManagedApplicationByName( applicationName );
			if( ma == null ) {
				response = handleError(
						Status.NOT_FOUND,
						new RestError( REST_INEXISTING, application( applicationName )),
						lang ).build();

			} else {
				this.manager.applicationMngr().bindOrUnbindApplication( ma, externalExportPrefix, boundApp, true );
				response = Response.ok().build();
			}

		} catch( UnauthorizedActionException | IOException e ) {
			response = RestServicesUtils.handleError(
					Status.FORBIDDEN,
					new RestError( ErrorCode.REST_UNDETAILED_ERROR, e ),
					lang ).build();
		}

		return response;
	}
35839
public static appflowpolicylabel get(nitro_service service, String labelname) throws Exception{
		appflowpolicylabel obj = new appflowpolicylabel();
		obj.set_labelname(labelname);
		appflowpolicylabel response = (appflowpolicylabel) obj.get_resource(service);
		return response;
	}
370552
public ListAppStreamsResponse listAppStreams(String app) {
        ListAppStreamsRequest request = new ListAppStreamsRequest();
        request.setApp(app);
        return listAppStreams(request);
    }
714725
public static <T> AttributeKey<T> appScoped() {
        return new AttributeKey<T>() {
            public T get(HttpServletRequest req) {
                return (T) getContext(req).getAttribute(name);
            }

            public void set(HttpServletRequest req, T value) {
                getContext(req).setAttribute(name, value);
            }

            public void remove(HttpServletRequest req) {
                getContext(req).removeAttribute(name);
            }

            private ServletContext getContext(HttpServletRequest req) {
                return ((StaplerRequest)req).getServletContext();
            }
        };
    }
1230963
function viewAppByName(appName, callback, success) {
  jitsu.apps.view(appName, function (err, app) {
    return err ? callback(err) : success(null, app);
  });
}
702144
public void bindWithApplication( String externalExportPrefix, String applicationName ) {

		Set<String> bounds = this.applicationBindings.get( externalExportPrefix );
		if( bounds == null ) {
			bounds = new LinkedHashSet<> ();
			this.applicationBindings.put( externalExportPrefix, bounds );
		}

		bounds.add( applicationName );
	}
88329
public Release getReleaseInfo(String appName, String releaseName) {
        return connection.execute(new ReleaseInfo(appName, releaseName), apiKey);
    }
845469
public static appfwpolicylabel_appfwpolicy_binding[] get(nitro_service service, String labelname) throws Exception{
		appfwpolicylabel_appfwpolicy_binding obj = new appfwpolicylabel_appfwpolicy_binding();
		obj.set_labelname(labelname);
		appfwpolicylabel_appfwpolicy_binding response[] = (appfwpolicylabel_appfwpolicy_binding[]) obj.get_resources(service);
		return response;
	}
711304
@Programmatic
    public ApplicationRole findByNameCached(final String name) {
        return queryResultsCache.execute(new Callable<ApplicationRole>() {
            @Override public ApplicationRole call() throws Exception {
                return findByName(name);
            }
        }, ApplicationRoleRepository.class, "findByNameCached", name);
    }
781618
public static void loadBeerSample(CouchbaseMock mock) throws IOException {
        InputStream iss = CouchbaseMock.class.getClassLoader().getResourceAsStream("views/beer-sample.serialized.xz");
        DocumentLoader.loadFromSerializedXZ(iss, "beer-sample", mock);
    }