/**
   * Moves a process component to backing store
   *
   * @param memory partitions linked list (memory)
   * @param swap processes into backing store linked list (swap)
   * @param partition memory partition allocating process component to swap
   * @throws SoSimException partition does not allocate any process' component
   */
  public void swapOutProcess(
      List<MemPartition> memory, List<ProcessMemUnit> swap, MemPartition partition)
      throws SoSimException {
    if (partition.getAllocated() == null) throw new SoSimException("me_09");
    ProcessComponent child = (ProcessComponent) partition.getAllocated();

    swap.add(child);
    child.setLoad(false);
    partition.setAllocated(null);
  }
  public DiscoveredResourceDetails discoverResource(
      Configuration pluginConfig, ResourceDiscoveryContext resourceDiscoveryContext)
      throws InvalidPluginConfigurationException {
    ProcessInfo processInfo;
    try {
      processInfo =
          ProcessComponent.getProcessForConfiguration(
              pluginConfig, resourceDiscoveryContext.getSystemInformation());
    } catch (Exception e) {
      throw new RuntimeException(
          "Failed to manually add process Resource based on plugin config: "
              + pluginConfig.toString(true),
          e);
    }

    String type = pluginConfig.getSimpleValue("type", "pidFile");
    String resourceKey = pluginConfig.getSimpleValue(type, null);
    if (resourceKey == null || resourceKey.length() == 0) {
      throw new InvalidPluginConfigurationException(
          "Invalid type [" + type + "] value: [" + resourceKey + "]");
    }

    ResourceType resourceType = resourceDiscoveryContext.getResourceType();
    String resourceName = processInfo.getBaseName();
    String resourceVersion = null;
    String resourceDescription =
        processInfo.getBaseName()
            + " process with "
            + (type.equals("pidFile") ? "PID file" : "PIQL expression")
            + " ["
            + resourceKey
            + "]";

    DiscoveredResourceDetails detail =
        new DiscoveredResourceDetails(
            resourceType,
            resourceKey,
            resourceName,
            resourceVersion,
            resourceDescription,
            pluginConfig,
            processInfo);
    return detail;
  }