• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java CloudSpace类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.cloudfoundry.client.lib.domain.CloudSpace的典型用法代码示例。如果您正苦于以下问题:Java CloudSpace类的具体用法?Java CloudSpace怎么用?Java CloudSpace使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CloudSpace类属于org.cloudfoundry.client.lib.domain包,在下文中一共展示了CloudSpace类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getSpacesBoundToSecurityGroup

import org.cloudfoundry.client.lib.domain.CloudSpace; //导入依赖的package包/类
@Override
public List<CloudSpace> getSpacesBoundToSecurityGroup(String securityGroupName) {
    Map<String, Object> urlVars = new HashMap<String, Object>();
    // Need to go a few levels out to get the Organization that Spaces needs
    String urlPath = "/v2/security_groups?q=name:{name}&inline-relations-depth=2";
    urlVars.put("name", securityGroupName);
    List<Map<String, Object>> resourceList = getAllResources(urlPath, urlVars);
    List<CloudSpace> spaces = new ArrayList<CloudSpace>();
    if (resourceList.size() > 0) {
        Map<String, Object> resource = resourceList.get(0);

        Map<String, Object> securityGroupResource = CloudEntityResourceMapper.getEntity(resource);
        List<Map<String, Object>> spaceResources = CloudEntityResourceMapper.getEmbeddedResourceList(securityGroupResource, "spaces");
        for (Map<String, Object> spaceResource : spaceResources) {
            spaces.add(resourceMapper.mapResource(spaceResource, CloudSpace.class));
        }
    } else {
        throw new CloudFoundryException(HttpStatus.NOT_FOUND, "Not Found", "Security group '" + securityGroupName + "' not found.");
    }
    return spaces;
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:22,代码来源:CloudControllerClientImpl.java


示例2: saveToken

import org.cloudfoundry.client.lib.domain.CloudSpace; //导入依赖的package包/类
public void saveToken(URI target, OAuth2AccessToken token, CloudInfo cloudInfo, CloudSpace space) {
    TargetInfos targetInfos = getTokensFromFile();

    if (targetInfos == null) {
        targetInfos = new TargetInfos();
    }

    HashMap<String, String> targetInfo = targetInfos.get(target);

    if (targetInfo == null) {
        targetInfo = new LinkedHashMap<String, String>();
    }

    targetInfos.putToken(targetInfo, token);
    targetInfos.putRefreshToken(targetInfo, token.getRefreshToken());
    targetInfos.putVersion(targetInfo, cloudInfo.getVersion());
    targetInfos.putSpace(targetInfo, space.getMeta().getGuid().toString());
    targetInfos.putOrganization(targetInfo, space.getOrganization().getMeta().getGuid().toString());

    targetInfos.put(target, targetInfo);

    saveTokensToFile(targetInfos);
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:24,代码来源:TokensFile.java


示例3: createGetAndDeleteSpaceOnCurrentOrg

import org.cloudfoundry.client.lib.domain.CloudSpace; //导入依赖的package包/类
@Test
public void createGetAndDeleteSpaceOnCurrentOrg() throws Exception {
    String spaceName = "dummy space";
    CloudSpace newSpace = connectedClient.getSpace(spaceName);
    assertNull("Space '" + spaceName + "' should not exist before creation", newSpace);
    connectedClient.createSpace(spaceName);
    newSpace = connectedClient.getSpace(spaceName);
    assertNotNull("newSpace should not be null", newSpace);
    assertEquals(spaceName, newSpace.getName());
    boolean foundSpaceInCurrentOrg = false;
    for (CloudSpace aSpace : connectedClient.getSpaces()) {
        if (spaceName.equals(aSpace.getName())) {
            foundSpaceInCurrentOrg = true;
        }
    }
    assertTrue(foundSpaceInCurrentOrg);
    connectedClient.deleteSpace(spaceName);
    CloudSpace deletedSpace = connectedClient.getSpace(spaceName);
    assertNull("Space '" + spaceName + "' should not exist after deletion", deletedSpace);

}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:22,代码来源:CloudFoundryClientTest.java


示例4: attemptToFindSpace

import org.cloudfoundry.client.lib.domain.CloudSpace; //导入依赖的package包/类
private CloudSpace attemptToFindSpace(String spaceId) {
    try {
        return new SpaceGetterFactory().createSpaceGetter().getSpace(client, spaceId);
    } catch (CloudFoundryException e) {
        // From our point of view 403 means the same as 404 - the user does not have access to a space, so it is like it does not exist
        // for him.
        if (e.getStatusCode().equals(HttpStatus.FORBIDDEN)) {
            LOGGER.debug(MessageFormat.format("The user does not have access to space with ID {0}!", spaceId));
            return null;
        }
        if (e.getStatusCode().equals(HttpStatus.NOT_FOUND)) {
            LOGGER.debug(MessageFormat.format("Space with ID {0} does not exist!", spaceId));
            return null;
        }
        throw e;
    }
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:18,代码来源:ClientHelper.java


示例5: setUpMocks

import org.cloudfoundry.client.lib.domain.CloudSpace; //导入依赖的package包/类
private void setUpMocks() {
    DefaultOAuth2AccessToken accessToken = new DefaultOAuth2AccessToken("testTokenValue");
    accessToken.setScope(new HashSet<>());
    CloudSpace space = new CloudSpace(null, SPACE, new CloudOrganization(null, ORG));
    List<CloudSpace> spaces = new ArrayList<>();
    if (hasAccess) {
        spaces.add(space);
    }

    userInfo = new UserInfo(USER_ID, USERNAME, accessToken);
    List<String> spaceDevelopersList = new ArrayList<>();
    if (hasPermissions) {
        spaceDevelopersList.add(USER_ID);
    }
    when(client.getSpaces()).thenReturn(spaces);
    when(client.getSpaceDevelopers2(ORG, SPACE)).thenReturn(spaceDevelopersList);
    when(clientProvider.getCloudFoundryClient(userInfo.getToken())).thenReturn(client);
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:19,代码来源:AuthorizationUtilTest.java


示例6: getCloudFoundryClientAsAdmin

import org.cloudfoundry.client.lib.domain.CloudSpace; //导入依赖的package包/类
@Bean(name = "cloudFoundryClientAsAdmin")
public CloudFoundryClient getCloudFoundryClientAsAdmin() throws MalformedURLException {
    if (this.cfAdminUser == null
            || this.cfAdminUser.isEmpty()
            || this.cfAdminPassword == null
            || this.cfAdminPassword.isEmpty()
            || this.cloudControllerUrl == null
            || this.cloudControllerUrl.isEmpty()
            || this.noCloudFoundryAccess) {
        return null;
    }
    CloudOrganization cloudOrganization = this.getOrg();
    CloudSpace cloudSpace = this.getSpace();
    if (cloudOrganization == null || cloudSpace == null) {
        return null;
    }
    logger.info(String.format("Creating new CloudFoundry client using admin access with org '%s' and space '%s'", cloudOrganization.getName(), cloudSpace.getName()));
    return cloudFoundryClientFactory.createCloudFoundryClient(this.cfAdminUser, this.cfAdminPassword, this.cloudControllerUrl, cloudOrganization.getName(), cloudSpace.getName());
}
 
开发者ID:cloudfoundry-community,项目名称:oauth-register-broker,代码行数:20,代码来源:AppConfig.java


示例7: getCloudFoundryClientAsAdmin

import org.cloudfoundry.client.lib.domain.CloudSpace; //导入依赖的package包/类
@Bean(name = "cloudFoundryClientAsAdmin")
public CloudFoundryClient getCloudFoundryClientAsAdmin() throws MalformedURLException {
    if (this.cfAdminUser == null
            || this.cfAdminUser.isEmpty()
            || this.cfAdminPassword == null
            || this.cfAdminPassword.isEmpty()
            || this.cloudControllerUrl == null
            || this.cloudControllerUrl.isEmpty()
            || this.noCloudFoundryAccess) {
        return null;
    }
    CloudOrganization cloudOrganization = this.getOrg();
    CloudSpace cloudSpace = this.getSpace();
    if (cloudOrganization == null || cloudSpace == null) {
        return null;
    }
    logger.debug(String.format("Creating new CloudFoundry client using admin access with org '%s' and space '%s'", cloudOrganization.getName(), cloudSpace.getName()));
    return cloudFoundryClientFactory.createCloudFoundryClient(this.cfAdminUser, this.cfAdminPassword, this.cloudControllerUrl, cloudOrganization.getName(), cloudSpace.getName());
}
 
开发者ID:orange-cloudfoundry,项目名称:db-dumper-service,代码行数:20,代码来源:AppConfig.java


示例8: setCloudSpace

import org.cloudfoundry.client.lib.domain.CloudSpace; //导入依赖的package包/类
protected void setCloudSpace(CloudFoundryServer cloudServer, String orgName, String spaceName)
		throws CoreException {
	CloudOrgsAndSpaces spaces = CFUiUtil.getCloudSpaces(cloudServer, cloudServer.getUsername(),
			cloudServer.getPassword(), cloudServer.getUrl(), false, cloudServer.isSelfSigned(), null, false,
			null, null);
	Assert.isTrue(spaces != null, "Failed to resolve orgs and spaces.");
	Assert.isTrue(spaces.getDefaultCloudSpace() != null,
			"No default space selected in cloud space lookup handler.");

	CloudSpace cloudSpace = spaces.getSpace(orgName, spaceName);
	if (cloudSpace == null) {
		throw CloudErrorUtil.toCoreException(
				"Failed to resolve cloud space when running junits: " + orgName + " - " + spaceName);
	}
	cloudServer.setSpace(cloudSpace);
}
 
开发者ID:eclipse,项目名称:cft,代码行数:17,代码来源:CloudFoundryTestFixture.java


示例9: validateCurrent

import org.cloudfoundry.client.lib.domain.CloudSpace; //导入依赖的package包/类
protected IStatus validateCurrent(CloudSpace currentSpace) {
	int severity = IStatus.OK;
	String validationMessage = Messages.VALID_ACCOUNT;
	CloudSpacesDescriptor descriptor = getCurrentSpacesDescriptor();
	if (descriptor == null || descriptor.getOrgsAndSpaces() == null) {
		validationMessage = Messages.ERROR_CHECK_CONNECTION_NO_SPACES;
		severity = IStatus.ERROR;
	}
	else if (getSpaceWithNoServerInstance() == null) {
		validationMessage = Messages.ERROR_ALL_SPACES_ASSOCIATED_SERVER_INSTANCES;
		severity = IStatus.ERROR;
	}
	else {
		return validateSpaceSelection(currentSpace);
	}
	return CloudFoundryPlugin.getStatus(validationMessage, severity);
}
 
开发者ID:eclipse,项目名称:cft,代码行数:18,代码来源:CloudSpacesDelegate.java


示例10: CloneServerPage

import org.cloudfoundry.client.lib.domain.CloudSpace; //导入依赖的package包/类
CloneServerPage(CloudFoundryServer server) {
	super(server, null);

	cloudServerSpaceDelegate = new CloudSpacesDelegate(cloudServer) {

		@Override
		public void setSelectedSpace(CloudSpace selectedCloudSpace) {

			CloneServerPage.this.selectedSpace = selectedCloudSpace;
			CloneServerPage.this.setServerNameInUI(getSuggestedServerName(selectedCloudSpace));
		}

		@Override
		protected CloudSpace getCurrentCloudSpace() {
			return selectedSpace;
		}
	};
}
 
开发者ID:eclipse,项目名称:cft,代码行数:19,代码来源:CloneServerPage.java


示例11: getSuggestedServerName

import org.cloudfoundry.client.lib.domain.CloudSpace; //导入依赖的package包/类
protected String getSuggestedServerName(CloudSpace selectedCloudSpace) {

		if (selectedCloudSpace == null) {
			return null;
		}

		String suggestedName = selectedCloudSpace.getName();

		int i = 1;

		while (nameExists(suggestedName)) {
			int openParIndex = suggestedName.indexOf('(');
			int closeParIndex = suggestedName.indexOf(')');
			if (openParIndex > 0 && closeParIndex > openParIndex) {
				suggestedName = suggestedName.substring(0, openParIndex).trim();
			}
			suggestedName += " (" + i++ + ")"; //$NON-NLS-1$ //$NON-NLS-2$
		}
		return suggestedName;
	}
 
开发者ID:eclipse,项目名称:cft,代码行数:21,代码来源:CloneServerPage.java


示例12: setValues

import org.cloudfoundry.client.lib.domain.CloudSpace; //导入依赖的package包/类
protected void setValues() {
	orgIDtoSpaces = new HashMap<String, List<CloudSpace>>();
	orgIDtoOrg = new HashMap<String, CloudOrganization>();
	// Parse the orgs and restructure the spaces per org for quick lookup,
	// as the original list of spaces is flat and does
	// not convey the org -> spaces structure.
	for (CloudSpace clSpace : originalSpaces) {
		CloudOrganization org = clSpace.getOrganization();
		List<CloudSpace> spaces = orgIDtoSpaces.get(org.getName());
		if (spaces == null) {
			spaces = new ArrayList<CloudSpace>();
			orgIDtoSpaces.put(org.getName(), spaces);
			orgIDtoOrg.put(org.getName(), org);
		}

		spaces.add(clSpace);
	}
}
 
开发者ID:eclipse,项目名称:cft,代码行数:19,代码来源:CloudOrgsAndSpaces.java


示例13: CFClientV1Support

import org.cloudfoundry.client.lib.domain.CloudSpace; //导入依赖的package包/类
public CFClientV1Support(CloudFoundryOperations cfClient, CloudSpace existingSessionConnection, CFInfo cloudInfo,
		HttpProxyConfiguration httpProxyConfiguration, CloudFoundryServer cfServer, boolean trustSelfSigned) {
	this.cloudInfo = cloudInfo;
	this.oauth = getHeaderProvider(cfClient);
	this.existingSessionConnection = existingSessionConnection;

	this.restTemplate = RestUtils.createRestTemplate(httpProxyConfiguration, trustSelfSigned, true);
	ClientHttpRequestFactory requestFactory = restTemplate.getRequestFactory();
	restTemplate.setRequestFactory(authorize(requestFactory));

	this.tokenUrl = cloudInfo.getTokenUrl();
	
	this.authorizationUrl = cloudInfo.getAuthorizationUrl();
	
	this.cfServer = cfServer;
}
 
开发者ID:eclipse,项目名称:cft,代码行数:17,代码来源:CFClientV1Support.java


示例14: setSpace

import org.cloudfoundry.client.lib.domain.CloudSpace; //导入依赖的package包/类
public void setSpace(CloudSpace space) {

		secureStoreDirty = true;

		if (space != null) {
			this.cloudSpace = new CloudFoundrySpace(space);
			internalSetOrg(cloudSpace.getOrgName());
			internalSetSpace(cloudSpace.getSpaceName());
		}
		else {
			// Otherwise clear the org and space
			internalSetOrg(null);
			internalSetSpace(null);
			cloudSpace = null;
		}

		updateServerId();
	}
 
开发者ID:eclipse,项目名称:cft,代码行数:19,代码来源:CloudFoundryServer.java


示例15: getCloudFoundryOperations

import org.cloudfoundry.client.lib.domain.CloudSpace; //导入依赖的package包/类
public CloudFoundryOperations getCloudFoundryOperations(CloudCredentials credentials, URL url, CloudSpace session,
		boolean selfSigned) {

	// Proxies are always updated on each client call by the
	// CloudFoundryServerBehaviour Request as well as the client login
	// handler
	// therefore it is not critical to set the proxy in the client on
	// client
	// creation

	HttpProxyConfiguration proxyConfiguration = getProxy(url);
	//@ TODO tentatively set selfSigned = true
	selfSigned = true;
	return session != null ? new CloudFoundryClient(credentials, url, session, selfSigned)
			: new CloudFoundryClient(credentials, url, proxyConfiguration, selfSigned);
}
 
开发者ID:osswangxining,项目名称:dockerfoundry,代码行数:17,代码来源:DockerFoundryClientFactory.java


示例16: getSpaces

import org.cloudfoundry.client.lib.domain.CloudSpace; //导入依赖的package包/类
public List<CloudSpace> getSpaces() {
	List<CloudSpace> spaces = new ArrayList<CloudSpace>();
	String urlPath = API_BASE+"/spaces?inline-relations-depth=1";
	try {
		List<JSONObject> jspaces = ResponseObject.getResources(urlPath, token);
		for (JSONObject jspace : jspaces) {
			JSONObject entity = jspace.getJSONObject(ENTITY);
			Meta meta = new Meta(jspace.getJSONObject(METADATA));
			JSONObject orgEntity = entity.getJSONObject("organization");
			CloudOrganization org = new CloudOrganization(orgEntity.getJSONObject(METADATA),
					orgEntity.getJSONObject(ENTITY));
			CloudSpace space = new CloudSpace(meta,entity.getString("name"),org);
			spaces.add(space);
		}

	} 
	catch (Throwable e) {
		e.printStackTrace();
	} 
	return spaces;
}
 
开发者ID:stephen-kruger,项目名称:cloudfoundry-liteclient-lib,代码行数:22,代码来源:CloudFoundryClient.java


示例17: CloudControllerClientImpl

import org.cloudfoundry.client.lib.domain.CloudSpace; //导入依赖的package包/类
public CloudControllerClientImpl(URL cloudControllerUrl, RestTemplate restTemplate, OauthClient oauthClient,
    LoggregatorClient loggregatorClient, CloudCredentials cloudCredentials, CloudSpace sessionSpace) {
    logger = LogFactory.getLog(getClass().getName());

    initialize(cloudControllerUrl, restTemplate, oauthClient, loggregatorClient, cloudCredentials);

    this.sessionSpace = sessionSpace;
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:9,代码来源:CloudControllerClientImpl.java


示例18: getSpace

import org.cloudfoundry.client.lib.domain.CloudSpace; //导入依赖的package包/类
@Override
public CloudSpace getSpace(String spaceName, boolean required) {
    Map<String, Object> resource = findSpaceResource(spaceName);
    CloudSpace space = null;
    if (resource != null) {
        space = resourceMapper.mapResource(resource, CloudSpace.class);
    }
    if (space == null && required) {
        throw new CloudFoundryException(HttpStatus.NOT_FOUND, "Not Found", "Space '" + spaceName + "' not found.");
    }
    return space;
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:13,代码来源:CloudControllerClientImpl.java


示例19: getSpaces

import org.cloudfoundry.client.lib.domain.CloudSpace; //导入依赖的package包/类
@Override
public List<CloudSpace> getSpaces() {
    String urlPath = "/v2/spaces?inline-relations-depth=1";
    List<Map<String, Object>> resourceList = getAllResources(urlPath);
    List<CloudSpace> spaces = new ArrayList<CloudSpace>();
    for (Map<String, Object> resource : resourceList) {
        spaces.add(resourceMapper.mapResource(resource, CloudSpace.class));
    }
    return spaces;
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:11,代码来源:CloudControllerClientImpl.java


示例20: validateSpaceAndOrg

import org.cloudfoundry.client.lib.domain.CloudSpace; //导入依赖的package包/类
private CloudSpace validateSpaceAndOrg(String spaceName, String orgName, CloudControllerClientImpl client) {
    List<CloudSpace> spaces = client.getSpaces();

    for (CloudSpace space : spaces) {
        if (space.getName().equals(spaceName)) {
            CloudOrganization org = space.getOrganization();
            if (orgName == null || org.getName().equals(orgName)) {
                return space;
            }
        }
    }

    throw new IllegalArgumentException("No matching organization and space found for org: " + orgName + " space: " + "" + spaceName);
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:15,代码来源:CloudControllerClientImpl.java



注:本文中的org.cloudfoundry.client.lib.domain.CloudSpace类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ASN1SetParser类代码示例发布时间:2022-05-23
下一篇:
Java ReceiverBase类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap