Test for the existence of a given datastream in VITAL.

@param fedora An instantiated fedora client
@param vitalPid The VITAL PID to use
@param dsPid The datastream ID on the object
@returns boolean True is found, False if not found or there are errors
167935
private boolean datastreamExists(FedoraClient fedora, String vitalPid,
            String dsPid) {
        try {
            // Some options:
            // * getAPIA().listDatastreams... seems best
            // * getAPIM().getDatastream... causes Exceptions against new IDs
            // * getAPIM().getDatastreams... is limited to a single state
            DatastreamDef[] streams = fedora.getAPIA().listDatastreams(
                    vitalPid, null);
            for (DatastreamDef stream : streams) {
                if (stream.getID().equals(dsPid)) {
                    return true;
                }
            }
        } catch (Exception ex) {
            log.error("API Query error: ", ex);
        }
        return false;
    }
409459
public boolean check(Long pipelineId) {
        MainstemMonitor mainstemMonitor = ArbitrateFactory.getInstance(pipelineId, MainstemMonitor.class);
        return mainstemMonitor.check();
    }
1116832
public boolean hasStream(SIBUuid12 streamID, int priority, Reliability reliability ) throws SIResourceException 
  {
    if (tc.isEntryEnabled()) 
      SibTr.entry(tc, "hasStream", 
        new Object[]{streamID, new Integer(priority), reliability});
        
    StreamSet streamSet = (StreamSet) streamSets.get(streamID);
    if(streamSet != null) 
    {
      if ( streamSet.getStream(priority, reliability) != null )        
      { 
        if (tc.isEntryEnabled()) SibTr.exit(tc, "hasStream", Boolean.TRUE);
        return true;
      }  
    }
    if (tc.isEntryEnabled()) SibTr.exit(tc, "hasStream", Boolean.FALSE);
    return false;  
  }
35635
public String compareDatastreamChecksum(Context context,
                                            String pid,
                                            String dsID,
                                            Date versionDate)
            throws ServerException {
        return delegate.compareDatastreamChecksum(context,
                                                  pid,
                                                  dsID,
                                                  versionDate);
    }
1248073
public static void validateReservedDatastream(PID pid,
                                                  String dsId,
                                                  Datastream ds)
            throws ValidationException {

        // NB: only want to generate inputstream from .getContentStream() once
        // we know that this is a datastream to validate
        // to prevent reading of non-reserved datstream content when it is not needed
        InputStream content = null;

        try {
        if ("POLICY".equals(dsId)) {
            content = ds.getContentStream();
            validatePOLICY(content);
        } else if ("FESLPOLICY".equals(dsId)) {
            content = ds.getContentStream();
            validateFESLPOLICY(content);
        } else if ("RELS-EXT".equals(dsId) || "RELS-INT".equals(dsId)) {
                content = ds.getContentStream();
            validateRELS(pid, dsId, content);
            }
        } catch (StreamIOException e) {
            throw new ValidationException("Failed to get content stream for " + pid + "/" + dsId + ": " + e.getMessage(), e);
        }

        if (content != null) {
            try {
                content.close();
            } catch (IOException e) {
                throw new ValidationException("Error closing content stream for " + pid + "/" + dsId + ": " + e.getMessage(), e);
            }
        }
    }
267609
def is_available(cls, disk, kernel):
        
        kmap = cls.list(disk['datacenter_id'], None, kernel, True)
        for flavor in kmap:
            if kernel in kmap[flavor]:
                return True
        return False
48454
@Override
    public String compareDatastreamChecksum(String pid,
                                            String dsID,
                                            String versionDate) {
        assertInitialized();
        try {
            MessageContext ctx = context.getMessageContext();
            return m_management.compareDatastreamChecksum(ReadOnlyContext
                    .getSoapContext(ctx), pid, dsID, DateUtility
                    .parseDateOrNull(versionDate));
        } catch (Throwable th) {
            LOG.error("Error comparing datastream checksum", th);
            throw CXFUtility.getFault(th);
        }
    }
