<p>Invoke API-M.purgeDatastream
</p><p>
DELETE /objects/{pid}/datastreams/{dsID} ? startDT endDT logMessage</p>
779993
@Path("/{dsID}")
    @DELETE
    @Produces(MediaType.APPLICATION_JSON)
    public Response deleteDatastream(@PathParam(RestParam.PID) String pid,
                                     @PathParam(RestParam.DSID) String dsID,
                                     @QueryParam(RestParam.START_DT) String startDT,
                                     @QueryParam(RestParam.END_DT) String endDT,
                                     @QueryParam(RestParam.LOG_MESSAGE) String logMessage,
                                     @QueryParam(RestParam.FLASH) @DefaultValue("false") boolean flash) {

        try {
            Context context = getContext();
            Date startDate = DateUtility.parseDateOrNull(startDT);
            Date endDate = DateUtility.parseDateOrNull(endDT);
            Date[] purged = m_management.purgeDatastream(context,
                                        pid,
                                        dsID,
                                        startDate,
                                        endDate,
                                        logMessage);

            // convert purged into a String[] so we can return it as a JSON array
            List<String> results = new ArrayList<String>(purged.length);
            for (Date d : purged) {
                results.add(DateUtility.convertDateToXSDString(d));
            }
            return Response.ok(m_mapper.writeValueAsString(results)).build();
        } catch (Exception ex) {
            return handleException(ex, flash);
        }
    }
354078
protected void cleanup(JobContext context) throws IOException {
    boolean delete =
        BigQueryOutputConfiguration.getCleanupTemporaryDataFlag(context.getConfiguration());

    if (delete && outputFileSystem.exists(outputPath)) {
      logger.atInfo().log("Found GCS output data at '%s', attempting to clean up.", outputPath);
      if (outputFileSystem.delete(outputPath, true)) {
        logger.atInfo().log("Successfully deleted GCS output path '%s'.", outputPath);
      } else {
        logger.atWarning().log(
            "Failed to delete GCS output at '%s', retrying on shutdown.", outputPath);
        outputFileSystem.deleteOnExit(outputPath);
      }
    }
  }
1316879
@Override
    public void destroy() {
        if (timerFilterThread != null) {
            timerFilterThread.setStopped();
            timerFilterThread = null;
        }

        Filter filter = null;
        for (int i=0; i<filterFactory.getAllFilter().size(); i++) {
            // ZAP: Removed unnecessary cast.
            filter = filterFactory.getAllFilter().get(i);
            try {
                filter.destroy();
            } catch (Exception e) {}
        }
        
        
    }
1333064
def datastream_lastmodified(request, pid, dsid, repo=None,
    as_of_date=None, *args, **kwargs):
    '''
    '''
    try:
        if repo is None:
            repo = Repository()
        resp = repo.api.getDatastream(pid, dsid, asOfDateTime=as_of_date)
        dsprofile = parse_xml_object(DatastreamProfile, resp.content, resp.url)
        if dsprofile:
            return dsprofile.created
    except RequestFailed:
        pass
1167353
@Override
    public void destroy() throws Exception {
        final boolean trace = TraceComponent.isAnyTracingEnabled();
        if (trace && tc.isEntryEnabled())
            Tr.entry(this, tc, "destroy", id);

        tracker.close();

        StringBuilder filter = new StringBuilder(FilterUtils.createPropertyFilter(AbstractConnectionFactoryService.ID, id));
        filter.insert(filter.length() - 1, '*');

        builder.removeExistingConfigurations(filter.toString());

        if (trace && tc.isEntryEnabled())
            Tr.exit(this, tc, "destroy");
    }
