Package io.fabric8.api

Examples of io.fabric8.api.Container


        Set<WorkItem> workItems = assignedWorkItems.get(context);
        if (workItems.isEmpty()) {
            return profileData;
        }

        Container current = fabricService.get().getCurrentContainer();
        Version version = current.getVersion();
        String templateProfileName = String.valueOf(context.getConfiguration().get(TEMPLATE_PROFILE_PROPERTY_NAME));
        Profile templateProfile = version.getRequiredProfile(templateProfileName);
        Set<String> allFiles = templateProfile.getFileConfigurations().keySet();
        Iterable<String> mvelFiles = Iterables.filter(allFiles, MvelPredicate.INSTANCE);
        Iterable<String> plainFiles = Iterables.filter(allFiles, Predicates.not(MvelPredicate.INSTANCE));
View Full Code Here


     * @param containerId
     * @return
     */
    public synchronized int createJolokiaPort(String containerId) {
        FabricService fabricService = getFabricService();
        Container currentContainer = fabricService.getCurrentContainer();
        Set<Integer> usedPortByHost = fabricService.getPortService().findUsedPortByHost(currentContainer);

        while (true) {
            if (externalJolokiaPort <= 0) {
                externalJolokiaPort = JolokiaAgentHelper.DEFAULT_JOLOKIA_PORT;
            } else {
                externalJolokiaPort++;
            }
            if (!usedPortByHost.contains(externalJolokiaPort)) {
                Container container = fabricService.getCurrentContainer();
                String pid = JolokiaAgentHelper.JOLOKIA_PORTS_PID;
                String key = containerId;
                fabricService.getPortService().registerPort(container, pid, key, externalJolokiaPort);
                return externalJolokiaPort;
            }
View Full Code Here

                }
            } else {
                externalPortCounter++;
            }
            if (!usedPortByHost.contains(externalPortCounter)) {
                Container container = getFabricService().getCurrentContainer();
                String pid = Constants.PORTS_PID;
                String key = containerId + "-" + portKey;
                getFabricService().getPortService().registerPort(container, pid, key, externalPortCounter);
                return externalPortCounter;
            }
View Full Code Here

            ImmutableSet<Map.Entry<String, Installation>> entries = map.entrySet();
            for (Map.Entry<String, Installation> entry : entries) {
                String id = entry.getKey();
                Installation installation = entry.getValue();
                try {
                    Container container = null;
                    try {
                        container = fabric.getContainer(id);
                    } catch (Exception e) {
                        LOG.debug("No container for id: " + id + ". " + e, e);
                    }
View Full Code Here

            ImmutableSet<Map.Entry<String, Installation>> entries = map.entrySet();
            for (Map.Entry<String, Installation> entry : entries) {
                String id = entry.getKey();
                Installation installation = entry.getValue();
                try {
                    Container container = null;
                    try {
                        container = fabric.getContainer(id);
                    } catch (Exception e) {
                        LOG.debug("No container for id: " + id + ". " + e, e);
                    }
                    if (container != null) {
                        Long pid = installation.getActivePid();
                        if (LOG.isDebugEnabled()) {
                            LOG.debug("Polling container " + id + " for its PID");
                        }
                        if (pid == null) {
                            if (container.isAlive()) {
                                container.setAlive(false);
                            }
                        } else if (pid != null && pid != 0) {
                            if (!container.isAlive()) {
                                container.setAlive(true);
                            }
                            if (!Objects.equal(container.getProvisionResult(), Container.PROVISION_SUCCESS)) {
                                container.setProvisionResult(Container.PROVISION_SUCCESS);
                            }
                            aliveIds.add(id);

                            Map<String, String> envVars = ProcessManagerController.getInstallationProxyPorts(installation);
                            List<String> newZkPaths = JolokiaAgentHelper.jolokiaKeepAliveCheck(zkMasterCache, fabric, container, envVars);
View Full Code Here

     * Replays again all events.
     */
    protected void replay() {
        // query all the mbeans and check they are all registered for the current container...
        if (mBeanServer != null) {
            Container container = getCurrentContainer();
            if (container != null) {
                ObjectName objectName = createObjectName(CXF_API_ENDPOINT_MBEAN_NAME);
                if (objectName != null && container != null) {
                    Set<ObjectInstance> instances = mBeanServer.queryMBeans(objectName, isCxfServiceEndpointQuery);
                    for (ObjectInstance instance : instances) {
View Full Code Here

        System.out.println("Welcome to " + appName);
        System.out.println("");

        // are we part of fabric?
        if (fabricService != null) {
            Container container = fabricService.getCurrentContainer();
            if (container != null) {
                boolean ensemble = container.isEnsembleServer();
                if (ensemble) {
                    System.out.println("This container \u001B[1m" + container.getId() + "\u001B[0m is a Fabric ensemble server.");
                } else {
                    System.out.println("This container \u001B[1m" + container.getId() + "\u001B[0m is joined to an existing Fabric.");
                }
            } else {
                System.out.println("This container \u001B[1m" + name + "\u001B[0m is a standalone container.");
            }
            String url = fabricService.getWebConsoleUrl();
View Full Code Here

                    }
                } else {
                    externalPortCounter++;
                }
                if (!usedPortByHost.contains(externalPortCounter)) {
                    Container container = getFabricService().getCurrentContainer();
                    String pid = Constants.PORTS_PID;
                    String key = containerId + "-" + portKey;
                    getFabricService().getPortService().registerPort(container, pid, key, externalPortCounter);
                    return externalPortCounter;
                }
View Full Code Here

    @Override
    protected Set<Integer> findUsedPortByHostAndDocker() {
        try {
            FabricService fabric = getFabricService();
            Container currentContainer = fabric.getCurrentContainer();
            Set<Integer> usedPorts;
            Set<Integer> dockerPorts;
            synchronized (portLock) {
                usedPorts = fabric.getPortService().findUsedPortByHost(currentContainer);
                dockerPorts = Dockers.getUsedPorts(docker);
View Full Code Here

            }
            sb.append("\n");
            cmdStr = sb.toString();
        }

        Container found = FabricCommand.getContainer(fabricService, container);
        String sshUrl = found.getSshUrl();
        if (sshUrl == null) {
            throw new IllegalArgumentException("Container " + container + " has no SSH URL.");
        }
        String[] ssh = sshUrl.split(":");
        if (ssh.length < 2) {
View Full Code Here

TOP

Related Classes of io.fabric8.api.Container

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.