1067383
public static boolean findEntityRecursively(final EntityContainer container, final UUID id) {
	final AtomicBoolean found = new AtomicBoolean();

	walkEntityTree(container, e -> {
	    if (id.equals(e.getID())) {
		found.set(true);
		return EntityVisitResult.EXIT;
	    } else {
		return EntityVisitResult.CONTINUE;
	    }
	});

	return found.get();
    }
266806
@Override
    public boolean exists(final FedoraSession session, final String path) {
        final Session jcrSession = getJcrSession(session);
        try {
            validatePath(jcrSession, path);
            return jcrSession.nodeExists(path);
        } catch (final IllegalArgumentException e) {
            throw new InvalidResourceIdentifierException("Illegal path: " + path);
        } catch (final RepositoryException e) {
            throw new RepositoryRuntimeException(e);
        }
    }
687022
private static void validateRELS(PID pid, String dsId, InputStream content)
            throws ValidationException {
        logger.debug("Validating " + dsId + " datastream");
        new RelsValidator().validate(pid, dsId, content);
        logger.debug(dsId + " datastream is valid");
    }
979939
func existsPID(pid int) bool {
	_, err := os.FindProcess(pid)
	if err != nil {
		return false
	}

	return true
}
1254166
private String createNewObject(FedoraClient fedora, String oid)
            throws Exception {
        InputStream in = null;
        byte[] template = null;
        // Start by reading our FOXML template into memory
        try {
            if (foxmlTemplate != null) {
                // We have a user provided template
                in = new FileInputStream(foxmlTemplate);
                template = IOUtils.toByteArray(in);
            } else {
                // Use the built in template
                in = getClass().getResourceAsStream("/foxml_template.xml");
                template = IOUtils.toByteArray(in);
            }
        } catch (IOException ex) {
            throw new Exception(
                    "Error accessing FOXML Template, please check system configuration!");
        } finally {
            if (in != null) {
                in.close();
            }
        }

        String vitalPid = fedora.getAPIM().ingest(template,
                Strings.FOXML_VERSION,
                "ReDBox creating new object: '" + oid + "'");
        log.info("New VITAL PID: '{}'", vitalPid);
        return vitalPid;
    }
600000
public boolean exists(String key) {
        Path dir = getKeyDir(key);
        boolean res = false;
        try {
            _fs = dir.getFileSystem(_hadoopConf);
            res = _fs.exists(dir);
        } catch (IOException e) {
            LOG.warn("Exception checking for exists on: " + key);
        }
        return res;
    }
983693
public boolean checkIdle (long idleStamp)
    {
        if (_lastEvent > idleStamp) {
            return false;
        }
        if (!isClosed()) {
            log.info("Disconnecting non-communicative client",
                     "conn", this, "idle", (System.currentTimeMillis() - _lastEvent) + "ms");
        }
        return true;
    }
829506
@GetMapping(value = "/{entityTypeId}/exist", produces = APPLICATION_JSON_VALUE)
  public boolean entityExists(@PathVariable("entityTypeId") String entityTypeId) {
    return dataService.hasRepository(entityTypeId);
  }
570565
@Override
    public List<org.fcrepo.server.types.gen.Datastream> getDatastreamHistory(String pid,
                                                                             String dsID) {
        assertInitialized();
        try {
            MessageContext ctx = context.getMessageContext();
            org.fcrepo.server.storage.types.Datastream[] intDatastreams =
                    m_management.getDatastreamHistory(ReadOnlyContext
                            .getSoapContext(ctx), pid, dsID);
            return getGenDatastreams(intDatastreams);
        } catch (Throwable th) {
            LOG.error("Error getting datastream history", th);
            throw CXFUtility.getFault(th);
        }
    }
122027
def pid_exists(value, pidtype=None):
    
    try:
        PersistentIdentifier.get(pidtype, value)
        return True
    except PIDDoesNotExistError:
        return False