Record a content loader for a given patch id.

@param patchID       the patch id
@param contentLoader the content loader
977664
protected void recordContentLoader(final String patchID, final PatchContentLoader contentLoader) {
        if (contentLoaders.containsKey(patchID)) {
            throw new IllegalStateException("Content loader already registered for patch " + patchID); // internal wrong usage, no i18n
        }
        contentLoaders.put(patchID, contentLoader);
    }
224798
@PATCH
    @Path("{id}")
    public final Response patch(@PathParam("id") final URI_ID id, @NotNull final MODEL model) throws Exception {
        return super.patch(id, model);
    }
792526
private function logInsert($contenttype, $contentid, $content, $comment = null)
    {
        $this->app['logger.change']->info(
            'Insert record',
            [
                'action'      => 'INSERT',
                'contenttype' => $contenttype,
                'id'          => $contentid,
                'new'         => $content,
                'old'         => null,
                'comment'     => $comment,
            ]
        );
    }
183795
public final void initApplicationClassLoader(ClassLoader loader)
    {
        if (loader == null)
            throw new IllegalArgumentException("loader is null");
        if (!Kit.testIfCanLoadRhinoClasses(loader))
            throw new IllegalArgumentException(
                "Loader can not resolve Rhino classes");

        if (this.applicationClassLoader != null)
            throw new IllegalStateException(
                "applicationClassLoader can only be set once");
        checkNotSealed();

        this.applicationClassLoader = loader;
    }
629164
public SendGridContentHandler register(final Class<? extends Content> clazz, final SendGridContentHandler handler) {
		if (handler == null) {
			throw new IllegalArgumentException("[handler] cannot be null");
		}
		if (clazz == null) {
			throw new IllegalArgumentException("[clazz] cannot be null");
		}

		LOG.debug("Registering content handler {} for content type {}", handler, clazz);
		return handlers.put(clazz, handler);
	}
926858
public void setContentType(String contentType) {
        if (contentType == null) {
            _properties.remove(AMQP_PROP_CONTENT_TYPE);
            return;
        }
        
        _properties.put(AMQP_PROP_CONTENT_TYPE, contentType);
    }
364286
public SoapServerFaultResponseActionBuilder attachment(String contentId, String contentType, Resource contentResource) {
        return attachment(contentId, contentType, contentResource, FileUtils.getDefaultCharset());
    }
95441
void registerContent(
            final String pCacheURI,
            final CacheRequest pRequest,
            final CachedResponse pCachedResponse
    ) throws IOException {
        // System.out.println(" ## HTTPCache ## Registering content for " + pCacheURI);

//        pRequest.removeAttribute(ATTRIB_IS_STALE);
//        pRequest.setAttribute(ATTRIB_CACHED_RESPONSE, pCachedResponse);

        if ("HEAD".equals(pRequest.getMethod())) {
            // System.out.println(" ## HTTPCache ## Was HEAD request, will NOT store content.");
            return;
        }

        // TODO: Several resources may have same extension...
        String extension = MIMEUtil.getExtension(pCachedResponse.getHeaderValue(HEADER_CONTENT_TYPE));
        if (extension == null) {
            extension = "[NULL]";
        }

        synchronized (contentCache) {
            contentCache.put(pCacheURI + '.' + extension, pCachedResponse);

            // This will be the default version
            if (!contentCache.containsKey(pCacheURI)) {
                contentCache.put(pCacheURI, pCachedResponse);
            }
        }

        // Write the cached content to disk
        File content = new File(tempDir, "./" + pCacheURI + '.' + extension);
        if (deleteCacheOnExit && !content.exists()) {
            content.deleteOnExit();
        }

        File parent = content.getParentFile();
        if (!(parent.exists() || parent.mkdirs())) {
            log("Could not create directory " + parent.getAbsolutePath());

            // TODO: Make sure vary-info is still created in memory

            return;
        }

        OutputStream mContentStream = new BufferedOutputStream(new FileOutputStream(content));

        try {
            pCachedResponse.writeContentsTo(mContentStream);
        }
        finally {
            try {
                mContentStream.close();
            }
            catch (IOException e) {
                log("Error closing content stream: " + e.getMessage(), e);
            }
        }

        // Write the cached headers to disk (in pseudo-properties-format)
        File headers = new File(content.getAbsolutePath() + FILE_EXT_HEADERS);
        if (deleteCacheOnExit && !headers.exists()) {
            headers.deleteOnExit();
        }

        FileWriter writer = new FileWriter(headers);
        PrintWriter headerWriter = new PrintWriter(writer);
        try {
            String[] names = pCachedResponse.getHeaderNames();

            for (String name : names) {
                String[] values = pCachedResponse.getHeaderValues(name);

                headerWriter.print(name);
                headerWriter.print(": ");
                headerWriter.println(StringUtil.toCSVString(values, "\\"));
            }
        }
        finally {
            headerWriter.flush();
            try {
                writer.close();
            }
            catch (IOException e) {
                log("Error closing header stream: " + e.getMessage(), e);
            }
        }

        // TODO: Make this more robust, if some weird entity is not
        // consistent in it's vary-headers..
        // (sometimes Vary, sometimes not, or somtimes different Vary headers).

        // Write extra Vary info to disk
        String[] varyHeaders = pCachedResponse.getHeaderValues(HEADER_VARY);

        // If no variations, then don't store vary info
        if (varyHeaders != null && varyHeaders.length > 0) {
            Properties variations = getVaryProperties(pCacheURI);

            String vary = StringUtil.toCSVString(varyHeaders);
            variations.setProperty(HEADER_VARY, vary);

            // Create Vary-key and map to file extension...
            String varyKey = createVaryKey(varyHeaders, pRequest);
//            System.out.println("varyKey: " + varyKey);
//            System.out.println("extension: " + extension);
            variations.setProperty(varyKey, extension);

            storeVaryProperties(pCacheURI, variations);
        }
    }
