diff --git a/build.gradle b/build.gradle index d9474653b3..c4397bfb07 100644 --- a/build.gradle +++ b/build.gradle @@ -404,7 +404,7 @@ tasks.register('checkDeniedLicense') { "BSD-4-Clause", "BSD-4-Clause-UC", "NPL-1.0", "NPL-1.1", "JSON" ] // Update exemptions according to https://github.com/apache/eventmesh/issues/4842 - def allowedArtifacts = ["amqp-client", "stax-api", "javassist", "hibernate-core", "hibernate-commons-annotations", "ST4", "xsdlib"] + def allowedArtifacts = ["amqp-client", "stax-api", "javassist", "ST4", "xsdlib"] def licenseFile = file('tools/dist-license/LICENSE') def lines = licenseFile.readLines() diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/JsonUtils.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/JsonUtils.java index 71d42e3452..cf07bdfbe7 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/JsonUtils.java +++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/JsonUtils.java @@ -58,7 +58,7 @@ public static T mapToObject(Map map, Class beanClass) { return null; } Object obj = OBJECT_MAPPER.convertValue(map, beanClass); - return (T) obj; + return beanClass.cast(obj); } /** diff --git a/eventmesh-connectors/eventmesh-connector-http/build.gradle b/eventmesh-connectors/eventmesh-connector-http/build.gradle index 734b2fc622..786ac4518d 100644 --- a/eventmesh-connectors/eventmesh-connector-http/build.gradle +++ b/eventmesh-connectors/eventmesh-connector-http/build.gradle @@ -18,10 +18,15 @@ dependencies { api project(":eventmesh-openconnect:eventmesh-openconnect-java") implementation project(":eventmesh-common") - implementation 'io.cloudevents:cloudevents-http-vertx:2.3.0' + + implementation 'io.cloudevents:cloudevents-http-vertx:3.0.0' implementation 'io.vertx:vertx-web:4.4.6' + implementation 'io.vertx:vertx-web-client:4.4.6' + implementation 'dev.failsafe:failsafe:3.3.2' testImplementation "org.apache.httpcomponents:httpclient" + testImplementation 'org.mock-server:mockserver-netty:5.15.0' + testImplementation 'com.squareup.okhttp3:okhttp:4.12.0' compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' } \ No newline at end of file diff --git a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/server/HttpConnectServer.java b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/server/HttpConnectServer.java index bd94fed126..8d753d2815 100644 --- a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/server/HttpConnectServer.java +++ b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/server/HttpConnectServer.java @@ -18,6 +18,7 @@ package org.apache.eventmesh.connector.http.server; import org.apache.eventmesh.connector.http.config.HttpServerConfig; +import org.apache.eventmesh.connector.http.sink.HttpSinkConnector; import org.apache.eventmesh.connector.http.source.connector.HttpSourceConnector; import org.apache.eventmesh.openconnect.Application; import org.apache.eventmesh.openconnect.util.ConfigUtil; @@ -33,7 +34,8 @@ public static void main(String[] args) throws Exception { } if (serverConfig.isSinkEnable()) { - // TODO support sink connector + Application httpSinkApp = new Application(); + httpSinkApp.run(HttpSinkConnector.class); } } diff --git a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/HttpSinkConnector.java b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/HttpSinkConnector.java new file mode 100644 index 0000000000..23d09fa141 --- /dev/null +++ b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/HttpSinkConnector.java @@ -0,0 +1,124 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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 + * + * 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 org.apache.eventmesh.connector.http.sink; + +import org.apache.eventmesh.connector.http.sink.config.HttpSinkConfig; +import org.apache.eventmesh.connector.http.sink.config.SinkConnectorConfig; +import org.apache.eventmesh.connector.http.sink.handle.CommonHttpSinkHandler; +import org.apache.eventmesh.connector.http.sink.handle.HttpSinkHandler; +import org.apache.eventmesh.connector.http.sink.handle.RetryHttpSinkHandler; +import org.apache.eventmesh.connector.http.sink.handle.WebhookHttpSinkHandler; +import org.apache.eventmesh.openconnect.api.config.Config; +import org.apache.eventmesh.openconnect.api.connector.ConnectorContext; +import org.apache.eventmesh.openconnect.api.connector.SinkConnectorContext; +import org.apache.eventmesh.openconnect.api.sink.Sink; +import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; + +import java.util.List; +import java.util.Objects; + +import lombok.Getter; +import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class HttpSinkConnector implements Sink { + + private HttpSinkConfig httpSinkConfig; + + @Getter + private HttpSinkHandler sinkHandler; + + @Override + public Class configClass() { + return HttpSinkConfig.class; + } + + @Override + public void init(Config config) throws Exception { + this.httpSinkConfig = (HttpSinkConfig) config; + doInit(); + } + + @Override + public void init(ConnectorContext connectorContext) throws Exception { + SinkConnectorContext sinkConnectorContext = (SinkConnectorContext) connectorContext; + this.httpSinkConfig = (HttpSinkConfig) sinkConnectorContext.getSinkConfig(); + doInit(); + } + + @SneakyThrows + private void doInit() { + // Fill default values if absent + SinkConnectorConfig.populateFieldsWithDefaults(this.httpSinkConfig.connectorConfig); + // Create different handlers for different configurations + HttpSinkHandler nonRetryHandler; + if (this.httpSinkConfig.connectorConfig.getWebhookConfig().isActivate()) { + nonRetryHandler = new WebhookHttpSinkHandler(this.httpSinkConfig.connectorConfig); + } else { + nonRetryHandler = new CommonHttpSinkHandler(this.httpSinkConfig.connectorConfig); + } + + int maxRetries = this.httpSinkConfig.connectorConfig.getRetryConfig().getMaxRetries(); + if (maxRetries == 0) { + // Use the original sink handler + this.sinkHandler = nonRetryHandler; + } else if (maxRetries > 0) { + // Wrap the sink handler with a retry handler + this.sinkHandler = new RetryHttpSinkHandler(this.httpSinkConfig.connectorConfig, nonRetryHandler); + } else { + throw new IllegalArgumentException("Max retries must be greater than or equal to 0."); + } + } + + @Override + public void start() throws Exception { + this.sinkHandler.start(); + } + + @Override + public void commit(ConnectRecord record) { + + } + + @Override + public String name() { + return this.httpSinkConfig.connectorConfig.getConnectorName(); + } + + @Override + public void stop() throws Exception { + this.sinkHandler.stop(); + } + + @Override + public void put(List sinkRecords) { + for (ConnectRecord sinkRecord : sinkRecords) { + try { + if (Objects.isNull(sinkRecord)) { + log.warn("ConnectRecord data is null, ignore."); + continue; + } + // Handle the ConnectRecord + this.sinkHandler.handle(sinkRecord); + } catch (Exception e) { + log.error("Failed to sink message via HTTP. ", e); + } + } + } +} diff --git a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/config/HttpRetryConfig.java b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/config/HttpRetryConfig.java new file mode 100644 index 0000000000..cf6d5adcb7 --- /dev/null +++ b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/config/HttpRetryConfig.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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 + * + * 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 org.apache.eventmesh.connector.http.sink.config; + +import lombok.Data; + +@Data +public class HttpRetryConfig { + // maximum number of retries, default 3, minimum 0 + private int maxRetries = 3; + + // retry interval, default 2000ms + private int interval = 2000; + + // Default value is false, indicating that only requests with network-level errors will be retried. + // If set to true, all failed requests will be retried, including network-level errors and non-2xx responses. + private boolean retryOnNonSuccess = false; +} diff --git a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/config/HttpSinkConfig.java b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/config/HttpSinkConfig.java new file mode 100644 index 0000000000..3dd0c2b6a5 --- /dev/null +++ b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/config/HttpSinkConfig.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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 + * + * 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 org.apache.eventmesh.connector.http.sink.config; + +import org.apache.eventmesh.openconnect.api.config.SinkConfig; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = true) +public class HttpSinkConfig extends SinkConfig { + + public SinkConnectorConfig connectorConfig; +} diff --git a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/config/HttpWebhookConfig.java b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/config/HttpWebhookConfig.java new file mode 100644 index 0000000000..f15bac4568 --- /dev/null +++ b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/config/HttpWebhookConfig.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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 + * + * 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 org.apache.eventmesh.connector.http.sink.config; + +import lombok.Data; + +@Data +public class HttpWebhookConfig { + + private boolean activate = false; + + // Path to display/export callback data + private String exportPath = "/export"; + + private int port; + + // timeunit: ms + private int serverIdleTimeout = 5000; + + // max size of the storage queue + private int maxStorageSize = 5000; +} diff --git a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/config/SinkConnectorConfig.java b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/config/SinkConnectorConfig.java new file mode 100644 index 0000000000..9bb338cceb --- /dev/null +++ b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/config/SinkConnectorConfig.java @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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 + * + * 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 org.apache.eventmesh.connector.http.sink.config; + +import io.vertx.core.http.HttpClientOptions; + +import lombok.Data; + +@Data +public class SinkConnectorConfig { + + private String connectorName; + + private String[] urls; + + // keepAlive, default true + private boolean keepAlive = HttpClientOptions.DEFAULT_KEEP_ALIVE; + + // timeunit: ms, default 60000ms + private int keepAliveTimeout = HttpClientOptions.DEFAULT_KEEP_ALIVE_TIMEOUT * 1000; // Keep units consistent + + // timeunit: ms, default 5000ms, recommended scope: 5000ms - 10000ms + private int connectionTimeout = 5000; + + // timeunit: ms, default 5000ms + private int idleTimeout; + + // maximum number of HTTP/1 connections a client will pool, default 5 + private int maxConnectionPoolSize = HttpClientOptions.DEFAULT_MAX_POOL_SIZE; + + // retry config + private HttpRetryConfig retryConfig = new HttpRetryConfig(); + + // webhook config + private HttpWebhookConfig webhookConfig = new HttpWebhookConfig(); + + + /** + * Fill default values if absent (When there are multiple default values for a field) + * + * @param config SinkConnectorConfig + */ + public static void populateFieldsWithDefaults(SinkConnectorConfig config) { + /* + * set default values for idleTimeout + * recommended scope: common(5s - 10s), webhook(15s - 30s) + */ + final int commonHttpIdleTimeout = 5000; + final int webhookHttpIdleTimeout = 15000; + + // Set default values for idleTimeout + if (config.getIdleTimeout() == 0) { + int idleTimeout = config.webhookConfig.isActivate() ? webhookHttpIdleTimeout : commonHttpIdleTimeout; + config.setIdleTimeout(idleTimeout); + } + + } +} diff --git a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/data/HttpConnectRecord.java b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/data/HttpConnectRecord.java new file mode 100644 index 0000000000..1bfd223079 --- /dev/null +++ b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/data/HttpConnectRecord.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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 + * + * 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 org.apache.eventmesh.connector.http.sink.data; + +import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; + +import java.time.LocalDateTime; +import java.util.Map; +import java.util.UUID; + +import lombok.Builder; +import lombok.Data; + +/** + * a special ConnectRecord for HttpSinkConnector + */ +@Data +@Builder +public class HttpConnectRecord { + + private String type; + + private String time; + + private String uuid; + + private String eventId; + + private ConnectRecord data; + + /** + * Convert ConnectRecord to HttpConnectRecord + * + * @param record the ConnectRecord to convert + * @return the converted HttpConnectRecord + */ + public static HttpConnectRecord convertConnectRecord(ConnectRecord record, String type) { + Map offsetMap = record.getPosition().getOffset().getOffset(); + String offset = "0"; + if (!offsetMap.isEmpty()) { + offset = offsetMap.values().iterator().next().toString(); + } + return HttpConnectRecord.builder() + .type(type) + .time(LocalDateTime.now().toString()) + .uuid(UUID.randomUUID().toString()) + .eventId(type + "-" + offset) + .data(record) + .build(); + } + +} diff --git a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/data/HttpExportMetadata.java b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/data/HttpExportMetadata.java new file mode 100644 index 0000000000..848012f152 --- /dev/null +++ b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/data/HttpExportMetadata.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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 + * + * 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 org.apache.eventmesh.connector.http.sink.data; + +import java.time.LocalDateTime; + +import lombok.Builder; +import lombok.Data; + +/** + * Metadata for an HTTP export operation. + */ +@Data +@Builder +public class HttpExportMetadata { + private String url; + + private int code; + + private String message; + + private LocalDateTime receivedTime; + + private String uuid; + + private String retriedBy; + + private int retryNum; +} diff --git a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/data/HttpExportRecord.java b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/data/HttpExportRecord.java new file mode 100644 index 0000000000..b6382aee7a --- /dev/null +++ b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/data/HttpExportRecord.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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 + * + * 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 org.apache.eventmesh.connector.http.sink.data; + +import lombok.AllArgsConstructor; +import lombok.Data; + +/** + * Represents an HTTP export record containing metadata and data to be exported. + */ +@Data +@AllArgsConstructor +public class HttpExportRecord { + + private HttpExportMetadata metadata; + + private Object data; +} diff --git a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/data/HttpExportRecordPage.java b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/data/HttpExportRecordPage.java new file mode 100644 index 0000000000..5c44eb3b7f --- /dev/null +++ b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/data/HttpExportRecordPage.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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 + * + * 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 org.apache.eventmesh.connector.http.sink.data; + +import java.util.List; + +import lombok.AllArgsConstructor; +import lombok.Data; + +/** + * Represents a page of HTTP export records. + */ +@Data +@AllArgsConstructor +public class HttpExportRecordPage { + + private int pageNum; + + private int pageSize; + + private List pageItems; + +} diff --git a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/handle/CommonHttpSinkHandler.java b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/handle/CommonHttpSinkHandler.java new file mode 100644 index 0000000000..e21046c4d2 --- /dev/null +++ b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/handle/CommonHttpSinkHandler.java @@ -0,0 +1,181 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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 + * + * 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 org.apache.eventmesh.connector.http.sink.handle; + +import org.apache.eventmesh.connector.http.sink.config.SinkConnectorConfig; +import org.apache.eventmesh.connector.http.sink.data.HttpConnectRecord; +import org.apache.eventmesh.connector.http.util.HttpUtils; +import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; + +import java.net.URI; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +import io.netty.handler.codec.http.HttpHeaderNames; +import io.vertx.core.Future; +import io.vertx.core.MultiMap; +import io.vertx.core.Vertx; +import io.vertx.core.buffer.Buffer; +import io.vertx.core.http.HttpHeaders; +import io.vertx.ext.web.client.HttpResponse; +import io.vertx.ext.web.client.WebClient; +import io.vertx.ext.web.client.WebClientOptions; + +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; + +/** + * Common HTTP/HTTPS Sink Handler implementation to handle ConnectRecords by sending them over HTTP or HTTPS to configured URLs. + * + *

