Package brooklyn.location

Examples of brooklyn.location.Location


       
        List<Entity> dockerHosts = dockerInfrastructure.getDockerHostList();
        DockerHost dockerHost = (DockerHost) Iterables.getOnlyElement(dockerHosts);

        LocationDefinition infraLocDef = findLocationMatchingName("dynamicdockertest.*");
        Location infraLoc = managementContext.getLocationRegistry().resolve(infraLocDef);
        assertTrue(infraLoc instanceof DockerLocation, "loc="+infraLoc);

        LocationDefinition hostLocDef = findLocationMatchingName(dockerInfrastructure.getDynamicLocation().getId() + "-" + dockerHost
                .getDockerHostName() + ".*");
        Location hostLoc = managementContext.getLocationRegistry().resolve(hostLocDef);
        assertTrue(hostLoc instanceof DockerHostLocation, "loc=" + hostLoc);
    }
View Full Code Here


        }
        String locationSpec = String.format(DockerResolver.DOCKER_INFRASTRUCTURE_SPEC, getId()) + String.format(":(name=\"%s\")", locationName);
        setAttribute(LOCATION_SPEC, locationSpec);

        final LocationDefinition definition = new BasicLocationDefinition(locationName, locationSpec, flags);
        Location location = getManagementContext().getLocationRegistry().resolve(definition);
        getManagementContext().getLocationRegistry().updateDefinedLocation(definition);
        getManagementContext().getLocationManager().manage(location);

        getManagementContext().addPropertiesReloadListener(new ManagementContext.PropertiesReloadListener() {
            @Override
            public void reloaded() {
                if (started.get()) {
                    Location resolved = getManagementContext().getLocationRegistry().resolve(definition);
                    getManagementContext().getLocationRegistry().updateDefinedLocation(definition);
                    getManagementContext().getLocationManager().manage(resolved);
                }
            }
        });
View Full Code Here

    public void start(Collection<? extends Location> locations) {
        if (started.compareAndSet(false, true)) {
            // TODO support multiple locations
            setAttribute(SERVICE_UP, Boolean.FALSE);

            Location provisioner = Iterables.getOnlyElement(locations);
            LOG.info("Creating new DockerLocation wrapping {}", provisioner);

            Map<String, ?> flags = MutableMap.<String, Object>builder()
                    .putAll(getConfig(LOCATION_FLAGS))
                    .put("provisioner", provisioner)
View Full Code Here

        String locationSpec = String.format(DockerResolver.DOCKER_HOST_MACHINE_SPEC, infrastructure.getId(), getId()) + String.format(":(name=\"%s\")", locationName);
        setAttribute(LOCATION_SPEC, locationSpec);

        final LocationDefinition definition = new BasicLocationDefinition(locationName, locationSpec, flags);
        Location location = getManagementContext().getLocationRegistry().resolve(definition);
        setAttribute(DYNAMIC_LOCATION, location);
        setAttribute(LOCATION_NAME, location.getId());

        if (getConfig(DockerInfrastructure.REGISTER_DOCKER_HOST_LOCATIONS)) {
            getManagementContext().getLocationRegistry().updateDefinedLocation(definition);
        }
        getManagementContext().getLocationManager().manage(location);

        getManagementContext().addPropertiesReloadListener(new ManagementContext.PropertiesReloadListener() {
            @Override
            public void reloaded() {
                if (getInfrastructure().isLocationAvailable()) {
                    Location resolved = getManagementContext().getLocationRegistry().resolve(definition);
                    if (getConfig(DockerInfrastructure.REGISTER_DOCKER_HOST_LOCATIONS)) {
                        getManagementContext().getLocationRegistry().updateDefinedLocation(definition);
                    }
                    getManagementContext().getLocationManager().manage(resolved);
                }
View Full Code Here

TOP

Related Classes of brooklyn.location.Location

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.