<commit_before>module Fabric {
  
  export var managerMBean = "org.fusesource.fabric:type=Fabric";

  export function setSelect(selection, group) {
    if (!angular.isDefined(selection)) {
      return group[0];
    }
    var answer = group.findIndex( function(item) { return item.id === selection.id } );
    if (answer !== -1) {
      return group[answer];
    } else {
      return group[0];
    }
  }


  
  export function stopContainer(jolokia, id, success, error) {
    jolokia.request(
      {
        type: 'exec', mbean: managerMBean,
        operation: 'stopContainer(java.lang.String)',
        arguments: [id]
      },
      onSuccess(success, { error: error }));
  }

  export function destroyContainer(jolokia, id, success, error) {
    jolokia.request(
      {
        type: 'exec', mbean: managerMBean,
        operation: 'destroyContainer(java.lang.String)',
        arguments: [id]
      },
      onSuccess(success, { error: error }));
  }

  export function startContainer(jolokia, id, success, error) {
    jolokia.request(
      {
        type: 'exec', mbean: managerMBean,
        operation: 'startContainer(java.lang.String)',
        arguments: [id]
      },
      onSuccess(success, { error: error }));
  }
  
  
  export function getServiceList(container) {
    var answer = [];
    if (angular.isDefined(container) && angular.isDefined(container.jmxDomains) && angular.isArray(container.jmxDomains)) {

      container.jmxDomains.forEach((domain) => {
        if (domain === "org.apache.activemq") {
          answer.push({
            title: "Apache ActiveMQ",
            type: "img",
            src: "app/fabric/img/message_broker.png"
          });
        }
        if (domain === "org.apache.camel") {
          answer.push({
            title: "Apache Camel",
            type: "img",
            src: "app/fabric/img/camel.png"
          });
        }
        if (domain === "org.fusesource.fabric") {<commit_msg>combine these functions into one<commit_after>module Fabric {
  
  export var managerMBean = "org.fusesource.fabric:type=Fabric";

  export function setSelect(selection, group) {
    if (!angular.isDefined(selection)) {
      return group[0];
    }
    var answer = group.findIndex( function(item) { return item.id === selection.id } );
    if (answer !== -1) {
      return group[answer];
    } else {
      return group[0];
    }
  }

  export function containerAction(action, jolokia, id, success, error) {
    jolokia.request(
        {
          type: 'exec', mbean: managerMBean,
          operation: action,
          arguments: [id]
        },
        {
          method: 'POST',
          success: success,
          error: error
        });
  }
  
  export function stopContainer(jolokia, id, success, error) {
    containerAction('stopContainer(java.lang.String)', jolokia, id, success, error);
  }

  export function destroyContainer(jolokia, id, success, error) {
    containerAction('destroyContainer(java.lang.String)', jolokia, id, success, error);
  }

  export function startContainer(jolokia, id, success, error) {
    containerAction('startContainer(java.lang.String)', jolokia, id, success, error);
  }
  
  
  export function getServiceList(container) {
    var answer = [];
    if (angular.isDefined(container) && angular.isDefined(container.jmxDomains) && angular.isArray(container.jmxDomains)) {

      container.jmxDomains.forEach((domain) => {
        if (domain === "org.apache.activemq") {
          answer.push({
            title: "Apache ActiveMQ",
            type: "img",
            src: "app/fabric/img/message_broker.png"
          });
        }
        if (domain === "org.apache.camel") {
          answer.push({
            title: "Apache Camel",
            type: "img",
            src: "app/fabric/img/camel.png"
          });
        }
        if (domain === "org.fusesource.fabric") {
{'fraction_non_alphanumeric': 0.13817994328435163, 'fraction_numerical': 0.0015467904098994587, 'mean_word_length': 2.3593073593073592, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3828218', 'n_tokens_mistral': 1204, 'n_tokens_neox': 1171, 'n_words': 241}