This handler initializes a WebClient for making HTTP requests based on the provided SinkConnectorConfig. + * It handles processing ConnectRecords by converting them to HttpConnectRecord and sending them asynchronously to each configured URL using the + * WebClient.

+ * + *

The handler uses Vert.x's WebClient to perform HTTP/HTTPS requests. It initializes the WebClient in the {@link #start()} + * method and closes it in the {@link #stop()} method to manage resources efficiently.

+ * + *

Each ConnectRecord is processed and sent to all configured URLs concurrently using asynchronous HTTP requests.

+ */ +@Slf4j +@Getter +public class CommonHttpSinkHandler implements HttpSinkHandler { + + private final SinkConnectorConfig connectorConfig; + + private final List urls; + + private WebClient webClient; + + + public CommonHttpSinkHandler(SinkConnectorConfig sinkConnectorConfig) { + this.connectorConfig = sinkConnectorConfig; + // Initialize URLs + String[] urlStrings = sinkConnectorConfig.getUrls(); + this.urls = Arrays.stream(urlStrings) + .map(URI::create) + .collect(Collectors.toList()); + } + + /** + * Initializes the WebClient for making HTTP requests based on the provided SinkConnectorConfig. + */ + @Override + public void start() { + // Create WebClient + doInitWebClient(); + } + + /** + * Initializes the WebClient with the provided configuration options. + */ + private void doInitWebClient() { + final Vertx vertx = Vertx.vertx(); + WebClientOptions options = new WebClientOptions() + .setKeepAlive(this.connectorConfig.isKeepAlive()) + .setKeepAliveTimeout(this.connectorConfig.getKeepAliveTimeout() / 1000) + .setIdleTimeout(this.connectorConfig.getIdleTimeout()) + .setIdleTimeoutUnit(TimeUnit.MILLISECONDS) + .setConnectTimeout(this.connectorConfig.getConnectionTimeout()) + .setMaxPoolSize(this.connectorConfig.getMaxConnectionPoolSize()); + this.webClient = WebClient.create(vertx, options); + } + + /** + * Processes a ConnectRecord by sending it over HTTP or HTTPS. This method should be called for each ConnectRecord that needs to be processed. + * + * @param record the ConnectRecord to process + */ + @Override + public void handle(ConnectRecord record) { + for (URI url : this.urls) { + // convert ConnectRecord to HttpConnectRecord + String type = String.format("%s.%s.%s", connectorConfig.getConnectorName(), url.getScheme(), "common"); + HttpConnectRecord httpConnectRecord = HttpConnectRecord.convertConnectRecord(record, type); + deliver(url, httpConnectRecord); + } + } + + + /** + * Processes HttpConnectRecord on specified URL while returning its own processing logic. + * This method sends the HttpConnectRecord to the specified URL using the WebClient. + * + * @param url URI to which the HttpConnectRecord should be sent + * @param httpConnectRecord HttpConnectRecord to process + * @return processing chain + */ + @Override + public Future> deliver(URI url, HttpConnectRecord httpConnectRecord) { + // create headers + MultiMap headers = HttpHeaders.headers() + .set(HttpHeaderNames.CONTENT_TYPE, "application/json; charset=utf-8") + .set(HttpHeaderNames.ACCEPT, "application/json; charset=utf-8"); + + // get timestamp and offset + Long timestamp = httpConnectRecord.getData().getTimestamp(); + Map offset = httpConnectRecord.getData().getPosition().getOffset().getOffset(); + + // send the request + return this.webClient.post(url.getPath()) + .host(url.getHost()) + .port(url.getPort() == -1 ? (Objects.equals(url.getScheme(), "https") ? 443 : 80) : url.getPort()) + .putHeaders(headers) + .ssl(Objects.equals(url.getScheme(), "https")) + .sendJson(httpConnectRecord) + .onSuccess(res -> { + log.info("Request sent successfully. Record: timestamp={}, offset={}", timestamp, offset); + // log the response + if (HttpUtils.is2xxSuccessful(res.statusCode())) { + if (log.isDebugEnabled()) { + log.debug("Received successful response: statusCode={}. Record: timestamp={}, offset={}, responseBody={}", + res.statusCode(), timestamp, offset, res.bodyAsString()); + } else { + log.info("Received successful response: statusCode={}. Record: timestamp={}, offset={}", res.statusCode(), timestamp, offset); + } + } else { + if (log.isDebugEnabled()) { + log.warn("Received non-2xx response: statusCode={}. Record: timestamp={}, offset={}, responseBody={}", + res.statusCode(), timestamp, offset, res.bodyAsString()); + } else { + log.warn("Received non-2xx response: statusCode={}. Record: timestamp={}, offset={}", res.statusCode(), timestamp, offset); + } + } + + }) + .onFailure(err -> log.error("Request failed to send. Record: timestamp={}, offset={}", timestamp, offset, err)); + } + + + /** + * Cleans up and releases resources used by the HTTP/HTTPS handler. + */ + @Override + public void stop() { + if (this.webClient != null) { + this.webClient.close(); + } else { + log.warn("WebClient is null, ignore."); + } + } + + +} \ No newline at end of file diff --git a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/handle/HttpSinkHandler.java b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/handle/HttpSinkHandler.java new file mode 100644 index 0000000000..09fd66a762 --- /dev/null +++ b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/handle/HttpSinkHandler.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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 + * + * 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 org.apache.eventmesh.connector.http.sink.handle; + +import org.apache.eventmesh.connector.http.sink.data.HttpConnectRecord; +import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; + +import java.net.URI; + +import io.vertx.core.Future; +import io.vertx.core.buffer.Buffer; +import io.vertx.ext.web.client.HttpResponse; + +/** + * Interface for handling ConnectRecords via HTTP or HTTPS. Classes implementing this interface are responsible for processing ConnectRecords by + * sending them over HTTP or HTTPS, with additional support for handling multiple requests and asynchronous processing. + * + *

Any class that needs to process ConnectRecords via HTTP or HTTPS should implement this interface. + * Implementing classes must provide implementations for the {@link #start()}, {@link #handle(ConnectRecord)}, + * {@link #deliver(URI, HttpConnectRecord)}, and {@link #stop()} methods.

+ * + *

Implementing classes should ensure thread safety and handle HTTP/HTTPS communication efficiently. + * The {@link #start()} method initializes any necessary resources for HTTP/HTTPS communication. The {@link #handle(ConnectRecord)} method processes a + * ConnectRecord by sending it over HTTP or HTTPS. The {@link #deliver(URI, HttpConnectRecord)} method processes HttpConnectRecord on specified URL + * while returning its own processing logic {@link #stop()} method releases any resources used for HTTP/HTTPS communication.

+ * + *

It's recommended to handle exceptions gracefully within the {@link #deliver(URI, HttpConnectRecord)} method + * to prevent message loss or processing interruptions.

+ */ +public interface HttpSinkHandler { + + /** + * Initializes the HTTP/HTTPS handler. This method should be called before using the handler. + */ + void start(); + + /** + * Processes a ConnectRecord by sending it over HTTP or HTTPS. This method should be called for each ConnectRecord that needs to be processed. + * + * @param record the ConnectRecord to process + */ + void handle(ConnectRecord record); + + + /** + * Processes HttpConnectRecord on specified URL while returning its own processing logic + * + * @param url URI to which the HttpConnectRecord should be sent + * @param httpConnectRecord HttpConnectRecord to process + * @return processing chain + */ + Future> deliver(URI url, HttpConnectRecord httpConnectRecord); + + /** + * Cleans up and releases resources used by the HTTP/HTTPS handler. This method should be called when the handler is no longer needed. + */ + void stop(); +} + diff --git a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/handle/RetryHttpSinkHandler.java b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/handle/RetryHttpSinkHandler.java new file mode 100644 index 0000000000..06700261d5 --- /dev/null +++ b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/handle/RetryHttpSinkHandler.java @@ -0,0 +1,206 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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 + * + * 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 org.apache.eventmesh.connector.http.sink.handle; + +import org.apache.eventmesh.connector.http.sink.config.HttpRetryConfig; +import org.apache.eventmesh.connector.http.sink.config.SinkConnectorConfig; +import org.apache.eventmesh.connector.http.sink.data.HttpConnectRecord; +import org.apache.eventmesh.connector.http.sink.data.HttpExportMetadata; +import org.apache.eventmesh.connector.http.sink.data.HttpExportRecord; +import org.apache.eventmesh.connector.http.util.HttpUtils; +import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; + +import java.net.ConnectException; +import java.net.URI; +import java.time.Duration; +import java.time.LocalDateTime; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import java.util.stream.Collectors; + +import io.vertx.core.Future; +import io.vertx.core.buffer.Buffer; +import io.vertx.ext.web.client.HttpResponse; + +import lombok.extern.slf4j.Slf4j; + +import dev.failsafe.Failsafe; +import dev.failsafe.RetryPolicy; +import dev.failsafe.RetryPolicyBuilder; +import dev.failsafe.event.ExecutionEvent; + + +@Slf4j +public class RetryHttpSinkHandler implements HttpSinkHandler { + + private final SinkConnectorConfig connectorConfig; + + // Retry policy builder + private RetryPolicyBuilder> retryPolicyBuilder; + + private final List urls; + + private final HttpSinkHandler sinkHandler; + + + public RetryHttpSinkHandler(SinkConnectorConfig connectorConfig, HttpSinkHandler sinkHandler) { + this.connectorConfig = connectorConfig; + this.sinkHandler = sinkHandler; + + // Initialize retry + initRetry(); + + // Initialize URLs + String[] urlStrings = connectorConfig.getUrls(); + this.urls = Arrays.stream(urlStrings) + .map(URI::create) + .collect(Collectors.toList()); + } + + private void initRetry() { + HttpRetryConfig httpRetryConfig = this.connectorConfig.getRetryConfig(); + + this.retryPolicyBuilder = RetryPolicy.>builder() + .handleIf(e -> e instanceof ConnectException) + .handleResultIf(response -> httpRetryConfig.isRetryOnNonSuccess() && !HttpUtils.is2xxSuccessful(response.statusCode())) + .withMaxRetries(httpRetryConfig.getMaxRetries()) + .withDelay(Duration.ofMillis(httpRetryConfig.getInterval())); + } + + + /** + * Initializes the WebClient for making HTTP requests based on the provided SinkConnectorConfig. + */ + @Override + public void start() { + sinkHandler.start(); + } + + + /** + * Processes a ConnectRecord by sending it over HTTP or HTTPS. This method should be called for each ConnectRecord that needs to be processed. + * + * @param record the ConnectRecord to process + */ + @Override + public void handle(ConnectRecord record) { + for (URI url : this.urls) { + // convert ConnectRecord to HttpConnectRecord + String type = String.format("%s.%s.%s", + this.connectorConfig.getConnectorName(), url.getScheme(), + this.connectorConfig.getWebhookConfig().isActivate() ? "webhook" : "common"); + HttpConnectRecord httpConnectRecord = HttpConnectRecord.convertConnectRecord(record, type); + // handle the HttpConnectRecord + deliver(url, httpConnectRecord); + } + } + + + /** + * Processes HttpConnectRecord on specified URL while returning its own processing logic This method provides the retry power to process the + * HttpConnectRecord + * + * @param url URI to which the HttpConnectRecord should be sent + * @param httpConnectRecord HttpConnectRecord to process + * @return processing chain + */ + @Override + public Future> deliver(URI url, HttpConnectRecord httpConnectRecord) { + // Only webhook mode needs to use the UUID to identify the request + String id = httpConnectRecord.getUuid(); + + // Build the retry policy + RetryPolicy> retryPolicy = retryPolicyBuilder + .onSuccess(event -> { + if (connectorConfig.getWebhookConfig().isActivate()) { + // convert the result to an HttpExportRecord + HttpExportRecord exportRecord = covertToExportRecord(httpConnectRecord, event, event.getResult(), event.getException(), url, id); + // add the data to the queue + ((WebhookHttpSinkHandler) sinkHandler).addDataToQueue(exportRecord); + } + }) + .onRetry(event -> { + if (log.isDebugEnabled()) { + log.warn("Retrying the request to {} for the {} time. HttpConnectRecord= {}", url, event.getAttemptCount(), httpConnectRecord); + } else { + log.warn("Retrying the request to {} for the {} time.", url, event.getAttemptCount()); + } + if (connectorConfig.getWebhookConfig().isActivate()) { + HttpExportRecord exportRecord = + covertToExportRecord(httpConnectRecord, event, event.getLastResult(), event.getLastException(), url, id); + ((WebhookHttpSinkHandler) sinkHandler).addDataToQueue(exportRecord); + } + // update the HttpConnectRecord + httpConnectRecord.setTime(LocalDateTime.now().toString()); + httpConnectRecord.setUuid(UUID.randomUUID().toString()); + }) + .onFailure(event -> { + if (log.isDebugEnabled()) { + log.error("Failed to send the request to {} after {} attempts. HttpConnectRecord= {}", url, event.getAttemptCount(), + httpConnectRecord, event.getException()); + } else { + log.error("Failed to send the request to {} after {} attempts.", url, event.getAttemptCount(), event.getException()); + } + if (connectorConfig.getWebhookConfig().isActivate()) { + HttpExportRecord exportRecord = covertToExportRecord(httpConnectRecord, event, event.getResult(), event.getException(), url, id); + ((WebhookHttpSinkHandler) sinkHandler).addDataToQueue(exportRecord); + } + }).build(); + + // Handle the HttpConnectRecord with retry + Failsafe.with(retryPolicy) + .getStageAsync(() -> sinkHandler.deliver(url, httpConnectRecord).toCompletionStage()); + + return null; + } + + /** + * Converts the ExecutionCompletedEvent to an HttpExportRecord. + * + * @param httpConnectRecord HttpConnectRecord + * @param event ExecutionEvent + * @param response the response of the request, may be null + * @param e the exception thrown during the request, may be null + * @param url the URL the request was sent to + * @param id UUID + * @return the converted HttpExportRecord + */ + private HttpExportRecord covertToExportRecord(HttpConnectRecord httpConnectRecord, ExecutionEvent event, HttpResponse response, + Throwable e, URI url, String id) { + + HttpExportMetadata httpExportMetadata = HttpExportMetadata.builder() + .url(url.toString()) + .code(response != null ? response.statusCode() : -1) + .message(response != null ? response.statusMessage() : e.getMessage()) + .receivedTime(LocalDateTime.now()) + .uuid(httpConnectRecord.getUuid()) + .retriedBy(event.getAttemptCount() > 1 ? id : null) + .retryNum(event.getAttemptCount() - 1).build(); + + return new HttpExportRecord(httpExportMetadata, response == null ? null : response.bodyAsString()); + } + + /** + * Cleans up and releases resources used by the HTTP/HTTPS handler. + */ + @Override + public void stop() { + sinkHandler.stop(); + } +} diff --git a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/handle/WebhookHttpSinkHandler.java b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/handle/WebhookHttpSinkHandler.java new file mode 100644 index 0000000000..e07683fcfa --- /dev/null +++ b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/handle/WebhookHttpSinkHandler.java @@ -0,0 +1,348 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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 + * + * 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 org.apache.eventmesh.connector.http.sink.handle; + +import org.apache.eventmesh.common.exception.EventMeshException; +import org.apache.eventmesh.connector.http.sink.config.HttpWebhookConfig; +import org.apache.eventmesh.connector.http.sink.config.SinkConnectorConfig; +import org.apache.eventmesh.connector.http.sink.data.HttpConnectRecord; +import org.apache.eventmesh.connector.http.sink.data.HttpExportMetadata; +import org.apache.eventmesh.connector.http.sink.data.HttpExportRecord; +import org.apache.eventmesh.connector.http.sink.data.HttpExportRecordPage; +import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; + +import org.apache.commons.lang3.StringUtils; + +import java.net.URI; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Objects; +import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; + +import io.netty.handler.codec.http.HttpResponseStatus; +import io.vertx.core.Future; +import io.vertx.core.MultiMap; +import io.vertx.core.Vertx; +import io.vertx.core.buffer.Buffer; +import io.vertx.core.http.HttpHeaders; +import io.vertx.core.http.HttpMethod; +import io.vertx.core.http.HttpServer; +import io.vertx.core.http.HttpServerOptions; +import io.vertx.ext.web.Router; +import io.vertx.ext.web.client.HttpResponse; +import io.vertx.ext.web.handler.LoggerHandler; + +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONWriter; + +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; + +/** + * Extends CommonHttpSinkHandler to provide additional functionality for handling webhook features, including sending requests to callback servers, + * allowing longer response wait times, storing responses returned from callback servers, and exposing received data through an HTTP service. + */ +@Slf4j +public class WebhookHttpSinkHandler extends CommonHttpSinkHandler { + + private final SinkConnectorConfig sinkConnectorConfig; + + // the configuration for webhook + private final HttpWebhookConfig webhookConfig; + + // the server for exporting the received data + private HttpServer exportServer; + + // store the received data, when webhook is enabled + private final ConcurrentLinkedQueue receivedDataQueue; + + // the maximum queue size + private final int maxQueueSize; + + // the current queue size + private final AtomicInteger currentQueueSize; + + public WebhookHttpSinkHandler(SinkConnectorConfig sinkConnectorConfig) { + super(sinkConnectorConfig); + this.sinkConnectorConfig = sinkConnectorConfig; + this.webhookConfig = sinkConnectorConfig.getWebhookConfig(); + this.maxQueueSize = this.webhookConfig.getMaxStorageSize(); + this.currentQueueSize = new AtomicInteger(0); + this.receivedDataQueue = new ConcurrentLinkedQueue<>(); + // init the export server + doInitExportServer(); + } + + /** + * Initialize the server for exporting the received data + */ + private void doInitExportServer() { + final Vertx vertx = Vertx.vertx(); + final Router router = Router.router(vertx); + // add logger handler + router.route().handler(LoggerHandler.create()); + // add export handler + router.route() + .path(this.webhookConfig.getExportPath()) + .method(HttpMethod.GET) + .produces("application/json") + .handler(ctx -> { + // Validate the request parameters + MultiMap params = ctx.request().params(); + String pageNumStr = params.get(ParamEnum.PAGE_NUM.getValue()); + String pageSizeStr = params.get(ParamEnum.PAGE_SIZE.getValue()); + String type = params.get(ParamEnum.TYPE.getValue()); + + // 1. type must be "poll" or "peek" or null + // 2. if type is "peek", pageNum must be greater than 0 + // 3. pageSize must be greater than 0 + if ((type != null && !Objects.equals(type, TypeEnum.PEEK.getValue()) && !Objects.equals(type, TypeEnum.POLL.getValue())) + || (Objects.equals(type, TypeEnum.PEEK.getValue()) && (StringUtils.isBlank(pageNumStr) || Integer.parseInt(pageNumStr) < 1)) + || (StringUtils.isBlank(pageSizeStr) || Integer.parseInt(pageSizeStr) < 1)) { + + // Return 400 Bad Request if the request parameters are invalid + ctx.response() + .putHeader(HttpHeaders.CONTENT_TYPE, "application/json; charset=utf-8") + .setStatusCode(HttpResponseStatus.BAD_REQUEST.code()) + .end(); + log.info("Invalid request parameters. pageNum: {}, pageSize: {}, type: {}", pageNumStr, pageSizeStr, type); + return; + } + + // Parse the request parameters + if (type == null) { + type = TypeEnum.PEEK.getValue(); + } + int pageNum = StringUtils.isBlank(pageNumStr) ? 1 : Integer.parseInt(pageNumStr); + int pageSize = Integer.parseInt(pageSizeStr); + + if (currentQueueSize.get() == 0) { + ctx.response() + .putHeader(HttpHeaders.CONTENT_TYPE, "application/json; charset=utf-8") + .setStatusCode(HttpResponseStatus.NO_CONTENT.code()) + .end(); + log.info("No callback data to export."); + return; + } + + // Get the received data + List exportRecords; + if (Objects.equals(type, TypeEnum.POLL.getValue())) { + // If the type is poll, only the first page of data is exported and removed + exportRecords = getDataFromQueue(0, pageSize, true); + } else { + // If the type is peek, the specified page of data is exported without removing + int startIndex = (pageNum - 1) * pageSize; + int endIndex = startIndex + pageSize; + exportRecords = getDataFromQueue(startIndex, endIndex, false); + } + + // Create HttpExportRecordPage + HttpExportRecordPage page = new HttpExportRecordPage(pageNum, exportRecords.size(), exportRecords); + + // export the received data + ctx.response() + .putHeader(HttpHeaders.CONTENT_TYPE, "application/json; charset=utf-8") + .setStatusCode(HttpResponseStatus.OK.code()) + .send(JSON.toJSONString(page, JSONWriter.Feature.WriteMapNullValue)); + if (log.isDebugEnabled()) { + log.debug("Succeed to export callback data. Data: {}", page); + } else { + log.info("Succeed to export callback data."); + } + }); + // create the export server + this.exportServer = vertx.createHttpServer(new HttpServerOptions() + .setPort(this.webhookConfig.getPort()) + .setIdleTimeout(this.webhookConfig.getServerIdleTimeout()) + .setIdleTimeoutUnit(TimeUnit.MILLISECONDS)).requestHandler(router); + } + + /** + * Starts the HTTP/HTTPS handler by creating a WebClient with configured options and starting the export server. + */ + @Override + public void start() { + // start the webclient + super.start(); + // start the export server + Throwable t = this.exportServer.listen().cause(); + if (t != null) { + throw new EventMeshException("Failed to start Vertx server. ", t); + } + } + + /** + * Processes a ConnectRecord by sending it over HTTP or HTTPS. This method should be called for each ConnectRecord that needs to be processed. + * + * @param record the ConnectRecord to process + */ + @Override + public void handle(ConnectRecord record) { + for (URI url : super.getUrls()) { + // convert ConnectRecord to HttpConnectRecord + String type = String.format("%s.%s.%s", this.getConnectorConfig().getConnectorName(), url.getScheme(), "webhook"); + HttpConnectRecord httpConnectRecord = HttpConnectRecord.convertConnectRecord(record, type); + // handle the HttpConnectRecord + deliver(url, httpConnectRecord); + } + } + + + /** + * Processes HttpConnectRecord on specified URL while returning its own processing logic This method sends the HttpConnectRecord to the specified + * URL by super class method and stores the received data. + * + * @param url URI to which the HttpConnectRecord should be sent + * @param httpConnectRecord HttpConnectRecord to process + * @return processing chain + */ + @Override + public Future> deliver(URI url, HttpConnectRecord httpConnectRecord) { + // send the request + Future> responseFuture = super.deliver(url, httpConnectRecord); + // store the received data + return responseFuture.onComplete(arr -> { + // If open retry, return directly and handled by RetryHttpSinkHandler + if (sinkConnectorConfig.getRetryConfig().getMaxRetries() > 0) { + return; + } + // create ExportMetadataBuilder + HttpResponse response = arr.succeeded() ? arr.result() : null; + + HttpExportMetadata httpExportMetadata = HttpExportMetadata.builder() + .url(url.toString()) + .code(response != null ? response.statusCode() : -1) + .message(response != null ? response.statusMessage() : arr.cause().getMessage()) + .receivedTime(LocalDateTime.now()) + .retriedBy(null) + .uuid(httpConnectRecord.getUuid()) + .retryNum(0) + .build(); + + // create ExportRecord + HttpExportRecord exportRecord = new HttpExportRecord(httpExportMetadata, arr.succeeded() ? arr.result().bodyAsString() : null); + // add the data to the queue + addDataToQueue(exportRecord); + }); + } + + + /** + * Adds the received data to the queue. + * + * @param exportRecord the received data to add to the queue + */ + public void addDataToQueue(HttpExportRecord exportRecord) { + // If the current queue size is greater than or equal to the maximum queue size, remove the oldest element + if (currentQueueSize.get() >= maxQueueSize) { + Object removedData = receivedDataQueue.poll(); + if (log.isDebugEnabled()) { + log.debug("The queue is full, remove the oldest element: {}", removedData); + } else { + log.info("The queue is full, remove the oldest element"); + } + currentQueueSize.decrementAndGet(); + } + // Try to put the received data into the queue + if (receivedDataQueue.offer(exportRecord)) { + currentQueueSize.incrementAndGet(); + log.debug("Successfully put the received data into the queue: {}", exportRecord); + } else { + log.error("Failed to put the received data into the queue: {}", exportRecord); + } + } + + /** + * Gets the received data from the queue. + * + * @param startIndex the start index of the data to get + * @param endIndex the end index of the data to get + * @param removed whether to remove the data from the queue + * @return the received data + */ + private List getDataFromQueue(int startIndex, int endIndex, boolean removed) { + Iterator iterator = receivedDataQueue.iterator(); + + List pageItems = new ArrayList<>(endIndex - startIndex); + int count = 0; + while (iterator.hasNext() && count < endIndex) { + HttpExportRecord item = iterator.next(); + if (count >= startIndex) { + pageItems.add(item); + if (removed) { + iterator.remove(); + currentQueueSize.decrementAndGet(); + } + } + count++; + } + return pageItems; + } + + /** + * Cleans up and releases resources used by the HTTP/HTTPS handler. + */ + @Override + public void stop() { + // stop the webclient + super.stop(); + // stop the export server + if (this.exportServer != null) { + Throwable t = this.exportServer.close().cause(); + if (t != null) { + throw new EventMeshException("Failed to stop Vertx server. ", t); + } + } else { + log.warn("Callback server is null, ignore."); + } + } + + + @Getter + public enum ParamEnum { + PAGE_NUM("pageNum"), + PAGE_SIZE("pageSize"), + TYPE("type"); + + private final String value; + + ParamEnum(String value) { + this.value = value; + } + + } + + + @Getter + public enum TypeEnum { + POLL("poll"), + PEEK("peek"); + + private final String value; + + TypeEnum(String value) { + this.value = value; + } + + } +} \ No newline at end of file diff --git a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/util/HttpUtils.java b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/util/HttpUtils.java new file mode 100644 index 0000000000..79f9fd120d --- /dev/null +++ b/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/util/HttpUtils.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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 + * + * 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 org.apache.eventmesh.connector.http.util; + +public class HttpUtils { + + /** + * Checks if the status code represents a successful response (2xx). + * + * @param statusCode the HTTP status code to check + * @return true if the status code is 2xx, false otherwise + */ + public static boolean is2xxSuccessful(int statusCode) { + int seriesCode = statusCode / 100; + return seriesCode == 2; + } +} diff --git a/eventmesh-connectors/eventmesh-connector-http/src/main/resources/sink-config.yml b/eventmesh-connectors/eventmesh-connector-http/src/main/resources/sink-config.yml new file mode 100644 index 0000000000..f740cf7cd1 --- /dev/null +++ b/eventmesh-connectors/eventmesh-connector-http/src/main/resources/sink-config.yml @@ -0,0 +1,46 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF 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 +# +# 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. +# + +pubSubConfig: + meshAddress: 127.0.0.1:10000 + subject: TopicTest + idc: FT + env: PRD + group: httpSink + appId: 5032 + userName: httpSinkUser + passWord: httpPassWord +connectorConfig: + connectorName: httpSink + urls: + - http://127.0.0.1:8987/test + ssl: false + keepAlive: true + keepAliveTimeout: 60000 + idleTimeout: 5000 # timeunit: ms, recommended scope: common(5s - 10s), webhook(15s - 60s) + connectionTimeout: 5000 # timeunit: ms, recommended scope: 5 - 10s + maxConnectionPoolSize: 5 + retryConfig: + maxRetries: 2 + interval: 1000 + retryOnNonSuccess: false + webhookConfig: + activate: false + exportPath: /export + port: 8988 + serverIdleTimeout: 5000 + maxStorageSize: 5000 diff --git a/eventmesh-connectors/eventmesh-connector-http/src/test/java/org/apache/eventmesh/connector/http/source/connector/HttpSinkConnectorTest.java b/eventmesh-connectors/eventmesh-connector-http/src/test/java/org/apache/eventmesh/connector/http/source/connector/HttpSinkConnectorTest.java new file mode 100644 index 0000000000..738df6430b --- /dev/null +++ b/eventmesh-connectors/eventmesh-connector-http/src/test/java/org/apache/eventmesh/connector/http/source/connector/HttpSinkConnectorTest.java @@ -0,0 +1,170 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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 + * + * 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 org.apache.eventmesh.connector.http.source.connector; + +import static org.mockserver.model.HttpRequest.request; + +import org.apache.eventmesh.connector.http.sink.HttpSinkConnector; +import org.apache.eventmesh.connector.http.sink.config.HttpSinkConfig; +import org.apache.eventmesh.connector.http.sink.config.HttpWebhookConfig; +import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord; +import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordOffset; +import org.apache.eventmesh.openconnect.offsetmgmt.api.data.RecordPartition; +import org.apache.eventmesh.openconnect.util.ConfigUtil; + +import java.net.URI; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockserver.integration.ClientAndServer; +import org.mockserver.model.HttpRequest; +import org.mockserver.model.HttpResponse; +import org.mockserver.model.MediaType; + +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; + +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class HttpSinkConnectorTest { + + private HttpSinkConnector sinkConnector; + + private HttpSinkConfig sinkConfig; + + private URI severUri; + + private ClientAndServer mockServer; + + + @BeforeEach + void before() throws Exception { + // init sinkConnector + this.sinkConnector = new HttpSinkConnector(); + this.sinkConfig = (HttpSinkConfig) ConfigUtil.parse(sinkConnector.configClass()); + this.sinkConnector.init(this.sinkConfig); + this.sinkConnector.start(); + + this.severUri = URI.create(sinkConfig.connectorConfig.getUrls()[0]); + // start mockServer + mockServer = ClientAndServer.startClientAndServer(severUri.getPort()); + mockServer.reset() + .when( + request() + .withMethod("POST") + .withPath(severUri.getPath()) + ) + .respond( + httpRequest -> { + JSONObject requestBody = JSON.parseObject(httpRequest.getBodyAsString()); + return HttpResponse.response() + .withContentType(MediaType.APPLICATION_JSON) + .withStatusCode(200) + .withBody(new JSONObject() + .fluentPut("code", 0) + .fluentPut("message", "success") + .fluentPut("data", requestBody.getJSONObject("data").get("data")) + .toJSONString() + ); // .withDelay(TimeUnit.SECONDS, 10); + } + ); + } + + @AfterEach + void after() throws Exception { + this.sinkConnector.stop(); + this.mockServer.close(); + } + + @Test + void testPut() throws Exception { + // Create a list of ConnectRecord + final int times = 10; + List connectRecords = new ArrayList<>(); + for (int i = 0; i < times; i++) { + ConnectRecord record = createConnectRecord(); + connectRecords.add(record); + } + // Put ConnectRecord + sinkConnector.put(connectRecords); + + // sleep 5s + Thread.sleep(5000); + + // verify request + HttpRequest[] recordedRequests = mockServer.retrieveRecordedRequests(null); + assert recordedRequests.length == times; + + // verify response + HttpWebhookConfig webhookConfig = sinkConfig.connectorConfig.getWebhookConfig(); + String url = new HttpUrl.Builder() + .scheme("http") + .host(severUri.getHost()) + .port(webhookConfig.getPort()) + .addPathSegments(webhookConfig.getExportPath()) + .addQueryParameter("pageNum", "1") + .addQueryParameter("pageSize", "10") + .addQueryParameter("type", "poll") + .build().toString(); + + // build request + Request request = new Request.Builder() + .url(url) + .addHeader("Content-Type", "application/json") + .build(); + + OkHttpClient client = new OkHttpClient(); + try (Response response = client.newCall(request).execute()) { + // check response code + if (!response.isSuccessful()) { + throw new RuntimeException("Unexpected response code: " + response); + } + // check response body + ResponseBody responseBody = response.body(); + if (responseBody != null) { + JSONObject jsonObject = JSON.parseObject(responseBody.string()); + JSONArray pageItems = jsonObject.getJSONArray("pageItems"); + + assert pageItems != null && pageItems.size() == times; + + for (int i = 0; i < times; i++) { + JSONObject pageItem = pageItems.getJSONObject(i); + assert pageItem != null; + assert pageItem.getJSONObject("data") != null; + assert pageItem.getJSONObject("metadata") != null; + } + } + } + } + + private ConnectRecord createConnectRecord() { + RecordPartition partition = new RecordPartition(); + RecordOffset offset = new RecordOffset(); + long timestamp = System.currentTimeMillis(); + return new ConnectRecord(partition, offset, timestamp, UUID.randomUUID().toString()); + } +} diff --git a/eventmesh-connectors/eventmesh-connector-http/src/test/resources/sink-config.yml b/eventmesh-connectors/eventmesh-connector-http/src/test/resources/sink-config.yml new file mode 100644 index 0000000000..149ad7681b --- /dev/null +++ b/eventmesh-connectors/eventmesh-connector-http/src/test/resources/sink-config.yml @@ -0,0 +1,46 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF 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 +# +# 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. +# + +pubSubConfig: + meshAddress: 127.0.0.1:10000 + subject: TopicTest + idc: FT + env: PRD + group: httpSink + appId: 5032 + userName: httpSinkUser + passWord: httpPassWord +connectorConfig: + connectorName: httpSink + urls: + - http://127.0.0.1:8987/test + ssl: false + keepAlive: true + keepAliveTimeout: 60000 + idleTimeout: 15000 # timeunit: ms, recommended scope: common(5s - 10s), webhook(15s - 60s) + connectionTimeout: 5000 # timeunit: ms, recommended scope: 5 - 10s + maxConnectionPoolSize: 10 + retryConfig: + maxRetries: 2 + interval: 1000 + retryOnNonSuccess: true + webhookConfig: + activate: true + exportPath: /export + port: 8988 + serverIdleTimeout: 5000 + maxStorageSize: 5000 \ No newline at end of file diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/build.gradle b/eventmesh-connectors/eventmesh-connector-jdbc/build.gradle index 603cf8564f..5118072e1d 100644 --- a/eventmesh-connectors/eventmesh-connector-jdbc/build.gradle +++ b/eventmesh-connectors/eventmesh-connector-jdbc/build.gradle @@ -37,12 +37,12 @@ dependencies { antlr("org.antlr:antlr4:4.13.0") implementation 'org.antlr:antlr4-runtime:4.13.0' implementation 'com.alibaba:druid:1.2.20' - implementation 'org.hibernate:hibernate-core:5.6.15.Final' + compileOnly 'org.hibernate:hibernate-core:5.6.15.Final' implementation project(":eventmesh-common") implementation project(":eventmesh-openconnect:eventmesh-openconnect-java") implementation project(":eventmesh-spi") implementation 'com.zendesk:mysql-binlog-connector-java:0.28.0' - implementation 'mysql:mysql-connector-java:8.0.32' + compileOnly 'mysql:mysql-connector-java:8.0.32' compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/AbstractHttpHandler.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/AbstractHttpHandler.java index 0b0a6afedf..cdfe4e163a 100644 --- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/AbstractHttpHandler.java +++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/AbstractHttpHandler.java @@ -35,7 +35,9 @@ import com.alibaba.fastjson2.JSONWriter; import lombok.Data; +import lombok.extern.slf4j.Slf4j; +@Slf4j @Data public abstract class AbstractHttpHandler implements HttpHandler { @@ -83,6 +85,12 @@ protected void writeUnauthorized(ChannelHandlerContext ctx, String message) { writeJson(ctx, json, HttpResponseStatus.UNAUTHORIZED); } + protected void writeInternalServerError(ChannelHandlerContext ctx, String message) { + Result result = new Result<>(message); + String json = JSON.toJSONString(result, JSONWriter.Feature.WriteNulls); + writeJson(ctx, json, HttpResponseStatus.INTERNAL_SERVER_ERROR); + } + /** * Use {@link HttpResponseUtils#buildHttpResponse} to build {@link HttpResponse} param. */ @@ -92,25 +100,36 @@ protected void write(ChannelHandlerContext ctx, HttpResponse response) { @Override public void handle(HttpRequest httpRequest, ChannelHandlerContext ctx) throws Exception { - switch (HttpMethod.valueOf(httpRequest.method().name())) { - case OPTIONS: - preflight(ctx); - break; - case GET: - get(httpRequest, ctx); - break; - case POST: - post(httpRequest, ctx); - break; - case PUT: - put(httpRequest, ctx); - break; - case DELETE: - delete(httpRequest, ctx); - break; - default: - // do nothing - break; + try { + switch (HttpMethod.valueOf(httpRequest.method().name())) { + case OPTIONS: + preflight(ctx); + break; + case GET: + get(httpRequest, ctx); + break; + case POST: + post(httpRequest, ctx); + break; + case PUT: + put(httpRequest, ctx); + break; + case DELETE: + delete(httpRequest, ctx); + break; + default: // do nothing + } + } catch (RuntimeException e) { + StackTraceElement element = e.getStackTrace()[0]; + String className = element.getClassName(); + String handlerName = className.substring(className.lastIndexOf(".") + 1); + if (e instanceof IllegalArgumentException) { + log.warn("Admin endpoint {}:{} - {}", handlerName, element.getLineNumber(), e.getMessage()); + writeBadRequest(ctx, e.getMessage()); + } else { + log.error("Admin endpoint {}:{} - {}", handlerName, element.getLineNumber(), e.getMessage(), e); + writeInternalServerError(ctx, e.getMessage()); + } } } diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/AdminHandlerManager.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/AdminHandlerManager.java index 4f81584b9d..1da928dc10 100644 --- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/AdminHandlerManager.java +++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/AdminHandlerManager.java @@ -58,6 +58,8 @@ public class AdminHandlerManager { + private EventMeshServer eventMeshServer; + private EventMeshTCPServer eventMeshTCPServer; private EventMeshHTTPServer eventMeshHTTPServer; @@ -71,9 +73,10 @@ public class AdminHandlerManager { private final Map httpHandlerMap = new ConcurrentHashMap<>(); public AdminHandlerManager(EventMeshServer eventMeshServer) { + this.eventMeshServer = eventMeshServer; + this.eventMeshTCPServer = eventMeshServer.getEventMeshTCPServer(); this.eventMeshGrpcServer = eventMeshServer.getEventMeshGrpcServer(); this.eventMeshHTTPServer = eventMeshServer.getEventMeshHTTPServer(); - this.eventMeshTCPServer = eventMeshServer.getEventMeshTCPServer(); this.eventMeshMetaStorage = eventMeshServer.getMetaStorage(); this.adminWebHookConfigOperationManage = eventMeshTCPServer.getAdminWebHookConfigOperationManage(); } @@ -112,6 +115,7 @@ public void registerHttpHandler() { // v2 endpoints initHandler(new ConfigurationHandler( + eventMeshServer.getConfiguration(), eventMeshTCPServer.getEventMeshTCPConfiguration(), eventMeshHTTPServer.getEventMeshHttpConfiguration(), eventMeshGrpcServer.getEventMeshGrpcConfiguration())); diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/v2/ConfigurationHandler.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/v2/ConfigurationHandler.java index ce16b95749..1c149ca521 100644 --- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/v2/ConfigurationHandler.java +++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/v2/ConfigurationHandler.java @@ -39,6 +39,7 @@ import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.filter.Filter; import com.alibaba.fastjson2.filter.NameFilter; +import com.alibaba.fastjson2.filter.PropertyFilter; import com.alibaba.fastjson2.filter.ValueFilter; import lombok.extern.slf4j.Slf4j; @@ -56,6 +57,7 @@ @EventMeshHttpHandler(path = "/v2/configuration") public class ConfigurationHandler extends AbstractHttpHandler { + private final CommonConfiguration commonConfiguration; private final EventMeshTCPConfiguration eventMeshTCPConfiguration; private final EventMeshHTTPConfiguration eventMeshHTTPConfiguration; private final EventMeshGrpcConfiguration eventMeshGrpcConfiguration; @@ -68,10 +70,12 @@ public class ConfigurationHandler extends AbstractHttpHandler { * @param eventMeshGrpcConfiguration the gRPC configuration for EventMesh */ public ConfigurationHandler( + CommonConfiguration commonConfiguration, EventMeshTCPConfiguration eventMeshTCPConfiguration, EventMeshHTTPConfiguration eventMeshHTTPConfiguration, EventMeshGrpcConfiguration eventMeshGrpcConfiguration) { super(); + this.commonConfiguration = commonConfiguration; this.eventMeshTCPConfiguration = eventMeshTCPConfiguration; this.eventMeshHTTPConfiguration = eventMeshHTTPConfiguration; this.eventMeshGrpcConfiguration = eventMeshGrpcConfiguration; @@ -85,34 +89,51 @@ public ConfigurationHandler( *

When {@code properties}, the field names are returned in Properties format; *

When {@code bean}, the field names themselves are used as json keys. * + *

  • + * {@code configs}: String; Optional, DefaultValue: {@code exclusive}, SelectableValue: {@code all}. + *

    When {@code exclusive}, protocol-specific configurations will only contain protocol-exclusive fields + * and won't contain any {@link CommonConfiguration} fields; + *

    When {@code all}, protocol-specific configurations will contain all fields, including those in {@link CommonConfiguration}. + *

  • * */ @Override protected void get(HttpRequest httpRequest, ChannelHandlerContext ctx) { String format = HttpRequestUtil.getQueryParam(httpRequest, "format", "properties"); - - Filter[] filters; - if (format.equals("properties")) { - filters = new Filter[] {new ConfigFieldFilter(), new IPAddressToStringFilter()}; - } else if (format.equals("bean")) { - filters = new Filter[] {new IPAddressToStringFilter()}; - } else { - log.warn("Invalid format param: {}", format); - writeBadRequest(ctx, "Invalid format param: " + format); - return; + String configs = HttpRequestUtil.getQueryParam(httpRequest, "configs", "exclusive"); + + List filters = new ArrayList<>(); + switch (configs) { + case "exclusive": + filters.add(new SuperClassFieldFilter()); + break; + case "all": break; + default: + throw new IllegalArgumentException("Invalid param 'configs': " + configs); + } + switch (format) { + case "properties": + filters.add(new ConfigFieldFilter()); + break; + case "bean": break; + default: + throw new IllegalArgumentException("Invalid param 'format': " + format); } + filters.add(new IPAddressToStringFilter()); GetConfigurationResponse getConfigurationResponse = new GetConfigurationResponse( + commonConfiguration, eventMeshTCPConfiguration, eventMeshHTTPConfiguration, - eventMeshGrpcConfiguration + eventMeshGrpcConfiguration, + "v1.10.0-release" // TODO get version number after merging https://github.com/apache/eventmesh/pull/4055 ); - String json = JSON.toJSONString(Result.success(getConfigurationResponse), filters); + String json = JSON.toJSONString(Result.success(getConfigurationResponse), filters.toArray(new Filter[0])); writeJson(ctx, json); } /** - * For each member of {@link EventMeshTCPConfiguration}, {@link EventMeshHTTPConfiguration}, and {@link EventMeshGrpcConfiguration}, + * For each member of configuration classes, * the value of the {@link ConfigField} annotation for each field is obtained through reflection, * and then concatenated with the configuration prefix in the {@link Config} annotation to serve as the JSON key for this field. *

    @@ -155,6 +176,39 @@ private Field findFieldInClassHierarchy(Class clazz, String fieldName) throws } } + /** + * For each member of {@link EventMeshTCPConfiguration}, {@link EventMeshHTTPConfiguration}, and {@link EventMeshGrpcConfiguration}, + * if the {@code name} is a member that exists in {@link CommonConfiguration} class, it will be skipped. + */ + static class SuperClassFieldFilter implements PropertyFilter { + @Override + public boolean apply(Object object, String name, Object value) { + try { + Field field = findFieldInClassNonHierarchy(object.getClass(), name); + return field != null; + } catch (NoSuchFieldException e) { + log.error("Failed to get field {} from object {}", name, object, e); + } + return true; + } + + /** + * If a field of a subclass exists in the superclass, return null, causing FastJSON to skip this field. + */ + private Field findFieldInClassNonHierarchy(Class clazz, String fieldName) throws NoSuchFieldException { + try { + return clazz.getDeclaredField(fieldName); + } catch (NoSuchFieldException e) { + Class superclass = clazz.getSuperclass(); + if (superclass == null) { + throw e; + } else { + return null; + } + } + } + } + /** * {@link IPAddress} can't be serialized directly by FastJSON, * so this filter converts {@link IPAddress} objects to their string representation. diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/response/v2/GetConfigurationResponse.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/response/v2/GetConfigurationResponse.java index 40161cca73..5ae9eeb2d3 100644 --- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/response/v2/GetConfigurationResponse.java +++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/response/v2/GetConfigurationResponse.java @@ -17,6 +17,7 @@ package org.apache.eventmesh.runtime.admin.response.v2; +import org.apache.eventmesh.common.config.CommonConfiguration; import org.apache.eventmesh.runtime.configuration.EventMeshGrpcConfiguration; import org.apache.eventmesh.runtime.configuration.EventMeshHTTPConfiguration; import org.apache.eventmesh.runtime.configuration.EventMeshTCPConfiguration; @@ -30,7 +31,9 @@ @AllArgsConstructor public class GetConfigurationResponse { + private CommonConfiguration commonConfiguration; private EventMeshTCPConfiguration eventMeshTCPConfiguration; private EventMeshHTTPConfiguration eventMeshHTTPConfiguration; private EventMeshGrpcConfiguration eventMeshGrpcConfiguration; + private String eventMeshVersion; } diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/DeleteTopicProcessor.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/DeleteTopicProcessor.java index 039754a815..c156cc704d 100644 --- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/DeleteTopicProcessor.java +++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/DeleteTopicProcessor.java @@ -122,10 +122,11 @@ public void handler(HandlerService.HandlerSpecific handlerSpecific, HttpRequest Map responseBodyMap = new HashMap<>(); StringBuilder sb = new StringBuilder(); - sb.append(faildTopic.toString()).append(" not exist in eventmesh"); - HTTP_LOGGER.warn("delete topic fail, {}", sb.toString()); + String topics = String.join(", ", faildTopic); + sb.append(topics).append(" do not exist in eventmesh"); + HTTP_LOGGER.warn("delete topic fail, {}", sb); responseBodyMap.put("retCode", EventMeshRetCode.EVENTMESH_OPERATE_FAIL.getRetCode()); - responseBodyMap.put("retMsg", EventMeshRetCode.EVENTMESH_OPERATE_FAIL.getErrMsg() + sb.toString()); + responseBodyMap.put("retMsg", EventMeshRetCode.EVENTMESH_OPERATE_FAIL.getErrMsg() + sb); responseWrapper = requestWrapper.createHttpResponse(responseHeaderMap, responseBodyMap); responseWrapper.setHttpResponseStatus(HttpResponseStatus.BAD_REQUEST); handlerSpecific.sendErrorResponse(EventMeshRetCode.EVENTMESH_OPERATE_FAIL, responseHeaderMap, diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/ReplyMessageProcessor.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/ReplyMessageProcessor.java index ce178f0f1a..55051573c2 100644 --- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/ReplyMessageProcessor.java +++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/ReplyMessageProcessor.java @@ -73,12 +73,12 @@ public ReplyMessageProcessor(EventMeshHTTPServer eventMeshHTTPServer) { @Override public void processRequest(ChannelHandlerContext ctx, AsyncContext asyncContext) throws Exception { - HttpCommand responseEventMeshCommand; String localAddress = IPUtils.getLocalAddress(); HttpCommand request = asyncContext.getRequest(); + final String channelRemoteAddr = RemotingHelper.parseChannelRemoteAddr(ctx.channel()); cmdLogger.info("cmd={}|{}|client2eventMesh|from={}|to={}", RequestCode.get(Integer.valueOf(request.getRequestCode())), EventMeshConstants.PROTOCOL_HTTP, - RemotingHelper.parseChannelRemoteAddr(ctx.channel()), localAddress); + channelRemoteAddr, localAddress); ReplyMessageRequestHeader replyMessageRequestHeader = (ReplyMessageRequestHeader) request.getHeader(); @@ -167,7 +167,6 @@ public void processRequest(ChannelHandlerContext ctx, AsyncContext try { // body - // omsMsg.setBody(replyMessageRequestBody.getContent().getBytes(EventMeshConstants.DEFAULT_CHARSET)); event = CloudEventBuilder.from(event) .withSubject(replyTopic) .withExtension(EventMeshConstants.MSG_TYPE, EventMeshConstants.PERSISTENT) diff --git a/eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/MessageUtils.java b/eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/MessageUtils.java index 2232e539c9..a12436e330 100644 --- a/eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/MessageUtils.java +++ b/eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/MessageUtils.java @@ -32,6 +32,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Objects; import java.util.concurrent.ThreadLocalRandom; import java.util.stream.IntStream; @@ -83,12 +84,12 @@ public static Package buildPackage(Object message, Command command) { final Package msg = getPackage(command); if (message instanceof CloudEvent) { final CloudEvent cloudEvent = (CloudEvent) message; - Preconditions.checkNotNull(cloudEvent.getDataContentType(), "DateContentType cannot be null"); + Preconditions.checkNotNull(Objects.requireNonNull(cloudEvent.getDataContentType()), "DateContentType cannot be null"); msg.getHeader().putProperty(Constants.PROTOCOL_TYPE, CLOUD_EVENTS_PROTOCOL_NAME); msg.getHeader().putProperty(Constants.PROTOCOL_VERSION, cloudEvent.getSpecVersion().toString()); msg.getHeader().putProperty(Constants.PROTOCOL_DESC, "tcp"); - final byte[] bodyByte = EventFormatProvider.getInstance().resolveFormat(cloudEvent.getDataContentType()) + final byte[] bodyByte = Objects.requireNonNull(EventFormatProvider.getInstance().resolveFormat(cloudEvent.getDataContentType())) .serialize((CloudEvent) message); msg.setBody(bodyByte); } else if (message instanceof EventMeshMessage) { diff --git a/tools/dist-license/LICENSE b/tools/dist-license/LICENSE index 83e1299db3..c5a89ef125 100644 --- a/tools/dist-license/LICENSE +++ b/tools/dist-license/LICENSE @@ -203,9 +203,9 @@ ======================================================================= This distribution contains the following third-party artifacts: -FastInfoset 1.2.15 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt ST4 4.3.4 licensed under 'BSD-4-Clause'. For details see: licenses/BSD-4-Clause.txt accessors-smart 2.4.7 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +adapter-rxjava2 2.9.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt alibabacloud-gateway-spi 0.0.1 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt amqp-client 5.16.0 licensed under 'AL 2.0'. For details see: licenses/AL 2.0.txt amqp-client 5.16.0 licensed under 'GPL v2'. For details see: licenses/GPL v2.txt @@ -213,12 +213,12 @@ amqp-client 5.16.0 licensed under 'MPL-2.0'. For details see: licenses/MPL-2.0.t animal-sniffer-annotations 1.19 licensed under 'MIT'. For details see: licenses/MIT.txt annotations 2.20.29 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt annotations 4.1.1.4 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt -antlr 2.7.7 licensed under 'BSD-3-Clause'. For details see: licenses/BSD-3-Clause.txt antlr-runtime 3.5.3 licensed under 'BSD licence'. For details see: licenses/BSD licence.txt antlr4 4.13.0 licensed under 'BSD-3-Clause'. For details see: licenses/BSD-3-Clause.txt antlr4-runtime 4.13.0 licensed under 'BSD-3-Clause'. For details see: licenses/BSD-3-Clause.txt aopalliance 1.0 licensed under 'Public Domain'. For details see: licenses/Public Domain.txt apache-client 2.20.29 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +api 0.18.2 licensed under 'MIT'. For details see: licenses/MIT.txt arns 2.20.29 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt asm 9.1 licensed under 'BSD-3-Clause'. For details see: licenses/BSD-3-Clause.txt asm 9.2 licensed under 'BSD-3-Clause'. For details see: licenses/BSD-3-Clause.txt @@ -247,10 +247,11 @@ bouncy-castle-bc 2.10.1 licensed under 'Apache-2.0'. For details see: licenses/A bouncy-castle-bc 2.11.1 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt bson 3.12.11 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt byte-buddy 1.11.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt -byte-buddy 1.12.18 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt cache-api 1.1.1 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt checker-qual 3.12.0 licensed under 'MIT'. For details see: licenses/MIT.txt +classgraph 4.8.21 licensed under 'MIT'. For details see: licenses/MIT.txt classmate 1.5.1 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +client 0.18.2 licensed under 'MIT'. For details see: licenses/MIT.txt cloudevents-api 2.4.2 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt cloudevents-core 2.4.2 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt cloudevents-http-vertx 2.3.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt @@ -270,6 +271,7 @@ commons-logging 1.2 licensed under 'Apache-2.0'. For details see: licenses/Apach commons-text 1.9 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt commons-validator 1.7 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt consul-api 1.4.5 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +converter-jackson 2.9.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt credentials-java 0.2.4 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt crt-core 2.20.29 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt curator-client 5.4.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt @@ -304,8 +306,6 @@ gson 2.8.2 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt guava 31.0.1-jre licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt guava-retrying 2.0.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt guice 4.2.2 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt -hibernate-commons-annotations 5.1.2.Final licensed under 'LGPL-2.1-only'. For details see: licenses/LGPL-2.1-only.txt -hibernate-core 5.6.15.Final licensed under 'LGPL-2.1-only'. For details see: licenses/LGPL-2.1-only.txt hibernate-validator 6.2.0.Final licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt http-client-spi 2.20.29 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt httpasyncclient 4.1.3 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt @@ -316,8 +316,6 @@ httpmime 4.5.13 licensed under 'Apache-2.0'. For details see: licenses/Apache-2. icu4j 72.1 licensed under 'Unicode/ICU License'. For details see: licenses/Unicode-ICU License.txt ini4j 0.5.4 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt ipaddress 5.3.3 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt -istack-commons-runtime 3.0.7 licensed under 'CDDL-1.1'. For details see: licenses/CDDL-1.1.txt -istack-commons-runtime 3.0.7 licensed under 'GPL-2.0-with-classpath-exception'. For details see: licenses/GPL-2.0-with-classpath-exception.txt j2objc-annotations 1.3 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt jackson-annotations 2.13.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt jackson-core 2.13.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt @@ -325,32 +323,24 @@ jackson-databind 2.13.0 licensed under 'Apache-2.0'. For details see: licenses/A jackson-dataformat-yaml 2.13.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt jackson-datatype-jdk8 2.13.5 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt jackson-datatype-jsr310 2.13.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +jackson-jr-objects 2.16.1 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt jackson-module-parameter-names 2.13.5 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt jakarta.annotation-api 1.3.5 licensed under 'EPL-2.0'. For details see: licenses/EPL-2.0.txt jakarta.annotation-api 1.3.5 licensed under 'GPL-2.0-with-classpath-exception'. For details see: licenses/GPL-2.0-with-classpath-exception.txt jakarta.validation-api 2.0.2 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt -jandex 2.4.2.Final licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt javassist 3.24.0-GA licensed under 'MPL-1.1'. For details see: licenses/MPL-1.1.txt javassist 3.24.0-GA licensed under 'LGPL-2.1-only'. For details see: licenses/LGPL-2.1-only.txt javassist 3.24.0-GA licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt javax.inject 1 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt -javax.persistence-api 2.2 licensed under 'EPL-1.0'. For details see: licenses/EPL-1.0.txt -javax.persistence-api 2.2 licensed under 'BSD-3-Clause'. For details see: licenses/BSD-3-Clause.txt javax.ws.rs-api 2.1 licensed under 'CDDL-1.1'. For details see: licenses/CDDL-1.1.txt javax.ws.rs-api 2.1 licensed under 'GPL-2.0-with-classpath-exception'. For details see: licenses/GPL-2.0-with-classpath-exception.txt jaxb-api 2.3.0 licensed under 'CDDL-1.1'. For details see: licenses/CDDL-1.1.txt jaxb-api 2.3.0 licensed under 'GPL-2.0-with-classpath-exception'. For details see: licenses/GPL-2.0-with-classpath-exception.txt -jaxb-api 2.3.1 licensed under 'CDDL-1.1'. For details see: licenses/CDDL-1.1.txt -jaxb-api 2.3.1 licensed under 'GPL-2.0-with-classpath-exception'. For details see: licenses/GPL-2.0-with-classpath-exception.txt jaxb-core 2.3.0 licensed under 'CDDL-1.1'. For details see: licenses/CDDL-1.1.txt jaxb-impl 2.3.0 licensed under 'CDDL-1.1'. For details see: licenses/CDDL-1.1.txt -jaxb-runtime 2.3.1 licensed under 'CDDL-1.1'. For details see: licenses/CDDL-1.1.txt jboss-logging 3.4.1.Final licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt -jboss-logging 3.4.3.Final licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt jboss-marshalling 2.0.11.Final licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt jboss-marshalling-river 2.0.11.Final licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt -jboss-transaction-api_1.2_spec 1.1.1.Final licensed under 'Common Development and Distribution License'. For details see: licenses/Common Development and Distribution License.txt -jboss-transaction-api_1.2_spec 1.1.1.Final licensed under 'GNU General Public License, Version 2 with the Classpath Exception'. For details see: licenses/GNU General Public License, Version 2 with the Classpath Exception.txt jcommander 1.78 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt jcommander 1.82 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt jetcd-common 0.3.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt @@ -367,6 +357,7 @@ json-path 2.7.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2. json-smart 2.4.7 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt json-utils 2.20.29 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt jsr305 3.0.2 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +jtokkit 0.5.1 licensed under 'MIT'. For details see: licenses/MIT.txt kafka-clients 3.0.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt listenablefuture 9999.0-empty-to-avoid-conflict-with-guava licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt log4j-api 2.22.1 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt @@ -374,6 +365,7 @@ log4j-core 2.22.1 licensed under 'Apache-2.0'. For details see: licenses/Apache- log4j-slf4j2-impl 2.22.1 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt lz4-java 1.7.1 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt lz4-java 1.8.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +mbknor-jackson-jsonschema_2.12 1.0.34 licensed under 'MIT'. For details see: licenses/MIT.txt metrics-annotation 4.1.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt metrics-core 4.1.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt metrics-healthchecks 4.1.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt @@ -454,17 +446,24 @@ okhttp 3.14.9 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0. okio 1.17.2 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt openapiutil 0.2.1 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt openmessaging-api 2.2.1-pubsub licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt -opentelemetry-api 1.3.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt -opentelemetry-api-metrics 1.3.0-alpha licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt -opentelemetry-context 1.3.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt -opentelemetry-exporter-jaeger 1.4.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt -opentelemetry-exporter-prometheus 1.3.0-alpha licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt -opentelemetry-exporter-zipkin 1.3.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt -opentelemetry-sdk 1.3.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt -opentelemetry-sdk-common 1.3.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt -opentelemetry-sdk-metrics 1.3.0-alpha licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt -opentelemetry-sdk-trace 1.3.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt -opentelemetry-semconv 1.3.0-alpha licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +opentelemetry-api 1.36.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +opentelemetry-api-events 1.36.0-alpha licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +opentelemetry-context 1.36.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +opentelemetry-exporter-common 1.34.1 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +opentelemetry-exporter-common 1.36.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +opentelemetry-exporter-jaeger 1.34.1 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +opentelemetry-exporter-prometheus 1.36.0-alpha licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +opentelemetry-exporter-sender-okhttp 1.34.1 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +opentelemetry-exporter-zipkin 1.36.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +opentelemetry-extension-incubator 1.36.0-alpha licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +opentelemetry-sdk 1.36.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +opentelemetry-sdk-common 1.36.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +opentelemetry-sdk-extension-autoconfigure-spi 1.34.1 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +opentelemetry-sdk-extension-autoconfigure-spi 1.36.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +opentelemetry-sdk-logs 1.36.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +opentelemetry-sdk-metrics 1.36.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +opentelemetry-sdk-trace 1.36.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +opentelemetry-semconv 1.30.1-alpha licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt org.abego.treelayout.core 1.0.3 licensed under 'BSD-3-Clause'. For details see: licenses/BSD-3-Clause.txt org.jacoco.agent 0.8.4 licensed under 'EPL-1.0'. For details see: licenses/EPL-1.0.txt perfmark-api 0.23.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt @@ -484,12 +483,16 @@ pravega-shared-controller-api 0.11.0 licensed under 'Apache-2.0'. For details se pravega-shared-protocol 0.11.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt pravega-shared-security 0.11.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt profiles 2.20.29 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +prometheus-metrics-config 1.1.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +prometheus-metrics-exporter-common 1.1.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +prometheus-metrics-exporter-httpserver 1.1.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +prometheus-metrics-exposition-formats 1.1.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +prometheus-metrics-model 1.1.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +prometheus-metrics-shaded-protobuf 1.1.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt proto-google-common-protos 2.0.1 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt protobuf-java 3.19.2 licensed under 'BSD-3-Clause'. For details see: licenses/BSD-3-Clause.txt protobuf-java 3.21.5 licensed under 'BSD-3-Clause'. For details see: licenses/BSD-3-Clause.txt -protobuf-java 3.21.9 licensed under 'BSD-3-Clause'. For details see: licenses/BSD-3-Clause.txt protobuf-java-util 3.15.0 licensed under 'BSD-3-Clause'. For details see: licenses/BSD-3-Clause.txt -protobuf-java-util 3.17.2 licensed under 'BSD-3-Clause'. For details see: licenses/BSD-3-Clause.txt protobuf-java-util 3.21.5 licensed under 'BSD-3-Clause'. For details see: licenses/BSD-3-Clause.txt protobuf-java-util 3.5.1 licensed under 'BSD-3-Clause'. For details see: licenses/BSD-3-Clause.txt protocol-core 2.20.29 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt @@ -503,6 +506,7 @@ reactive-streams 1.0.3 licensed under 'CC0-1.0'. For details see: licenses/CC0-1 reactor-core 3.4.13 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt redisson 3.17.3 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt regions 2.20.29 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +retrofit 2.9.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt rocketmq-acl 4.9.5 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt rocketmq-broker 4.9.5 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt rocketmq-client 4.9.5 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt @@ -514,12 +518,16 @@ rocketmq-remoting 4.9.5 licensed under 'Apache-2.0'. For details see: licenses/A rocketmq-srvutil 4.9.5 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt rocketmq-store 4.9.5 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt rocketmq-tools 4.9.5 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +rxjava 2.0.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt rxjava 3.0.12 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt s3 2.20.29 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +scala-library 2.12.8 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt sdk-core 2.20.29 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt -simpleclient 0.8.1 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt -simpleclient_common 0.8.1 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt -simpleclient_httpserver 0.8.1 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +service 0.18.2 licensed under 'MIT'. For details see: licenses/MIT.txt +simpleclient 0.12.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +simpleclient_tracer_common 0.12.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +simpleclient_tracer_otel 0.12.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +simpleclient_tracer_otel_agent 0.12.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt slack-api-client 1.1.6 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt slack-api-model 1.1.6 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt slack-app-backend 1.1.6 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt @@ -562,9 +570,9 @@ tomcat-embed-core 9.0.73 licensed under 'Apache-2.0'. For details see: licenses/ tomcat-embed-el 9.0.56 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt tomcat-embed-el 9.0.73 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt tomcat-embed-websocket 9.0.73 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt -txw2 2.3.1 licensed under 'CDDL-1.1'. For details see: licenses/CDDL-1.1.txt utils 2.20.29 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt validation-api 1.1.0.Final licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +validation-api 2.0.1.Final licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt vertx-auth-common 4.4.6 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt vertx-auth-common 4.4.6 licensed under 'EPL-1.0'. For details see: licenses/EPL-1.0.txt vertx-bridge-common 4.4.6 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt @@ -581,9 +589,9 @@ xpp3 1.1.4c licensed under 'Indiana University Extreme! Lab Software License, ve xpp3 1.1.4c licensed under 'Public Domain'. For details see: licenses/Public Domain.txt xpp3 1.1.4c licensed under 'Apache-1.1'. For details see: licenses/Apache-1.1.txt xsdlib 2013.6.1 licensed under 'BSD-4-Clause'. For details see: licenses/BSD-4-Clause.txt -zipkin 2.23.2 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt -zipkin-reporter 2.16.3 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt -zipkin-sender-okhttp3 2.16.3 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +zipkin 2.27.1 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +zipkin-reporter 3.3.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt +zipkin-sender-okhttp3 3.3.0 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt zookeeper 3.7.1 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt zookeeper-jute 3.7.1 licensed under 'Apache-2.0'. For details see: licenses/Apache-2.0.txt zstd-jni 1.5.0-2 licensed under 'BSD-2-Clause'. For details see: licenses/BSD-2-Clause.txt diff --git a/tools/dist-license/licenses/java/Common Development and Distribution License-downloaded-cddl.txt b/tools/dist-license/licenses/java/Common Development and Distribution License-downloaded-cddl.txt deleted file mode 100644 index 9bc6342e22..0000000000 --- a/tools/dist-license/licenses/java/Common Development and Distribution License-downloaded-cddl.txt +++ /dev/null @@ -1,384 +0,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 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. - - 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 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. diff --git a/tools/dist-license/licenses/java/Common Development and Distribution License.txt b/tools/dist-license/licenses/java/Common Development and Distribution License.txt deleted file mode 100644 index f685be4cb1..0000000000 --- a/tools/dist-license/licenses/java/Common Development and Distribution License.txt +++ /dev/null @@ -1 +0,0 @@ -http://repository.jboss.org/licenses/cddl.txt \ No newline at end of file diff --git a/tools/dist-license/licenses/java/GNU General Public License, Version 2 with the Classpath Exception-downloaded-gpl-2.0-ce.txt b/tools/dist-license/licenses/java/GNU General Public License, Version 2 with the Classpath Exception-downloaded-gpl-2.0-ce.txt deleted file mode 100644 index fd91b6f18e..0000000000 --- a/tools/dist-license/licenses/java/GNU General Public License, Version 2 with the Classpath Exception-downloaded-gpl-2.0-ce.txt +++ /dev/null @@ -1,363 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. - - -"CLASSPATH" EXCEPTION TO THE GPL - -Certain source files distributed by Oracle America and/or its affiliates are -subject to the following clarification and special exception to the GPL, but -only where Oracle has expressly included in the particular source file's header -the words "Oracle designates this particular file as subject to the "Classpath" -exception as provided by Oracle in the LICENSE file that accompanied this code." - - Linking this library statically or dynamically with other modules is making - a combined work based on this library. Thus, the terms and conditions of - the GNU General Public License cover the whole combination. - - As a special exception, the copyright holders of this library give you - permission to link this library with independent modules to produce an - executable, regardless of the license terms of these independent modules, - and to copy and distribute the resulting executable under terms of your - choice, provided that you also meet, for each linked independent module, - the terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. If - you modify this library, you may extend this exception to your version of - the library, but you are not obligated to do so. If you do not wish to do - so, delete this exception statement from your version. diff --git a/tools/dist-license/licenses/java/GNU General Public License, Version 2 with the Classpath Exception.txt b/tools/dist-license/licenses/java/GNU General Public License, Version 2 with the Classpath Exception.txt deleted file mode 100644 index f9322c59c0..0000000000 --- a/tools/dist-license/licenses/java/GNU General Public License, Version 2 with the Classpath Exception.txt +++ /dev/null @@ -1 +0,0 @@ -http://repository.jboss.org/licenses/gpl-2.0-ce.txt \ No newline at end of file diff --git a/tools/dist-license/licenses/java/Unicode-ICU License-downloaded-LICENSE b/tools/dist-license/licenses/java/Unicode-ICU License-downloaded-LICENSE deleted file mode 100644 index d67e1c8c66..0000000000 --- a/tools/dist-license/licenses/java/Unicode-ICU License-downloaded-LICENSE +++ /dev/null @@ -1,514 +0,0 @@ -UNICODE LICENSE V3 - -COPYRIGHT AND PERMISSION NOTICE - -Copyright © 2016-2024 Unicode, Inc. - -NOTICE TO USER: Carefully read the following legal agreement. BY -DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR -SOFTWARE, YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE -TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT -DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of data files and any associated documentation (the "Data Files") or -software and any associated documentation (the "Software") to deal in the -Data Files or Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, and/or sell -copies of the Data Files or Software, and to permit persons to whom the -Data Files or Software are furnished to do so, provided that either (a) -this copyright and permission notice appear with all copies of the Data -Files or Software, or (b) this copyright and permission notice appear in -associated Documentation. - -THE DATA FILES AND SOFTWARE ARE 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 OF -THIRD PARTY RIGHTS. - -IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE -BE LIABLE FOR ANY CLAIM, OR 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 THE DATA -FILES OR SOFTWARE. - -Except as contained in this notice, the name of a copyright holder shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in these Data Files or Software without prior written -authorization of the copyright holder. - -SPDX-License-Identifier: Unicode-3.0 - ----------------------------------------------------------------------- - -Third-Party Software Licenses - -This section contains third-party software notices and/or additional -terms for licensed third-party software components included within ICU -libraries. - ----------------------------------------------------------------------- - -ICU License - ICU 1.8.1 to ICU 57.1 - -COPYRIGHT AND PERMISSION NOTICE - -Copyright (c) 1995-2016 International Business Machines Corporation and others -All rights reserved. - -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, and/or sell copies of the Software, and to permit persons -to whom the Software is furnished to do so, provided that the above -copyright notice(s) and this permission notice appear in all copies of -the Software and that both the above copyright notice(s) and this -permission notice appear in supporting documentation. - -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 -OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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. - -Except as contained in this notice, the name of a copyright holder -shall not be used in advertising or otherwise to promote the sale, use -or other dealings in this Software without prior written authorization -of the copyright holder. - -All trademarks and registered trademarks mentioned herein are the -property of their respective owners. - ----------------------------------------------------------------------- - -Chinese/Japanese Word Break Dictionary Data (cjdict.txt) - - # The Google Chrome software developed by Google is licensed under - # the BSD license. Other software included in this distribution is - # provided under other licenses, as set forth below. - # - # The BSD License - # http://opensource.org/licenses/bsd-license.php - # Copyright (C) 2006-2008, 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. - # - # - # The word list in cjdict.txt are generated by combining three word lists - # listed below with further processing for compound word breaking. The - # frequency is generated with an iterative training against Google web - # corpora. - # - # * Libtabe (Chinese) - # - https://sourceforge.net/project/?group_id=1519 - # - Its license terms and conditions are shown below. - # - # * IPADIC (Japanese) - # - http://chasen.aist-nara.ac.jp/chasen/distribution.html - # - Its license terms and conditions are shown below. - # - # ---------COPYING.libtabe ---- BEGIN-------------------- - # - # /* - # * Copyright (c) 1999 TaBE Project. - # * Copyright (c) 1999 Pai-Hsiang Hsiao. - # * 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 TaBE Project 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 - # * 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) 1999 Computer Systems and Communication Lab, - # * Institute of Information Science, Academia - # * Sinica. 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 Computer Systems and Communication Lab - # * 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 - # * 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 1996 Chih-Hao Tsai @ Beckman Institute, - # University of Illinois - # c-tsai4@uiuc.edu http://casper.beckman.uiuc.edu/~c-tsai4 - # - # ---------------COPYING.libtabe-----END-------------------------------- - # - # - # ---------------COPYING.ipadic-----BEGIN------------------------------- - # - # Copyright 2000, 2001, 2002, 2003 Nara Institute of Science - # and Technology. All Rights Reserved. - # - # Use, reproduction, and distribution of this software is permitted. - # Any copy of this software, whether in its original form or modified, - # must include both the above copyright notice and the following - # paragraphs. - # - # Nara Institute of Science and Technology (NAIST), - # the copyright holders, disclaims all warranties with regard to this - # software, including all implied warranties of merchantability and - # fitness, in no event shall NAIST 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 tortuous action, arising out - # of or in connection with the use or performance of this software. - # - # A large portion of the dictionary entries - # originate from ICOT Free Software. The following conditions for ICOT - # Free Software applies to the current dictionary as well. - # - # Each User may also freely distribute the Program, whether in its - # original form or modified, to any third party or parties, PROVIDED - # that the provisions of Section 3 ("NO WARRANTY") will ALWAYS appear - # on, or be attached to, the Program, which is distributed substantially - # in the same form as set out herein and that such intended - # distribution, if actually made, will neither violate or otherwise - # contravene any of the laws and regulations of the countries having - # jurisdiction over the User or the intended distribution itself. - # - # NO WARRANTY - # - # The program was produced on an experimental basis in the course of the - # research and development conducted during the project and is provided - # to users as so produced on an experimental basis. Accordingly, the - # program is provided without any warranty whatsoever, whether express, - # implied, statutory or otherwise. The term "warranty" used herein - # includes, but is not limited to, any warranty of the quality, - # performance, merchantability and fitness for a particular purpose of - # the program and the nonexistence of any infringement or violation of - # any right of any third party. - # - # Each user of the program will agree and understand, and be deemed to - # have agreed and understood, that there is no warranty whatsoever for - # the program and, accordingly, the entire risk arising from or - # otherwise connected with the program is assumed by the user. - # - # Therefore, neither ICOT, the copyright holder, or any other - # organization that participated in or was otherwise related to the - # development of the program and their respective officials, directors, - # officers and other employees shall be held liable for any and all - # damages, including, without limitation, general, special, incidental - # and consequential damages, arising out of or otherwise in connection - # with the use or inability to use the program or any product, material - # or result produced or otherwise obtained by using the program, - # regardless of whether they have been advised of, or otherwise had - # knowledge of, the possibility of such damages at any time during the - # project or thereafter. Each user will be deemed to have agreed to the - # foregoing by his or her commencement of use of the program. The term - # "use" as used herein includes, but is not limited to, the use, - # modification, copying and distribution of the program and the - # production of secondary products from the program. - # - # In the case where the program, whether in its original form or - # modified, was distributed or delivered to or received by a user from - # any person, organization or entity other than ICOT, unless it makes or - # grants independently of ICOT any specific warranty to the user in - # writing, such person, organization or entity, will also be exempted - # from and not be held liable to the user for any such damages as noted - # above as far as the program is concerned. - # - # ---------------COPYING.ipadic-----END---------------------------------- - ----------------------------------------------------------------------- - -Lao Word Break Dictionary Data (laodict.txt) - - # Copyright (C) 2016 and later: Unicode, Inc. and others. - # License & terms of use: http://www.unicode.org/copyright.html - # Copyright (c) 2015 International Business Machines Corporation - # and others. All Rights Reserved. - # - # Project: https://github.com/rober42539/lao-dictionary - # Dictionary: https://github.com/rober42539/lao-dictionary/laodict.txt - # License: https://github.com/rober42539/lao-dictionary/LICENSE.txt - # (copied below) - # - # This file is derived from the above dictionary version of Nov 22, 2020 - # ---------------------------------------------------------------------- - # Copyright (C) 2013 Brian Eugene Wilson, Robert Martin Campbell. - # 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. - # - # 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. - # -------------------------------------------------------------------------- - ----------------------------------------------------------------------- - -Burmese Word Break Dictionary Data (burmesedict.txt) - - # Copyright (c) 2014 International Business Machines Corporation - # and others. All Rights Reserved. - # - # This list is part of a project hosted at: - # github.com/kanyawtech/myanmar-karen-word-lists - # - # -------------------------------------------------------------------------- - # Copyright (c) 2013, LeRoy Benjamin Sharon - # 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 Myanmar Karen Word Lists, 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. - # -------------------------------------------------------------------------- - ----------------------------------------------------------------------- - -Time Zone Database - - ICU uses the public domain data and code derived from Time Zone -Database for its time zone support. The ownership of the TZ database -is explained in BCP 175: Procedure for Maintaining the Time Zone -Database section 7. - - # 7. Database Ownership - # - # The TZ database itself is not an IETF Contribution or an IETF - # document. Rather it is a pre-existing and regularly updated work - # that is in the public domain, and is intended to remain in the - # public domain. Therefore, BCPs 78 [RFC5378] and 79 [RFC3979] do - # not apply to the TZ Database or contributions that individuals make - # to it. Should any claims be made and substantiated against the TZ - # Database, the organization that is providing the IANA - # Considerations defined in this RFC, under the memorandum of - # understanding with the IETF, currently ICANN, may act in accordance - # with all competent court orders. No ownership claims will be made - # by ICANN or the IETF Trust on the database or the code. Any person - # making a contribution to the database or code waives all rights to - # future claims in that contribution or in the TZ Database. - ----------------------------------------------------------------------- - -Google double-conversion - -Copyright 2006-2011, the V8 project authors. 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. - ----------------------------------------------------------------------- - -File: aclocal.m4 (only for ICU4C) -Section: pkg.m4 - Macros to locate and utilise pkg-config. - - -Copyright © 2004 Scott James Remnant . -Copyright © 2012-2015 Dan Nicholson - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. - -As a special exception to the GNU General Public License, if you -distribute this file as part of a program that contains a -configuration script generated by Autoconf, you may include it under -the same distribution terms that you use for the rest of that -program. - - -(The condition for the exception is fulfilled because -ICU4C includes a configuration script generated by Autoconf, -namely the `configure` script.) - ----------------------------------------------------------------------- - -File: config.guess (only for ICU4C) - - -This file is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, see . - -As a special exception to the GNU General Public License, if you -distribute this file as part of a program that contains a -configuration script generated by Autoconf, you may include it under -the same distribution terms that you use for the rest of that -program. This Exception is an additional permission under section 7 -of the GNU General Public License, version 3 ("GPLv3"). - - -(The condition for the exception is fulfilled because -ICU4C includes a configuration script generated by Autoconf, -namely the `configure` script.) - ----------------------------------------------------------------------- - -File: install-sh (only for ICU4C) - - -Copyright 1991 by the Massachusetts Institute of Technology - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, 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. M.I.T. makes no representations about the -suitability of this software for any purpose. It is provided "as is" -without express or implied warranty.