597300
def delete_stream(stream_name, region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
    r = _execute_with_retries(conn,
                              "delete_stream",
                              StreamName=stream_name)
    if 'error' not in r:
        r['result'] = True
    return r
432910
private void onCleanExit(final String processId) {
    this.onResourceStatus(
        ResourceStatusEventImpl.newBuilder()
            .setIdentifier(processId)
            .setState(State.DONE)
            .setExitCode(0)
            .build()
    );
  }
215001
void rstStream() {
        if (reset) {
            return;
        }
        reset = true;
        if(!isReadyForFlush()) {
            IoUtils.safeClose(this);
        }
        getChannel().removeStreamSink(getStreamId());
    }
1295963
public void forceFlush(SIBUuid12 streamID)
    throws SIResourceException, SIResourceException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(this, tc, "forceFlush", new Object[] { streamID });

    // Synchronize to resolve racing messages.
    synchronized (flushMap)
    {
      FlushQueryRecord entry = flushMap.remove(streamID);

      // Remove the entry (we may not have even had
      // one), then clean up any existing stream state.  Also, make
      // sure we turn off the alarm if there IS an entry.  Note that
      // an alarm will always be present if an entry exists.
      if (entry != null)
         entry.resend.cancel();

      flush(streamID);

    }

    //If all the inbound stream sets are empty, queue the destination that the
    //inbound streams are for to the asynch deletion thread, incase any cleanup
    //of the destination is required.  If not, the asynch deletion thread will do
    //nothing.
 //   if (isEmpty())
 //   {
 //     DestinationManager destinationManager = messageProcessor.getDestinationManager();
 //     BaseDestinationHandler destinationHandler = protocolItemStream.getDestinationHandler();
 //     destinationManager.markDestinationAsCleanUpPending(destinationHandler);
 //   }


    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "forceFlush");
  }
181745
@Override
    public List<org.fcrepo.server.types.gen.Datastream> getDatastreams(String pid,
                                                                       String asOfDateTime,
                                                                       String dsState) {
        assertInitialized();
        try {
            MessageContext ctx = context.getMessageContext();
            org.fcrepo.server.storage.types.Datastream[] intDatastreams =
                    m_management.getDatastreams(ReadOnlyContext
                            .getSoapContext(ctx), pid, DateUtility
                            .parseDateOrNull(asOfDateTime), dsState);
            return getGenDatastreams(intDatastreams);
        } catch (Throwable th) {
            LOG.error("Error getting datastreams", th);
            throw CXFUtility.getFault(th);
        }
    }
593614
@Override
    public org.fcrepo.server.types.gen.MIMETypedStream getDatastreamDissemination(String pid,
                                                                                  String dsID,
                                                                                  String asOfDateTime) {
        MessageContext ctx = context.getMessageContext();
        Context context = ReadOnlyContext.getSoapContext(ctx);
        assertInitialized();
        try {
            org.fcrepo.server.storage.types.MIMETypedStream mimeTypedStream =
                    m_access.getDatastreamDissemination(context,
                                                        pid,
                                                        dsID,
                                                        DateUtility
                                                                .parseDateOrNull(asOfDateTime));
            org.fcrepo.server.types.gen.MIMETypedStream genMIMETypedStream =
                    TypeUtility
                            .convertMIMETypedStreamToGenMIMETypedStream(mimeTypedStream);
            return genMIMETypedStream;
        } catch (OutOfMemoryError oome) {
            LOG.error("Out of memory error getting " + dsID
                    + " datastream dissemination for " + pid);
            String exceptionText =
                    "The datastream you are attempting to retrieve is too large "
                            + "to transfer via getDatastreamDissemination (as determined "
                            + "by the server memory allocation.) Consider retrieving this "
                            + "datastream via REST at: ";
            String restURL =
                    describeRepository().getRepositoryBaseURL() + "/get/" + pid
                            + "/" + dsID;
            throw CXFUtility.getFault(new Exception(exceptionText + restURL));

        } catch (Throwable th) {
            LOG.error("Error getting datastream dissemination", th);
            throw CXFUtility.getFault(th);
        }
    }
