Package com.sun.faban.harness.engine

Examples of com.sun.faban.harness.engine.CmdService


                "fa:runConfig/fa:runControl/fa:steadyState");

        hosts = par.getEnabledHosts(roleElement);

        // Obtain unique hosts
        CmdService cmds = CmdService.getHandle();
        ArrayList<String> hostList = new ArrayList<String>(hosts.length);
        HashSet<String> realHostSet = new HashSet<String>(hosts.length);

        for (String host : hosts) {
            if (realHostSet.add(cmds.getHostName(host)))
                hostList.add(host);
        }
        uniqueHosts = new String[hostList.size()];
        uniqueHosts = hostList.toArray(uniqueHosts);

        hostPorts = par.getEnabledHostPorts(roleElement);
        if (hostPorts != null && hostPorts.size() > 0) {
            hostPorts = Collections.unmodifiableList(
                    par.getEnabledHostPorts(roleElement));

            uniqueHostPorts =
                    new ArrayList<NameValuePair<Integer>>(hostPorts.size());
            HashSet<NameValuePair<Integer>> hostPortSet =
                    new HashSet<NameValuePair<Integer>>(hostPorts.size());
            for (NameValuePair<Integer> hostPort : hostPorts) {
                if (hostPortSet.add(new NameValuePair<Integer>(
                        cmds.getHostName(hostPort.name), hostPort.value)))
                    uniqueHostPorts.add(hostPort);
            }
            uniqueHostPorts = Collections.unmodifiableList(uniqueHostPorts);
        }
    }
