Find the "super" PID from the <code>ibm:extends</code> attribute of the OCD for <code>pid</code>.

@param pid must never be null
@return the super PID or <code>null</code> if no <code>ibm:extends</code> attribute could be found
545800
private String getExtends(String pid) {
        RegistryEntry re = getRegistryEntry(pid);
        return re == null ? null : re.getExtends();
    }
286026
private String getOwnProcessId() {
        // Format of name is : <pid>@<host>
        String name = ManagementFactory.getRuntimeMXBean().getName();
        int endIdx = name.indexOf('@');
        return endIdx != -1 ? name.substring(0,endIdx) : name;
    }
1256420
public final CatalogGs findSubcatalogGsByIdInTc(
    final TradingCatalog pCatalog, final Long pId) {
    for (TradingCatalog cat : pCatalog.getSubcatalogs()) {
      if (cat.getCatalog().getItsId().equals(pId)) {
        return cat.getCatalog();
      }
      for (TradingCatalog cati : cat.getSubcatalogs()) {
        if (cati.getCatalog().getItsId().equals(pId)) {
          return cati.getCatalog();
        }
        //recursion:
        CatalogGs cgs = findSubcatalogGsByIdInTc(cati, pId);
        if (cgs != null) {
          return cgs;
        }
      }
    }
    return null;
  }
676282
public static int pid() {
        int localPID = 0;
        try {
            String name = ManagementFactory.getRuntimeMXBean().getName();
            String[] nameSplit = name.split("@");
            if(nameSplit.length > 1) {
                localPID = Integer.parseInt(nameSplit[0]);
            }
            return localPID;
        } catch(Throwable t) {
            throw new UnsupportedOperationException("An error occurred while getting the PID: " + t.getMessage()) ;
        }
    }
142365
public static String pidMemoryUsage(int pid) throws IOException {
    Process process =
        new ProcessBuilder().command("ps", "-o", "pid,rss,vsz", "-p", Long.toString(pid)).start();

    BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));

    reader.readLine(); // Skip header

    String line = reader.readLine();
    String[] parts = line.trim().split("\\s+", 3);

    int readPid = Integer.parseInt(parts[0]);
    if (pid != readPid) {
      throw new RuntimeException("`ps` returned something unexpected: '" + line + "'");
    }

    long rss = Long.parseLong(parts[1]) * 1024;
    long vsz = Long.parseLong(parts[2]);

    // 0 pid, 1 rss, 2 vsz
    return String.format("%d\t%d", rss, vsz);
  }
1312732
public static ObjectFields getObjectFields(String pid, String[] fields)
            throws IOException {
        FieldSearchQuery query = new FieldSearchQuery();
        Condition condition = new Condition();
        condition.setProperty("pid");
        condition.setOperator(ComparisonOperator.fromValue("eq"));
        condition.setValue(pid);
        FieldSearchQuery.Conditions conds = new FieldSearchQuery.Conditions();
        conds.getCondition().add(condition);
        ObjectFactory factory = new ObjectFactory();
        query.setConditions(factory.createFieldSearchQueryConditions(conds));
        FieldSearchResult result =
                Administrator.APIA
                        .findObjects(TypeUtility.convertStringtoAOS(fields),
                                     new BigInteger("1"),
                                     query);
        ResultList resultList = result.getResultList();
        if (resultList == null || resultList.getObjectFields() == null
                && resultList.getObjectFields().size() == 0) {
            throw new IOException("Object not found in repository");
        }
        return resultList.getObjectFields().get(0);
    }
848861
private int processId(final java.lang.Process process) {
    int processId = 0;
    try {
      final Field f = process.getClass().getDeclaredField("pid");
      f.setAccessible(true);

      processId = f.getInt(process);
    } catch (final Throwable e) {
      e.printStackTrace();
    }

    return processId;
  }
577351
public Extension getExtension(ObjectIdentifier oid) {
        if (extensions == null)
            return null;

        // following returns null if no such OID in map
        //XXX consider cloning this
        return extensions.get(OIDMap.getName(oid));
    }
695789
private int openDoor(int pid) throws IOException {
        String path = tmpdir + "/.java_pid" + pid;;
        fd = open(path);

        // Check that the file owner/permission to avoid attaching to
        // bogus process
        try {
            checkPermissions(path);
        } catch (IOException ioe) {
            close(fd);
            throw ioe;
        }
        return fd;
    }