94164
@Override
    public void cleanup(Map<String, String> options) throws Exception {

        ClientProperties properties = new ClientProperties(options);

        if (!executedTaskKill) {
            synchronized (lock) {
                if (properties.isKillTasksAtStartup()) {
                    if (properties.getBrowser().equalsIgnoreCase("ie")
                            || properties.getBrowser().equalsIgnoreCase("iexplore")
                            || properties.getBrowser().equalsIgnoreCase("*iexplore")
                        	|| properties.getBrowser().equalsIgnoreCase("internet explorer")) {
                        try {
                            Runtime.getRuntime().exec("taskkill /F /IM IEDriverServer.exe /T");
                        } catch (IOException e) {
                            log.warn("Taskkill failed to kill any rogue IEDriverServer.exe tasks");
                        }
                        try {
                            Runtime.getRuntime().exec("taskkill /F /IM iexplore.exe /T");
                        } catch (IOException e) {
                            log.warn("Taskkill failed to kill any rogue Internet Explorer browsers");
                        }
                    } else if (properties.getBrowser().equalsIgnoreCase("chrome")) {
                        if (properties.getOS() == null
                                || properties.getOS().equalsIgnoreCase("windows")) {
                            try {
                                Runtime.getRuntime().exec("taskkill /F /IM chromedriver.exe /T");

                            } catch (IOException e) {
                                log.warn("Taskkill failed to kill any rogue chromedriver.exe processes");
                            }
                            try {
                                Runtime.getRuntime().exec("taskkill /F /IM chrome.exe /T");
                            } catch (IOException e) {
                                log.warn("Taskkill failed to kill any rogue chrome browsers");

                            }
                        } else if (properties.getOS().equalsIgnoreCase("linux")) {
                            try {
                                Runtime.getRuntime().exec("killall -9 chromedriver");
                            } catch (IOException e) {
                                log.warn("Taskkill failed to kill any rogue chromedriver.exe processes");
                            }
                            try {
                                Runtime.getRuntime().exec("killall -9 chrome");
                            } catch (IOException e) {
                                log.warn("Taskkill failed to kill any rogue chrome browsers");
                            }
                        } else if (properties.getOS().equalsIgnoreCase("mac")) {
                            try {
                                Runtime.getRuntime().exec("killall -KILL chromedriver");
                            } catch (IOException e) {
                                log.warn("Taskkill failed to kill any rogue chromedriver tasks");
                            }
                            try {
                                Runtime.getRuntime().exec("killall -KILL chrome");
                            } catch (IOException e) {
                                log.warn("Taskkill failed to kill any rogue chrome browsers");
                            }
                        } else {
                            log.warn("Taskkill failed to kill any rogue chromedriver or chrome tasks because the OS"
                                    + "provided is either incorrect or not supported");
                        }
                    } else if (properties.getBrowser().equalsIgnoreCase("firefox")
                            || properties.getBrowser().equalsIgnoreCase("*firefox")) {
                        if (properties.getOS() == null
                                || properties.getOS().equalsIgnoreCase("windows")) {
                            // there is no taskkill for FirefoxDriver because
                            // there is no "server" used for Firefox
                            try {
                                Runtime.getRuntime().exec("taskkill /F /IM firefox.exe /T");

                            } catch (IOException e) {
                                log.warn("Taskkill failed to kill any rogue firefox browsers");
                            }
                        } else if (properties.getOS().equalsIgnoreCase("linux")) {
                            try {
                                Runtime.getRuntime().exec("killall -9 firefox");
                            } catch (IOException e) {
                                log.warn("Taskkill failed to kill any rogue firefox browsers");
                            }
                        } else if (properties.getOS().equalsIgnoreCase("mac")) {
                            try {
                                Runtime.getRuntime().exec("killall -KILL firefox");
                            } catch (IOException e) {
                                log.warn("Taskkill failed to kill any rogue firefox browsers");
                            }
                        } else {
                            log.warn("Taskkill failed to kill any rogue firefox tasks because the OS"
                                    + "provided is either incorrect or not supported");
                        }
                    }
                }
                executedTaskKill = true;
            }
        }

        removeWebDriverTempOldFolders(properties);
    }
