Convenient method to lookup storageService of the application
@param restClient
@param applicationName
@return storage service name
962709
private static String lookupStorageServiceByApp(RESTClient restClient, String applicationName) {
        Utils.require(applicationName != null, "Missing application name");
        if (applicationName != null) {
            ApplicationDefinition appDef =  Command.getAppDef(restClient, applicationName);
            Utils.require(appDef != null, "Unknown application: %s", applicationName);
            return appDef.getStorageService();
        }
        return null;
    }
44527
private MBeanServer getServerForName(String name) {
        try {
            MBeanServer mbeanServer = null;
            final ObjectName objectNameQuery = new ObjectName(name + ":type=Service,*");

            for (final MBeanServer server : MBeanServerFactory.findMBeanServer(null)) {
                if (server.queryNames(objectNameQuery, null).size() > 0) {
                    mbeanServer = server;
                    // we found it, bail out
                    break;
                }
            }

            return mbeanServer;
        } catch (Exception e) {
        }

        return null;
    }
672714
public Service getService(String name) {
        Service service = store.get(name);
        if (service == null) {
            throw HttpException.notFound("Service not found for name '" + name + "'");
        }
        return service;
    }
1009559
public ArrayList<String> cdn_webstorage_serviceName_storage_GET(String serviceName, OvhOrderStorageEnum storage) throws IOException {
		String qPath = "/order/cdn/webstorage/{serviceName}/storage";
		StringBuilder sb = path(qPath, serviceName);
		query(sb, "storage", storage);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, t1);
	}
1106097
def get_esri_service_name(url):
    
    result = re.search('rest/services/(.*)/[MapServer|ImageServer]', url)
    if result is None:
        return url
    else:
        return result.group(1)
328742
private static ManagedRestService buildRestService(Atomix atomix, Namespace namespace) {
    final String httpHost = namespace.getString("http_host");
    final Integer httpPort = namespace.getInt("http_port");
    return RestService.builder()
        .withAtomix(atomix)
        .withAddress(Address.from(httpHost, httpPort))
        .build();
  }
784746
public static Container findContainerByIdOrByName( String name, DockerClient dockerClient ) {

		Container result = null;
		List<Container> containers = dockerClient.listContainersCmd().withShowAll( true ).exec();
		for( Container container : containers ) {
			List<String> names = Arrays.asList( container.getNames());

			// Docker containers are prefixed with '/'.
			// At least, those we created, since their parent is the Docker daemon.
			if( container.getId().equals( name )
					|| names.contains( "/" + name )) {
				result = container;
				break;
			}
		}

		return result;
	}
1000348
public static ObjectName createApplicationObjectName(String name, String serverName) {
        Hashtable<String, String> props = new Hashtable<String, String>();
        props.put(TYPE_SERVER, serverName);
        return createObjectName(TYPE_APPLICATION, name, props);
    }
863893
public AppIdentity getAppIdentity(final String applicationName) {
		if (isCached(applicationName)) {
			return applicationIdentityCache.get(applicationName).getAppIdentity();

		} else {
			// Update environment detail with new configured application name
			final EnvironmentDetail updatedEnvDetail =
				updateEnvironmentDetail(defaultApiConfig.getEnvDetail(), applicationName);

			// use existing apiConfig, with new application name
			final ApiConfiguration updatedApiConfig = defaultApiConfig.toBuilder()
				.application(applicationName)
				.envDetail(updatedEnvDetail)
				.build();

			return getAppIdentity(updatedApiConfig);
		}
	}
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));
    }
464064
public List<Application> getAppsOnSpace(int spaceId) {
		return getResourceFactory().getApiResource(
				"/app/space/" + spaceId + "/").get(
				new GenericType<List<Application>>() {
				});
	}
926211
public Object service(String name) {
        Object service = this.services.get(name);
        if (service == null) {
            throw new IllegalArgumentException("Service '" + name + "' not found");
        }
        return service; 
    }
43764
private StorageService verifyStorageServiceOption(ApplicationDefinition currAppDef, ApplicationDefinition appDef) {
        // Verify or assign StorageService
        String ssName = getStorageServiceOption(appDef);
        StorageService storageService = getStorageService(appDef);
        Utils.require(storageService != null, "StorageService is unknown or hasn't been initialized: %s", ssName);
        
        // Currently, StorageService can't be changed.
        if (currAppDef != null) {
            String currSSName = getStorageServiceOption(currAppDef);
            Utils.require(currSSName.equals(ssName), "'StorageService' cannot be changed for application: %s", appDef.getAppName());
        }
        return storageService;
    }
866825
private StorageObject getObject(StorageResourceId resourceId)
      throws IOException {
    logger.atFine().log("getObject(%s)", resourceId);
    Preconditions.checkArgument(
        resourceId.isStorageObject(), "Expected full StorageObject id, got %s", resourceId);
    String bucketName = resourceId.getBucketName();
    String objectName = resourceId.getObjectName();
    Storage.Objects.Get getObject =
        configureRequest(gcs.objects().get(bucketName, objectName), bucketName);
    try {
      return getObject.execute();
    } catch (IOException e) {
      if (errorExtractor.itemNotFound(e)) {
        logger.atFine().withCause(e).log("getObject(%s): not found", resourceId);
        return null;
      }
      throw new IOException("Error accessing " + resourceId, e);
    }
  }
538045
public synchronized Name getServiceName() {
        if (size() < 2) {
            return null;
        }
        if (cachedServiceName == null) {
            cachedServiceName = getCompositeKey().getPrefix(size() - 1);
        }
        return cachedServiceName;
    }
840858
@Override
	public Response resynchronize( String applicationName ) {

		this.logger.fine( "Request: resynchronize all the agents." );
		String lang = lang( this.manager );
		Response response = Response.ok().build();
		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.instancesMngr().resynchronizeAgents( ma );

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

		return response;
	}
1360682
def get_application_by_name(self, team_name, application_name):
        
        return self._request('GET', 'rest/applications/' + str(team_name) + '/lookup?name=' + str(application_name))