当前位置: 首页>>代码示例>>Java>>正文


Java CloudRoute类代码示例

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


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

示例1: deleteOrphanedRoutes

import org.cloudfoundry.client.lib.domain.CloudRoute; //导入依赖的package包/类
/**
 * Delete routes that do not have any application which is assigned to them.
 *
 * @return deleted routes or an empty list if no routes have been found
 */
@Override
public List<CloudRoute> deleteOrphanedRoutes() {
    List<CloudRoute> orphanRoutes = new ArrayList<>();
    for (CloudDomain cloudDomain : getDomainsForOrg()) {
        orphanRoutes.addAll(fetchOrphanRoutes(cloudDomain.getName()));
    }

    List<CloudRoute> deletedCloudRoutes = new ArrayList<>();
    for (CloudRoute orphanRoute : orphanRoutes) {
        deleteRoute(orphanRoute.getHost(), orphanRoute.getDomain().getName());
        deletedCloudRoutes.add(orphanRoute);
    }

    return deletedCloudRoutes;
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:21,代码来源:CloudControllerClientImpl.java

示例2: doGetRoutes

import org.cloudfoundry.client.lib.domain.CloudRoute; //导入依赖的package包/类
private List<CloudRoute> doGetRoutes(UUID domainGuid) {
    Map<String, Object> urlVars = new HashMap<String, Object>();
    String urlPath = "/v2";
    // TODO: NOT implemented ATM:
    // if (sessionSpace != null) {
    // urlVars.put("space", sessionSpace.getMeta().getGuid());
    // urlPath = urlPath + "/spaces/{space}";
    // }
    urlPath = urlPath + "/routes?inline-relations-depth=1";
    List<Map<String, Object>> allRoutes = getAllResources(urlPath, urlVars);
    List<CloudRoute> routes = new ArrayList<CloudRoute>();
    for (Map<String, Object> route : allRoutes) {
        // TODO: move space_guid to path once implemented (see above):
        UUID space = CloudEntityResourceMapper.getEntityAttribute(route, "space_guid", UUID.class);
        UUID domain = CloudEntityResourceMapper.getEntityAttribute(route, "domain_guid", UUID.class);
        if (sessionSpace.getMeta().getGuid().equals(space) && domainGuid.equals(domain)) {
            // routes.add(CloudEntityResourceMapper.getEntityAttribute(route, "host", String.class));
            routes.add(resourceMapper.mapResource(route, CloudRoute.class));
        }
    }
    return routes;
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:23,代码来源:CloudControllerClientImpl.java

示例3: addAndDeleteRoute

import org.cloudfoundry.client.lib.domain.CloudRoute; //导入依赖的package包/类
@Test
public void addAndDeleteRoute() {
    connectedClient.addDomain(TEST_DOMAIN);
    connectedClient.addRoute("my_route1", TEST_DOMAIN);
    connectedClient.addRoute("my_route2", TEST_DOMAIN);

    List<CloudRoute> routes = connectedClient.getRoutes(TEST_DOMAIN);
    assertNotNull(getRouteWithHost("my_route1", routes));
    assertNotNull(getRouteWithHost("my_route2", routes));

    connectedClient.deleteRoute("my_route2", TEST_DOMAIN);
    routes = connectedClient.getRoutes(TEST_DOMAIN);
    assertNotNull(getRouteWithHost("my_route1", routes));
    assertNull(getRouteWithHost("my_route2", routes));

    // test that removing domain that has routes throws exception
    try {
        connectedClient.deleteDomain(TEST_DOMAIN);
        fail("should have thrown exception");
    } catch (IllegalStateException ex) {
        assertTrue(ex.getMessage().contains("in use"));
    }
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:24,代码来源:CloudFoundryClientTest.java

示例4: appsWithRoutesAreCounted

import org.cloudfoundry.client.lib.domain.CloudRoute; //导入依赖的package包/类
@Test
public void appsWithRoutesAreCounted() throws IOException {
    String appName = namespacedAppName("my_route3");
    CloudApplication app = createAndUploadSimpleTestApp(appName);
    List<String> uris = app.getUris();
    uris.add("my_route3." + TEST_DOMAIN);
    connectedClient.addDomain(TEST_DOMAIN);
    connectedClient.updateApplicationUris(appName, uris);

    List<CloudRoute> routes = connectedClient.getRoutes(TEST_DOMAIN);
    assertNotNull(getRouteWithHost("my_route3", routes));
    assertEquals(1, getRouteWithHost("my_route3", routes).getAppsUsingRoute());
    assertTrue(getRouteWithHost("my_route3", routes).inUse());

    List<CloudRoute> defaultDomainRoutes = connectedClient.getRoutes(defaultDomainName);
    assertNotNull(getRouteWithHost(appName, defaultDomainRoutes));
    assertEquals(1, getRouteWithHost(appName, defaultDomainRoutes).getAppsUsingRoute());
    assertTrue(getRouteWithHost(appName, defaultDomainRoutes).inUse());
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:20,代码来源:CloudFoundryClientTest.java

示例5: deleteOrphanedRoutes

import org.cloudfoundry.client.lib.domain.CloudRoute; //导入依赖的package包/类
@Test
public void deleteOrphanedRoutes() {
    connectedClient.addDomain(TEST_DOMAIN);
    connectedClient.addRoute("unbound_route", TEST_DOMAIN);

    List<CloudRoute> routes = connectedClient.getRoutes(TEST_DOMAIN);
    CloudRoute unboundRoute = getRouteWithHost("unbound_route", routes);
    assertNotNull(unboundRoute);
    assertEquals(0, unboundRoute.getAppsUsingRoute());

    List<CloudRoute> deletedRoutes = connectedClient.deleteOrphanedRoutes();
    assertNull(getRouteWithHost("unbound_route", connectedClient.getRoutes(TEST_DOMAIN)));

    assertTrue(deletedRoutes.size() > 0);
    boolean found = false;
    for (CloudRoute route : deletedRoutes) {
        if (route.getHost().equals("unbound_route")) {
            found = true;
        }
    }
    assertTrue(found);
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:23,代码来源:CloudFoundryClientTest.java

示例6: getColumnText

import org.cloudfoundry.client.lib.domain.CloudRoute; //导入依赖的package包/类
public String getColumnText(Object element, int columnIndex) {
	String result = null;

	TableColumn column = viewer.getTable().getColumn(columnIndex);
	if (column != null) {
		switch (columnIndex) {
		case 0:
			result = getText(element);
			break;
		case 1:
			if (element instanceof CloudRoute) {
				result = ((CloudRoute) element).getDomain().getName();
			}
			break;
		case 2:
			if (element instanceof CloudRoute && ((CloudRoute) element).inUse()) {
				return IN_USE;
			}
			break;
		}

	}
	return result;
}
 
开发者ID:eclipse,项目名称:cft,代码行数:25,代码来源:CloudRoutePart.java

示例7: remove

import org.cloudfoundry.client.lib.domain.CloudRoute; //导入依赖的package包/类
/**
 * 
 * @param updatedToRemove elements to remove. Passing a null or empty list
 * will clear the list of items to remove.
 */
protected void remove(List<?> updatedToRemove) {

	// If no change, then do nothing to avoid firing change events
	if (routesToRemove.equals(updatedToRemove)) {
		return;
	}

	routesToRemove.clear();

	if (updatedToRemove != null) {
		for (Object obj : updatedToRemove) {
			if (obj instanceof CloudRoute) {
				CloudRoute route = (CloudRoute) obj;
				if (!routesToRemove.contains(route)) {
					routesToRemove.add(route);
				}
			}
		}
	}

	notifyChange(new PartChangeEvent(routesToRemove, Status.OK_STATUS, ROUTES_REMOVED));

	refreshAll();

}
 
开发者ID:eclipse,项目名称:cft,代码行数:31,代码来源:CloudRoutePart.java

示例8: handleChange

import org.cloudfoundry.client.lib.domain.CloudRoute; //导入依赖的package包/类
@Override
public void handleChange(PartChangeEvent event) {

	if (event.getSource() == CloudRoutePart.ROUTES_REMOVED) {
		Object data = event.getData();
		if (data instanceof List<?>) {
			List<?> routes = (List<?>) data;
			IStatus errorInUse = null;
			for (Object obj : routes) {
				if (obj instanceof CloudRoute) {
					CloudRoute rt = (CloudRoute) obj;
					if (rt.inUse()) {
						errorInUse = CloudFoundryPlugin.getStatus(
								NLS.bind(Messages.ERROR_ROUTE_IN_USE, rt.getName()), IStatus.ERROR);
					}
				}
			}
			if (errorInUse != null) {
				event = new PartChangeEvent(event.getData(), errorInUse, event.getSource());
			}

		}

	}
	super.handleChange(event);
}
 
开发者ID:eclipse,项目名称:cft,代码行数:27,代码来源:CloudRoutesWizard.java

示例9: deleteRoute

import org.cloudfoundry.client.lib.domain.CloudRoute; //导入依赖的package包/类
public BaseClientRequest<?> deleteRoute(final List<CloudRoute> routes) throws CoreException {

		if (routes == null || routes.isEmpty()) {
			return null;
		}
		return new BehaviourRequest<Void>("Deleting routes", behaviour) { //$NON-NLS-1$
			@Override
			protected Void doRun(CloudFoundryOperations client, SubMonitor progress) throws CoreException {
				for (CloudRoute route : routes) {
					client.deleteRoute(route.getHost(), route.getDomain().getName());
				}
				return null;

			}
		};
	}
 
开发者ID:eclipse,项目名称:cft,代码行数:17,代码来源:ClientRequestFactory.java

示例10: getRoutes

import org.cloudfoundry.client.lib.domain.CloudRoute; //导入依赖的package包/类
/**
	 * Retrieves the orgs and spaces for the current server instance.
	 * @param monitor
	 * @return
	 * @throws CoreException if it failed to retrieve the orgs and spaces.
	 */
//	public CloudOrgsAndSpaces getCloudSpaces(IProgressMonitor monitor) throws CoreException {
//		return new BehaviourRequest<CloudOrgsAndSpaces>("Getting orgs and spaces") { //$NON-NLS-1$
//
//			@Override
//			protected CloudOrgsAndSpaces doRun(DockerClient client, SubMonitor progress) throws CoreException {
//				// return internalGetCloudSpaces(client);
//				return null;
//			}
//
//		}.run(monitor);
//	}

	public List<CloudRoute> getRoutes(final String domainName, IProgressMonitor monitor) throws CoreException {

		List<CloudRoute> routes = new BehaviourRequest<List<CloudRoute>>(NLS.bind(Messages.ROUTES, domainName)) {
			@Override
			protected List<CloudRoute> doRun(DockerClient client, SubMonitor progress) throws CoreException {
				// return client.getRoutes(domainName);
				return null;
			}
		}.run(monitor);

		return routes;
	}
 
开发者ID:osswangxining,项目名称:dockerfoundry,代码行数:31,代码来源:DockerFoundryServerBehaviour.java

示例11: deleteRoute

import org.cloudfoundry.client.lib.domain.CloudRoute; //导入依赖的package包/类
public void deleteRoute(final List<CloudRoute> routes, IProgressMonitor monitor) throws CoreException {

		if (routes == null || routes.isEmpty()) {
			return;
		}
		new BehaviourRequest<Void>("Deleting routes") { //$NON-NLS-1$
			@Override
			protected Void doRun(DockerClient client, SubMonitor progress) throws CoreException {
				for (CloudRoute route : routes) {
					// client.deleteRoute(route.getHost(),
					// route.getDomain().getName());
				}
				return null;

			}
		}.run(monitor);
	}
 
开发者ID:osswangxining,项目名称:dockerfoundry,代码行数:18,代码来源:DockerFoundryServerBehaviour.java

示例12: getRoutes

import org.cloudfoundry.client.lib.domain.CloudRoute; //导入依赖的package包/类
public List<CloudRoute> getRoutes(String domainName) {
	UUID domainGuid = getDomainGuid(domainName, true);
	String urlPath = API_BASE+"/routes?inline-relations-depth=1";
	List<CloudRoute> routes = new ArrayList<CloudRoute>();
	// tbd


	//		for (Map<String, Object> route : allRoutes) {
	////			TODO: move space_guid to path once implemented (see above):
	//			UUID space = CloudEntityResourceMapper.getEntityAttribute(route, "space_guid", UUID.class);
	//			UUID domain = CloudEntityResourceMapper.getEntityAttribute(route, "domain_guid", UUID.class);
	//			if (sessionSpace.getMeta().getGuid().equals(space) && domainGuid.equals(domain)) {
	//				//routes.add(CloudEntityResourceMapper.getEntityAttribute(route, "host", String.class));
	//				routes.add(resourceMapper.mapResource(route, CloudRoute.class));
	//			}
	//		}
	log.severe(NYI+" "+urlPath+" "+domainGuid);
	return routes;
}
 
开发者ID:stephen-kruger,项目名称:cloudfoundry-liteclient-lib,代码行数:20,代码来源:CloudFoundryClient.java

示例13: addAndDeleteRoute

import org.cloudfoundry.client.lib.domain.CloudRoute; //导入依赖的package包/类
@Test
public void addAndDeleteRoute() throws CloudFoundryException {
	connectedClient.addDomain(TEST_DOMAIN);
	connectedClient.addRoute("my_route1", TEST_DOMAIN);
	connectedClient.addRoute("my_route2", TEST_DOMAIN);

	List<CloudRoute> routes = connectedClient.getRoutes(TEST_DOMAIN);
	assertNotNull(getRouteWithHost("my_route1", routes));
	assertNotNull(getRouteWithHost("my_route2", routes));

	connectedClient.deleteRoute("my_route2", TEST_DOMAIN);
	routes = connectedClient.getRoutes(TEST_DOMAIN);
	assertNotNull(getRouteWithHost("my_route1", routes));
	assertNull(getRouteWithHost("my_route2", routes));

	// test that removing domain that has routes throws exception
	try {
		connectedClient.deleteDomain(TEST_DOMAIN);
		fail("should have thrown exception");
	}
	catch (IllegalStateException ex) {
		assertTrue(ex.getMessage().contains("in use"));
	}
}
 
开发者ID:stephen-kruger,项目名称:cloudfoundry-liteclient-lib,代码行数:25,代码来源:CloudFoundryClientTest.java

示例14: appsWithRoutesAreCounted

import org.cloudfoundry.client.lib.domain.CloudRoute; //导入依赖的package包/类
@Test
public void appsWithRoutesAreCounted() throws IOException, CloudFoundryException {
	String appName = namespacedAppName("my_route3");
	CloudApplication app = createAndUploadSimpleTestApp(appName);
	List<String> uris = app.getUris();
	uris.add("my_route3." + TEST_DOMAIN);
	connectedClient.addDomain(TEST_DOMAIN);
	connectedClient.updateApplicationUris(appName, uris);

	List<CloudRoute> routes = connectedClient.getRoutes(TEST_DOMAIN);
	assertNotNull(getRouteWithHost("my_route3", routes));
	assertEquals(1, getRouteWithHost("my_route3", routes).getAppsUsingRoute());
	assertTrue(getRouteWithHost("my_route3", routes).inUse());

	List<CloudRoute> defaultDomainRoutes = connectedClient.getRoutes(defaultDomainName);
	assertNotNull(getRouteWithHost(appName, defaultDomainRoutes));
	assertEquals(1, getRouteWithHost(appName, defaultDomainRoutes).getAppsUsingRoute());
	assertTrue(getRouteWithHost(appName, defaultDomainRoutes).inUse());
}
 
开发者ID:stephen-kruger,项目名称:cloudfoundry-liteclient-lib,代码行数:20,代码来源:CloudFoundryClientTest.java

示例15: deleteDomain

import org.cloudfoundry.client.lib.domain.CloudRoute; //导入依赖的package包/类
@Override
public void deleteDomain(String domainName) {
    assertSpaceProvided("delete domain");
    UUID domainGuid = getDomainGuid(domainName, true);
    List<CloudRoute> routes = getRoutes(domainName);
    if (routes.size() > 0) {
        throw new IllegalStateException("Unable to remove domain that is in use --" + " it has " + routes.size() + " routes.");
    }
    doDeleteDomain(domainGuid);
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:11,代码来源:CloudControllerClientImpl.java


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