57337
public static boolean isProcDead(String pid) {
        if (!OSInfo.isLinux()) {
            return false;
        }

        String path = "/proc/" + pid;
        File file = new File(path);

        if (!file.exists()) {
            LOG.info("Process " + pid + " is dead");
            return true;
        }

        return false;
    }
1089641
public final InputStream retrieve(String pid)
            throws LowlevelStorageException {
        File file = getFile(pid);
        return fileSystem.read(file);
    }
706743
private static Long getPid(File pidFile) {
      FileReader reader = null;
      BufferedReader lineReader = null;
      String pidLine  = null;
      try {
        reader = new FileReader(pidFile);
        lineReader = new BufferedReader(reader);
        pidLine = lineReader.readLine();
        if(pidLine!=null) {
          pidLine = pidLine.trim();     
        }   
      } catch (Exception ex) {
        log.error("Failed to read PID from file  [" + pidFile.getAbsolutePath() + "]", ex);
      } finally {
        if(reader!=null) try { reader.close(); } catch (Exception ex) { /* No Op */ }
      }
      try {
        return Long.parseLong(pidLine);
      } catch (Exception ex) {
        return null;
      }     
    }
59806
public String getObjectPID() {
        if (object != null && !isLiteral && object.startsWith("info:fedora/")) {
            String PID = object.substring(12);
            return PID;
        }
        return null;
    }
275629
public Set<String> getParents(String pid) throws MelcoeXacmlException {
        logger.debug("Obtaining parents for: {}", pid);

        Set<String> parentPIDs = new HashSet<String>();
        if (pid.equalsIgnoreCase(Constants.FEDORA_REPOSITORY_PID.uri)) {
            return parentPIDs;
        }

        query: for (String relationship : relationships) {
            logger.debug("relationship query: {}, {}", pid, relationship);

            Map<String, Set<String>> mapping;
            try {
                mapping = getRelationships(pid, relationship);
            } catch (MelcoeXacmlException e) {
                Throwable t = e.getCause();
                // An object X, may legitimately declare a parent relation to
                // another object, Y which does not exist. Therefore, we don't
                // want to continue querying for Y's parents.
                if (t != null && t instanceof ObjectNotInLowlevelStorageException) {
                    logger.debug("Parent, {}, not found.", pid);
                    break query;
                } else {
                // Unexpected error, so we throw back the original
                throw e;
            }
            }

            Set<String> parents = mapping.get(relationship);
            if (parents != null) {
                for (String parent : parents) {
                    PID parentPID = PID.getInstance(parent);
                    // we want the parents in demo:123 form, not info:fedora/demo:123
                    parentPIDs.add(parentPID.toString());
                    logger.debug("added parent {}", parentPID.toString());
                }
            }
        }
        return parentPIDs;
    }
416708
public ClassDescriptor getSuperClassDescriptor()
    {
        if (!m_superCldSet)
        {
            if(getBaseClass() != null)
            {
                m_superCld = getRepository().getDescriptorFor(getBaseClass());
                if(m_superCld.isAbstract() || m_superCld.isInterface())
                {
                    throw new MetadataException("Super class mapping only work for real class, but declared super class" +
                            " is an interface or is abstract. Declared class: " + m_superCld.getClassNameOfObject());
                }
            }
            m_superCldSet = true;
        }

        return m_superCld;
    }
669519
public static String getPid(EvaluationCtx context) {
        EvaluationResult attribute
                = context.getResourceAttribute(STRING_ATTRIBUTE,
                        Constants.OBJECT.PID.attributeId,
                                               null);
        BagAttribute element = getAttributeFromEvaluationResult(attribute);
        if (element == null) {
            logger.debug("PolicyFinderModule:getPid exit on can't get pid on request callback");
            return null;
        }

        if (!(element.getType().equals(STRING_ATTRIBUTE))) {
            logger.debug("PolicyFinderModule:getPid exit on couldn't get pid from xacml request non-string returned");
            return null;
        }

        return (element.size() == 1) ? (String) element.getValue() : null;
    }
1155206
private static String getPID() {
        String name = ManagementFactory.getRuntimeMXBean().getName();
        int index = name.indexOf('@');
        if (index == -1) {
            return null;
        }

        String pid = name.substring(0, index);
        if (!pid.matches("[0-9]+")) {
            return null;
        }

        return pid;
    }