View Full Code Here


                ctxList.add(ctx);
                if ("services".equals(sd.locationType)) {
                    String fullLocation = sd.locationType + '/' + sd.location;
                    activeDeployments.add(fullLocation);

                    CmdService cmds = CmdService.getHandle();
                    String[] ctxHosts = ctx.getHosts();
                    for (String ctxHost : ctxHosts) {
                        if (hostDeploymentSet.add(new NameValuePair<String>(
                                cmds.getHostName(ctxHost), sd.location))) {
                            hostDeploymentList.add(new NameValuePair<String>(
                                    ctxHost, sd.location));
                        }
                    }
                }
                String toolCmds = par.getParameter("fh:tools", serviceElement);
                Set<String> tools = new LinkedHashSet<String>();
                if (toolCmds.toUpperCase().equals("NONE")) {
                } else if (toolCmds.length() != 0){
                    StringTokenizer st = new StringTokenizer(toolCmds, ";");
                    while (st.hasMoreTokens()) {
                        tools.add(st.nextToken().trim());
                    }
                } else {
                    String key = "default" + '/' + serviceName;
                    Set<String> toolsetTools = new LinkedHashSet<String>();
                    if(toolSetsMap.containsKey(key)){
                        toolsetTools.addAll(toolSetsMap.get(key));
                        for (String t1 : toolsetTools) {
                            StringTokenizer tt1 = new StringTokenizer(t1);
                            String toolId1 = tt1.nextToken();
                            String toolKey1 = toolId1 + '/' + serviceName;
                            ToolDescription toolDesc = toolMap.get(toolKey1);
                            MasterToolContext toolCtx;
                            if (toolDesc != null) {
                                toolCtx = new MasterToolContext(t1, ctx,
                                        toolDesc);
                            } else {
                                toolDesc = toolMap.get(toolId1);
                                if (toolDesc != null) {
                                    toolCtx = new MasterToolContext(
                                            t1, ctx, toolDesc);
                                    activeDeployments.add(
                                            toolDesc.getLocationType() +
                                                    File.separator +
                                                    toolDesc.getLocation());
                                } else {
                                    //logger.info("No Tool Description for tool: " + t1);
                                    logger.fine("No Tool Description for tool: "
                                            + t1 +" ,so it's a command line tool");
                                    toolCtx = new MasterToolContext(
                                            t1, ctx, null);
                                }
                            }
                            if (toolCtx != null) {
                                toolList.add(toolCtx);
                            }
                        }
                    }

                }
                // Analyze the list of tools for toolset references.
                for (String tool : tools) {
                    StringTokenizer tt = new StringTokenizer(tool);
                    String toolId = tt.nextToken();
                    String toolKey = toolId + '/' + serviceName;
                    Set<String> toolsetTools = new LinkedHashSet<String>();
                    if (toolSetsMap.containsKey(toolKey)) {
                        toolsetTools.addAll(toolSetsMap.get(toolKey));
                        for (String t1 : toolsetTools) {
                            StringTokenizer tt1 = new StringTokenizer(t1);
                            String toolId1 = tt1.nextToken();
                            String toolKey1 = toolId1 + '/' + serviceName;
                            ToolDescription toolDesc = toolMap.get(toolKey1);
                            MasterToolContext toolCtx;
                            if (toolDesc != null) {
                                toolCtx = new MasterToolContext(t1, ctx, toolDesc);
                            } else {
                                toolDesc = toolMap.get(toolId1);
                                if (toolDesc != null) {
                                    toolCtx = new MasterToolContext(
                                            t1, ctx, toolDesc);
                                } else {
                                    logger.fine("No Tool Description for tool: "
                                            + t1 +
                                            " ,so it's a command line tool");
                                    toolCtx = new MasterToolContext(
                                            t1, ctx, null);
                                }
                            }
                            if (toolCtx != null) {
                                toolList.add(toolCtx);
                            }
                        }
                    } else {
                        ToolDescription toolDesc = toolMap.get(toolKey);
                        MasterToolContext toolCtx;
                        if (toolDesc != null) {
                            toolCtx = new MasterToolContext(tool, ctx, toolDesc);
                        } else {
                            toolDesc = toolMap.get(toolId);
                            if (toolDesc != null) {
                                toolCtx = new MasterToolContext(
                                        tool, ctx, toolDesc);
                            } else {
                                logger.fine("No Tool Description for tool: " +
                                        tool + " ,so it's a command line tool");
                                toolCtx = new MasterToolContext(
                                        tool, ctx, null);
                            }
                        }
                        if (toolCtx != null) {
                            toolList.add(toolCtx);
                        }
                    }
                }
                for (MasterToolContext toolCtx : toolList) {
                    String locationType;
                    if (toolCtx.getToolDescription() != null) {
                        locationType =
                            toolCtx.getToolDescription().getLocationType();
                        if ("services".equals(locationType)) {
                            String location =
                                    toolCtx.getToolDescription().getLocation();
                            String fullLocation = locationType + '/' + location;
                            activeDeployments.add(fullLocation);

                            CmdService cmds = CmdService.getHandle();
                            String[] ctxHosts =
                                    toolCtx.getToolServiceContext().getHosts();
                            for (String ctxHost : ctxHosts) {
                                if (hostDeploymentSet.add(new NameValuePair<String>(
                                        cmds.getHostName(ctxHost), location))) {
                                    hostDeploymentList.add(new NameValuePair<String>
                                            (ctxHost, location));
                                }
                            }
                        }
View Full Code Here

            }
            pathList.add(hostPath.value);
        }

        Set<Map.Entry<String, List<String>>> entrySet = downloadMap.entrySet();
        CmdService cmds = CmdService.getHandle();
        for (Map.Entry<String, List<String>> entry : entrySet) {
            cmds.downloadServices(entry.getKey(), entry.getValue());
        }

        // Also update the paths on the local command agent.
        ArrayList<String> activeServiceList = new ArrayList<String>();
        for (String deployment : activeDeployments) {
            if (deployment.startsWith("services/"))
                activeServiceList.add(deployment.substring(9));
        }
        cmds.updatePaths(activeServiceList);
    }
View Full Code Here

     * parameter file and run information.
     * @param par The parameter repository/file
     * @throws ConfigurationException If there is a configuration error
     */
    public HostRoles(ParamRepository par) throws ConfigurationException {
        CmdService cmds = CmdService.getHandle();
        List<NameValuePair<String>> hostRoles = par.getHostRoles();
        ArrayList<String> drivers = new ArrayList<String>();

        for (NameValuePair<String> hostRole : hostRoles) {

View Full Code Here

     * @param hostName The host name to check.
     * @param fileName The file name to test.
     * @return true if exists, false otherwise.
     */
    public static boolean exists(String hostName, String fileName) {
        CmdService cs = CmdService.getHandle();
        return cs.doesFileExist(hostName, fileName);
    }
View Full Code Here

     * @param hostName The host name to check.
     * @param fileName The file name to test.
     * @return true if file is a normal file, false otherwise.
     */
    public static boolean isFile(String hostName, String fileName) {
        CmdService cs = CmdService.getHandle();
        return cs.isFile(hostName, fileName);
    }
View Full Code Here

     * @param hostName The host name to check.
     * @param fileName The file name to test.
     * @return true if file is a directory, false otherwise.
     */
    public static boolean isDirectory(String hostName, String fileName) {
        CmdService cs = CmdService.getHandle();
        return cs.isDirectory(hostName, fileName);       
    }
View Full Code Here

TOP

Related Classes of com.sun.faban.harness.engine.CmdService

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.