81202
public void reconstituteSourceStreams(DestinationHandler dest, PtoPOutputHandler outputHandler, int startMode) 
  
  throws MessageStoreException, SIDiscriminatorSyntaxException, SIErrorException, SIResourceException
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "reconstituteSourceStreams", new Integer(startMode));

    
    /*
     * Iterate through all contained Protocol Items, looking for StreamSet
     * associated with source. Note that outputHandler passed in is null if this 
     * is Pubsub. 
     */ 
     
    SourceStreamSetFilter filter = null;
    if( dest.isPubSub())
    { 
      filter = new SourceStreamSetFilter(null);
    }
    else
    {
      filter = new SourceStreamSetFilter(outputHandler.getTargetMEUuid());
    }
    
    NonLockingCursor cursor = null;
    
    try
    {
      cursor = newNonLockingItemCursor(filter);    
           
	    AbstractItem item = null;
	    
	    //should only be one match!!
	    while (null != (item = cursor.next()))
	    {
	      StreamSet streamSet = (StreamSet)item;
          streamSet.initializeNonPersistent(dest.getTxManager());
	      
	      // Don't do flush if we are asked to start in recovery mode 
	      if(   ((startMode & JsConstants.ME_START_FLUSH ) == JsConstants.ME_START_FLUSH )
	         && ((startMode & JsConstants.ME_START_RECOVERY ) == 0 ) )
	      {
	        // Log message to console saying we have started flush for this steamSet
	        // parmeters are:- ME name, streamSet Uuid, destinationName
	        SibTr.info(
	          tc,
	          "FLUSH_INITIATED_MESSAGE_CWSIP0781",
	          new Object[] { dest.getMessageProcessor().getMessagingEngineName(),
	                        streamSet.getStreamID(),
	                        dest.getName() });
	      }
	      try
	      {
	        if( dest.isPubSub())
	        {
	          PubSubInputHandler inputHandler = (PubSubInputHandler)dest.getInputHandler();
	          inputHandler.reconstitutePubSubSourceStreams(streamSet, startMode);
	        }
	        else
	        {        
	          outputHandler.reconstitutePtoPSourceStreams(streamSet, startMode);
	        }
	      }
	      catch (SIResourceException e)
	      {
	        // FFDC
	        FFDCFilter.processException(
	          e,
	          "com.ibm.ws.sib.processor.impl.store.itemstreams.SourceProtocolItemStream.reconstituteSourceStreams",
	          "1:179:1.29",
	          this);
	        
	        // Don't do flush if we are asked to start in recovery mode 
	        if(   ((startMode & JsConstants.ME_START_FLUSH ) == JsConstants.ME_START_FLUSH )
	           && ((startMode & JsConstants.ME_START_RECOVERY ) == 0 ) )
	        {
	          // Log message to console saying flush for this steamSet has failed
	          // parmeters are:- ME name, streamSet Uuid, destinationName, exception.
	          SibTr.error(
	            tc,
	            "FLUSH_FAILED_MESSAGE_CWSIP0782",
	            new Object[] {dest.getMessageProcessor().getMessagingEngineName(),
	                          streamSet.getStreamID(),
	                          dest.getName(),
	                          e });
	        }
	        
	        // Rethrow exception after logging error
	        if (tc.isEntryEnabled()) SibTr.exit(tc, "reconstituteSourceStreams");
	        throw(e);
	      
	      }
	    }
    }
    finally
    {
      if (cursor != null)
        cursor.finished();
    }
    
    if (tc.isEntryEnabled())  
      SibTr.exit(tc, "reconstituteSourceStreams");      
  }
368400
@Override
    public java.util.concurrent.Future<DeleteStreamResult> deleteStreamAsync(String streamName,
            com.amazonaws.handlers.AsyncHandler<DeleteStreamRequest, DeleteStreamResult> asyncHandler) {

        return deleteStreamAsync(new DeleteStreamRequest().withStreamName(streamName), asyncHandler);
    }
563553
public void deleteStream(String domain, String app, String stream) {
        DeleteStreamRequest request = new DeleteStreamRequest()
                .withDomain(domain)
                .withApp(app)
                .withStream(stream);
        deleteStream(request);
    }
318923
private void purge()
  {
    if (TraceComponent.isAnyTracingEnabled() && _tc.isEntryEnabled()) SibTr.entry(this, _tc, "purge");

    Iterator<Map.Entry<K,TimedValue<V>>> it = _realMap.entrySet().iterator();
    while (it.hasNext())
    {
      Map.Entry<K,TimedValue<V>> entry = it.next();
      TimedValue<V> value = entry.getValue();
      if (value.hasExipred())
      {
        it.remove();
        if (TraceComponent.isAnyTracingEnabled() && _tc.isDebugEnabled())
        {
          SibTr.debug(_tc, "The value with the key " + entry.getKey() + " has expired");
        }
      }
    }
    
    if (TraceComponent.isAnyTracingEnabled() && _tc.isEntryEnabled()) SibTr.exit(this, _tc, "purge");
  }
646288
public void purgeThreadLocal() {
        // if thread local pools exist, check to see if we have one created and
        // therefore need to tell it to purge
        if (null != threadLocals) {
            LocalThreadObjectPool pool = threadLocals.get();
            if (null != pool) {
                Object[] data = pool.purge();
                if (0 < data.length) {
                    mainPool.putBatch(data);
                }
            }
        }
    }