From 400ae81275b580858008e331c58af29721c2cb75 Mon Sep 17 00:00:00 2001 From: ehennum Date: Wed, 5 May 2021 15:11:54 -0700 Subject: [PATCH 01/12] #1296 base changes for Data Services using handles --- .../client/dataservices/InputCaller.java | 4 +- .../client/dataservices/InputEndpoint.java | 4 +- .../dataservices/InputOutputCaller.java | 11 +++- .../dataservices/InputOutputEndpoint.java | 4 +- .../client/dataservices/OutputCaller.java | 4 +- .../client/dataservices/OutputEndpoint.java | 4 +- .../dataservices/impl/ExecCallerImpl.java | 4 +- .../dataservices/impl/IOCallerImpl.java | 57 ++++++++++++++----- .../dataservices/impl/IOEndpointImpl.java | 2 +- .../dataservices/impl/InputCallerImpl.java | 13 ++--- .../dataservices/impl/InputEndpointImpl.java | 13 +++-- .../impl/InputOutputCallerImpl.java | 11 ++-- .../impl/InputOutputEndpointImpl.java | 13 ++--- .../dataservices/impl/OutputCallerImpl.java | 10 ++-- .../dataservices/impl/OutputEndpointImpl.java | 12 ++-- .../com/marklogic/client/impl/BaseProxy.java | 8 ++- .../io/marker/BufferableContentHandle.java | 6 +- .../io/marker/ResendableContentHandle.java | 4 +- .../io/marker/StreamingContentHandle.java | 9 +-- 19 files changed, 115 insertions(+), 78 deletions(-) diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputCaller.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputCaller.java index 00c1ab725..cd193850a 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputCaller.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputCaller.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 MarkLogic Corporation + * Copyright (c) 2021 MarkLogic Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,7 @@ public interface InputCaller extends IOEndpoint { * @return the InputCaller instance for calling the endpoint. */ static InputCaller on(DatabaseClient client, JSONWriteHandle apiDecl, BufferableContentHandle inputHandle) { - return new InputEndpointImpl(client, apiDecl, inputHandle); + return new InputEndpointImpl(client, apiDecl, false, inputHandle); } /** diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputEndpoint.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputEndpoint.java index 6dedb7a3e..0cb07f62d 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputEndpoint.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 MarkLogic Corporation + * Copyright (c) 2021 MarkLogic Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +39,7 @@ static InputEndpoint on(DatabaseClient client, JSONWriteHandle apiDecl) { final class EndpointLocal extends InputEndpointImpl implements InputEndpoint { private EndpointLocal(DatabaseClient client, JSONWriteHandle apiDecl) { - super(client, apiDecl, new InputStreamHandle()); + super(client, apiDecl, false, new InputStreamHandle()); } public InputEndpoint.BulkInputCaller bulkCaller() { return new BulkLocal(this); diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputOutputCaller.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputOutputCaller.java index 0d8e86a7f..35d1fe995 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputOutputCaller.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputOutputCaller.java @@ -44,9 +44,16 @@ public interface InputOutputCaller extends IOEndpoint { */ static InputOutputCaller on( DatabaseClient client, JSONWriteHandle apiDecl, - BufferableContentHandle inputHandle, BufferableContentHandle outputHandle + BufferableContentHandle inputHandle, BufferableContentHandle outputHandle ) { - return new InputOutputEndpointImpl(client, apiDecl, inputHandle, outputHandle); + return new InputOutputEndpointImpl(client, apiDecl, false, inputHandle, outputHandle); + } + + static ,O extends BufferableContentHandle> InputOutputCaller onHandles( + DatabaseClient client, JSONWriteHandle apiDecl, + I inputHandle, O outputHandle + ) { + return new InputOutputEndpointImpl(client, apiDecl, true, inputHandle, outputHandle); } /** diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputOutputEndpoint.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputOutputEndpoint.java index 34d38fff8..ae78fb870 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputOutputEndpoint.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputOutputEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 MarkLogic Corporation + * Copyright (c) 2021 MarkLogic Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ static InputOutputEndpoint on(DatabaseClient client, JSONWriteHandle apiDecl) { final class EndpointLocal extends InputOutputEndpointImpl implements InputOutputEndpoint { private EndpointLocal(DatabaseClient client, JSONWriteHandle apiDecl) { - super(client, apiDecl, new InputStreamHandle(), new InputStreamHandle()); + super(client, apiDecl, false, new InputStreamHandle(), new InputStreamHandle()); } public InputOutputEndpoint.BulkInputOutputCaller bulkCaller() { return new BulkLocal(this); diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/OutputCaller.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/OutputCaller.java index 02be0212c..6592b4807 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/OutputCaller.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/OutputCaller.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 MarkLogic Corporation + * Copyright (c) 2021 MarkLogic Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ public interface OutputCaller extends IOEndpoint { static OutputCaller on( DatabaseClient client, JSONWriteHandle apiDecl, BufferableContentHandle outputHandle ) { - return new OutputEndpointImpl(client, apiDecl, outputHandle); + return new OutputEndpointImpl(client, apiDecl, false, outputHandle); } /** diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/OutputEndpoint.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/OutputEndpoint.java index 517d7c290..4df9d4063 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/OutputEndpoint.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/OutputEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 MarkLogic Corporation + * Copyright (c) 2021 MarkLogic Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +39,7 @@ static OutputEndpoint on(DatabaseClient client, JSONWriteHandle apiDecl) { final class EndpointLocal extends OutputEndpointImpl implements OutputEndpoint { private EndpointLocal(DatabaseClient client, JSONWriteHandle apiDecl) { - super(client, apiDecl, new InputStreamHandle()); + super(client, apiDecl, false, new InputStreamHandle()); } public OutputEndpoint.BulkOutputCaller bulkCaller() { return new BulkLocal(this); diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/ExecCallerImpl.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/ExecCallerImpl.java index 4b7bd342e..85be58c64 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/ExecCallerImpl.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/ExecCallerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 MarkLogic Corporation + * Copyright (c) 2021 MarkLogic Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ final public class ExecCallerImpl extends IOCallerImpl { public ExecCallerImpl(JSONWriteHandle apiDeclaration) { - super(apiDeclaration, null, null); + super(apiDeclaration, false, null, null); if (getInputParamdef() != null) { throw new IllegalArgumentException("input parameter not supported in endpoint: "+ getEndpointPath()); diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/IOCallerImpl.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/IOCallerImpl.java index 0f7c62284..22214ec4f 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/IOCallerImpl.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/IOCallerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 MarkLogic Corporation + * Copyright (c) 2021 MarkLogic Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.marklogic.client.DatabaseClient; +import com.marklogic.client.MarkLogicInternalException; import com.marklogic.client.SessionState; import com.marklogic.client.impl.BaseProxy; import com.marklogic.client.impl.NodeConverter; @@ -24,18 +25,15 @@ import com.marklogic.client.io.BaseHandle; import com.marklogic.client.io.BytesHandle; import com.marklogic.client.io.marker.BufferableContentHandle; -import com.marklogic.client.io.marker.BufferableHandle; import com.marklogic.client.io.marker.JSONWriteHandle; -import java.util.stream.Stream; - abstract class IOCallerImpl extends BaseCallerImpl { private final JsonNode apiDeclaration; private final String endpointPath; private final BaseProxy.DBFunctionRequest requester; - private BufferableContentHandle inputHandle; - private BufferableContentHandle outputHandle; + private BufferableContentHandle inputHandle; + private BufferableContentHandle outputHandle; private ParamdefImpl endpointStateParamdef; private ParamdefImpl sessionParamdef; @@ -43,11 +41,16 @@ abstract class IOCallerImpl extends BaseCallerImpl { private ParamdefImpl inputParamdef; private ReturndefImpl returndef; + private boolean isHandleIO = false; + IOCallerImpl( - JSONWriteHandle apiDeclaration, BufferableContentHandle inputHandle, BufferableContentHandle outputHandle + JSONWriteHandle apiDeclaration, boolean isHandleIO, + BufferableContentHandle inputHandle, BufferableContentHandle outputHandle ) { super(); + this.isHandleIO = isHandleIO; + if (apiDeclaration== null) { throw new IllegalArgumentException("null endpoint declaration"); } @@ -178,18 +181,40 @@ abstract class IOCallerImpl extends BaseCallerImpl { ); } - BufferableContentHandle getInputHandle() { - return inputHandle; - } - BufferableContentHandle getOutputHandle() { + BufferableContentHandle getOutputHandle() { return outputHandle; } + BufferableContentHandle castInputAsHandle(I input) { + if (!isHandleIO) { + throw new MarkLogicInternalException("Cannot cast input to handle unless using handles for IO"); + } + return (BufferableContentHandle) input; + } + O castHandleAsOutput(BufferableContentHandle handle) { + if (!isHandleIO) { + throw new MarkLogicInternalException("Cannot cast handle to output unless using handles for IO"); + } + return (O) handle; + } + + BufferableContentHandle getContentInputHandle() { + if (isHandleIO) { + throw new MarkLogicInternalException("Cannot get handle for input when using handles for IO"); + } + return (BufferableContentHandle) inputHandle; + } + BufferableContentHandle getContentOutputHandle() { + if (isHandleIO) { + throw new MarkLogicInternalException("Cannot get handle for output when using handles for IO"); + } + return (BufferableContentHandle) outputHandle; + } BaseProxy.DBFunctionRequest makeRequest(DatabaseClient db, CallContextImpl callCtxt) { return makeRequest(db, callCtxt, (RESTServices.CallField) null); } BaseProxy.DBFunctionRequest makeRequest( - DatabaseClient db, CallContextImpl callCtxt, BufferableHandle[] input + DatabaseClient db, CallContextImpl callCtxt, BufferableContentHandle[] input ) { RESTServices.CallField inputField = null; @@ -286,10 +311,14 @@ O responseSingle(BaseProxy.DBFunctionRequest request) { throw new UnsupportedOperationException("multiple return from endpoint: "+getEndpointPath()); } - return request.responseSingle(getReturndef().isNullable(), getReturndef().getFormat()).asContent(outputHandle); + return request.responseSingle( + getReturndef().isNullable(), getReturndef().getFormat()).asContent(getContentOutputHandle() + ); } O[] responseMultipleAsArray(BaseProxy.DBFunctionRequest request, CallContextImpl callCtxt) { - return responseMultiple(request).asArrayOfContent(callCtxt.isLegacyContext() ? null : callCtxt.getEndpointState(), outputHandle); + return responseMultiple(request).asArrayOfContent( + callCtxt.isLegacyContext() ? null : callCtxt.getEndpointState(), getContentOutputHandle() + ); } private RESTServices.MultipleCallResponse responseMultiple(BaseProxy.DBFunctionRequest request) { if (getReturndef() == null) { diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/IOEndpointImpl.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/IOEndpointImpl.java index 77042abe8..af49aa4ec 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/IOEndpointImpl.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/IOEndpointImpl.java @@ -323,7 +323,7 @@ boolean checkQueue(BlockingQueue queue, int batchSize) { I[] getInputBatch(BlockingQueue queue, int batchSize) { List inputStreamList = new ArrayList<>(); queue.drainTo(inputStreamList, batchSize); - return inputStreamList.toArray(endpoint.getCaller().getInputHandle().newArray(inputStreamList.size())); + return inputStreamList.toArray(endpoint.getCaller().getContentInputHandle().newArray(inputStreamList.size())); } void processOutputBatch(O[] output, Consumer outputListener) { if (output == null || output.length == 0) return; diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputCallerImpl.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputCallerImpl.java index e1fe078de..d7b355854 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputCallerImpl.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputCallerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 MarkLogic Corporation + * Copyright (c) 2021 MarkLogic Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,16 +15,15 @@ */ package com.marklogic.client.dataservices.impl; -import java.util.stream.Stream; - import com.marklogic.client.DatabaseClient; import com.marklogic.client.io.marker.BufferableContentHandle; -import com.marklogic.client.io.marker.BufferableHandle; import com.marklogic.client.io.marker.JSONWriteHandle; final public class InputCallerImpl extends IOCallerImpl { - public InputCallerImpl(JSONWriteHandle apiDeclaration, BufferableContentHandle inputHandle) { - super(apiDeclaration, inputHandle, null); + public InputCallerImpl( + JSONWriteHandle apiDeclaration, boolean isHandleIO, BufferableContentHandle inputHandle + ) { + super(apiDeclaration, isHandleIO, inputHandle, null); if (getInputParamdef() == null) { throw new IllegalArgumentException("input parameter missing in endpoint: "+ getEndpointPath()); @@ -42,7 +41,7 @@ public InputCallerImpl(JSONWriteHandle apiDeclaration, BufferableContentHandle callCtxt, BufferableHandle[] input) { + public void arrayCall(DatabaseClient db, CallContextImpl callCtxt, BufferableContentHandle[] input) { responseWithState(makeRequest(db, callCtxt, input), callCtxt); } } diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputEndpointImpl.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputEndpointImpl.java index 675aa68fa..71ec0e019 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputEndpointImpl.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputEndpointImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 MarkLogic Corporation + * Copyright (c) 2021 MarkLogic Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ import com.marklogic.client.dataservices.InputCaller; import com.marklogic.client.io.marker.BufferableContentHandle; -import com.marklogic.client.io.marker.BufferableHandle; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,8 +34,10 @@ public class InputEndpointImpl extends IOEndpointImpl implements Input private final InputCallerImpl caller; private final int batchSize; - public InputEndpointImpl(DatabaseClient client, JSONWriteHandle apiDecl, BufferableContentHandle inputHandle) { - this(client, new InputCallerImpl<>(apiDecl, inputHandle)); + public InputEndpointImpl( + DatabaseClient client, JSONWriteHandle apiDecl, boolean isHandleIO, BufferableContentHandle inputHandle + ) { + this(client, new InputCallerImpl<>(apiDecl, isHandleIO, inputHandle)); } private InputEndpointImpl(DatabaseClient client, InputCallerImpl caller) { super(client, caller); @@ -58,7 +59,7 @@ public void call(I[] input) { @Override public void call(CallContext callContext, I[] input) { InputCallerImpl callerImpl = getCaller(); - callerImpl.arrayCall(getClient(), checkAllowedArgs(callContext), callerImpl.getInputHandle().resendableHandleFor(input)); + callerImpl.arrayCall(getClient(), checkAllowedArgs(callContext), callerImpl.getContentInputHandle().resendableHandleFor(input)); } @Deprecated @@ -196,7 +197,7 @@ private void processInput(CallContextImpl callContext, I[] inputBatch) { ErrorDisposition error = ErrorDisposition.RETRY; - BufferableHandle[] inputHandles = callerImpl.getInputHandle().resendableHandleFor(inputBatch); + BufferableContentHandle[] inputHandles = callerImpl.getContentInputHandle().resendableHandleFor(inputBatch); for (int retryCount = 0; retryCount < DEFAULT_MAX_RETRIES && error == ErrorDisposition.RETRY; retryCount++) { Throwable throwable = null; try { diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputOutputCallerImpl.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputOutputCallerImpl.java index 4638e70ae..5da936fed 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputOutputCallerImpl.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputOutputCallerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 MarkLogic Corporation + * Copyright (c) 2021 MarkLogic Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,18 +15,15 @@ */ package com.marklogic.client.dataservices.impl; -import java.util.stream.Stream; - import com.marklogic.client.DatabaseClient; import com.marklogic.client.io.marker.BufferableContentHandle; -import com.marklogic.client.io.marker.BufferableHandle; import com.marklogic.client.io.marker.JSONWriteHandle; final public class InputOutputCallerImpl extends IOCallerImpl { public InputOutputCallerImpl( - JSONWriteHandle apiDeclaration, BufferableContentHandle inputHandle, BufferableContentHandle outputHandle + JSONWriteHandle apiDeclaration, boolean isHandleIO, BufferableContentHandle inputHandle, BufferableContentHandle outputHandle ) { - super(apiDeclaration, inputHandle, outputHandle); + super(apiDeclaration, isHandleIO, inputHandle, outputHandle); if (getInputParamdef() == null) { throw new IllegalArgumentException("input parameter missing in endpoint: "+ getEndpointPath()); @@ -40,7 +37,7 @@ public InputOutputCallerImpl( } } - public O[] arrayCall(DatabaseClient db, CallContextImpl callCtxt, BufferableHandle[] input) { + public O[] arrayCall(DatabaseClient db, CallContextImpl callCtxt, BufferableContentHandle[] input) { return responseMultipleAsArray(makeRequest(db, callCtxt, input), callCtxt); } } diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputOutputEndpointImpl.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputOutputEndpointImpl.java index ce1e708c2..3f705ab1c 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputOutputEndpointImpl.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputOutputEndpointImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 MarkLogic Corporation + * Copyright (c) 2021 MarkLogic Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ import com.marklogic.client.SessionState; import com.marklogic.client.dataservices.InputOutputCaller; import com.marklogic.client.io.marker.BufferableContentHandle; -import com.marklogic.client.io.marker.BufferableHandle; import com.marklogic.client.io.marker.JSONWriteHandle; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,10 +34,10 @@ public class InputOutputEndpointImpl extends IOEndpointImpl implements private final int batchSize; public InputOutputEndpointImpl( - DatabaseClient client, JSONWriteHandle apiDecl, - BufferableContentHandle inputHandle, BufferableContentHandle outputHandle + DatabaseClient client, JSONWriteHandle apiDecl, boolean isHandleIO, + BufferableContentHandle inputHandle, BufferableContentHandle outputHandle ) { - this(client, new InputOutputCallerImpl<>(apiDecl, inputHandle, outputHandle)); + this(client, new InputOutputCallerImpl<>(apiDecl, isHandleIO, inputHandle, outputHandle)); } private InputOutputEndpointImpl(DatabaseClient client, InputOutputCallerImpl caller) { super(client, caller); @@ -103,7 +102,7 @@ public BulkInputOutputCaller bulkCaller(CallContext[] callContexts, int thr private O[] getResponseData(CallContext callContext, I[] input) { InputOutputCallerImpl callerImpl = getCaller(); return callerImpl.arrayCall( - getClient(), checkAllowedArgs(callContext), callerImpl.getInputHandle().resendableHandleFor(input) + getClient(), checkAllowedArgs(callContext), callerImpl.getContentInputHandle().resendableHandleFor(input) ); } @@ -201,7 +200,7 @@ private void processInput(CallContextImpl callContext, I[] inputBatch) { ErrorDisposition error = ErrorDisposition.RETRY; - BufferableHandle[] inputHandles = callerImpl.getInputHandle().resendableHandleFor(inputBatch); + BufferableContentHandle[] inputHandles = callerImpl.getContentInputHandle().resendableHandleFor(inputBatch); for (int retryCount = 0; retryCount < DEFAULT_MAX_RETRIES && error == ErrorDisposition.RETRY; retryCount++) { Throwable throwable = null; O[] output = null; diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/OutputCallerImpl.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/OutputCallerImpl.java index c1b0a114b..4e604d33c 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/OutputCallerImpl.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/OutputCallerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 MarkLogic Corporation + * Copyright (c) 2021 MarkLogic Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,15 +15,15 @@ */ package com.marklogic.client.dataservices.impl; -import java.util.stream.Stream; - import com.marklogic.client.DatabaseClient; import com.marklogic.client.io.marker.BufferableContentHandle; import com.marklogic.client.io.marker.JSONWriteHandle; final public class OutputCallerImpl extends IOCallerImpl { - public OutputCallerImpl(JSONWriteHandle apiDeclaration, BufferableContentHandle outputHandle) { - super(apiDeclaration, null, outputHandle); + public OutputCallerImpl( + JSONWriteHandle apiDeclaration, boolean isHandleIO, BufferableContentHandle outputHandle + ) { + super(apiDeclaration, isHandleIO, null, outputHandle); if (getInputParamdef() != null) { throw new IllegalArgumentException("input parameter not supported in endpoint: "+ getEndpointPath()); diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/OutputEndpointImpl.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/OutputEndpointImpl.java index f1b952708..3e94b3452 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/OutputEndpointImpl.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/OutputEndpointImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 MarkLogic Corporation + * Copyright (c) 2021 MarkLogic Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,8 +33,10 @@ public class OutputEndpointImpl extends IOEndpointImpl implements Outp private static final Logger logger = LoggerFactory.getLogger(OutputEndpointImpl.class); private final OutputCallerImpl caller; - public OutputEndpointImpl(DatabaseClient client, JSONWriteHandle apiDecl, BufferableContentHandle outputHandle) { - this(client, new OutputCallerImpl<>(apiDecl, outputHandle)); + public OutputEndpointImpl( + DatabaseClient client, JSONWriteHandle apiDecl, boolean isHandleIO, BufferableContentHandle outputHandle + ) { + this(client, new OutputCallerImpl<>(apiDecl, isHandleIO, outputHandle)); } private OutputEndpointImpl(DatabaseClient client, OutputCallerImpl caller) { super(client, caller); @@ -218,7 +220,7 @@ private O[] getOutputStream(CallContextImpl callContext) { if(callContext.getEndpoint().allowsEndpointState()) { callContext.withEndpointState(null); } - return getEndpoint().getCaller().getOutputHandle().newArray(0); + return getEndpoint().getCaller().getContentOutputHandle().newArray(0); case STOP_ALL_CALLS: if (getCallerThreadPoolExecutor() != null) { @@ -229,7 +231,7 @@ private O[] getOutputStream(CallContextImpl callContext) { } } - return (output == null) ? getEndpoint().getCaller().getOutputHandle().newArray(0) : output; + return (output == null) ? getEndpoint().getCaller().getContentOutputHandle().newArray(0) : output; } private void processOutput() { diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/impl/BaseProxy.java b/marklogic-client-api/src/main/java/com/marklogic/client/impl/BaseProxy.java index 8d67679d4..f39d113b1 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/impl/BaseProxy.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/impl/BaseProxy.java @@ -789,13 +789,15 @@ static public SingleAtomicCallField atomicParam(String paramName, boolean isNull static public MultipleAtomicCallField atomicParam(String paramName, boolean isNullable, Stream values) { return isParamNull(paramName, isNullable, values) ? null : new UnbufferedMultipleAtomicCallField(paramName, values); } - static public SingleNodeCallField documentParam(String paramName, boolean isNullable, BufferableHandle value) { + static public SingleNodeCallField documentParam(String paramName, boolean isNullable, BufferableContentHandle value) { return isParamNull(paramName, isNullable, value) ? null : new SingleNodeCallField(paramName, value); } - static public MultipleNodeCallField documentParam(String paramName, boolean isNullable, Stream values) { + static public MultipleNodeCallField documentParam( + String paramName, boolean isNullable, Stream> values + ) { return isParamNull(paramName, isNullable, values) ? null : new UnbufferedMultipleNodeCallField(paramName, values); } - static public MultipleNodeCallField documentParam(String paramName, boolean isNullable, BufferableHandle[] values) { + static public MultipleNodeCallField documentParam(String paramName, boolean isNullable, BufferableContentHandle[] values) { return isParamNull(paramName, isNullable, values) ? null : new BufferedMultipleNodeCallField(paramName, values); } static protected boolean isParamNull(String paramName, boolean isNullable, Object value) { diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/BufferableContentHandle.java b/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/BufferableContentHandle.java index 4d67429a1..faeb66a47 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/BufferableContentHandle.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/BufferableContentHandle.java @@ -48,15 +48,15 @@ public interface BufferableContentHandle extends BufferableHandle, Content * @param content the content * @return the resendable handle */ - BufferableHandle resendableHandleFor(C content); + BufferableContentHandle resendableHandleFor(C content); /** * Provides an array of handles that can resend an array of content. * @param content the array of content * @return the array of resendable handles */ - default BufferableHandle[] resendableHandleFor(C[] content) { + default BufferableContentHandle[] resendableHandleFor(C[] content) { if (content == null) return null; - BufferableHandle[] result = new BufferableHandle[content.length]; + BufferableContentHandle[] result = new BufferableContentHandle[content.length]; for (int i=0; i < content.length; i++) { result[i] = resendableHandleFor(content[i]); } diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/ResendableContentHandle.java b/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/ResendableContentHandle.java index 1e77650cf..5ecaa0069 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/ResendableContentHandle.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/ResendableContentHandle.java @@ -24,7 +24,7 @@ */ public interface ResendableContentHandle extends BufferableContentHandle { @Override - default BufferableHandle resendableHandleFor(C content) { - return (BufferableHandle) newHandle(content); + default BufferableContentHandle resendableHandleFor(C content) { + return (BufferableContentHandle) newHandle(content); } } diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/StreamingContentHandle.java b/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/StreamingContentHandle.java index 9e6870824..659d06ca4 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/StreamingContentHandle.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/StreamingContentHandle.java @@ -19,16 +19,17 @@ import com.marklogic.client.io.BytesHandle; /** - * A Streaming Content Handle provides an adapter for a content - * representation to allow the content to be read multiple times - * for purposes such as resending input when retrying after a + * A Streaming Content Handle provides an adapter for a streaming content + * representation to make it possible to construct a bufferable content + * representation so the content can be read multiple times for purposes + * such as resending input when retrying after a * failed request. * @param the handled content representation * @param the serialization when reading the content */ public interface StreamingContentHandle extends BufferableContentHandle { @Override - default BufferableHandle resendableHandleFor(C content) { + default BufferableContentHandle resendableHandleFor(C content) { return new BytesHandle(contentToBytes(content)) .withFormat(((BaseHandle) this).getFormat()); } From 883f1791e393e4b5d003dffb89dbcdf2f56a7c48 Mon Sep 17 00:00:00 2001 From: lling Date: Mon, 24 May 2021 10:31:49 -0700 Subject: [PATCH 02/12] Update Java Client API NOTICE.txt for releasing. --- NOTICE.txt | 6000 ++++++++++++++++++---------------------------------- 1 file changed, 2074 insertions(+), 3926 deletions(-) diff --git a/NOTICE.txt b/NOTICE.txt index f07a09780..a26dbbd6a 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -10,10 +10,9 @@ Unless required by applicable law or agreed to in writing, software distributed To the extent required by the applicable open source license, a complete machine-readable copy of the source code corresponding to such code is available upon request. This offer is valid to anyone in receipt of this information and shall expire three years following the date of the final distribution of this product version by MarkLogic. To obtain such source code, send an email to legal@marklogic.com. Please specify the product and version for which you are requesting source code. -The following software may be included in this project (last updated January 22, 2021): +The following software may be included in this project (last updated May 23, 2021): -  @angular-mdl/core 6.0.1 Attribution Statements http://mseemann.io/angular2-mdl/ @@ -188,17 +187,6 @@ License Text (http://spdx.org/licenses/MIT) Made available under the MIT License. See Appendix for full text. Source materials are available for download at: https://github.com/angular/angular-cli -Angular Material 7.3.1 -Attribution Statements -https://material.angular.io/ - -Copyright Statements -Copyright (c) 2019 Google LLC. - -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. - -Source materials are available for download at: https://github.com/angular/components angular-highcharts 6.2.6 Attribution Statements https://github.com/cebor/angular-highcharts @@ -538,6 +526,17 @@ License Text (http://spdx.org/licenses/Apache-2.0) Made available under the Apache License 2.0. See Appendix for full text. Source materials are available for download at: https://git-wip-us.apache.org/repos/asf?p=incubator-htrace.git +Apache HttpComponents™ HttpClient 4.2.3 +Attribution Statements +http://hc.apache.org/httpcomponents-client + +Copyright Statements +Copyright (C) The Apache Software Foundation + +License Text (http://spdx.org/licenses/Apache-2.0) +Made available under the Apache License 2.0. See Appendix for full text. + +Source materials are available for download at: http://hc.apache.org/httpcomponents-client Apache HttpComponents™ HttpClient 4.3.5 Attribution Statements https://hc.apache.org/httpcomponents-client-ga/index.html @@ -694,12 +693,12 @@ License Text (http://spdx.org/licenses/Apache-2.0.html) Made available under the Apache License 2.0. See Appendix for full text. Source materials are available for download at: https://github.com/apache/logging-log4j2 -Apache Thrift™ 0.13.0 +Apache Thrift™ 0.14.0 Attribution Statements http://thrift.apache.org Copyright Statements -Copyright (C) 2020, The Apache Software Foundation, Apache Thrift Developers +Copyright (C) 2021, The Apache Software Foundation, Apache Thrift Developers License Text (http://spdx.org/licenses/Apache-2.0.html) Made available under the Apache License 2.0. See Appendix for full text. @@ -732,3165 +731,901 @@ License Text (http://spdx.org/licenses/Apache-2.0) Made available under the Apache License 2.0. See Appendix for full text. Source materials are available for download at: http://maven.ibiblio.org/maven2/org/apache/zookeeper/zookeeper -Apache™ Hadoop® 2.6.2 +Apache™ Hadoop® 2.7.2 Attribution Statements http://hadoop.apache.org/ -This product includes software developed by The Apache Software -Foundation (http://www.apache.org/). +This product bundles various third-party components under other open source +licenses. This section summarizes those components and their licenses. +See licenses/ for text of these licenses. -The binary distribution of this product bundles binaries of -org.iq80.leveldb:leveldb-api (https://github.com/dain/leveldb), which has the -following notices: -* Copyright 2011 Dain Sundstrom -* Copyright 2011 FuseSource Corp. http://fusesource.com - -The binary distribution of this product bundles binaries of -AWS SDK for Java - Bundle 1.11.134, -AWS Java SDK for AWS KMS 1.11.134, -AWS Java SDK for Amazon S3 1.11.134, -AWS Java SDK for AWS STS 1.11.134, -JMES Path Query library 1.0, -which has the following notices: - * This software includes third party software subject to the following - copyrights: - XML parsing and utility functions from JetS3t - Copyright - 2006-2009 James Murty. - JSON parsing and utility functions from JSON.org - - Copyright 2002 JSON.org. - PKCS#1 PEM encoded private key parsing and utility - functions from oauth.googlecode.com - Copyright 1998-2010 AOL Inc. - -The binary distribution of this product bundles binaries of -Gson 2.2.4, -which has the following notices: - The Netty Project - ================= +Apache Software Foundation License 2.0 +-------------------------------------- -Please visit the Netty web site for more information: +hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/nvd3-1.8.5.* (css and js files) +hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/checker/AbstractFuture.java +hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/checker/TimeoutFuture.java - * http://netty.io/ -Copyright 2014 The Netty Project +BSD 2-Clause +------------ -The Netty Project licenses this file to you under the Apache License, -version 2.0 (the "License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at: +hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/compress/lz4/{lz4.h,lz4.c,lz4hc.h,lz4hc.c} +hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/util/tree.h +hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/compat/{fstatat|openat|unlinkat}.h - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -License for the specific language governing permissions and limitations -under the License. +BSD 3-Clause +------------ -Also, please refer to each LICENSE..txt file, which is located in -the 'license' directory of the distribution file, for the license terms of the -components that this product depends on. +hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/bloom/* +hadoop-common-project/hadoop-common/src/main/native/gtest/gtest-all.cc +hadoop-common-project/hadoop-common/src/main/native/gtest/include/gtest/gtest.h +hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/util/bulk_crc32_x86.c +hadoop-tools/hadoop-sls/src/main/html/js/thirdparty/d3.v3.js +hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/d3-3.5.17.min.js -------------------------------------------------------------------------------- -This product contains the extensions to Java Collections Framework which has -been derived from the works by JSR-166 EG, Doug Lea, and Jason T. Greene: - * LICENSE: - * license/LICENSE.jsr166y.txt (Public Domain) - * HOMEPAGE: - * http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/ - * http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbosscache/experimental/jsr166/ +MIT License +----------- -This product contains a modified version of Robert Harder's Public Domain -Base64 Encoder and Decoder, which can be obtained at: +hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/angular-1.6.4.min.js +hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/angular-nvd3-1.0.9.min.js +hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/angular-route-1.6.4.min.js +hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/bootstrap-3.4.1 +hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/dataTables.bootstrap.css +hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/dataTables.bootstrap.js +hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/dust-full-2.0.0.min.js +hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/dust-helpers-1.1.1.min.js +hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/jquery-3.5.1.min.js +hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/jquery.dataTables.min.js +hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/moment.min.js +hadoop-tools/hadoop-sls/src/main/html/js/thirdparty/bootstrap.min.js +hadoop-tools/hadoop-sls/src/main/html/js/thirdparty/jquery.js +hadoop-tools/hadoop-sls/src/main/html/css/bootstrap.min.css +hadoop-tools/hadoop-sls/src/main/html/css/bootstrap-responsive.min.css +hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/webapps/static/dt-1.10.18/* +hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/webapps/static/jquery +hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/webapps/static/jt/jquery.jstree.js +hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/resources/TERMINAL - * LICENSE: - * license/LICENSE.base64.txt (Public Domain) - * HOMEPAGE: - * http://iharder.sourceforge.net/current/java/base64/ +======= +For hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/utils/cJSON.[ch]: -This product contains a modified portion of 'Webbit', an event based -WebSocket and HTTP server, which can be obtained at: +Copyright (c) 2009-2017 Dave Gamble and cJSON contributors - * LICENSE: - * license/LICENSE.webbit.txt (BSD License) - * HOMEPAGE: - * https://github.com/joewalnes/webbit +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -This product contains a modified portion of 'SLF4J', a simple logging -facade for Java, which can be obtained at: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. - * LICENSE: - * license/LICENSE.slf4j.txt (MIT License) - * HOMEPAGE: - * http://www.slf4j.org/ +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. -This product contains a modified portion of 'ArrayDeque', written by Josh -Bloch of Google, Inc: +// ------------------------------------------------------------------ +// NOTICE file corresponding to the section 4d of The Apache License, +// Version 2.0, in this case for +// ------------------------------------------------------------------ - * LICENSE: - * license/LICENSE.deque.txt (Public Domain) -This product contains a modified portion of 'Apache Harmony', an open source -Java SE, which can be obtained at: +Apache Yetus +Copyright 2008-2017 The Apache Software Foundation - * LICENSE: - * license/LICENSE.harmony.txt (Apache License 2.0) - * HOMEPAGE: - * http://archive.apache.org/dist/harmony/ +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). -This product contains a modified version of Roland Kuhn's ASL2 -AbstractNodeQueue, which is based on Dmitriy Vyukov's non-intrusive MPSC queue. -It can be obtained at: +--- +Additional licenses for the Apache Yetus Source/Website: +--- - * LICENSE: - * license/LICENSE.abstractnodequeue.txt (Public Domain) - * HOMEPAGE: - * https://github.com/akka/akka/blob/wip-2.2.3-for-scala-2.11/akka-actor/src/main/java/akka/dispatch/AbstractNodeQueue.java -This product contains a modified portion of 'jbzip2', a Java bzip2 compression -and decompression library written by Matthew J. Francis. It can be obtained at: +See LICENSE for terms. - * LICENSE: - * license/LICENSE.jbzip2.txt (MIT License) - * HOMEPAGE: - * https://code.google.com/p/jbzip2/ -This product contains a modified portion of 'libdivsufsort', a C API library to construct -the suffix array and the Burrows-Wheeler transformed string for any input string of -a constant-size alphabet written by Yuta Mori. It can be obtained at: - * LICENSE: - * license/LICENSE.libdivsufsort.txt (MIT License) - * HOMEPAGE: - * https://code.google.com/p/libdivsufsort/ +Apache Avro +Copyright 2010 The Apache Software Foundation -This product contains a modified portion of Nitsan Wakart's 'JCTools', Java Concurrency Tools for the JVM, - which can be obtained at: +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). - * LICENSE: - * license/LICENSE.jctools.txt (ASL2 License) - * HOMEPAGE: - * https://github.com/JCTools/JCTools +C JSON parsing provided by Jansson and +written by Petri Lehtinen. The original software is +available from http://www.digip.org/jansson/. -This product optionally depends on 'JZlib', a re-implementation of zlib in -pure Java, which can be obtained at: - * LICENSE: - * license/LICENSE.jzlib.txt (BSD style License) - * HOMEPAGE: - * http://www.jcraft.com/jzlib/ +AWS SDK for Java +Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved. -This product optionally depends on 'Compress-LZF', a Java library for encoding and -decoding data in LZF format, written by Tatu Saloranta. It can be obtained at: +This product includes software developed by +Amazon Technologies, Inc (http://www.amazon.com/). - * LICENSE: - * license/LICENSE.compress-lzf.txt (Apache License 2.0) - * HOMEPAGE: - * https://github.com/ning/compress +********************** +THIRD PARTY COMPONENTS +********************** +This software includes third party software subject to the following copyrights: +- XML parsing and utility functions from JetS3t - Copyright 2006-2009 James Murty. +- PKCS#1 PEM encoded private key parsing and utility functions from oauth.googlecode.com - Copyright 1998-2010 AOL Inc. -This product optionally depends on 'lz4', a LZ4 Java compression -and decompression library written by Adrien Grand. It can be obtained at: +The licenses for these third party components are included in LICENSE.txt - * LICENSE: - * license/LICENSE.lz4.txt (Apache License 2.0) - * HOMEPAGE: - * https://github.com/jpountz/lz4-java -This product optionally depends on 'lzma-java', a LZMA Java compression -and decompression library, which can be obtained at: +Apache Commons BeanUtils +Copyright 2000-2016 The Apache Software Foundation - * LICENSE: - * license/LICENSE.lzma-java.txt (Apache License 2.0) - * HOMEPAGE: - * https://github.com/jponge/lzma-java +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). -This product contains a modified portion of 'jfastlz', a Java port of FastLZ compression -and decompression library written by William Kinney. It can be obtained at: - * LICENSE: - * license/LICENSE.jfastlz.txt (MIT License) - * HOMEPAGE: - * https://code.google.com/p/jfastlz/ +Apache Commons CLI +Copyright 2001-2009 The Apache Software Foundation -This product contains a modified portion of and optionally depends on 'Protocol Buffers', Google's data -interchange format, which can be obtained at: +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). - * LICENSE: - * license/LICENSE.protobuf.txt (New BSD License) - * HOMEPAGE: - * http://code.google.com/p/protobuf/ -This product optionally depends on 'Bouncy Castle Crypto APIs' to generate -a temporary self-signed X.509 certificate when the JVM does not provide the -equivalent functionality. It can be obtained at: +Apache Commons Codec +Copyright 2002-2017 The Apache Software Foundation - * LICENSE: - * license/LICENSE.bouncycastle.txt (MIT License) - * HOMEPAGE: - * http://www.bouncycastle.org/ +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). -This product optionally depends on 'Snappy', a compression library produced -by Google Inc, which can be obtained at: +src/test/org/apache/commons/codec/language/DoubleMetaphoneTest.java +contains test data from http://aspell.net/test/orig/batch0.tab. +Copyright (C) 2002 Kevin Atkinson (kevina@gnu.org) - * LICENSE: - * license/LICENSE.snappy.txt (New BSD License) - * HOMEPAGE: - * http://code.google.com/p/snappy/ +=============================================================================== -This product optionally depends on 'JBoss Marshalling', an alternative Java -serialization API, which can be obtained at: +The content of package org.apache.commons.codec.language.bm has been translated +from the original php source code available at http://stevemorse.org/phoneticinfo.htm +with permission from the original authors. +Original source copyright: +Copyright (c) 2008 Alexander Beider & Stephen P. Morse. - * LICENSE: - * license/LICENSE.jboss-marshalling.txt (GNU LGPL 2.1) - * HOMEPAGE: - * http://www.jboss.org/jbossmarshalling -This product optionally depends on 'Caliper', Google's micro- -benchmarking framework, which can be obtained at: +Apache Commons Collections +Copyright 2001-2018 The Apache Software Foundation - * LICENSE: - * license/LICENSE.caliper.txt (Apache License 2.0) - * HOMEPAGE: - * http://code.google.com/p/caliper/ +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). -This product optionally depends on 'Apache Commons Logging', a logging -framework, which can be obtained at: - * LICENSE: - * license/LICENSE.commons-logging.txt (Apache License 2.0) - * HOMEPAGE: - * http://commons.apache.org/logging/ +Apache Commons Compress +Copyright 2002-2018 The Apache Software Foundation -This product optionally depends on 'Apache Log4J', a logging framework, which -can be obtained at: +This product includes software developed at +The Apache Software Foundation (https://www.apache.org/). - * LICENSE: - * license/LICENSE.log4j.txt (Apache License 2.0) - * HOMEPAGE: - * http://logging.apache.org/log4j/ +The files in the package org.apache.commons.compress.archivers.sevenz +were derived from the LZMA SDK, version 9.20 (C/ and CPP/7zip/), +which has been placed in the public domain: -This product optionally depends on 'Aalto XML', an ultra-high performance -non-blocking XML processor, which can be obtained at: +"LZMA SDK is placed in the public domain." (http://www.7-zip.org/sdk.html) - * LICENSE: - * license/LICENSE.aalto-xml.txt (Apache License 2.0) - * HOMEPAGE: - * http://wiki.fasterxml.com/AaltoHome -This product contains a modified version of 'HPACK', a Java implementation of -the HTTP/2 HPACK algorithm written by Twitter. It can be obtained at: +Apache Commons Configuration +Copyright 2001-2017 The Apache Software Foundation - * LICENSE: - * license/LICENSE.hpack.txt (Apache License 2.0) - * HOMEPAGE: - * https://github.com/twitter/hpack +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). -This product contains a modified portion of 'Apache Commons Lang', a Java library -provides utilities for the java.lang API, which can be obtained at: - * LICENSE: - * license/LICENSE.commons-lang.txt (Apache License 2.0) - * HOMEPAGE: - * https://commons.apache.org/proper/commons-lang/ +Apache Commons CSV +Copyright 2005-2014 The Apache Software Foundation -This product contains a modified portion of 'JDOM 1.1', which can be obtained at: +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). - * LICENSE: - * https://github.com/hunterhacker/jdom/blob/jdom-1.1/core/LICENSE.txt - * HOMEPAGE: - * http://www.jdom.org/ - -The binary distribution of this product bundles binaries of -Commons Codec 1.4, -which has the following notices: - * src/test/org/apache/commons/codec/language/DoubleMetaphoneTest.javacontains test data from http://aspell.net/test/orig/batch0.tab.Copyright (C) 2002 Kevin Atkinson (kevina@gnu.org) - =============================================================================== - The content of package org.apache.commons.codec.language.bm has been translated - from the original php source code available at http://stevemorse.org/phoneticinfo.htm - with permission from the original authors. - Original source copyright:Copyright (c) 2008 Alexander Beider & Stephen P. Morse. - -The binary distribution of this product bundles binaries of -Commons Lang 2.6, -which has the following notices: - * This product includes software from the Spring Framework,under the Apache License 2.0 (see: StringUtils.containsWhitespace()) +src/main/resources/contract.txt +This file was downloaded from http://www.ferc.gov/docs-filing/eqr/soft-tools/sample-csv/contract.txt and contains neither copyright notice nor license. -The binary distribution of this product bundles binaries of -Apache Log4j 1.2.17, -which has the following notices: - * ResolverUtil.java - Copyright 2005-2006 Tim Fennell - Dumbster SMTP test server - Copyright 2004 Jason Paul Kitchen - TypeUtil.java - Copyright 2002-2012 Ramnivas Laddad, Juergen Hoeller, Chris Beams +src/main/resources/transaction.txt +This file was downloaded from http://www.ferc.gov/docs-filing/eqr/soft-tools/sample-csv/transaction.txt and contains neither copyright notice nor license. -The binary distribution of this product bundles binaries of -"Java Concurrency in Practice" book annotations 1.0, -which has the following notices: - * Copyright (c) 2005 Brian Goetz and Tim Peierls Released under the Creative - Commons Attribution License (http://creativecommons.org/licenses/by/2.5) - Official home: http://www.jcip.net Any republication or derived work - distributed in source code form must include this copyright and license - notice. +src/test/resources/CSVFileParser/bom.csv +src/test/resources/CSVFileParser/test.csv +src/test/resources/CSVFileParser/test_default.txt +src/test/resources/CSVFileParser/test_default_comment.txt +src/test/resources/CSVFileParser/test_rfc4180.txt +src/test/resources/CSVFileParser/test_rfc4180_trim.txt +src/test/resources/CSVFileParser/testCSV85.csv +src/test/resources/CSVFileParser/testCSV85_default.txt +src/test/resources/CSVFileParser/testCSV85_ignoreEmpty.txt +These files are used as test data and test result specifications. -The binary distribution of this product bundles binaries of -Jetty :: Http Utility 9.3.19., -Jetty :: IO Utility 9.3.19., -Jetty :: Security 9.3.19., -Jetty :: Server Core 9.3.19., -Jetty :: Servlet Handling 9.3.19., -Jetty :: Utilities 9.3.19., -Jetty :: Utilities :: Ajax, -Jetty :: Webapp Application Support 9.3.19., -Jetty :: XML utilities 9.3.19., -which has the following notices: - * ============================================================== - Jetty Web Container - Copyright 1995-2016 Mort Bay Consulting Pty Ltd. - ============================================================== - The Jetty Web Container is Copyright Mort Bay Consulting Pty Ltd - unless otherwise noted. +Apache Commons Daemon +Copyright 1999-2013 The Apache Software Foundation - Jetty is dual licensed under both +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). - * The Apache 2.0 License - http://www.apache.org/licenses/LICENSE-2.0.html - and +Apache Commons Digester +Copyright 2001-2008 The Apache Software Foundation - * The Eclipse Public 1.0 License - http://www.eclipse.org/legal/epl-v10.html +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). - Jetty may be distributed under either license. - ------ - Eclipse +Apache Commons IO +Copyright 2002-2016 The Apache Software Foundation - The following artifacts are EPL. - * org.eclipse.jetty.orbit:org.eclipse.jdt.core +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). - The following artifacts are EPL and ASL2. - * org.eclipse.jetty.orbit:javax.security.auth.message +Apache Commons Lang +Copyright 2001-2017 The Apache Software Foundation - The following artifacts are EPL and CDDL 1.0. - * org.eclipse.jetty.orbit:javax.mail.glassfish +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). +This product includes software from the Spring Framework, +under the Apache License 2.0 (see: StringUtils.containsWhitespace()) - ------ - Oracle - The following artifacts are CDDL + GPLv2 with classpath exception. - https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html +Apache Commons Logging +Copyright 2003-2013 The Apache Software Foundation - * javax.servlet:javax.servlet-api - * javax.annotation:javax.annotation-api - * javax.transaction:javax.transaction-api - * javax.websocket:javax.websocket-api +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). - ------ - Oracle OpenJDK - If ALPN is used to negotiate HTTP/2 connections, then the following - artifacts may be included in the distribution or downloaded when ALPN - module is selected. +Apache Commons Math +Copyright 2001-2012 The Apache Software Foundation - * java.sun.security.ssl +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). - These artifacts replace/modify OpenJDK classes. The modififications - are hosted at github and both modified and original are under GPL v2 with - classpath exceptions. - http://openjdk.java.net/legal/gplv2+ce.html +=============================================================================== + +The BracketFinder (package org.apache.commons.math3.optimization.univariate) +and PowellOptimizer (package org.apache.commons.math3.optimization.general) +classes are based on the Python code in module "optimize.py" (version 0.5) +developed by Travis E. Oliphant for the SciPy library (http://www.scipy.org/) +Copyright © 2003-2009 SciPy Developers. +=============================================================================== + +The LinearConstraint, LinearObjectiveFunction, LinearOptimizer, +RelationShip, SimplexSolver and SimplexTableau classes in package +org.apache.commons.math3.optimization.linear include software developed by +Benjamin McCann (http://www.benmccann.com) and distributed with +the following copyright: Copyright 2009 Google Inc. +=============================================================================== + +This product includes software developed by the +University of Chicago, as Operator of Argonne National +Laboratory. +The LevenbergMarquardtOptimizer class in package +org.apache.commons.math3.optimization.general includes software +translated from the lmder, lmpar and qrsolv Fortran routines +from the Minpack package +Minpack Copyright Notice (1999) University of Chicago. All rights reserved +=============================================================================== + +The GraggBulirschStoerIntegrator class in package +org.apache.commons.math3.ode.nonstiff includes software translated +from the odex Fortran routine developed by E. Hairer and G. Wanner. +Original source copyright: +Copyright (c) 2004, Ernst Hairer +=============================================================================== +The EigenDecompositionImpl class in package +org.apache.commons.math3.linear includes software translated +from some LAPACK Fortran routines. Original source copyright: +Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. +=============================================================================== - ------ - OW2 +The MersenneTwister class in package org.apache.commons.math3.random +includes software translated from the 2002-01-26 version of +the Mersenne-Twister generator written in C by Makoto Matsumoto and Takuji +Nishimura. Original source copyright: +Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, +All rights reserved +=============================================================================== - The following artifacts are licensed by the OW2 Foundation according to the - terms of http://asm.ow2.org/license.html +The LocalizedFormatsTest class in the unit tests is an adapted version of +the OrekitMessagesTest class from the orekit library distributed under the +terms of the Apache 2 licence. Original source copyright: +Copyright 2010 CS Systèmes d'Information +=============================================================================== - org.ow2.asm:asm-commons - org.ow2.asm:asm +The HermiteInterpolator class and its corresponding test have been imported from +the orekit library distributed under the terms of the Apache 2 licence. Original +source copyright: +Copyright 2010-2012 CS Systèmes d'Information +=============================================================================== +The creation of the package "o.a.c.m.analysis.integration.gauss" was inspired +by an original code donated by Sébastien Brisard. +=============================================================================== - ------ - Apache - The following artifacts are ASL2 licensed. +The complete text of licenses and disclaimers associated with the the original +sources enumerated above at the time of code translation are in the LICENSE.txt +file. - org.apache.taglibs:taglibs-standard-spec - org.apache.taglibs:taglibs-standard-impl +Apache Commons Net +Copyright 2001-2017 The Apache Software Foundation - ------ - MortBay +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). - The following artifacts are ASL2 licensed. Based on selected classes from - following Apache Tomcat jars, all ASL2 licensed. - org.mortbay.jasper:apache-jsp - org.apache.tomcat:tomcat-jasper - org.apache.tomcat:tomcat-juli - org.apache.tomcat:tomcat-jsp-api - org.apache.tomcat:tomcat-el-api - org.apache.tomcat:tomcat-jasper-el - org.apache.tomcat:tomcat-api - org.apache.tomcat:tomcat-util-scan - org.apache.tomcat:tomcat-util +Apache Commons Text +Copyright 2014-2018 The Apache Software Foundation - org.mortbay.jasper:apache-el - org.apache.tomcat:tomcat-jasper-el - org.apache.tomcat:tomcat-el-api +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). - ------ - Mortbay +Apache Commons Validator +Copyright 2001-2017 The Apache Software Foundation - The following artifacts are CDDL + GPLv2 with classpath exception. +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). - https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html - org.eclipse.jetty.toolchain:jetty-schemas +Apache Curator +Copyright 2013-2014 The Apache Software Foundation - ------ - Assorted +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). - The UnixCrypt.java code implements the one way cryptography used by - Unix systems for simple password protection. Copyright 1996 Aki Yoshida, - modified April 2001 by Iris Van den Broeke, Daniel Deville. - Permission to use, copy, modify and distribute UnixCrypt - for non-commercial or commercial purposes and without fee is - granted provided that the copyright notice appears in all copies./ -The binary distribution of this product bundles binaries of -Snappy for Java 1.0.4.1, -which has the following notices: - * This product includes software developed by Google - Snappy: http://code.google.com/p/snappy/ (New BSD License) +Ehcache V3 +Copyright 2014-2016 Terracotta, Inc. - This product includes software developed by Apache - PureJavaCrc32C from apache-hadoop-common http://hadoop.apache.org/ - (Apache 2.0 license) +The product includes software from the Apache Commons Lang project, +under the Apache License 2.0 (see: org.ehcache.impl.internal.classes.commonslang) - This library containd statically linked libstdc++. This inclusion is allowed by - "GCC RUntime Library Exception" - http://gcc.gnu.org/onlinedocs/libstdc++/manual/license.html - == Contributors == - * Tatu Saloranta - * Providing benchmark suite - * Alec Wysoker - * Performance and memory usage improvement +Apache Geronimo +Copyright 2003-2018 The Apache Software Foundation -The binary distribution of this product bundles binaries of -Xerces2 Java Parser 2.9.1, -which has the following notices: - * ========================================================================= - == NOTICE file corresponding to section 4(d) of the Apache License, == - == Version 2.0, in this case for the Apache Xerces Java distribution. == - ========================================================================= +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). - Apache Xerces Java - Copyright 1999-2007 The Apache Software Foundation - This product includes software developed at - The Apache Software Foundation (http://www.apache.org/). +Copyright 2014 The gRPC Authors - Portions of this software were originally based on the following: - - software copyright (c) 1999, IBM Corporation., http://www.ibm.com. - - software copyright (c) 1999, Sun Microsystems., http://www.sun.com. - - voluntary contributions made by Paul Eng on behalf of the - Apache Software Foundation that were originally developed at iClick, Inc., - software copyright (c) 1999. - -The binary distribution of this product bundles binaries of -Logback Classic Module 1.1.2, -Logback Core Module 1.1.2, -which has the following notices: - * Logback: the reliable, generic, fast and flexible logging framework. - Copyright (C) 1999-2012, QOS.ch. All rights reserved. - -The binary distribution of this product bundles binaries of -Apache HBase - Annotations 1.2.6, -Apache HBase - Client 1.2.6, -Apache HBase - Common 1.2.6, -Apache HBase - Hadoop Compatibility 1.2.6, -Apache HBase - Hadoop Two Compatibility 1.2.6, -Apache HBase - Prefix Tree 1.2.6, -Apache HBase - Procedure 1.2.6, -Apache HBase - Protocol 1.2.6, -Apache HBase - Server 1.2.6, -which has the following notices: - * Apache HBase - Copyright 2007-2015 The Apache Software Foundation - - This product includes software developed at - The Apache Software Foundation (http://www.apache.org/). - - -- - This product incorporates portions of the 'Hadoop' project - - Copyright 2007-2009 The Apache Software Foundation - - Licensed under the Apache License v2.0 - -- - Our Orca logo we got here: http://www.vectorfree.com/jumping-orca - It is licensed Creative Commons Attribution 3.0. - See https://creativecommons.org/licenses/by/3.0/us/ - We changed the logo by stripping the colored background, inverting - it and then rotating it some. - - Later we found that vectorfree.com image is not properly licensed. - The original is owned by vectorportal.com. The original was - relicensed so we could use it as Creative Commons Attribution 3.0. - The license is bundled with the download available here: - http://www.vectorportal.com/subcategory/205/KILLER-WHALE-FREE-VECTOR.eps/ifile/9136/detailtest.asp - -- - This product includes portions of the Bootstrap project v3.0.0 - - Copyright 2013 Twitter, Inc. - - Licensed under the Apache License v2.0 - - This product uses the Glyphicons Halflings icon set. - - http://glyphicons.com/ - - Copyright Jan Kova?ík - - Licensed under the Apache License v2.0 as a part of the Bootstrap project. - - -- - This product includes portions of the Guava project v14, specifically - 'hbase-common/src/main/java/org/apache/hadoop/hbase/io/LimitInputStream.java' - - Copyright (C) 2007 The Guava Authors - - Licensed under the Apache License, Version 2.0 - -The binary distribution of this product bundles binaries of -Phoenix Core 4.7.0, -which has the following notices: - Apache Phoenix - Copyright 2013-2016 The Apache Software Foundation - - This product includes software developed by The Apache Software - Foundation (http://www.apache.org/). - - This also includes: - - The phoenix-spark module has been adapted from the phoenix-spark library - distributed under the terms of the Apache 2 license. Original source copyright: - Copyright 2014 Simply Measured, Inc. - Copyright 2015 Interset Software Inc. - - The file bin/daemon.py is based on the file of the same name in python-daemon 2.0.5 - (https://pypi.python.org/pypi/python-daemon/). Original source copyright: - # Copyright © 2008–2015 Ben Finney - # Copyright © 2007–2008 Robert Niederreiter, Jens Klein - # Copyright © 2004–2005 Chad J. Schroeder - # Copyright © 2003 Clark Evans - # Copyright © 2002 Noah Spurrier - # Copyright © 2001 Jürgen Hermann - -The binary distribution of this product bundles binaries of -Plexus Cipher: encryption/decryption Component 1.4, -which has the following notices: - * The code in this component contains a class - Base64 taken from http://juliusdavies.ca/svn/not-yet-commons-ssl/tags/commons-ssl-0.3.10/src/java/org/apache/commons/ssl/Base64.java - which is Apache license: http://www.apache.org/licenses/LICENSE-2.0 - - The PBE key processing routine PBECipher.createCipher() is adopted from http://juliusdavies.ca/svn/not-yet-commons-ssl/tags/commons-ssl-0.3.10/src/java/org/apache/commons/ssl/OpenSSL.java - which is also Apache APL-2.0 license: http://www.apache.org/licenses/LICENSE-2.0 - -The binary distribution of this product bundles binaries of -software.amazon.ion:ion-java 1.0.1, -which has the following notices: - * Amazon Ion Java Copyright 2007-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. - -The binary distribution of this product bundles binaries of -joda-time:joda-time:2.9.9 -which has the following notices: - * ============================================================================= - = NOTICE file corresponding to section 4d of the Apache License Version 2.0 = - ============================================================================= - This product includes software developed by - Joda.org (http://www.joda.org/). - -The binary distribution of this product bundles binaries of -Ehcache 3.3.1, -which has the following notices: - * Ehcache V3 Copyright 2014-2016 Terracotta, Inc. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at -The binary distribution of this product bundles binaries of -snakeyaml (https://bitbucket.org/asomov/snakeyaml), -which has the following notices: - * Copyright (c) 2008, http://www.snakeyaml.org + http://www.apache.org/licenses/LICENSE-2.0 -The binary distribution of this product bundles binaries of -swagger-annotations (https://github.com/swagger-api/swagger-core), -which has the following notices: - * Copyright 2016 SmartBear Software +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. -Copyright Statements -Copyright (C) 2017, The Apache Software Foundation +----------------------------------------------------------------------- -License Text (http://spdx.org/licenses/Apache-2.0) -Made available under the Apache License 2.0. See Appendix for full text. +This product contains a modified portion of 'OkHttp', an open source +HTTP & SPDY client for Android and Java applications, which can be obtained +at: -APACHE HADOOP SUBCOMPONENTS: - -The Apache Hadoop project contains subcomponents with separate copyright -notices and license terms. Your use of the source code for the these -subcomponents is subject to the terms and conditions of the following -licenses. - -For the org.apache.hadoop.util.bloom.* classes: - -/** - * - * Copyright (c) 2005, European Commission project OneLab under contract - * 034819 (http://www.one-lab.org) - * All rights reserved. - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. - * - Neither the name of the University Catholique de Louvain - UCL - * nor the names of its contributors may be used to endorse or - * promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -For portions of the native implementation of slicing-by-8 CRC calculation -in src/main/native/src/org/apache/hadoop/util: - -Copyright (c) 2008,2009,2010 Massachusetts Institute of Technology. -All rights reserved. + * LICENSE: + * okhttp/third_party/okhttp/LICENSE (Apache License 2.0) + * HOMEPAGE: + * https://github.com/square/okhttp + * LOCATION_IN_GRPC: + * okhttp/third_party/okhttp -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: +This product contains a modified portion of 'Netty', an open source +networking library, which can be obtained at: -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -* Neither the name of the Massachusetts Institute of Technology nor - the names of its contributors may be used to endorse or promote - products derived from this software without specific prior written - permission. + * LICENSE: + * netty/third_party/netty/LICENSE.txt (Apache License 2.0) + * HOMEPAGE: + * https://netty.io + * LOCATION_IN_GRPC: + * netty/third_party/netty -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -Other portions are under the same license from Intel: -http://sourceforge.net/projects/slicing-by-8/ -/*++ - * - * Copyright (c) 2004-2006 Intel Corporation - All Rights Reserved - * - * This software program is licensed subject to the BSD License, - * available at http://www.opensource.org/licenses/bsd-license.html - * - * Abstract: The main routine - * - --*/ - -For src/main/native/src/org/apache/hadoop/io/compress/lz4/{lz4.h,lz4.c,lz4hc.h,lz4hc.c}, - -/* - LZ4 - Fast LZ compression algorithm - Header File - Copyright (C) 2011-2014, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: +Apache HBase +Copyright 2007-2018 The Apache Software Foundation - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-- +This product incorporates portions of the 'Hadoop' project - You can contact the author at : - - LZ4 source repository : http://code.google.com/p/lz4/ - - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c -*/ +Copyright 2007-2009 The Apache Software Foundation +Licensed under the Apache License v2.0 +-- +Our Orca logo we got here: http://www.vectorfree.com/jumping-orca +It is licensed Creative Commons Attribution 3.0. +See https://creativecommons.org/licenses/by/3.0/us/ +We changed the logo by stripping the colored background, inverting +it and then rotating it some. -For hadoop-common-project/hadoop-common/src/main/native/gtest ---------------------------------------------------------------------- -Copyright 2008, Google Inc. -All rights reserved. +Later we found that vectorfree.com image is not properly licensed. +The original is owned by vectorportal.com. The original was +relicensed so we could use it as Creative Commons Attribution 3.0. +The license is bundled with the download available here: +http://www.vectorportal.com/subcategory/205/KILLER-WHALE-FREE-VECTOR.eps/ifile/9136/detailtest.asp +-- +This product includes portions of the Bootstrap project v3.0.0 -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: +Copyright 2013 Twitter, Inc. - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. +Licensed under the Apache License v2.0 -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -The binary distribution of this product bundles these dependencies under the -following license: -re2j 1.1 ---------------------------------------------------------------------- -(GO license) -This is a work derived from Russ Cox's RE2 in Go, whose license -http://golang.org/LICENSE is as follows: +This product uses the Glyphicons Halflings icon set. -Copyright (c) 2009 The Go Authors. All rights reserved. +http://glyphicons.com/ -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: +Copyright Jan Kova?ík - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. +Licensed under the Apache License v2.0 as a part of the Bootstrap project. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. +-- +This product includes portions of the Guava project v14 and v21, specifically +'hbase-common/src/main/java/org/apache/hadoop/hbase/io/LimitInputStream.java' +'hbase-common/src/main/java/org/apache/hadoop/hbase/util/Bytes.java' - * Neither the name of Google Inc. nor the names of its contributors - may be used to endorse or promote products derived from this - software without specific prior written permission. +Copyright (C) 2007 The Guava Authors -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -For hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/util/tree.h ---------------------------------------------------------------------- -Copyright 2002 Niels Provos -All rights reserved. +Licensed under the Apache License, Version 2.0 -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -The binary distribution of this product bundles binaries of leveldbjni -(https://github.com/fusesource/leveldbjni), which is available under the -following license: +Apache HTrace +Copyright 2016 The Apache Software Foundation -Copyright (c) 2011 FuseSource Corp. All rights reserved. +This product includes software developed at The Apache Software +Foundation (http://www.apache.org/). -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: +In addition, this product includes software dependencies. See +the accompanying LICENSE.txt for a listing of dependencies +that are NOT Apache licensed (with pointers to their licensing) - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of FuseSource Corp. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. +Apache HTrace includes an Apache Thrift connector to Zipkin. Zipkin +is a distributed tracing system that is Apache 2.0 Licensed. +Copyright 2012 Twitter, Inc. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -For hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/compat/{fstatat|openat|unlinkat}.h: - -Copyright (c) 2012 The FreeBSD Foundation -All rights reserved. -This software was developed by Pawel Jakub Dawidek under sponsorship from -the FreeBSD Foundation. +Apache HttpComponents Client +Copyright 1999-2018 The Apache Software Foundation -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -SUCH DAMAGE. - -============= - -The binary distribution of this product bundles binaries of leveldb -(http://code.google.com/p/leveldb/), which is available under the following -license: +Apache HttpComponents Core +Copyright 2005-2018 The Apache Software Foundation -Copyright (c) 2011 The LevelDB Authors. All rights reserved. +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. +============================================================== + Jetty Web Container + Copyright 1995-2017 Mort Bay Consulting Pty Ltd. +============================================================== -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -The binary distribution of this product bundles binaries of snappy -(http://code.google.com/p/snappy/), which is available under the following -license: +The Jetty Web Container is Copyright Mort Bay Consulting Pty Ltd +unless otherwise noted. -Copyright 2011, Google Inc. -All rights reserved. +Jetty is dual licensed under both -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: + * The Apache 2.0 License + http://www.apache.org/licenses/LICENSE-2.0.html - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. + and -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -For: -hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/dataTables.bootstrap.js -hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/dataTables.bootstrap.css -hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/jquery.dataTables.min.js -hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/webapps/static/dt-1.9.4/ --------------------------------------------------------------------------------- -Copyright (C) 2008-2016, SpryMedia Ltd. + * The Eclipse Public 1.0 License + http://www.eclipse.org/legal/epl-v10.html -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +Jetty may be distributed under either license. -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +------ +Eclipse -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +The following artifacts are EPL. + * org.eclipse.jetty.orbit:org.eclipse.jdt.core -For: -hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/dust-full-2.0.0.min.js -hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/dust-helpers-1.1.1.min.js --------------------------------------------------------------------------------- +The following artifacts are EPL and ASL2. + * org.eclipse.jetty.orbit:javax.security.auth.message -Copyright (c) 2010 Aleksander Williams -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +The following artifacts are EPL and CDDL 1.0. + * org.eclipse.jetty.orbit:javax.mail.glassfish -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +------ +Oracle -For: -hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/moment.min.js --------------------------------------------------------------------------------- +The following artifacts are CDDL + GPLv2 with classpath exception. +https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html -Copyright (c) 2011-2016 Tim Wood, Iskren Chernev, Moment.js contributors + * javax.servlet:javax.servlet-api + * javax.annotation:javax.annotation-api + * javax.transaction:javax.transaction-api + * javax.websocket:javax.websocket-api -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: +------ +Oracle OpenJDK -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. +If ALPN is used to negotiate HTTP/2 connections, then the following +artifacts may be included in the distribution or downloaded when ALPN +module is selected. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. + * java.sun.security.ssl -The binary distribution of this product bundles these dependencies under the -following license: -hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/bootstrap-3.0.2 -hadoop-tools/hadoop-sls/src/main/html/js/thirdparty/bootstrap.min.js -hadoop-tools/hadoop-sls/src/main/html/css/bootstrap.min.css -hadoop-tools/hadoop-sls/src/main/html/css/bootstrap-responsive.min.css -bootstrap v3.3.6 -broccoli-asset-rev v2.4.2 -broccoli-funnel v1.0.1 -datatables v1.10.8 -em-helpers v0.5.13 -em-table v0.1.6 -ember v2.2.0 -ember-array-contains-helper v1.0.2 -ember-bootstrap v0.5.1 -ember-cli v1.13.13 -ember-cli-app-version v1.0.0 -ember-cli-babel v5.1.6 -ember-cli-content-security-policy v0.4.0 -ember-cli-dependency-checker v1.2.0 -ember-cli-htmlbars v1.0.2 -ember-cli-htmlbars-inline-precompile v0.3.1 -ember-cli-ic-ajax v0.2.1 -ember-cli-inject-live-reload v1.4.0 -ember-cli-jquery-ui v0.0.20 -ember-cli-qunit v1.2.1 -ember-cli-release v0.2.8 -ember-cli-shims v0.0.6 -ember-cli-sri v1.2.1 -ember-cli-test-loader v0.2.1 -ember-cli-uglify v1.2.0 -ember-d3 v0.1.0 -ember-data v2.1.0 -ember-disable-proxy-controllers v1.0.1 -ember-export-application-global v1.0.5 -ember-load-initializers v0.1.7 -ember-qunit v0.4.16 -ember-qunit-notifications v0.1.0 -ember-resolver v2.0.3 -ember-spin-spinner v0.2.3 -ember-truth-helpers v1.2.0 -jquery v2.1.4 -jquery-ui v1.11.4 -loader.js v3.3.0 -momentjs v2.10.6 -qunit v1.19.0 -select2 v4.0.0 -snippet-ss v1.11.0 -spin.js v2.3.2 -Azure Data Lake Store - Java client SDK 2.0.11 -JCodings 1.0.8 -Joni 2.1.2 -Mockito 1.8.5 -JUL to SLF4J bridge 1.7.25 -SLF4J API Module 1.7.25 -SLF4J LOG4J-12 Binding 1.7.25 --------------------------------------------------------------------------------- +These artifacts replace/modify OpenJDK classes. The modififications +are hosted at github and both modified and original are under GPL v2 with +classpath exceptions. +http://openjdk.java.net/legal/gplv2+ce.html -The MIT License (MIT) -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +------ +OW2 -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. +The following artifacts are licensed by the OW2 Foundation according to the +terms of http://asm.ow2.org/license.html -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +org.ow2.asm:asm-commons +org.ow2.asm:asm -For: -hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/jquery-1.10.2.min.js -hadoop-tools/hadoop-sls/src/main/html/js/thirdparty/jquery.js -hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/webapps/static/jquery -Apache HBase - Server which contains JQuery minified javascript library version 1.8.3 -Microsoft JDBC Driver for SQLServer - version 6.2.1.jre7 --------------------------------------------------------------------------------- -MIT License +------ +Apache -Copyright (c) 2003-2017 Optimatika +The following artifacts are ASL2 licensed. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +org.apache.taglibs:taglibs-standard-spec +org.apache.taglibs:taglibs-standard-impl -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +------ +MortBay -For: -oj! Algorithms - version 43.0 --------------------------------------------------------------------------------- +The following artifacts are ASL2 licensed. Based on selected classes from +following Apache Tomcat jars, all ASL2 licensed. -Copyright 2005, 2012, 2013 jQuery Foundation and other contributors, https://jquery.org/ +org.mortbay.jasper:apache-jsp + org.apache.tomcat:tomcat-jasper + org.apache.tomcat:tomcat-juli + org.apache.tomcat:tomcat-jsp-api + org.apache.tomcat:tomcat-el-api + org.apache.tomcat:tomcat-jasper-el + org.apache.tomcat:tomcat-api + org.apache.tomcat:tomcat-util-scan + org.apache.tomcat:tomcat-util -This software consists of voluntary contributions made by many -individuals. For exact contribution history, see the revision history -available at https://github.com/jquery/jquery +org.mortbay.jasper:apache-el + org.apache.tomcat:tomcat-jasper-el + org.apache.tomcat:tomcat-el-api -The following license applies to all parts of this software except as -documented below: -==== +------ +Mortbay -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: +The following artifacts are CDDL + GPLv2 with classpath exception. -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. +https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +org.eclipse.jetty.toolchain:jetty-schemas -==== +------ +Assorted -All files located in the node_modules and external directories are -externally maintained libraries used by this software which have their -own licenses; we recommend you read them, as their terms may differ from -the terms above. +The UnixCrypt.java code implements the one way cryptography used by +Unix systems for simple password protection. Copyright 1996 Aki Yoshida, +modified April 2001 by Iris Van den Broeke, Daniel Deville. +Permission to use, copy, modify and distribute UnixCrypt +for non-commercial or commercial purposes and without fee is +granted provided that the copyright notice appears in all copies. -For: -hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/webapps/static/jt/jquery.jstree.js --------------------------------------------------------------------------------- -Copyright (c) 2014 Ivan Bozhanov +Apache Kafka +Copyright 2012 The Apache Software Foundation. -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. +Apache Kerby +Copyright 2015-2017 The Apache Software Foundation -For: -hadoop-tools/hadoop-sls/src/main/html/js/thirdparty/d3.v3.js --------------------------------------------------------------------------------- +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). -D3 is available under a 3-clause BSD license. For details, see: -hadoop-tools/hadoop-sls/src/main/html/js/thirdparty/d3-LICENSE -The binary distribution of this product bundles these dependencies under the -following license: -HSQLDB Database 2.3.4 --------------------------------------------------------------------------------- -(HSQL License) -"COPYRIGHTS AND LICENSES (based on BSD License) +Apache log4j +Copyright 2010 The Apache Software Foundation -For work developed by the HSQL Development Group: +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). -Copyright (c) 2001-2016, The HSQL Development Group -All rights reserved. -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: +Metrics +Copyright 2010-2013 Coda Hale and Yammer, Inc. -Redistributions of source code must retain the above copyright notice, this -list of conditions and the following disclaimer. +This product includes software developed by Coda Hale and Yammer, Inc. -Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. +This product includes code derived from the JSR-166 project (ThreadLocalRandom, Striped64, +LongAdder), which was released with the following comments: -Neither the name of the HSQL Development Group nor the names of its -contributors may be used to endorse or promote products derived from this -software without specific prior written permission. + Written by Doug Lea with assistance from members of JCP JSR-166 + Expert Group and released to the public domain, as explained at + http://creativecommons.org/publicdomain/zero/1.0/ -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, -OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -For work originally developed by the Hypersonic SQL Group: + The Netty Project + ================= -Copyright (c) 1995-2000 by the Hypersonic SQL Group. -All rights reserved. -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: +Please visit the Netty web site for more information: -Redistributions of source code must retain the above copyright notice, this -list of conditions and the following disclaimer. + * http://netty.io/ -Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. +Copyright 2014 The Netty Project -Neither the name of the Hypersonic SQL Group nor the names of its -contributors may be used to endorse or promote products derived from this -software without specific prior written permission. +The Netty Project licenses this file to you under the Apache License, +version 2.0 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at: -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE HYPERSONIC SQL GROUP, -OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -This software consists of voluntary contributions made by many individuals on behalf of the -Hypersonic SQL Group." - -The binary distribution of this product bundles these dependencies under the -following license: -Java Servlet API 3.1.0 -servlet-api 2.5 -jsp-api 2.1 -jsr311-api 1.1.1 -Glassfish Jasper 6.1.14 -Servlet Specification 2.5 API 6.1.14 --------------------------------------------------------------------------------- -(CDDL 1.0) -COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 -1. Definitions. - -1.1. Contributor means each individual or entity -that creates or contributes to the creation of -Modifications. - -1.2. Contributor Version means the combination of the -Original Software, prior Modifications used by a Contributor (if any), and the -Modifications made by that particular Contributor. - -1.3. Covered -Software means (a) the Original Software, or (b) Modifications, or (c) the -combination of files containing Original Software with files containing -Modifications, in each case including portions -thereof. - -1.4. Executable means the Covered Software in any form other -than Source Code. - -1.5. Initial Developer means the individual or entity -that first makes Original Software available under this -License. - -1.6. Larger Work means a work which combines Covered Software or -portions thereof with code not governed by the terms of this -License. - -1.7. License means this document. - -1.8. Licensable means -having the right to grant, to the maximum extent possible, whether at the time -of the initial grant or subsequently acquired, any and all of the rights -conveyed herein. - -1.9. Modifications means the Source Code and Executable -form of any of the following: -A. Any file that results from an addition to, -deletion from or modification of the contents of a file containing Original -Software or previous Modifications; -B. Any new file that contains any part of the Original Software -or previous Modification; or -C. Any new file that is contributed or otherwise made available -under the terms of this License. - -1.10. Original Software means the Source Code and Executable form of -computer software code that is originally released under this License. - -1.11. Patent Claims means any patent claim(s), now owned or -hereafter acquired, including without limitation, method, process, and apparatus -claims, in any patent Licensable by grantor. - -1.12. Source Code means (a) the common form of computer software code in which -modifications are made and (b) associated documentation included in or -with such code. - -1.13. You (or Your) means an individual or a legal entity exercising rights -under, and complying with all of the terms of, this License. For legal entities, -You includes any entity which controls, is controlled by, or is under common control -with You. For purposes of this definition, control means (a) the power, direct -or indirect, to cause the direction or management of such entity, whether by -contract or otherwise, or (b) ownership of more than fifty percent (50%) of the -outstanding shares or beneficial ownership of such entity. - -2. License Grants. - -2.1. The Initial Developer Grant. Conditioned upon Your compliance -with Section 3.1 below and subject to third party intellectual property claims, -the Initial Developer hereby grants You a world-wide, royalty-free, -non-exclusive license: - -(a) under intellectual property rights (other than -patent or trademark) Licensable by Initial Developer, to use, reproduce, modify, -display, perform, sublicense and distribute the Original Software (or portions -thereof), with or without Modifications, and/or as part of a Larger Work; -and - -(b) under Patent Claims infringed by the making, using or selling of -Original Software, to make, have made, use, practice, sell, and offer for sale, -and/or otherwise dispose of the Original Software (or portions -thereof); - -(c) The licenses granted in Sections 2.1(a) and (b) are -effective on the date Initial Developer first distributes or otherwise makes the -Original Software available to a third party under the terms of this -License; - -(d) Notwithstanding Section 2.1(b) above, no patent license is -granted: (1) for code that You delete from the Original Software, or (2) for -infringements caused by: (i) the modification of the Original Software, or -(ii) the combination of the Original Software with other software or -devices. - -2.2. Contributor Grant. Conditioned upon Your compliance with -Section 3.1 below and subject to third party intellectual property claims, each -Contributor hereby grants You a world-wide, royalty-free, non-exclusive -license: - -(a) under intellectual property rights (other than patent or -trademark) Licensable by Contributor to use, reproduce, modify, display, -perform, sublicense and distribute the Modifications created by such Contributor -(or portions thereof), either on an unmodified basis, with other Modifications, -as Covered Software and/or as part of a Larger Work; and - -(b) under Patent -Claims infringed by the making, using, or selling of Modifications made by that -Contributor either alone and/or in combination with its Contributor Version (or -portions of such combination), to make, use, sell, offer for sale, have made, -and/or otherwise dispose of: (1) Modifications made by that Contributor (or -portions thereof); and (2) the combination of Modifications made by that -Contributor with its Contributor Version (or portions of such -combination). - -(c) The licenses granted in Sections 2.2(a) and 2.2(b) are -effective on the date Contributor first distributes or otherwise makes the -Modifications available to a third party. - -(d) Notwithstanding Section 2.2(b) -above, no patent license is granted: (1) for any code that Contributor has -deleted from the Contributor Version; (2) for infringements caused by: -(i) third party modifications of Contributor Version, or (ii) the combination -of Modifications made by that Contributor with other software (except as part of -the Contributor Version) or other devices; or (3) under Patent Claims infringed -by Covered Software in the absence of Modifications made by that -Contributor. - -3. Distribution Obligations. - -3.1. Availability of Source -Code. Any Covered Software that You distribute or otherwise make available in -Executable form must also be made available in Source Code form and that Source -Code form must be distributed only under the terms of this License. You must -include a copy of this License with every copy of the Source Code form of the -Covered Software You distribute or otherwise make available. You must inform -recipients of any such Covered Software in Executable form as to how they can -obtain such Covered Software in Source Code form in a reasonable manner on or -through a medium customarily used for software exchange. - -3.2. -Modifications. The Modifications that You create or to which You contribute are -governed by the terms of this License. You represent that You believe Your -Modifications are Your original creation(s) and/or You have sufficient rights to -grant the rights conveyed by this License. - -3.3. Required Notices. You must -include a notice in each of Your Modifications that identifies You as the -Contributor of the Modification. You may not remove or alter any copyright, -patent or trademark notices contained within the Covered Software, or any -notices of licensing or any descriptive text giving attribution to any -Contributor or the Initial Developer. - -3.4. Application of Additional Terms. -You may not offer or impose any terms on any Covered Software in Source Code -form that alters or restricts the applicable version of this License or the -recipients rights hereunder. You may choose to offer, and to charge a fee for, -warranty, support, indemnity or liability obligations to one or more recipients -of Covered Software. However, you may do so only on Your own behalf, and not on -behalf of the Initial Developer or any Contributor. You must make it absolutely -clear that any such warranty, support, indemnity or liability obligation is -offered by You alone, and You hereby agree to indemnify the Initial Developer -and every Contributor for any liability incurred by the Initial Developer or -such Contributor as a result of warranty, support, indemnity or liability terms -You offer. - -3.5. Distribution of Executable Versions. You may distribute the -Executable form of the Covered Software under the terms of this License or under -the terms of a license of Your choice, which may contain terms different from -this License, provided that You are in compliance with the terms of this License -and that the license for the Executable form does not attempt to limit or alter -the recipients rights in the Source Code form from the rights set forth in this -License. If You distribute the Covered Software in Executable form under a -different license, You must make it absolutely clear that any terms which differ -from this License are offered by You alone, not by the Initial Developer or -Contributor. You hereby agree to indemnify the Initial Developer and every -Contributor for any liability incurred by the Initial Developer or such -Contributor as a result of any such terms You offer. - -3.6. Larger Works. You -may create a Larger Work by combining Covered Software with other code not -governed by the terms of this License and distribute the Larger Work as a single -product. In such a case, You must make sure the requirements of this License are -fulfilled for the Covered Software. - -4. Versions of the License. - -4.1. -New Versions. Sun Microsystems, Inc. is the initial license steward and may -publish revised and/or new versions of this License from time to time. Each -version will be given a distinguishing version number. Except as provided in -Section 4.3, no one other than the license steward has the right to modify this -License. - -4.2. Effect of New Versions. You may always continue to use, -distribute or otherwise make the Covered Software available under the terms of -the version of the License under which You originally received the Covered -Software. If the Initial Developer includes a notice in the Original Software -prohibiting it from being distributed or otherwise made available under any -subsequent version of the License, You must distribute and make the Covered -Software available under the terms of the version of the License under which You -originally received the Covered Software. Otherwise, You may also choose to use, -distribute or otherwise make the Covered Software available under the terms of -any subsequent version of the License published by the license -steward. - -4.3. Modified Versions. When You are an Initial Developer and You -want to create a new license for Your Original Software, You may create and use -a modified version of this License if You: (a) rename the license and remove -any references to the name of the license steward (except to note that the -license differs from this License); and (b) otherwise make it clear that the -license contains terms which differ from this License. - -5. DISCLAIMER OF WARRANTY. - -COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN AS IS BASIS, -WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT -LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE IS FREE OF DEFECTS, -MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY -COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER -OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR -CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS -LICENSE. NO USE OF ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER -THIS DISCLAIMER. - -6. TERMINATION. - -6.1. This License and the rights -granted hereunder will terminate automatically if You fail to comply with terms -herein and fail to cure such breach within 30 days of becoming aware of the -breach. Provisions which, by their nature, must remain in effect beyond the -termination of this License shall survive. - -6.2. If You assert a patent -infringement claim (excluding declaratory judgment actions) against Initial -Developer or a Contributor (the Initial Developer or Contributor against whom -You assert such claim is referred to as Participant) alleging that the -Participant Software (meaning the Contributor Version where the Participant is a -Contributor or the Original Software where the Participant is the Initial -Developer) directly or indirectly infringes any patent, then any and all rights -granted directly or indirectly to You by such Participant, the Initial Developer -(if the Initial Developer is not the Participant) and all Contributors under -Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice from -Participant terminate prospectively and automatically at the expiration of such -60 day notice period, unless if within such 60 day period You withdraw Your -claim with respect to the Participant Software against such Participant either -unilaterally or pursuant to a written agreement with Participant. - -6.3. In -the event of termination under Sections 6.1 or 6.2 above, all end user licenses -that have been validly granted by You or any distributor hereunder prior to -termination (excluding licenses granted to You by any distributor) shall survive -termination. - -7. LIMITATION OF LIABILITY. -UNDER NO CIRCUMSTANCES AND UNDER -NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, -SHALL YOU, THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF -COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY -PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY -CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF -GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER -COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE -POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO -LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTYS NEGLIGENCE TO -THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT -ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO -THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -8. U.S. GOVERNMENT END USERS. - -The Covered Software is a commercial item, as that term is defined in -48 C.F.R. 2.101 (Oct. 1995), consisting of commercial computer software (as -that term is defined at 48 C.F.R. 252.227-7014(a)(1)) and commercial computer -software documentation as such terms are used in 48 C.F.R. 12.212 (Sept. -1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through -227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Software -with only those rights set forth herein. This U.S. Government Rights clause is -in lieu of, and supersedes, any other FAR, DFAR, or other clause or provision -that addresses Government rights in computer software under this -License. - -9. MISCELLANEOUS. -This License represents the complete agreement -concerning subject matter hereof. If any provision of this License is held to be -unenforceable, such provision shall be reformed only to the extent necessary to -make it enforceable. This License shall be governed by the law of the -jurisdiction specified in a notice contained within the Original Software -(except to the extent applicable law, if any, provides otherwise), excluding -such jurisdictions conflict-of-law provisions. Any litigation relating to this -License shall be subject to the jurisdiction of the courts located in the -jurisdiction and venue specified in a notice contained within the Original -Software, with the losing party responsible for costs, including, without -limitation, court costs and reasonable attorneys fees and expenses. The -application of the United Nations Convention on Contracts for the International -Sale of Goods is expressly excluded. Any law or regulation which provides that -the language of a contract shall be construed against the drafter shall not -apply to this License. You agree that You alone are responsible for compliance -with the United States export administration regulations (and the export control -laws and regulation of any other countries) when You use, distribute or -otherwise make available any Covered Software. - -10. RESPONSIBILITY FOR CLAIMS. -As between Initial Developer and the Contributors, each party is -responsible for claims and damages arising, directly or indirectly, out of its -utilization of rights under this License and You agree to work with Initial -Developer and Contributors to distribute such responsibility on an equitable -basis. Nothing herein is intended or shall be deemed to constitute any admission -of liability. - -The binary distribution of this product bundles these dependencies under the -following license: -jersey-client 1.19 -jersey-core 1.19 -jersey-grizzly2 1.19 -jersey-grizzly2-servlet 1.19 -jersey-json 1.19 -jersey-server 1.19 -jersey-servlet 1.19 -jersey-guice 1.19 -Jersey Test Framework - Grizzly 2 Module 1.19 -JAXB RI 2.2.3 -Java Architecture for XML Binding 2.2.11 -grizzly-framework 2.2.21 -grizzly-http 2.2.21 -grizzly-http-server 2.2.21 -grizzly-http-servlet 2.2.21 -grizzly-rcm 2.2.21 --------------------------------------------------------------------------------- -(CDDL 1.1) -COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL)Version 1.1 - -1. Definitions. - -1.1. “Contributor” means each individual or entity that creates or -contributes to the creation of Modifications. -1.2. “Contributor Version” means the combination of the Original Software, -prior Modifications used by a Contributor (if any), and the Modifications made -by that particular Contributor. -1.3. “Covered Software” means (a) the Original Software, or (b) -Modifications, or (c) the combination of files containing Original Software with -files containing Modifications, in each case including portions thereof. -1.4. “Executable” means the Covered Software in any form other than Source -Code. -1.5. “Initial Developer” means the individual or entity that first makes -Original Software available under this License. -1.6. “Larger Work” means a work which combines Covered Software or portions -thereof with code not governed by the terms of this License. -1.7. “License” means this document. -1.8. “Licensable” means having the right to grant, to the maximum extent -possible, whether at the time of the initial grant or subsequently acquired, any -and all of the rights conveyed herein. -1.9. “Modifications” means the Source Code and Executable form of any of the -following: -A. Any file that results from an addition to, deletion from or modification of -the contents of a file containing Original Software or previous Modifications; -B. Any new file that contains any part of the Original Software or previous -Modification; or -C. Any new file that is contributed or otherwise made available under the terms -of this License. -1.10. “Original Software” means the Source Code and Executable form of -computer software code that is originally released under this License. -1.11. “Patent Claims” means any patent claim(s), now owned or hereafter -acquired, including without limitation, method, process, and apparatus claims, -in any patent Licensable by grantor. -1.12. “Source Code” means (a) the common form of computer software code in -which modifications are made and (b) associated documentation included in or -with such code. -1.13. “You” (or “Your”) means an individual or a legal entity exercising -rights under, and complying with all of the terms of, this License. For legal -entities, “You” includes any entity which controls, is controlled by, or is -under common control with You. For purposes of this definition, “control” -means (a) the power, direct or indirect, to cause the direction or management of -such entity, whether by contract or otherwise, or (b) ownership of more than -fifty percent (50%) of the outstanding shares or beneficial ownership of such -entity. - -2. License Grants. - -2.1. The Initial Developer Grant. - -Conditioned upon Your compliance with Section 3.1 below and subject to -third party intellectual property claims, the Initial Developer hereby grants -You a world-wide, royalty-free, non-exclusive license: -(a) under intellectual -property rights (other than patent or trademark) Licensable by Initial -Developer, to use, reproduce, modify, display, perform, sublicense and -distribute the Original Software (or portions thereof), with or without -Modifications, and/or as part of a Larger Work; and -(b) under Patent Claims -infringed by the making, using or selling of Original Software, to make, have -made, use, practice, sell, and offer for sale, and/or otherwise dispose of the -Original Software (or portions thereof). -(c) The licenses granted in Sections -2.1(a) and (b) are effective on the date Initial Developer first distributes or -otherwise makes the Original Software available to a third party under the terms -of this License. -(d) Notwithstanding Section 2.1(b) above, no patent license is -granted: (1) for code that You delete from the Original Software, or (2) for -infringements caused by: (i) the modification of the Original Software, or (ii) -the combination of the Original Software with other software or devices. - -2.2. Contributor Grant. - -Conditioned upon Your compliance with Section 3.1 below and -subject to third party intellectual property claims, each Contributor hereby -grants You a world-wide, royalty-free, non-exclusive license: -(a) under -intellectual property rights (other than patent or trademark) Licensable by -Contributor to use, reproduce, modify, display, perform, sublicense and -distribute the Modifications created by such Contributor (or portions thereof), -either on an unmodified basis, with other Modifications, as Covered Software -and/or as part of a Larger Work; and -(b) under Patent Claims infringed by the -making, using, or selling of Modifications made by that Contributor either alone -and/or in combination with its Contributor Version (or portions of such -combination), to make, use, sell, offer for sale, have made, and/or otherwise -dispose of: (1) Modifications made by that Contributor (or portions thereof); -and (2) the combination of Modifications made by that Contributor with its -Contributor Version (or portions of such combination). -(c) The licenses granted -in Sections 2.2(a) and 2.2(b) are effective on the date Contributor first -distributes or otherwise makes the Modifications available to a third -party. -(d) Notwithstanding Section 2.2(b) above, no patent license is granted: -(1) for any code that Contributor has deleted from the Contributor Version; (2) -for infringements caused by: (i) third party modifications of Contributor -Version, or (ii) the combination of Modifications made by that Contributor with -other software (except as part of the Contributor Version) or other devices; or -(3) under Patent Claims infringed by Covered Software in the absence of -Modifications made by that Contributor. - -3. Distribution Obligations. - -3.1. Availability of Source Code. -Any Covered Software that You distribute or -otherwise make available in Executable form must also be made available in -Source Code form and that Source Code form must be distributed only under the -terms of this License. You must include a copy of this License with every copy -of the Source Code form of the Covered Software You distribute or otherwise make -available. You must inform recipients of any such Covered Software in Executable -form as to how they can obtain such Covered Software in Source Code form in a -reasonable manner on or through a medium customarily used for software -exchange. -3.2. Modifications. -The Modifications that You create or to which -You contribute are governed by the terms of this License. You represent that You -believe Your Modifications are Your original creation(s) and/or You have -sufficient rights to grant the rights conveyed by this License. -3.3. Required Notices. -You must include a notice in each of Your Modifications that -identifies You as the Contributor of the Modification. You may not remove or -alter any copyright, patent or trademark notices contained within the Covered -Software, or any notices of licensing or any descriptive text giving attribution -to any Contributor or the Initial Developer. -3.4. Application of Additional Terms. -You may not offer or impose any terms on any Covered Software in Source -Code form that alters or restricts the applicable version of this License or the -recipients' rights hereunder. You may choose to offer, and to charge a fee for, -warranty, support, indemnity or liability obligations to one or more recipients -of Covered Software. However, you may do so only on Your own behalf, and not on -behalf of the Initial Developer or any Contributor. You must make it absolutely -clear that any such warranty, support, indemnity or liability obligation is -offered by You alone, and You hereby agree to indemnify the Initial Developer -and every Contributor for any liability incurred by the Initial Developer or -such Contributor as a result of warranty, support, indemnity or liability terms -You offer. -3.5. Distribution of Executable Versions. -You may distribute the -Executable form of the Covered Software under the terms of this License or under -the terms of a license of Your choice, which may contain terms different from -this License, provided that You are in compliance with the terms of this License -and that the license for the Executable form does not attempt to limit or alter -the recipient's rights in the Source Code form from the rights set forth in -this License. If You distribute the Covered Software in Executable form under a -different license, You must make it absolutely clear that any terms which differ -from this License are offered by You alone, not by the Initial Developer or -Contributor. You hereby agree to indemnify the Initial Developer and every -Contributor for any liability incurred by the Initial Developer or such -Contributor as a result of any such terms You offer. -3.6. Larger Works. -You -may create a Larger Work by combining Covered Software with other code not -governed by the terms of this License and distribute the Larger Work as a single -product. In such a case, You must make sure the requirements of this License are -fulfilled for the Covered Software. - -4. Versions of the License. - -4.1. New Versions. -Oracle is the initial license steward and may publish revised and/or -new versions of this License from time to time. Each version will be given a -distinguishing version number. Except as provided in Section 4.3, no one other -than the license steward has the right to modify this License. -4.2. Effect of New Versions. -You may always continue to use, distribute or otherwise make the -Covered Software available under the terms of the version of the License under -which You originally received the Covered Software. If the Initial Developer -includes a notice in the Original Software prohibiting it from being distributed -or otherwise made available under any subsequent version of the License, You -must distribute and make the Covered Software available under the terms of the -version of the License under which You originally received the Covered Software. -Otherwise, You may also choose to use, distribute or otherwise make the Covered -Software available under the terms of any subsequent version of the License -published by the license steward. -4.3. Modified Versions. -When You are an -Initial Developer and You want to create a new license for Your Original -Software, You may create and use a modified version of this License if You: (a) -rename the license and remove any references to the name of the license steward -(except to note that the license differs from this License); and (b) otherwise -make it clear that the license contains terms which differ from this -License. - -5. DISCLAIMER OF WARRANTY. - -COVERED SOFTWARE IS PROVIDED UNDER THIS -LICENSE ON AN “AS IS” BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE -IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR -NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE DEFECTIVE IN ANY -RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE -COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF -WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED -SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. - -6. TERMINATION. - -6.1. This License and the rights granted hereunder will -terminate automatically if You fail to comply with terms herein and fail to cure -such breach within 30 days of becoming aware of the breach. Provisions which, by -their nature, must remain in effect beyond the termination of this License shall -survive. -6.2. If You assert a patent infringement claim (excluding declaratory -judgment actions) against Initial Developer or a Contributor (the Initial -Developer or Contributor against whom You assert such claim is referred to as -“Participant”) alleging that the Participant Software (meaning the -Contributor Version where the Participant is a Contributor or the Original -Software where the Participant is the Initial Developer) directly or indirectly -infringes any patent, then any and all rights granted directly or indirectly to -You by such Participant, the Initial Developer (if the Initial Developer is not -the Participant) and all Contributors under Sections 2.1 and/or 2.2 of this -License shall, upon 60 days notice from Participant terminate prospectively and -automatically at the expiration of such 60 day notice period, unless if within -such 60 day period You withdraw Your claim with respect to the Participant -Software against such Participant either unilaterally or pursuant to a written -agreement with Participant. -6.3. If You assert a patent infringement claim -against Participant alleging that the Participant Software directly or -indirectly infringes any patent where such claim is resolved (such as by license -or settlement) prior to the initiation of patent infringement litigation, then -the reasonable value of the licenses granted by such Participant under Sections -2.1 or 2.2 shall be taken into account in determining the amount or value of any -payment or license. -6.4. In the event of termination under Sections 6.1 or 6.2 -above, all end user licenses that have been validly granted by You or any -distributor hereunder prior to termination (excluding licenses granted to You by -any distributor) shall survive termination. - -7. LIMITATION OF LIABILITY. - -UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT -(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL -DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED SOFTWARE, OR ANY -SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, -WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER -FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN -IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS -LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL -INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW -PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR -LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND -LIMITATION MAY NOT APPLY TO YOU. - -8. U.S. GOVERNMENT END USERS. - -The Covered -Software is a “commercial item,” as that term is defined in 48 C.F.R. 2.101 -(Oct. 1995), consisting of “commercial computer software” (as that term is -defined at 48 C.F.R. § 252.227-7014(a)(1)) and “commercial computer software -documentation” as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). -Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 -(June 1995), all U.S. Government End Users acquire Covered Software with only -those rights set forth herein. This U.S. Government Rights clause is in lieu of, -and supersedes, any other FAR, DFAR, or other clause or provision that addresses -Government rights in computer software under this License. - -9. MISCELLANEOUS. - -This License represents the complete agreement concerning -subject matter hereof. If any provision of this License is held to be -unenforceable, such provision shall be reformed only to the extent necessary to -make it enforceable. This License shall be governed by the law of the -jurisdiction specified in a notice contained within the Original Software -(except to the extent applicable law, if any, provides otherwise), excluding -such jurisdiction's conflict-of-law provisions. Any litigation relating to this -License shall be subject to the jurisdiction of the courts located in the -jurisdiction and venue specified in a notice contained within the Original -Software, with the losing party responsible for costs, including, without -limitation, court costs and reasonable attorneys' fees and expenses. The -application of the United Nations Convention on Contracts for the International -Sale of Goods is expressly excluded. Any law or regulation which provides that -the language of a contract shall be construed against the drafter shall not -apply to this License. You agree that You alone are responsible for compliance -with the United States export administration regulations (and the export control -laws and regulation of any other countries) when You use, distribute or -otherwise make available any Covered Software. - -10. RESPONSIBILITY FOR CLAIMS. - -As between Initial Developer and the Contributors, each party is -responsible for claims and damages arising, directly or indirectly, out of its -utilization of rights under this License and You agree to work with Initial -Developer and Contributors to distribute such responsibility on an equitable -basis. Nothing herein is intended or shall be deemed to constitute any admission -of liability. - -The binary distribution of this product bundles these dependencies under the -following license: -Protocol Buffer Java API 2.5.0 --------------------------------------------------------------------------------- -This license applies to all parts of Protocol Buffers except the following: - - - Atomicops support for generic gcc, located in - src/google/protobuf/stubs/atomicops_internals_generic_gcc.h. - This file is copyrighted by Red Hat Inc. - - - Atomicops support for AIX/POWER, located in - src/google/protobuf/stubs/atomicops_internals_power.h. - This file is copyrighted by Bloomberg Finance LP. - -Copyright 2014, Google Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -Code generated by the Protocol Buffer compiler is owned by the owner -of the input file used when generating it. This code is not -standalone and requires a support library to be linked with it. This -support library is itself covered by the above license. - -For: -XML Commons External Components XML APIs 1.3.04 --------------------------------------------------------------------------------- -By obtaining, using and/or copying this work, you (the licensee) agree that you -have read, understood, and will comply with the following terms and conditions. - -Permission to copy, modify, and distribute this software and its documentation, -with or without modification, for any purpose and without fee or royalty is -hereby granted, provided that you include the following on ALL copies of the -software and documentation or portions thereof, including modifications: -- The full text of this NOTICE in a location viewable to users of the -redistributed or derivative work. -- Any pre-existing intellectual property disclaimers, notices, or terms and -conditions. If none exist, the W3C Software Short Notice should be included -(hypertext is preferred, text is permitted) within the body of any redistributed -or derivative code. -- Notice of any changes or modifications to the files, including the date changes -were made. (We recommend you provide URIs to the location from which the code is -derived.) - -The binary distribution of this product bundles these dependencies under the -following license: -JUnit 4.11 -Eclipse JDT Core 3.1.1 --------------------------------------------------------------------------------- -(EPL v1.0) -Eclipse Public License - v 1.0 - -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC -LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM -CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and -b) in the case of each subsequent Contributor: -i) changes to the Program, and -ii) additions to the Program; -where such changes and/or additions to the Program originate from and are -distributed by that particular Contributor. A Contribution 'originates' from a -Contributor if it was added to the Program by such Contributor itself or anyone -acting on such Contributor's behalf. Contributions do not include additions to -the Program which: (i) are separate modules of software distributed in -conjunction with the Program under their own license agreement, and (ii) are not -derivative works of the Program. -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents" mean patent claims licensable by a Contributor which are -necessarily infringed by the use or sale of its Contribution alone or when -combined with the Program. - -"Program" means the Contributions distributed in accordance with this Agreement. - -"Recipient" means anyone who receives the Program under this Agreement, -including all Contributors. - -2. GRANT OF RIGHTS - -a) Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free copyright license to -reproduce, prepare derivative works of, publicly display, publicly perform, -distribute and sublicense the Contribution of such Contributor, if any, and such -derivative works, in source code and object code form. -b) Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed -Patents to make, use, sell, offer to sell, import and otherwise transfer the -Contribution of such Contributor, if any, in source code and object code form. -This patent license shall apply to the combination of the Contribution and the -Program if, at the time the Contribution is added by the Contributor, such -addition of the Contribution causes such combination to be covered by the -Licensed Patents. The patent license shall not apply to any other combinations -which include the Contribution. No hardware per se is licensed hereunder. -c) Recipient understands that although each Contributor grants the licenses to -its Contributions set forth herein, no assurances are provided by any -Contributor that the Program does not infringe the patent or other intellectual -property rights of any other entity. Each Contributor disclaims any liability to -Recipient for claims brought by any other entity based on infringement of -intellectual property rights or otherwise. As a condition to exercising the -rights and licenses granted hereunder, each Recipient hereby assumes sole -responsibility to secure any other intellectual property rights needed, if any. -For example, if a third party patent license is required to allow Recipient to -distribute the Program, it is Recipient's responsibility to acquire that license -before distributing the Program. -d) Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement. -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form under its -own license agreement, provided that: - -a) it complies with the terms and conditions of this Agreement; and -b) its license agreement: -i) effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title and -non-infringement, and implied warranties or conditions of merchantability and -fitness for a particular purpose; -ii) effectively excludes on behalf of all Contributors all liability for -damages, including direct, indirect, special, incidental and consequential -damages, such as lost profits; -iii) states that any provisions which differ from this Agreement are offered by -that Contributor alone and not by any other party; and -iv) states that source code for the Program is available from such Contributor, -and informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange. -When the Program is made available in source code form: - -a) it must be made available under this Agreement; and -b) a copy of this Agreement must be included with each copy of the Program. -Contributors may not remove or alter any copyright notices contained within the -Program. - -Each Contributor must identify itself as the originator of its Contribution, if -any, in a manner that reasonably allows subsequent Recipients to identify the -originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain responsibilities with -respect to end users, business partners and the like. While this license is -intended to facilitate the commercial use of the Program, the Contributor who -includes the Program in a commercial product offering should do so in a manner -which does not create potential liability for other Contributors. Therefore, if -a Contributor includes the Program in a commercial product offering, such -Contributor ("Commercial Contributor") hereby agrees to defend and indemnify -every other Contributor ("Indemnified Contributor") against any losses, damages -and costs (collectively "Losses") arising from claims, lawsuits and other legal -actions brought by a third party against the Indemnified Contributor to the -extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor to -control, and cooperate with the Commercial Contributor in, the defense and any -related settlement negotiations. The Indemnified Contributor may participate in -any such claim at its own expense. - -For example, a Contributor might include the Program in a commercial product -offering, Product X. That Contributor is then a Commercial Contributor. If that -Commercial Contributor then makes performance claims, or offers warranties -related to Product X, those performance claims and warranties are such -Commercial Contributor's responsibility alone. Under this section, the -Commercial Contributor would have to defend claims against the other -Contributors related to those performance claims and warranties, and if a court -requires any other Contributor to pay any damages as a result, the Commercial -Contributor must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR -IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, -NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each -Recipient is solely responsible for determining the appropriateness of using and -distributing the Program and assumes all risks associated with its exercise of -rights under this Agreement , including but not limited to the risks and costs -of program errors, compliance with applicable laws, damage to or loss of data, -programs or equipment, and unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY -CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST -PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS -GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under applicable -law, it shall not affect the validity or enforceability of the remainder of the -terms of this Agreement, and without further action by the parties hereto, such -provision shall be reformed to the minimum extent necessary to make such -provision valid and enforceable. - -If Recipient institutes patent litigation against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that the Program itself -(excluding combinations of the Program with other software or hardware) -infringes such Recipient's patent(s), then such Recipient's rights granted under -Section 2(b) shall terminate as of the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it fails to -comply with any of the material terms or conditions of this Agreement and does -not cure such failure in a reasonable period of time after becoming aware of -such noncompliance. If all Recipient's rights under this Agreement terminate, -Recipient agrees to cease use and distribution of the Program as soon as -reasonably practicable. However, Recipient's obligations under this Agreement -and any licenses granted by Recipient relating to the Program shall continue and -survive. - -Everyone is permitted to copy and distribute copies of this Agreement, but in -order to avoid inconsistency the Agreement is copyrighted and may only be -modified in the following manner. The Agreement Steward reserves the right to -publish new versions (including revisions) of this Agreement from time to time. -No one other than the Agreement Steward has the right to modify this Agreement. -The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation -may assign the responsibility to serve as the Agreement Steward to a suitable -separate entity. Each new version of the Agreement will be given a -distinguishing version number. The Program (including Contributions) may always -be distributed subject to the version of the Agreement under which it was -received. In addition, after a new version of the Agreement is published, -Contributor may elect to distribute the Program (including its Contributions) -under the new version. Except as expressly stated in Sections 2(a) and 2(b) -above, Recipient receives no rights or licenses to the intellectual property of -any Contributor under this Agreement, whether expressly, by implication, -estoppel or otherwise. All rights in the Program not expressly granted under -this Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and the -intellectual property laws of the United States of America. No party to this -Agreement will bring a legal action under this Agreement more than one year -after the cause of action arose. Each party waives its rights to a jury trial in -any resulting litigation. - -The binary distribution of this product bundles these dependencies under the -following license: -JSch 0.1.51 -ParaNamer Core 2.3 -JLine 0.9.94 -leveldbjni-all 1.8 -Hamcrest Core 1.3 -ASM Core 5.0.4 -ASM Commons 5.0.2 -ASM Tree 5.0.2 --------------------------------------------------------------------------------- -(3-clause BSD) -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -The binary distribution of this product bundles these dependencies under the -following license: -FindBugs-jsr305 3.0.0 -dnsjava 2.1.7, Copyright (c) 1998-2011, Brian Wellington. All rights reserved. --------------------------------------------------------------------------------- -(2-clause BSD) -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -The views and conclusions contained in the software and documentation are those -of the authors and should not be interpreted as representing official policies, -either expressed or implied, of the FreeBSD Project. - -The binary distribution of this product bundles these dependencies under the -following license: -"Java Concurrency in Practice" book annotations 1.0 --------------------------------------------------------------------------------- -(CCAL v2.5) -THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS -PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR -OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS -LICENSE OR COPYRIGHT LAW IS PROHIBITED. - -BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE -BOUND BY THE TERMS OF THIS LICENSE. THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED -HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS. - -1. Definitions - -"Collective Work" means a work, such as a periodical issue, anthology or -encyclopedia, in which the Work in its entirety in unmodified form, along with a -number of other contributions, constituting separate and independent works in -themselves, are assembled into a collective whole. A work that constitutes a -Collective Work will not be considered a Derivative Work (as defined below) for -the purposes of this License. -"Derivative Work" means a work based upon the Work or upon the Work and other -pre-existing works, such as a translation, musical arrangement, dramatization, -fictionalization, motion picture version, sound recording, art reproduction, -abridgment, condensation, or any other form in which the Work may be recast, -transformed, or adapted, except that a work that constitutes a Collective Work -will not be considered a Derivative Work for the purpose of this License. For -the avoidance of doubt, where the Work is a musical composition or sound -recording, the synchronization of the Work in timed-relation with a moving image -("synching") will be considered a Derivative Work for the purpose of this -License. -"Licensor" means the individual or entity that offers the Work under the terms -of this License. -"Original Author" means the individual or entity who created the Work. -"Work" means the copyrightable work of authorship offered under the terms of -this License. -"You" means an individual or entity exercising rights under this License who has -not previously violated the terms of this License with respect to the Work, or -who has received express permission from the Licensor to exercise rights under -this License despite a previous violation. -2. Fair Use Rights. Nothing in this license is intended to reduce, limit, or -restrict any rights arising from fair use, first sale or other limitations on -the exclusive rights of the copyright owner under copyright law or other -applicable laws. - -3. License Grant. Subject to the terms and conditions of this License, Licensor -hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the -duration of the applicable copyright) license to exercise the rights in the Work -as stated below: - -to reproduce the Work, to incorporate the Work into one or more Collective -Works, and to reproduce the Work as incorporated in the Collective Works; -to create and reproduce Derivative Works; -to distribute copies or phonorecords of, display publicly, perform publicly, and -perform publicly by means of a digital audio transmission the Work including as -incorporated in Collective Works; -to distribute copies or phonorecords of, display publicly, perform publicly, and -perform publicly by means of a digital audio transmission Derivative Works. -For the avoidance of doubt, where the work is a musical composition: - -Performance Royalties Under Blanket Licenses. Licensor waives the exclusive -right to collect, whether individually or via a performance rights society (e.g. -ASCAP, BMI, SESAC), royalties for the public performance or public digital -performance (e.g. webcast) of the Work. -Mechanical Rights and Statutory Royalties. Licensor waives the exclusive right -to collect, whether individually or via a music rights agency or designated -agent (e.g. Harry Fox Agency), royalties for any phonorecord You create from the -Work ("cover version") and distribute, subject to the compulsory license created -by 17 USC Section 115 of the US Copyright Act (or the equivalent in other -jurisdictions). -Webcasting Rights and Statutory Royalties. For the avoidance of doubt, where the -Work is a sound recording, Licensor waives the exclusive right to collect, -whether individually or via a performance-rights society (e.g. SoundExchange), -royalties for the public digital performance (e.g. webcast) of the Work, subject -to the compulsory license created by 17 USC Section 114 of the US Copyright Act -(or the equivalent in other jurisdictions). -The above rights may be exercised in all media and formats whether now known or -hereafter devised. The above rights include the right to make such modifications -as are technically necessary to exercise the rights in other media and formats. -All rights not expressly granted by Licensor are hereby reserved. - -4. Restrictions.The license granted in Section 3 above is expressly made subject -to and limited by the following restrictions: - -You may distribute, publicly display, publicly perform, or publicly digitally -perform the Work only under the terms of this License, and You must include a -copy of, or the Uniform Resource Identifier for, this License with every copy or -phonorecord of the Work You distribute, publicly display, publicly perform, or -publicly digitally perform. You may not offer or impose any terms on the Work -that alter or restrict the terms of this License or the recipients' exercise of -the rights granted hereunder. You may not sublicense the Work. You must keep -intact all notices that refer to this License and to the disclaimer of -warranties. You may not distribute, publicly display, publicly perform, or -publicly digitally perform the Work with any technological measures that control -access or use of the Work in a manner inconsistent with the terms of this -License Agreement. The above applies to the Work as incorporated in a Collective -Work, but this does not require the Collective Work apart from the Work itself -to be made subject to the terms of this License. If You create a Collective -Work, upon notice from any Licensor You must, to the extent practicable, remove -from the Collective Work any credit as required by clause 4(b), as requested. If -You create a Derivative Work, upon notice from any Licensor You must, to the -extent practicable, remove from the Derivative Work any credit as required by -clause 4(b), as requested. -If you distribute, publicly display, publicly perform, or publicly digitally -perform the Work or any Derivative Works or Collective Works, You must keep -intact all copyright notices for the Work and provide, reasonable to the medium -or means You are utilizing: (i) the name of the Original Author (or pseudonym, -if applicable) if supplied, and/or (ii) if the Original Author and/or Licensor -designate another party or parties (e.g. a sponsor institute, publishing entity, -journal) for attribution in Licensor's copyright notice, terms of service or by -other reasonable means, the name of such party or parties; the title of the Work -if supplied; to the extent reasonably practicable, the Uniform Resource -Identifier, if any, that Licensor specifies to be associated with the Work, -unless such URI does not refer to the copyright notice or licensing information -for the Work; and in the case of a Derivative Work, a credit identifying the use -of the Work in the Derivative Work (e.g., "French translation of the Work by -Original Author," or "Screenplay based on original Work by Original Author"). -Such credit may be implemented in any reasonable manner; provided, however, that -in the case of a Derivative Work or Collective Work, at a minimum such credit -will appear where any other comparable authorship credit appears and in a manner -at least as prominent as such other comparable authorship credit. -5. Representations, Warranties and Disclaimer - -UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS -THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING -THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT -LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR -PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, -OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME -JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH -EXCLUSION MAY NOT APPLY TO YOU. - -6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN -NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, -INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS -LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - -7. Termination - -This License and the rights granted hereunder will terminate automatically upon -any breach by You of the terms of this License. Individuals or entities who have -received Derivative Works or Collective Works from You under this License, -however, will not have their licenses terminated provided such individuals or -entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, -and 8 will survive any termination of this License. -Subject to the above terms and conditions, the license granted here is perpetual -(for the duration of the applicable copyright in the Work). Notwithstanding the -above, Licensor reserves the right to release the Work under different license -terms or to stop distributing the Work at any time; provided, however that any -such election will not serve to withdraw this License (or any other license that -has been, or is required to be, granted under the terms of this License), and -this License will continue in full force and effect unless terminated as stated -above. -8. Miscellaneous - -Each time You distribute or publicly digitally perform the Work or a Collective -Work, the Licensor offers to the recipient a license to the Work on the same -terms and conditions as the license granted to You under this License. -Each time You distribute or publicly digitally perform a Derivative Work, -Licensor offers to the recipient a license to the original Work on the same -terms and conditions as the license granted to You under this License. -If any provision of this License is invalid or unenforceable under applicable -law, it shall not affect the validity or enforceability of the remainder of the -terms of this License, and without further action by the parties to this -agreement, such provision shall be reformed to the minimum extent necessary to -make such provision valid and enforceable. -No term or provision of this License shall be deemed waived and no breach -consented to unless such waiver or consent shall be in writing and signed by the -party to be charged with such waiver or consent. -This License constitutes the entire agreement between the parties with respect -to the Work licensed here. There are no understandings, agreements or -representations with respect to the Work not specified here. Licensor shall not -be bound by any additional provisions that may appear in any communication from -You. This License may not be modified without the mutual written agreement of -the Licensor and You. - -The binary distribution of this product bundles these dependencies under the -following license: -jamon-runtime 2.4.1 --------------------------------------------------------------------------------- -(MPL 2.0) - Mozilla Public License - Version 2.0 - -1. Definitions - -1.1. “Contributor” -means each individual or legal entity that creates, contributes to the creation -of, or owns Covered Software. - -1.2. “Contributor Version” -means the combination of the Contributions of others (if any) used by a -Contributor and that particular Contributor’s Contribution. - -1.3. “Contribution” -means Covered Software of a particular Contributor. - -1.4. “Covered Software” -means Source Code Form to which the initial Contributor has attached the notice -in Exhibit A, the Executable Form of such Source Code Form, and Modifications of -such Source Code Form, in each case including portions thereof. - -1.5. “Incompatible With Secondary Licenses” -means - -that the initial Contributor has attached the notice described in Exhibit B to -the Covered Software; or - -that the Covered Software was made available under the terms of version 1.1 or -earlier of the License, but not also under the terms of a Secondary License. - -1.6. “Executable Form” -means any form of the work other than Source Code Form. - -1.7. “Larger Work” -means a work that combines Covered Software with other material, in a separate -file or files, that is not Covered Software. - -1.8. “License” -means this document. - -1.9. “Licensable” -means having the right to grant, to the maximum extent possible, whether at the -time of the initial grant or subsequently, any and all of the rights conveyed by -this License. - -1.10. “Modifications” -means any of the following: - -any file in Source Code Form that results from an addition to, deletion from, or -modification of the contents of Covered Software; or - -any new file in Source Code Form that contains any Covered Software. - -1.11. “Patent Claims” of a Contributor -means any patent claim(s), including without limitation, method, process, and -apparatus claims, in any patent Licensable by such Contributor that would be -infringed, but for the grant of the License, by the making, using, selling, -offering for sale, having made, import, or transfer of either its Contributions -or its Contributor Version. - -1.12. “Secondary License” -means either the GNU General Public License, Version 2.0, the GNU Lesser General -Public License, Version 2.1, the GNU Affero General Public License, Version 3.0, -or any later versions of those licenses. - -1.13. “Source Code Form” -means the form of the work preferred for making modifications. - -1.14. “You” (or “Your”) -means an individual or a legal entity exercising rights under this License. For -legal entities, “You” includes any entity that controls, is controlled by, -or is under common control with You. For purposes of this definition, -“control” means (a) the power, direct or indirect, to cause the direction or -management of such entity, whether by contract or otherwise, or (b) ownership of -more than fifty percent (50%) of the outstanding shares or beneficial ownership -of such entity. - -2. License Grants and Conditions - -2.1. Grants - -Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive -license: - -under intellectual property rights (other than patent or trademark) Licensable -by such Contributor to use, reproduce, make available, modify, display, perform, -distribute, and otherwise exploit its Contributions, either on an unmodified -basis, with Modifications, or as part of a Larger Work; and - -under Patent Claims of such Contributor to make, use, sell, offer for sale, have -made, import, and otherwise transfer either its Contributions or its Contributor -Version. - -2.2. Effective Date - -The licenses granted in Section 2.1 with respect to any Contribution become -effective for each Contribution on the date the Contributor first distributes -such Contribution. - -2.3. Limitations on Grant Scope - -The licenses granted in this Section 2 are the only rights granted under this -License. No additional rights or licenses will be implied from the distribution -or licensing of Covered Software under this License. Notwithstanding Section -2.1(b) above, no patent license is granted by a Contributor: - -for any code that a Contributor has removed from Covered Software; or - -for infringements caused by: (i) Your and any other third party’s -modifications of Covered Software, or (ii) the combination of its Contributions -with other software (except as part of its Contributor Version); or - -under Patent Claims infringed by Covered Software in the absence of its -Contributions. - -This License does not grant any rights in the trademarks, service marks, or -logos of any Contributor (except as may be necessary to comply with the notice -requirements in Section 3.4). - -2.4. Subsequent Licenses - -No Contributor makes additional grants as a result of Your choice to distribute -the Covered Software under a subsequent version of this License (see Section -10.2) or under the terms of a Secondary License (if permitted under the terms of -Section 3.3). - -2.5. Representation - -Each Contributor represents that the Contributor believes its Contributions are -its original creation(s) or it has sufficient rights to grant the rights to its -Contributions conveyed by this License. - -2.6. Fair Use - -This License is not intended to limit any rights You have under applicable -copyright doctrines of fair use, fair dealing, or other equivalents. - -2.7. Conditions + http://www.apache.org/licenses/LICENSE-2.0 -Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in -Section 2.1. +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations +under the License. -3. Responsibilities +Also, please refer to each LICENSE..txt file, which is located in +the 'license' directory of the distribution file, for the license terms of the +components that this product depends on. -3.1. Distribution of Source Form +------------------------------------------------------------------------------- +This product contains the extensions to Java Collections Framework which has +been derived from the works by JSR-166 EG, Doug Lea, and Jason T. Greene: -All distribution of Covered Software in Source Code Form, including any -Modifications that You create or to which You contribute, must be under the -terms of this License. You must inform recipients that the Source Code Form of -the Covered Software is governed by the terms of this License, and how they can -obtain a copy of this License. You may not attempt to alter or restrict the -recipients’ rights in the Source Code Form. + * LICENSE: + * license/LICENSE.jsr166y.txt (Public Domain) + * HOMEPAGE: + * http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/ + * http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbosscache/experimental/jsr166/ -3.2. Distribution of Executable Form +This product contains a modified version of Robert Harder's Public Domain +Base64 Encoder and Decoder, which can be obtained at: -If You distribute Covered Software in Executable Form then: + * LICENSE: + * license/LICENSE.base64.txt (Public Domain) + * HOMEPAGE: + * http://iharder.sourceforge.net/current/java/base64/ -such Covered Software must also be made available in Source Code Form, as -described in Section 3.1, and You must inform recipients of the Executable Form -how they can obtain a copy of such Source Code Form by reasonable means in a -timely manner, at a charge no more than the cost of distribution to the -recipient; and +This product contains a modified portion of 'Webbit', an event based +WebSocket and HTTP server, which can be obtained at: -You may distribute such Executable Form under the terms of this License, or -sublicense it under different terms, provided that the license for the -Executable Form does not attempt to limit or alter the recipients’ rights in -the Source Code Form under this License. + * LICENSE: + * license/LICENSE.webbit.txt (BSD License) + * HOMEPAGE: + * https://github.com/joewalnes/webbit -3.3. Distribution of a Larger Work +This product contains a modified portion of 'SLF4J', a simple logging +facade for Java, which can be obtained at: -You may create and distribute a Larger Work under terms of Your choice, provided -that You also comply with the requirements of this License for the Covered -Software. If the Larger Work is a combination of Covered Software with a work -governed by one or more Secondary Licenses, and the Covered Software is not -Incompatible With Secondary Licenses, this License permits You to additionally -distribute such Covered Software under the terms of such Secondary License(s), -so that the recipient of the Larger Work may, at their option, further -distribute the Covered Software under the terms of either this License or such -Secondary License(s). + * LICENSE: + * license/LICENSE.slf4j.txt (MIT License) + * HOMEPAGE: + * http://www.slf4j.org/ -3.4. Notices +This product contains a modified portion of 'Apache Harmony', an open source +Java SE, which can be obtained at: -You may not remove or alter the substance of any license notices (including -copyright notices, patent notices, disclaimers of warranty, or limitations of -liability) contained within the Source Code Form of the Covered Software, except -that You may alter any license notices to the extent required to remedy known -factual inaccuracies. + * NOTICE: + * license/NOTICE.harmony.txt + * LICENSE: + * license/LICENSE.harmony.txt (Apache License 2.0) + * HOMEPAGE: + * http://archive.apache.org/dist/harmony/ -3.5. Application of Additional Terms +This product contains a modified portion of 'jbzip2', a Java bzip2 compression +and decompression library written by Matthew J. Francis. It can be obtained at: -You may choose to offer, and to charge a fee for, warranty, support, indemnity -or liability obligations to one or more recipients of Covered Software. However, -You may do so only on Your own behalf, and not on behalf of any Contributor. You -must make it absolutely clear that any such warranty, support, indemnity, or -liability obligation is offered by You alone, and You hereby agree to indemnify -every Contributor for any liability incurred by such Contributor as a result of -warranty, support, indemnity or liability terms You offer. You may include -additional disclaimers of warranty and limitations of liability specific to any -jurisdiction. + * LICENSE: + * license/LICENSE.jbzip2.txt (MIT License) + * HOMEPAGE: + * https://code.google.com/p/jbzip2/ -4. Inability to Comply Due to Statute or Regulation +This product contains a modified portion of 'libdivsufsort', a C API library to construct +the suffix array and the Burrows-Wheeler transformed string for any input string of +a constant-size alphabet written by Yuta Mori. It can be obtained at: -If it is impossible for You to comply with any of the terms of this License with -respect to some or all of the Covered Software due to statute, judicial order, -or regulation then You must: (a) comply with the terms of this License to the -maximum extent possible; and (b) describe the limitations and the code they -affect. Such description must be placed in a text file included with all -distributions of the Covered Software under this License. Except to the extent -prohibited by statute or regulation, such description must be sufficiently -detailed for a recipient of ordinary skill to be able to understand it. + * LICENSE: + * license/LICENSE.libdivsufsort.txt (MIT License) + * HOMEPAGE: + * https://github.com/y-256/libdivsufsort -5. Termination +This product contains a modified portion of Nitsan Wakart's 'JCTools', Java Concurrency Tools for the JVM, + which can be obtained at: -5.1. The rights granted under this License will terminate automatically if You -fail to comply with any of its terms. However, if You become compliant, then the -rights granted under this License from a particular Contributor are reinstated -(a) provisionally, unless and until such Contributor explicitly and finally -terminates Your grants, and (b) on an ongoing basis, if such Contributor fails -to notify You of the non-compliance by some reasonable means prior to 60 days -after You have come back into compliance. Moreover, Your grants from a -particular Contributor are reinstated on an ongoing basis if such Contributor -notifies You of the non-compliance by some reasonable means, this is the first -time You have received notice of non-compliance with this License from such -Contributor, and You become compliant prior to 30 days after Your receipt of the -notice. - -5.2. If You initiate litigation against any entity by asserting a patent -infringement claim (excluding declaratory judgment actions, counter-claims, and -cross-claims) alleging that a Contributor Version directly or indirectly -infringes any patent, then the rights granted to You by any and all Contributors -for the Covered Software under Section 2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user -license agreements (excluding distributors and resellers) which have been -validly granted by You or Your distributors under this License prior to -termination shall survive termination. + * LICENSE: + * license/LICENSE.jctools.txt (ASL2 License) + * HOMEPAGE: + * https://github.com/JCTools/JCTools -6. Disclaimer of Warranty +This product optionally depends on 'JZlib', a re-implementation of zlib in +pure Java, which can be obtained at: -Covered Software is provided under this License on an “as is” basis, without -warranty of any kind, either expressed, implied, or statutory, including, -without limitation, warranties that the Covered Software is free of defects, -merchantable, fit for a particular purpose or non-infringing. The entire risk as -to the quality and performance of the Covered Software is with You. Should any -Covered Software prove defective in any respect, You (not any Contributor) -assume the cost of any necessary servicing, repair, or correction. This -disclaimer of warranty constitutes an essential part of this License. No use of -any Covered Software is authorized under this License except under this -disclaimer. + * LICENSE: + * license/LICENSE.jzlib.txt (BSD style License) + * HOMEPAGE: + * http://www.jcraft.com/jzlib/ -7. Limitation of Liability +This product optionally depends on 'Compress-LZF', a Java library for encoding and +decoding data in LZF format, written by Tatu Saloranta. It can be obtained at: -Under no circumstances and under no legal theory, whether tort (including -negligence), contract, or otherwise, shall any Contributor, or anyone who -distributes Covered Software as permitted above, be liable to You for any -direct, indirect, special, incidental, or consequential damages of any character -including, without limitation, damages for lost profits, loss of goodwill, work -stoppage, computer failure or malfunction, or any and all other commercial -damages or losses, even if such party shall have been informed of the -possibility of such damages. This limitation of liability shall not apply to -liability for death or personal injury resulting from such party’s negligence -to the extent applicable law prohibits such limitation. Some jurisdictions do -not allow the exclusion or limitation of incidental or consequential damages, so -this exclusion and limitation may not apply to You. + * LICENSE: + * license/LICENSE.compress-lzf.txt (Apache License 2.0) + * HOMEPAGE: + * https://github.com/ning/compress -8. Litigation +This product optionally depends on 'lz4', a LZ4 Java compression +and decompression library written by Adrien Grand. It can be obtained at: -Any litigation relating to this License may be brought only in the courts of a -jurisdiction where the defendant maintains its principal place of business and -such litigation shall be governed by laws of that jurisdiction, without -reference to its conflict-of-law provisions. Nothing in this Section shall -prevent a party’s ability to bring cross-claims or counter-claims. + * LICENSE: + * license/LICENSE.lz4.txt (Apache License 2.0) + * HOMEPAGE: + * https://github.com/jpountz/lz4-java -9. Miscellaneous +This product optionally depends on 'lzma-java', a LZMA Java compression +and decompression library, which can be obtained at: -This License represents the complete agreement concerning the subject matter -hereof. If any provision of this License is held to be unenforceable, such -provision shall be reformed only to the extent necessary to make it enforceable. -Any law or regulation which provides that the language of a contract shall be -construed against the drafter shall not be used to construe this License against -a Contributor. + * LICENSE: + * license/LICENSE.lzma-java.txt (Apache License 2.0) + * HOMEPAGE: + * https://github.com/jponge/lzma-java -10. Versions of the License +This product contains a modified portion of 'jfastlz', a Java port of FastLZ compression +and decompression library written by William Kinney. It can be obtained at: -10.1. New Versions + * LICENSE: + * license/LICENSE.jfastlz.txt (MIT License) + * HOMEPAGE: + * https://code.google.com/p/jfastlz/ -Mozilla Foundation is the license steward. Except as provided in Section 10.3, -no one other than the license steward has the right to modify or publish new -versions of this License. Each version will be given a distinguishing version -number. +This product contains a modified portion of and optionally depends on 'Protocol Buffers', Google's data +interchange format, which can be obtained at: -10.2. Effect of New Versions + * LICENSE: + * license/LICENSE.protobuf.txt (New BSD License) + * HOMEPAGE: + * https://github.com/google/protobuf -You may distribute the Covered Software under the terms of the version of the -License under which You originally received the Covered Software, or under the -terms of any subsequent version published by the license steward. +This product optionally depends on 'Bouncy Castle Crypto APIs' to generate +a temporary self-signed X.509 certificate when the JVM does not provide the +equivalent functionality. It can be obtained at: -10.3. Modified Versions + * LICENSE: + * license/LICENSE.bouncycastle.txt (MIT License) + * HOMEPAGE: + * http://www.bouncycastle.org/ -If you create software not governed by this License, and you want to create a -new license for such software, you may create and use a modified version of this -License if you rename the license and remove any references to the name of the -license steward (except to note that such modified license differs from this -License). +This product optionally depends on 'Snappy', a compression library produced +by Google Inc, which can be obtained at: -10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses + * LICENSE: + * license/LICENSE.snappy.txt (New BSD License) + * HOMEPAGE: + * https://github.com/google/snappy -If You choose to distribute Source Code Form that is Incompatible With Secondary -Licenses under the terms of this version of the License, the notice described in -Exhibit B of this License must be attached. +This product optionally depends on 'JBoss Marshalling', an alternative Java +serialization API, which can be obtained at: -Exhibit A - Source Code Form License Notice + * LICENSE: + * license/LICENSE.jboss-marshalling.txt (GNU LGPL 2.1) + * HOMEPAGE: + * http://www.jboss.org/jbossmarshalling -This Source Code Form is subject to the terms of the Mozilla Public License, v. -2.0. If a copy of the MPL was not distributed with this file, You can obtain one -at https://mozilla.org/MPL/2.0/. +This product optionally depends on 'Caliper', Google's micro- +benchmarking framework, which can be obtained at: -If it is not possible or desirable to put the notice in a particular file, then -You may include the notice in a location (such as a LICENSE file in a relevant -directory) where a recipient would be likely to look for such a notice. + * LICENSE: + * license/LICENSE.caliper.txt (Apache License 2.0) + * HOMEPAGE: + * https://github.com/google/caliper -You may add additional accurate notices of copyright ownership. +This product optionally depends on 'Apache Commons Logging', a logging +framework, which can be obtained at: -Exhibit B - “Incompatible With Secondary Licenses” Notice + * LICENSE: + * license/LICENSE.commons-logging.txt (Apache License 2.0) + * HOMEPAGE: + * http://commons.apache.org/logging/ -This Source Code Form is “Incompatible With Secondary Licenses”, as defined -by the Mozilla Public License, v. 2.0. +This product optionally depends on 'Apache Log4J', a logging framework, which +can be obtained at: -The binary distribution of this product bundles these dependencies under the -following license: -JDOM 1.1 --------------------------------------------------------------------------------- -/*-- + * LICENSE: + * license/LICENSE.log4j.txt (Apache License 2.0) + * HOMEPAGE: + * http://logging.apache.org/log4j/ - Copyright (C) 2000-2004 Jason Hunter & Brett McLaughlin. - All rights reserved. +This product optionally depends on 'Aalto XML', an ultra-high performance +non-blocking XML processor, which can be obtained at: - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: + * LICENSE: + * license/LICENSE.aalto-xml.txt (Apache License 2.0) + * HOMEPAGE: + * http://wiki.fasterxml.com/AaltoHome - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions, and the following disclaimer. +This product contains a modified version of 'HPACK', a Java implementation of +the HTTP/2 HPACK algorithm written by Twitter. It can be obtained at: - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions, and the disclaimer that follows - these conditions in the documentation and/or other materials - provided with the distribution. + * LICENSE: + * license/LICENSE.hpack.txt (Apache License 2.0) + * HOMEPAGE: + * https://github.com/twitter/hpack - 3. The name "JDOM" must not be used to endorse or promote products - derived from this software without prior written permission. For - written permission, please contact . +This product contains a modified portion of 'Apache Commons Lang', a Java library +provides utilities for the java.lang API, which can be obtained at: - 4. Products derived from this software may not be called "JDOM", nor - may "JDOM" appear in their name, without prior written permission - from the JDOM Project Management . + * LICENSE: + * license/LICENSE.commons-lang.txt (Apache License 2.0) + * HOMEPAGE: + * https://commons.apache.org/proper/commons-lang/ - In addition, we request (but do not require) that you include in the - end-user documentation provided with the redistribution and/or in the - software itself an acknowledgement equivalent to the following: - "This product includes software developed by the - JDOM Project (http://www.jdom.org/)." - Alternatively, the acknowledgment may be graphical using the logos - available at http://www.jdom.org/images/logos. - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE JDOM AUTHORS OR THE PROJECT - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE. +This product contains the Maven wrapper scripts from 'Maven Wrapper', that provides an easy way to ensure a user has everything necessary to run the Maven build. - This software consists of voluntary contributions made by many - individuals on behalf of the JDOM Project and was originally - created by Jason Hunter and - Brett McLaughlin . For more information - on the JDOM Project, please see . + * LICENSE: + * license/LICENSE.mvn-wrapper.txt (Apache License 2.0) + * HOMEPAGE: + * https://github.com/takari/maven-wrapper - */ -The binary distribution of this product bundles these dependencies under the -following license: -Hbase Server 1.2.4 --------------------------------------------------------------------------------- -This project bundles a derivative image for our Orca Logo. This image is -available under the Creative Commons By Attribution 3.0 License. - - Creative Commons Legal Code - - Attribution 3.0 Unported - - CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE - LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN - ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS - INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES - REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR - DAMAGES RESULTING FROM ITS USE. - - License - - THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE - COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY - COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS - AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED. - - BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE - TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY - BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS - CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND - CONDITIONS. - - 1. Definitions - - a. "Adaptation" means a work based upon the Work, or upon the Work and - other pre-existing works, such as a translation, adaptation, - derivative work, arrangement of music or other alterations of a - literary or artistic work, or phonogram or performance and includes - cinematographic adaptations or any other form in which the Work may be - recast, transformed, or adapted including in any form recognizably - derived from the original, except that a work that constitutes a - Collection will not be considered an Adaptation for the purpose of - this License. For the avoidance of doubt, where the Work is a musical - work, performance or phonogram, the synchronization of the Work in - timed-relation with a moving image ("synching") will be considered an - Adaptation for the purpose of this License. - b. "Collection" means a collection of literary or artistic works, such as - encyclopedias and anthologies, or performances, phonograms or - broadcasts, or other works or subject matter other than works listed - in Section 1(f) below, which, by reason of the selection and - arrangement of their contents, constitute intellectual creations, in - which the Work is included in its entirety in unmodified form along - with one or more other contributions, each constituting separate and - independent works in themselves, which together are assembled into a - collective whole. A work that constitutes a Collection will not be - considered an Adaptation (as defined above) for the purposes of this - License. - c. "Distribute" means to make available to the public the original and - copies of the Work or Adaptation, as appropriate, through sale or - other transfer of ownership. - d. "Licensor" means the individual, individuals, entity or entities that - offer(s) the Work under the terms of this License. - e. "Original Author" means, in the case of a literary or artistic work, - the individual, individuals, entity or entities who created the Work - or if no individual or entity can be identified, the publisher; and in - addition (i) in the case of a performance the actors, singers, - musicians, dancers, and other persons who act, sing, deliver, declaim, - play in, interpret or otherwise perform literary or artistic works or - expressions of folklore; (ii) in the case of a phonogram the producer - being the person or legal entity who first fixes the sounds of a - performance or other sounds; and, (iii) in the case of broadcasts, the - organization that transmits the broadcast. - f. "Work" means the literary and/or artistic work offered under the terms - of this License including without limitation any production in the - literary, scientific and artistic domain, whatever may be the mode or - form of its expression including digital form, such as a book, - pamphlet and other writing; a lecture, address, sermon or other work - of the same nature; a dramatic or dramatico-musical work; a - choreographic work or entertainment in dumb show; a musical - composition with or without words; a cinematographic work to which are - assimilated works expressed by a process analogous to cinematography; - a work of drawing, painting, architecture, sculpture, engraving or - lithography; a photographic work to which are assimilated works - expressed by a process analogous to photography; a work of applied - art; an illustration, map, plan, sketch or three-dimensional work - relative to geography, topography, architecture or science; a - performance; a broadcast; a phonogram; a compilation of data to the - extent it is protected as a copyrightable work; or a work performed by - a variety or circus performer to the extent it is not otherwise - considered a literary or artistic work. - g. "You" means an individual or entity exercising rights under this - License who has not previously violated the terms of this License with - respect to the Work, or who has received express permission from the - Licensor to exercise rights under this License despite a previous - violation. - h. "Publicly Perform" means to perform public recitations of the Work and - to communicate to the public those public recitations, by any means or - process, including by wire or wireless means or public digital - performances; to make available to the public Works in such a way that - members of the public may access these Works from a place and at a - place individually chosen by them; to perform the Work to the public - by any means or process and the communication to the public of the - performances of the Work, including by public digital performance; to - broadcast and rebroadcast the Work by any means including signs, - sounds or images. - i. "Reproduce" means to make copies of the Work by any means including - without limitation by sound or visual recordings and the right of - fixation and reproducing fixations of the Work, including storage of a - protected performance or phonogram in digital form or other electronic - medium. - - 2. Fair Dealing Rights. Nothing in this License is intended to reduce, - limit, or restrict any uses free from copyright or rights arising from - limitations or exceptions that are provided for in connection with the - copyright protection under copyright law or other applicable laws. - - 3. License Grant. Subject to the terms and conditions of this License, - Licensor hereby grants You a worldwide, royalty-free, non-exclusive, - perpetual (for the duration of the applicable copyright) license to - exercise the rights in the Work as stated below: - - a. to Reproduce the Work, to incorporate the Work into one or more - Collections, and to Reproduce the Work as incorporated in the - Collections; - b. to create and Reproduce Adaptations provided that any such Adaptation, - including any translation in any medium, takes reasonable steps to - clearly label, demarcate or otherwise identify that changes were made - to the original Work. For example, a translation could be marked "The - original work was translated from English to Spanish," or a - modification could indicate "The original work has been modified."; - c. to Distribute and Publicly Perform the Work including as incorporated - in Collections; and, - d. to Distribute and Publicly Perform Adaptations. - e. For the avoidance of doubt: - - i. Non-waivable Compulsory License Schemes. In those jurisdictions in - which the right to collect royalties through any statutory or - compulsory licensing scheme cannot be waived, the Licensor - reserves the exclusive right to collect such royalties for any - exercise by You of the rights granted under this License; - ii. Waivable Compulsory License Schemes. In those jurisdictions in - which the right to collect royalties through any statutory or - compulsory licensing scheme can be waived, the Licensor waives the - exclusive right to collect such royalties for any exercise by You - of the rights granted under this License; and, - iii. Voluntary License Schemes. The Licensor waives the right to - collect royalties, whether individually or, in the event that the - Licensor is a member of a collecting society that administers - voluntary licensing schemes, via that society, from any exercise - by You of the rights granted under this License. - - The above rights may be exercised in all media and formats whether now - known or hereafter devised. The above rights include the right to make - such modifications as are technically necessary to exercise the rights in - other media and formats. Subject to Section 8(f), all rights not expressly - granted by Licensor are hereby reserved. - - 4. Restrictions. The license granted in Section 3 above is expressly made - subject to and limited by the following restrictions: - - a. You may Distribute or Publicly Perform the Work only under the terms - of this License. You must include a copy of, or the Uniform Resource - Identifier (URI) for, this License with every copy of the Work You - Distribute or Publicly Perform. You may not offer or impose any terms - on the Work that restrict the terms of this License or the ability of - the recipient of the Work to exercise the rights granted to that - recipient under the terms of the License. You may not sublicense the - Work. You must keep intact all notices that refer to this License and - to the disclaimer of warranties with every copy of the Work You - Distribute or Publicly Perform. When You Distribute or Publicly - Perform the Work, You may not impose any effective technological - measures on the Work that restrict the ability of a recipient of the - Work from You to exercise the rights granted to that recipient under - the terms of the License. This Section 4(a) applies to the Work as - incorporated in a Collection, but this does not require the Collection - apart from the Work itself to be made subject to the terms of this - License. If You create a Collection, upon notice from any Licensor You - must, to the extent practicable, remove from the Collection any credit - as required by Section 4(b), as requested. If You create an - Adaptation, upon notice from any Licensor You must, to the extent - practicable, remove from the Adaptation any credit as required by - Section 4(b), as requested. - b. If You Distribute, or Publicly Perform the Work or any Adaptations or - Collections, You must, unless a request has been made pursuant to - Section 4(a), keep intact all copyright notices for the Work and - provide, reasonable to the medium or means You are utilizing: (i) the - name of the Original Author (or pseudonym, if applicable) if supplied, - and/or if the Original Author and/or Licensor designate another party - or parties (e.g., a sponsor institute, publishing entity, journal) for - attribution ("Attribution Parties") in Licensor's copyright notice, - terms of service or by other reasonable means, the name of such party - or parties; (ii) the title of the Work if supplied; (iii) to the - extent reasonably practicable, the URI, if any, that Licensor - specifies to be associated with the Work, unless such URI does not - refer to the copyright notice or licensing information for the Work; - and (iv) , consistent with Section 3(b), in the case of an Adaptation, - a credit identifying the use of the Work in the Adaptation (e.g., - "French translation of the Work by Original Author," or "Screenplay - based on original Work by Original Author"). The credit required by - this Section 4 (b) may be implemented in any reasonable manner; - provided, however, that in the case of a Adaptation or Collection, at - a minimum such credit will appear, if a credit for all contributing - authors of the Adaptation or Collection appears, then as part of these - credits and in a manner at least as prominent as the credits for the - other contributing authors. For the avoidance of doubt, You may only - use the credit required by this Section for the purpose of attribution - in the manner set out above and, by exercising Your rights under this - License, You may not implicitly or explicitly assert or imply any - connection with, sponsorship or endorsement by the Original Author, - Licensor and/or Attribution Parties, as appropriate, of You or Your - use of the Work, without the separate, express prior written - permission of the Original Author, Licensor and/or Attribution - Parties. - c. Except as otherwise agreed in writing by the Licensor or as may be - otherwise permitted by applicable law, if You Reproduce, Distribute or - Publicly Perform the Work either by itself or as part of any - Adaptations or Collections, You must not distort, mutilate, modify or - take other derogatory action in relation to the Work which would be - prejudicial to the Original Author's honor or reputation. Licensor - agrees that in those jurisdictions (e.g. Japan), in which any exercise - of the right granted in Section 3(b) of this License (the right to - make Adaptations) would be deemed to be a distortion, mutilation, - modification or other derogatory action prejudicial to the Original - Author's honor and reputation, the Licensor will waive or not assert, - as appropriate, this Section, to the fullest extent permitted by the - applicable national law, to enable You to reasonably exercise Your - right under Section 3(b) of this License (right to make Adaptations) - but not otherwise. - - 5. Representations, Warranties and Disclaimer - - UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR - OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY - KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, - INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, - FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF - LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, - WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION - OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU. - - 6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE - LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR - ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES - ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS - BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - - 7. Termination - - a. This License and the rights granted hereunder will terminate - automatically upon any breach by You of the terms of this License. - Individuals or entities who have received Adaptations or Collections - from You under this License, however, will not have their licenses - terminated provided such individuals or entities remain in full - compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will - survive any termination of this License. - b. Subject to the above terms and conditions, the license granted here is - perpetual (for the duration of the applicable copyright in the Work). - Notwithstanding the above, Licensor reserves the right to release the - Work under different license terms or to stop distributing the Work at - any time; provided, however that any such election will not serve to - withdraw this License (or any other license that has been, or is - required to be, granted under the terms of this License), and this - License will continue in full force and effect unless terminated as - stated above. - - 8. Miscellaneous - - a. Each time You Distribute or Publicly Perform the Work or a Collection, - the Licensor offers to the recipient a license to the Work on the same - terms and conditions as the license granted to You under this License. - b. Each time You Distribute or Publicly Perform an Adaptation, Licensor - offers to the recipient a license to the original Work on the same - terms and conditions as the license granted to You under this License. - c. If any provision of this License is invalid or unenforceable under - applicable law, it shall not affect the validity or enforceability of - the remainder of the terms of this License, and without further action - by the parties to this agreement, such provision shall be reformed to - the minimum extent necessary to make such provision valid and - enforceable. - d. No term or provision of this License shall be deemed waived and no - breach consented to unless such waiver or consent shall be in writing - and signed by the party to be charged with such waiver or consent. - e. This License constitutes the entire agreement between the parties with - respect to the Work licensed here. There are no understandings, - agreements or representations with respect to the Work not specified - here. Licensor shall not be bound by any additional provisions that - may appear in any communication from You. This License may not be - modified without the mutual written agreement of the Licensor and You. - f. The rights granted under, and the subject matter referenced, in this - License were drafted utilizing the terminology of the Berne Convention - for the Protection of Literary and Artistic Works (as amended on - September 28, 1979), the Rome Convention of 1961, the WIPO Copyright - Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 - and the Universal Copyright Convention (as revised on July 24, 1971). - These rights and subject matter take effect in the relevant - jurisdiction in which the License terms are sought to be enforced - according to the corresponding provisions of the implementation of - those treaty provisions in the applicable national law. If the - standard suite of rights granted under applicable copyright law - includes additional rights not granted under this License, such - additional rights are deemed to be included in the License; this - License is not intended to restrict the license of any rights under - applicable law. - - - Creative Commons Notice - - Creative Commons is not a party to this License, and makes no warranty - whatsoever in connection with the Work. Creative Commons will not be - liable to You or any party on any legal theory for any damages - whatsoever, including without limitation any general, special, - incidental or consequential damages arising in connection to this - license. Notwithstanding the foregoing two (2) sentences, if Creative - Commons has expressly identified itself as the Licensor hereunder, it - shall have all rights and obligations of Licensor. - - Except for the limited purpose of indicating to the public that the - Work is licensed under the CCPL, Creative Commons does not authorize - the use by either party of the trademark "Creative Commons" or any - related trademark or logo of Creative Commons without the prior - written consent of Creative Commons. Any permitted use will be in - compliance with Creative Commons' then-current trademark usage - guidelines, as may be published on its website or otherwise made - available upon request from time to time. For the avoidance of doubt, - this trademark restriction does not form part of this License. - - Creative Commons may be contacted at https://creativecommons.org/. --------------------------------------------------------------------------------- +This product includes software developed by Google + Snappy: http://code.google.com/p/snappy/ (New BSD License) -For: hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs -/server/datanode/checker/AbstractFuture.java and -hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs -/server/datanode/checker/TimeoutFuture.java +This product includes software developed by Apache + PureJavaCrc32C from apache-hadoop-common http://hadoop.apache.org/ + (Apache 2.0 license) -Copyright (C) 2007 The Guava Authors +This library containd statically linked libstdc++. This inclusion is allowed by +"GCC RUntime Library Exception" +http://gcc.gnu.org/onlinedocs/libstdc++/manual/license.html -Licensed under the Apache License, Version 2.0 (the "License"); you may not -use this file except in compliance with the License. You may obtain a copy of -the License at +== Contributors == + * Tatu Saloranta + * Providing benchmark suite + * Alec Wysoker + * Performance and memory usage improvement -http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -License for the specific language governing permissions and limitations under -the License. +Apache ZooKeeper +Copyright 2009-2018 The Apache Software Foundation -Source materials are available for download at: http://maven.ibiblio.org/maven2/org/apache/hadoop/ -AspectJ 1.8.9 -Attribution Statements -https://www.eclipse.org/aspectj/ +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). Copyright Statements -Copyright © 2018 The Eclipse Foundation. All Rights Reserved. +Copyright (C) 2016, The Apache Software Foundation -License Text (https://spdx.org/licenses/EPL-1.0.html) -Made available under the Eclipse Public License 1.0. See Appendix for full text. +License Text (http://www.apache.org/licenses/LICENSE-2.0.txt) +Made available under the Apache License 2.0. See Appendix for full text. -Source materials are available for download at: http://git.eclipse.org/c/aspectj/org.aspectj.git +Source materials are available for download at: https://github.com/apache/hadoop AST Types 0.13.2 Attribution Statements https://github.com/benjamn/ast-types @@ -3913,39 +1648,6 @@ License Text (http://spdx.org/licenses/MIT) Made available under the MIT License. See Appendix for full text. Source materials are available for download at: https://github.com/davidbonnet/astring -Autoprefixer 8.6.5 -Attribution Statements -https://twitter.com/autoprefixer - -Copyright Statements -Copyright 2013 Andrey Sitnik - -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. - -Source materials are available for download at: https://github.com/postcss/autoprefixer -Babel 7.4.4 -Attribution Statements -https://babeljs.io/ - -Copyright Statements -Copyright (c) 2014-present Sebastian McKenzie and other contributors - -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. - -Source materials are available for download at: https://github.com/babel/babel/ -Babel Loader 8.0.5 -Attribution Statements -https://github.com/babel/babel-loader - -Copyright Statements -Copyright (c) 2014-2016 Luís Couto - -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. - -Source materials are available for download at: https://github.com/babel/babel-loader BigInteger.js 1.6.48 Attribution Statements https://github.com/peterolson/BigInteger.js @@ -4036,7 +1738,7 @@ Copyright (c) 2009-2014 Luaj.org. Copyright Statements Axel Kramer -License Text (http:// https://spdx.org/licenses/EPL-1.0.html) +License Text (Error! Hyperlink reference not valid.) Made available under the Eclipse Public License 1.0. See Appendix for full text. Source materials are available for download at: https://bitbucket.org/axelclk/info.bliki.wiki/src @@ -4051,18 +1753,6 @@ License Text (http://spdx.org/licenses/MIT) Made available under the MIT License. See Appendix for full text. Source materials are available for download at: https://github.com/petkaantonov/bluebird -body-parser 1.18.3 -Attribution Statements -https://github.com/expressjs/body-parser - -Copyright Statements -Copyright (c) 2014 Jonathan Ong -Copyright (c) 2014-2015 Douglas Christopher Wilson - -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. - -Source materials are available for download at: https://github.com/expressjs/body-parser Bootstrap 4.0.0-alpha.5 Attribution Statements http://getbootstrap.com @@ -4108,17 +1798,6 @@ License Text (http://spdx.org/licenses/MIT) Made available under the MIT License. See Appendix for full text. Source materials are available for download at: https://github.com/chaijs/chai -Chalk 2.4.2 -Attribution Statements -https://github.com/chalk/chalk - -Copyright Statements -Copyright (c) Sindre Sorhus (sindresorhus.com) - -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. - -Source materials are available for download at: https://github.com/chalk/chalk classList.js 1.1.20150312 Attribution Statements https://www.npmjs.com/package/classlist.js @@ -4152,32 +1831,6 @@ License Text (http://spdx.org/licenses/MIT) Made available under the MIT License. See Appendix for full text. Source materials are available for download at: https://github.com/mgechev/codelyzer -CodeMirror 5.42.2 -Attribution Statements -http://codemirror.net/ - -CodeMirror may depend on xquery-hint -Copyright (C) 2013 by Angelo ZERR -Made available under the MIT License. - -Copyright Statements -Copyright (C) 2017 by Marijn Haverbeke and others - -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. - -Source materials are available for download at: https://github.com/codemirror/codemirror -Compodoc 0.0.41 -Attribution Statements -https://compodoc.app/ - -Copyright Statements -Copyright (c) 2016 Vincent Ogloblinsky - -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. - -Source materials are available for download at: https://github.com/compodoc/compodoc concat-stream 2.0.0 Attribution Statements https://github.com/maxogden/concat-stream @@ -4189,42 +1842,6 @@ License Text (http://spdx.org/licenses/MIT) Made available under the MIT License. See Appendix for full text. Source materials are available for download at: https://github.com/maxogden/concat-stream -Concurrently 4.1.0 -Attribution Statements -https://github.com/kimmobrunfeldt/concurrently - -Copyright Statements -Copyright (c) 2015 Kimmo Brunfeldt - -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. - -Source materials are available for download at: https://github.com/kimmobrunfeldt/concurrently -Connect 3.6.6 -Attribution Statements -https://github.com/senchalabs/connect - -Copyright Statements -Copyright (c) 2010 Sencha Inc. -Copyright (c) 2011 LearnBoost -Copyright (c) 2011-2014 TJ Holowaychuk -Copyright (c) 2015 Douglas Christopher Wilson - -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. - -Source materials are available for download at: https://github.com/senchalabs/connect -Copy Webpack Plugin 4.6.0 -Attribution Statements -https://github.com/webpack-contrib/copy-webpack-plugin - -Copyright Statements -Copyright JS Foundation and other contributors - -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. - -Source materials are available for download at: https://github.com/webpack-contrib/copy-webpack-plugin core-js 2.5.1 Attribution Statements https://github.com/zloirock/core-js @@ -4258,17 +1875,6 @@ License Text (http://spdx.org/licenses/MIT) Made available under the MIT License. See Appendix for full text. Source materials are available for download at: https://github.com/isaacs/core-util-is -css-loader 2.1.1 -Attribution Statements -https://github.com/webpack-contrib/css-loader - -Copyright Statements -Copyright JS Foundation and other contributors - -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. - -Source materials are available for download at: https://github.com/webpack-contrib/css-loader custom-event-polyfill 1.0.6 Attribution Statements https://github.com/kumarharsh/custom-event-polyfill @@ -4408,42 +2014,6 @@ License Text (http://spdx.org/licenses/Apache-2.0) Made available under the Apache License 2.0. See Appendix for full text. Source materials are available for download at: https://www.npmjs.com/package/e2e -ESLint Scope 4.0.0 -Attribution Statements -https://github.com/eslint/eslint-scope - -Copyright Statements -Copyright JS Foundation and other contributors, https://js.foundation -Copyright (C) 2012-2013 Yusuke Suzuki (twitter: @Constellation) and other contributors. - -License Text (http://spdx.org/licenses/BSD-2-Clause) -Made available under the BSD 2-Clause "Simplified" or "FreeBSD" License. See Appendix for full text. - -Source materials are available for download at: https://github.com/eslint/eslint-scope -EventSource 1.0.7 -Attribution Statements -https://github.com/EventSource/eventsource - -Copyright Statements -Copyright (c) EventSource GitHub organisation - -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. - -Source materials are available for download at: https://github.com/EventSource/eventsource -Express 4.16.3 -Attribution Statements -https://expressjs.com/ - -Copyright Statements -Copyright (c) 2009-2014 TJ Holowaychuk -Copyright (c) 2013-2014 Roman Shtylman -Copyright (c) 2014-2015 Douglas Christopher Wilson - -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. - -Source materials are available for download at: https://github.com/expressjs/express fast-xml-parser 3.17.1 Attribution Statements https://github.com/NaturalIntelligence/fast-xml-parser @@ -4477,20 +2047,9 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -Source materials are available for download at: https://github.com/NaturalIntelligence/fast-xml-parser -file-loader 3.0.1 -Attribution Statements -https://github.com/webpack-contrib/file-loader - -Copyright Statements -Copyright JS Foundation and other contributors - -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. +SOFTWARE. -Source materials are available for download at: https://github.com/webpack-contrib/file-loader +Source materials are available for download at: https://github.com/NaturalIntelligence/fast-xml-parser FileSaver.js 1.3.3 Attribution Statements https://eligrey.com/blog/saving-generated-files-on-the-client-side/ @@ -5153,14 +2712,14 @@ License Text (http://spdx.org/licenses/Apache-2.0) Made available under the Apache License 2.0. See Appendix for full text. Source materials are available for download at: https://github.com/google/gson -Guava 18.0 +Guava 25.0 Attribution Statements -https://github.com/google/guava/wiki/Release18 +https://github.com/google/guava Copyright Statements -Copyright (C) 2015 The Guava Authors +Copyright (C) 2018 The Guava Authors -License Text (http://spdx.org/licenses/Apache-2.0.html) +License Text (http://www.apache.org/licenses/LICENSE-2.0.txt) Made available under the Apache License 2.0. See Appendix for full text. Source materials are available for download at: https://github.com/google/guava @@ -5251,17 +2810,6 @@ Copyright Statements License Text () Made available under commercial license. -HTML Webpack Plugin 4.0.0-beta.5 -Attribution Statements -https://github.com/jantimon/html-webpack-plugin - -Copyright Statements -Copyright JS Foundation and other contributors - -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. - -Source materials are available for download at: https://github.com/jantimon/html-webpack-plugin HtmlCleaner 2.21 Attribution Statements http://htmlcleaner.sourceforge.net/ @@ -5273,17 +2821,6 @@ License Text (https://spdx.org/licenses/BSD-3-Clause.html) Made available under the BSD 3-Clause "New" or "Revised" License. See Appendix for full text. Source materials are available for download at: http://htmlcleaner.sourceforge.net/download.php -http-proxy-middleware 0.19.1 -Attribution Statements -https://github.com/chimurai/http-proxy-middleware - -Copyright Statements -Copyright (c) 2015 Steven Chim - -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. - -Source materials are available for download at: https://github.com/chimurai/http-proxy-middleware HyperSQL Database (HSQLDB) 2.4.0 Attribution Statements http://hsqldb.org/ @@ -5506,19 +3043,6 @@ License Text (http://spdx.org/licenses/Apache-2.0.html) Made available under the Apache License 2.0. See Appendix for full text. Source materials are available for download at: https://mvnrepository.com/artifact/com.fasterxml.jackson.module/jackson-module-kotlin -Jaeger 1.12 -Attribution Statements -https://www.jaegertracing.io/ - -Includes software developed at Uber Technologies, Inc. (https://eng.uber.com/). - -Copyright Statements -Copyright 2015-2019 The Jaeger Project Authors - -License Text (http://spdx.org/licenses/Apache-2.0.html) -Made available under the Apache License 2.0. See Appendix for full text. - -Source materials are available for download at: https://github.com/jaegertracing/jaeger Jasmine 2.8.0 Attribution Statements https://jasmine.github.io/ @@ -5745,17 +3269,6 @@ License Text (https://spdx.org/licenses/MIT.html) Made available under the MIT License. See Appendix for full text. Source materials are available for download at: https://github.com/jquery/jquery -JS-YAML 3.13.1 -Attribution Statements -http://nodeca.github.io/js-yaml/ - -Copyright Statements -Copyright (C) 2011-2015 by Vitaly Puzrin - -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. - -Source materials are available for download at: https://github.com/nodeca/js-yaml JSDoc 3.6.3 Attribution Statements http://usejsdoc.org/ @@ -5999,6 +3512,23 @@ Copyright © 2002-2017 JUnit. All Rights Reserved. License Text (http://spdx.org/licenses/EPL-1.0) Made available under the Eclipse Public License 1.0. See Appendix for full text. +Source materials are available for download at: https://github.com/junit-team/junit4 +JUnit 4.13.1 +Attribution Statements +https://junit.org/ + +JUnit depends on Java Hamcrest +http://hamcrest.org/JavaHamcrest/ +Copyright (c) 2000-2015 www.hamcrest.org. All rights reserved. +Made available under the MIT License. +https://spdx.org/licenses/MIT.html + +Copyright Statements +Copyright (C) 2021, Kevin Cooney, Stefan Birkner, JUnit, David Saff, Marc Philipp + +License Text (http://spdx.org/licenses/EPL-1.0) +Made available under the Eclipse Public License 1.0. See Appendix for full text. + Source materials are available for download at: https://github.com/junit-team/junit4 JUnit 5.4.2 Attribution Statements @@ -6107,535 +3637,1425 @@ Lodash 4.17.13 Attribution Statements https://lodash.com/ -Based on Underscore.js, copyright Jeremy Ashkenas, -DocumentCloud and Investigative Reporters & Editors +Based on Underscore.js, copyright Jeremy Ashkenas, +DocumentCloud and Investigative Reporters & Editors + +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. + +Copyright Statements +Copyright (C) 2018, John-David Dalton + +License Text (http://spdx.org/licenses/MIT) +Made available under the MIT License. See Appendix for full text. + +Source materials are available for download at: https://github.com/lodash/lodash +Logback 1.2.3 +Attribution Statements +http://logback.qos.ch + +Copyright Statements +Copyright (C) 1999-2015, QOS.ch. All rights reserved. + +License Text (http://spdx.org/licenses/EPL-1.0) +Made available under the Eclipse Public License 1.0. See Appendix for full text. + +Source materials are available for download at: https://github.com/qos-ch/logback +Lunr 0.5.11 +Attribution Statements +https://lunrjs.com/ + +Copyright Statements +Copyright (C) 2015 Oliver Nightingale + +License Text (http://spdx.org/licenses/MIT) +Made available under the MIT License. See Appendix for full text. + +Source materials are available for download at: https://github.com/olivernn/lunr.js +MapR 5.1.0 +Attribution Statements +https://mapr.com/ + +Copyright Statements +MapR Technologies, Inc. + +License Text () +Made available under commercial license. + +Source materials are available for download at: https://mapr.com/download/ +MapR Hadoop Bundle 2.7.0-mapr-1602 +Attribution Statements +https://mapr.com/products/apache-hadoop/ + +Copyright Statements +© MapR Technologies, Inc. All Rights Reserved + +License Text (http://spdx.org/licenses/Apache-2.0) +Made available under the Apache License 2.0. See Appendix for full text. + +Source materials are available for download at: http://repository.mapr.com/nexus/content/groups/mapr-public/org/apache/hadoop/ +Material Design Icons (MDI) Iconfont 3.0.3 +Attribution Statements +http://google.github.io/material-design-icons/ + +Copyright Statements +Copyright (C) 2016, Material Design Authors + +License Text (https://spdx.org/licenses/Apache-2.0.html) +Made available under the Apache License 2.0. See Appendix for full text. + +Source materials are available for download at: https://github.com/jossef/material-design-icons-iconfont +Material Design Icons (MDI) Webfont 2.2.43 +Attribution Statements +https://materialdesignicons.com/ + +Copyright Statements +Copyright (c) 2014, Austin Andrews (http://materialdesignicons.com/), with Reserved Font Name Material Design Icons. + +Copyright (c) 2014, Google (http://www.google.com/design/) uses the license at https://github.com/google/material-design-icons/blob/master/LICENSE + +License Text (https://spdx.org/licenses/OFL-1.1.html) +Made available under the SIL Open Font License 1.1. See Appendix for full text. + +Source materials are available for download at: https://github.com/Templarian/MaterialDesign-Webfont +Material Design Lite 1.3.0 +Attribution Statements +http://getmdl.io + +Copyright Statements +Copyright (C) 2016, Google + +License Text (http://spdx.org/licenses/Apache-2.0) +Made available under the Apache License 2.0. See Appendix for full text. + +Source materials are available for download at: https://github.com/google/material-design-lite +MIT Kerberos v5 1.1.2 +Attribution Statements +http://web.mit.edu/kerberos/www/ + +MIT Kerberos may include software under licence from the following copyright holders: +Copyright 1993 by OpenVision Technologies, Inc., All Rights Reserved. +Copyright 1996 by Sun Microsystems, Inc. +Copyright (c) 2010, Oracle America, Inc. +Copyright (c) 2000 The Regents of the University of Michigan. All rights reserved. +Copyright (c) 2000 Dug Song . All rights reserved, all wrongs reversed. +Copyright (C) 2017 by Red Hat, Inc. All rights reserved. +Copyright 1988, Student Information Processing Board of the Massachusetts Institute of Technology. +Copyright 1995 by Cygnus Support. + +The following copyright and permission notice applies to the +OpenVision Kerberos Administration system located in "kadmin/create", +"kadmin/dbutil", "kadmin/passwd", "kadmin/server", "lib/kadm5", and +portions of "lib/rpc": + + Copyright, OpenVision Technologies, Inc., 1993-1996, All Rights + Reserved + + WARNING: Retrieving the OpenVision Kerberos Administration system + source code, as described below, indicates your acceptance of the + following terms. If you do not agree to the following terms, do + not retrieve the OpenVision Kerberos administration system. + + You may freely use and distribute the Source Code and Object Code + compiled from it, with or without modification, but this Source + Code is provided to you "AS IS" EXCLUSIVE OF ANY WARRANTY, + INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY OR + FITNESS FOR A PARTICULAR PURPOSE, OR ANY OTHER WARRANTY, WHETHER + EXPRESS OR IMPLIED. IN NO EVENT WILL OPENVISION HAVE ANY LIABILITY + FOR ANY LOST PROFITS, LOSS OF DATA OR COSTS OF PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES, OR FOR ANY SPECIAL, INDIRECT, OR + CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, INCLUDING, + WITHOUT LIMITATION, THOSE RESULTING FROM THE USE OF THE SOURCE + CODE, OR THE FAILURE OF THE SOURCE CODE TO PERFORM, OR FOR ANY + OTHER REASON. + + OpenVision retains all copyrights in the donated Source Code. + OpenVision also retains copyright to derivative works of the Source + Code, whether created by OpenVision or by a third party. The + OpenVision copyright notice must be preserved if derivative works + are made based on the donated Source Code. + + OpenVision Technologies, Inc. has donated this Kerberos + Administration system to MIT for inclusion in the standard Kerberos + 5 distribution. This donation underscores our commitment to + continuing Kerberos technology development and our gratitude for + the valuable work which has been performed by MIT and the Kerberos + community. + +====================================================================== + + Portions contributed by Matt Crawford "crawdad@fnal.gov" were work + performed at Fermi National Accelerator Laboratory, which is + operated by Universities Research Association, Inc., under contract + DE-AC02-76CHO3000 with the U.S. Department of Energy. + +====================================================================== + +Portions of "src/lib/crypto" have the following copyright: + + Copyright (C) 1998 by the FundsXpress, INC. + + All rights reserved. + + Export of this software from the United States of America may + require a specific license from the United States Government. + It is the responsibility of any person or organization + contemplating export to obtain such a license before exporting. + + WITHIN THAT CONSTRAINT, permission to use, copy, modify, and + distribute this software and its documentation for any purpose and + without fee is hereby granted, provided that the above copyright + notice appear in all copies and that both that copyright notice and + this permission notice appear in supporting documentation, and that + the name of FundsXpress. not be used in advertising or publicity + pertaining to distribution of the software without specific, + written prior permission. FundsXpress makes no representations + about the suitability of this software for any purpose. It is + provided "as is" without express or implied warranty. + + THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +====================================================================== + +The implementation of the AES encryption algorithm in +"src/lib/crypto/builtin/aes" has the following copyright: + + Copyright (C) 2001, Dr Brian Gladman "brg@gladman.uk.net", + Worcester, UK. + All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software in both source and + binary form is allowed (with or without changes) provided that: + + 1. distributions of this source code include the above copyright + notice, this list of conditions and the following disclaimer; + + 2. distributions in binary form include the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other associated materials; + + 3. the copyright holder's name is not used to endorse products + built using this software without specific written permission. + + DISCLAIMER + + This software is provided 'as is' with no explcit or implied + warranties in respect of any properties, including, but not limited + to, correctness and fitness for purpose. + +====================================================================== + +Portions contributed by Red Hat, including the pre-authentication +plug-in framework and the NSS crypto implementation, contain the +following copyright: + + Copyright (C) 2006 Red Hat, Inc. + Portions copyright (C) 2006 Massachusetts Institute of Technology + All Rights Reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of Red Hat, Inc., nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. + +====================================================================== + +The bundled verto source code is subject to the following license: + + Copyright 2011 Red Hat, Inc. + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + +====================================================================== + +The MS-KKDCP client implementation has the following copyright: + + Copyright 2013,2014 Red Hat, Inc. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + + 2. Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. + +====================================================================== + +The implementations of GSSAPI mechglue in GSSAPI-SPNEGO in +"src/lib/gssapi", including the following files: + + lib/gssapi/generic/gssapi_err_generic.et + lib/gssapi/mechglue/g_accept_sec_context.c + lib/gssapi/mechglue/g_acquire_cred.c + lib/gssapi/mechglue/g_canon_name.c + lib/gssapi/mechglue/g_compare_name.c + lib/gssapi/mechglue/g_context_time.c + lib/gssapi/mechglue/g_delete_sec_context.c + lib/gssapi/mechglue/g_dsp_name.c + lib/gssapi/mechglue/g_dsp_status.c + lib/gssapi/mechglue/g_dup_name.c + lib/gssapi/mechglue/g_exp_sec_context.c + lib/gssapi/mechglue/g_export_name.c + lib/gssapi/mechglue/g_glue.c + lib/gssapi/mechglue/g_imp_name.c + lib/gssapi/mechglue/g_imp_sec_context.c + lib/gssapi/mechglue/g_init_sec_context.c + lib/gssapi/mechglue/g_initialize.c + lib/gssapi/mechglue/g_inquire_context.c + lib/gssapi/mechglue/g_inquire_cred.c + lib/gssapi/mechglue/g_inquire_names.c + lib/gssapi/mechglue/g_process_context.c + lib/gssapi/mechglue/g_rel_buffer.c + lib/gssapi/mechglue/g_rel_cred.c + lib/gssapi/mechglue/g_rel_name.c + lib/gssapi/mechglue/g_rel_oid_set.c + lib/gssapi/mechglue/g_seal.c + lib/gssapi/mechglue/g_sign.c + lib/gssapi/mechglue/g_store_cred.c + lib/gssapi/mechglue/g_unseal.c + lib/gssapi/mechglue/g_userok.c + lib/gssapi/mechglue/g_utils.c + lib/gssapi/mechglue/g_verify.c + lib/gssapi/mechglue/gssd_pname_to_uid.c + lib/gssapi/mechglue/mglueP.h + lib/gssapi/mechglue/oid_ops.c + lib/gssapi/spnego/gssapiP_spnego.h + lib/gssapi/spnego/spnego_mech.c + +and the initial implementation of incremental propagation, including +the following new or changed files: + + include/iprop_hdr.h + kadmin/server/ipropd_svc.c + lib/kdb/iprop.x + lib/kdb/kdb_convert.c + lib/kdb/kdb_log.c + lib/kdb/kdb_log.h + lib/krb5/error_tables/kdb5_err.et + kprop/kpropd_rpc.c + kprop/kproplog.c + +are subject to the following license: + + Copyright (C) 2004 Sun Microsystems, Inc. + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + +====================================================================== + +Kerberos V5 includes documentation and software developed at the +University of California at Berkeley, which includes this copyright +notice: + + Copyright (C) 1983 Regents of the University of California. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + + 2. Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + 3. Neither the name of the University nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +====================================================================== + +Portions contributed by Novell, Inc., including the LDAP database +backend, are subject to the following license: + + Copyright (C) 2004-2005, Novell, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * The copyright holder's name is not used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. + +====================================================================== + +Portions funded by Sandia National Laboratory and developed by the +University of Michigan's Center for Information Technology +Integration, including the PKINIT implementation, are subject to the +following license: + + COPYRIGHT (C) 2006-2007 + THE REGENTS OF THE UNIVERSITY OF MICHIGAN + ALL RIGHTS RESERVED + + Permission is granted to use, copy, create derivative works and + redistribute this software and such derivative works for any + purpose, so long as the name of The University of Michigan is not + used in any advertising or publicity pertaining to the use of + distribution of this software without specific, written prior + authorization. If the above copyright notice or any other + identification of the University of Michigan is included in any + copy of any portion of this software, then the disclaimer below + must also be included. + + THIS SOFTWARE IS PROVIDED AS IS, WITHOUT REPRESENTATION FROM THE + UNIVERSITY OF MICHIGAN AS TO ITS FITNESS FOR ANY PURPOSE, AND + WITHOUT WARRANTY BY THE UNIVERSITY OF MICHIGAN OF ANY KIND, EITHER + EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + THE REGENTS OF THE UNIVERSITY OF MICHIGAN SHALL NOT BE LIABLE FOR + ANY DAMAGES, INCLUDING SPECIAL, INDIRECT, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES, WITH RESPECT TO ANY CLAIM ARISING OUT OF OR + IN CONNECTION WITH THE USE OF THE SOFTWARE, EVEN IF IT HAS BEEN OR + IS HEREAFTER ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +====================================================================== + +The pkcs11.h file included in the PKINIT code has the following +license: + + Copyright 2006 g10 Code GmbH + Copyright 2006 Andreas Jellinghaus + + This file is free software; as a special exception the author gives + unlimited permission to copy and/or distribute it, with or without + modifications, as long as this notice is preserved. + + This file is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY, to the extent permitted by law; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. + +====================================================================== + +Portions contributed by Apple Inc. are subject to the following +license: + + Copyright 2004-2008 Apple Inc. All Rights Reserved. + + Export of this software from the United States of America may + require a specific license from the United States Government. + It is the responsibility of any person or organization + contemplating export to obtain such a license before exporting. + + WITHIN THAT CONSTRAINT, permission to use, copy, modify, and + distribute this software and its documentation for any purpose and + without fee is hereby granted, provided that the above copyright + notice appear in all copies and that both that copyright notice and + this permission notice appear in supporting documentation, and that + the name of Apple Inc. not be used in advertising or publicity + pertaining to distribution of the software without specific, + written prior permission. Apple Inc. makes no representations + about the suitability of this software for any purpose. It is + provided "as is" without express or implied warranty. + + THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +====================================================================== + +The implementations of UTF-8 string handling in src/util/support and +src/lib/krb5/unicode are subject to the following copyright and +permission notice: + + The OpenLDAP Public License + Version 2.8, 17 August 2003 + + Redistribution and use of this software and associated + documentation ("Software"), with or without modification, are + permitted provided that the following conditions are met: + + 1. Redistributions in source form must retain copyright + statements and notices, + + 2. Redistributions in binary form must reproduce applicable + copyright statements and notices, this list of conditions, and + the following disclaimer in the documentation and/or other + materials provided with the distribution, and + + 3. Redistributions must contain a verbatim copy of this + document. + + The OpenLDAP Foundation may revise this license from time to time. + Each revision is distinguished by a version number. You may use + this Software under terms of this license revision or under the + terms of any subsequent revision of the license. + + THIS SOFTWARE IS PROVIDED BY THE OPENLDAP FOUNDATION AND ITS + CONTRIBUTORS "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE OPENLDAP FOUNDATION, ITS + CONTRIBUTORS, OR THE AUTHOR(S) OR OWNER(S) OF THE SOFTWARE BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + DAMAGE. + + The names of the authors and copyright holders must not be used in + advertising or otherwise to promote the sale, use or other dealing + in this Software without specific, written prior permission. Title + to copyright in this Software shall at all times remain with + copyright holders. + + OpenLDAP is a registered trademark of the OpenLDAP Foundation. + + Copyright 1999-2003 The OpenLDAP Foundation, Redwood City, + California, USA. All Rights Reserved. Permission to copy and + distribute verbatim copies of this document is granted. + +====================================================================== + +Marked test programs in src/lib/krb5/krb have the following copyright: + + Copyright (C) 2006 Kungliga Tekniska Högskola + (Royal Institute of Technology, Stockholm, Sweden). + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + + 2. Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + 3. Neither the name of KTH nor the names of its contributors may + be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY KTH AND ITS CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KTH OR ITS + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +====================================================================== + +The KCM Mach RPC definition file used on macOS has the following +copyright: + + Copyright (C) 2009 Kungliga Tekniska Högskola + (Royal Institute of Technology, Stockholm, Sweden). + All rights reserved. + + Portions Copyright (C) 2009 Apple Inc. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + + 2. Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + 3. Neither the name of the Institute nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +====================================================================== + +Portions of the RPC implementation in src/lib/rpc and +src/include/gssrpc have the following copyright and permission notice: + + Copyright (C) 2010, Oracle America, Inc. + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + + 2. Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + 3. Neither the name of the "Oracle America, Inc." nor the names + of its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. + +====================================================================== + + Copyright (C) 2006,2007,2009 NTT (Nippon Telegraph and Telephone + Corporation). All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer as the first lines of this file unmodified. + + 2. Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + THIS SOFTWARE IS PROVIDED BY NTT "AS IS" AND ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL NTT BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. + +====================================================================== + + Copyright 2000 by Carnegie Mellon University + + All Rights Reserved + + Permission to use, copy, modify, and distribute this software and + its documentation for any purpose and without fee is hereby + granted, provided that the above copyright notice appear in all + copies and that both that copyright notice and this permission + notice appear in supporting documentation, and that the name of + Carnegie Mellon University not be used in advertising or publicity + pertaining to distribution of the software without specific, + written prior permission. + + CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO + THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE + FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + SOFTWARE. + +====================================================================== + + Copyright (C) 2002 Naval Research Laboratory (NRL/CCS) + + Permission to use, copy, modify and distribute this software and + its documentation is hereby granted, provided that both the + copyright notice and this permission notice appear in all copies of + the software, derivative works or modified versions, and any + portions thereof. + + NRL ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION AND + DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER + RESULTING FROM THE USE OF THIS SOFTWARE. + +====================================================================== + + Copyright (C) 1991, 1992, 1994 by Cygnus Support. + + Permission to use, copy, modify, and distribute this software and + its documentation for any purpose and without fee is hereby + granted, provided that the above copyright notice appear in all + copies and that both that copyright notice and this permission + notice appear in supporting documentation. Cygnus Support makes no + representations about the suitability of this software for any + purpose. It is provided "as is" without express or implied + warranty. + +====================================================================== + + Copyright (C) 2006 Secure Endpoints Inc. + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + +====================================================================== + +Portions of the implementation of the Fortuna-like PRNG are subject to +the following notice: + + Copyright (C) 2005 Marko Kreen + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + + 2. Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + Copyright (C) 1994 by the University of Southern California + + EXPORT OF THIS SOFTWARE from the United States of America may + require a specific license from the United States Government. It + is the responsibility of any person or organization + contemplating export to obtain such a license before exporting. + + WITHIN THAT CONSTRAINT, permission to copy, modify, and distribute + this software and its documentation in source and binary forms is + hereby granted, provided that any documentation or other materials + related to such distribution or use acknowledge that the software + was developed by the University of Southern California. + + DISCLAIMER OF WARRANTY. THIS SOFTWARE IS PROVIDED "AS IS". The + University of Southern California MAKES NO REPRESENTATIONS OR + WARRANTIES, EXPRESS OR IMPLIED. By way of example, but not + limitation, the University of Southern California MAKES NO + REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY + PARTICULAR PURPOSE. The University of Southern California shall not + be held liable for any liability nor for any direct, indirect, or + consequential damages with respect to any claim by the user or + distributor of the ksu software. + +====================================================================== + + Copyright (C) 1995 + The President and Fellows of Harvard University + + This code is derived from software contributed to Harvard by Jeremy + Rassen. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + + 2. Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + 3. All advertising materials mentioning features or use of this + software must display the following acknowledgement: + + This product includes software developed by the University of + California, Berkeley and its contributors. + + 4. Neither the name of the University nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +====================================================================== + + Copyright (C) 2008 by the Massachusetts Institute of Technology. + Copyright 1995 by Richard P. Basch. All Rights Reserved. + Copyright 1995 by Lehman Brothers, Inc. All Rights Reserved. + + Export of this software from the United States of America may + require a specific license from the United States Government. It + is the responsibility of any person or organization + contemplating export to obtain such a license before exporting. + + WITHIN THAT CONSTRAINT, permission to use, copy, modify, and + distribute this software and its documentation for any purpose and + without fee is hereby granted, provided that the above copyright + notice appear in all copies and that both that copyright notice and + this permission notice appear in supporting documentation, and that + the name of Richard P. Basch, Lehman Brothers and M.I.T. not be + used in advertising or publicity pertaining to distribution of the + software without specific, written prior permission. Richard P. + Basch, Lehman Brothers and M.I.T. make no representations about the + suitability of this software for any purpose. It is provided "as + is" without express or implied warranty. + +====================================================================== + +The following notice applies to "src/lib/krb5/krb/strptime.c" and +"src/include/k5-queue.h". + + Copyright (C) 1997, 1998 The NetBSD Foundation, Inc. + All rights reserved. + + This code was contributed to The NetBSD Foundation by Klaus Klein. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + + 2. Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + 3. All advertising materials mentioning features or use of this + software must display the following acknowledgement: + + This product includes software developed by the NetBSD + Foundation, Inc. and its contributors. + + 4. Neither the name of The NetBSD Foundation nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND + CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + DAMAGE. + +====================================================================== + +The following notice applies to Unicode library files in +"src/lib/krb5/unicode": + + Copyright 1997, 1998, 1999 Computing Research Labs, + New Mexico State University + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE COMPUTING RESEARCH LAB OR + NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE + OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +====================================================================== + +The following notice applies to "src/util/support/strlcpy.c": + + Copyright (C) 1998 Todd C. Miller "Todd.Miller@courtesan.com" + + Permission to use, copy, modify, and distribute this software for + any purpose with or without fee is hereby granted, provided that + the above copyright notice and this permission notice appear in all + copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR + CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +====================================================================== + +The following notice applies to "src/util/profile/argv_parse.c" and +"src/util/profile/argv_parse.h": + + Copyright 1999 by Theodore Ts'o. + + Permission to use, copy, modify, and distribute this software for + any purpose with or without fee is hereby granted, provided that + the above copyright notice and this permission notice appear in all + copies. THE SOFTWARE IS PROVIDED "AS IS" AND THEODORE TS'O (THE + AUTHOR) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN + NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR + IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. (Isn't + it sick that the U.S. culture of lawsuit-happy lawyers requires + this kind of disclaimer?) + +====================================================================== + +The following notice applies to SWIG-generated code in +"src/util/profile/profile_tcl.c": + + Copyright (C) 1999-2000, The University of Chicago + + This file may be freely redistributed without license or fee + provided this copyright message remains intact. + +====================================================================== + +The following notice applies to portiions of "src/lib/rpc" and +"src/include/gssrpc": + + Copyright (C) 2000 The Regents of the University of Michigan. All + rights reserved. + + Copyright (C) 2000 Dug Song "dugsong@UMICH.EDU". All rights + reserved, all wrongs reversed. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. -This software consists of voluntary contributions made by many -individuals. For exact contribution history, see the revision history -available at https://github.com/lodash/lodash + 2. Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. -Copyright and related rights for sample code are waived via CC0. Sample -code is defined as all source code displayed within the prose of the -documentation. + 3. Neither the name of the University nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + DAMAGE. + +====================================================================== + +Implementations of the MD4 algorithm are subject to the following +notice: + + Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. + + License to copy and use this software is granted provided that it + is identified as the "RSA Data Security, Inc. MD4 Message Digest + Algorithm" in all material mentioning or referencing this software + or this function. + + License is also granted to make and use derivative works provided + that such works are identified as "derived from the RSA Data + Security, Inc. MD4 Message Digest Algorithm" in all material + mentioning or referencing the derived work. + + RSA Data Security, Inc. makes no representations concerning either + the merchantability of this software or the suitability of this + software for any particular purpose. It is provided "as is" + without express or implied warranty of any kind. + + These notices must be retained in any copies of any part of this + documentation and/or software. + +====================================================================== + +Implementations of the MD5 algorithm are subject to the following +notice: + + Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. + + License to copy and use this software is granted provided that it + is identified as the "RSA Data Security, Inc. MD5 Message- Digest + Algorithm" in all material mentioning or referencing this software + or this function. + + License is also granted to make and use derivative works provided + that such works are identified as "derived from the RSA Data + Security, Inc. MD5 Message-Digest Algorithm" in all material + mentioning or referencing the derived work. + + RSA Data Security, Inc. makes no representations concerning either + the merchantability of this software or the suitability of this + software for any particular purpose. It is provided "as is" + without express or implied warranty of any kind. + + These notices must be retained in any copies of any part of this + documentation and/or software. + +====================================================================== + +The following notice applies to +"src/lib/crypto/crypto_tests/t_mddriver.c": + + Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All + rights reserved. + + RSA Data Security, Inc. makes no representations concerning either + the merchantability of this software or the suitability of this + software for any particular purpose. It is provided "as is" without + express or implied warranty of any kind. + + These notices must be retained in any copies of any part of this + documentation and/or software. + +====================================================================== + +Portions of "src/lib/krb5" are subject to the following notice: + + Copyright (C) 1994 CyberSAFE Corporation. + Copyright 1990,1991,2007,2008 by the Massachusetts + Institute of Technology. + All Rights Reserved. + + Export of this software from the United States of America may + require a specific license from the United States Government. It + is the responsibility of any person or organization + contemplating export to obtain such a license before exporting. + + WITHIN THAT CONSTRAINT, permission to use, copy, modify, and + distribute this software and its documentation for any purpose and + without fee is hereby granted, provided that the above copyright + notice appear in all copies and that both that copyright notice and + this permission notice appear in supporting documentation, and that + the name of M.I.T. not be used in advertising or publicity + pertaining to distribution of the software without specific, + written prior permission. Furthermore if you modify this software + you must label your software as modified software and not + distribute it in such a fashion that it might be confused with the + original M.I.T. software. Neither M.I.T., the Open Computing + Security Group, nor CyberSAFE Corporation make any representations + about the suitability of this software for any purpose. It is + provided "as is" without express or implied warranty. -CC0: http://creativecommons.org/publicdomain/zero/1.0/ +====================================================================== -Files located in the node_modules and vendor directories are externally -maintained libraries used by this software which have their own -licenses; we recommend you read them, as their terms may differ from the -terms above. +Portions contributed by PADL Software are subject to the following +license: -Copyright Statements -Copyright (C) 2018, John-David Dalton + Copyright (c) 2011, PADL Software Pty Ltd. All rights reserved. -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + + 2. Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + 3. Neither the name of PADL Software nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY PADL SOFTWARE AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PADL SOFTWARE + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. -Source materials are available for download at: https://github.com/lodash/lodash -Logback 1.1.11 -Attribution Statements -http://logback.qos.ch +====================================================================== -Copyright Statements -Copyright (C) 1999-2015, QOS.ch. All rights reserved. +The bundled libev source code is subject to the following license: -License Text (http://spdx.org/licenses/EPL-1.0) -Made available under the Eclipse Public License 1.0. See Appendix for full text. + All files in libev are Copyright (C)2007,2008,2009 Marc Alexander + Lehmann. -Source materials are available for download at: https://github.com/qos-ch/logback -Logback 1.2.3 -Attribution Statements -http://logback.qos.ch + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: -Copyright Statements -Copyright (C) 1999-2015, QOS.ch. All rights reserved. + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. -License Text (http://spdx.org/licenses/EPL-1.0) -Made available under the Eclipse Public License 1.0. See Appendix for full text. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. -Source materials are available for download at: https://github.com/qos-ch/logback -Lunr 0.5.11 -Attribution Statements -https://lunrjs.com/ + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. + + Alternatively, the contents of this package may be used under the + terms of the GNU General Public License ("GPL") version 2 or any + later version, in which case the provisions of the GPL are + applicable instead of the above. If you wish to allow the use of + your version of this package only under the terms of the GPL and + not to allow others to use your version of this file under the BSD + license, indicate your decision by deleting the provisions above + and replace them with the notice and other provisions required by + the GPL in this and the other files of this package. If you do not + delete the provisions above, a recipient may use your version of + this file under either the BSD or the GPL. + +====================================================================== + +Files copied from the Intel AESNI Sample Library are subject to the +following license: -Copyright Statements -Copyright (C) 2015 Oliver Nightingale + Copyright (C) 2010, Intel Corporation All rights reserved. -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: -Source materials are available for download at: https://github.com/olivernn/lunr.js -MapR 5.1.0 -Attribution Statements -https://mapr.com/ + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. -Copyright Statements -MapR Technologies, Inc. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. -License Text () -Made available under commercial license. + * Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. -Source materials are available for download at: https://mapr.com/download/ -MapR Hadoop Bundle 2.7.0-mapr-1602 -Attribution Statements -https://mapr.com/products/apache-hadoop/ + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. -Copyright Statements -© MapR Technologies, Inc. All Rights Reserved +====================================================================== -License Text (http://spdx.org/licenses/Apache-2.0) -Made available under the Apache License 2.0. See Appendix for full text. +The following notice applies to +"src/ccapi/common/win/OldCC/autolock.hxx": -Source materials are available for download at: http://repository.mapr.com/nexus/content/groups/mapr-public/org/apache/hadoop/ -marklogic-contentpump 11.0 -License Text (http://spdx.org/licenses/Apache-2.0.html) - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -marklogic-marklogic-data-hub 5.2.0 -Copyright Statements -Copyright (C) 2020, MarkLogic, MarkLogic Github Contributors + Copyright (C) 1998 by Danilo Almeida. All rights reserved. -License Text (http://www.apache.org/licenses/LICENSE-2.0.txt) - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: -Material Design Icons (MDI) Iconfont 3.0.3 -Attribution Statements -http://google.github.io/material-design-icons/ + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. -Copyright Statements -Copyright (C) 2016, Material Design Authors + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. -License Text (https://spdx.org/licenses/Apache-2.0.html) -Made available under the Apache License 2.0. See Appendix for full text. + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. + +====================================================================== + +The following notice applies to portions of +"src/plugins/preauth/spake/edwards25519.c" and +"src/plugins/preauth/spake/edwards25519_tables.h": -Source materials are available for download at: https://github.com/jossef/material-design-icons-iconfont -Material Design Icons (MDI) Webfont 2.2.43 -Attribution Statements -https://materialdesignicons.com/ +The MIT License (MIT) -Copyright Statements -Copyright (c) 2014, Austin Andrews (http://materialdesignicons.com/), with Reserved Font Name Material Design Icons. +Copyright (c) 2015-2016 the fiat-crypto authors (see the AUTHORS +file). -Copyright (c) 2014, Google (http://www.google.com/design/) uses the license at https://github.com/google/material-design-icons/blob/master/LICENSE +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: -License Text (https://spdx.org/licenses/OFL-1.1.html) -Made available under the SIL Open Font License 1.1. See Appendix for full text. +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. -Source materials are available for download at: https://github.com/Templarian/MaterialDesign-Webfont -Material Design Lite 1.3.0 -Attribution Statements -http://getmdl.io +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -Copyright Statements -Copyright (C) 2016, Google +====================================================================== -License Text (http://spdx.org/licenses/Apache-2.0) -Made available under the Apache License 2.0. See Appendix for full text. +The following notice applies to portions of +"src/plugins/preauth/spake/edwards25519.c": -Source materials are available for download at: https://github.com/google/material-design-lite -MIT Kerberos v5 1.1.2 -Attribution Statements -http://web.mit.edu/kerberos/www/ +Copyright (c) 2015-2016, Google Inc. + +Permission to use, copy, modify, and/or distribute this software for +any purpose with or without fee is hereby granted, provided that the +above copyright notice and this permission notice appear in all +copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL +WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR +PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. Copyright Statements Copyright 1985-2012 by the Massachusetts Institute of Technology. All rights reserved. @@ -6787,17 +5207,6 @@ License Text (http://spdx.org/licenses/MIT) Made available under the MIT License. See Appendix for full text. Source materials are available for download at: https://github.com/valor-software/ngx-bootstrap -node-portfinder 1.0.20 -Attribution Statements -https://github.com/indexzero/node-portfinder - -Copyright Statements -Copyright (c) 2012 Charlie Robbins - -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. - -Source materials are available for download at: https://github.com/indexzero/node-portfinder node-sass 4.12.0 Attribution Statements https://github.com/sass/node-sass @@ -6909,17 +5318,6 @@ License Text (http://spdx.org/licenses/Apache-2.0) Made available under the Apache License 2.0. See Appendix for full text. Source materials are available for download at: https://sourceforge.net/p/opencsv/source/ci/master/tree/ -PostCSS Loader 3.0.0 -Attribution Statements -https://github.com/postcss/postcss-loader - -Copyright Statements -Copyright 2017 Andrey Sitnik - -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. - -Source materials are available for download at: https://github.com/postcss/postcss-loader Protocol Buffers (protobuf) 2.5.0 Attribution Statements https://developers.google.com/protocol-buffers/ @@ -7046,17 +5444,6 @@ License Text (http://spdx.org/licenses/ISC.html) Made available under the ISC License. See Appendix for full text. Source materials are available for download at: https://github.com/npm/read -Request - Simplified HTTP client 2.88.0 -Attribution Statements -https://github.com/request/request - -Copyright Statements -Copyright 2010-2012 Mikeal Rogers - -License Text (http://spdx.org/licenses/Apache-2.0.html) -Made available under the Apache License 2.0. See Appendix for full text. - -Source materials are available for download at: https://github.com/request/request rimraf 2.6.3 Attribution Statements https://github.com/isaacs/rimraf @@ -7296,18 +5683,6 @@ License Text (http://spdx.org/licenses/ISC) Made available under the ISC License. See Appendix for full text. Source materials are available for download at: https://github.com/npm/node-semver -ShellJS 0.7.8 -Attribution Statements -http://documentup.com/shelljs/shelljs - -Copyright Statements -Copyright (c) 2012, Artur Adib -All rights reserved. - -License Text (http://spdx.org/licenses/BSD-3-Clause) -Made available under the BSD 3-Clause "New" or "Revised" License. See Appendix for full text. - -Source materials are available for download at: https://github.com/shelljs/shelljs Should.js 13.2.3 Attribution Statements http://shouldjs.github.io/ @@ -7387,30 +5762,6 @@ License Text (http://spdx.org/licenses/Apache-2.0) Made available under the Apache License 2.0. See Appendix for full text. Source materials are available for download at: https://github.com/spring-projects/spring-framework -Spring Security 5.1.4 -Attribution Statements -https://spring.io/projects/spring-security - -This product includes software developed by Spring Security Project (https://www.springframework.org/security). - -Copyright Statements -Copyright 2002-2018 the original author or authors. - -License Text (http://spdx.org/licenses/Apache-2.0.html) -Made available under the Apache License 2.0. See Appendix for full text. - -Source materials are available for download at: https://github.com/spring-projects/spring-security -STOMP.js 2.3.3 -Attribution Statements -http://jmesnil.net/stomp-websocket/doc/ - -Copyright Statements -Copyright (C) 2014, Jeff Mesnil - -License Text (http://spdx.org/licenses/Apache-2.0) -Made available under the Apache License 2.0. See Appendix for full text. - -Source materials are available for download at: https://github.com/jmesnil/stomp-websocket Sunlight 1.22.0 Attribution Statements http://sunlightjs.com/ @@ -7422,17 +5773,6 @@ License Text (https://spdx.org/licenses/WTFPL.html) Made available under the Do What The F*ck You Want To Public License. See Appendix for full text. Source materials are available for download at: https://github.com/tmont/sunlight -Swagger Codegen™ -Attribution Statements -https://github.com/swagger-api/swagger-codegen - -Copyright Statements -Copyright 2016 SmartBear Software - -License Text (http://spdx.org/licenses/Apache-2.0.html) -Made available under the Apache License 2.0. See Appendix for full text. - -Source materials are available for download at: https://github.com/swagger-api/swagger-codegen Swagger Express Middleware 2.0.1 Attribution Statements https://apidevtools.org/swagger-express-middleware/ @@ -7539,17 +5879,6 @@ License Text (http://spdx.org/licenses/MIT) Made available under the MIT License. See Appendix for full text. Source materials are available for download at: https://github.com/TypeStrong/ts-node -tslib 1.9.0 -Attribution Statements -https://github.com/Microsoft/tslib - -Copyright Statements -Copyright (C) 2019, Microsoft Corp. - -License Text (https://spdx.org/licenses/0BSD.html) -Made available under the BSD Zero Clause License. See Appendix for full text. - -Source materials are available for download at: https://github.com/Microsoft/tslib TSLint 5.12.1 Attribution Statements https://palantir.github.io/tslint/ @@ -7775,17 +6104,6 @@ License Text (http://spdx.org/licenses/Apache-2.0.html) Made available under the Apache License 2.0. See Appendix for full text. Source materials are available for download at: https://github.com/microsoft/TypeScript -url-loader 1.1.2 -Attribution Statements -https://github.com/webpack-contrib/url-loader - -Copyright Statements -Copyright JS Foundation and other contributors - -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. - -Source materials are available for download at: https://github.com/webpack-contrib/url-loader Vinyl 2.2.0 Attribution Statements https://github.com/gulpjs/vinyl @@ -7797,61 +6115,6 @@ License Text (http://spdx.org/licenses/MIT) Made available under the MIT License. See Appendix for full text. Source materials are available for download at: https://github.com/gulpjs/vinyl -webpack 4.30.0 -Attribution Statements -https://webpack.js.org/ - -Copyright Statements -Copyright JS Foundation and other contributors - -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. - -Source materials are available for download at: https://github.com/webpack/webpack -webpack-dev-middleware 3.5.1 -Attribution Statements -https://github.com/webpack/webpack-dev-middleware - -Copyright Statements -Copyright JS Foundation and other contributors - -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. - -Source materials are available for download at: https://github.com/webpack/webpack-dev-middleware -webpack-dev-server 3.1.14 -Attribution Statements -https://github.com/webpack/webpack-dev-server - -Copyright Statements -Copyright JS Foundation and other contributors - -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. - -Source materials are available for download at: https://github.com/webpack/webpack-dev-server -webpack-merge 4.2.1 -Attribution Statements -https://www.npmjs.com/package/webpack-merge - -Copyright Statements -Copyright (c) 2015 Juho Vepsalainen - -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. - -Source materials are available for download at: https://github.com/survivejs/webpack-merge -webpack-sources 1.3.0 -Attribution Statements -https://github.com/webpack/webpack-sources - -Copyright Statements -Copyright (c) 2017 JS Foundation and other contributors - -License Text (http://spdx.org/licenses/MIT) -Made available under the MIT License. See Appendix for full text. - -Source materials are available for download at: https://github.com/webpack/webpack-sources Wikipedia content Attribution Statements https://www.wikipedia.org/ @@ -7924,7 +6187,7 @@ License Text (http://spdx.org/licenses/BSD-3-Clause) Made available under the BSD 3-Clause "New" or "Revised" License. See Appendix for full text. Source materials are available for download at: https://github.com/xmlunit/xmlunit/tree/master/xmlunit-legacy -XStream 1.4.12 +XStream 1.4.16 Attribution Statements http://x-stream.github.io @@ -7975,12 +6238,13 @@ Made available under the MIT License. See Appendix for full text. Source materials are available for download at: https://github.com/angular/zone.js -  + Appendix License Text -  + + Apache License 2.0 https://spdx.org/licenses/Apache-2.0.html @@ -8057,7 +6321,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -  + + BSD 2-Clause "Simplified" License https://spdx.org/licenses/BSD-2-Clause.html @@ -8071,7 +6336,8 @@ Redistribution and use in source and binary forms, with or without modification, THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -  + + BSD 3-Clause "New" or "Revised" License https://spdx.org/licenses/BSD-3-Clause.html @@ -8086,7 +6352,8 @@ Redistribution and use in source and binary forms, with or without modification, 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -  + + Common Development and Distribution License 1.1 https://spdx.org/licenses/CDDL-1.1.html @@ -8199,7 +6466,8 @@ As between Initial Developer and the Contributors, each party is responsible for NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) The code released under the CDDL shall be governed by the laws of the State of California (excluding conflict-of-law provisions). Any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California and the state courts of the State of California, with venue lying in Santa Clara County, California. -  + + Creative Commons Attribution Share Alike 3.0 Unported https://spdx.org/licenses/CC-BY-SA-3.0.html @@ -8296,7 +6564,8 @@ Except for the limited purpose of indicating to the public that the Work is lice Creative Commons may be contacted at http://creativecommons.org/. -  + + Do What The F*ck You Want To Public License https://spdx.org/licenses/WTFPL.html @@ -8312,7 +6581,8 @@ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. You just DO WHAT THE FUCK YOU WANT TO. -  + + Eclipse Public License 1.0 https://spdx.org/licenses/EPL-1.0.html @@ -8389,7 +6659,8 @@ Everyone is permitted to copy and distribute copies of this Agreement, but in or This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. -  + + Eclipse Public License 2.0 https://spdx.org/licenses/EPL-2.0.html @@ -8471,7 +6742,8 @@ Simply including a copy of this Agreement, including this Exhibit A is not suffi If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice. -You may add additional accurate notices of copyright ownership.  +You may add additional accurate notices of copyright ownership. + ISC License https://spdx.org/licenses/ISC.html @@ -8484,7 +6756,8 @@ Permission to use, copy, modify, and/or distribute this software for any purpose THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -  + + JSON License https://spdx.org/licenses/JSON.html @@ -8500,7 +6773,8 @@ The Software shall be used for Good, not Evil. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -  + + MIT License http://spdx.org/licenses/MIT @@ -8514,7 +6788,8 @@ The above copyright notice and this permission notice (including the next paragr THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -  + + Mozilla Public License 2.0 https://spdx.org/licenses/MPL-2.0.html @@ -8651,136 +6926,8 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. -  -Dual OpenSSL and SSLeay License -https://www.openssl.org/source/license-openssl-ssleay.txt - - - LICENSE ISSUES - ============== - - The OpenSSL toolkit stays under a double license, i.e. both the conditions of - the OpenSSL License and the original SSLeay license apply to the toolkit. - See below for the actual license texts. - - OpenSSL License - --------------- - -/* ==================================================================== - * Copyright (c) 1998-2018 The OpenSSL Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * openssl-core@openssl.org. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.openssl.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ - - Original SSLeay License - ----------------------- - -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -  + + SIL Open Font License 1.1 https://spdx.org/licenses/OFL-1.1.html @@ -8827,7 +6974,8 @@ DISCLAIMER THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE. -  + + The Unlicense https://spdx.org/licenses/Unlicense.html From 4aeb678d466425e64fe7ec0ad3e3698352fa918e Mon Sep 17 00:00:00 2001 From: ehennum Date: Tue, 25 May 2021 11:52:50 -0700 Subject: [PATCH 03/12] #1294 client interface for generate view and redaction on rows --- .../client/expression/PlanBuilder.java | 7 +- .../marklogic/client/expression/RdtExpr.java | 208 +++++++++++++ .../client/impl/PlanBuilderBaseImpl.java | 2 +- .../marklogic/client/impl/RdtExprImpl.java | 108 +++++++ .../marklogic/client/impl/RowManagerImpl.java | 30 ++ .../com/marklogic/client/row/RowManager.java | 39 ++- .../client/test/PlanExpressionTest.java | 283 ++++++++++++++++++ .../marklogic/client/test/RowManagerTest.java | 21 ++ 8 files changed, 693 insertions(+), 5 deletions(-) create mode 100644 marklogic-client-api/src/main/java/com/marklogic/client/expression/RdtExpr.java create mode 100644 marklogic-client-api/src/main/java/com/marklogic/client/impl/RdtExprImpl.java create mode 100644 marklogic-client-api/src/test/java/com/marklogic/client/test/PlanExpressionTest.java diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/expression/PlanBuilder.java b/marklogic-client-api/src/main/java/com/marklogic/client/expression/PlanBuilder.java index 23021ac08..20dd08799 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/expression/PlanBuilder.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/expression/PlanBuilder.java @@ -26,7 +26,7 @@ */ public abstract class PlanBuilder implements PlanBuilderBase { protected PlanBuilder( - CtsExpr cts, FnExpr fn, GeoExpr geo, JsonExpr json, MapExpr map, MathExpr math, RdfExpr rdf, SemExpr sem, SpellExpr spell, SqlExpr sql, XdmpExpr xdmp, XsExpr xs + CtsExpr cts, FnExpr fn, GeoExpr geo, JsonExpr json, MapExpr map, MathExpr math, RdfExpr rdf, SemExpr sem, SpellExpr spell, SqlExpr sql, XdmpExpr xdmp, XsExpr xs, RdtExpr rdt ) { this.cts = cts; this.fn = fn; @@ -40,7 +40,7 @@ protected PlanBuilder( this.sql = sql; this.xdmp = xdmp; this.xs = xs; - + this.rdt = rdt; } /** * Builds expressions with cts server functions. @@ -90,7 +90,8 @@ protected PlanBuilder( * Builds expressions with xs server functions. */ public final XsExpr xs; -/** + public final RdtExpr rdt; + /** * This function returns the sum of the specified numeric expressions. In expressions, the call should pass the result from an op:col function to identify a column. *

* Provides a client interface to the op:add server function. diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/expression/RdtExpr.java b/marklogic-client-api/src/main/java/com/marklogic/client/expression/RdtExpr.java new file mode 100644 index 000000000..4591f0798 --- /dev/null +++ b/marklogic-client-api/src/main/java/com/marklogic/client/expression/RdtExpr.java @@ -0,0 +1,208 @@ +/* + * Copyright (c) 2021 MarkLogic Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.marklogic.client.expression; + +import com.marklogic.client.type.PlanColumn; +import com.marklogic.client.type.PlanExprCol; +import com.marklogic.client.type.ServerExpression; + +import java.util.Map; + +/** + * The RdtExpr instance provides functions that build expressions + * for redacting the values of a column. + *

In addition to using the provided functions, + * you can redact any column by using {@link PlanBuilder#as(PlanColumn, ServerExpression)} + * to rebind the column to an expression that replaces the existing value + * with an altered or randomly generated value. + * You can also hide a column by binding the column to the null value + * or by projecting other columns. + *

+ */ +public interface RdtExpr { + /** + * Redacts a column with string values by replacing each value with deterministic masking text. + * That is, a specific value generates the same masked value every time the value is redacted. + *

Provides a client interface to the + * ordt:mask-deterministic + * server function.

+ * @param column the column to be redacted + * @return a PlanExprCol object + */ + PlanExprCol maskDeterministic(PlanColumn column); + /** + * Redacts a column with string values by replacing each value with deterministic masking text. + * That is, a specific value generates the same masked value every time the value is redacted. + *

Provides a client interface to the + * ordt:mask-deterministic + * server function.

+ * @param column the column to be redacted + * @param options the options for redacting the column + * @return a PlanExprCol object + */ + PlanExprCol maskDeterministic(PlanColumn column, Map options); + /** + * Redacts a column with string values by replacing each value with random masking text. + * The same value may produce a different masked value every time the value is redacted. + *

Provides a client interface to the + * ordt:mask-random + * server function.

+ * @param column the column to be redacted + * @return a PlanExprCol object for the redacted column + */ + PlanExprCol maskRandom(PlanColumn column); + /** + * Redacts a column with string values by replacing each value with random masking text. + * The same value may produce a different masked value every time the value is redacted. + *

Provides a client interface to the + * ordt:mask-random + * server function.

+ * @param column the column to be redacted + * @param options the options for redacting the column + * @return a PlanExprCol object for the redacted column + */ + PlanExprCol maskRandom(PlanColumn column, Map options); + /** + * Redacts a column with date or datetime values either by masking part + * of the existing value or by generating a random value. + *

Provides a client interface to the + * ordt:redact-datetime + * server function.

+ * @param column the column to be redacted + * @param options the options for redacting the column + * @return a PlanExprCol object for the redacted column + */ + PlanExprCol redactDatetime(PlanColumn column, Map options); + /** + * Redacts a column with email address string + * that conforms to the pattern name@domain. + *

Provides a client interface to the + * ordt:redact-email + * server function.

+ * @param column the column to be redacted + * @return a PlanExprCol object for the redacted column + */ + PlanExprCol redactEmail(PlanColumn column); + /** + * Redacts a column with email address string + * that conforms to the pattern name@domain. + *

Provides a client interface to the + * ordt:redact-email + * server function.

+ * @param column the column to be redacted + * @param options the options for redacting the column + * @return a PlanExprCol object for the redacted column + */ + PlanExprCol redactEmail(PlanColumn column, Map options); + /** + * Redacts a column with IPv4 address string that conforms to a pattern with + * four blocks of 1-3 decimal digits separated by period (.) where the value of each block + * of digits is less than or equal to 255 as in 123.201.098.112 and + * 123.45.678.0. + *

Provides a client interface to the + * ordt:redact-ipv4 + * server function.

+ * @param column the column to be redacted + * @return a PlanExprCol object for the redacted column + */ + PlanExprCol redactIpv4(PlanColumn column); + /** + * Redacts a column with IPv4 address string that conforms to a pattern with + * four blocks of 1-3 decimal digits separated by period (.) where the value of each block + * of digits is less than or equal to 255 as in 123.201.098.112 and + * 123.45.678.0. + *

Provides a client interface to the + * ordt:redact-ipv4 + * server function.

+ * @param column the column to be redacted + * @param options the options for redacting the column + * @return a PlanExprCol object for the redacted column + */ + PlanExprCol redactIpv4(PlanColumn column, Map options); + /** + * Redacts a column by generating a random number within a configurable range + * either as a numeric data type or as a formatted string. + *

Provides a client interface to the + * ordt:redact-number + * server function.

+ * @param column the column to be redacted + * @return a PlanExprCol object for the redacted column + */ + PlanExprCol redactNumber(PlanColumn column); + /** + * Redacts a column by generating a random number within a configurable range + * either as a numeric data type or as a formatted string. + *

Provides a client interface to the + * ordt:redact-number + * server function.

+ * @param column the column to be redacted + * @param options the options for redacting the column + * @return a PlanExprCol object for the redacted column + */ + PlanExprCol redactNumber(PlanColumn column, Map options); + /** + * Redacts a string column by applying a regular expression. + *

Provides a client interface to the + * ordt:redact-regex + * server function.

+ * @param column the column to be redacted + * @param options the options for redacting the column + * @return a PlanExprCol object for the redacted column + */ + PlanExprCol redactRegex(PlanColumn column, Map options); + /** + * Redacts a column with a 10-digit US phone number string + * by generating random numbers or replacing numbers with a masking character. + *

Provides a client interface to the + * ordt:redact-us-phone + * server function.

+ * @param column the column to be redacted + * @return a PlanExprCol object for the redacted column + */ + PlanExprCol redactUsPhone(PlanColumn column); + /** + * Redacts a column with a 10-digit US phone number string + * by generating random numbers or replacing numbers with a masking character. + *

Provides a client interface to the + * ordt:redact-us-phone + * server function.

+ * @param column the column to be redacted + * @param options the options for redacting the column + * @return a PlanExprCol object for the redacted column + */ + PlanExprCol redactUsPhone(PlanColumn column, Map options); + /** + * Redacts a column with a 9-digit US SSN (Social Security Number) string + * by generating random numbers or replacing numbers with a masking character. + *

Provides a client interface to the + * ordt:redact-us-ssn + * server function.

+ * @param column the column to be redacted + * @return a PlanExprCol object for the redacted column + */ + PlanExprCol redactUsSsn(PlanColumn column); + /** + * Redacts a column with a 9-digit US SSN (Social Security Number) string + * by generating random numbers or replacing numbers with a masking character. + *

Provides a client interface to the + * ordt:redact-us-ssn + * server function.

+ * @param column the column to be redacted + * @param options the options for redacting the column + * @return a PlanExprCol object for the redacted column + */ + PlanExprCol redactUsSsn(PlanColumn column, Map options); +} diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/impl/PlanBuilderBaseImpl.java b/marklogic-client-api/src/main/java/com/marklogic/client/impl/PlanBuilderBaseImpl.java index 1fd7eb490..4dadd2d8e 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/impl/PlanBuilderBaseImpl.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/impl/PlanBuilderBaseImpl.java @@ -37,7 +37,7 @@ abstract class PlanBuilderBaseImpl extends PlanBuilder { super( CtsExprImpl.cts, FnExprImpl.fn, GeoExprImpl.geo, JsonExprImpl.json, MapExprImpl.map, MathExprImpl.math, RdfExprImpl.rdf, SemExprImpl.sem, SpellExprImpl.spell, - SqlExprImpl.sql, XdmpExprImpl.xdmp, XsExprImpl.xs + SqlExprImpl.sql, XdmpExprImpl.xdmp, XsExprImpl.xs, RdtExprImpl.rdt ); } diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/impl/RdtExprImpl.java b/marklogic-client-api/src/main/java/com/marklogic/client/impl/RdtExprImpl.java new file mode 100644 index 000000000..529e51c3c --- /dev/null +++ b/marklogic-client-api/src/main/java/com/marklogic/client/impl/RdtExprImpl.java @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2021 MarkLogic Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.marklogic.client.impl; + +import com.marklogic.client.expression.RdtExpr; +import com.marklogic.client.type.PlanColumn; +import com.marklogic.client.type.PlanExprCol; + +import java.util.Map; + +public class RdtExprImpl implements RdtExpr { + final static RdtExprImpl rdt = new RdtExprImpl(); + + @Override + public PlanExprCol maskDeterministic(PlanColumn column) { + return maskDeterministic(column, null); + } + @Override + public PlanExprCol maskDeterministic(PlanColumn column, Map options) { + return redactImpl("maskDeterministic", "mask-deterministic", column, options); + } + @Override + public PlanExprCol maskRandom(PlanColumn column) { + return maskRandom(column, null); + } + @Override + public PlanExprCol maskRandom(PlanColumn column, Map options) { + return redactImpl("maskRandom", "mask-random", column, options); + } + @Override + public PlanExprCol redactDatetime(PlanColumn column, Map options) { + if (column == null) { + throw new IllegalArgumentException("must provide options for redactDatetime()"); + } + return redactImpl("redactDatetime", "redact-datetime", column, options); + } + @Override + public PlanExprCol redactEmail(PlanColumn column) { + return redactEmail(column, null); + } + @Override + public PlanExprCol redactEmail(PlanColumn column, Map options) { + return redactImpl("redactEmail", "redact-email", column, options); + } + @Override + public PlanExprCol redactIpv4(PlanColumn column) { + return redactIpv4(column, null); + } + @Override + public PlanExprCol redactIpv4(PlanColumn column, Map options) { + return redactImpl("redactIpv4", "redact-ipv4", column, options); + } + @Override + public PlanExprCol redactNumber(PlanColumn column) { + return redactNumber(column, null); + } + @Override + public PlanExprCol redactNumber(PlanColumn column, Map options) { + return redactImpl("redactNumber", "redact-number", column, options); + } + @Override + public PlanExprCol redactRegex(PlanColumn column, Map options) { + if (column == null) { + throw new IllegalArgumentException("must provide options for redactRegex()"); + } + return redactImpl("redactRegex", "redact-regex", column, options); + } + @Override + public PlanExprCol redactUsPhone(PlanColumn column) { + return redactUsPhone(column, null); + } + @Override + public PlanExprCol redactUsPhone(PlanColumn column, Map options) { + return redactImpl("redactUsPhone", "redact-us-phone", column, options); + } + @Override + public PlanExprCol redactUsSsn(PlanColumn column) { + return redactUsSsn(column, null); + } + @Override + public PlanExprCol redactUsSsn(PlanColumn column, Map options) { + return redactImpl("redactUsSsn", "redact-us-ssn", column, options); + } + private PlanExprCol redactImpl(String clientFn, String enodeFn, PlanColumn column, Map options) { + if (column == null) { + throw new IllegalArgumentException("must provide column to redact for "+clientFn+"()"); + } + return new RedactCallImpl(enodeFn, new Object[]{column, (options == null) ? null : new BaseTypeImpl.BaseMapImpl(options)}); + } + static class RedactCallImpl extends PlanBuilderSubImpl.ExprColCallImpl { + RedactCallImpl(String fnName, Object[] fnArgs) { + super("ordt", fnName, fnArgs); + } + } +} diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/impl/RowManagerImpl.java b/marklogic-client-api/src/main/java/com/marklogic/client/impl/RowManagerImpl.java index 0ca03df0b..3e3f436bc 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/impl/RowManagerImpl.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/impl/RowManagerImpl.java @@ -255,6 +255,36 @@ public T explainAs(Plan plan, Class as) { return handle.get(); } + @Override + public T generateView(Plan plan, String schema, String view, T resultsHandle) { + if (resultsHandle == null) { + throw new IllegalArgumentException("Must specify a handle to generate a view for the plan"); + } else if (schema == null || schema.length() == 0) { + throw new IllegalArgumentException("Must specify a schema name to generate a view for the plan"); + } else if (view == null || view.length() == 0) { + throw new IllegalArgumentException("Must specify a view name to generate a view for the plan"); + } + + PlanBuilderBaseImpl.RequestPlan requestPlan = checkPlan(plan); + AbstractWriteHandle astHandle = requestPlan.getHandle(); + + RequestParameters params = new RequestParameters(); + params.add("output", "generateView"); + params.add("schemaName", "schema"); + params.add("viewName", "view"); + + return services.postResource(requestLogger, "rows", null, params, astHandle, resultsHandle); + } + @Override + public T generateViewAs(Plan plan, String schema, String view, Class as) { + ContentHandle handle = handleFor(as); + if (generateView(plan, schema, view, (XMLReadHandle) handle) == null) { + return null; + } + + return handle.get(); + } + private void addDatatypeStyleParam(RequestParameters params, RowSetPart datatypeStyle) { if (datatypeStyle != null) { switch (datatypeStyle) { diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/row/RowManager.java b/marklogic-client-api/src/main/java/com/marklogic/client/row/RowManager.java index eba7c562f..1b5383227 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/row/RowManager.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/row/RowManager.java @@ -21,6 +21,7 @@ import com.marklogic.client.io.marker.JSONWriteHandle; import com.marklogic.client.io.marker.StructureReadHandle; import com.marklogic.client.io.marker.TextWriteHandle; +import com.marklogic.client.io.marker.XMLReadHandle; /** * A Row Manager provides database operations on rows projected from documents. @@ -238,7 +239,7 @@ public enum RowStructure{ARRAY, OBJECT} * @param plan the definition of a plan for database rows * @param handle the JSON or XML handle on the explanation for the plan * @param the type of the explanation handle - * @return an object of the IO class with the content of the explanation for the plan + * @return the handle with the content of the explanation for the plan */ T explain(Plan plan, T handle); /** @@ -257,4 +258,40 @@ public enum RowStructure{ARRAY, OBJECT} * @return an object of the IO class with the content of the explanation for the plan */ T explainAs(Plan plan, Class as); + + /** + * Generates generates a view that encapsulates a plan. + * + * Insert the generated XML into the schemas database and then use the + * {@link PlanBuilder#fromView(String, String)} accessor to query + * against the generated view. + * @param plan the definition of a plan for database rows + * @param schema the name of the schema for the new view generated from the plan + * @param view the name of the new view generated from the plan + * @param handle the XML handle on the generated view for the plan + * @param the type of the handle for the generated view + * @return the handle with the content of the generated view for the plan + */ + T generateView(Plan plan, String schema, String view, T handle); + /** + * Generates generates a view that encapsulates a plan. + * + * Insert the generated XML into the schemas database and then use the + * {@link PlanBuilder#fromView(String, String)} accessor to query + * against the generated view. + * + * The IO class must have been registered before creating the database client. + * By default, the provided handles that implement + * {@link com.marklogic.client.io.marker.ContentHandle ContentHandle} are registered. + * + * Learn more about shortcut methods + * + * @param plan the definition of a plan for database rows + * @param schema the name of the schema for the new view generated from the plan + * @param view the name of the new view generated from the plan + * @param as the IO class for reading the generated view for the plan + * @param the type of the IO object for reading the generated view + * @return an object of the IO class with the content of the generated view for the plan + */ + T generateViewAs(Plan plan, String schema, String view, Class as); } diff --git a/marklogic-client-api/src/test/java/com/marklogic/client/test/PlanExpressionTest.java b/marklogic-client-api/src/test/java/com/marklogic/client/test/PlanExpressionTest.java new file mode 100644 index 000000000..625e99be4 --- /dev/null +++ b/marklogic-client-api/src/test/java/com/marklogic/client/test/PlanExpressionTest.java @@ -0,0 +1,283 @@ +/* + * Copyright (c) 2021 MarkLogic Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.marklogic.client.test; + +import com.marklogic.client.expression.PlanBuilder; +import com.marklogic.client.row.RowManager; +import com.marklogic.client.row.RowRecord; +import com.marklogic.client.row.RowSet; +import com.marklogic.client.type.PlanExprCol; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import static org.junit.Assert.*; + +public class PlanExpressionTest { + protected static RowManager rowMgr = null; + protected static PlanBuilder p = null; + + @BeforeClass + public static void beforeClass() { + Common.connect(); + rowMgr = Common.client.newRowManager(); + p = rowMgr.newPlanBuilder(); + } + @AfterClass + public static void afterClass() { + p = null; + rowMgr = null; + } + + private RowRecord redactTest(String testName, Map testRow, PlanExprCol... cols) { + PlanBuilder.ModifyPlan plan = + p.fromLiterals(new Map[]{testRow}) + .bind(p.colSeq(cols)); + + RowSet rowSet = rowMgr.resultRows(plan); + Iterator rowItr = rowSet.iterator(); + assertTrue("no row to test for "+testName, rowItr.hasNext()); + + return rowItr.next(); + } + + @Test + public void testMaskDeterministic() { + final String testStr = "What is truth?"; + final int testLen = testStr.length(); + + Map testRow = new HashMap<>(); + testRow.put("cDefault", testStr); + testRow.put("cCharMixedCaseMaxLen", testStr); + + Map testOpts = new HashMap<>(); + testOpts.put("character", "mixedCase"); + testOpts.put("maxLength", testLen); + + RowRecord resultRow = redactTest("testMaskDeterministic()", testRow, + p.rdt.maskDeterministic(p.col("cDefault")), + p.rdt.maskDeterministic(p.col("cCharMixedCaseMaxLen"), testOpts) + ); + + String cDefaultVal = resultRow.getString("cDefault"); + assertNotNull(cDefaultVal); + assertTrue(cDefaultVal.matches("^[A-za-z0-9+=/]+$")); + + String cCharMixedCaseMaxLenVal = resultRow.getString("cCharMixedCaseMaxLen"); + assertNotNull(cCharMixedCaseMaxLenVal); + assertEquals(testLen, cCharMixedCaseMaxLenVal.length()); + assertTrue(cCharMixedCaseMaxLenVal.matches("^[A-za-z]+$")); + } + @Test + public void testMaskRandom() { + final int base64Len = 26; + final String testStr = "What is truth?"; + final int testLen = base64Len - 1; + + Map testRow = new HashMap<>(); + testRow.put("cDefault", testStr); + testRow.put("cCharLowerCaseNumericLen", testStr); + + Map testOpts = new HashMap<>(); + testOpts.put("character", "lowerCaseNumeric"); + testOpts.put("length", testLen); + + RowRecord resultRow = redactTest("testMaskRandom()", testRow, + p.rdt.maskRandom(p.col("cDefault")), + p.rdt.maskRandom(p.col("cCharLowerCaseNumericLen"), testOpts) + ); + + String cDefaultVal = resultRow.getString("cDefault"); + assertNotNull(cDefaultVal); + assertEquals(base64Len, cDefaultVal.length()); + assertTrue(cDefaultVal.matches("^[A-za-z0-9+=/]+$")); + + String cCharLowerCaseNumericLenVal = resultRow.getString("cCharLowerCaseNumericLen"); + assertNotNull(cCharLowerCaseNumericLenVal); + assertEquals(testLen, cCharLowerCaseNumericLenVal.length()); + assertTrue(cCharLowerCaseNumericLenVal.matches("^[a-z0-9]+$")); + } + @Test + public void testRedactDatetime() { + final String testStr = "12/31/2019"; + + Map testRow = new HashMap<>(); + testRow.put("cParsed", testStr); + testRow.put("cRandom", testStr); + + Map parsedOpts = new HashMap<>(); + parsedOpts.put("level", "parsed"); + parsedOpts.put("picture", "[M01]/[D01]/[Y0001]"); + parsedOpts.put("format", "xx/xx/[Y01]"); + + Map randomOpts = new HashMap<>(); + randomOpts.put("level", "random"); + randomOpts.put("range", "2000,2020"); + + RowRecord resultRow = redactTest("testRedactDatetime()", testRow, + p.rdt.redactDatetime(p.col("cParsed"), parsedOpts), + p.rdt.redactDatetime(p.col("cRandom"), randomOpts) + ); + + String cParsedVal = resultRow.getString("cParsed"); + assertNotNull(cParsedVal); + assertEquals("xx/xx/19", cParsedVal); + + String cRandomVal = resultRow.getString("cRandom"); + assertNotNull(cRandomVal); + assertTrue(cRandomVal.matches("^20\\d{2}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d+$")); + } + @Test + public void testRedactEmail() { + final String testStr = "thename1@thedomain1.com"; + + Map testRow = new HashMap<>(); + testRow.put("cDefault", testStr); + testRow.put("cName", testStr); + + Map testOpts = new HashMap<>(); + testOpts.put("level", "name"); + + RowRecord resultRow = redactTest("testRedactEmail()", testRow, + p.rdt.redactEmail(p.col("cDefault")), + p.rdt.redactEmail(p.col("cName"), testOpts) + ); + + String cDefaultVal = resultRow.getString("cDefault"); + assertNotNull(cDefaultVal); + assertEquals("NAME@DOMAIN", cDefaultVal); + + String cNameVal = resultRow.getString("cName"); + assertNotNull(cNameVal); + assertEquals("NAME@thedomain1.com", cNameVal); + } + @Test + public void testRedactIpv4() { + final String testStr = "123.145.167.189"; + + Map testRow = new HashMap<>(); + testRow.put("cDefault", testStr); + testRow.put("cChar", testStr); + + Map testOpts = new HashMap<>(); + testOpts.put("character", "x"); + + RowRecord resultRow = redactTest("testRedactIpv4()", testRow, + p.rdt.redactIpv4(p.col("cDefault")), + p.rdt.redactIpv4(p.col("cChar"), testOpts) + ); + + String cDefaultVal = resultRow.getString("cDefault"); + assertNotNull(cDefaultVal); + assertEquals("###.###.###.###", cDefaultVal); + + String cCharVal = resultRow.getString("cChar"); + assertNotNull(cCharVal); + assertEquals("xxx.xxx.xxx.xxx", cCharVal); + } + @Test + public void testRedactNumber() { + Map testRow = new HashMap<>(); + testRow.put("cDefault", 1); + testRow.put("cDouble", 1.3); + + Map testOpts = new HashMap<>(); + testOpts.put("type", "double"); + testOpts.put("min", 2); + testOpts.put("max", 4); + + RowRecord resultRow = redactTest("testRedactNumber()", testRow, + p.rdt.redactNumber(p.col("cDefault")), + p.rdt.redactNumber(p.col("cDouble"), testOpts) + ); + + int cDefaultVal = resultRow.getInt("cDefault"); + + double cDoubleVal = resultRow.getDouble("cDouble"); + assertTrue(2 <= cDoubleVal && cDoubleVal <= 4); + } + @Test + public void testRedactRegex() { + Map testRow = new HashMap<>(); + testRow.put("cTarget", "thetargettext"); + + Map testOpts = new HashMap<>(); + testOpts.put("pattern", "tar([a-z])et"); + testOpts.put("replacement", "=$1="); + + RowRecord resultRow = redactTest("testRedactRegex()", testRow, + p.rdt.redactRegex(p.col("cTarget"), testOpts) + ); + + String cTargetVal = resultRow.getString("cTarget"); + assertNotNull(cTargetVal); + assertEquals("the=g=text", cTargetVal); + } + @Test + public void testRedactUsPhone() { + final String testStr = "123-456-7890"; + + Map testRow = new HashMap<>(); + testRow.put("cDefault", testStr); + testRow.put("cFullRandom", testStr); + + Map testOpts = new HashMap<>(); + testOpts.put("level", "full-random"); + + RowRecord resultRow = redactTest("testRedactUsPhone()", testRow, + p.rdt.redactUsPhone(p.col("cDefault")), + p.rdt.redactUsPhone(p.col("cFullRandom"), testOpts) + ); + + String cDefaultVal = resultRow.getString("cDefault"); + assertNotNull(cDefaultVal); + assertEquals("###-###-####", cDefaultVal); + + String cFullRandomVal = resultRow.getString("cFullRandom"); + assertNotNull(cFullRandomVal); + assertEquals(testStr.length(), cFullRandomVal.length()); + assertTrue(cFullRandomVal.matches("^\\d{3}-\\d{3}-\\d{4}$")); + } + @Test + public void testRedactUsSsn() { + final String testStr = "123-45-6789"; + + Map testRow = new HashMap<>(); + testRow.put("cDefault", testStr); + testRow.put("cFullRandom", testStr); + + Map testOpts = new HashMap<>(); + testOpts.put("level", "full-random"); + + RowRecord resultRow = redactTest("testRedactUsSsn()", testRow, + p.rdt.redactUsSsn(p.col("cDefault")), + p.rdt.redactUsSsn(p.col("cFullRandom"), testOpts) + ); + + String cDefaultVal = resultRow.getString("cDefault"); + assertNotNull(cDefaultVal); + assertEquals("###-##-####", cDefaultVal); + + String cFullRandomVal = resultRow.getString("cFullRandom"); + assertNotNull(cFullRandomVal); + assertEquals(testStr.length(), cFullRandomVal.length()); + assertTrue(cFullRandomVal.matches("^\\d{3}-\\d{2}-\\d{4}$")); + } +} \ No newline at end of file diff --git a/marklogic-client-api/src/test/java/com/marklogic/client/test/RowManagerTest.java b/marklogic-client-api/src/test/java/com/marklogic/client/test/RowManagerTest.java index c97c36299..5d2294594 100644 --- a/marklogic-client-api/src/test/java/com/marklogic/client/test/RowManagerTest.java +++ b/marklogic-client-api/src/test/java/com/marklogic/client/test/RowManagerTest.java @@ -1172,6 +1172,27 @@ public void testMapper() throws IOException, XPathExpressionException { } } @Test + public void testGenerateView() throws IOException { + RowManager rowMgr = Common.client.newRowManager(); + + PlanBuilder p = rowMgr.newPlanBuilder(); + + PlanBuilder.ExportablePlan builtPlan = + p.fromView("opticUnitTest", "musician") + .where( + p.cts.andQuery( + p.cts.jsonPropertyWordQuery("instrument", "trumpet"), + p.cts.jsonPropertyWordQuery(p.xs.string("lastName"), p.xs.stringSeq("Armstrong", "Davis")) + ) + ) + .orderBy(p.col("lastName")); + + Document xmlRoot = rowMgr.generateView(builtPlan, "opticUnitTest", "musicianView", new DOMHandle()).get(); + assertNotNull(xmlRoot); + xmlRoot = rowMgr.generateViewAs(builtPlan, "opticUnitTest", "musicianView", Document.class); + assertNotNull(xmlRoot); + } + @Test public void testExplain() throws IOException { RowManager rowMgr = Common.client.newRowManager(); From 103093225c88aa329618c9745fc29fc8639bdb25 Mon Sep 17 00:00:00 2001 From: georgeajit Date: Thu, 3 Jun 2021 15:02:33 -0700 Subject: [PATCH 04/12] No Task - Out of order key cols can be used in namedgroup --- .../functionaltest/TestOpticOnViews.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/TestOpticOnViews.java b/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/TestOpticOnViews.java index 4c14d66b9..4517c50d5 100644 --- a/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/TestOpticOnViews.java +++ b/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/TestOpticOnViews.java @@ -2914,6 +2914,33 @@ public void testgroupByUnion() throws KeyManagementException, NoSuchAlgorithmExc assertEquals("Row 2 testgroupByUnion MasterDate value incorrect", "2015-12-01", jsonBindingsNodesDate.get(1).path("MasterDate").path("value").asText()); assertEquals("Row 2 testgroupByUnion DateCount size incorrect", 1, jsonBindingsNodesDate.get(1).path("DateCount").path("value").asInt()); assertEquals("Row 2 testgroupByUnion color value incorrect", "null", jsonBindingsNodesDate.get(1).path("color").path("type").asText()); + + // Note that this plan5 is ued to verify if non-alphabetic col key name have any issues. Refer to BT56490 + ModifyPlan plan5 = plan1.union(plan2) + .select(p.as("MasterDate", p.schemaCol("opticFunctionalTest", "master", "date")), + p.as("DetailName", p.schemaCol("opticFunctionalTest", "detail", "name")), + p.as("DetailId", p.schemaCol("opticFunctionalTest", "detail", "masterId")), + p.col("amount"), + p.col("color") + ) + .groupByUnion(p.groupSeq(p.col("DetailId"), p.col("MasterDate"), p.col("color")), + p.aggregateSeq(p.count("DateCount", "MasterDate"))) + .orderBy(p.desc(p.col("MasterDate"))); + + JacksonHandle jacksonHandleColOrder = new JacksonHandle(); + jacksonHandleColOrder.setMimetype("application/json"); + + rowMgr.resultDoc(plan5, jacksonHandleColOrder); + JsonNode jsonResultsColOrd = jacksonHandleColOrder.get(); + JsonNode jsonBindingsNodesColOrd = jsonResultsColOrd.path("rows"); + System.out.println("Results from Column in non alphbetic column name order are : " + jsonBindingsNodesColOrd); + + assertEquals("Nine nodes not returned from testgroupByUnion of plan5 ", 9, jsonBindingsNodesColOrd.size()); + assertEquals("Row 1 plan5 of testgroupByUnion MasterDate value incorrect", "2015-12-02", jsonBindingsNodesColOrd.get(0).path("MasterDate").path("value").asText()); + assertEquals("Row 1 plan5 of testgroupByUnion DateCount size incorrect", 1, jsonBindingsNodesColOrd.get(0).path("DateCount").path("value").asInt()); + assertEquals("Row 7 plan5 of testgroupByUnion color type incorrect", "null", jsonBindingsNodesColOrd.get(7).path("color").path("type").asText()); + assertEquals("Row 7 plan5 of testgroupByUnion color value incorrect", "blue", jsonBindingsNodesColOrd.get(6).path("color").path("value").asText()); + } // Same as testgroupsByUnion with facade. From c68390c50f784a3bc2284bec402168e5ebc5028f Mon Sep 17 00:00:00 2001 From: georgeajit Date: Thu, 3 Jun 2021 16:09:34 -0700 Subject: [PATCH 05/12] No Task - Removed apache http library dependency. --- .../build.gradle | 2 - .../functionaltest/ConnectedRESTQA.java | 2155 ++++++++--------- .../functionaltest/TestBiTempMetaValues.java | 4 +- .../client/functionaltest/TestBiTemporal.java | 4 +- 4 files changed, 1049 insertions(+), 1116 deletions(-) diff --git a/marklogic-client-api-functionaltests/build.gradle b/marklogic-client-api-functionaltests/build.gradle index 4918680ff..c05bdc8a9 100755 --- a/marklogic-client-api-functionaltests/build.gradle +++ b/marklogic-client-api-functionaltests/build.gradle @@ -30,8 +30,6 @@ repositories { dependencies { implementation project (':marklogic-client-api') implementation group: 'org.skyscreamer', name: 'jsonassert', version: '1.5.0' - implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.11.0' - implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.11.0' implementation group: 'org.slf4j', name: 'slf4j-api', version:'1.7.25' testImplementation group: 'ch.qos.logback', name: 'logback-classic', version:'1.2.3' implementation group: 'commons-io', name: 'commons-io', version: '2.6' diff --git a/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/ConnectedRESTQA.java b/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/ConnectedRESTQA.java index df04a2ca1..504d65b9b 100644 --- a/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/ConnectedRESTQA.java +++ b/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/ConnectedRESTQA.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 MarkLogic Corporation + * Copyright (c) 2021 MarkLogic Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,51 +16,6 @@ package com.marklogic.client.functionaltest; -import java.io.IOException; -import java.io.InputStream; -import java.net.InetAddress; -import java.security.KeyManagementException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.UnrecoverableKeyException; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -import javax.net.ssl.KeyManager; -import javax.net.ssl.KeyManagerFactory; -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; - -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.NameValuePair; -import org.apache.http.auth.AuthScope; -import org.apache.http.auth.UsernamePasswordCredentials; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.ResponseHandler; -import org.apache.http.client.entity.UrlEncodedFormEntity; -import org.apache.http.client.methods.HttpDelete; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpPut; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.BasicResponseHandler; -import org.apache.http.impl.client.DefaultHttpClient; -import org.apache.http.message.BasicNameValuePair; -import org.apache.http.util.EntityUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.json.JSONObject; - import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; @@ -72,8 +27,21 @@ import com.marklogic.client.DatabaseClientFactory.SSLHostnameVerifier; import com.marklogic.client.DatabaseClientFactory.SecurityContext; import com.marklogic.client.admin.ServerConfigurationManager; +import com.marklogic.client.impl.OkHttpServices; +import com.marklogic.client.impl.RESTServices; import com.marklogic.client.io.DocumentMetadataHandle; import com.marklogic.client.io.DocumentMetadataHandle.Capability; +import okhttp3.*; +import org.json.JSONObject; + +import javax.net.ssl.*; +import java.io.IOException; +import java.io.InputStream; +import java.net.InetAddress; +import java.security.*; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.util.*; public abstract class ConnectedRESTQA { private String serverName = ""; @@ -103,58 +71,79 @@ public abstract class ConnectedRESTQA { private static Boolean isLBHost = false; private static int PROPERTY_WAIT = 0; + private static final int ML_RES_OK = 200; + private static final int ML_RES_CREATED = 201; + private static final int ML_RES_SRVRDELETE = 202; + private static final int ML_RES_CHANGED = 204; + private static final int ML_RES_BADREQT = 400; + private static final int ML_RES_NOTFND = 404; + private static final String ML_MANAGE_DB = "App-Services"; SSLContext sslContext = null; - /** - * Use Rest call to create a database. - * - * @param dbName - */ - private static final Logger logger = LogManager.getLogger(ConnectedRESTQA.class); + // Using MarkLogic client API's OKHttpClient Impl to connect to App-Services DB and use REST Manage API calls. + private static OkHttpClient createManageAdminClient(String username, String password) { + // build client with authentication information. + RESTServices services = new OkHttpServices(); + services.connect(host_name, Integer.parseInt(admin_port), ML_MANAGE_DB, new DatabaseClientFactory.DigestAuthContext(username, password)); + OkHttpClient okHttpClient = (OkHttpClient) services.getClientImplementation(); + return okHttpClient; + } + // Use Rest call to create a database. public static void createDB(String dbName) { - DefaultHttpClient client = null; + OkHttpClient client; try { - client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - - HttpPost post = new HttpPost("http://" + host_name + ":" + admin_port + "/manage/v2/databases?format=json"); + client = createManageAdminClient("admin", "admin"); String JSONString = "[{\"database-name\":\"" + dbName + "\"}]"; - - post.addHeader("Content-type", "application/json"); - post.setEntity(new StringEntity(JSONString)); - - HttpResponse response = client.execute(post); - HttpEntity respEntity = response.getEntity(); - - if (respEntity != null) { - // EntityUtils to get the response content - String content = EntityUtils.toString(respEntity); - System.out.println(content); + String urlStr = new String("http://" + host_name + ":" + admin_port + "/manage/v2/databases"); + + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(urlStr) + .post(RequestBody.create(JSONString, MediaType.parse("application/json"))) + .build(); + try (Response response = client.newCall(request).execute()) { + if (!response.isSuccessful()) throw new IOException("Unexpected code " + response); + else { + // Get response body + if (response.code() == ML_RES_CREATED) { + System.out.println("Created " + dbName + " database"); + System.out.println(response); + } + } } - EntityUtils.consume(respEntity); } catch (Exception e) { - // writing error to Log e.printStackTrace(); - } finally { - client.getConnectionManager().shutdown(); } } - public static String getBootStrapHostFromML() { - InputStream jstream = null; - DefaultHttpClient client = null; + public static String getBootStrapHostFromML() { + OkHttpClient client; + StringBuilder resp = new StringBuilder(); try { - client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - HttpGet getrequest = new HttpGet( + client = createManageAdminClient("admin", "admin"); + StringBuilder strBuf = new StringBuilder(); + String getrequest = new String( "http://" + host_name + ":" + admin_port + "/manage/v2/properties?format=json"); - HttpResponse resp = client.execute(getrequest); - jstream = resp.getEntity().getContent(); - JsonNode jnode = new ObjectMapper().readTree(jstream); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(getrequest) + .build(); + try (Response response = client.newCall(request).execute()) { + if (!response.isSuccessful()) throw new IOException("Unexpected code " + response); + else { + // Get response body + if (response.code() == 200) { + resp.append(response.body().string()); + System.out.println("BootStrapHostFromML : " + resp.toString()); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + JsonNode jnode = new ObjectMapper().readTree(resp.toString()); String propName = "bootstrap-host"; if (!jnode.isNull()) { if (jnode.has(propName)) { @@ -172,84 +161,68 @@ public static String getBootStrapHostFromML() { return InetAddress.getLocalHost().getCanonicalHostName().toLowerCase(); } } catch (Exception e) { - // writing error to Log e.printStackTrace(); return host_name; - } finally { - try { - jstream.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - jstream = null; - client.getConnectionManager().shutdown(); } } public static void createForest(String fName, String dbName) { - DefaultHttpClient client = null; + OkHttpClient client; try { - client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - HttpPost post = new HttpPost("http://" + host_name + ":" + admin_port + "/manage/v2/forests?format=json"); + client = createManageAdminClient("admin", "admin"); + String urlStr = new String("http://" + host_name + ":" + admin_port + "/manage/v2/forests?format=json"); String hName = getBootStrapHostFromML(); String JSONString = "{\"database\":\"" + dbName + "\",\"forest-name\":\"" + fName + "\",\"host\":\"" + hName + "\"}"; - post.addHeader("Content-type", "application/json"); - post.setEntity(new StringEntity(JSONString)); - - HttpResponse response = client.execute(post); - HttpEntity respEntity = response.getEntity(); - - if (respEntity != null) { - // EntityUtils to get the response content - String content = EntityUtils.toString(respEntity); - System.out.println(content); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(urlStr) + .post(RequestBody.create(JSONString, MediaType.parse("application/json"))) + .build(); + try (Response response = client.newCall(request).execute()) { + if (!response.isSuccessful()) throw new IOException("Unexpected code " + response); + else { + if (response.code() == ML_RES_CREATED) { + System.out.println("Created forest " + fName); + System.out.println(response.body().string()); + } + } } } catch (Exception e) { - // writing error to Log e.printStackTrace(); - } finally { - client.getConnectionManager().shutdown(); } } - /* - * creating forests on different hosts - */ + // creating forests on different hosts public static void createForestonHost(String fName, String dbName, String hName) { - DefaultHttpClient client = null; + OkHttpClient client; try { - client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - HttpPost post = new HttpPost("http://" + host_name + ":" + admin_port + "/manage/v2/forests?format=json"); + client = createManageAdminClient("admin", "admin"); + String urlStr = new String("http://" + host_name + ":" + admin_port + "/manage/v2/forests?format=json"); String JSONString = "{\"database\":\"" + dbName + "\",\"forest-name\":\"" + fName + "\",\"host\":\"" + hName + "\"}"; - post.addHeader("Content-type", "application/json"); - post.setEntity(new StringEntity(JSONString)); - - HttpResponse response = client.execute(post); - HttpEntity respEntity = response.getEntity(); - - if (respEntity != null) { - // EntityUtils to get the response content - String content = EntityUtils.toString(respEntity); - System.out.println(content); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(urlStr) + .post(RequestBody.create(JSONString, MediaType.parse("application/json"))) + .build(); + try (Response response = client.newCall(request).execute()) { + if (!response.isSuccessful()) throw new IOException("Unexpected code " + response); + else { + if (response.code() == ML_RES_CREATED) { + System.out.println("Created forest " + fName + " on host " + hName); + System.out.println(response.body().string()); + } + } } } catch (Exception e) { - // writing error to Log e.printStackTrace(); - } finally { - client.getConnectionManager().shutdown(); } } public static void postRequest(Map payload, Map params, String endpoint) { - DefaultHttpClient client = null; + OkHttpClient client; JSONObject JSONpayload = null; try { if (payload == null) { @@ -258,56 +231,65 @@ public static void postRequest(Map payload, Map else { JSONpayload = new JSONObject(payload); } - client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - HttpPost post = new HttpPost("http://" + host_name + ":" + admin_port + endpoint); + client = createManageAdminClient("admin", "admin"); + String postUrl = new String("http://" + host_name + ":" + admin_port + endpoint); + StringBuilder resp = new StringBuilder(); + // Initialize Builder (not RequestBody) + FormBody.Builder builder = new FormBody.Builder(); + if (params != null) { - Iterator localIterator; - ArrayList postParameters = new ArrayList(); - for (localIterator = params.entrySet().iterator(); localIterator.hasNext();) { - Map.Entry localEntry = (Map.Entry) localIterator.next(); - postParameters.add(new BasicNameValuePair(localEntry.getKey(), localEntry.getValue())); + for(Map.Entry entry: params.entrySet()) { + builder.add(entry.getKey(), entry.getValue()); } - post.setEntity(new UrlEncodedFormEntity(postParameters)); - } - if (payload != null) { - post.addHeader("Content-type", "application/json"); - post.setEntity(new StringEntity(JSONpayload.toString())); } - - HttpResponse response = client.execute(post); - HttpEntity respEntity = response.getEntity(); - if (respEntity != null) { - // EntityUtils to get the response content - String content = EntityUtils.toString(respEntity); - System.out.println(content); + RequestBody formBody = builder.build(); + + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(postUrl) + .post(formBody) + .build(); + try (Response response = client.newCall(request).execute()) { + if (!response.isSuccessful()) throw new IOException("Unexpected code " + response); + else if (response.code() == ML_RES_OK) { + resp.append(response.body().string()); + if (!resp.toString().isEmpty()) { + System.out.println("Posted params "); + System.out.println(resp); + } + } else { + System.out.println("No proper reponse from post request"); + System.out.println(response); + } } } catch (Exception e) { - // writing error to Log e.printStackTrace(); - } finally { - client.close(); } } public static void assocRESTServer(String restServerName, String dbName, int restPort) { - DefaultHttpClient client = null; + OkHttpClient client; try { - client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - - HttpPost post = new HttpPost("http://" + host_name + ":" + admin_port + "/v1/rest-apis?format=json"); + client = createManageAdminClient("admin", "admin"); + String urlStr = new String("http://" + host_name + ":" + admin_port + "/v1/rest-apis?format=json"); String JSONString = "{ \"rest-api\": {\"name\":\"" + restServerName + "\",\"database\":\"" + dbName + "\",\"port\":\"" + restPort + "\"}}"; - post.addHeader("Content-type", "application/json"); - post.setEntity(new StringEntity(JSONString)); - - HttpResponse response = client.execute(post); - - if (response.getStatusLine().getStatusCode() == 400) { + StringBuilder resp = new StringBuilder(); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(urlStr) + .post(RequestBody.create(JSONString, MediaType.parse("application/json"))) + .build(); + try (Response response = client.newCall(request).execute()) { + resp.append(response.body().string()); + if (!resp.toString().isEmpty()) { + System.out.println("Will try to associate RESTServer with DB"); + //System.out.println(resp); + } + } + JsonNode returnResp = new ObjectMapper().readTree(resp.toString()); + if (returnResp.get("errorResponse").get("statusCode").asInt() == ML_RES_BADREQT) { System.out.println("AppServer already exist"); if (dbName.equals("Documents")) { System.out.println("and Context database is Documents DB"); @@ -315,74 +297,70 @@ public static void assocRESTServer(String restServerName, String dbName, int res System.out.println("and changing context database to " + dbName); associateRESTServerWithDB(restServerName, dbName); } - } else if (response.getStatusLine().getStatusCode() == 201) { + } else if (returnResp.get("errorResponse").get("statusCode").asInt() == ML_RES_CREATED) { // Enable security on new REST Http Server if SSL is turned on. if (IsSecurityEnabled()) { enableSecurityOnRESTServer(restServerName, dbName); } } } catch (Exception e) { - // writing error to Log e.printStackTrace(); - } finally { - client.getConnectionManager().shutdown(); } } public static void enableSecurityOnRESTServer(String restServerName, String dbName) throws Exception { - DefaultHttpClient client = null; + OkHttpClient client; try { - client = new DefaultHttpClient(); - - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); + client = createManageAdminClient("admin", "admin"); String body = "{\"group-name\": \"Default\",\"internal-security\":\"true\", \"ssl-certificate-template\":\"ssl1-QAXdbcServer\", \"ssl-require-client-certificate\":\"true\"" + "}"; - - HttpPut put = new HttpPut("http://" + host_name + ":" + admin_port + "/manage/v2/servers/" + restServerName + StringBuilder resp = new StringBuilder(); + String put = new String("http://" + host_name + ":" + admin_port + "/manage/v2/servers/" + restServerName + "/properties?server-type=http"); - put.addHeader("Content-type", "application/json"); - put.setEntity(new StringEntity(body)); - - HttpResponse response2 = client.execute(put); - HttpEntity respEntity = response2.getEntity(); - if (respEntity != null) { - String content = EntityUtils.toString(respEntity); - System.out.println(content); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(put) + .put(RequestBody.create(body, MediaType.parse("application/json"))) + .build(); + try (Response response = client.newCall(request).execute()) { + if (!response.isSuccessful()) throw new IOException("Unexpected code " + response); + else { + + if (response.code() == ML_RES_CHANGED) { + System.out.println("Enabled Security OnRESTServer " + restServerName) ; + System.out.println(response.body().toString()); + } + } } } catch (Exception e) { - // writing error to Log e.printStackTrace(); - } finally { - client.getConnectionManager().shutdown(); } } public static void associateRESTServerWithDB(String restServerName, String dbName) throws Exception { - DefaultHttpClient client = null; + OkHttpClient client; try { - client = new DefaultHttpClient(); - - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); + client = createManageAdminClient("admin", "admin"); String body = "{\"content-database\": \"" + dbName + "\",\"group-name\": \"Default\"}"; - HttpPut put = new HttpPut("http://" + host_name + ":" + admin_port + "/manage/v2/servers/" + restServerName + String put = new String("http://" + host_name + ":" + admin_port + "/manage/v2/servers/" + restServerName + "/properties?server-type=http"); - put.addHeader("Content-type", "application/json"); - put.setEntity(new StringEntity(body)); - - HttpResponse response2 = client.execute(put); - HttpEntity respEntity = response2.getEntity(); - if (respEntity != null) { - String content = EntityUtils.toString(respEntity); - System.out.println(content); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(put) + .put(RequestBody.create(body, MediaType.parse("application/json"))) + .build(); + try (Response response = client.newCall(request).execute()) { + if (!response.isSuccessful()) throw new IOException("Unexpected code " + response); + else { + if (response.code() == ML_RES_CHANGED) { + System.out.println("Associated " + restServerName + " with database " + dbName); + System.out.println(response); + } + } } } catch (Exception e) { - // writing error to Log e.printStackTrace(); - } finally { - client.getConnectionManager().shutdown(); } } @@ -392,31 +370,30 @@ public static void associateRESTServerWithDB(String restServerName, String dbNam */ public static void associateRESTServerWithDefaultUser(String restServerName, String userName, String authType) throws Exception { - DefaultHttpClient client = null; + OkHttpClient client; try { - client = new DefaultHttpClient(); - - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); + client = createManageAdminClient("admin", "admin"); String body = "{ \"default-user\":\"" + userName + "\",\"authentication\": \"" + authType + "\",\"group-name\": \"Default\"}"; - - HttpPut put = new HttpPut("http://" + host_name + ":" + admin_port + "/manage/v2/servers/" + restServerName + StringBuilder resp = new StringBuilder(); + String put = new String("http://" + host_name + ":" + admin_port + "/manage/v2/servers/" + restServerName + "/properties?server-type=http"); - put.addHeader("Content-type", "application/json"); - put.setEntity(new StringEntity(body)); - - HttpResponse response2 = client.execute(put); - HttpEntity respEntity = response2.getEntity(); - if (respEntity != null) { - String content = EntityUtils.toString(respEntity); - System.out.println(content); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(put) + .put(RequestBody.create(body, MediaType.parse("application/json"))) + .build(); + try (Response response = client.newCall(request).execute()) { + if (!response.isSuccessful()) throw new IOException("Unexpected code " + response); + else { + if (response.code() == ML_RES_CREATED) { + System.out.println("Associate REST server with default user successful") ; + System.out.println(response); + } + } } } catch (Exception e) { - // writing error to Log e.printStackTrace(); - } finally { - client.getConnectionManager().shutdown(); } } @@ -424,32 +401,40 @@ public static void associateRESTServerWithDefaultUser(String restServerName, Str * Creating RESTServer With default content and module database */ public static void createRESTServerWithDB(String restServerName, int restPort) { - DefaultHttpClient client = null; + OkHttpClient client; try { - client = new DefaultHttpClient(); - - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - HttpPost post = new HttpPost("http://" + host_name + ":" + admin_port + "/v1/rest-apis?format=json"); - // - String JSONString = "{ \"rest-api\": {\"name\":\"" + restServerName + "\",\"port\":\"" + restPort + "\"}}"; - - post.addHeader("Content-type", "application/json"); - post.setEntity(new StringEntity(JSONString)); - - HttpResponse response = client.execute(post); - HttpEntity respEntity = response.getEntity(); - - if (respEntity != null) { - // EntityUtils to get the response content - String content = EntityUtils.toString(respEntity); - System.out.println(content); + client = createManageAdminClient("admin", "admin"); + String getrequest = new String( + "http://" + host_name + ":" + admin_port + "/manage/v2/servers/" + restServerName + "?group-id=Default"); + Request requestGet = new Request.Builder() + .header("Content-type", "application/json") + .url(getrequest) + .build(); + try (Response responseGet = client.newCall(requestGet).execute()) { + if (responseGet.code() == ML_RES_OK) { + System.out.println("Rest Server already present " + restServerName); + } + else if (responseGet.code() == ML_RES_NOTFND) { + String post = new String("http://" + host_name + ":" + admin_port + "/v1/rest-apis?format=json"); + String JSONString = "{ \"rest-api\": {\"name\":\"" + restServerName + "\",\"port\":\"" + restPort + "\"}}"; + + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(post) + .post(RequestBody.create(JSONString, MediaType.parse("application/json"))) + .build(); + try (Response response = client.newCall(request).execute()) { + if (!responseGet.isSuccessful()) throw new IOException("Unexpected code " + responseGet); + + if (response.code() == ML_RES_CREATED) { + System.out.println("created REST Server " + restServerName + " With DB"); + System.out.println(response.body().string()); + } + } + } } } catch (Exception e) { - // writing error to Log e.printStackTrace(); - } finally { - client.getConnectionManager().shutdown(); } } @@ -463,7 +448,7 @@ public static void setupJavaRESTServer(String dbName, String fName, String restS Date d = cal.getTime(); long beforeSetup = cal.getTimeInMillis(); long before = cal.getTimeInMillis(); - logger.info("### Starting TESTCASE SETUP." + dbName + "### " + d); + //logger.info("### Starting TESTCASE SETUP." + dbName + "### " + d); createDB(dbName); logTestMessages("CREATE-DB", before); @@ -505,97 +490,94 @@ public static void setupJavaRESTServer(String dbName, String fName, String restS } /* - * Create a role with given privilages + * Create a role with given privileges */ public static void createUserRolesWithPrevilages(String roleName, String... privNames) { - DefaultHttpClient client = null; + OkHttpClient client; try { - client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - HttpGet getrequest = new HttpGet("http://" + host_name + ":" + admin_port + "/manage/v2/roles/" + roleName); - HttpResponse resp = client.execute(getrequest); - - if (resp.getStatusLine().getStatusCode() == 200) { - System.out.println("Role already exist"); - } else { - System.out.println("Role dont exist, will create now"); - String[] roleNames = { "rest-reader", "rest-writer" }; - client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - - ObjectMapper mapper = new ObjectMapper(); - ObjectNode mainNode = mapper.createObjectNode(); - - ArrayNode roleArray = mapper.createArrayNode(); - ArrayNode privArray = mapper.createArrayNode(); - ArrayNode permArray = mapper.createArrayNode(); - mainNode.put("role-name", roleName); - mainNode.put("description", "role discription"); - - for (String rolename : roleNames) - roleArray.add(rolename); - mainNode.withArray("role").addAll(roleArray); - for (String privName : privNames) { - ObjectNode privNode = mapper.createObjectNode(); - privNode.put("privilege-name", privName); - privNode.put("action", "http://marklogic.com/xdmp/privileges/" + privName.replace(":", "-")); - privNode.put("kind", "execute"); - privArray.add(privNode); - } - mainNode.withArray("privilege").addAll(privArray); - permArray.add(getPermissionNode(roleNames[0], Capability.READ).get("permission").get(0)); - permArray.add(getPermissionNode(roleNames[1], Capability.READ).get("permission").get(0)); - permArray.add(getPermissionNode(roleNames[1], Capability.EXECUTE).get("permission").get(0)); - permArray.add(getPermissionNode(roleNames[1], Capability.UPDATE).get("permission").get(0)); - mainNode.withArray("permission").addAll(permArray); - System.out.println(mainNode.toString()); - HttpPost post = new HttpPost("http://" + host_name + ":" + admin_port + "/manage/v2/roles?format=json"); - post.addHeader("Content-type", "application/json"); - post.setEntity(new StringEntity(mainNode.toString())); - - HttpResponse response = client.execute(post); - HttpEntity respEntity = response.getEntity(); - if (response.getStatusLine().getStatusCode() == 400) { - System.out.println("creation of role got a problem"); - } else if (respEntity != null) { - // EntityUtils to get the response content - String content = EntityUtils.toString(respEntity); - System.out.println(content); - } else { - System.out.println("No Proper Response"); + client = createManageAdminClient("admin", "admin"); + String getrequest = new String("http://" + host_name + ":" + admin_port + "/manage/v2/roles/" + roleName); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(getrequest) + .build(); + Response response = client.newCall(request).execute(); + if (response.code() == ML_RES_OK) { + System.out.println("Role already exist"); + } else if (response.code() == ML_RES_NOTFND) { + System.out.println("Role does not exist, will create now"); + String[] roleNames = { "rest-reader", "rest-writer" }; + + ObjectMapper mapper = new ObjectMapper(); + ObjectNode mainNode = mapper.createObjectNode(); + + ArrayNode roleArray = mapper.createArrayNode(); + ArrayNode privArray = mapper.createArrayNode(); + ArrayNode permArray = mapper.createArrayNode(); + mainNode.put("role-name", roleName); + mainNode.put("description", "role discription"); + + for (String rolename : roleNames) + roleArray.add(rolename); + mainNode.withArray("role").addAll(roleArray); + for (String privName : privNames) { + ObjectNode privNode = mapper.createObjectNode(); + privNode.put("privilege-name", privName); + privNode.put("action", "http://marklogic.com/xdmp/privileges/" + privName.replace(":", "-")); + privNode.put("kind", "execute"); + privArray.add(privNode); + } + mainNode.withArray("privilege").addAll(privArray); + permArray.add(getPermissionNode(roleNames[0], Capability.READ).get("permission").get(0)); + permArray.add(getPermissionNode(roleNames[1], Capability.READ).get("permission").get(0)); + permArray.add(getPermissionNode(roleNames[1], Capability.EXECUTE).get("permission").get(0)); + permArray.add(getPermissionNode(roleNames[1], Capability.UPDATE).get("permission").get(0)); + mainNode.withArray("permission").addAll(permArray); + System.out.println(mainNode.toString()); + + String postUrl = new String("http://" + host_name + ":" + admin_port + "/manage/v2/roles?format=json"); + Request requestPost = new Request.Builder() + .header("Content-type", "application/json") + .url(postUrl) + .post(RequestBody.create(mainNode.toString(), MediaType.parse("application/json"))) + .build(); + Response responsePost = client.newCall(requestPost).execute(); + if (responsePost.code() == ML_RES_BADREQT) { + System.out.println("Creation of role has a problem"); + } else if (responsePost.code() == ML_RES_CREATED && responsePost.body().string()!= null) { + System.out.println("Created role " + roleName + " with required privileges"); + System.out.println(responsePost); + } else { + System.out.println("No Proper Response"); } } } catch (Exception e) { - // writing error to Log e.printStackTrace(); - } finally { - client.getConnectionManager().shutdown(); + } + finally { + client = null; } } /* - * Create a role with given privilages. With added Node Update Capability - * Similar to createUserRolesWithPrevilages method, but have Node Update. + * Create a role with given privileges. With added Node Update Capability + * Similar to createUserRolesWithPrevileges method, but have Node Update. */ public static void createRoleWithNodeUpdate(String roleName, String... privNames) { - DefaultHttpClient client = null; + OkHttpClient client; try { - client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - HttpGet getrequest = new HttpGet("http://" + host_name + ":" + admin_port + "/manage/v2/roles/" + roleName); - HttpResponse resp = client.execute(getrequest); - - if (resp.getStatusLine().getStatusCode() == 200) { + client = createManageAdminClient("admin", "admin"); + String getrequest = new String("http://" + host_name + ":" + admin_port + "/manage/v2/roles/" + roleName); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(getrequest) + .build(); + Response response = client.newCall(request).execute(); + if (response.code() == ML_RES_OK) { System.out.println("Role already exist"); - } else { - System.out.println("Role dont exist, will create now"); + } else if (response.code() == ML_RES_NOTFND) { + System.out.println("Role does not exist, will create now"); String[] roleNames = { "rest-reader", "rest-writer" }; - client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); ObjectMapper mapper = new ObjectMapper(); ObjectNode mainNode = mapper.createObjectNode(); @@ -625,49 +607,44 @@ public static void createRoleWithNodeUpdate(String roleName, String... privNames mainNode.withArray("permission").addAll(permArray); System.out.println(mainNode.toString()); - HttpPost post = new HttpPost("http://" + host_name + ":" + admin_port + "/manage/v2/roles?format=json"); - post.addHeader("Content-type", "application/json"); - post.setEntity(new StringEntity(mainNode.toString())); - - HttpResponse response = client.execute(post); - HttpEntity respEntity = response.getEntity(); - if (response.getStatusLine().getStatusCode() == 400) { - System.out.println("creation of role got a problem"); - } else if (respEntity != null) { - // EntityUtils to get the response content - String content = EntityUtils.toString(respEntity); - System.out.println(content); + String postUrl = new String("http://" + host_name + ":" + admin_port + "/manage/v2/roles?format=json"); + Request requestPost = new Request.Builder() + .header("Content-type", "application/json") + .url(postUrl) + .post(RequestBody.create(mainNode.toString(), MediaType.parse("application/json"))) + .build(); + Response responsePost = client.newCall(requestPost).execute(); + if (responsePost.code() == ML_RES_BADREQT) { + System.out.println("Creation of role has a problem"); + } else if (responsePost.code() == ML_RES_CREATED && responsePost.body().string() != null) { + System.out.println("Created role " + roleName + " with required privileges"); + System.out.println(responsePost); } else { System.out.println("No Proper Response"); } } } catch (Exception e) { - // writing error to Log e.printStackTrace(); } finally { - client.getConnectionManager().shutdown(); + client = null; } } - /* - * This function creates a REST user with given roles - */ + // This function creates a REST user with given roles public static void createRESTUser(String usrName, String pass, String... roleNames) { - DefaultHttpClient client = null; + OkHttpClient client; try { - client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - HttpGet getrequest = new HttpGet("http://" + host_name + ":" + admin_port + "/manage/v2/users/" + usrName); - HttpResponse resp = client.execute(getrequest); - - if (resp.getStatusLine().getStatusCode() == 200) { + client = createManageAdminClient("admin", "admin"); + String getrequest = new String("http://" + host_name + ":" + admin_port + "/manage/v2/users/" + usrName); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(getrequest) + .build(); + Response response = client.newCall(request).execute(); + if (response.code() == ML_RES_OK) { System.out.println("User already exist"); } else { - System.out.println("User dont exist"); - client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); + System.out.println("User does not exist"); ObjectMapper mapper = new ObjectMapper(); ObjectNode mainNode = mapper.createObjectNode(); @@ -681,34 +658,30 @@ public static void createRESTUser(String usrName, String pass, String... roleNam mainNode.withArray("role").addAll(childArray); System.out.println(mainNode.toString()); - HttpPost post = new HttpPost("http://" + host_name + ":" + admin_port + "/manage/v2/users?format=json"); - post.addHeader("Content-type", "application/json"); - post.setEntity(new StringEntity(mainNode.toString())); - - HttpResponse response = client.execute(post); - HttpEntity respEntity = response.getEntity(); - if (response.getStatusLine().getStatusCode() == 400) { - System.out.println("User already exist"); - } else if (respEntity != null) { - // EntityUtils to get the response content - String content = EntityUtils.toString(respEntity); - System.out.println(content); + String postUrl = new String("http://" + host_name + ":" + admin_port + "/manage/v2/users?format=json"); + Request requestPost = new Request.Builder() + .header("Content-type", "application/json") + .url(postUrl) + .post(RequestBody.create(mainNode.toString(), MediaType.parse("application/json"))) + .build(); + Response responsePost = client.newCall(requestPost).execute(); + if (responsePost.code() == ML_RES_BADREQT) { + System.out.println("Creation of user has a problem"); + } else if (responsePost.code() == ML_RES_CREATED && responsePost.body().string()!= null) { + System.out.println("Created user " + usrName + " with required roles"); + System.out.println(responsePost); } else { System.out.println("No Proper Response"); } } } catch (Exception e) { - // writing error to Log e.printStackTrace(); } finally { - client.getConnectionManager().shutdown(); + client = null; } } - /* - * "permission": [ { "role-name": "dls-user", "capability": "read" } - */ - + // "permission": [ { "role-name": "dls-user", "capability": "read" } public static ObjectNode getPermissionNode(String roleName, DocumentMetadataHandle.Capability... cap) { ObjectMapper mapper = new ObjectMapper(); ObjectNode mNode = mapper.createObjectNode(); @@ -738,21 +711,19 @@ public static ObjectNode getCollectionNode(String... collections) { public static void createRESTUserWithPermissions(String usrName, String pass, ObjectNode perm, ObjectNode colections, String... roleNames) { - DefaultHttpClient client = null; + OkHttpClient client; try { - client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - HttpGet getrequest = new HttpGet("http://" + host_name + ":" + admin_port + "/manage/v2/users/" + usrName); - HttpResponse resp = client.execute(getrequest); - - if (resp.getStatusLine().getStatusCode() == 200) { + client = createManageAdminClient("admin", "admin"); + String getrequest = new String("http://" + host_name + ":" + admin_port + "/manage/v2/users/" + usrName); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(getrequest) + .build(); + Response response = client.newCall(request).execute(); + if (response.code() == ML_RES_OK) { System.out.println("User already exist"); } else { - System.out.println("User dont exist"); - client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); + System.out.println("User does not exist"); ObjectMapper mapper = new ObjectMapper(); ObjectNode mainNode = mapper.createObjectNode(); @@ -768,73 +739,80 @@ public static void createRESTUserWithPermissions(String usrName, String pass, Ob mainNode.setAll(colections); System.out.println(mainNode.toString()); - HttpPost post = new HttpPost("http://" + host_name + ":" + admin_port + "/manage/v2/users?format=json"); - post.addHeader("Content-type", "application/json"); - post.setEntity(new StringEntity(mainNode.toString())); - - HttpResponse response = client.execute(post); - HttpEntity respEntity = response.getEntity(); - if (response.getStatusLine().getStatusCode() == 400) { + String postUrl = new String("http://" + host_name + ":" + admin_port + "/manage/v2/users?format=json"); + Request requestPost = new Request.Builder() + .header("Content-type", "application/json") + .url(postUrl) + .post(RequestBody.create(mainNode.toString(), MediaType.parse("application/json"))) + .build(); + Response responsePost = client.newCall(requestPost).execute(); + if (responsePost.code() == ML_RES_BADREQT) { System.out.println("Bad User creation request"); - } else if (respEntity != null) { - // EntityUtils to get the response content - String content = EntityUtils.toString(respEntity); - System.out.println(content); + } else if (responsePost.code() == ML_RES_CREATED) { + System.out.println(responsePost.body().string()); } else { System.out.println("No Proper Response"); } } } catch (Exception e) { - // writing error to Log e.printStackTrace(); } finally { - client.getConnectionManager().shutdown(); + client = null; } } public static void deleteRESTUser(String usrName) { - DefaultHttpClient client = null; + OkHttpClient client; try { - client = new DefaultHttpClient(); - - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - - HttpDelete delete = new HttpDelete( - "http://" + host_name + ":" + admin_port + "/manage/v2/users/" + usrName); - - HttpResponse response = client.execute(delete); - if (response.getStatusLine().getStatusCode() == 202) { + client = createManageAdminClient("admin", "admin"); + String deleteUrl = new String("http://" + host_name + ":" + admin_port + "/manage/v2/users/" + usrName); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(deleteUrl) + .delete() + .build(); + Response response = client.newCall(request).execute(); + if (response.code() == ML_RES_CHANGED) { Thread.sleep(3500); + System.out.println("User " + usrName + " deleted"); + System.out.println(response.body().string()); + } + else { + System.out.println("User " + usrName + " deletion has issues"); + System.out.println("Response from user deletion is: " + response); } } catch (Exception e) { - // writing error to Log e.printStackTrace(); } finally { - client.getConnectionManager().shutdown(); + client = null; } } public static void deleteUserRole(String roleName) { - DefaultHttpClient client = null; + OkHttpClient client; try { - client = new DefaultHttpClient(); - - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - - HttpDelete delete = new HttpDelete( - "http://" + host_name + ":" + admin_port + "/manage/v2/roles/" + roleName); - - HttpResponse response = client.execute(delete); - if (response.getStatusLine().getStatusCode() == 202) { + client = createManageAdminClient("admin", "admin"); + String deleteUrl = new String("http://" + host_name + ":" + admin_port + "/manage/v2/roles/" + roleName); + + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(deleteUrl) + .delete() + .build(); + Response response = client.newCall(request).execute(); + if (response.code() == ML_RES_CHANGED) { Thread.sleep(3500); + System.out.println("Role " + roleName + " deleted"); + System.out.println(response.body().string()); + } + else { + System.out.println("Role " + roleName + " deletion has issues"); + System.out.println("Response from role deletion is: " + response); } } catch (Exception e) { - // writing error to Log e.printStackTrace(); } finally { - client.getConnectionManager().shutdown(); + client = null; } } @@ -850,148 +828,172 @@ public static void setupJavaRESTServerWithDB(String restServerName, int restPort * This function deletes the REST appserver along with attached content * database and module database */ - public static void deleteRESTServerWithDB(String restServerName) { - DefaultHttpClient client = null; + OkHttpClient client; try { - client = new DefaultHttpClient(); - - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - - HttpDelete delete = new HttpDelete("http://" + host_name + ":" + admin_port + "/v1/rest-apis/" + client = createManageAdminClient("admin", "admin"); + String deleteUrl = new String("http://" + host_name + ":" + admin_port + "/v1/rest-apis/" + restServerName + "?include=content&include=modules"); - HttpResponse response = client.execute(delete); - if (response.getStatusLine().getStatusCode() == 202) { + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(deleteUrl) + .delete() + .build(); + Response response = client.newCall(request).execute(); + if (response.code() == ML_RES_SRVRDELETE) { Thread.sleep(9500); + System.out.println("Server " + restServerName + " deleted"); + //System.out.println(response.body().string()); + } + else { + System.out.println("Server " + restServerName + " deletion has issues"); + System.out.println("Response from server deletion is: " + response); } } catch (Exception e) { - // writing error to Log e.printStackTrace(); } finally { - client.getConnectionManager().shutdown(); + client = null; } } public static void deleteRESTServer(String restServerName) { - DefaultHttpClient client = null; + OkHttpClient client; try { - client = new DefaultHttpClient(); - - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - - HttpDelete delete = new HttpDelete( + client = createManageAdminClient("admin", "admin"); + String deleteUrl = new String( "http://" + host_name + ":" + admin_port + "/v1/rest-apis/" + restServerName + "&include=modules"); - HttpResponse response = client.execute(delete); - if (response.getStatusLine().getStatusCode() == 202) { + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(deleteUrl) + .delete() + .build(); + Response response = client.newCall(request).execute(); + + if (response.code() == ML_RES_SRVRDELETE) { Thread.sleep(3500); waitForServerRestart(); - } else - System.out.println("Server response " + response.getStatusLine().getStatusCode()); + } else { + Thread.sleep(3500); + System.out.println("Server response " + response.body().string()); + } } catch (Exception e) { - // writing error to Log System.out.println("Inside Deleting Rest server is throwing an error"); e.printStackTrace(); } finally { - client.getConnectionManager().shutdown(); + client = null; } } public static void detachForest(String dbName, String fName) { - DefaultHttpClient client = null; + OkHttpClient client; try { - client = new DefaultHttpClient(); - - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - - HttpPost post = new HttpPost("http://" + host_name + ":" + admin_port + "/manage/v2/forests/" + fName); - List urlParameters = new ArrayList<>(); - urlParameters.add(new BasicNameValuePair("state", "detach")); - urlParameters.add(new BasicNameValuePair("database", dbName)); - - post.setEntity(new UrlEncodedFormEntity(urlParameters)); - - HttpResponse response = client.execute(post); - HttpEntity respEntity = response.getEntity(); - - if (respEntity != null) { - // EntityUtils to get the response content - String content = EntityUtils.toString(respEntity); - System.out.println(content); + client = createManageAdminClient("admin", "admin"); + + String postUrl = new String("http://" + host_name + ":" + admin_port + "/manage/v2/forests/" + fName); + RequestBody formBody = new FormBody.Builder() + .add("state", "detach") + .add("database", dbName) + .build(); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(postUrl) + .post(formBody) + .build(); + Response response = client.newCall(request).execute(); + + if (response.code() == ML_RES_OK) { + System.out.println("Forest " + fName + " has been detached from database " + dbName); + } else { + System.out.println("Forest " + fName + " detaching from database " + dbName + " ran into problems"); + System.out.println(response); } } catch (Exception e) { - // writing error to Log e.printStackTrace(); } finally { - client.getConnectionManager().shutdown(); + client = null; } } - /* - * Deleting a forest is a HTTP Delete request - */ + // Deleting a forest is a HTTP Delete request public static void deleteForest(String fName) { - DefaultHttpClient client = null; + OkHttpClient client; try { - client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - - HttpDelete delete = new HttpDelete( + client = createManageAdminClient("admin", "admin"); + String deleteUrl = new String( "http://" + host_name + ":" + admin_port + "/manage/v2/forests/" + fName + "?level=full"); - client.execute(delete); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(deleteUrl) + .delete() + .build(); + Response response = client.newCall(request).execute(); + if (response.code() == ML_RES_CHANGED) { + System.out.println("Forest " + fName + " has been deleted"); + } else { + System.out.println("Forest " + fName + " deletion ran into problems"); + System.out.println(response); + } } catch (Exception e) { - // writing error to Log e.printStackTrace(); } finally { - client.getConnectionManager().shutdown(); + client = null; } } - /* - * Deleting Database - */ + // Deleting Database public static void deleteDB(String dbName) { - DefaultHttpClient client = null; + OkHttpClient client; try { - client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - - HttpDelete delete = new HttpDelete( - "http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName); - client.execute(delete); + client = createManageAdminClient("admin", "admin"); + String deleteUrl = new String("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(deleteUrl) + .delete() + .build(); + Response response = client.newCall(request).execute(); + if (response.code() == ML_RES_CHANGED) { + System.out.println("Database " + dbName + " has been deleted"); + } else { + System.out.println("Database " + dbName + " deletion ran into problems"); + System.out.println(response); + } } catch (Exception e) { - // writing error to Log e.printStackTrace(); } finally { - client.getConnectionManager().shutdown(); + client = null; } } - /* - * Clear the Database - */ + //Clear the Database public static void clearDB(int port) { - DefaultHttpClient client = null; + OkHttpClient client = createManageAdminClient("admin", "admin"); try { InputStream jsonstream = null; String uri = null; - if (IsSecurityEnabled()) { + String resGet = null; + JsonNode jnode = null; + if (/*IsSecurityEnabled()*/false) { // In case of SSL use 8002 port to clear DB contents. - client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - HttpGet getrequest = new HttpGet("http://" + host_name + ":" + admin_port + "/manage/v2/servers/" + String getrequest = new String("http://" + host_name + ":" + admin_port + "/manage/v2/servers/" + getRestAppServerName() + "/properties?group-id=Default&format=json"); - HttpResponse response1 = client.execute(getrequest); - jsonstream = response1.getEntity().getContent(); - JsonNode jnode = new ObjectMapper().readTree(jsonstream); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(getrequest) + .build(); + Response response = client.newCall(request).execute(); + + if (response.code() == ML_RES_OK) { + resGet = response.body().string(); + System.out.println("Response from Get is " + resGet); + } + if (resGet != null && !resGet.isEmpty()) + jnode = new ObjectMapper().readTree(resGet); + else throw new Exception("Unexpected error " + response); + String dbName = jnode.get("content-database").asText(); System.out.println("App Server's content database properties value from ClearDB is :" + dbName); @@ -1000,58 +1002,61 @@ public static void clearDB(int port) { mainNode.put("operation", "clear-database"); - HttpPost post = new HttpPost( - "http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName); - post.addHeader("Content-type", "application/json"); - post.setEntity(new StringEntity(mainNode.toString())); - - HttpResponse response = client.execute(post); - HttpEntity respEntity = response.getEntity(); - if (response.getStatusLine().getStatusCode() == 400) { - System.out.println("Database contents cleared"); - } else if (respEntity != null) { - // EntityUtils to get the response content - String content = EntityUtils.toString(respEntity); - System.out.println(content); + String postUrl = new String("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName); + Request requestSSLClear = new Request.Builder() + .header("Content-type", "application/json") + .url(postUrl) + .post(RequestBody.create(mainNode.toString(), MediaType.parse("application/json"))) + .build(); + Response responseSSLClear = client.newCall(requestSSLClear).execute(); + if (responseSSLClear.code() == ML_RES_OK) { + System.out.println(dbName + " database contents cleared"); } else { - System.out.println("No Proper Response from clearDB in SSL."); + System.out.println("Database contents did not clear"); } } else { - client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, port), - new UsernamePasswordCredentials("admin", "admin")); uri = "http://" + host_name + ":" + port + "/v1/search/"; - HttpDelete delete = new HttpDelete(uri); - client.execute(delete); + Request requestNormClear = new Request.Builder() + .header("Content-type", "application/json") + .url(uri) + .delete() + .build(); + Response responseNormClear = client.newCall(requestNormClear).execute(); + if (responseNormClear.code() == ML_RES_CHANGED) + System.out.println("Content database cleared for App Server on port " + port); + else { + System.out.println("Content database not cleared"); + throw new Exception("Unexpected error " + responseNormClear); + } } } catch (Exception e) { - // writing error to Log e.printStackTrace(); } finally { - client.getConnectionManager().shutdown(); + client = null; } } public static void waitForServerRestart() { - DefaultHttpClient client = null; + OkHttpClient client = createManageAdminClient("admin", "admin");; try { int count = 0; while (count < 20) { - client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, 8001), - new UsernamePasswordCredentials("admin", "admin")); - count++; try { - HttpGet getrequest = new HttpGet("http://" + host_name + ":8001/admin/v1/timestamp"); - HttpResponse response = client.execute(getrequest); - if (response.getStatusLine().getStatusCode() == 503) { + String getrequestUrl = new String("http://" + host_name + ":8001/admin/v1/timestamp"); + Request requestGet = new Request.Builder() + .header("Content-type", "application/json") + .url(getrequestUrl) + .build(); + Response responseGet = client.newCall(requestGet).execute(); + + if (responseGet.code() == 503) { Thread.sleep(5000); - } else if (response.getStatusLine().getStatusCode() == 200) { + } else if (responseGet.code() == 200) { break; } else { System.out.println("Waiting for response from server, Trial :" - + response.getStatusLine().getStatusCode() + count); + + responseGet.code() + count); Thread.sleep(6000); } } catch (Exception e) { @@ -1062,7 +1067,7 @@ public static void waitForServerRestart() { System.out.println("Inside wait for server restart is throwing an error"); e.printStackTrace(); } finally { - client.getConnectionManager().shutdown(); + client = null; } } @@ -1082,7 +1087,7 @@ public static void tearDownJavaRESTServer(String dbName, String[] fNames, String Calendar cal = Calendar.getInstance(); Date d = cal.getTime(); long beforeTeardown = cal.getTimeInMillis(); - logger.info("### StartingTestCase TEARDOWN " + dbName + " ### " + d); + //logger.info("### StartingTestCase TEARDOWN " + dbName + " ### " + d); long before = cal.getTimeInMillis(); try { @@ -1120,9 +1125,7 @@ public static void tearDownJavaRESTServer(String dbName, String[] fNames, String logTestMessages(" Ending TESTCASE TEARDOWN ", beforeTeardown); } - /* - * This function deletes rest server along with default forest and database - */ + // This function deletes rest server along with default forest and database public static void tearDownJavaRESTServerWithDB(String restServerName) throws Exception { try { deleteRESTServerWithDB(restServerName); @@ -1133,93 +1136,100 @@ public static void tearDownJavaRESTServerWithDB(String restServerName) throws Ex Thread.sleep(6000); } - /* - * - * setting up AppServices configurations setting up database properties - * whose value is string - */ + // Setting up AppServices configurations setting up database properties whose value is string public static void setDatabaseProperties(String dbName, String prop, String propValue) throws IOException { - InputStream jsonstream = null; - DefaultHttpClient client = null; + String resGet = null; + JsonNode jnode = null; + Response responsePut = null; + OkHttpClient client = createManageAdminClient("admin", "admin"); try { - client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - HttpGet getrequest = new HttpGet("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + String getrequest = new String("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + "/properties?format=json"); - HttpResponse response1 = client.execute(getrequest); - jsonstream = response1.getEntity().getContent(); - JsonNode jnode = new ObjectMapper().readTree(jsonstream); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(getrequest) + .build(); + Response response1 = client.newCall(request).execute(); + if (response1.code() == ML_RES_OK) { + resGet = response1.body().string(); + System.out.println("Response from Get is " + resGet); + } + if (resGet != null && !resGet.isEmpty()) + jnode = new ObjectMapper().readTree(resGet); + else throw new Exception("Unexpected error " + response1); if (!jnode.isNull()) { ((ObjectNode) jnode).put(prop, propValue); - HttpPut put = new HttpPut("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + String putUrl = new String("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + "/properties?format=json"); - put.addHeader("Content-type", "application/json"); - put.setEntity(new StringEntity(jnode.toString())); - HttpResponse response2 = client.execute(put); - HttpEntity respEntity = response2.getEntity(); + String putProps = jnode.toString(); + Request requestPut = new Request.Builder() + .header("Content-type", "application/json") + .url(putUrl) + .put(RequestBody.create(putProps, MediaType.parse("application/json"))) + .build(); + responsePut = client.newCall(requestPut).execute(); - if (respEntity != null) { - String content = EntityUtils.toString(respEntity); - System.out.println(content); + if (responsePut.code() == ML_RES_CHANGED) { + System.out.println("Database " + dbName + ". property " + prop +" has been updated with " + propValue); } } else { - System.out.println("REST call for database properties returned NULL "); + System.out.println("REST call for database properties update has issues"); + System.out.println(responsePut.toString()); } } catch (Exception e) { - // writing error to Log e.printStackTrace(); } finally { - if (jsonstream == null) { - } else { - jsonstream.close(); - } - client.getConnectionManager().shutdown(); + client = null; } } public static void setDatabaseProperties(String dbName, String prop, boolean propValue) throws IOException { - InputStream jsonstream = null; - DefaultHttpClient client = null; + String resGet = null; + JsonNode jnode = null; + Response responsePut = null; + OkHttpClient client = createManageAdminClient("admin", "admin"); try { - client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - HttpGet getrequest = new HttpGet("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + String getrequest = new String("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + "/properties?format=json"); - HttpResponse response1 = client.execute(getrequest); - jsonstream = response1.getEntity().getContent(); - JsonNode jnode = new ObjectMapper().readTree(jsonstream); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(getrequest) + .build(); + Response response1 = client.newCall(request).execute(); + if (response1.code() == ML_RES_OK) { + resGet = response1.body().string(); + System.out.println("Response from Get is " + resGet); + } + if (resGet != null && !resGet.isEmpty()) + jnode = new ObjectMapper().readTree(resGet); + else throw new Exception("Unexpected error " + response1); if (!jnode.isNull()) { ((ObjectNode) jnode).put(prop, propValue); - - HttpPut put = new HttpPut("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + String putUrl = new String("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + "/properties?format=json"); - put.addHeader("Content-type", "application/json"); - put.setEntity(new StringEntity(jnode.toString())); - HttpResponse response2 = client.execute(put); - HttpEntity respEntity = response2.getEntity(); + String putProps = jnode.toString(); + Request requestPut = new Request.Builder() + .header("Content-type", "application/json") + .url(putUrl) + .put(RequestBody.create(putProps, MediaType.parse("application/json"))) + .build(); + responsePut = client.newCall(requestPut).execute(); - if (respEntity != null) { - String content = EntityUtils.toString(respEntity); - System.out.println(content); + if (responsePut.code() == ML_RES_CHANGED) { + System.out.println("Database " + dbName + ". property " + prop +" has been updated with " + propValue); } } else { - System.out.println("REST call for database properties returned NULL "); + System.out.println("REST call for database properties update has issues"); + System.out.println(responsePut.toString()); } } catch (Exception e) { - // writing error to Log e.printStackTrace(); } finally { - if (jsonstream == null) { - } else { - jsonstream.close(); - } - client.getConnectionManager().shutdown(); + client = null; } } @@ -1230,18 +1240,26 @@ public static void setDatabaseProperties(String dbName, String prop, boolean pro * adds elements to that array */ public static void setDatabaseProperties(String dbName, String propName, ObjectNode objNode) throws IOException { - InputStream jsonstream = null; - DefaultHttpClient client = null; + String resGet = null; + JsonNode jnode = null; + Response responsePut = null; + OkHttpClient client = createManageAdminClient("admin", "admin"); try { - client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - HttpGet getrequest = new HttpGet("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + String getrequest = new String("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + "/properties?format=json"); - HttpResponse response1 = client.execute(getrequest); - jsonstream = response1.getEntity().getContent(); - ObjectMapper mapper = new ObjectMapper(); - JsonNode jnode = mapper.readTree(jsonstream); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(getrequest) + .build(); + Response response1 = client.newCall(request).execute(); + if (response1.code() == ML_RES_OK) { + resGet = response1.body().string(); + System.out.println("Response from Get is " + resGet); + } + if (resGet != null && !resGet.isEmpty()) + jnode = new ObjectMapper().readTree(resGet); + else throw new Exception("Unexpected error " + response1); + if (!jnode.isNull()) { if (!jnode.has(propName)) { ((ObjectNode) jnode).putArray(propName).addAll(objNode.withArray(propName)); @@ -1256,31 +1274,30 @@ public static void setDatabaseProperties(String dbName, String propName, ObjectN } } } - - HttpPut put = new HttpPut("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + String putUrl = new String("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + "/properties?format=json"); - put.addHeader("Content-type", "application/json"); - put.setEntity(new StringEntity(jnode.toString())); - - HttpResponse response2 = client.execute(put); - HttpEntity respEntity = response2.getEntity(); - if (respEntity != null) { - String content = EntityUtils.toString(respEntity); - System.out.println(content); + + String putProps = jnode.toString(); + Request requestPut = new Request.Builder() + .header("Content-type", "application/json") + .url(putUrl) + .put(RequestBody.create(putProps, MediaType.parse("application/json"))) + .build(); + responsePut = client.newCall(requestPut).execute(); + System.out.println(responsePut); + if (responsePut.code() == ML_RES_CHANGED) { + System.out.println("Database " + dbName + ". property " + propName +" has been updated"); } } else { - System.out.println("REST call for database properties returned NULL \n" + jnode.toString() + "\n" - + response1.getStatusLine().getStatusCode()); + System.out.println("REST call for database properties update has issues"); + System.out.println(responsePut.toString()); + System.out.println(jnode.toString()); } } catch (Exception e) { // writing error to Log e.printStackTrace(); } finally { - if (jsonstream == null) { - } else { - jsonstream.close(); - } - client.getConnectionManager().shutdown(); + client = null; } } @@ -1735,18 +1752,26 @@ public static void addBuiltInGeoIndex(String dbName) throws Exception { */ public static void setDatabaseFieldProperties(String dbName, String field_name, String propName, ObjectNode objNode) throws IOException { - InputStream jsonstream = null; - DefaultHttpClient client = null; + String resGet = null; + JsonNode jnode = null; + Response responsePut = null; + OkHttpClient client = createManageAdminClient("admin", "admin"); try { - client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - HttpGet getrequest = new HttpGet("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + String getrequest = new String("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + "/properties?format=json"); - HttpResponse response1 = client.execute(getrequest); - jsonstream = response1.getEntity().getContent(); - ObjectMapper mapper = new ObjectMapper(); - JsonNode jnode = mapper.readTree(jsonstream); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(getrequest) + .build(); + Response response1 = client.newCall(request).execute(); + if (response1.code() == ML_RES_OK) { + resGet = response1.body().string(); + System.out.println("Response from Get is " + resGet); + } + if (resGet != null && !resGet.isEmpty()) + jnode = new ObjectMapper().readTree(resGet); + else throw new Exception("Unexpected error " + response1); + if (!jnode.isNull() && jnode.has("field")) { JsonNode fieldNode = jnode.withArray("field"); Iterator fnode = fieldNode.elements(); @@ -1761,31 +1786,28 @@ public static void setDatabaseFieldProperties(String dbName, String field_name, } } } - - HttpPut put = new HttpPut("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + String putUrl = new String("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + "/properties?format=json"); - put.addHeader("Content-type", "application/json"); - put.setEntity(new StringEntity(jnode.toString())); - - HttpResponse response2 = client.execute(put); - HttpEntity respEntity = response2.getEntity(); - if (respEntity != null) { - String content = EntityUtils.toString(respEntity); - System.out.println(content); + String putProps = jnode.toString(); + Request requestPut = new Request.Builder() + .header("Content-type", "application/json") + .url(putUrl) + .put(RequestBody.create(putProps, MediaType.parse("application/json"))) + .build(); + responsePut = client.newCall(requestPut).execute(); + System.out.println(responsePut); + if (responsePut.code() == ML_RES_CHANGED) { + System.out.println("Database " + dbName + ". property " + propName +" has been updated"); } } else { - System.out.println("REST call for database properties returned NULL \n" + jnode.toString() + "\n" - + response1.getStatusLine().getStatusCode()); + System.out.println("REST call for database properties update has issues"); + System.out.println(responsePut.toString()); + System.out.println(jnode.toString()); } } catch (Exception e) { - // writing error to Log e.printStackTrace(); } finally { - if (jsonstream == null) { - } else { - jsonstream.close(); - } - client.getConnectionManager().shutdown(); + client = null; } } @@ -1937,86 +1959,59 @@ public static void addElementRangeIndexTemporalAxis(String dbName, String axisNa axisEnd.set("element-reference", elementReferenceEnd); rootNode.set("axis-end", axisEnd); - System.out.println(rootNode.toString()); - DefaultHttpClient client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); + OkHttpClient client = createManageAdminClient("admin", "admin"); - HttpPost post = new HttpPost("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + String postStr = new String("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + "/temporal/axes?format=json"); - post.addHeader("Content-type", "application/json"); - post.addHeader("accept", "application/json"); - post.setEntity(new StringEntity(rootNode.toString())); - - HttpResponse response = client.execute(post); - HttpEntity respEntity = response.getEntity(); - if (response.getStatusLine().getStatusCode() == 400) { - HttpEntity entity = response.getEntity(); - String responseString = EntityUtils.toString(entity, "UTF-8"); - System.out.println(responseString); - } else if (respEntity != null) { - // EntityUtils to get the response content - String content = EntityUtils.toString(respEntity); - System.out.println(content); - - System.out.println("Temporal axis: " + axisName + " created"); - System.out.println("=============================================================="); - } else { - System.out.println("No Proper Response"); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(postStr) + .post(RequestBody.create(rootNode.toString(), MediaType.parse("application/json"))) + .build(); + Response response = client.newCall(request).execute(); + System.out.println(response); + if (!response.isSuccessful()) throw new IOException("Unexpected code " + response); + else { + if (response.code() == ML_RES_CREATED) { + System.out.println("Temporal axis: " + axisName + " created"); + } + else { + System.out.println("No Proper Response in Temporal axis creation"); + System.out.println(response); + } } - client.getConnectionManager().shutdown(); + client = null; } - /* - * Delete a temporal axis - * - * @dbName Database Name - * - * @axisName Axis Name - */ public static void deleteElementRangeIndexTemporalAxis(String dbName, String axisName) throws Exception { - DefaultHttpClient client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); + OkHttpClient client = createManageAdminClient("admin", "admin"); - HttpDelete del = new HttpDelete("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + String delStr = new String("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + "/temporal/axes/" + axisName + "?format=json"); - del.addHeader("Content-type", "application/json"); - del.addHeader("accept", "application/json"); - - HttpResponse response = client.execute(del); - HttpEntity respEntity = response.getEntity(); - if (response.getStatusLine().getStatusCode() == 400) { - HttpEntity entity = response.getEntity(); - String responseString = EntityUtils.toString(entity, "UTF-8"); - System.out.println(responseString); - } else if (respEntity != null) { - // EntityUtils to get the response content - String content = EntityUtils.toString(respEntity); - System.out.println(content); - } else { - System.out.println("Axis: " + axisName + " deleted"); - System.out.println("=============================================================="); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(delStr) + .delete() + .build(); + Response response = client.newCall(request).execute(); + + if (!response.isSuccessful()) throw new IOException("Unexpected code " + response); + else { + if (response.code() == ML_RES_CHANGED) { + System.out.println(axisName + " Axis deleted " + " on database " + dbName) ; + } + else { + System.out.println("No Proper Response in Temporal axis deletion"); + System.out.println(response); + } } - client.getConnectionManager().shutdown(); + client = null; } - /* - * Create a temporal collection - * - * @dbName Database Name - * - * @collectionName Collection Name (name of temporal collection that needs - * to be created) - * - * @systemAxisName Name of System axis - * - * @validAxisName Name of Valid axis - */ public static void addElementRangeIndexTemporalCollection(String dbName, String collectionName, String systemAxisName, String validAxisName) throws Exception { ObjectMapper mapper = new ObjectMapper(); @@ -2025,51 +2020,28 @@ public static void addElementRangeIndexTemporalCollection(String dbName, String rootNode.put("collection-name", collectionName); rootNode.put("system-axis", systemAxisName); rootNode.put("valid-axis", validAxisName); - System.out.println(rootNode.toString()); - DefaultHttpClient client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - - HttpPost post = new HttpPost("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + OkHttpClient client = createManageAdminClient("admin", "admin"); + String postStr = new String("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + "/temporal/collections?format=json"); - post.addHeader("Content-type", "application/json"); - post.addHeader("accept", "application/json"); - post.setEntity(new StringEntity(rootNode.toString())); - - HttpResponse response = client.execute(post); - HttpEntity respEntity = response.getEntity(); - if (response.getStatusLine().getStatusCode() == 400) { - HttpEntity entity = response.getEntity(); - String responseString = EntityUtils.toString(entity, "UTF-8"); - System.out.println(responseString); - } else if (respEntity != null) { - // EntityUtils to get the response content - String content = EntityUtils.toString(respEntity); - System.out.println(content); - + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(postStr) + .post(RequestBody.create(rootNode.toString(), MediaType.parse("application/json"))) + .build(); + Response response = client.newCall(request).execute(); + if (!response.isSuccessful()) throw new IOException("Unexpected code " + response); + else if (response.code() == ML_RES_CREATED) { System.out.println("Temporal collection: " + collectionName + " created"); - System.out.println("=============================================================="); } else { - System.out.println("No Proper Response"); + System.out.println("No Proper Response from Temporal collection creation"); } - client.getConnectionManager().shutdown(); + client = null; } - /* - * Create a temporal collection - * - * @dbName Database Name - * - * @collectionName Collection Name (name of temporal collection that needs - * to be created) - * - * @systemAxisName Name of System axis - * - * @validAxisName Name of Valid axis - */ + // Update temporal collection public static void updateTemporalCollectionForLSQT(String dbName, String collectionName, boolean enable) throws Exception { ObjectMapper mapper = new ObjectMapper(); @@ -2079,145 +2051,131 @@ public static void updateTemporalCollectionForLSQT(String dbName, String collect // Set system time values ObjectNode automation = mapper.createObjectNode(); automation.put("enabled", true); - rootNode.set("automation", automation); - System.out.println(rootNode.toString()); - DefaultHttpClient client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); + OkHttpClient client =createManageAdminClient("admin", "admin"); - HttpPut put = new HttpPut("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + String putStr = new String("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + "/temporal/collections/lsqt/properties?collection=" + collectionName); - put.addHeader("Content-type", "application/json"); - put.addHeader("accept", "application/json"); - put.setEntity(new StringEntity(rootNode.toString())); - - HttpResponse response = client.execute(put); - HttpEntity respEntity = response.getEntity(); - if (response.getStatusLine().getStatusCode() == 400) { - HttpEntity entity = response.getEntity(); - String responseString = EntityUtils.toString(entity, "UTF-8"); - System.out.println(responseString); - } else if (respEntity != null) { - // EntityUtils to get the response content - String content = EntityUtils.toString(respEntity); - System.out.println(content); - - System.out.println("Temporal collection: " + collectionName + " created"); - System.out.println("=============================================================="); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(putStr) + .put(RequestBody.create(rootNode.toString(), MediaType.parse("application/json"))) + .build(); + Response response = client.newCall(request).execute(); + if (response.code() == ML_RES_CHANGED) { + System.out.println("Temporal collection: " + collectionName + " updated"); } else { - System.out.println("No Proper Response"); + System.out.println("No Proper Response from Temporal collection update"); } - client.getConnectionManager().shutdown(); + client = null; } - /* - * Delete a temporal collection - * - * @dbName Database Name - * - * @collectionName Collection Name - */ + // Delete a temporal collection public static void deleteElementRangeIndexTemporalCollection(String dbName, String collectionName) throws Exception { - DefaultHttpClient client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); + OkHttpClient client = createManageAdminClient("admin", "admin"); - HttpDelete del = new HttpDelete("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + String del = new String("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + "/temporal/collections?collection=" + collectionName + "&format=json"); - - del.addHeader("Content-type", "application/json"); - del.addHeader("accept", "application/json"); - - HttpResponse response = client.execute(del); - HttpEntity respEntity = response.getEntity(); - if (response.getStatusLine().getStatusCode() == 400) { - HttpEntity entity = response.getEntity(); - String responseString = EntityUtils.toString(entity, "UTF-8"); - System.out.println(responseString); - } else if (respEntity != null) { - // EntityUtils to get the response content - String content = EntityUtils.toString(respEntity); - System.out.println(content); - } else { - System.out.println("Collection: " + collectionName + " deleted"); - System.out.println("=============================================================="); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(del) + .delete() + .build(); + Response response = client.newCall(request).execute(); + if (response.code() == ML_RES_CHANGED) { + Thread.sleep(3500); + System.out.println("collection " + collectionName + " deleted"); + System.out.println(response.body().string()); + } + else { + System.out.println("collection " + collectionName + " deletion has issues"); + System.out.println("Response from collection deletion is: " + response); } - client.getConnectionManager().shutdown(); + client = null; } public static void loadBug18993() { - DefaultHttpClient client = null; + OkHttpClient client = null; try { - client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, 8011), - new UsernamePasswordCredentials("admin", "admin")); + client = createManageAdminClient("admin", "admin"); String document = "a space b"; String perm = "perm:rest-writer=read&perm:rest-writer=insert&perm:rest-writer=update&perm:rest-writer=execute"; - HttpPut put = new HttpPut( + String putStr = new String( "http://" + host_name + ":" + getRestAppServerPort() + "/v1/documents?uri=/a%20b&" + perm); - put.addHeader("Content-type", "application/xml"); - put.setEntity(new StringEntity(document)); - HttpResponse response = client.execute(put); - HttpEntity respEntity = response.getEntity(); - if (respEntity != null) { - String content = EntityUtils.toString(respEntity); - System.out.println(content); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(putStr) + .put(RequestBody.create(document.toLowerCase(), MediaType.parse("application/xml"))) + .build(); + Response response = client.newCall(request).execute(); + if (response.code() == ML_RES_BADREQT) { + System.out.println(response); + } + else { + System.out.println("Loading documents for test 189933 has issues"); + System.out.println(response); } } catch (Exception e) { // writing error to Log e.printStackTrace(); } finally { - client.getConnectionManager().shutdown(); + client= null; } } public static void setAuthentication(String level, String restServerName) - throws ClientProtocolException, IOException { - DefaultHttpClient client = new DefaultHttpClient(); - - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); + throws IOException { + OkHttpClient client = createManageAdminClient("admin", "admin"); String body = "{\"authentication\": \"" + level + "\"}"; - HttpPut put = new HttpPut("http://" + host_name + ":" + admin_port + "/manage/v2/servers/" + restServerName + String putStr = new String("http://" + host_name + ":" + admin_port + "/manage/v2/servers/" + restServerName + "/properties?server-type=http&group-id=Default"); - put.addHeader("Content-type", "application/json"); - put.setEntity(new StringEntity(body)); - - HttpResponse response2 = client.execute(put); - HttpEntity respEntity = response2.getEntity(); - if (respEntity != null) { - String content = EntityUtils.toString(respEntity); - System.out.println(content); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(putStr) + .put(RequestBody.create(body, MediaType.parse("application/json"))) + .build(); + Response response = client.newCall(request).execute(); + + if (!response.isSuccessful()) throw new IOException("Unexpected code " + response); + else if (response.code() == ML_RES_CHANGED) { + System.out.println("App Server Authentication value changed to " + level); + } + else { + System.out.println("App Server Authentication value change ran into issues"); + System.out.println(response); } - client.getConnectionManager().shutdown(); + client = null; } - public static void setDefaultUser(String usr, String restServerName) throws ClientProtocolException, IOException { + public static void setDefaultUser(String usr, String restServerName) throws IOException { - DefaultHttpClient client = new DefaultHttpClient(); + OkHttpClient client = createManageAdminClient("admin", "admin"); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); String body = "{\"default-user\": \"" + usr + "\"}"; - HttpPut put = new HttpPut("http://" + host_name + ":" + admin_port + "/manage/v2/servers/" + restServerName + String putStr = new String("http://" + host_name + ":" + admin_port + "/manage/v2/servers/" + restServerName + "/properties?server-type=http&group-id=Default"); - put.addHeader("Content-type", "application/json"); - put.setEntity(new StringEntity(body)); - - HttpResponse response2 = client.execute(put); - HttpEntity respEntity = response2.getEntity(); - if (respEntity != null) { - String content = EntityUtils.toString(respEntity); - System.out.println(content); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(putStr) + .put(RequestBody.create(body, MediaType.parse("application/json"))) + .build(); + Response response = client.newCall(request).execute(); + + if (!response.isSuccessful()) throw new IOException("Unexpected code " + response); + else if (response.code() == ML_RES_CHANGED) { + System.out.println("Default User name changed to " + usr); + } + else { + System.out.println("Default User name change ran into issues"); + System.out.println(response); } - client.getConnectionManager().shutdown(); + client = null; } public static void setupServerRequestLogging(DatabaseClient client, boolean flag) throws Exception { @@ -2232,32 +2190,35 @@ public static void setupServerRequestLogging(DatabaseClient client, boolean flag * database. */ public static void setPathRangeIndexInDatabase(String dbName, JsonNode jnode) throws IOException { - DefaultHttpClient client = null; + OkHttpClient client = null; try { - client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); + client = createManageAdminClient("admin", "admin"); - HttpPut put = new HttpPut("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + String putStr = new String("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + "/properties?format=json"); - put.addHeader("Content-type", "application/json"); - put.setEntity(new StringEntity(jnode.toString())); - - HttpResponse response = client.execute(put); - HttpEntity respEntity = response.getEntity(); - if (respEntity != null) { - String content = EntityUtils.toString(respEntity); - System.out.println(content); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(putStr) + .put(RequestBody.create(jnode.toString(), MediaType.parse("application/json"))) + .build(); + Response response = client.newCall(request).execute(); + + if (!response.isSuccessful()) throw new IOException("Unexpected code " + response); + else if (response.code() == ML_RES_CHANGED) { + System.out.println("Path index assignment successful "); + } + else { + System.out.println("Path index assignment ran into issues"); + System.out.println(response); } } catch (Exception e) { - // writing error to Log e.printStackTrace(); } finally { - client.getConnectionManager().shutdown(); + client = null; } } - /** + /* * Returns a SSLContext, so that the tests can run on a SSL enabled REST * server. * @@ -2318,7 +2279,7 @@ public X509Certificate[] getAcceptedIssuers() { return mlsslContext; } - /** + /* * Clear the database contents based on port for SSL or non SSL enabled REST * Server. * @throws Exception @@ -2327,7 +2288,7 @@ public static void clearDB() throws Exception { clearDB(getRestServerPort()); } - /** + /* * Configure a SSL or non SSL enabled REST Server based on the build.gradle * ssl setting. * @@ -2345,14 +2306,7 @@ public static void configureRESTServer(String dbName, String[] fNames) throws Ex setRESTServerWithDistributeTimestamps(restServerName, "cluster"); } - /** - * Configure a SSL or non SSL enabled REST Server based on the build.gradle - * ssl setting. Associate database or not - * - * @param dbName - * @param fNames - * @throws Exception - */ + //Configure a SSL or non SSL enabled REST Server based on the build.gradle public static void configureRESTServer(String dbName, String[] fNames, boolean bAssociateDB) throws Exception { loadGradleProperties(); if (IsSecurityEnabled()) @@ -2361,13 +2315,7 @@ public static void configureRESTServer(String dbName, String[] fNames, boolean b setupJavaRESTServer(dbName, fNames[0], restServerName, getRestServerPort(), bAssociateDB); } - /** - * Removes the database and forest from a REST server. - * - * @param dbName - * @param fNames - * @throws Exception - */ + // Removes the database and forest from a REST server. public static void cleanupRESTServer(String dbName, String[] fNames) throws Exception { if (IsSecurityEnabled()) tearDownJavaRESTServer(dbName, fNames, restSslServerName); @@ -2375,11 +2323,7 @@ public static void cleanupRESTServer(String dbName, String[] fNames) throws Exce tearDownJavaRESTServer(dbName, fNames, restServerName); } - /** - * Returns true or false based security (ssl) is enabled or disabled. - * - * @return - */ + // Returns true or false based security (ssl) is enabled or disabled. public static boolean IsSecurityEnabled() { boolean bSecurityEnabled = false; if (getSslEnabled().trim().equalsIgnoreCase("true")) @@ -2484,35 +2428,28 @@ public static DatabaseClient getDatabaseClientOnDatabase(String hostName, int po return client; } - /** - * Return a Server name. For SSL runs returns value in restSslServerName For - * non SSL runs returns restServerName - * - * @return - */ - + //Return a Server name. For SSL runs returns value in restSslServerName For + // non SSL runs returns restServerName public static String getRestServerName() { return (getSslEnabled().trim().equalsIgnoreCase("true") ? restSslServerName : restServerName); } - /** + /* * Return a Server host name configured in build.gradle. For SSL runs * returns SSL_HOST_NAME For non SSL runs returns HOST_NAME * * @return */ - public static String getRestServerHostName() { return (getSslEnabled().trim().equalsIgnoreCase("true") ? getSslServer() : getServer()); } - /** + /* * Return a Server host port configured in build.gradle. For SSL runs * returns HTTPS_PORT For non SSL runs returns HTTP_PORT * * @return */ - public static int getRestServerPort() { return (getSslEnabled().trim().equalsIgnoreCase("true") ? getHttpsPort() : getHttpPort()); } @@ -2619,14 +2556,12 @@ public static int getRestAppServerPort() { return (IsSecurityEnabled() ? getHttpsPort() : getHttpPort()); } - // Returns the name of the REST Application server name. Currently on single - // node. + // Returns the name of the REST Application server name. Currently on single node. public static String getRestAppServerName() { return (IsSecurityEnabled() ? getSslAppServerName() : getAppServerName()); } - // Returns the Host name where REST Application server runs. Currently on - // single node. + // Returns the Host name where REST Application server runs. Currently on single node. public static String getRestAppServerHostName() { return (IsSecurityEnabled() ? getSslServer() : getServer()); } @@ -2686,67 +2621,60 @@ public static String getSslAppServerName() { */ public static void associateRESTServerWithKerberosExtSecurity(String restServerName, String extSecurityrName) throws Exception { - DefaultHttpClient client = new DefaultHttpClient(); - - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); + OkHttpClient client = createManageAdminClient("admin", "admin"); String body = "{\"group-name\": \"Default\", \"authentication\":\"kerberos-ticket\",\"internal-security\": \"false\",\"external-security\": \"" + extSecurityrName + "\"}"; - HttpPut put = new HttpPut("http://" + host_name + ":" + admin_port + "/manage/v2/servers/" + restServerName + String putStr = new String("http://" + host_name + ":" + admin_port + "/manage/v2/servers/" + restServerName + "/properties?server-type=http"); - put.addHeader("Content-type", "application/json"); - put.setEntity(new StringEntity(body)); - - HttpResponse response2 = client.execute(put); - HttpEntity respEntity = response2.getEntity(); - if (respEntity != null) { - String content = EntityUtils.toString(respEntity); - System.out.println(content); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(putStr) + .put(RequestBody.create(body, MediaType.parse("application/json"))) + .build(); + Response response = client.newCall(request).execute(); + if (response.code() == ML_RES_CHANGED) { + System.out.println("External security " + extSecurityrName + " has been associated with " + restServerName + " server"); + } + else { + System.out.println("External security association with App server has issues"); + System.out.println(response); } - client.getConnectionManager().shutdown(); + client = null; } /* * Associate REST server with Digest Auth Property changes needed for - * Kerberos are: - * + * are: * authentication set to "Digest" internal security set to "true" */ public static void associateRESTServerWithDigestAuth(String restServerName) throws Exception { - DefaultHttpClient client = new DefaultHttpClient(); - - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); + OkHttpClient client = createManageAdminClient("admin", "admin"); String extSecurityrName = ""; String body = "{\"group-name\": \"Default\", \"authentication\":\"Digest\",\"internal-security\": \"true\",\"external-security\": \"" + extSecurityrName + "\"}"; - ; - - HttpPut put = new HttpPut("http://" + host_name + ":" + admin_port + "/manage/v2/servers/" + restServerName + String putStr = new String("http://" + host_name + ":" + admin_port + "/manage/v2/servers/" + restServerName + "/properties?server-type=http"); - put.addHeader("Content-type", "application/json"); - put.setEntity(new StringEntity(body)); - - HttpResponse response2 = client.execute(put); - HttpEntity respEntity = response2.getEntity(); - if (respEntity != null) { - String content = EntityUtils.toString(respEntity); - System.out.println(content); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(putStr) + .put(RequestBody.create(body, MediaType.parse("application/json"))) + .build(); + Response response = client.newCall(request).execute(); + if (response.code() == ML_RES_CHANGED) { + System.out.println("Digest Auth has been associated with " + restServerName + " server"); + } + else { + System.out.println("Digest Auth association with App server has issues"); + System.out.println(response); } - client.getConnectionManager().shutdown(); + client = null; } - /* - * Creates an external security name. - */ - + // Creates an external security name. public static void createExternalSecurityForKerberos(String restServerName, String extSecurityName) throws Exception { - DefaultHttpClient client = new DefaultHttpClient(); - - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); + OkHttpClient client = createManageAdminClient("admin", "admin"); String body = "{\"authentication\": \"kerberos\", \"external-security-name\":\"" + extSecurityName + "\", \"description\":\"External Kerberos Security\"" + ",\"cache-timeout\":\"300\", \"authorization\":\"internal\"," + "\"ldap-server-uri\":\"\"," @@ -2754,41 +2682,38 @@ public static void createExternalSecurityForKerberos(String restServerName, Stri + "\"ldap-password\":\"\"," + "\"ldap-bind-method\":\"MD5\"," + "\"ssl-require-client-certificate\":\"true\"" + "}"; - HttpPost post = new HttpPost("http://" + host_name + ":" + admin_port + "/manage/v2/external-security"); - post.addHeader("Content-type", "application/json"); - post.setEntity(new StringEntity(body)); - - HttpResponse response2 = client.execute(post); - HttpEntity respEntity = response2.getEntity(); - if (respEntity != null) { - String content = EntityUtils.toString(respEntity); - System.out.println(content); + String postStr = new String("http://" + host_name + ":" + admin_port + "/manage/v2/external-security"); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(postStr) + .post(RequestBody.create(body, MediaType.parse("application/json"))) + .build(); + Response response = client.newCall(request).execute(); + if (response.code() == ML_RES_CREATED) { + System.out.println("External security " + extSecurityName + " created and associated with " + restServerName + " server"); + } + else { + System.out.println("External security creation and association with App server has issues"); + System.out.println(response); } - client.getConnectionManager().shutdown(); + client = null; } - /* - * This function creates a REST user with a Kerberos External name and given - * roles - */ - + // This function creates a REST user with a Kerberos External name and given roles public static void createRESTKerberosUser(String usrName, String pass, String externalName, String... roleNames) { - DefaultHttpClient clientReq = null; - DefaultHttpClient clientPost = null; + OkHttpClient client = createManageAdminClient("admin", "admin");; try { - clientReq = new DefaultHttpClient(); - clientReq.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - HttpGet getrequest = new HttpGet("http://" + host_name + ":" + admin_port + "/manage/v2/users/" + usrName); - HttpResponse resp = clientReq.execute(getrequest); - - if (resp.getStatusLine().getStatusCode() == 200) { - System.out.println("Kerberos User already exist"); + String getrequest = new String("http://" + host_name + ":" + admin_port + "/manage/v2/users/" + usrName); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(getrequest) + .build(); + Response responseGet = client.newCall(request).execute(); + + if (responseGet.code() == ML_RES_OK) { + System.out.println("Kerberos User " + usrName + " already exist"); } else { - System.out.println("Kerberos User dont exist"); - clientPost = new DefaultHttpClient(); - clientPost.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); + System.out.println("Kerberos User does exist"); ObjectMapper mapper = new ObjectMapper(); ObjectNode mainNode = mapper.createObjectNode(); @@ -2810,32 +2735,31 @@ public static void createRESTKerberosUser(String usrName, String pass, String ex mainNode.withArray("external-names").addAll(childArrayExtNames); System.out.println(mainNode.toString()); - HttpPost post = new HttpPost("http://" + host_name + ":" + admin_port + "/manage/v2/users?format=json"); - post.addHeader("Content-type", "application/json"); - post.setEntity(new StringEntity(mainNode.toString())); - - HttpResponse response = clientPost.execute(post); - HttpEntity respEntity = response.getEntity(); - if (response.getStatusLine().getStatusCode() == 400) { + String postStr = new String("http://" + host_name + ":" + admin_port + "/manage/v2/users?format=json"); + Request requestUsr = new Request.Builder() + .header("Content-type", "application/json") + .url(postStr) + .post(RequestBody.create(mainNode.toString(), MediaType.parse("application/json"))) + .build(); + Response responseUsr = client.newCall(requestUsr).execute(); + if (responseUsr.code() == ML_RES_BADREQT) { System.out.println("Kerberos User already exist - Status Code 400"); - } else if (respEntity != null) { - // EntityUtils to get the response content - String content = EntityUtils.toString(respEntity); - System.out.println(content); + } else if (responseUsr.code() == ML_RES_CREATED) { + System.out.println("Kerberos User " + usrName + " associated with " + externalName + " external name"); } else { System.out.println("No Proper Response - Kerberos User"); + System.out.println(responseUsr); } } } catch (Exception e) { - // writing error to Log e.printStackTrace(); } finally { - clientReq.getConnectionManager().shutdown(); - clientPost.getConnectionManager().shutdown(); + client = null; } } public static void changeProperty(Map properties, String endpoint) { + OkHttpClient client = null; try { StringBuffer xmlBuff = new StringBuffer(); xmlBuff.append("{"); @@ -2852,32 +2776,36 @@ public static void changeProperty(Map properties, String endpoin j++; } xmlBuff.append('}'); - DefaultHttpClient client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - - HttpPut post = new HttpPut("http://" + host_name + ":" + admin_port + endpoint); - post.addHeader("Content-type", "application/json"); - post.setEntity(new StringEntity(xmlBuff.toString())); - - HttpResponse response = client.execute(post); - HttpEntity respEntity = response.getEntity(); - - if (respEntity != null) { - String content = EntityUtils.toString(respEntity); - System.out.println(content); + client = createManageAdminClient("admin", "admin"); + + String putStr = new String("http://" + host_name + ":" + admin_port + endpoint); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(putStr) + .put(RequestBody.create(xmlBuff.toString(), MediaType.parse("application/json"))) + .build(); + + Response response = client.newCall(request).execute(); + if (response.code() == ML_RES_BADREQT) { + System.out.println("Property change returned - Status Code 400"); + System.out.println(response); + } else if (response.code() == ML_RES_CHANGED) { + System.out.println("Property changes successful"); + } else { + System.out.println("No Proper Response"); + System.out.println(response); } } catch (Exception e) { e.printStackTrace(); } + finally { + client = null; + } } public static JsonNode getState(Map properties, String endpoint) { try { - - DefaultHttpClient client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); + OkHttpClient client = createManageAdminClient("admin", "admin"); StringBuilder xmlBuff = new StringBuilder(); Iterator it = properties.entrySet().iterator(); @@ -2891,17 +2819,22 @@ public static JsonNode getState(Map properties, String endpoint) } else { xmlBuff.append('=').append(pair.getValue()).append('&'); } - j++; } - HttpGet get = new HttpGet( - "http://" + host_name + ":" + admin_port + endpoint + "?format=json&" + xmlBuff.toString()); - HttpResponse response = client.execute(get); - ResponseHandler handler = new BasicResponseHandler(); - String body = handler.handleResponse(response); - JsonNode actualObj = new ObjectMapper().readTree(body); - return actualObj; - + String getStr = new String("http://" + host_name + ":" + admin_port + endpoint + "?format=json&" + xmlBuff.toString()); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(getStr) + .build(); + Response response = client.newCall(request).execute(); + if(response.code() == ML_RES_OK) { + String body = response.body().string(); + JsonNode actualObj = new ObjectMapper().readTree(body); + return actualObj; + } + else { + System.out.println("No proper response from getState"); + } } catch (Exception e) { e.printStackTrace(); } @@ -2909,22 +2842,29 @@ public static JsonNode getState(Map properties, String endpoint) } public static String[] getHosts() { + String body = null; try { - DefaultHttpClient client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - HttpGet get = new HttpGet("http://" + host_name + ":" + admin_port + "/manage/v2/hosts?format=json"); - - HttpResponse response = client.execute(get); - ResponseHandler handler = new BasicResponseHandler(); - String body = handler.handleResponse(response); - JsonNode actualObj = new ObjectMapper().readTree(body); - JsonNode nameNode = actualObj.path("host-default-list").path("list-items"); - List hosts = nameNode.findValuesAsText("nameref"); - String[] s = new String[hosts.size()]; - hosts.toArray(s); - return s; - + OkHttpClient client = createManageAdminClient("admin", "admin"); + String getStr = new String("http://" + host_name + ":" + admin_port + "/manage/v2/hosts?format=json"); + + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(getStr) + .build(); + Response response = client.newCall(request).execute(); + if(response.code() != ML_RES_OK) { + System.out.println("No proper response from getHosts"); + System.out.println(response); + } + else if (response.code() == ML_RES_OK) { + body = response.body().string(); + JsonNode actualObj = new ObjectMapper().readTree(body); + JsonNode nameNode = actualObj.path("host-default-list").path("list-items"); + List hosts = nameNode.findValuesAsText("nameref"); + String[] s = new String[hosts.size()]; + hosts.toArray(s); + return s; + } } catch (Exception e) { e.printStackTrace(); } @@ -2943,74 +2883,64 @@ public static void disableAutomationOnTemporalCollection(String dbName, String c automation.put("enabled", false); rootNode.set("automation", automation); - System.out.println(rootNode.toString()); - DefaultHttpClient client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials( - new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - - HttpPut put = new HttpPut("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + "/temporal/collections/lsqt/properties?collection=" + collectionName); + OkHttpClient client = createManageAdminClient("admin", "admin"); - put.addHeader("Content-type", "application/json"); - put.addHeader("accept", "application/json"); - put.setEntity(new StringEntity(rootNode.toString())); + String putStr = new String("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + "/temporal/collections/lsqt/properties?collection=" + collectionName); - HttpResponse response = client.execute(put); - HttpEntity respEntity = response.getEntity(); - if (response.getStatusLine().getStatusCode() == 400) { - HttpEntity entity = response.getEntity(); - String responseString = EntityUtils.toString(entity, "UTF-8"); - System.out.println(responseString); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(putStr) + .put(RequestBody.create(rootNode.toString(), MediaType.parse("application/json"))) + .build(); + Response response = client.newCall(request).execute(); + if (response.code() == ML_RES_BADREQT) { + System.out.println("Disable automation for a LSQT enabled DB on a collection - Failed"); + System.out.println(response); } - else if (respEntity != null) { - // EntityUtils to get the response content - String content = EntityUtils.toString(respEntity); - System.out.println(content); - - System.out.println("Temporal collection: " + collectionName + " created"); - System.out.println("=============================================================="); + else if (response.code() == ML_RES_CHANGED) { + System.out.println("Disable automation for a LSQT on " + collectionName + " successful"); } else { - System.out.println("No Proper Response"); + System.out.println("No Proper Response for Disable automation for a LSQT"); } - client.getConnectionManager().shutdown(); + client = null; } public static int getDocumentCount(String dbName) throws IOException { - InputStream jsonstream = null; - DefaultHttpClient client = null; + String jsonStr = null; + OkHttpClient client = null; int nCount = 0; try { - client = new DefaultHttpClient(); - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - HttpGet getrequest = new HttpGet("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + client = createManageAdminClient("admin", "admin"); + String getrequest = new String("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName + "?view=counts&format=json"); - HttpResponse response1 = client.execute(getrequest); - jsonstream = response1.getEntity().getContent(); - JsonNode jnode = new ObjectMapper().readTree(jsonstream); - - - if (!jnode.isNull()) { - nCount = jnode.path("database-counts").path("count-properties").path("documents").get("value").asInt(); - System.out.println(jnode); - } else { - System.out.println("REST call for database properties returned NULL "); - } + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(getrequest) + .build(); + Response response1 = client.newCall(request).execute(); + if (!response1.isSuccessful()) throw new IOException("Unexpected code " + response1); + else { + jsonStr = response1.body().string(); + JsonNode jnode = new ObjectMapper().readTree(jsonStr); + + if (!jnode.isNull()) { + nCount = jnode.path("database-counts").path("count-properties").path("documents").get("value").asInt(); + System.out.println(jnode); + } else { + System.out.println("REST call for database properties returned NULL "); + } + } } catch (Exception e) { - // writing error to Log e.printStackTrace(); } finally { - if (jsonstream == null) { - } else { - jsonstream.close(); - } - client.getConnectionManager().shutdown(); + client = null; } return nCount; } + // Wait for all nodes to be informed when property is updated in AWS env public static void waitForPropertyPropagate() { waitFor(PROPERTY_WAIT); @@ -3025,59 +2955,64 @@ public static void waitFor(int milliseconds) { } } } + /* * Associate REST server with timestamps in "distribute timestamps" to specify distribution of commit timestamps * For example set to "strict" for Application Load Balancing (AWS) * */ private static void setRESTServerWithDistributeTimestamps(String restServerName, String distributeTimestampType) throws Exception { - DefaultHttpClient client = new DefaultHttpClient(); - - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); - String extSecurityrName = ""; - String body = "{\"group-name\": \"Default\",\"distribute-timestamps\": \"" + distributeTimestampType + "\"}"; - ; - - HttpPut put = new HttpPut("http://" + host_name + ":" + admin_port + "/manage/v2/servers/" + restServerName - + "/properties?server-type=http"); - put.addHeader("Content-type", "application/json"); - put.setEntity(new StringEntity(body)); - - HttpResponse response2 = client.execute(put); - HttpEntity respEntity = response2.getEntity(); - if (respEntity != null) { - String content = EntityUtils.toString(respEntity); - System.out.println(content); + + OkHttpClient client = createManageAdminClient("admin", "admin"); + try { + String extSecurityrName = ""; + String body = "{\"group-name\": \"Default\",\"distribute-timestamps\": \"" + distributeTimestampType + "\"}"; + + String putStr = new String("http://" + host_name + ":" + admin_port + "/manage/v2/servers/" + restServerName + + "/properties?server-type=http"); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(putStr) + .put(RequestBody.create(body, MediaType.parse("application/json"))) + .build(); + Response response = client.newCall(request).execute(); + if (!response.isSuccessful()) throw new IOException("Unexpected code " + response); + else if (response.code() == ML_RES_CHANGED) { + System.out.println("Property " + distributeTimestampType + " successfully set"); + } + } + catch (Exception ex) { + ex.printStackTrace(); + } finally { + client = null; } - client.getConnectionManager().shutdown(); } public static void associateRESTServerWithModuleDB(String restServerName, String modulesDbName) throws Exception { - DefaultHttpClient client = null; + OkHttpClient client = null; try { - client = new DefaultHttpClient(); - - client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()), - new UsernamePasswordCredentials("admin", "admin")); + client = createManageAdminClient("admin", "admin"); String body = "{\"modules-database\": \"" + modulesDbName + "\",\"group-name\": \"Default\"}"; - HttpPut put = new HttpPut("http://" + host_name + ":" + admin_port + "/manage/v2/servers/" + restServerName + String putStr = new String("http://" + host_name + ":" + admin_port + "/manage/v2/servers/" + restServerName + "/properties?server-type=http"); - put.addHeader("Content-type", "application/json"); - put.setEntity(new StringEntity(body)); - - HttpResponse response2 = client.execute(put); - HttpEntity respEntity = response2.getEntity(); - if (respEntity != null) { - String content = EntityUtils.toString(respEntity); - System.out.println(content); + Request request = new Request.Builder() + .header("Content-type", "application/json") + .url(putStr) + .put(RequestBody.create(body, MediaType.parse("application/json"))) + .build(); + Response response = client.newCall(request).execute(); + if (!response.isSuccessful()) throw new IOException("Unexpected code " + response); + else if (response.code() == ML_RES_CHANGED) { + System.out.println(restServerName + " server successfully associated with " + modulesDbName + "database"); + } + else { + System.out.println("No proper response in associating RESTServer With ModuleDB"); } } catch (Exception e) { - // writing error to Log e.printStackTrace(); } finally { - client.getConnectionManager().shutdown(); + client = null; } } -} \ No newline at end of file +} diff --git a/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/TestBiTempMetaValues.java b/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/TestBiTempMetaValues.java index 9855ba81b..ea9e78387 100644 --- a/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/TestBiTempMetaValues.java +++ b/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/TestBiTempMetaValues.java @@ -149,10 +149,10 @@ public static void tearDownAfterClass() throws Exception { temporalCollectionName); ConnectedRESTQA.deleteElementRangeIndexTemporalCollection(dbName, bulktemporalCollectionName); - ConnectedRESTQA.deleteElementRangeIndexTemporalAxis(dbName, + /*ConnectedRESTQA.deleteElementRangeIndexTemporalAxis(dbName, axisValidName); ConnectedRESTQA.deleteElementRangeIndexTemporalAxis(dbName, - axisSystemName); + axisSystemName);*/ deleteDB(schemadbName); deleteForest(schemafNames[0]); } diff --git a/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/TestBiTemporal.java b/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/TestBiTemporal.java index 24373bf45..79bf601c0 100644 --- a/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/TestBiTemporal.java +++ b/marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/TestBiTemporal.java @@ -154,7 +154,7 @@ public static void tearDownAfterClass() throws Exception { // Temporal collection needs to be delete before temporal axis associated // with it can be deleted - ConnectedRESTQA.deleteElementRangeIndexTemporalCollection("Documents", + /*ConnectedRESTQA.deleteElementRangeIndexTemporalCollection("Documents", temporalLsqtCollectionName); ConnectedRESTQA.deleteElementRangeIndexTemporalCollection("Documents", temporalCollectionName); @@ -163,7 +163,7 @@ public static void tearDownAfterClass() throws Exception { ConnectedRESTQA.deleteElementRangeIndexTemporalAxis("Documents", axisValidName); ConnectedRESTQA.deleteElementRangeIndexTemporalAxis("Documents", - axisSystemName); + axisSystemName);*/ deleteDB(schemadbName); deleteForest(schemafNames[0]); } From 43c2069252d00672c5969c94635d6a043e149793 Mon Sep 17 00:00:00 2001 From: lling Date: Wed, 9 Jun 2021 22:42:52 -0700 Subject: [PATCH 06/12] #1291 Change log msg from warn to debug level. Added what maxDocBatchSize is in the msg. --- .../marklogic/client/datamovement/impl/QueryBatcherImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/datamovement/impl/QueryBatcherImpl.java b/marklogic-client-api/src/main/java/com/marklogic/client/datamovement/impl/QueryBatcherImpl.java index e2637141e..248bd23bf 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/datamovement/impl/QueryBatcherImpl.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/datamovement/impl/QueryBatcherImpl.java @@ -313,7 +313,7 @@ public QueryBatcher withJobId(String jobId) { @Override public QueryBatcher withBatchSize(int docBatchSize) { if (docBatchSize > this.maxUriBatchSize) { - logger.warn("docBatchSize is beyond maxDocBatchSize"); + logger.debug("docBatchSize is beyond maxDocBatchSize, which is {}.", this.maxUriBatchSize); } if (docBatchSize < 1) { throw new IllegalArgumentException("docBatchSize cannot be less than 1"); From b691b6e0c185e64c08eacafe69704512b92f277f Mon Sep 17 00:00:00 2001 From: lling Date: Thu, 10 Jun 2021 10:51:20 -0700 Subject: [PATCH 07/12] Throw an exception when constructing a query with empty string as criteria #1290 --- .../com/marklogic/client/impl/StringQueryDefinitionImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/impl/StringQueryDefinitionImpl.java b/marklogic-client-api/src/main/java/com/marklogic/client/impl/StringQueryDefinitionImpl.java index 007bba856..83b439323 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/impl/StringQueryDefinitionImpl.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/impl/StringQueryDefinitionImpl.java @@ -31,6 +31,9 @@ public String getCriteria() { @Override public void setCriteria(String criteria) { + if (criteria.length() == 0) { + throw new IllegalArgumentException("Criteria cannot be an empty string."); + } this.criteria = criteria; } From 9a9ddb5f0d524c857b6f88f4836969a4926128f5 Mon Sep 17 00:00:00 2001 From: lling Date: Thu, 10 Jun 2021 13:23:56 -0700 Subject: [PATCH 08/12] check if getCallerThreadPoolExecutor is null or not #1265 --- .../marklogic/client/dataservices/impl/ExecEndpointImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/ExecEndpointImpl.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/ExecEndpointImpl.java index f5fbefa48..ced4365fa 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/ExecEndpointImpl.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/ExecEndpointImpl.java @@ -254,7 +254,7 @@ public Boolean call() throws InterruptedException{ submitTask(this); } else { - if (aliveCallContextCount.decrementAndGet() == 0) { + if (aliveCallContextCount.decrementAndGet() == 0 && getCallerThreadPoolExecutor() != null) { getCallerThreadPoolExecutor().shutdown(); } } From 5a5569acc9996c70954f1473a16e2f0fea6ece45 Mon Sep 17 00:00:00 2001 From: ehennum Date: Tue, 22 Jun 2021 12:21:10 -0700 Subject: [PATCH 09/12] #1296 refactoring for handle provider --- .../client/dataservices/InputCaller.java | 3 +- .../client/dataservices/InputEndpoint.java | 3 +- .../dataservices/InputOutputCaller.java | 11 +- .../dataservices/InputOutputEndpoint.java | 3 +- .../client/dataservices/OutputCaller.java | 3 +- .../client/dataservices/OutputEndpoint.java | 3 +- .../dataservices/impl/ExecCallerImpl.java | 2 +- .../dataservices/impl/ExecEndpointImpl.java | 13 +- .../dataservices/impl/HandleProvider.java | 120 ++++++++++++++++ .../dataservices/impl/IOCallerImpl.java | 100 +++++-------- .../dataservices/impl/IOEndpointImpl.java | 2 +- .../dataservices/impl/InputCallerImpl.java | 9 +- .../dataservices/impl/InputEndpointImpl.java | 14 +- .../impl/InputOutputCallerImpl.java | 9 +- .../impl/InputOutputEndpointImpl.java | 15 +- .../dataservices/impl/OutputCallerImpl.java | 7 +- .../dataservices/impl/OutputEndpointImpl.java | 20 ++- .../client/extra/dom4j/DOM4JHandle.java | 5 + .../client/extra/gson/GSONHandle.java | 5 + .../client/extra/jdom/JDOMHandle.java | 6 + .../marklogic/client/impl/OkHttpServices.java | 131 +++++++++++++++--- .../marklogic/client/impl/RESTServices.java | 3 + .../com/marklogic/client/io/BytesHandle.java | 5 + .../com/marklogic/client/io/DOMHandle.java | 5 + .../com/marklogic/client/io/FileHandle.java | 5 + .../client/io/InputSourceHandle.java | 5 + .../client/io/InputStreamHandle.java | 7 +- .../com/marklogic/client/io/JAXBHandle.java | 5 + .../client/io/JacksonDatabindHandle.java | 5 + .../marklogic/client/io/JacksonHandle.java | 5 + .../client/io/JacksonParserHandle.java | 5 + .../com/marklogic/client/io/ReaderHandle.java | 5 + .../com/marklogic/client/io/SourceHandle.java | 5 + .../com/marklogic/client/io/StringHandle.java | 5 + .../client/io/XMLEventReaderHandle.java | 5 + .../client/io/XMLStreamReaderHandle.java | 5 + .../io/marker/BufferableContentHandle.java | 32 ++++- .../client/io/marker/ContentHandle.java | 1 + .../io/marker/ResendableContentHandle.java | 16 ++- .../io/marker/StreamingContentHandle.java | 2 +- .../marklogic/client/tools/proxy/Generator.kt | 5 +- .../proxy/endpointDeclarationSchema.json | 2 +- .../positive/AnyDocumentBundle.java | 94 +++++++++++++ .../client/test/dbfunction/fntestgen.kt | 4 +- .../positive/anyDocument/sendReceiveDocs.api | 19 +++ .../positive/anyDocument/sendReceiveDocs.sjs | 8 ++ .../positive/anyDocument/service.json | 4 + 47 files changed, 584 insertions(+), 162 deletions(-) create mode 100644 marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/HandleProvider.java create mode 100644 ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/positive/AnyDocumentBundle.java create mode 100644 ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveDocs.api create mode 100644 ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveDocs.sjs create mode 100644 ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/service.json diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputCaller.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputCaller.java index cd193850a..76e9649ad 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputCaller.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputCaller.java @@ -16,6 +16,7 @@ package com.marklogic.client.dataservices; import com.marklogic.client.DatabaseClient; +import com.marklogic.client.dataservices.impl.HandleProvider; import com.marklogic.client.dataservices.impl.InputEndpointImpl; import com.marklogic.client.io.marker.BufferableContentHandle; import com.marklogic.client.io.marker.BufferableHandle; @@ -37,7 +38,7 @@ public interface InputCaller extends IOEndpoint { * @return the InputCaller instance for calling the endpoint. */ static InputCaller on(DatabaseClient client, JSONWriteHandle apiDecl, BufferableContentHandle inputHandle) { - return new InputEndpointImpl(client, apiDecl, false, inputHandle); + return new InputEndpointImpl(client, apiDecl, new HandleProvider.ContentHandleProvider<>(inputHandle,null)); } /** diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputEndpoint.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputEndpoint.java index 0cb07f62d..1aa96cd02 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputEndpoint.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputEndpoint.java @@ -19,6 +19,7 @@ import com.marklogic.client.DatabaseClient; import com.marklogic.client.SessionState; +import com.marklogic.client.dataservices.impl.HandleProvider; import com.marklogic.client.dataservices.impl.InputEndpointImpl; import com.marklogic.client.io.InputStreamHandle; import com.marklogic.client.io.marker.JSONWriteHandle; @@ -39,7 +40,7 @@ static InputEndpoint on(DatabaseClient client, JSONWriteHandle apiDecl) { final class EndpointLocal extends InputEndpointImpl implements InputEndpoint { private EndpointLocal(DatabaseClient client, JSONWriteHandle apiDecl) { - super(client, apiDecl, false, new InputStreamHandle()); + super(client, apiDecl, new HandleProvider.ContentHandleProvider<>(new InputStreamHandle(), null)); } public InputEndpoint.BulkInputCaller bulkCaller() { return new BulkLocal(this); diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputOutputCaller.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputOutputCaller.java index 35d1fe995..fd8358ef4 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputOutputCaller.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputOutputCaller.java @@ -16,6 +16,7 @@ package com.marklogic.client.dataservices; import com.marklogic.client.DatabaseClient; +import com.marklogic.client.dataservices.impl.HandleProvider; import com.marklogic.client.dataservices.impl.InputOutputEndpointImpl; import com.marklogic.client.io.marker.BufferableContentHandle; import com.marklogic.client.io.marker.BufferableHandle; @@ -46,15 +47,17 @@ static InputOutputCaller on( DatabaseClient client, JSONWriteHandle apiDecl, BufferableContentHandle inputHandle, BufferableContentHandle outputHandle ) { - return new InputOutputEndpointImpl(client, apiDecl, false, inputHandle, outputHandle); + return new InputOutputEndpointImpl<>(client, apiDecl, new HandleProvider.ContentHandleProvider<>(inputHandle, outputHandle)); } - static ,O extends BufferableContentHandle> InputOutputCaller onHandles( +/* TODO: ADD TO ISSUE -- ALSO FOR InputCaller AND OutputCaller -- AND DELETE + static InputOutputCaller,BufferableContentHandle> onHandles( DatabaseClient client, JSONWriteHandle apiDecl, - I inputHandle, O outputHandle + BufferableContentHandle inputHandle, BufferableContentHandle outputHandle ) { - return new InputOutputEndpointImpl(client, apiDecl, true, inputHandle, outputHandle); + return new InputOutputEndpointImpl<>(client, apiDecl, new HandleProvider.DirectHandleProvider<>(inputHandle, outputHandle)); } + */ /** * Makes one call to an endpoint that doesn't take endpoint constants, endpoint state, or a session. diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputOutputEndpoint.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputOutputEndpoint.java index ae78fb870..e5660dc0c 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputOutputEndpoint.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputOutputEndpoint.java @@ -17,6 +17,7 @@ import com.marklogic.client.DatabaseClient; import com.marklogic.client.SessionState; +import com.marklogic.client.dataservices.impl.HandleProvider; import com.marklogic.client.dataservices.impl.InputOutputEndpointImpl; import com.marklogic.client.io.InputStreamHandle; import com.marklogic.client.io.marker.JSONWriteHandle; @@ -40,7 +41,7 @@ static InputOutputEndpoint on(DatabaseClient client, JSONWriteHandle apiDecl) { final class EndpointLocal extends InputOutputEndpointImpl implements InputOutputEndpoint { private EndpointLocal(DatabaseClient client, JSONWriteHandle apiDecl) { - super(client, apiDecl, false, new InputStreamHandle(), new InputStreamHandle()); + super(client, apiDecl, new HandleProvider.ContentHandleProvider<>(new InputStreamHandle(), new InputStreamHandle())); } public InputOutputEndpoint.BulkInputOutputCaller bulkCaller() { return new BulkLocal(this); diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/OutputCaller.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/OutputCaller.java index 6592b4807..cdf501e36 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/OutputCaller.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/OutputCaller.java @@ -16,6 +16,7 @@ package com.marklogic.client.dataservices; import com.marklogic.client.DatabaseClient; +import com.marklogic.client.dataservices.impl.HandleProvider; import com.marklogic.client.dataservices.impl.OutputEndpointImpl; import com.marklogic.client.io.marker.BufferableContentHandle; import com.marklogic.client.io.marker.JSONWriteHandle; @@ -40,7 +41,7 @@ public interface OutputCaller extends IOEndpoint { static OutputCaller on( DatabaseClient client, JSONWriteHandle apiDecl, BufferableContentHandle outputHandle ) { - return new OutputEndpointImpl(client, apiDecl, false, outputHandle); + return new OutputEndpointImpl(client, apiDecl, new HandleProvider.ContentHandleProvider<>(null, outputHandle)); } /** diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/OutputEndpoint.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/OutputEndpoint.java index 4df9d4063..476ebfaf4 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/OutputEndpoint.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/OutputEndpoint.java @@ -17,6 +17,7 @@ import com.marklogic.client.DatabaseClient; import com.marklogic.client.SessionState; +import com.marklogic.client.dataservices.impl.HandleProvider; import com.marklogic.client.dataservices.impl.OutputEndpointImpl; import com.marklogic.client.io.InputStreamHandle; import com.marklogic.client.io.marker.JSONWriteHandle; @@ -39,7 +40,7 @@ static OutputEndpoint on(DatabaseClient client, JSONWriteHandle apiDecl) { final class EndpointLocal extends OutputEndpointImpl implements OutputEndpoint { private EndpointLocal(DatabaseClient client, JSONWriteHandle apiDecl) { - super(client, apiDecl, false, new InputStreamHandle()); + super(client, apiDecl, new HandleProvider.ContentHandleProvider<>(null, new InputStreamHandle())); } public OutputEndpoint.BulkOutputCaller bulkCaller() { return new BulkLocal(this); diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/ExecCallerImpl.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/ExecCallerImpl.java index 85be58c64..1b69f0a9b 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/ExecCallerImpl.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/ExecCallerImpl.java @@ -20,7 +20,7 @@ final public class ExecCallerImpl extends IOCallerImpl { public ExecCallerImpl(JSONWriteHandle apiDeclaration) { - super(apiDeclaration, false, null, null); + super(apiDeclaration, new HandleProvider.ContentHandleProvider<>(null, null)); if (getInputParamdef() != null) { throw new IllegalArgumentException("input parameter not supported in endpoint: "+ getEndpointPath()); diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/ExecEndpointImpl.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/ExecEndpointImpl.java index ced4365fa..46218a9fd 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/ExecEndpointImpl.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/ExecEndpointImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 MarkLogic Corporation + * Copyright (c) 2021 MarkLogic Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -127,7 +127,7 @@ public void awaitCompletion() { else if(getCallContextQueue() != null && !getCallContextQueue().isEmpty()){ try { for (int i = 0; i < getThreadCount(); i++) { - BulkCallableImpl bulkCallableImpl = new BulkCallableImpl(this); + BulkCallableImpl bulkCallableImpl = new BulkCallableImpl(this); submitTask(bulkCallableImpl); } if(getCallerThreadPoolExecutor() != null) @@ -235,8 +235,7 @@ private boolean processOutput(CallContextImpl callContext){ } } -// TODO: static private class BulkCallableImpl - private class BulkCallableImpl implements Callable { + static private class BulkCallableImpl implements Callable { private final BulkExecCallerImpl bulkExecCallerImpl; BulkCallableImpl(BulkExecCallerImpl bulkExecCallerImpl) { @@ -251,11 +250,11 @@ public Boolean call() throws InterruptedException{ if(continueCalling) { bulkExecCallerImpl.getCallContextQueue().put(callContext); - submitTask(this); + bulkExecCallerImpl.submitTask(this); } else { - if (aliveCallContextCount.decrementAndGet() == 0 && getCallerThreadPoolExecutor() != null) { - getCallerThreadPoolExecutor().shutdown(); + if (bulkExecCallerImpl.aliveCallContextCount.decrementAndGet() == 0 && bulkExecCallerImpl.getCallerThreadPoolExecutor() != null) { + bulkExecCallerImpl.getCallerThreadPoolExecutor().shutdown(); } } diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/HandleProvider.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/HandleProvider.java new file mode 100644 index 000000000..300ce5ada --- /dev/null +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/HandleProvider.java @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2021 MarkLogic Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.marklogic.client.dataservices.impl; + +import com.marklogic.client.impl.RESTServices; +import com.marklogic.client.io.marker.BufferableContentHandle; + +public interface HandleProvider { + BufferableContentHandle getInputHandle(); + BufferableContentHandle getOutputHandle(); + I[] newInputArray(int length); + O[] newOutputArray(int length); + BufferableContentHandle[] bufferableInputHandleOn(I[] input); + O[] outputAsArray(CallContextImpl callCtxt, RESTServices.MultipleCallResponse response); + + class ContentHandleProvider implements HandleProvider { + private final BufferableContentHandle inputHandle; + private final BufferableContentHandle outputHandle; + public ContentHandleProvider(BufferableContentHandle inputHandle, BufferableContentHandle outputHandle) { + this.inputHandle = inputHandle; + this.outputHandle = outputHandle; + } + @Override + public BufferableContentHandle getInputHandle() { + return inputHandle; + } + @Override + public BufferableContentHandle getOutputHandle() { + return outputHandle; + } + @Override + public I[] newInputArray(int length) { + if (inputHandle == null) { + throw new IllegalStateException("No input handle provided"); + } + return inputHandle.newArray(length); + } + @Override + public O[] newOutputArray(int length) { + if (outputHandle == null) { + throw new IllegalStateException("No output handle provided"); + } + return outputHandle.newArray(length); + } + @Override + public BufferableContentHandle[] bufferableInputHandleOn(I[] input) { + if (inputHandle == null) { + throw new IllegalStateException("No input handle provided"); + } + return inputHandle.resendableHandleFor(input); + } + @Override + public O[] outputAsArray(CallContextImpl callCtxt, RESTServices.MultipleCallResponse response) { + if (outputHandle == null) { + throw new IllegalStateException("No output handle provided"); + } + return response.asArrayOfContent( + callCtxt.isLegacyContext() ? null : callCtxt.getEndpointState(), outputHandle + ); + } + } + + class DirectHandleProvider + implements HandleProvider, BufferableContentHandle> { + private final BufferableContentHandle inputHandle; + private final BufferableContentHandle outputHandle; + public DirectHandleProvider(BufferableContentHandle inputHandle, BufferableContentHandle outputHandle) { + this.inputHandle = inputHandle; + this.outputHandle = outputHandle; + } + @Override + public BufferableContentHandle getInputHandle() { + return inputHandle; + } + @Override + public BufferableContentHandle getOutputHandle() { + return outputHandle; + } + @Override + public BufferableContentHandle[] newInputArray(int length) { + if (inputHandle == null) { + throw new IllegalStateException("No input handle provided"); + } + return inputHandle.newHandleArray(length); + } + @Override + public BufferableContentHandle[] newOutputArray(int length) { + if (outputHandle == null) { + throw new IllegalStateException("No output handle provided"); + } + return outputHandle.newHandleArray(length); + } + @Override + public BufferableContentHandle[] bufferableInputHandleOn(BufferableContentHandle[] input) { + return input; + } + @Override + public BufferableContentHandle[] outputAsArray( + CallContextImpl, BufferableContentHandle> callCtxt, + RESTServices.MultipleCallResponse response) { + if (outputHandle == null) { + throw new IllegalStateException("No output handle provided"); + } + return response.asArrayOfHandles(callCtxt.getEndpointState(), outputHandle); + } + } +} diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/IOCallerImpl.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/IOCallerImpl.java index 22214ec4f..e0a6e2341 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/IOCallerImpl.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/IOCallerImpl.java @@ -17,7 +17,6 @@ import com.fasterxml.jackson.databind.JsonNode; import com.marklogic.client.DatabaseClient; -import com.marklogic.client.MarkLogicInternalException; import com.marklogic.client.SessionState; import com.marklogic.client.impl.BaseProxy; import com.marklogic.client.impl.NodeConverter; @@ -32,50 +31,48 @@ abstract class IOCallerImpl extends BaseCallerImpl { private final String endpointPath; private final BaseProxy.DBFunctionRequest requester; - private BufferableContentHandle inputHandle; - private BufferableContentHandle outputHandle; - private ParamdefImpl endpointStateParamdef; private ParamdefImpl sessionParamdef; private ParamdefImpl endpointConstantsParamdef; private ParamdefImpl inputParamdef; private ReturndefImpl returndef; - private boolean isHandleIO = false; + private final HandleProvider handleProvider; - IOCallerImpl( - JSONWriteHandle apiDeclaration, boolean isHandleIO, - BufferableContentHandle inputHandle, BufferableContentHandle outputHandle - ) { + IOCallerImpl(JSONWriteHandle apiDeclaration, HandleProvider handleProvider) { super(); - - this.isHandleIO = isHandleIO; - - if (apiDeclaration== null) { + if (apiDeclaration == null) { throw new IllegalArgumentException("null endpoint declaration"); + } else if (handleProvider == null) { + throw new IllegalArgumentException("null handle provider"); } this.apiDeclaration = NodeConverter.handleToJsonNode(apiDeclaration); if (!this.apiDeclaration.isObject()) { throw new IllegalArgumentException( - "endpoint declaration must be object: " + this.apiDeclaration.toString() + "endpoint declaration must be object: " + this.apiDeclaration ); } + this.handleProvider = handleProvider; + this.endpointPath = getText(this.apiDeclaration.get("endpoint")); if (this.endpointPath == null || this.endpointPath.length() == 0) { throw new IllegalArgumentException( - "no endpoint in endpoint declaration: " + this.apiDeclaration.toString() + "no endpoint in endpoint declaration: " + this.apiDeclaration ); } int nodeArgCount = 0; + BaseHandle inputHandleBase = (BaseHandle) handleProvider.getInputHandle(); + BaseHandle outputHandleBase = (BaseHandle) handleProvider.getOutputHandle(); + JsonNode functionParams = this.apiDeclaration.get("params"); if (functionParams != null) { if (!functionParams.isArray()) { throw new IllegalArgumentException( - "params must be array in endpoint declaration: " + this.apiDeclaration.toString() + "params must be array in endpoint declaration: " + this.apiDeclaration ); } @@ -84,7 +81,7 @@ abstract class IOCallerImpl extends BaseCallerImpl { for (JsonNode functionParam : functionParams) { if (!functionParam.isObject()) { throw new IllegalArgumentException( - "parameter must be object in endpoint declaration: " + functionParam.toString() + "parameter must be object in endpoint declaration: " + functionParam ); } ParamdefImpl paramdef = new ParamdefImpl(functionParam); @@ -107,11 +104,10 @@ abstract class IOCallerImpl extends BaseCallerImpl { throw new IllegalArgumentException("input parameter must be nullable"); } this.inputParamdef = paramdef; - if (inputHandle == null) { + if (inputHandleBase == null) { throw new IllegalArgumentException("no input handle provided for input parameter"); } - ((BaseHandle) inputHandle).setFormat(paramdef.getFormat()); - this.inputHandle = inputHandle; + inputHandleBase.setFormat(paramdef.getFormat()); nodeArgCount += 2; break; case "session": @@ -139,7 +135,7 @@ abstract class IOCallerImpl extends BaseCallerImpl { } } } - if (this.inputParamdef == null && inputHandle != null) { + if (this.inputParamdef == null && inputHandleBase != null) { throw new IllegalArgumentException("no input parameter declared but input handle provided"); } @@ -147,20 +143,19 @@ abstract class IOCallerImpl extends BaseCallerImpl { if (functionReturn != null) { if (!functionReturn.isObject()) { throw new IllegalArgumentException( - "return must be object in endpoint declaration: "+functionReturn.toString() + "return must be object in endpoint declaration: "+ functionReturn ); } this.returndef = new ReturndefImpl(functionReturn); if (!this.returndef.isNullable()) { throw new IllegalArgumentException("return must be nullable"); } - if (outputHandle != null) { - ((BaseHandle) outputHandle).setFormat(this.returndef.getFormat()); - this.outputHandle = outputHandle; + if (outputHandleBase != null) { + outputHandleBase.setFormat(this.returndef.getFormat()); } else if (this.endpointStateParamdef == null) { throw new IllegalArgumentException("no output handle provided for return values"); } - } else if (outputHandle != null) { + } else if (outputHandleBase != null) { throw new IllegalArgumentException("no return values declared but output handle provided"); } @@ -181,40 +176,26 @@ abstract class IOCallerImpl extends BaseCallerImpl { ); } - BufferableContentHandle getOutputHandle() { - return outputHandle; + BufferableContentHandle[] bufferableInputHandleOn(I[] input) { + return handleProvider.bufferableInputHandleOn(input); } - BufferableContentHandle castInputAsHandle(I input) { - if (!isHandleIO) { - throw new MarkLogicInternalException("Cannot cast input to handle unless using handles for IO"); - } - return (BufferableContentHandle) input; + I[] newContentInputArray(int length) { + return handleProvider.newInputArray(length); } - O castHandleAsOutput(BufferableContentHandle handle) { - if (!isHandleIO) { - throw new MarkLogicInternalException("Cannot cast handle to output unless using handles for IO"); - } - return (O) handle; - } - - BufferableContentHandle getContentInputHandle() { - if (isHandleIO) { - throw new MarkLogicInternalException("Cannot get handle for input when using handles for IO"); - } - return (BufferableContentHandle) inputHandle; - } - BufferableContentHandle getContentOutputHandle() { - if (isHandleIO) { - throw new MarkLogicInternalException("Cannot get handle for output when using handles for IO"); - } - return (BufferableContentHandle) outputHandle; + O[] newContentOutputArray(int length) { + return handleProvider.newOutputArray(length); } BaseProxy.DBFunctionRequest makeRequest(DatabaseClient db, CallContextImpl callCtxt) { return makeRequest(db, callCtxt, (RESTServices.CallField) null); } BaseProxy.DBFunctionRequest makeRequest( - DatabaseClient db, CallContextImpl callCtxt, BufferableContentHandle[] input + DatabaseClient db, CallContextImpl callCtxt, I[] input + ) { + return makeRequest(db, callCtxt, bufferableInputHandleOn(input)); + } + private BaseProxy.DBFunctionRequest makeRequest( + DatabaseClient db, CallContextImpl callCtxt, BufferableContentHandle[] input ) { RESTServices.CallField inputField = null; @@ -304,21 +285,8 @@ boolean responseWithState(BaseProxy.DBFunctionRequest request, CallContextImpl callCtxt) { - return responseMultiple(request).asArrayOfContent( - callCtxt.isLegacyContext() ? null : callCtxt.getEndpointState(), getContentOutputHandle() - ); + return handleProvider.outputAsArray(callCtxt, responseMultiple(request)); } private RESTServices.MultipleCallResponse responseMultiple(BaseProxy.DBFunctionRequest request) { if (getReturndef() == null) { diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/IOEndpointImpl.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/IOEndpointImpl.java index af49aa4ec..ad47d47a4 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/IOEndpointImpl.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/IOEndpointImpl.java @@ -323,7 +323,7 @@ boolean checkQueue(BlockingQueue queue, int batchSize) { I[] getInputBatch(BlockingQueue queue, int batchSize) { List inputStreamList = new ArrayList<>(); queue.drainTo(inputStreamList, batchSize); - return inputStreamList.toArray(endpoint.getCaller().getContentInputHandle().newArray(inputStreamList.size())); + return inputStreamList.toArray(endpoint.getCaller().newContentInputArray(inputStreamList.size())); } void processOutputBatch(O[] output, Consumer outputListener) { if (output == null || output.length == 0) return; diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputCallerImpl.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputCallerImpl.java index d7b355854..f119405d4 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputCallerImpl.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputCallerImpl.java @@ -16,14 +16,11 @@ package com.marklogic.client.dataservices.impl; import com.marklogic.client.DatabaseClient; -import com.marklogic.client.io.marker.BufferableContentHandle; import com.marklogic.client.io.marker.JSONWriteHandle; final public class InputCallerImpl extends IOCallerImpl { - public InputCallerImpl( - JSONWriteHandle apiDeclaration, boolean isHandleIO, BufferableContentHandle inputHandle - ) { - super(apiDeclaration, isHandleIO, inputHandle, null); + public InputCallerImpl(JSONWriteHandle apiDeclaration, HandleProvider handleProvider) { + super(apiDeclaration, handleProvider); if (getInputParamdef() == null) { throw new IllegalArgumentException("input parameter missing in endpoint: "+ getEndpointPath()); @@ -41,7 +38,7 @@ public InputCallerImpl( } } - public void arrayCall(DatabaseClient db, CallContextImpl callCtxt, BufferableContentHandle[] input) { + public void arrayCall(DatabaseClient db, CallContextImpl callCtxt, I[] input) { responseWithState(makeRequest(db, callCtxt, input), callCtxt); } } diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputEndpointImpl.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputEndpointImpl.java index 71ec0e019..e7b0bab8b 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputEndpointImpl.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputEndpointImpl.java @@ -20,7 +20,6 @@ import java.util.concurrent.LinkedBlockingQueue; import com.marklogic.client.dataservices.InputCaller; -import com.marklogic.client.io.marker.BufferableContentHandle; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,9 +34,9 @@ public class InputEndpointImpl extends IOEndpointImpl implements Input private final int batchSize; public InputEndpointImpl( - DatabaseClient client, JSONWriteHandle apiDecl, boolean isHandleIO, BufferableContentHandle inputHandle + DatabaseClient client, JSONWriteHandle apiDecl, HandleProvider handleProvider ) { - this(client, new InputCallerImpl<>(apiDecl, isHandleIO, inputHandle)); + this(client, new InputCallerImpl<>(apiDecl, handleProvider)); } private InputEndpointImpl(DatabaseClient client, InputCallerImpl caller) { super(client, caller); @@ -59,7 +58,7 @@ public void call(I[] input) { @Override public void call(CallContext callContext, I[] input) { InputCallerImpl callerImpl = getCaller(); - callerImpl.arrayCall(getClient(), checkAllowedArgs(callContext), callerImpl.getContentInputHandle().resendableHandleFor(input)); + callerImpl.arrayCall(getClient(), checkAllowedArgs(callContext), input); } @Deprecated @@ -197,11 +196,10 @@ private void processInput(CallContextImpl callContext, I[] inputBatch) { ErrorDisposition error = ErrorDisposition.RETRY; - BufferableContentHandle[] inputHandles = callerImpl.getContentInputHandle().resendableHandleFor(inputBatch); for (int retryCount = 0; retryCount < DEFAULT_MAX_RETRIES && error == ErrorDisposition.RETRY; retryCount++) { Throwable throwable = null; try { - getEndpoint().getCaller().arrayCall(callContext.getClient(), callContext, inputHandles); + getEndpoint().getCaller().arrayCall(callContext.getClient(), callContext, inputBatch); incrementCallCount(); return; } catch (Throwable catchedThrowable) { @@ -216,7 +214,9 @@ private void processInput(CallContextImpl callContext, I[] inputBatch) { try { if (retryCount < DEFAULT_MAX_RETRIES - 1) { - error = getErrorListener().processError(retryCount, throwable, callContext, inputHandles); + error = getErrorListener().processError( + retryCount, throwable, callContext, callerImpl.bufferableInputHandleOn(inputBatch) + ); } else { error = ErrorDisposition.SKIP_CALL; } diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputOutputCallerImpl.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputOutputCallerImpl.java index 5da936fed..330982d12 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputOutputCallerImpl.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputOutputCallerImpl.java @@ -16,14 +16,11 @@ package com.marklogic.client.dataservices.impl; import com.marklogic.client.DatabaseClient; -import com.marklogic.client.io.marker.BufferableContentHandle; import com.marklogic.client.io.marker.JSONWriteHandle; final public class InputOutputCallerImpl extends IOCallerImpl { - public InputOutputCallerImpl( - JSONWriteHandle apiDeclaration, boolean isHandleIO, BufferableContentHandle inputHandle, BufferableContentHandle outputHandle - ) { - super(apiDeclaration, isHandleIO, inputHandle, outputHandle); + public InputOutputCallerImpl(JSONWriteHandle apiDeclaration, HandleProvider handleProvider) { + super(apiDeclaration, handleProvider); if (getInputParamdef() == null) { throw new IllegalArgumentException("input parameter missing in endpoint: "+ getEndpointPath()); @@ -37,7 +34,7 @@ public InputOutputCallerImpl( } } - public O[] arrayCall(DatabaseClient db, CallContextImpl callCtxt, BufferableContentHandle[] input) { + public O[] arrayCall(DatabaseClient db, CallContextImpl callCtxt, I[] input) { return responseMultipleAsArray(makeRequest(db, callCtxt, input), callCtxt); } } diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputOutputEndpointImpl.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputOutputEndpointImpl.java index 3f705ab1c..97016f06b 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputOutputEndpointImpl.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputOutputEndpointImpl.java @@ -18,7 +18,6 @@ import com.marklogic.client.DatabaseClient; import com.marklogic.client.SessionState; import com.marklogic.client.dataservices.InputOutputCaller; -import com.marklogic.client.io.marker.BufferableContentHandle; import com.marklogic.client.io.marker.JSONWriteHandle; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -34,10 +33,9 @@ public class InputOutputEndpointImpl extends IOEndpointImpl implements private final int batchSize; public InputOutputEndpointImpl( - DatabaseClient client, JSONWriteHandle apiDecl, boolean isHandleIO, - BufferableContentHandle inputHandle, BufferableContentHandle outputHandle + DatabaseClient client, JSONWriteHandle apiDecl, HandleProvider handleProvider ) { - this(client, new InputOutputCallerImpl<>(apiDecl, isHandleIO, inputHandle, outputHandle)); + this(client, new InputOutputCallerImpl<>(apiDecl, handleProvider)); } private InputOutputEndpointImpl(DatabaseClient client, InputOutputCallerImpl caller) { super(client, caller); @@ -102,7 +100,7 @@ public BulkInputOutputCaller bulkCaller(CallContext[] callContexts, int thr private O[] getResponseData(CallContext callContext, I[] input) { InputOutputCallerImpl callerImpl = getCaller(); return callerImpl.arrayCall( - getClient(), checkAllowedArgs(callContext), callerImpl.getContentInputHandle().resendableHandleFor(input) + getClient(), checkAllowedArgs(callContext), input ); } @@ -200,12 +198,11 @@ private void processInput(CallContextImpl callContext, I[] inputBatch) { ErrorDisposition error = ErrorDisposition.RETRY; - BufferableContentHandle[] inputHandles = callerImpl.getContentInputHandle().resendableHandleFor(inputBatch); for (int retryCount = 0; retryCount < DEFAULT_MAX_RETRIES && error == ErrorDisposition.RETRY; retryCount++) { Throwable throwable = null; O[] output = null; try { - output = callerImpl.arrayCall(callContext.getClient(), callContext, inputHandles); + output = callerImpl.arrayCall(callContext.getClient(), callContext, inputBatch); incrementCallCount(); processOutputBatch(output, getOutputListener()); @@ -218,7 +215,9 @@ private void processInput(CallContextImpl callContext, I[] inputBatch) { if (getErrorListener() != null) { try { if (retryCount < DEFAULT_MAX_RETRIES - 1) { - error = getErrorListener().processError(retryCount, throwable, callContext, inputHandles); + error = getErrorListener().processError( + retryCount, throwable, callContext, callerImpl.bufferableInputHandleOn(inputBatch) + ); } else { error = ErrorDisposition.SKIP_CALL; } diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/OutputCallerImpl.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/OutputCallerImpl.java index 4e604d33c..23a7a776d 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/OutputCallerImpl.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/OutputCallerImpl.java @@ -16,14 +16,11 @@ package com.marklogic.client.dataservices.impl; import com.marklogic.client.DatabaseClient; -import com.marklogic.client.io.marker.BufferableContentHandle; import com.marklogic.client.io.marker.JSONWriteHandle; final public class OutputCallerImpl extends IOCallerImpl { - public OutputCallerImpl( - JSONWriteHandle apiDeclaration, boolean isHandleIO, BufferableContentHandle outputHandle - ) { - super(apiDeclaration, isHandleIO, null, outputHandle); + public OutputCallerImpl(JSONWriteHandle apiDeclaration, HandleProvider handleProvider) { + super(apiDeclaration, handleProvider); if (getInputParamdef() != null) { throw new IllegalArgumentException("input parameter not supported in endpoint: "+ getEndpointPath()); diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/OutputEndpointImpl.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/OutputEndpointImpl.java index 3e94b3452..6b1f7e98e 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/OutputEndpointImpl.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/OutputEndpointImpl.java @@ -19,7 +19,6 @@ import com.marklogic.client.MarkLogicInternalException; import com.marklogic.client.SessionState; import com.marklogic.client.dataservices.OutputCaller; -import com.marklogic.client.io.marker.BufferableContentHandle; import com.marklogic.client.io.marker.JSONWriteHandle; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -34,9 +33,9 @@ public class OutputEndpointImpl extends IOEndpointImpl implements Outp private final OutputCallerImpl caller; public OutputEndpointImpl( - DatabaseClient client, JSONWriteHandle apiDecl, boolean isHandleIO, BufferableContentHandle outputHandle + DatabaseClient client, JSONWriteHandle apiDecl, HandleProvider handleProvider ) { - this(client, new OutputCallerImpl<>(apiDecl, isHandleIO, outputHandle)); + this(client, new OutputCallerImpl<>(apiDecl, handleProvider)); } private OutputEndpointImpl(DatabaseClient client, OutputCallerImpl caller) { super(client, caller); @@ -167,7 +166,7 @@ public void awaitCompletion() { else if(getCallContextQueue() != null && !getCallContextQueue().isEmpty()){ try { for (int i = 0; i < getThreadCount(); i++) { - BulkCallableImpl bulkCallableImpl = new BulkCallableImpl(this); + BulkCallableImpl bulkCallableImpl = new BulkCallableImpl(this); submitTask(bulkCallableImpl); } getCallerThreadPoolExecutor().awaitTermination(); @@ -220,7 +219,7 @@ private O[] getOutputStream(CallContextImpl callContext) { if(callContext.getEndpoint().allowsEndpointState()) { callContext.withEndpointState(null); } - return getEndpoint().getCaller().getContentOutputHandle().newArray(0); + return getEndpoint().getCaller().newContentOutputArray(0); case STOP_ALL_CALLS: if (getCallerThreadPoolExecutor() != null) { @@ -231,7 +230,7 @@ private O[] getOutputStream(CallContextImpl callContext) { } } - return (output == null) ? getEndpoint().getCaller().getContentOutputHandle().newArray(0) : output; + return (output == null) ? getEndpoint().getCaller().newContentOutputArray(0) : output; } private void processOutput() { @@ -276,8 +275,7 @@ private boolean processOutput(CallContextImpl callContext){ } -// TODO: make static private class BulkCallableImpl - private class BulkCallableImpl implements Callable { + static private class BulkCallableImpl implements Callable { private final BulkOutputCallerImpl bulkOutputCallerImpl; BulkCallableImpl(BulkOutputCallerImpl bulkOutputCallerImpl) { @@ -291,10 +289,10 @@ public Boolean call() { boolean continueCalling = (callContext == null) ? false : bulkOutputCallerImpl.processOutput(callContext); if (continueCalling) { bulkOutputCallerImpl.getCallContextQueue().put(callContext); - submitTask(this); + bulkOutputCallerImpl.submitTask(this); } else { - if (getCallerThreadPoolExecutor() != null && aliveCallContextCount.decrementAndGet() == 0) { - getCallerThreadPoolExecutor().shutdown(); + if (bulkOutputCallerImpl.getCallerThreadPoolExecutor() != null && bulkOutputCallerImpl.aliveCallContextCount.decrementAndGet() == 0) { + bulkOutputCallerImpl.getCallerThreadPoolExecutor().shutdown(); } } diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/extra/dom4j/DOM4JHandle.java b/marklogic-client-api/src/main/java/com/marklogic/client/extra/dom4j/DOM4JHandle.java index 57ec4697d..c9f7af000 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/extra/dom4j/DOM4JHandle.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/extra/dom4j/DOM4JHandle.java @@ -95,6 +95,11 @@ public DOM4JHandle(Document content) { public DOM4JHandle newHandle() { return new DOM4JHandle(); } + @Override + public DOM4JHandle[] newHandleArray(int length) { + if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); + return new DOM4JHandle[length]; + } /** * Returns the dom4j reader for XML content. diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/extra/gson/GSONHandle.java b/marklogic-client-api/src/main/java/com/marklogic/client/extra/gson/GSONHandle.java index 415805608..dd25e4f38 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/extra/gson/GSONHandle.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/extra/gson/GSONHandle.java @@ -89,6 +89,11 @@ public GSONHandle(JsonElement content) { public GSONHandle newHandle() { return new GSONHandle(); } + @Override + public GSONHandle[] newHandleArray(int length) { + if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); + return new GSONHandle[length]; + } /** * Returns the parser used to construct element objects from JSON. diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/extra/jdom/JDOMHandle.java b/marklogic-client-api/src/main/java/com/marklogic/client/extra/jdom/JDOMHandle.java index 211757cc3..f8a9a22d4 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/extra/jdom/JDOMHandle.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/extra/jdom/JDOMHandle.java @@ -95,6 +95,12 @@ public JDOMHandle newHandle() { return new JDOMHandle(); } + @Override + public JDOMHandle[] newHandleArray(int length) { + if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); + return new JDOMHandle[length]; + } + /** * Returns the JDOM structure builder for XML content. * diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/impl/OkHttpServices.java b/marklogic-client-api/src/main/java/com/marklogic/client/impl/OkHttpServices.java index 13d2e8c6e..3d697abfe 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/impl/OkHttpServices.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/impl/OkHttpServices.java @@ -2046,6 +2046,27 @@ static private Request.Builder addVersionHeader(DocumentDescriptor desc, Request return requestBldr; } + static private R updateHandle(BodyPart part, R handle) { + HandleImplementation handleBase = HandleAccessor.as(handle); + + updateFormat(handleBase, getHeaderFormat(part)); + updateMimetype(handleBase, getHeaderMimetype(OkHttpServices.getHeader(part, HEADER_CONTENT_TYPE))); + updateLength(handleBase, getHeaderLength(OkHttpServices.getHeader(part, HEADER_CONTENT_LENGTH))); + handleBase.receiveContent(getEntity(part, handleBase.receiveAs())); + + return handle; + } + static private R updateHandle(Headers headers, ResponseBody body, R handle) { + HandleImplementation handleBase = HandleAccessor.as(handle); + + updateFormat(handleBase, getHeaderFormat(headers)); + updateMimetype(handleBase, getHeaderMimetype(headers.get(HEADER_CONTENT_TYPE))); + updateLength(handleBase, getHeaderLength(headers.get(HEADER_CONTENT_LENGTH))); + handleBase.receiveContent(getEntity(body, handleBase.receiveAs())); + + return handle; + } + @Override public T search(RequestLogger reqlog, T searchHandle, SearchQueryDefinition queryDef, long start, long len, QueryView view, @@ -5424,8 +5445,9 @@ static private String getReasonPhrase(Response response) { static private T getEntity(BodyPart part, Class as) { try { String contentType = part.getContentType(); - return getEntity(ResponseBody.create(MediaType.parse(contentType), part.getSize(), - Okio.buffer(Okio.source(part.getInputStream()))), as); + return getEntity( + ResponseBody.create(Okio.buffer(Okio.source(part.getInputStream())), MediaType.parse(contentType), part.getSize()), + as); } catch (IOException e) { throw new MarkLogicIOException(e); } catch (MessagingException e) { @@ -5975,6 +5997,9 @@ static class CallResponseImpl implements CallResponse { private boolean isNull = true; private Response response; + Response getResponse() { + return response; + } void setResponse(Response response) { this.response = response; } @@ -6062,12 +6087,19 @@ public C asContent(BufferableContentHandle outputHandle) { return content; } @Override + public BufferableContentHandle asHandle(BufferableContentHandle outputHandle) { + if (responseBody == null) return null; + + return updateHandle(getResponse().headers(), responseBody, outputHandle); + } + @Override public InputStream asInputStream() { return (responseBody == null) ? null : responseBody.byteStream(); } @Override public InputStreamHandle asInputStreamHandle() { - return (responseBody == null) ? null : new InputStreamHandle(asInputStream()); + return (responseBody == null) ? null : + updateHandle(getResponse().headers(), responseBody, new InputStreamHandle()); } @Override public Reader asReader() { @@ -6075,7 +6107,8 @@ public Reader asReader() { } @Override public ReaderHandle asReaderHandle() { - return (responseBody == null) ? null : new ReaderHandle(asReader()); + return (responseBody == null) ? null : + updateHandle(getResponse().headers(), responseBody, new ReaderHandle(asReader())); } @Override public String asString() { @@ -6168,9 +6201,9 @@ public Stream asStreamOfBytes() { } return builder.build(); } catch (MessagingException e) { - throw new RuntimeException(e); + throw new MarkLogicIOException(e); } catch (IOException e) { - throw new RuntimeException(e); + throw new MarkLogicIOException(e); } } @Override @@ -6190,10 +6223,11 @@ public Stream asStreamOfContent( Stream.Builder builder = Stream.builder(); for (int i=0; i < partCount; i++) { - C value = responsePartToContent(outputHandle, multipart.getBodyPart(i), receiveClass); + BodyPart bodyPart = multipart.getBodyPart(i); if (hasEndpointState && i == 0) { - endpointStateHandle.set(outputHandle.contentToBytes(value)); + updateHandle(bodyPart, endpointStateHandle); } else { + C value = responsePartToContent(outputHandle, bodyPart, receiveClass); builder.accept(value); } } @@ -6206,6 +6240,35 @@ public Stream asStreamOfContent( } } @Override + public Stream> asStreamOfHandles( + BytesHandle endpointStateHandle, BufferableContentHandle outputHandle + ) { + try { + if (multipart == null) { + return Stream.empty(); + } + + boolean hasEndpointState = (endpointStateHandle != null); + + Stream.Builder> builder = Stream.builder(); + + int partCount = multipart.getCount(); + for (int i=0; i < partCount; i++) { + BodyPart bodyPart = multipart.getBodyPart(i); + if (hasEndpointState && i == 0) { + updateHandle(bodyPart, endpointStateHandle); + } else { + builder.accept(updateHandle(bodyPart, outputHandle.newHandle())); + } + } + return builder.build(); + } catch (MessagingException e) { + throw new MarkLogicIOException(e); + } finally { + outputHandle.set(null); + } + } + @Override public Stream asStreamOfInputStreamHandle() { try { if (multipart == null) { @@ -6216,13 +6279,11 @@ public Stream asStreamOfInputStreamHandle() { Stream.Builder builder = Stream.builder(); for (int i=0; i < partCount; i++) { BodyPart bodyPart = multipart.getBodyPart(i); - builder.accept(new InputStreamHandle(bodyPart.getInputStream())); + builder.accept(updateHandle(bodyPart, new InputStreamHandle())); } return builder.build(); } catch (MessagingException e) { throw new MarkLogicIOException(e); - } catch (IOException e) { - throw new MarkLogicIOException(e); } } @Override @@ -6276,13 +6337,11 @@ public Stream asStreamOfReaderHandle() { Stream.Builder builder = Stream.builder(); for (int i=0; i < partCount; i++) { BodyPart bodyPart = multipart.getBodyPart(i); - builder.accept(new ReaderHandle(NodeConverter.InputStreamToReader(bodyPart.getInputStream()))); + builder.accept(updateHandle(bodyPart, new ReaderHandle())); } return builder.build(); } catch (MessagingException e) { throw new MarkLogicIOException(e); - } catch (IOException e) { - throw new MarkLogicIOException(e); } } @Override @@ -6342,11 +6401,12 @@ public C[] asArrayOfContent( int partCount = multipart.getCount(); C[] result = outputHandle.newArray(hasEndpointState ? (partCount - 1) : partCount); for (int i=0; i < partCount; i++) { - C value = responsePartToContent(outputHandle, multipart.getBodyPart(i), receiveClass); + BodyPart bodyPart = multipart.getBodyPart(i); if (hasEndpointState && i == 0) { - endpointStateHandle.set(outputHandle.contentToBytes(value)); + updateHandle(bodyPart, endpointStateHandle); } else { - result[hasEndpointState ? (i - 1) : i] = value; + C value = responsePartToContent(outputHandle, bodyPart, receiveClass); + result[hasEndpointState ? (i - 1) : i] = value; } } @@ -6357,6 +6417,35 @@ public C[] asArrayOfContent( outputHandle.set(null); } } + @Override + public BufferableContentHandle[] asArrayOfHandles( + BytesHandle endpointStateHandle, BufferableContentHandle outputHandle + ) { + try { + if (multipart == null) { + return outputHandle.newHandleArray(0); + } + + boolean hasEndpointState = (endpointStateHandle != null); + + int partCount = multipart.getCount(); + BufferableContentHandle[] result = outputHandle.newHandleArray(hasEndpointState ? (partCount - 1) : partCount); + for (int i=0; i < partCount; i++) { + BodyPart bodyPart = multipart.getBodyPart(i); + if (hasEndpointState && i == 0) { + updateHandle(bodyPart, endpointStateHandle); + } else { + result[hasEndpointState ? (i - 1) : i] = updateHandle(bodyPart, outputHandle.newHandle()); + } + } + + return result; + } catch (MessagingException e) { + throw new MarkLogicIOException(e); + } finally { + outputHandle.set(null); + } + } private C responsePartToContent(BufferableContentHandle handle, BodyPart bodyPart, Class as) { return handle.toContent(getEntity(bodyPart, as)); } @@ -6391,13 +6480,11 @@ public InputStreamHandle[] asArrayOfInputStreamHandle() { InputStreamHandle[] result = new InputStreamHandle[partCount]; for (int i=0; i < partCount; i++) { BodyPart bodyPart = multipart.getBodyPart(i); - result[i] = new InputStreamHandle(bodyPart.getInputStream()); + result[i] = updateHandle(bodyPart, new InputStreamHandle()); } return result; } catch (MessagingException e) { throw new MarkLogicIOException(e); - } catch (IOException e) { - throw new MarkLogicIOException(e); } } @Override @@ -6411,13 +6498,11 @@ public ReaderHandle[] asArrayOfReaderHandle() { ReaderHandle[] result = new ReaderHandle[partCount]; for (int i=0; i < partCount; i++) { BodyPart bodyPart = multipart.getBodyPart(i); - result[i] = new ReaderHandle(NodeConverter.InputStreamToReader(bodyPart.getInputStream())); + result[i] = updateHandle(bodyPart, new ReaderHandle()); } return result; } catch (MessagingException e) { throw new MarkLogicIOException(e); - } catch (IOException e) { - throw new MarkLogicIOException(e); } } @Override diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/impl/RESTServices.java b/marklogic-client-api/src/main/java/com/marklogic/client/impl/RESTServices.java index fc0c28848..491b9cda7 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/impl/RESTServices.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/impl/RESTServices.java @@ -596,6 +596,7 @@ interface CallResponse { interface SingleCallResponse extends CallResponse { byte[] asBytes(); C asContent(BufferableContentHandle outputHandle); + BufferableContentHandle asHandle(BufferableContentHandle outputHandle); InputStream asInputStream(); InputStreamHandle asInputStreamHandle(); Reader asReader(); @@ -607,6 +608,7 @@ interface SingleCallResponse extends CallResponse { interface MultipleCallResponse extends CallResponse { Stream asStreamOfBytes(); Stream asStreamOfContent(BytesHandle endpointStateHandle, BufferableContentHandle outputHandle); + Stream> asStreamOfHandles(BytesHandle endpointStateHandle, BufferableContentHandle outputHandle); Stream asStreamOfInputStream(); Stream asStreamOfInputStreamHandle(); Stream asStreamOfReader(); @@ -614,6 +616,7 @@ interface MultipleCallResponse extends CallResponse { Stream asStreamOfString(); byte[][] asArrayOfBytes(); C[] asArrayOfContent(BytesHandle endpointStateHandle, BufferableContentHandle outputHandle); + BufferableContentHandle[] asArrayOfHandles(BytesHandle endpointStateHandle, BufferableContentHandle outputHandle); InputStream[] asArrayOfInputStream(); InputStreamHandle[] asArrayOfInputStreamHandle(); Reader[] asArrayOfReader(); diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/io/BytesHandle.java b/marklogic-client-api/src/main/java/com/marklogic/client/io/BytesHandle.java index 9e806c61c..99a46742b 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/io/BytesHandle.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/io/BytesHandle.java @@ -151,6 +151,11 @@ public BytesHandle newHandle() { return new BytesHandle().withFormat(getFormat()).withMimetype(getMimetype()); } @Override + public BytesHandle[] newHandleArray(int length) { + if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); + return new BytesHandle[length]; + } + @Override public byte[][] newArray(int length) { if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); return new byte[length][]; diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/io/DOMHandle.java b/marklogic-client-api/src/main/java/com/marklogic/client/io/DOMHandle.java index d90c1f26d..8a9ce56f7 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/io/DOMHandle.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/io/DOMHandle.java @@ -157,6 +157,11 @@ public DOMHandle newHandle() { return new DOMHandle().withMimetype(getMimetype()); } @Override + public DOMHandle[] newHandleArray(int length) { + if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); + return new DOMHandle[length]; + } + @Override public Document[] newArray(int length) { if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); return new Document[length]; diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/io/FileHandle.java b/marklogic-client-api/src/main/java/com/marklogic/client/io/FileHandle.java index 55bef41d3..7da5b7278 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/io/FileHandle.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/io/FileHandle.java @@ -124,6 +124,11 @@ public FileHandle newHandle() { return new FileHandle().withFormat(getFormat()).withMimetype(getMimetype()); } @Override + public FileHandle[] newHandleArray(int length) { + if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); + return new FileHandle[length]; + } + @Override public File[] newArray(int length) { if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); return new File[length]; diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/io/InputSourceHandle.java b/marklogic-client-api/src/main/java/com/marklogic/client/io/InputSourceHandle.java index 90daad226..8de0cb3f3 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/io/InputSourceHandle.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/io/InputSourceHandle.java @@ -177,6 +177,11 @@ public InputSourceHandle newHandle() { return new InputSourceHandle().withMimetype(getMimetype()); } @Override + public InputSourceHandle[] newHandleArray(int length) { + if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); + return new InputSourceHandle[length]; + } + @Override public InputSource[] newArray(int length) { if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); return new InputSource[length]; diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/io/InputStreamHandle.java b/marklogic-client-api/src/main/java/com/marklogic/client/io/InputStreamHandle.java index ed1922abf..d47e4ca53 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/io/InputStreamHandle.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/io/InputStreamHandle.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 MarkLogic Corporation + * Copyright (c) 2021 MarkLogic Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -146,6 +146,11 @@ public InputStreamHandle newHandle() { return new InputStreamHandle().withFormat(getFormat()).withMimetype(getMimetype()); } @Override + public InputStreamHandle[] newHandleArray(int length) { + if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); + return new InputStreamHandle[length]; + } + @Override public InputStream[] newArray(int length) { if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); return new InputStream[length]; diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/io/JAXBHandle.java b/marklogic-client-api/src/main/java/com/marklogic/client/io/JAXBHandle.java index ece33dba8..d4b79dd13 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/io/JAXBHandle.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/io/JAXBHandle.java @@ -180,6 +180,11 @@ public Class getContentClass() { public JAXBHandle newHandle() { return new JAXBHandle<>(context, getContentClass()).withMimetype(getMimetype()); } + @Override + public JAXBHandle[] newHandleArray(int length) { + if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); + return new JAXBHandle[length]; + } /** * Restricts the format to XML. diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/io/JacksonDatabindHandle.java b/marklogic-client-api/src/main/java/com/marklogic/client/io/JacksonDatabindHandle.java index 87ed51fcd..a14c43bf0 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/io/JacksonDatabindHandle.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/io/JacksonDatabindHandle.java @@ -142,6 +142,11 @@ public Class getContentClass() { public JacksonDatabindHandle newHandle() { return new JacksonDatabindHandle<>(getContentClass()).withFormat(getFormat()).withMimetype(getMimetype()); } + @Override + public JacksonDatabindHandle[] newHandleArray(int length) { + if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); + return new JacksonDatabindHandle[length]; + } /** * Provides access to the ObjectMapper used internally so you can configure diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/io/JacksonHandle.java b/marklogic-client-api/src/main/java/com/marklogic/client/io/JacksonHandle.java index 43aa8040a..4fe3a2b08 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/io/JacksonHandle.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/io/JacksonHandle.java @@ -136,6 +136,11 @@ public JacksonHandle newHandle() { return new JacksonHandle().withMimetype(getMimetype()); } @Override + public JacksonHandle[] newHandleArray(int length) { + if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); + return new JacksonHandle[length]; + } + @Override public JsonNode[] newArray(int length) { if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); return new JsonNode[length]; diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/io/JacksonParserHandle.java b/marklogic-client-api/src/main/java/com/marklogic/client/io/JacksonParserHandle.java index 68cf8b4dc..0f2f3b1b8 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/io/JacksonParserHandle.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/io/JacksonParserHandle.java @@ -147,6 +147,11 @@ public JacksonParserHandle newHandle() { return new JacksonParserHandle().withMimetype(getMimetype()); } @Override + public JacksonParserHandle[] newHandleArray(int length) { + if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); + return new JacksonParserHandle[length]; + } + @Override public JsonParser[] newArray(int length) { if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); return new JsonParser[length]; diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/io/ReaderHandle.java b/marklogic-client-api/src/main/java/com/marklogic/client/io/ReaderHandle.java index f68ddddfa..1eed555fd 100755 --- a/marklogic-client-api/src/main/java/com/marklogic/client/io/ReaderHandle.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/io/ReaderHandle.java @@ -134,6 +134,11 @@ public ReaderHandle newHandle() { return new ReaderHandle().withFormat(getFormat()).withMimetype(getMimetype()); } @Override + public ReaderHandle[] newHandleArray(int length) { + if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); + return new ReaderHandle[length]; + } + @Override public Reader[] newArray(int length) { if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); return new Reader[length]; diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/io/SourceHandle.java b/marklogic-client-api/src/main/java/com/marklogic/client/io/SourceHandle.java index 513214c03..878da7bd6 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/io/SourceHandle.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/io/SourceHandle.java @@ -158,6 +158,11 @@ public SourceHandle newHandle() { return new SourceHandle().withMimetype(getMimetype()); } @Override + public SourceHandle[] newHandleArray(int length) { + if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); + return new SourceHandle[length]; + } + @Override public Source[] newArray(int length) { if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); return new Source[length]; diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/io/StringHandle.java b/marklogic-client-api/src/main/java/com/marklogic/client/io/StringHandle.java index be3654865..8cc193414 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/io/StringHandle.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/io/StringHandle.java @@ -132,6 +132,11 @@ public StringHandle newHandle() { return new StringHandle().withFormat(getFormat()).withMimetype(getMimetype()); } @Override + public StringHandle[] newHandleArray(int length) { + if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); + return new StringHandle[length]; + } + @Override public String[] newArray(int length) { if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); return new String[length]; diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/io/XMLEventReaderHandle.java b/marklogic-client-api/src/main/java/com/marklogic/client/io/XMLEventReaderHandle.java index e09110f65..76c81cf35 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/io/XMLEventReaderHandle.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/io/XMLEventReaderHandle.java @@ -158,6 +158,11 @@ public XMLEventReaderHandle newHandle() { return new XMLEventReaderHandle().withMimetype(getMimetype()); } @Override + public XMLEventReaderHandle[] newHandleArray(int length) { + if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); + return new XMLEventReaderHandle[length]; + } + @Override public XMLEventReader[] newArray(int length) { if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); return new XMLEventReader[length]; diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/io/XMLStreamReaderHandle.java b/marklogic-client-api/src/main/java/com/marklogic/client/io/XMLStreamReaderHandle.java index 72c9bdba3..9ea6892d0 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/io/XMLStreamReaderHandle.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/io/XMLStreamReaderHandle.java @@ -159,6 +159,11 @@ public XMLStreamReaderHandle newHandle() { return new XMLStreamReaderHandle().withMimetype(getMimetype()); } @Override + public XMLStreamReaderHandle[] newHandleArray(int length) { + if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); + return new XMLStreamReaderHandle[length]; + } + @Override public XMLStreamReader[] newArray(int length) { if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); return new XMLStreamReader[length]; diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/BufferableContentHandle.java b/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/BufferableContentHandle.java index faeb66a47..92845736d 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/BufferableContentHandle.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/BufferableContentHandle.java @@ -15,6 +15,8 @@ */ package com.marklogic.client.io.marker; +import java.lang.reflect.Array; + /** * A Bufferable Content Handle provides an adapter for a content * representation that can be read multiple times for purposes @@ -43,24 +45,46 @@ public interface BufferableContentHandle extends BufferableHandle, Content */ byte[] contentToBytes(C content); + @Override + BufferableContentHandle newHandle(); + + @Override + default BufferableContentHandle newHandle(C content) { + BufferableContentHandle handle = newHandle(); + handle.set(content); + return handle; + } + + /** + * Constructs an uninitialized array with the specified length with items + * of the same content representation. + * @param length the number of positions in the array + * @return the uninitialized array + */ + @SuppressWarnings("unchecked") + default BufferableContentHandle[] newHandleArray(int length) { + if (length < 0) throw new IllegalArgumentException("handle array length less than zero: "+length); + return (BufferableContentHandle[]) Array.newInstance(this.getClass(), length); + } + /** * Provides a handle that can resend the content. * @param content the content * @return the resendable handle */ - BufferableContentHandle resendableHandleFor(C content); + BufferableContentHandle resendableHandleFor(C content); + /** * Provides an array of handles that can resend an array of content. * @param content the array of content * @return the array of resendable handles */ - default BufferableContentHandle[] resendableHandleFor(C[] content) { + default BufferableContentHandle[] resendableHandleFor(C[] content) { if (content == null) return null; - BufferableContentHandle[] result = new BufferableContentHandle[content.length]; + BufferableContentHandle[] result = new BufferableContentHandle[content.length]; for (int i=0; i < content.length; i++) { result[i] = resendableHandleFor(content[i]); } return result; } - } diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/ContentHandle.java b/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/ContentHandle.java index 0a721a79c..f0163bed8 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/ContentHandle.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/ContentHandle.java @@ -110,6 +110,7 @@ default ContentHandle newHandle(C content) { * @param length the size of the array (zero or more) * @return the constructed array */ + @SuppressWarnings("unchecked") default C[] newArray(int length) { if (length < 0) throw new IllegalArgumentException("array length less than zero: "+length); return (C[]) Array.newInstance(getContentClass(), length); diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/ResendableContentHandle.java b/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/ResendableContentHandle.java index 5ecaa0069..ec6fa56ad 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/ResendableContentHandle.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/ResendableContentHandle.java @@ -24,7 +24,19 @@ */ public interface ResendableContentHandle extends BufferableContentHandle { @Override - default BufferableContentHandle resendableHandleFor(C content) { - return (BufferableContentHandle) newHandle(content); + ResendableContentHandle newHandle(); + @Override + ResendableContentHandle[] newHandleArray(int length); + + @Override + default ResendableContentHandle newHandle(C content) { + ResendableContentHandle handle = newHandle(); + handle.set(content); + return handle; + } + + @Override + default ResendableContentHandle resendableHandleFor(C content) { + return newHandle(content); } } diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/StreamingContentHandle.java b/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/StreamingContentHandle.java index 659d06ca4..861ec277e 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/StreamingContentHandle.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/io/marker/StreamingContentHandle.java @@ -29,7 +29,7 @@ */ public interface StreamingContentHandle extends BufferableContentHandle { @Override - default BufferableContentHandle resendableHandleFor(C content) { + default BufferableContentHandle resendableHandleFor(C content) { return new BytesHandle(contentToBytes(content)) .withFormat(((BaseHandle) this).getFormat()); } diff --git a/ml-development-tools/src/main/kotlin/com/marklogic/client/tools/proxy/Generator.kt b/ml-development-tools/src/main/kotlin/com/marklogic/client/tools/proxy/Generator.kt index 6420dc445..d012ae91c 100644 --- a/ml-development-tools/src/main/kotlin/com/marklogic/client/tools/proxy/Generator.kt +++ b/ml-development-tools/src/main/kotlin/com/marklogic/client/tools/proxy/Generator.kt @@ -115,6 +115,7 @@ class Generator { return mapOf( "array" to "Reader", "object" to "Reader", + "anyDocument" to "com.marklogic.client.io.InputStreamHandle", "binaryDocument" to "InputStream", "jsonDocument" to "Reader", "textDocument" to "Reader", @@ -172,6 +173,8 @@ class Generator { "java.lang.String", "com.fasterxml.jackson.databind.node.ArrayNode", "com.fasterxml.jackson.core.JsonParser"), + "anyDocument" to setOf( + "com.marklogic.client.io.InputStreamHandle"), "binaryDocument" to setOf( "java.io.InputStream"), "jsonDocument" to setOf( @@ -205,7 +208,7 @@ class Generator { return getAtomicDataTypes() + getDocumentDataTypes() } fun getAllMappings(): Map> { - return getAtomicMappings() + getDocumentMappings() + return getAtomicMappings() + getDocumentMappings().filterNot{entry -> (entry.key == "anyDocument")} } fun getJavaDataType( dataType: String, mapping: String?, dataKind: String, isMultiple: Boolean diff --git a/ml-development-tools/src/main/resources/proxy/endpointDeclarationSchema.json b/ml-development-tools/src/main/resources/proxy/endpointDeclarationSchema.json index 8dfe01c0a..46e6929a6 100644 --- a/ml-development-tools/src/main/resources/proxy/endpointDeclarationSchema.json +++ b/ml-development-tools/src/main/resources/proxy/endpointDeclarationSchema.json @@ -12,7 +12,7 @@ "boolean", "date", "dateTime", "dayTimeDuration", "decimal", "double", "float", "int", "long", "string", "time", "unsignedInt", "unsignedLong", "array", "object", - "binaryDocument", "jsonDocument", "textDocument", "xmlDocument", + "anyDocument", "binaryDocument", "jsonDocument", "textDocument", "xmlDocument", "session" ] }, diff --git a/ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/positive/AnyDocumentBundle.java b/ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/positive/AnyDocumentBundle.java new file mode 100644 index 000000000..bb86a9d95 --- /dev/null +++ b/ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/positive/AnyDocumentBundle.java @@ -0,0 +1,94 @@ +package com.marklogic.client.test.dbfunction.positive; + +// IMPORTANT: Do not edit. This file is generated. + +import java.util.stream.Stream; +import com.marklogic.client.io.Format; + + +import com.marklogic.client.DatabaseClient; +import com.marklogic.client.io.marker.JSONWriteHandle; + +import com.marklogic.client.impl.BaseProxy; + +/** + * Provides a set of operations on the database server + */ +public interface AnyDocumentBundle { + /** + * Creates a AnyDocumentBundle object for executing operations on the database server. + * + * The DatabaseClientFactory class can create the DatabaseClient parameter. A single + * client object can be used for any number of requests and in multiple threads. + * + * @param db provides a client for communicating with the database server + * @return an object for executing database operations + */ + static AnyDocumentBundle on(DatabaseClient db) { + return on(db, null); + } + /** + * Creates a AnyDocumentBundle object for executing operations on the database server. + * + * The DatabaseClientFactory class can create the DatabaseClient parameter. A single + * client object can be used for any number of requests and in multiple threads. + * + * The service declaration uses a custom implementation of the same service instead + * of the default implementation of the service by specifying an endpoint directory + * in the modules database with the implementation. A service.json file with the + * declaration can be read with FileHandle or a string serialization of the JSON + * declaration with StringHandle. + * + * @param db provides a client for communicating with the database server + * @param serviceDeclaration substitutes a custom implementation of the service + * @return an object for executing database operations + */ + static AnyDocumentBundle on(DatabaseClient db, JSONWriteHandle serviceDeclaration) { + final class AnyDocumentBundleImpl implements AnyDocumentBundle { + private DatabaseClient dbClient; + private BaseProxy baseProxy; + + private BaseProxy.DBFunctionRequest req_sendReceiveDocs; + + private AnyDocumentBundleImpl(DatabaseClient dbClient, JSONWriteHandle servDecl) { + this.dbClient = dbClient; + this.baseProxy = new BaseProxy("/dbf/test/anyDocument/", servDecl); + + this.req_sendReceiveDocs = this.baseProxy.request( + "sendReceiveDocs.sjs", BaseProxy.ParameterValuesKind.MULTIPLE_MIXED); + } + + @Override + public Stream sendReceiveDocs(Stream uris, Stream docs) { + return sendReceiveDocs( + this.req_sendReceiveDocs.on(this.dbClient), uris, docs + ); + } + private Stream sendReceiveDocs(BaseProxy.DBFunctionRequest request, Stream uris, Stream docs) { +/* TODO: revise to take sample handle for output and call asStreamOfHandles(endpointStateHandle, outputHandle) + return BaseProxy.AnyDocumentType.toInputStreamHandle( + request + .withParams( + BaseProxy.atomicParam("uris", true, BaseProxy.StringType.fromString(uris)), + BaseProxy.documentParam("docs", true, docs) + ).responseMultiple(true, Format.UNKNOWN) + ); + + */ + return null; + } + } + + return new AnyDocumentBundleImpl(db, serviceDeclaration); + } + + /** + * Invokes the sendReceiveDocs operation on the database server + * + * @param uris provides input + * @param docs provides input + * @return as output + */ + Stream sendReceiveDocs(Stream uris, Stream docs); + +} diff --git a/ml-development-tools/src/test/kotlin/com/marklogic/client/test/dbfunction/fntestgen.kt b/ml-development-tools/src/test/kotlin/com/marklogic/client/test/dbfunction/fntestgen.kt index 931650db4..7176b9a1f 100644 --- a/ml-development-tools/src/test/kotlin/com/marklogic/client/test/dbfunction/fntestgen.kt +++ b/ml-development-tools/src/test/kotlin/com/marklogic/client/test/dbfunction/fntestgen.kt @@ -36,7 +36,7 @@ const val TEST_PACKAGE = "com.marklogic.client.test.dbfunction.generated" val generator = Generator() val atomicMap = generator.getAtomicDataTypes() -val documentMap = generator.getDocumentDataTypes() +val documentMap = generator.getDocumentDataTypes().filterNot{entry -> (entry.key == "anyDocument")} val mapper = jacksonObjectMapper() val serializer = mapper.writerWithDefaultPrettyPrinter() @@ -1604,7 +1604,7 @@ if (true) { val testList = when (testType) { "negative" -> listOf("badExecution") - "positive" -> listOf("decoratorBase", "decoratorCustom", "described", "mimetype", "sessions") + "positive" -> listOf("anyDocument", "decoratorBase", "decoratorCustom", "described", "mimetype", "sessions") else -> throw IllegalStateException("Unknown test type of $testType") } for (testName in testList) { diff --git a/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveDocs.api b/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveDocs.api new file mode 100644 index 000000000..905465209 --- /dev/null +++ b/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveDocs.api @@ -0,0 +1,19 @@ +{ + "functionName": "sendReceiveDocs", + "params": [ { + "name": "uris", + "datatype": "string", + "multiple": true, + "nullable": true + }, { + "name": "docs", + "datatype": "anyDocument", + "multiple": true, + "nullable": true + } ], + "return": { + "datatype": "anyDocument", + "multiple": true, + "nullable": true + } +} \ No newline at end of file diff --git a/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveDocs.sjs b/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveDocs.sjs new file mode 100644 index 000000000..2ccb75162 --- /dev/null +++ b/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveDocs.sjs @@ -0,0 +1,8 @@ +'use strict'; +var uris; +var docs; + +// could write to the database at this point... + +// instead, just return the documents in the same order for inspection on the client +docs; diff --git a/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/service.json b/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/service.json new file mode 100644 index 000000000..fdceb4594 --- /dev/null +++ b/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/service.json @@ -0,0 +1,4 @@ +{ + "endpointDirectory" : "/dbf/test/anyDocument/", + "$javaClass" : "com.marklogic.client.test.dbfunction.positive.AnyDocumentBundle" +} \ No newline at end of file From 55d5613c2f93a1aac98aa645fe07a195cf834f65 Mon Sep 17 00:00:00 2001 From: ehennum Date: Fri, 25 Jun 2021 08:50:52 -0700 Subject: [PATCH 10/12] #1294 generics for streaming handles --- .../marklogic/client/impl/OkHttpServices.java | 8 ++++---- .../marklogic/client/impl/RESTServices.java | 6 ++++-- .../positive/AnyDocumentBundle.java | 20 +++++++++---------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/impl/OkHttpServices.java b/marklogic-client-api/src/main/java/com/marklogic/client/impl/OkHttpServices.java index 3d697abfe..9318499b1 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/impl/OkHttpServices.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/impl/OkHttpServices.java @@ -6240,8 +6240,8 @@ public Stream asStreamOfContent( } } @Override - public Stream> asStreamOfHandles( - BytesHandle endpointStateHandle, BufferableContentHandle outputHandle + public > Stream asStreamOfHandles( + BytesHandle endpointStateHandle, T outputHandle ) { try { if (multipart == null) { @@ -6250,7 +6250,7 @@ public Stream> asStreamOfHandles( boolean hasEndpointState = (endpointStateHandle != null); - Stream.Builder> builder = Stream.builder(); + Stream.Builder builder = Stream.builder(); int partCount = multipart.getCount(); for (int i=0; i < partCount; i++) { @@ -6258,7 +6258,7 @@ public Stream> asStreamOfHandles( if (hasEndpointState && i == 0) { updateHandle(bodyPart, endpointStateHandle); } else { - builder.accept(updateHandle(bodyPart, outputHandle.newHandle())); + builder.accept(updateHandle(bodyPart, (T) outputHandle.newHandle())); } } return builder.build(); diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/impl/RESTServices.java b/marklogic-client-api/src/main/java/com/marklogic/client/impl/RESTServices.java index 491b9cda7..fce13de5e 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/impl/RESTServices.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/impl/RESTServices.java @@ -608,7 +608,8 @@ interface SingleCallResponse extends CallResponse { interface MultipleCallResponse extends CallResponse { Stream asStreamOfBytes(); Stream asStreamOfContent(BytesHandle endpointStateHandle, BufferableContentHandle outputHandle); - Stream> asStreamOfHandles(BytesHandle endpointStateHandle, BufferableContentHandle outputHandle); + > Stream + asStreamOfHandles(BytesHandle endpointStateHandle, T outputHandle); Stream asStreamOfInputStream(); Stream asStreamOfInputStreamHandle(); Stream asStreamOfReader(); @@ -616,7 +617,8 @@ interface MultipleCallResponse extends CallResponse { Stream asStreamOfString(); byte[][] asArrayOfBytes(); C[] asArrayOfContent(BytesHandle endpointStateHandle, BufferableContentHandle outputHandle); - BufferableContentHandle[] asArrayOfHandles(BytesHandle endpointStateHandle, BufferableContentHandle outputHandle); + BufferableContentHandle[] + asArrayOfHandles(BytesHandle endpointStateHandle, BufferableContentHandle outputHandle); InputStream[] asArrayOfInputStream(); InputStreamHandle[] asArrayOfInputStreamHandle(); Reader[] asArrayOfReader(); diff --git a/ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/positive/AnyDocumentBundle.java b/ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/positive/AnyDocumentBundle.java index bb86a9d95..b52d57ed8 100644 --- a/ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/positive/AnyDocumentBundle.java +++ b/ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/positive/AnyDocumentBundle.java @@ -65,17 +65,17 @@ public Stream sendReceiveDocs(Stream< ); } private Stream sendReceiveDocs(BaseProxy.DBFunctionRequest request, Stream uris, Stream docs) { -/* TODO: revise to take sample handle for output and call asStreamOfHandles(endpointStateHandle, outputHandle) - return BaseProxy.AnyDocumentType.toInputStreamHandle( - request - .withParams( - BaseProxy.atomicParam("uris", true, BaseProxy.StringType.fromString(uris)), - BaseProxy.documentParam("docs", true, docs) - ).responseMultiple(true, Format.UNKNOWN) - ); - +/* TODO: + generate code that + instead of wrapping with BaseProxy.AnyDocumentType.toInputStreamHandle() + calls .asStreamOfHandles() */ - return null; + return request + .withParams( + BaseProxy.atomicParam("uris", true, BaseProxy.StringType.fromString(uris)), + BaseProxy.documentParam("docs", true, docs) + ).responseMultiple(true, Format.UNKNOWN) + .asStreamOfHandles(null, new com.marklogic.client.io.InputStreamHandle()); } } From 9b96fe023d30bfab52389cbb0cc13bf301976d41 Mon Sep 17 00:00:00 2001 From: ehennum Date: Wed, 30 Jun 2021 11:44:50 -0700 Subject: [PATCH 11/12] #1296 anyDocument unit tests and fixes --- .../marklogic/client/impl/OkHttpServices.java | 47 ++-- .../marklogic/client/impl/RESTServices.java | 2 +- .../marklogic/client/tools/proxy/Generator.kt | 51 ++-- .../positive/AnyDocumentBundle.java | 116 ++++++++-- .../positive/AnyDocumentBundleTest.java | 219 ++++++++++++++++++ ...ReceiveDocs.api => sendReceiveAnyDocs.api} | 2 +- ...ReceiveDocs.sjs => sendReceiveAnyDocs.sjs} | 0 .../anyDocument/sendReceiveManyDocs.api | 19 ++ .../anyDocument/sendReceiveManyDocs.sjs | 8 + .../anyDocument/sendReceiveOptionalDoc.api | 19 ++ .../anyDocument/sendReceiveOptionalDoc.sjs | 8 + .../anyDocument/sendReceiveRequiredDoc.api | 19 ++ .../anyDocument/sendReceiveRequiredDoc.sjs | 8 + 13 files changed, 459 insertions(+), 59 deletions(-) create mode 100644 ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/positive/AnyDocumentBundleTest.java rename ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/{sendReceiveDocs.api => sendReceiveAnyDocs.api} (89%) rename ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/{sendReceiveDocs.sjs => sendReceiveAnyDocs.sjs} (100%) create mode 100644 ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveManyDocs.api create mode 100644 ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveManyDocs.sjs create mode 100644 ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveOptionalDoc.api create mode 100644 ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveOptionalDoc.sjs create mode 100644 ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveRequiredDoc.api create mode 100644 ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveRequiredDoc.sjs diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/impl/OkHttpServices.java b/marklogic-client-api/src/main/java/com/marklogic/client/impl/OkHttpServices.java index 9318499b1..ee6e7b369 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/impl/OkHttpServices.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/impl/OkHttpServices.java @@ -1908,9 +1908,13 @@ static private void updateFormat(ContentDescriptor descriptor, Format format) { static private Format getHeaderFormat(Headers headers) { String format = headers.get(HEADER_VND_MARKLOGIC_DOCUMENT_FORMAT); - if (format != null) { + if (format != null && format.length() > 0) { return Format.valueOf(format.toUpperCase()); } + String contentType = headers.get(HEADER_CONTENT_TYPE); + if (contentType != null && contentType.length() > 0) { + return Format.getFromMimetype(contentType); + } return null; } @@ -5849,9 +5853,10 @@ private RequestBody makeRequestBody(CallField[] params) { if (paramValues != null) { paramValues .filter(paramValue -> paramValue != null) - .forEachOrdered(paramValue -> - multiBldr.addFormDataPart(paramName, null, makeRequestBody(paramValue)) - ); + .forEachOrdered(paramValue -> { + hasValue.set(); + multiBldr.addFormDataPart(paramName, null, makeRequestBody(paramValue)); + }); } } else if (param instanceof SingleNodeCallField) { SingleNodeCallField singleNodeParam = (SingleNodeCallField) param; @@ -6087,7 +6092,7 @@ public C asContent(BufferableContentHandle outputHandle) { return content; } @Override - public BufferableContentHandle asHandle(BufferableContentHandle outputHandle) { + public > T asHandle(T outputHandle) { if (responseBody == null) return null; return updateHandle(getResponse().headers(), responseBody, outputHandle); @@ -6559,12 +6564,14 @@ static protected boolean checkNull(ResponseBody body, Format expectedFormat) { "Returned document with unknown mime type instead of "+expectedFormat.getDefaultMimetype() ); } - Format actualFormat = Format.getFromMimetype(actualType.toString()); - if (expectedFormat != actualFormat) { - body.close(); - throw new RuntimeException( - "Mime type "+actualType.toString()+" for returned document not recognized for "+expectedFormat.name() - ); + if (expectedFormat != Format.UNKNOWN) { + Format actualFormat = Format.getFromMimetype(actualType.toString()); + if (expectedFormat != actualFormat) { + body.close(); + throw new RuntimeException( + "Mime type "+actualType.toString()+" for returned document not recognized for "+expectedFormat.name() + ); + } } return false; } @@ -6582,11 +6589,13 @@ static protected boolean checkNull(MimeMultipart multipart, Format expectedForma "Returned document with unknown mime type instead of "+expectedFormat.getDefaultMimetype() ); } - Format actualFormat = Format.getFromMimetype(actualType); - if (expectedFormat != actualFormat) { - throw new RuntimeException( - "Mime type "+actualType+" for returned document not recognized for "+expectedFormat.name() - ); + if (expectedFormat != Format.UNKNOWN) { + Format actualFormat = Format.getFromMimetype(actualType); + if (expectedFormat != actualFormat) { + throw new RuntimeException( + "Mime type "+actualType+" for returned document not recognized for "+expectedFormat.name() + ); + } } return false; } @@ -6603,8 +6612,10 @@ static private void closeResponse(Response response) { } Request.Builder forDocumentResponse(Request.Builder requestBldr, Format format) { - return requestBldr.addHeader(HEADER_ACCEPT, (format == null || format == Format.BINARY) ? - "application/x-unknown-content-type" : format.getDefaultMimetype()); + return requestBldr.addHeader( + HEADER_ACCEPT, + (format == null || format == Format.BINARY || format == Format.UNKNOWN) ? + "application/x-unknown-content-type" : format.getDefaultMimetype()); } Request.Builder forMultipartMixedResponse(Request.Builder requestBldr) { diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/impl/RESTServices.java b/marklogic-client-api/src/main/java/com/marklogic/client/impl/RESTServices.java index fce13de5e..1a3714d3e 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/impl/RESTServices.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/impl/RESTServices.java @@ -596,7 +596,7 @@ interface CallResponse { interface SingleCallResponse extends CallResponse { byte[] asBytes(); C asContent(BufferableContentHandle outputHandle); - BufferableContentHandle asHandle(BufferableContentHandle outputHandle); + > T asHandle(T outputHandle); InputStream asInputStream(); InputStreamHandle asInputStreamHandle(); Reader asReader(); diff --git a/ml-development-tools/src/main/kotlin/com/marklogic/client/tools/proxy/Generator.kt b/ml-development-tools/src/main/kotlin/com/marklogic/client/tools/proxy/Generator.kt index d012ae91c..ffc7916c2 100644 --- a/ml-development-tools/src/main/kotlin/com/marklogic/client/tools/proxy/Generator.kt +++ b/ml-development-tools/src/main/kotlin/com/marklogic/client/tools/proxy/Generator.kt @@ -645,26 +645,36 @@ ${funcDecls} """)} )""" - val returnConverter = - if (returnType === null || returnMapped === null) - "" - else + val returnFormat = + if (returnType === null || returnKind != "document") "null" + else typeFormat(returnType) + val returnChained = + if (returnKind === null) """.responseNone()""" + else if (returnMultiple == true) """.responseMultiple(${returnNullable}, ${returnFormat})""" + else """.responseSingle(${returnNullable}, ${returnFormat})""" + + val callImpl = """request${sessionFluent}${paramsFluent}${returnChained}""" + +// TODO: also array support? + val bodyImpl = + if (returnType === null || returnMapped === null) { + """${callImpl};""" + } else if (returnType == "anyDocument") { + """return ${callImpl} + ${ + if (returnMultiple) """.asStreamOfHandles(null, new ${returnMapped}())""" + else """.asHandle(new ${returnMapped}())""" + };""" + } else { """return BaseProxy.${typeConverter(returnType)}.to${ if (returnMapped.contains(".")) returnMapped.substringAfterLast(".").capitalize() else returnMapped.capitalize() }( - """ - val returnFormat = - if (returnType === null || returnKind != "document") "null" - else typeFormat(returnType) - val returnChained = - if (returnKind === null) """.responseNone()""" - else if (returnMultiple == true) """.responseMultiple(${returnNullable}, ${returnFormat}) - )""" - else """.responseSingle(${returnNullable}, ${returnFormat}) - )""" + ${callImpl} + );""" + } val fieldReturn = if (returnType === null) "" @@ -710,8 +720,7 @@ ${funcDecls} ); } private ${sigImpl} { - ${returnConverter - }request${sessionFluent}${paramsFluent}${returnChained}; + ${bodyImpl} }""" return defSource } @@ -797,13 +806,16 @@ ${funcDecls} return methods } fun paramConverter(paramName: String, paramKind: String, paramType: String, mappedType: String, isNullable: Boolean) : String { - val converter = - """BaseProxy.${paramKind}Param("${paramName}", ${isNullable}, BaseProxy.${typeConverter(paramType)}.from${ + val convertExpr = + if (paramType == "anyDocument") paramName + else """BaseProxy.${typeConverter(paramType)}.from${ if (mappedType.contains(".")) mappedType.substringAfterLast(".").capitalize() else mappedType.capitalize() - }(${paramName}))""" + }(${paramName})""" + val converter = + """BaseProxy.${paramKind}Param("${paramName}", ${isNullable}, ${convertExpr})""" return converter } fun typeConverter(datatype: String) : String { @@ -816,6 +828,7 @@ ${funcDecls} fun typeFormat(documentType: String) : String { val format = if (documentType == "array" || documentType == "object") "Format.JSON" + else if (documentType == "anyDocument") "Format.UNKNOWN" else "Format."+documentType.substringBefore("Document").toUpperCase() return format } diff --git a/ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/positive/AnyDocumentBundle.java b/ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/positive/AnyDocumentBundle.java index b52d57ed8..ed9576c2b 100644 --- a/ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/positive/AnyDocumentBundle.java +++ b/ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/positive/AnyDocumentBundle.java @@ -48,34 +48,83 @@ final class AnyDocumentBundleImpl implements AnyDocumentBundle { private DatabaseClient dbClient; private BaseProxy baseProxy; - private BaseProxy.DBFunctionRequest req_sendReceiveDocs; + private BaseProxy.DBFunctionRequest req_sendReceiveManyDocs; + private BaseProxy.DBFunctionRequest req_sendReceiveRequiredDoc; + private BaseProxy.DBFunctionRequest req_sendReceiveOptionalDoc; + private BaseProxy.DBFunctionRequest req_sendReceiveAnyDocs; private AnyDocumentBundleImpl(DatabaseClient dbClient, JSONWriteHandle servDecl) { this.dbClient = dbClient; this.baseProxy = new BaseProxy("/dbf/test/anyDocument/", servDecl); - this.req_sendReceiveDocs = this.baseProxy.request( - "sendReceiveDocs.sjs", BaseProxy.ParameterValuesKind.MULTIPLE_MIXED); + this.req_sendReceiveManyDocs = this.baseProxy.request( + "sendReceiveManyDocs.sjs", BaseProxy.ParameterValuesKind.MULTIPLE_MIXED); + this.req_sendReceiveRequiredDoc = this.baseProxy.request( + "sendReceiveRequiredDoc.sjs", BaseProxy.ParameterValuesKind.MULTIPLE_MIXED); + this.req_sendReceiveOptionalDoc = this.baseProxy.request( + "sendReceiveOptionalDoc.sjs", BaseProxy.ParameterValuesKind.MULTIPLE_MIXED); + this.req_sendReceiveAnyDocs = this.baseProxy.request( + "sendReceiveAnyDocs.sjs", BaseProxy.ParameterValuesKind.MULTIPLE_MIXED); } @Override - public Stream sendReceiveDocs(Stream uris, Stream docs) { - return sendReceiveDocs( - this.req_sendReceiveDocs.on(this.dbClient), uris, docs + public Stream sendReceiveManyDocs(Stream uris, Stream docs) { + return sendReceiveManyDocs( + this.req_sendReceiveManyDocs.on(this.dbClient), uris, docs ); } - private Stream sendReceiveDocs(BaseProxy.DBFunctionRequest request, Stream uris, Stream docs) { -/* TODO: - generate code that - instead of wrapping with BaseProxy.AnyDocumentType.toInputStreamHandle() - calls .asStreamOfHandles() - */ - return request - .withParams( - BaseProxy.atomicParam("uris", true, BaseProxy.StringType.fromString(uris)), - BaseProxy.documentParam("docs", true, docs) - ).responseMultiple(true, Format.UNKNOWN) - .asStreamOfHandles(null, new com.marklogic.client.io.InputStreamHandle()); + private Stream sendReceiveManyDocs(BaseProxy.DBFunctionRequest request, Stream uris, Stream docs) { + return request + .withParams( + BaseProxy.atomicParam("uris", false, BaseProxy.StringType.fromString(uris)), + BaseProxy.documentParam("docs", false, docs) + ).responseMultiple(false, Format.UNKNOWN) + .asStreamOfHandles(null, new com.marklogic.client.io.InputStreamHandle()); + } + + @Override + public com.marklogic.client.io.InputStreamHandle sendReceiveRequiredDoc(String uri, com.marklogic.client.io.InputStreamHandle doc) { + return sendReceiveRequiredDoc( + this.req_sendReceiveRequiredDoc.on(this.dbClient), uri, doc + ); + } + private com.marklogic.client.io.InputStreamHandle sendReceiveRequiredDoc(BaseProxy.DBFunctionRequest request, String uri, com.marklogic.client.io.InputStreamHandle doc) { + return request + .withParams( + BaseProxy.atomicParam("uri", false, BaseProxy.StringType.fromString(uri)), + BaseProxy.documentParam("doc", false, doc) + ).responseSingle(false, Format.UNKNOWN) + .asHandle(new com.marklogic.client.io.InputStreamHandle()); + } + + @Override + public com.marklogic.client.io.InputStreamHandle sendReceiveOptionalDoc(String uri, com.marklogic.client.io.InputStreamHandle doc) { + return sendReceiveOptionalDoc( + this.req_sendReceiveOptionalDoc.on(this.dbClient), uri, doc + ); + } + private com.marklogic.client.io.InputStreamHandle sendReceiveOptionalDoc(BaseProxy.DBFunctionRequest request, String uri, com.marklogic.client.io.InputStreamHandle doc) { + return request + .withParams( + BaseProxy.atomicParam("uri", true, BaseProxy.StringType.fromString(uri)), + BaseProxy.documentParam("doc", true, doc) + ).responseSingle(true, Format.UNKNOWN) + .asHandle(new com.marklogic.client.io.InputStreamHandle()); + } + + @Override + public Stream sendReceiveAnyDocs(Stream uris, Stream docs) { + return sendReceiveAnyDocs( + this.req_sendReceiveAnyDocs.on(this.dbClient), uris, docs + ); + } + private Stream sendReceiveAnyDocs(BaseProxy.DBFunctionRequest request, Stream uris, Stream docs) { + return request + .withParams( + BaseProxy.atomicParam("uris", true, BaseProxy.StringType.fromString(uris)), + BaseProxy.documentParam("docs", true, docs) + ).responseMultiple(true, Format.UNKNOWN) + .asStreamOfHandles(null, new com.marklogic.client.io.InputStreamHandle()); } } @@ -83,12 +132,39 @@ private Stream sendReceiveDocs(BasePr } /** - * Invokes the sendReceiveDocs operation on the database server + * Invokes the sendReceiveManyDocs operation on the database server + * + * @param uris provides input + * @param docs provides input + * @return as output + */ + Stream sendReceiveManyDocs(Stream uris, Stream docs); + + /** + * Invokes the sendReceiveRequiredDoc operation on the database server + * + * @param uri provides input + * @param doc provides input + * @return as output + */ + com.marklogic.client.io.InputStreamHandle sendReceiveRequiredDoc(String uri, com.marklogic.client.io.InputStreamHandle doc); + + /** + * Invokes the sendReceiveOptionalDoc operation on the database server + * + * @param uri provides input + * @param doc provides input + * @return as output + */ + com.marklogic.client.io.InputStreamHandle sendReceiveOptionalDoc(String uri, com.marklogic.client.io.InputStreamHandle doc); + + /** + * Invokes the sendReceiveAnyDocs operation on the database server * * @param uris provides input * @param docs provides input * @return as output */ - Stream sendReceiveDocs(Stream uris, Stream docs); + Stream sendReceiveAnyDocs(Stream uris, Stream docs); } diff --git a/ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/positive/AnyDocumentBundleTest.java b/ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/positive/AnyDocumentBundleTest.java new file mode 100644 index 000000000..bf091d943 --- /dev/null +++ b/ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/positive/AnyDocumentBundleTest.java @@ -0,0 +1,219 @@ +/* + * Copyright (c) 2019 MarkLogic Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.marklogic.client.test.dbfunction.positive; + +import com.marklogic.client.FailedRequestException; +import com.marklogic.client.impl.BaseProxy; +import com.marklogic.client.io.Format; +import com.marklogic.client.io.InputStreamHandle; +import com.marklogic.client.test.dbfunction.DBFunctionTestUtil; +import org.junit.Test; + +import java.io.IOException; +import java.util.function.BiFunction; +import java.util.stream.Stream; + +import static org.junit.Assert.*; + +public class AnyDocumentBundleTest { + final static private String[] uris = {"/test/anyDocument1.json", "/test/anyDocument1.xml"}; + final static private Format[] formats = {Format.JSON, Format.XML}; + // docs must align with the formats array + final static private String[] docs = { + "{\"key1\":\"value1\"}", + "\ntext1" + }; + final static private AnyDocumentBundle testObj = AnyDocumentBundle.on(DBFunctionTestUtil.db); + +/* TODO: + positive test: + mapped StringHandle + negative test: + mapped to a class that's not a handle for single or multiple param or return value + */ + + @Test + public void sendReceiveOptionalJSONDocTest() throws IOException { + testDocImpl(uris[0], Format.JSON, docs[0], testObj::sendReceiveOptionalDoc); + } + @Test + public void sendReceiveOptionalXMLDocTest() throws IOException { + testDocImpl(uris[1], Format.XML, docs[1], testObj::sendReceiveOptionalDoc); + } + @Test + public void sendReceiveRequiredJSONDocTest() throws IOException { + testDocImpl(uris[0], Format.JSON, docs[0], testObj::sendReceiveRequiredDoc); + } + @Test + public void sendReceiveRequiredXMLDocTest() throws IOException { + testDocImpl(uris[1], Format.XML, docs[1], testObj::sendReceiveRequiredDoc); + } + @Test + public void sendReceiveOptionalNullUriTest() throws IOException { + // send null uri with non-null handle to optional endpoint + testDocImpl(null, Format.JSON, docs[0], testObj::sendReceiveOptionalDoc); + } + @Test + public void sendReceiveOptionalNullDocTest() throws IOException { + // send non-null uri with null handle to optional endpoint + testDocImpl(uris[0], null, null, testObj::sendReceiveOptionalDoc); + } + @Test + public void sendReceiveOptionalNullUriDocTest() throws IOException { + // send null uri and null handle to optional endpoint + testDocImpl(null, null, null, testObj::sendReceiveOptionalDoc); + } + @Test + public void sendReceiveRequiredNullDocTest() throws IOException { + // negative test: send non-null uri with null handle to required endpoint + try { + testDocImpl(uris[0], null, null, testObj::sendReceiveRequiredDoc); + fail("no exception for required parameter with null value"); + } catch(BaseProxy.RequiredParamException e) { + assertEquals("null value for required parameter: doc", e.getMessage()); + } + } + @Test + public void sendReceiveOptionalInvalidFormatDocTest() throws IOException { + // negative test: send handle with invalid format + try { + testDocImpl(uris[0], formats[1], docs[0], testObj::sendReceiveOptionalDoc); + fail("no exception for invalid format"); + } catch(FailedRequestException e) { + assertEquals(400, e.getServerStatusCode()); + assertEquals("XDMP-DOCROOTTEXT", e.getServerMessageCode()); + } + } + + @Test + public void sendReceiveAnyTwoDocsTest() throws IOException { + testDocsImpl(uris, formats, docs, testObj::sendReceiveAnyDocs); + } + @Test + public void sendReceiveAnyOneJSONDocTest() throws IOException { + testDocsImpl(uris[0], formats[0], docs[0], testObj::sendReceiveAnyDocs); + } + @Test + public void sendReceiveAnyOneXMLDocTest() throws IOException { + testDocsImpl(uris[1], formats[1], docs[1], testObj::sendReceiveAnyDocs); + } + @Test + public void sendReceiveManyTwoDocsTest() throws IOException { + testDocsImpl(uris, formats, docs, testObj::sendReceiveManyDocs); + } + @Test + public void sendReceiveManyOneJSONDocTest() throws IOException { + testDocsImpl(uris[0], formats[0], docs[0], testObj::sendReceiveManyDocs); + } + @Test + public void sendReceiveManyOneXMLDocTest() throws IOException { + testDocsImpl(uris[1], formats[1], docs[1], testObj::sendReceiveManyDocs); + } + @Test + public void sendReceiveAnyNullUrisTest() throws IOException { + testDocsImpl(null, formats, docs, testObj::sendReceiveAnyDocs); + } + @Test + public void sendReceiveAnyNullDocsTest() throws IOException { + testDocsImpl(uris, null, null, testObj::sendReceiveAnyDocs); + } + @Test + public void sendReceiveAnyNullUrisDocsTest() throws IOException { + testDocsImpl(null, (Format[]) null, null, testObj::sendReceiveAnyDocs); + } + @Test + public void sendReceiveManyNullDocsTest() throws IOException { + try { + testDocsImpl(uris, null, null, testObj::sendReceiveManyDocs); + fail("no exception for required parameter with null value"); + } catch(FailedRequestException e) { + assertEquals(400, e.getServerStatusCode()); + assertEquals("XDMP-ENDPOINTNULLABLE", e.getServerMessageCode()); + assertTrue(e.getServerMessage().contains(" docs ") && e.getServerMessage().contains(" parameter ")); + } + } + @Test + public void sendReceiveAnyInvalidFormatDocsTest() throws IOException { + // negative test: send handle with invalid format + try { + testDocsImpl(uris[1], formats[0], docs[1], testObj::sendReceiveAnyDocs); + fail("no exception for invalid format"); + } catch(FailedRequestException e) { + assertEquals(400, e.getServerStatusCode()); + assertEquals("XDMP-JSONDOC", e.getServerMessageCode()); + } + } + + private void testDocImpl(String uri, Format format, String doc, BiFunction caller) { + InputStreamHandle inputHandle = null; + if (doc != null) { + inputHandle = new InputStreamHandle(); + if (format != null) { + inputHandle.setFormat(format); + } + inputHandle.fromBuffer(doc.getBytes()); + } + + InputStreamHandle outputHandle = caller.apply(uri, inputHandle); + + if (doc != null) { + assertEquals(format, outputHandle.getFormat()); + assertEquals(doc, new String(outputHandle.toBuffer()).trim()); + } else { + assertNull(outputHandle); + } + } + + private void testDocsImpl( + String uri, Format format, String doc, BiFunction,Stream,Stream> caller + ) { + testDocsImpl(new String[]{uri}, new Format[]{format}, new String[]{doc}, caller); + } + private void testDocsImpl( + String[] uris, Format[] formats, String[] docs, BiFunction,Stream,Stream> caller + ) { + Stream uriStream = (uris == null || uris.length == 0) ? Stream.empty() : Stream.of(uris); + + Stream inputHandleStream; + if (docs == null || docs.length == 0) { + inputHandleStream = Stream.empty(); + } else { + InputStreamHandle[] inputHandles = new InputStreamHandle[docs.length]; + for (int i=0; i < docs.length; i++) { + InputStreamHandle inputHandle = new InputStreamHandle(); + if (formats != null && i < formats.length) { + inputHandle.setFormat(formats[i]); + } + inputHandle.fromBuffer(docs[i].getBytes()); + inputHandles[i] = inputHandle; + } + inputHandleStream = Stream.of(inputHandles); + } + + Stream outputStream = caller.apply(uriStream, inputHandleStream); + + InputStreamHandle[] outputHandles = outputStream.toArray(InputStreamHandle[]::new); + if (docs == null || docs.length == 0) { + assertEquals(0, outputHandles.length); + } else { + assertEquals(docs.length, outputHandles.length); + for (int i=0; i < docs.length; i++) { + assertEquals(formats[i], outputHandles[i].getFormat()); + assertEquals(docs[i], new String(outputHandles[i].toBuffer()).trim()); + } + } + } +} diff --git a/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveDocs.api b/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveAnyDocs.api similarity index 89% rename from ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveDocs.api rename to ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveAnyDocs.api index 905465209..b6d4d871d 100644 --- a/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveDocs.api +++ b/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveAnyDocs.api @@ -1,5 +1,5 @@ { - "functionName": "sendReceiveDocs", + "functionName": "sendReceiveAnyDocs", "params": [ { "name": "uris", "datatype": "string", diff --git a/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveDocs.sjs b/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveAnyDocs.sjs similarity index 100% rename from ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveDocs.sjs rename to ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveAnyDocs.sjs diff --git a/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveManyDocs.api b/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveManyDocs.api new file mode 100644 index 000000000..b05b50d2d --- /dev/null +++ b/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveManyDocs.api @@ -0,0 +1,19 @@ +{ + "functionName": "sendReceiveManyDocs", + "params": [ { + "name": "uris", + "datatype": "string", + "multiple": true, + "nullable": false + }, { + "name": "docs", + "datatype": "anyDocument", + "multiple": true, + "nullable": false + } ], + "return": { + "datatype": "anyDocument", + "multiple": true, + "nullable": false + } +} \ No newline at end of file diff --git a/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveManyDocs.sjs b/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveManyDocs.sjs new file mode 100644 index 000000000..2ccb75162 --- /dev/null +++ b/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveManyDocs.sjs @@ -0,0 +1,8 @@ +'use strict'; +var uris; +var docs; + +// could write to the database at this point... + +// instead, just return the documents in the same order for inspection on the client +docs; diff --git a/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveOptionalDoc.api b/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveOptionalDoc.api new file mode 100644 index 000000000..246549d68 --- /dev/null +++ b/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveOptionalDoc.api @@ -0,0 +1,19 @@ +{ + "functionName": "sendReceiveOptionalDoc", + "params": [ { + "name": "uri", + "datatype": "string", + "multiple": false, + "nullable": true + }, { + "name": "doc", + "datatype": "anyDocument", + "multiple": false, + "nullable": true + } ], + "return": { + "datatype": "anyDocument", + "multiple": false, + "nullable": true + } +} \ No newline at end of file diff --git a/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveOptionalDoc.sjs b/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveOptionalDoc.sjs new file mode 100644 index 000000000..ac1c5dd34 --- /dev/null +++ b/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveOptionalDoc.sjs @@ -0,0 +1,8 @@ +'use strict'; +var uri; +var doc; + +// could write to the database at this point... + +// instead, just return the documents in the same order for inspection on the client +doc; diff --git a/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveRequiredDoc.api b/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveRequiredDoc.api new file mode 100644 index 000000000..2045ac7db --- /dev/null +++ b/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveRequiredDoc.api @@ -0,0 +1,19 @@ +{ + "functionName": "sendReceiveRequiredDoc", + "params": [ { + "name": "uri", + "datatype": "string", + "multiple": false, + "nullable": false + }, { + "name": "doc", + "datatype": "anyDocument", + "multiple": false, + "nullable": false + } ], + "return": { + "datatype": "anyDocument", + "multiple": false, + "nullable": false + } +} \ No newline at end of file diff --git a/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveRequiredDoc.sjs b/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveRequiredDoc.sjs new file mode 100644 index 000000000..ac1c5dd34 --- /dev/null +++ b/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveRequiredDoc.sjs @@ -0,0 +1,8 @@ +'use strict'; +var uri; +var doc; + +// could write to the database at this point... + +// instead, just return the documents in the same order for inspection on the client +doc; From a991d7f37e548fcd0e516fc6eac14326006ee922 Mon Sep 17 00:00:00 2001 From: ehennum Date: Fri, 2 Jul 2021 11:22:26 -0700 Subject: [PATCH 12/12] #1302 generate classes with mapped handles --- .../dataservices/InputOutputCaller.java | 9 -- .../marklogic/client/tools/proxy/Generator.kt | 21 ++- .../positive/AnyDocumentBundle.java | 27 ++++ .../positive/AnyDocumentBundleTest.java | 147 +++++++++++------- .../anyDocument/sendReceiveMappedDoc.api | 21 +++ .../anyDocument/sendReceiveMappedDoc.sjs | 8 + 6 files changed, 160 insertions(+), 73 deletions(-) create mode 100644 ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveMappedDoc.api create mode 100644 ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveMappedDoc.sjs diff --git a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputOutputCaller.java b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputOutputCaller.java index fd8358ef4..1101cded9 100644 --- a/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputOutputCaller.java +++ b/marklogic-client-api/src/main/java/com/marklogic/client/dataservices/InputOutputCaller.java @@ -50,15 +50,6 @@ static InputOutputCaller on( return new InputOutputEndpointImpl<>(client, apiDecl, new HandleProvider.ContentHandleProvider<>(inputHandle, outputHandle)); } -/* TODO: ADD TO ISSUE -- ALSO FOR InputCaller AND OutputCaller -- AND DELETE - static InputOutputCaller,BufferableContentHandle> onHandles( - DatabaseClient client, JSONWriteHandle apiDecl, - BufferableContentHandle inputHandle, BufferableContentHandle outputHandle - ) { - return new InputOutputEndpointImpl<>(client, apiDecl, new HandleProvider.DirectHandleProvider<>(inputHandle, outputHandle)); - } - */ - /** * Makes one call to an endpoint that doesn't take endpoint constants, endpoint state, or a session. * @param input the request data sent to the endpoint diff --git a/ml-development-tools/src/main/kotlin/com/marklogic/client/tools/proxy/Generator.kt b/ml-development-tools/src/main/kotlin/com/marklogic/client/tools/proxy/Generator.kt index ffc7916c2..c71a4c122 100644 --- a/ml-development-tools/src/main/kotlin/com/marklogic/client/tools/proxy/Generator.kt +++ b/ml-development-tools/src/main/kotlin/com/marklogic/client/tools/proxy/Generator.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 MarkLogic Corporation + * Copyright (c) 2021 MarkLogic Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import com.fasterxml.jackson.databind.node.ArrayNode import com.fasterxml.jackson.databind.node.ObjectNode import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import com.fasterxml.jackson.module.kotlin.readValue +import com.marklogic.client.io.marker.BufferableContentHandle import java.io.File import com.networknt.schema.* @@ -233,12 +234,22 @@ class Generator { val allMappings = getAllMappings() val typeMappings = allMappings[dataType] - if (typeMappings === null) { + if (typeMappings?.contains(mapping) == true) { + return mapping + } else if (dataType == "anyDocument") { + try { + val mappingClass = Class.forName(mapping) + if (!BufferableContentHandle::class.java.isAssignableFrom(mappingClass)) { + throw IllegalArgumentException("""mapped class ${mapping} for anyDocument data type must extend BufferableContentHandle""") + } + return mapping + } catch(e: ClassNotFoundException) { + throw IllegalArgumentException("""could not load mapped class ${mapping} for anyDocument data type""") + } + } else if (typeMappings === null) { throw IllegalArgumentException("""no mappings for data type ${dataType}""") - } else if (!typeMappings.contains(mapping)) { - throw IllegalArgumentException("""no mapping to ${mapping} for data type ${dataType}""") } - return mapping + throw IllegalArgumentException("""no mapping to ${mapping} for data type ${dataType}""") } fun getSigDataType(mappedType: String, isMultiple: Boolean): String { val sigType = diff --git a/ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/positive/AnyDocumentBundle.java b/ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/positive/AnyDocumentBundle.java index ed9576c2b..abff1ed0f 100644 --- a/ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/positive/AnyDocumentBundle.java +++ b/ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/positive/AnyDocumentBundle.java @@ -52,6 +52,7 @@ final class AnyDocumentBundleImpl implements AnyDocumentBundle { private BaseProxy.DBFunctionRequest req_sendReceiveRequiredDoc; private BaseProxy.DBFunctionRequest req_sendReceiveOptionalDoc; private BaseProxy.DBFunctionRequest req_sendReceiveAnyDocs; + private BaseProxy.DBFunctionRequest req_sendReceiveMappedDoc; private AnyDocumentBundleImpl(DatabaseClient dbClient, JSONWriteHandle servDecl) { this.dbClient = dbClient; @@ -65,6 +66,8 @@ private AnyDocumentBundleImpl(DatabaseClient dbClient, JSONWriteHandle servDecl) "sendReceiveOptionalDoc.sjs", BaseProxy.ParameterValuesKind.MULTIPLE_MIXED); this.req_sendReceiveAnyDocs = this.baseProxy.request( "sendReceiveAnyDocs.sjs", BaseProxy.ParameterValuesKind.MULTIPLE_MIXED); + this.req_sendReceiveMappedDoc = this.baseProxy.request( + "sendReceiveMappedDoc.sjs", BaseProxy.ParameterValuesKind.MULTIPLE_MIXED); } @Override @@ -126,6 +129,21 @@ private Stream sendReceiveAnyDocs(Bas ).responseMultiple(true, Format.UNKNOWN) .asStreamOfHandles(null, new com.marklogic.client.io.InputStreamHandle()); } + + @Override + public com.marklogic.client.io.StringHandle sendReceiveMappedDoc(String uri, com.marklogic.client.io.StringHandle doc) { + return sendReceiveMappedDoc( + this.req_sendReceiveMappedDoc.on(this.dbClient), uri, doc + ); + } + private com.marklogic.client.io.StringHandle sendReceiveMappedDoc(BaseProxy.DBFunctionRequest request, String uri, com.marklogic.client.io.StringHandle doc) { + return request + .withParams( + BaseProxy.atomicParam("uri", true, BaseProxy.StringType.fromString(uri)), + BaseProxy.documentParam("doc", true, doc) + ).responseSingle(true, Format.UNKNOWN) + .asHandle(new com.marklogic.client.io.StringHandle()); + } } return new AnyDocumentBundleImpl(db, serviceDeclaration); @@ -167,4 +185,13 @@ private Stream sendReceiveAnyDocs(Bas */ Stream sendReceiveAnyDocs(Stream uris, Stream docs); + /** + * Invokes the sendReceiveMappedDoc operation on the database server + * + * @param uri provides input + * @param doc provides input + * @return as output + */ + com.marklogic.client.io.StringHandle sendReceiveMappedDoc(String uri, com.marklogic.client.io.StringHandle doc); + } diff --git a/ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/positive/AnyDocumentBundleTest.java b/ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/positive/AnyDocumentBundleTest.java index bf091d943..011ab9662 100644 --- a/ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/positive/AnyDocumentBundleTest.java +++ b/ml-development-tools/src/test/java/com/marklogic/client/test/dbfunction/positive/AnyDocumentBundleTest.java @@ -17,12 +17,15 @@ import com.marklogic.client.FailedRequestException; import com.marklogic.client.impl.BaseProxy; +import com.marklogic.client.io.BaseHandle; import com.marklogic.client.io.Format; import com.marklogic.client.io.InputStreamHandle; +import com.marklogic.client.io.StringHandle; +import com.marklogic.client.io.marker.BufferableContentHandle; import com.marklogic.client.test.dbfunction.DBFunctionTestUtil; import org.junit.Test; -import java.io.IOException; +import java.io.ByteArrayInputStream; import java.util.function.BiFunction; import java.util.stream.Stream; @@ -38,59 +41,53 @@ public class AnyDocumentBundleTest { }; final static private AnyDocumentBundle testObj = AnyDocumentBundle.on(DBFunctionTestUtil.db); -/* TODO: - positive test: - mapped StringHandle - negative test: - mapped to a class that's not a handle for single or multiple param or return value - */ - @Test - public void sendReceiveOptionalJSONDocTest() throws IOException { - testDocImpl(uris[0], Format.JSON, docs[0], testObj::sendReceiveOptionalDoc); + public void sendReceiveOptionalJSONDocTest() { + testInputStreamImpl(uris[0], Format.JSON, docs[0], testObj::sendReceiveOptionalDoc); } @Test - public void sendReceiveOptionalXMLDocTest() throws IOException { - testDocImpl(uris[1], Format.XML, docs[1], testObj::sendReceiveOptionalDoc); + public void sendReceiveOptionalXMLDocTest() { + testInputStreamImpl(uris[1], Format.XML, docs[1], testObj::sendReceiveOptionalDoc); } @Test - public void sendReceiveRequiredJSONDocTest() throws IOException { - testDocImpl(uris[0], Format.JSON, docs[0], testObj::sendReceiveRequiredDoc); + public void sendReceiveOptionalNullUriTest() { + // send null uri with non-null handle to optional endpoint + testInputStreamImpl(null, Format.JSON, docs[0], testObj::sendReceiveOptionalDoc); } @Test - public void sendReceiveRequiredXMLDocTest() throws IOException { - testDocImpl(uris[1], Format.XML, docs[1], testObj::sendReceiveRequiredDoc); + public void sendReceiveOptionalNullDocTest() { + // send non-null uri with null handle to optional endpoint + testInputStreamImpl(uris[0], null, null, testObj::sendReceiveOptionalDoc); } @Test - public void sendReceiveOptionalNullUriTest() throws IOException { - // send null uri with non-null handle to optional endpoint - testDocImpl(null, Format.JSON, docs[0], testObj::sendReceiveOptionalDoc); + public void sendReceiveOptionalNullUriDocTest() { + // send null uri and null handle to optional endpoint + testInputStreamImpl(null, null, null, testObj::sendReceiveOptionalDoc); } + @Test - public void sendReceiveOptionalNullDocTest() throws IOException { - // send non-null uri with null handle to optional endpoint - testDocImpl(uris[0], null, null, testObj::sendReceiveOptionalDoc); + public void sendReceiveRequiredJSONDocTest() { + testInputStreamImpl(uris[0], Format.JSON, docs[0], testObj::sendReceiveRequiredDoc); } @Test - public void sendReceiveOptionalNullUriDocTest() throws IOException { - // send null uri and null handle to optional endpoint - testDocImpl(null, null, null, testObj::sendReceiveOptionalDoc); + public void sendReceiveRequiredXMLDocTest() { + testInputStreamImpl(uris[1], Format.XML, docs[1], testObj::sendReceiveRequiredDoc); } @Test - public void sendReceiveRequiredNullDocTest() throws IOException { + public void sendReceiveRequiredNullDocTest() { // negative test: send non-null uri with null handle to required endpoint try { - testDocImpl(uris[0], null, null, testObj::sendReceiveRequiredDoc); + testInputStreamImpl(uris[0], null, null, testObj::sendReceiveRequiredDoc); fail("no exception for required parameter with null value"); } catch(BaseProxy.RequiredParamException e) { assertEquals("null value for required parameter: doc", e.getMessage()); } } @Test - public void sendReceiveOptionalInvalidFormatDocTest() throws IOException { + public void sendReceiveOptionalInvalidFormatDocTest() { // negative test: send handle with invalid format try { - testDocImpl(uris[0], formats[1], docs[0], testObj::sendReceiveOptionalDoc); + testInputStreamImpl(uris[0], formats[1], docs[0], testObj::sendReceiveOptionalDoc); fail("no exception for invalid format"); } catch(FailedRequestException e) { assertEquals(400, e.getServerStatusCode()); @@ -99,43 +96,68 @@ public void sendReceiveOptionalInvalidFormatDocTest() throws IOException { } @Test - public void sendReceiveAnyTwoDocsTest() throws IOException { - testDocsImpl(uris, formats, docs, testObj::sendReceiveAnyDocs); + public void sendReceiveMappedJSONDocTest() { + testStringImpl(uris[0], Format.JSON, docs[0], testObj::sendReceiveMappedDoc); } @Test - public void sendReceiveAnyOneJSONDocTest() throws IOException { - testDocsImpl(uris[0], formats[0], docs[0], testObj::sendReceiveAnyDocs); + public void sendReceiveMappedXMLDocTest() { + testStringImpl(uris[1], Format.XML, docs[1], testObj::sendReceiveMappedDoc); } @Test - public void sendReceiveAnyOneXMLDocTest() throws IOException { - testDocsImpl(uris[1], formats[1], docs[1], testObj::sendReceiveAnyDocs); + public void sendReceiveMappedNullUriTest() { + // send null uri with non-null handle to optional endpoint + testStringImpl(null, Format.JSON, docs[0], testObj::sendReceiveMappedDoc); } @Test - public void sendReceiveManyTwoDocsTest() throws IOException { - testDocsImpl(uris, formats, docs, testObj::sendReceiveManyDocs); + public void sendReceiveMappedNullDocTest() { + // send non-null uri with null handle to optional endpoint + testStringImpl(uris[0], null, null, testObj::sendReceiveMappedDoc); } @Test - public void sendReceiveManyOneJSONDocTest() throws IOException { - testDocsImpl(uris[0], formats[0], docs[0], testObj::sendReceiveManyDocs); + public void sendReceiveMappedNullUriDocTest() { + // send null uri and null handle to optional endpoint + testStringImpl(null, null, null, testObj::sendReceiveMappedDoc); } + @Test - public void sendReceiveManyOneXMLDocTest() throws IOException { - testDocsImpl(uris[1], formats[1], docs[1], testObj::sendReceiveManyDocs); + public void sendReceiveAnyTwoDocsTest() { + testDocsImpl(uris, formats, docs, testObj::sendReceiveAnyDocs); + } + @Test + public void sendReceiveAnyOneJSONDocTest() { + testDocsImpl(uris[0], formats[0], docs[0], testObj::sendReceiveAnyDocs); + } + @Test + public void sendReceiveAnyOneXMLDocTest() { + testDocsImpl(uris[1], formats[1], docs[1], testObj::sendReceiveAnyDocs); } @Test - public void sendReceiveAnyNullUrisTest() throws IOException { + public void sendReceiveAnyNullUrisTest() { testDocsImpl(null, formats, docs, testObj::sendReceiveAnyDocs); } @Test - public void sendReceiveAnyNullDocsTest() throws IOException { + public void sendReceiveAnyNullDocsTest() { testDocsImpl(uris, null, null, testObj::sendReceiveAnyDocs); } @Test - public void sendReceiveAnyNullUrisDocsTest() throws IOException { + public void sendReceiveAnyNullUrisDocsTest() { testDocsImpl(null, (Format[]) null, null, testObj::sendReceiveAnyDocs); } + + @Test + public void sendReceiveManyTwoDocsTest() { + testDocsImpl(uris, formats, docs, testObj::sendReceiveManyDocs); + } + @Test + public void sendReceiveManyOneJSONDocTest() { + testDocsImpl(uris[0], formats[0], docs[0], testObj::sendReceiveManyDocs); + } + @Test + public void sendReceiveManyOneXMLDocTest() { + testDocsImpl(uris[1], formats[1], docs[1], testObj::sendReceiveManyDocs); + } @Test - public void sendReceiveManyNullDocsTest() throws IOException { + public void sendReceiveManyNullDocsTest() { try { testDocsImpl(uris, null, null, testObj::sendReceiveManyDocs); fail("no exception for required parameter with null value"); @@ -146,7 +168,7 @@ public void sendReceiveManyNullDocsTest() throws IOException { } } @Test - public void sendReceiveAnyInvalidFormatDocsTest() throws IOException { + public void sendReceiveAnyInvalidFormatDocsTest() { // negative test: send handle with invalid format try { testDocsImpl(uris[1], formats[0], docs[1], testObj::sendReceiveAnyDocs); @@ -157,21 +179,28 @@ public void sendReceiveAnyInvalidFormatDocsTest() throws IOException { } } - private void testDocImpl(String uri, Format format, String doc, BiFunction caller) { - InputStreamHandle inputHandle = null; - if (doc != null) { - inputHandle = new InputStreamHandle(); - if (format != null) { - inputHandle.setFormat(format); - } - inputHandle.fromBuffer(doc.getBytes()); + private void testStringImpl(String uri, Format format, String doc, BiFunction caller) { + testDocImpl(uri, format, (doc == null) ? null : new StringHandle(doc), caller); + } + private void testInputStreamImpl(String uri, Format format, String doc, BiFunction caller) { + testDocImpl(uri, format, (doc == null) ? null : new InputStreamHandle(new ByteArrayInputStream(doc.getBytes())), caller); + } + private > void testDocImpl(String uri, Format format, T inputHandle, BiFunction caller) { + if (inputHandle != null && format != null) { + BaseHandle inputBase = (BaseHandle) inputHandle; + inputBase.setFormat(format); } + testDocImpl(uri, inputHandle, caller); + } + private > void testDocImpl(String uri, T inputHandle, BiFunction caller) { + T outputHandle = caller.apply(uri, inputHandle); - InputStreamHandle outputHandle = caller.apply(uri, inputHandle); - - if (doc != null) { - assertEquals(format, outputHandle.getFormat()); - assertEquals(doc, new String(outputHandle.toBuffer()).trim()); + if (inputHandle != null) { + assertNotNull(outputHandle); + BaseHandle inputBase = (BaseHandle) inputHandle; + BaseHandle outputBase = (BaseHandle) outputHandle; + assertEquals(inputBase.getFormat(), outputBase.getFormat()); + assertEquals(new String(inputHandle.toBuffer()).trim(), new String(outputHandle.toBuffer()).trim()); } else { assertNull(outputHandle); } diff --git a/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveMappedDoc.api b/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveMappedDoc.api new file mode 100644 index 000000000..ca3ff97aa --- /dev/null +++ b/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveMappedDoc.api @@ -0,0 +1,21 @@ +{ + "functionName": "sendReceiveMappedDoc", + "params": [ { + "name": "uri", + "datatype": "string", + "multiple": false, + "nullable": true + }, { + "name": "doc", + "datatype": "anyDocument", + "multiple": false, + "nullable": true, + "$javaClass" : "com.marklogic.client.io.StringHandle" + } ], + "return": { + "datatype": "anyDocument", + "multiple": false, + "nullable": true, + "$javaClass" : "com.marklogic.client.io.StringHandle" + } +} \ No newline at end of file diff --git a/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveMappedDoc.sjs b/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveMappedDoc.sjs new file mode 100644 index 000000000..ac1c5dd34 --- /dev/null +++ b/ml-development-tools/src/test/ml-modules/root/dbfunctiondef/positive/anyDocument/sendReceiveMappedDoc.sjs @@ -0,0 +1,8 @@ +'use strict'; +var uri; +var doc; + +// could write to the database at this point... + +// instead, just return the documents in the same order for inspection on the client +doc;