@Override public void writeServices( String resourceName, TextWriteHandle sourceHandle, ExtensionMetadata metadata, MethodParameters... methodParams ) { if (resourceName == null) throw new IllegalArgumentException("Writing resource services with null name"); if (logger.isInfoEnabled()) logger.info("Writing resource services source for {}", resourceName); HandleImplementation sourceBase = HandleAccessor.checkHandle(sourceHandle, "resource"); RequestParameters extraParams = (metadata != null) ? metadata.asParameters() : new RequestParameters(); if (methodParams != null) { for (MethodParameters params : methodParams) { String method = params.getMethod().toString().toLowerCase(); extraParams.add("method", method); String prefix = method+":"; for (Map.Entry<String,List<String>> entry: params.entrySet()) { extraParams.put(prefix+entry.getKey(), entry.getValue()); } } } services.putValue(requestLogger, "config/resources", resourceName, extraParams, "application/xquery", sourceBase); }
private void writeTransform( String transformName, String sourceMimetype, AbstractWriteHandle sourceHandle, ExtensionMetadata metadata) throws ResourceNotFoundException, ResourceNotResendableException, ForbiddenUserException, FailedRequestException { if (transformName == null) throw new IllegalArgumentException("Writing transform with null name"); if (sourceHandle == null) throw new IllegalArgumentException("Writing transform source with null handle"); if (logger.isInfoEnabled()) logger.info("Writing transform source for {}", transformName); HandleImplementation sourceBase = HandleAccessor.checkHandle(sourceHandle, "transform"); Format sourceFormat = sourceBase.getFormat(); if ("application/xquery".equals(sourceMimetype)) { if (Format.TEXT != sourceFormat) sourceBase.setFormat(Format.TEXT); } else if ("application/xslt+xml".equals(sourceMimetype)) { if (Format.XML != sourceFormat) sourceBase.setFormat(Format.XML); } else if ("application/javascript".equals(sourceMimetype)) { if (Format.JSON != sourceFormat) sourceBase.setFormat(Format.JSON); } else { throw new MarkLogicInternalException( "Unsupported mimetype for source: "+sourceMimetype); } if (!sourceMimetype.equals(sourceBase.getMimetype())) sourceBase.setMimetype(sourceMimetype); RequestParameters extraParams = (metadata != null) ? metadata.asParameters() : null; services.putValue(requestLogger, "config/transforms", transformName, extraParams, sourceMimetype, sourceBase); }
sourceBase.setMimetype(sourceMimetype); RequestParameters extraParams = (metadata != null) ? metadata.asParameters() : null; if (paramTypes != null) { if (extraParams == null)
(metadata != null) ? metadata.asParameters() : new RequestParameters(); if (methodParams != null) { for (MethodParameters params : methodParams) {