99844
static PatchingTask createTask(final PatchingTasks.ContentTaskDefinition definition, final PatchContentProvider provider, final IdentityPatchContext.PatchEntry context) {
        final PatchContentLoader contentLoader = provider.getLoader(definition.getTarget().getPatchId());
        final PatchingTaskDescription description = PatchingTaskDescription.create(definition, contentLoader);
        return PatchingTask.Factory.create(description, context);
    }
1344010
private Response addContent(String spaceID, String contentID, String storeID) {

        StringBuilder msg = new StringBuilder("adding content(");
        msg.append(spaceID);
        msg.append(", ");
        msg.append(contentID);
        msg.append(", ");
        msg.append(storeID);
        msg.append(")");
        try {
            log.info(msg.toString());

            return doAddContent(spaceID, contentID, storeID);

        } catch (InvalidIdException e) {
            return responseBad(msg.toString(), e, BAD_REQUEST);

        } catch (ResourcePropertiesInvalidException e) {
            return responseBad(msg.toString(), BAD_REQUEST);

        } catch (ResourceNotFoundException e) {
            return responseNotFound(msg.toString(), e, NOT_FOUND);

        } catch (ResourceChecksumException e) {
            return responseBad(msg.toString(), e, CONFLICT);

        } catch (ResourceException e) {
            return responseBad(msg.toString(), e, INTERNAL_SERVER_ERROR);

        } catch (Exception e) {
            return responseBad(msg.toString(), e, INTERNAL_SERVER_ERROR);
        }
    }
702675
public synchronized void updateDocumentContent(Long docid, String content) throws SQLException {
        if (cache_document==CACHE_OFF) {
            edadb.updateDocumentContent(docid, content);
        } else if (cache_document==CACHE_ONLY) {
            Document docvo = documentCache.get(docid);
            if (docvo!=null) docvo.setContent(content);
        } else {
            edadb.updateDocumentContent(docid, content);
            Document docvo = documentCache.get(docid);
            if (docvo!=null) docvo.setContent(content);
        }
    }
227148
@Override
  public synchronized void recordAllocatedEvaluator(final String id) {
    if (this.fileSystem != null && this.changeLogLocation != null) {
      final String entry = ADD_FLAG + id + System.lineSeparator();
      this.logContainerChange(entry);
    }
  }
755802
private void loadListeners(ServiceLoader<LifecycleListener> loader) {
        Iterator<LifecycleListener> iterator = loader.iterator();
        while (hasNextSafely(iterator)) {
            try {
                LifecycleListener listener = iterator.next();
                listeners.add(listener);
                LOGGER.info(String.format("Found %s: %s", LifecycleListener.class, listener.getClass()));
            } catch (ServiceConfigurationError e) {
                LOGGER.error("iterator.next() failed", e);
            }
        }
    }
176598
public function deleteFields($contentId, VersionInfo $versionInfo)
    {
        foreach ($this->contentGateway->getFieldIdsByType($contentId, $versionInfo->versionNo) as $fieldType => $ids) {
            $this->storageHandler->deleteFieldData($fieldType, $versionInfo, $ids);
        }
        $this->contentGateway->deleteFields($contentId, $versionInfo->versionNo);
    }
128345
public boolean recordIdGenerator() {
    if (!currentInfo.isIdGenerator()) {
      currentInfo.setIdGenerator(true);
      populated = true;
      return true;
    } else {
      return false;
    }
  }
1323667
public PatchingResult rollbackLast(final ContentVerificationPolicy contentPolicy, final boolean resetConfiguration, InstallationManager.InstallationModification modification) throws PatchingException {

        // Determine the patch id to rollback
        String patchId;
        final List<String> oneOffs = modification.getPatchIDs();
        if (oneOffs.isEmpty()) {
            patchId = modification.getCumulativePatchID();
            if (patchId == null || Constants.NOT_PATCHED.equals(patchId)) {
                throw PatchLogger.ROOT_LOGGER.noPatchesApplied();
            }
        } else {
            patchId = oneOffs.get(0);//oneOffs.get(oneOffs.size() - 1);
        }
        return rollbackPatch(patchId, contentPolicy, false, resetConfiguration, modification);
    }
767841
public void setContentType(String contentType) throws InvalidArgumentException {
    if (Strings.isNullOrEmpty(contentType)) {
      throw new InvalidArgumentException("empty content type");
    }

    this.contentType = contentType;
  }