├── .DS_Store
├── .gitignore
├── LICENSE
├── NOTICE
├── README.md
├── bdio-protobuf
├── .DS_Store
├── build.gradle
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── blackducksoftware
│ │ │ └── bdio
│ │ │ └── proto
│ │ │ ├── BdioConstants.java
│ │ │ ├── BdioEntryType.java
│ │ │ ├── ProtobufBdioReader.java
│ │ │ ├── ProtobufBdioWriter.java
│ │ │ ├── api
│ │ │ ├── BdioAnnotationNode.java
│ │ │ ├── BdioBdbaFileNode.java
│ │ │ ├── BdioChunk.java
│ │ │ ├── BdioComponentNode.java
│ │ │ ├── BdioContainerLayerNode.java
│ │ │ ├── BdioContainerNode.java
│ │ │ ├── BdioDependencyNode.java
│ │ │ ├── BdioFileNode.java
│ │ │ ├── BdioHeader.java
│ │ │ ├── BdioValidationException.java
│ │ │ ├── IBdioNode.java
│ │ │ ├── IProtobufBdioValidator.java
│ │ │ ├── IProtobufBdioVersionReader.java
│ │ │ └── IProtobufBdioVersionWriter.java
│ │ │ ├── domain
│ │ │ └── ProtoChunk.java
│ │ │ └── impl
│ │ │ ├── AbstractProtobufBdioValidator.java
│ │ │ ├── AbstractProtobufBdioVersionReader.java
│ │ │ ├── AbstractProtobufBdioVersionWriter.java
│ │ │ ├── ProtoChunkBuilder.java
│ │ │ ├── ProtobufBdioConverter.java
│ │ │ ├── ProtobufBdioServiceProvider.java
│ │ │ ├── ProtobufBdioV1Reader.java
│ │ │ ├── ProtobufBdioV1Validator.java
│ │ │ ├── ProtobufBdioV1Writer.java
│ │ │ ├── ProtobufBdioV2Reader.java
│ │ │ ├── ProtobufBdioV2Validator.java
│ │ │ └── ProtobufBdioV2Writer.java
│ └── proto
│ │ ├── bdba_scan_nodes_v2.proto
│ │ ├── file_node_v1.proto
│ │ └── scan_header_v1.proto
│ └── test
│ ├── java
│ └── com
│ │ └── blackducksoftware
│ │ └── bdio
│ │ └── proto
│ │ ├── ProtobufBdioConverterTest.java
│ │ ├── ProtobufBdioV1ValidatorTest.java
│ │ ├── ProtobufBdioV1WriterReaderTest.java
│ │ ├── ProtobufBdioV2ValidatorTest.java
│ │ ├── ProtobufBdioV2WriterReaderTest.java
│ │ ├── ProtobufBdioWriterReaderTest.java
│ │ └── ProtobufTestUtils.java
│ └── resources
│ └── scan_data
│ └── dummy.txt
├── bdio-reactor
├── build.gradle
└── src
│ ├── main
│ └── java
│ │ └── com
│ │ └── blackducksoftware
│ │ └── bdio2
│ │ └── reactor
│ │ ├── ReactorBdioDocument.java
│ │ ├── ReactorJsonLdProcessing.java
│ │ └── package-info.java
│ └── test
│ └── java
│ └── com
│ └── blackducksoftware
│ └── bdio2
│ └── reactor
│ └── BdioDocumentFromModelTest.java
├── bdio-rxjava
├── build.gradle
└── src
│ ├── main
│ └── java
│ │ └── com
│ │ └── blackducksoftware
│ │ └── bdio2
│ │ └── rxjava
│ │ ├── RxJavaBdioDocument.java
│ │ ├── RxJavaJsonLdProcessing.java
│ │ └── package-info.java
│ └── test
│ └── java
│ └── com
│ └── blackducksoftware
│ └── bdio2
│ └── rxjava
│ └── BdioDocumentFromModelTest.java
├── bdio-test
├── build.gradle
└── src
│ ├── main
│ └── java
│ │ └── com
│ │ └── blackducksoftware
│ │ └── bdio2
│ │ └── test
│ │ ├── BdioTest.java
│ │ └── GraphRunner.java
│ └── test
│ └── java
│ └── com
│ └── blackducksoftware
│ └── bdio2
│ └── test
│ └── BdioTestTest.java
├── bdio-tinkerpop-db
└── Dockerfile
├── bdio-tinkerpop
├── build.gradle
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── blackducksoftware
│ │ │ └── bdio2
│ │ │ └── tinkerpop
│ │ │ ├── BlackDuckIo.java
│ │ │ ├── BlackDuckIoMapper.java
│ │ │ ├── BlackDuckIoNormalization.java
│ │ │ ├── BlackDuckIoOptions.java
│ │ │ ├── BlackDuckIoReadGraphException.java
│ │ │ ├── BlackDuckIoReader.java
│ │ │ ├── BlackDuckIoVersion.java
│ │ │ ├── BlackDuckIoWriter.java
│ │ │ ├── package-info.java
│ │ │ ├── spi
│ │ │ ├── AbstractBlackDuckIoSpi.java
│ │ │ ├── BlackDuckIoNormalizationSpi.java
│ │ │ ├── BlackDuckIoReaderSpi.java
│ │ │ ├── BlackDuckIoSpi.java
│ │ │ ├── BlackDuckIoWriterSpi.java
│ │ │ ├── DefaultBlackDuckIo.java
│ │ │ ├── DefaultBlackDuckIoNormalization.java
│ │ │ ├── DefaultBlackDuckIoReader.java
│ │ │ ├── DefaultBlackDuckIoWriter.java
│ │ │ └── package-info.java
│ │ │ ├── sqlg
│ │ │ ├── PostgresPlugin.java
│ │ │ ├── SqlgBlackDuckIo.java
│ │ │ ├── SqlgBlackDuckIoNormalization.java
│ │ │ ├── SqlgBlackDuckIoReader.java
│ │ │ ├── SqlgQueryBuilder.java
│ │ │ ├── flyway
│ │ │ │ ├── BaseSqlgMigration.java
│ │ │ │ ├── BdioCallback.java
│ │ │ │ ├── FlywayBackport.java
│ │ │ │ ├── JdbcUrlDataSource.java
│ │ │ │ ├── R__Create_aggregate_functions.java
│ │ │ │ ├── SqlgCallback.java
│ │ │ │ ├── SqlgFlywayExecutor.java
│ │ │ │ └── package-info.java
│ │ │ ├── package-info.java
│ │ │ ├── step
│ │ │ │ ├── AbstractSimpleSqlgOptimizationStep.java
│ │ │ │ ├── SqlgGraphAddPropertyStep.java
│ │ │ │ ├── SqlgGraphCountStep.java
│ │ │ │ ├── SqlgGraphDropPropertyStep.java
│ │ │ │ └── package-info.java
│ │ │ └── strategy
│ │ │ │ ├── SqlgSimpleQueryStrategy.java
│ │ │ │ └── package-info.java
│ │ │ ├── strategy
│ │ │ ├── PropertyConstantStrategy.java
│ │ │ └── package-info.java
│ │ │ ├── tinkergraph
│ │ │ ├── TinkerGraphBlackDuckIo.java
│ │ │ ├── TinkerGraphBlackDuckIoNormalization.java
│ │ │ ├── TinkerGraphBlackDuckIoReader.java
│ │ │ └── package-info.java
│ │ │ └── util
│ │ │ ├── UnknownProperties.java
│ │ │ ├── VertexProperties.java
│ │ │ └── package-info.java
│ └── resources
│ │ └── META-INF
│ │ └── services
│ │ └── org.umlg.sqlg.SqlgPlugin
│ └── test
│ ├── java
│ └── com
│ │ └── blackducksoftware
│ │ └── bdio2
│ │ └── tinkerpop
│ │ ├── BaseTest.java
│ │ ├── BlackDuckIoNormalizationTest.java
│ │ ├── BlackDuckIoReaderTest.java
│ │ ├── BlackDuckIoWriterTest.java
│ │ ├── sqlg
│ │ ├── SqlgBlackDuckIoNormalizationTest.java
│ │ ├── SqlgBlackDuckIoReaderTest.java
│ │ ├── SqlgCoreTests.java
│ │ └── strategy
│ │ │ └── OptimizationTest.java
│ │ ├── strategy
│ │ └── PropertyConstantStrategyTest.java
│ │ ├── test
│ │ └── NamedGraphBuilder.java
│ │ ├── tinkergraph
│ │ └── TinkerGraphCoreTests.java
│ │ └── util
│ │ └── VertexPropertiesTest.java
│ └── resources
│ ├── sqlg-core.properties
│ ├── sqlg.properties
│ ├── tinkergraph-core.properties
│ └── tinkergraph.properties
├── bdio-tool
├── build.gradle
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── blackducksoftware
│ │ │ └── bdio2
│ │ │ └── tool
│ │ │ ├── AbstractFileTool.java
│ │ │ ├── AbstractGraphTool.java
│ │ │ ├── BdioMain.java
│ │ │ ├── ConcatenateTool.java
│ │ │ ├── ContextTool.java
│ │ │ ├── DependenciesTool.java
│ │ │ ├── EntriesTool.java
│ │ │ ├── FilterTool.java
│ │ │ ├── GraphTool.java
│ │ │ ├── HeadTool.java
│ │ │ ├── HidTool.java
│ │ │ ├── JsonLdTool.java
│ │ │ ├── LintTool.java
│ │ │ ├── SpdxDocumentTool.java
│ │ │ ├── SpecificationTool.java
│ │ │ ├── Tool.java
│ │ │ ├── TreeFormat.java
│ │ │ ├── TreeTool.java
│ │ │ ├── VizTool.java
│ │ │ ├── linter
│ │ │ ├── DataPropertyRange.java
│ │ │ ├── Domain.java
│ │ │ ├── FileTree.java
│ │ │ ├── ImpliedFileSystemTypeConflict.java
│ │ │ ├── Linter.java
│ │ │ ├── Metadata.java
│ │ │ ├── MissingFilePath.java
│ │ │ ├── MissingProjectName.java
│ │ │ ├── Namespace.java
│ │ │ ├── ObjectPropertyRange.java
│ │ │ ├── SemanticRules.java
│ │ │ ├── SingleRoot.java
│ │ │ ├── UnreferencedNode.java
│ │ │ ├── UriSchemes.java
│ │ │ ├── ValidFilePath.java
│ │ │ ├── ValidIdentifier.java
│ │ │ └── package-info.java
│ │ │ └── package-info.java
│ └── resources
│ │ ├── META-INF
│ │ └── mime.types
│ │ └── com
│ │ └── blackducksoftware
│ │ └── bdio2
│ │ └── tool
│ │ ├── spdx
│ │ └── licenses.json
│ │ └── www_viz
│ │ ├── bdio.css
│ │ ├── bdio.js
│ │ └── index.html
│ └── test
│ └── java
│ └── com
│ └── blackducksoftware
│ └── bdio2
│ └── tool
│ └── ToolTest.java
├── bdio2
├── build.gradle
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── blackducksoftware
│ │ │ └── bdio2
│ │ │ ├── Bdio.java
│ │ │ ├── BdioContext.java
│ │ │ ├── BdioDocument.java
│ │ │ ├── BdioEmitter.java
│ │ │ ├── BdioFrame.java
│ │ │ ├── BdioMetadata.java
│ │ │ ├── BdioObject.java
│ │ │ ├── BdioReader.java
│ │ │ ├── BdioSubscriber.java
│ │ │ ├── BdioValueMapper.java
│ │ │ ├── BdioWriter.java
│ │ │ ├── Emitter.java
│ │ │ ├── EmitterFactory.java
│ │ │ ├── EntrySizeViolationException.java
│ │ │ ├── LegacyBdio1xEmitter.java
│ │ │ ├── LegacyJsonParserEmitter.java
│ │ │ ├── LegacyScanContainerEmitter.java
│ │ │ ├── LegacyStreamingScanContainerEmitter.java
│ │ │ ├── LegacyUtilities.java
│ │ │ ├── NodeDoesNotExistException.java
│ │ │ ├── StandardJavaValueMapper.java
│ │ │ ├── model
│ │ │ ├── Annotation.java
│ │ │ ├── Component.java
│ │ │ ├── Container.java
│ │ │ ├── Dependency.java
│ │ │ ├── File.java
│ │ │ ├── FileCollection.java
│ │ │ ├── License.java
│ │ │ ├── LicenseGroup.java
│ │ │ ├── Note.java
│ │ │ ├── Project.java
│ │ │ ├── Repository.java
│ │ │ ├── Vulnerability.java
│ │ │ └── package-info.java
│ │ │ └── package-info.java
│ └── resources
│ │ └── com
│ │ └── blackducksoftware
│ │ └── bdio2
│ │ ├── bdio-context-1.0.jsonld
│ │ ├── bdio-context-1.1.1.jsonld
│ │ ├── bdio-context-1.1.jsonld
│ │ ├── bdio-context-2.0.jsonld
│ │ └── bdio-context-2.1.jsonld
│ └── test
│ └── java
│ └── com
│ └── blackducksoftware
│ └── bdio2
│ ├── BdioContextTest.java
│ ├── BdioDataModelSortOrderTest.java
│ ├── BdioDataModelTest.java
│ ├── BdioEmitterTest.java
│ ├── BdioMetadataTest.java
│ ├── BdioObjectTest.java
│ ├── BdioReaderTest.java
│ ├── BdioTest.java
│ ├── BdioWriterTest.java
│ ├── LegacyBdio1xEmitterTest.java
│ ├── LegacyScanContainerEmitterTest.java
│ └── LegacyUtilitiesTest.java
├── build.gradle
├── dependencies.properties
├── docs
└── spec
│ ├── 00.Abstract.txt
│ ├── 01.Introduction.txt
│ ├── 02.Model.txt
│ ├── 03.SemanticRules.txt
│ ├── 04.DocumentFormat.txt
│ ├── AA.NamespaceRecommendations.txt
│ ├── AB.IdentifierGuidelines.txt
│ ├── AC.FileData.txt
│ └── AD.ContentTypes.txt
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blackducksoftware/bdio/cb631d8b49b992d9ad73a9d3e5262d8c7b789901/.DS_Store
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Gradle cache
2 | /.gradle/
3 |
4 | # Build output
5 | build/
6 |
7 | # Eclipse
8 | .settings/
9 | .classpath
10 | .project
11 | bin/
12 |
13 | # Eclipse TestNG plugin output
14 | test-output/
15 |
16 | # IntelliJ files
17 | /.idea/
18 | *.iml
19 |
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 | Black Duck I/O
2 | Copyright 2015-2016 Black Duck Software, Inc.
3 |
4 | This product includes software developed at
5 | Black Duck Software, Inc. (http://www.blackducksoftware.com/).
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Black Duck I/O
2 |
3 | [](https://travis-ci.org/blackducksoftware/bdio)
4 | [](https://bintray.com/bds/oss/bdio/_latestVersion)
5 |
6 | Black Duck I/O is a specification for how to transfer data between Black Duck products, specifically Bill of Material (BOM) and scan related data. It is also an API for producing and consuming data conforming to the specification. The specification leverages [JSON-LD][json-ld] to represent data. You can find some simple examples of using the API to generate data on the [wiki][wiki].
7 |
8 | ## Requirements
9 |
10 | The Black Duck I/O API requires Java 8 or later. The formatted data must conform to the [BDIO][bdio2_1] specification.
11 |
12 |
13 | ## Dependency Information
14 |
15 | Gradle
16 | ````
17 | compile 'com.blackducksoftware.bdio:bdio-rxjava:x.y.z'
18 | ````
19 |
20 | Maven
21 | ````
22 |
23 | com.blackducksoftware.bdio
24 | bdio-rxjava
25 | x.y.z
26 |
27 | ````
28 |
29 | ## Documentation
30 |
31 | Please refer to the [project wiki][wiki].
32 |
33 | ## Build
34 |
35 | ````
36 | $ git clone git@github.com:blackducksoftware/bdio.git bdio-libraries
37 | $ cd bdio-libraries/
38 | $ docker build -t blackducksoftware/bdio-tinkerpop-db bdio-tinkerpop-db/
39 | $ docker run -d -e POSTGRES_HOST_AUTH_METHOD=trust -p 5432:5432 blackducksoftware/bdio-tinkerpop-db
40 | $ ./gradlew build
41 | ````
42 |
43 | ## License
44 |
45 | Licensed to the Apache Software Foundation (ASF) under one
46 | or more contributor license agreements. See the NOTICE file
47 | distributed with this work for additional information
48 | regarding copyright ownership. The ASF licenses this file
49 | to you under the Apache License, Version 2.0 (the
50 | "License"); you may not use this file except in compliance
51 | with the License. You may obtain a copy of the License at
52 |
53 | http://www.apache.org/licenses/LICENSE-2.0
54 |
55 | Unless required by applicable law or agreed to in writing,
56 | software distributed under the License is distributed on an
57 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
58 | KIND, either express or implied. See the License for the
59 | specific language governing permissions and limitations
60 | under the License.
61 |
62 | [json-ld]: http://json-ld.org
63 | [bdio2_0]: https://blackducksoftware.github.io/bdio/specification/2.0
64 | [bdio2_1]: https://blackducksoftware.github.io/bdio/specification/2.1
65 | [wiki]: https://github.com/blackducksoftware/bdio/wiki
66 |
67 |
--------------------------------------------------------------------------------
/bdio-protobuf/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blackducksoftware/bdio/cb631d8b49b992d9ad73a9d3e5262d8c7b789901/bdio-protobuf/.DS_Store
--------------------------------------------------------------------------------
/bdio-protobuf/build.gradle:
--------------------------------------------------------------------------------
1 | description = 'Black Duck I/O protobuf format definitions'
2 |
3 | apply plugin: 'com.google.protobuf'
4 |
5 | dependencies {
6 | compile 'com.google.protobuf:protobuf-java'
7 | compile 'com.google.guava:guava'
8 | compile 'commons-lang:commons-lang'
9 |
10 | testCompile 'junit:junit'
11 | testCompile 'org.mockito:mockito-core'
12 | testCompile 'commons-lang:commons-lang'
13 | testCompile 'com.google.truth:truth'
14 | }
15 |
16 | protobuf {
17 | protoc {
18 | artifact = 'com.google.protobuf:protoc:3.20.1'
19 | }
20 |
21 | generateProtoTasks {
22 | all().each { task ->
23 | task.builtins {
24 | // Generates Python code in the output folder:
25 | python { }
26 | }
27 | }
28 | }
29 | }
30 |
31 | sourceSets {
32 | generated {
33 | java {
34 | srcDir 'build/generated/source/proto/main/java'
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/bdio-protobuf/src/main/java/com/blackducksoftware/bdio/proto/BdioConstants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Synopsys Inc.
3 | * http://www.synopsys.com/
4 | * All rights reserved.
5 | *
6 | * This software is the confidential and proprietary information of
7 | * Synopsys ("Confidential Information"). You shall not
8 | * disclose such Confidential Information and shall use it only in
9 | * accordance with the terms of the license agreement you entered into
10 | * with Synopsys.
11 | */
12 | package com.blackducksoftware.bdio.proto;
13 |
14 | public class BdioConstants {
15 |
16 | /**
17 | * version of data model, currently (till 2023.1.0 inclusive) used by signature
18 | * scans
19 | */
20 | public static final short VERSION_1 = 1;
21 |
22 | /**
23 | * version of data model in bdio entry, that will be used for SIGNATURE, BINARY and CONTAINER scan types
24 | */
25 | public static final short VERSION_2 = 2;
26 |
27 | /**
28 | * current version of data model
29 | */
30 | public static final short CURRENT_VERSION = VERSION_2;
31 |
32 | /**
33 | * name of header entry in bdio archive
34 | */
35 | public static final String HEADER_FILE_NAME = "bdio-header.pb";
36 |
37 | /**
38 | * name of entry in bdio archive
39 | */
40 | public static final String ENTRY_FILE_NAME_TEMPLATE = "bdio-entry-%02d.pb";
41 |
42 | /**
43 | * maximum size of bdio archive entry
44 | */
45 | public static final long MAX_CHUNK_SIZE = Math.multiplyExact(16, 1024 * 1024); // 16 Mb
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/bdio-protobuf/src/main/java/com/blackducksoftware/bdio/proto/BdioEntryType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Synopsys Inc.
3 | * http://www.synopsys.com/
4 | * All rights reserved.
5 | *
6 | * This software is the confidential and proprietary information of
7 | * Synopsys ("Confidential Information"). You shall not
8 | * disclose such Confidential Information and shall use it only in
9 | * accordance with the terms of the license agreement you entered into
10 | * with Synopsys.
11 | */
12 | package com.blackducksoftware.bdio.proto;
13 |
14 | /**
15 | * Enum defining bdio entry type.
16 | *
17 | * NOTE: Order matters here, only append new types to the end.
18 | *
19 | * @author sharapov
20 | */
21 | public enum BdioEntryType {
22 | HEADER, CHUNK
23 | }
24 |
--------------------------------------------------------------------------------
/bdio-protobuf/src/main/java/com/blackducksoftware/bdio/proto/api/BdioAnnotationNode.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Synopsys Inc.
3 | * http://www.synopsys.com/
4 | * All rights reserved.
5 | *
6 | * This software is the confidential and proprietary information of
7 | * Synopsys ("Confidential Information"). You shall not
8 | * disclose such Confidential Information and shall use it only in
9 | * accordance with the terms of the license agreement you entered into
10 | * with Synopsys.
11 | */
12 | package com.blackducksoftware.bdio.proto.api;
13 |
14 | import java.util.Objects;
15 |
16 | /**
17 | *
18 | * @author sharapov
19 | *
20 | */
21 | public class BdioAnnotationNode implements IBdioNode {
22 |
23 | private String id;
24 |
25 | private String comment;
26 |
27 | public BdioAnnotationNode(String id, String comment) {
28 | this.id = id;
29 | this.comment = comment;
30 | }
31 |
32 | public String getId() {
33 | return id;
34 | }
35 |
36 | public String getComment() {
37 | return comment;
38 | }
39 |
40 | @Override
41 | public int hashCode() {
42 | return Objects.hash(getId(), getComment());
43 | }
44 |
45 | @Override
46 | public boolean equals(Object other) {
47 | if (this == other) {
48 | return true;
49 | } else if (other instanceof BdioAnnotationNode) {
50 | BdioAnnotationNode annotationNode = (BdioAnnotationNode) other;
51 | return Objects.equals(getId(), annotationNode.getId())
52 | && Objects.equals(getComment(), annotationNode.getComment());
53 | }
54 |
55 | return false;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/bdio-protobuf/src/main/java/com/blackducksoftware/bdio/proto/api/BdioBdbaFileNode.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Black Duck Software Inc.
3 | * http://www.blackducksoftware.com/
4 | * All rights reserved.
5 | *
6 | * This software is the confidential and proprietary information of
7 | * Black Duck Software ("Confidential Information"). You shall not
8 | * disclose such Confidential Information and shall use it only in
9 | * accordance with the terms of the license agreement you entered into
10 | * with Black Duck Software.
11 | */
12 | package com.blackducksoftware.bdio.proto.api;
13 |
14 | import java.time.Instant;
15 | import java.util.Map;
16 | import java.util.Objects;
17 | import java.util.Optional;
18 |
19 | import com.google.common.collect.ImmutableMap;
20 |
21 | /**
22 | *
23 | * @author sharapov
24 | *
25 | */
26 | public class BdioBdbaFileNode implements IBdioNode {
27 |
28 | private final String id;
29 |
30 | private final String uri;
31 |
32 | private final long size;
33 |
34 | private final Instant lastModifiedDateTime;
35 |
36 | private final String fileSystemType;
37 |
38 | private final Map signatures;
39 |
40 | public BdioBdbaFileNode(String id, String uri, long size, Instant lastModifiedDateTime, String fileSystemType,
41 | Map signatures) {
42 | this.id = id;
43 | this.uri = uri;
44 | this.size = size;
45 | this.lastModifiedDateTime = lastModifiedDateTime;
46 | this.fileSystemType = fileSystemType;
47 | this.signatures = (signatures == null) ? ImmutableMap.of() : ImmutableMap.copyOf(signatures);
48 | }
49 |
50 | public String getId() {
51 | return id;
52 | }
53 |
54 | public String getUri() {
55 | return uri;
56 | }
57 |
58 | public long getSize() {
59 | return size;
60 | }
61 |
62 | public Instant getLastModifiedDateTime() {
63 | return lastModifiedDateTime;
64 | }
65 |
66 | public Optional getFileSystemType() {
67 | return Optional.ofNullable(fileSystemType);
68 | }
69 |
70 | public Map getSignatures() {
71 | return signatures;
72 | }
73 |
74 | @Override
75 | public int hashCode() {
76 | return Objects.hash(getId(), getUri(), getSize(), getLastModifiedDateTime(),
77 | getFileSystemType(), getSignatures());
78 | }
79 |
80 | @Override
81 | public boolean equals(final Object other) {
82 | if (this == other) {
83 | return true;
84 | } else if (other instanceof BdioBdbaFileNode) {
85 | BdioBdbaFileNode bdbaFileNode = (BdioBdbaFileNode) other;
86 | return Objects.equals(getId(), bdbaFileNode.getId())
87 | && Objects.equals(getUri(), bdbaFileNode.getUri())
88 | && Objects.equals(getSize(), bdbaFileNode.getSize())
89 | && Objects.equals(getLastModifiedDateTime(), bdbaFileNode.getLastModifiedDateTime())
90 | && Objects.equals(getFileSystemType(), bdbaFileNode.getFileSystemType())
91 | && Objects.equals(getSignatures(), bdbaFileNode.getSignatures());
92 | }
93 |
94 | return false;
95 | }
96 |
97 | }
98 |
--------------------------------------------------------------------------------
/bdio-protobuf/src/main/java/com/blackducksoftware/bdio/proto/api/BdioComponentNode.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Synopsys Inc.
3 | * http://www.synopsys.com/
4 | * All rights reserved.
5 | *
6 | * This software is the confidential and proprietary information of
7 | * Synopsys ("Confidential Information"). You shall not
8 | * disclose such Confidential Information and shall use it only in
9 | * accordance with the terms of the license agreement you entered into
10 | * with Synopsys.
11 | */
12 | package com.blackducksoftware.bdio.proto.api;
13 |
14 | import java.util.Objects;
15 | import java.util.Optional;
16 |
17 | /**
18 | *
19 | * @author sharapov
20 | *
21 | */
22 | public class BdioComponentNode implements IBdioNode {
23 |
24 | private String id;
25 |
26 | private String namespace;
27 |
28 | private String identifier;
29 |
30 | private String descriptionId;
31 |
32 | public BdioComponentNode(String id, String namespace, String identifier, String descriptionId) {
33 | this.id = id;
34 | this.namespace = namespace;
35 | this.identifier = identifier;
36 | this.descriptionId = descriptionId;
37 | }
38 |
39 | public String getId() {
40 | return id;
41 | }
42 |
43 | public String getNamespace() {
44 | return namespace;
45 | }
46 |
47 | public String getIdentifier() {
48 | return identifier;
49 | }
50 |
51 | public Optional getDescriptionId() {
52 | return Optional.ofNullable(descriptionId);
53 | }
54 |
55 | @Override
56 | public int hashCode() {
57 | return Objects.hash(getId(), getNamespace(), getIdentifier(), getDescriptionId());
58 | }
59 |
60 | @Override
61 | public boolean equals(Object other) {
62 | if (this == other) {
63 | return true;
64 | } else if (other instanceof BdioComponentNode) {
65 | BdioComponentNode componentNode = (BdioComponentNode) other;
66 | return Objects.equals(getId(), componentNode.getId())
67 | && Objects.equals(getNamespace(), componentNode.getNamespace())
68 | && Objects.equals(getIdentifier(), componentNode.getIdentifier())
69 | && Objects.equals(getDescriptionId(), componentNode.getDescriptionId());
70 | }
71 |
72 | return false;
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/bdio-protobuf/src/main/java/com/blackducksoftware/bdio/proto/api/BdioContainerLayerNode.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Synopsys Inc.
3 | * http://www.synopsys.com/
4 | * All rights reserved.
5 | *
6 | * This software is the confidential and proprietary information of
7 | * Synopsys ("Confidential Information"). You shall not
8 | * disclose such Confidential Information and shall use it only in
9 | * accordance with the terms of the license agreement you entered into
10 | * with Synopsys.
11 | */
12 | package com.blackducksoftware.bdio.proto.api;
13 |
14 | import java.time.Instant;
15 | import java.util.Objects;
16 | import java.util.Optional;
17 |
18 | /**
19 | *
20 | * @author sharapov
21 | *
22 | */
23 | public class BdioContainerLayerNode implements IBdioNode {
24 |
25 | private String id;
26 |
27 | private String layer;
28 |
29 | private long size;
30 |
31 | private String command;
32 |
33 | private Instant createdAt;
34 |
35 | private String comment;
36 |
37 | public BdioContainerLayerNode(String id, String layer, long size, String command, Instant createdAt,
38 | String comment) {
39 | this.id = id;
40 | this.layer = layer;
41 | this.size = size;
42 | this.command = command;
43 | this.createdAt = createdAt;
44 | this.comment = comment;
45 | }
46 |
47 | public String getId() {
48 | return id;
49 | }
50 |
51 | public String getLayer() {
52 | return layer;
53 | }
54 |
55 | public long getSize() {
56 | return size;
57 | }
58 |
59 | public Optional getCommand() {
60 | return Optional.ofNullable(command);
61 | }
62 |
63 | public Optional getCreatedAt() {
64 | return Optional.ofNullable(createdAt);
65 | }
66 |
67 | public Optional getComment() {
68 | return Optional.ofNullable(comment);
69 | }
70 |
71 | @Override
72 | public int hashCode() {
73 | return Objects.hash(getId(), getLayer(), getSize(), getCommand(), getCreatedAt(), getComment());
74 | }
75 |
76 | @Override
77 | public boolean equals(Object other) {
78 | if (this == other) {
79 | return true;
80 | } else if (other instanceof BdioContainerLayerNode) {
81 | BdioContainerLayerNode containerLayerNode = (BdioContainerLayerNode) other;
82 | return getSize() == containerLayerNode.getSize() && Objects.equals(getId(), containerLayerNode.getId())
83 | && Objects.equals(getLayer(), containerLayerNode.getLayer())
84 | && Objects.equals(getCommand(), containerLayerNode.getCommand())
85 | && Objects.equals(getCreatedAt(), containerLayerNode.getCreatedAt())
86 | && Objects.equals(getComment(), containerLayerNode.getComment());
87 | }
88 |
89 | return false;
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/bdio-protobuf/src/main/java/com/blackducksoftware/bdio/proto/api/BdioDependencyNode.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Synopsys Inc.
3 | * http://www.synopsys.com/
4 | * All rights reserved.
5 | *
6 | * This software is the confidential and proprietary information of
7 | * Synopsys ("Confidential Information"). You shall not
8 | * disclose such Confidential Information and shall use it only in
9 | * accordance with the terms of the license agreement you entered into
10 | * with Synopsys.
11 | */
12 | package com.blackducksoftware.bdio.proto.api;
13 |
14 | import java.util.List;
15 | import java.util.Objects;
16 | import java.util.Optional;
17 |
18 | import com.google.common.collect.ImmutableList;
19 |
20 | /**
21 | *
22 | * @author sharapov
23 | *
24 | */
25 | public class BdioDependencyNode implements IBdioNode {
26 |
27 | private String componentId;
28 |
29 | private String evidenceId;
30 |
31 | private String containerLayer;
32 |
33 | private String whiteoutLayer;
34 |
35 | private String descriptionId;
36 |
37 | private List matchTypes;
38 |
39 | public BdioDependencyNode(String componentId, String evidenceId, String containerLayer, String whiteoutLayer,
40 | String descriptionId, List matchTypes) {
41 | this.componentId = componentId;
42 | this.evidenceId = evidenceId;
43 | this.containerLayer = containerLayer;
44 | this.whiteoutLayer = whiteoutLayer;
45 | this.descriptionId = descriptionId;
46 | this.matchTypes = ImmutableList.copyOf(matchTypes);
47 | }
48 |
49 | public String getComponentId() {
50 | return componentId;
51 | }
52 |
53 | public Optional getEvidenceId() {
54 | return Optional.ofNullable(evidenceId);
55 | }
56 |
57 | public Optional getContainerLayer() {
58 | return Optional.ofNullable(containerLayer);
59 | }
60 |
61 | public Optional getWhiteoutLayer() {
62 | return Optional.ofNullable(whiteoutLayer);
63 | }
64 |
65 | public Optional getDescriptionId() {
66 | return Optional.ofNullable(descriptionId);
67 | }
68 |
69 | public List getMatchTypes() {
70 | return matchTypes;
71 | }
72 |
73 | @Override
74 | public int hashCode() {
75 | return Objects.hash(getComponentId(), getEvidenceId(), getContainerLayer(), getWhiteoutLayer(),
76 | getDescriptionId(), getMatchTypes());
77 | }
78 |
79 | @Override
80 | public boolean equals(final Object other) {
81 | if (this == other) {
82 | return true;
83 | } else if (other instanceof BdioDependencyNode) {
84 | BdioDependencyNode dependencyNode = (BdioDependencyNode) other;
85 | return Objects.equals(getComponentId(), dependencyNode.getComponentId())
86 | && Objects.equals(getEvidenceId(), dependencyNode.getEvidenceId())
87 | && Objects.equals(getContainerLayer(), dependencyNode.getContainerLayer())
88 | && Objects.equals(getWhiteoutLayer(), dependencyNode.getWhiteoutLayer())
89 | && Objects.equals(getDescriptionId(), dependencyNode.getDescriptionId())
90 | && Objects.equals(getMatchTypes(), dependencyNode.getMatchTypes());
91 | }
92 |
93 | return false;
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/bdio-protobuf/src/main/java/com/blackducksoftware/bdio/proto/api/BdioValidationException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Synopsys Inc.
3 | * http://www.synopsys.com/
4 | * All rights reserved.
5 | *
6 | * This software is the confidential and proprietary information of
7 | * Synopsys ("Confidential Information"). You shall not
8 | * disclose such Confidential Information and shall use it only in
9 | * accordance with the terms of the license agreement you entered into
10 | * with Synopsys.
11 | */
12 | package com.blackducksoftware.bdio.proto.api;
13 |
14 | /**
15 | *
16 | * @author sharapov
17 | *
18 | */
19 | public class BdioValidationException extends RuntimeException {
20 |
21 | private static final long serialVersionUID = 3528312351351639125L;
22 |
23 | public BdioValidationException(String message) {
24 | super(message);
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/bdio-protobuf/src/main/java/com/blackducksoftware/bdio/proto/api/IBdioNode.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Synopsys Inc.
3 | * http://www.synopsys.com/
4 | * All rights reserved.
5 | *
6 | * This software is the confidential and proprietary information of
7 | * Synopsys ("Confidential Information"). You shall not
8 | * disclose such Confidential Information and shall use it only in
9 | * accordance with the terms of the license agreement you entered into
10 | * with Synopsys.
11 | */
12 | package com.blackducksoftware.bdio.proto.api;
13 |
14 | /**
15 | * Marker interface for all bdio data classes that can be serialized
16 | *
17 | * @author sharapov
18 | *
19 | */
20 | public interface IBdioNode {
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/bdio-protobuf/src/main/java/com/blackducksoftware/bdio/proto/api/IProtobufBdioValidator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Synopsys Inc.
3 | * http://www.synopsys.com/
4 | * All rights reserved.
5 | *
6 | * This software is the confidential and proprietary information of
7 | * Synopsys ("Confidential Information"). You shall not
8 | * disclose such Confidential Information and shall use it only in
9 | * accordance with the terms of the license agreement you entered into
10 | * with Synopsys.
11 | */
12 | package com.blackducksoftware.bdio.proto.api;
13 |
14 | import com.google.protobuf.Message;
15 |
16 | /**
17 | * Api for validation of protobuf message before serialization or after deserialization
18 | *
19 | * @author sharapov
20 | *
21 | */
22 | public interface IProtobufBdioValidator {
23 |
24 | /**
25 | * Validate single protobuf data node
26 | *
27 | * @param message
28 | * node to validate
29 | * @throws BdioValidationException
30 | */
31 | void validate(Message message);
32 | }
33 |
--------------------------------------------------------------------------------
/bdio-protobuf/src/main/java/com/blackducksoftware/bdio/proto/api/IProtobufBdioVersionReader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Synopsys Inc.
3 | * http://www.synopsys.com/
4 | * All rights reserved.
5 | *
6 | * This software is the confidential and proprietary information of
7 | * Synopsys ("Confidential Information"). You shall not
8 | * disclose such Confidential Information and shall use it only in
9 | * accordance with the terms of the license agreement you entered into
10 | * with Synopsys.
11 | */
12 | package com.blackducksoftware.bdio.proto.api;
13 |
14 | import java.io.IOException;
15 | import java.io.InputStream;
16 |
17 | import com.blackducksoftware.bdio.proto.domain.ProtoChunk;
18 | import com.blackducksoftware.bdio.proto.domain.ProtoScanHeader;
19 |
20 | /**
21 | * Api for reading bdio data
22 | *
23 | * @author sharapov
24 | *
25 | */
26 | public interface IProtobufBdioVersionReader {
27 |
28 | /**
29 | * Reads header chunk represented by input stream
30 | *
31 | * @param in
32 | * input stream
33 | * @return ProtoScanHeader
34 | * @throws IOException
35 | */
36 | ProtoScanHeader readHeaderChunk(InputStream in) throws IOException;
37 |
38 | /**
39 | * Reads the bdio entry (chunk) represented by input stream.
40 | *
41 | * @param in
42 | * input stream
43 | * @return ProtoChunk deserialized bdio entry (chunk)
44 | * @throws IOException
45 | */
46 | ProtoChunk readProtoChunk(InputStream in) throws IOException;
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/bdio-protobuf/src/main/java/com/blackducksoftware/bdio/proto/api/IProtobufBdioVersionWriter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Synopsys Inc.
3 | * http://www.synopsys.com/
4 | * All rights reserved.
5 | *
6 | * This software is the confidential and proprietary information of
7 | * Synopsys ("Confidential Information"). You shall not
8 | * disclose such Confidential Information and shall use it only in
9 | * accordance with the terms of the license agreement you entered into
10 | * with Synopsys.
11 | */
12 | package com.blackducksoftware.bdio.proto.api;
13 |
14 | import java.io.IOException;
15 | import java.util.zip.ZipOutputStream;
16 |
17 | import com.google.protobuf.Message;
18 |
19 | /**
20 | * Api for writing bdio data
21 | *
22 | * @author sharapov
23 | *
24 | */
25 | public interface IProtobufBdioVersionWriter {
26 |
27 | /**
28 | * Write header data to bdio header in provided zip archive stream
29 | *
30 | * @param bdioArchive
31 | * @param header
32 | * @throws IOException
33 | */
34 | void writeToHeader(ZipOutputStream bdioArchive, Message header) throws IOException;
35 |
36 | /**
37 | * Write node to bdio entry in provided zip archive stream
38 | *
39 | * @param bdioArchive
40 | * @param node
41 | * @throws IOException
42 | */
43 | void writeToEntry(ZipOutputStream bdioArchive, Message node) throws IOException;
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/bdio-protobuf/src/main/java/com/blackducksoftware/bdio/proto/impl/AbstractProtobufBdioVersionReader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Black Duck Software Inc.
3 | * http://www.blackducksoftware.com/
4 | * All rights reserved.
5 | *
6 | * This software is the confidential and proprietary information of
7 | * Black Duck Software ("Confidential Information"). You shall not
8 | * disclose such Confidential Information and shall use it only in
9 | * accordance with the terms of the license agreement you entered into
10 | * with Black Duck Software.
11 | */
12 | package com.blackducksoftware.bdio.proto.impl;
13 |
14 | import java.io.IOException;
15 | import java.io.InputStream;
16 | import java.util.List;
17 | import java.util.Objects;
18 | import java.util.Optional;
19 |
20 | import com.blackducksoftware.bdio.proto.api.IProtobufBdioValidator;
21 | import com.blackducksoftware.bdio.proto.api.IProtobufBdioVersionReader;
22 | import com.blackducksoftware.bdio.proto.domain.ProtoChunk;
23 | import com.blackducksoftware.bdio.proto.domain.ProtoScanHeader;
24 | import com.google.protobuf.Any;
25 | import com.google.protobuf.Message;
26 |
27 | /**
28 | * Abstract protobuf bdio reader
29 | *
30 | * @author sharapov
31 | *
32 | */
33 | public abstract class AbstractProtobufBdioVersionReader implements IProtobufBdioVersionReader {
34 |
35 | protected final IProtobufBdioValidator validator;
36 |
37 | public AbstractProtobufBdioVersionReader(IProtobufBdioValidator validator) {
38 | this.validator = Objects.requireNonNull(validator);
39 | }
40 |
41 | /**
42 | * Get list of message type classes representing data model for specific version
43 | *
44 | * @return List>
45 | */
46 | abstract List> getClassesList();
47 |
48 | @Override
49 | public ProtoScanHeader readHeaderChunk(InputStream in) throws IOException {
50 | Any any = Any.parseFrom(in);
51 | if (any.is(ProtoScanHeader.class)) {
52 | return any.unpack(ProtoScanHeader.class);
53 | }
54 |
55 | throw new RuntimeException("Unknown type for header data: " + any.getTypeUrl());
56 | }
57 |
58 | @Override
59 | public ProtoChunk readProtoChunk(InputStream in) throws IOException {
60 | ProtoChunkBuilder protoChunkBuilder = new ProtoChunkBuilder();
61 |
62 | while (true) {
63 | Any any = Any.parseDelimitedFrom(in);
64 |
65 | if (any == null) {
66 | // the end of the steam
67 | break;
68 | }
69 |
70 | Optional> clz = getClassesList().stream()
71 | .filter(cl -> any.is(cl)).findFirst();
72 |
73 | if (clz.isEmpty()) {
74 | throw new RuntimeException("Object of unknown class is found: " + any.getTypeUrl());
75 | }
76 |
77 | Message message = any.unpack(clz.get());
78 | validator.validate(message);
79 | protoChunkBuilder.add(message);
80 | }
81 |
82 | return protoChunkBuilder.build();
83 | }
84 |
85 | }
86 |
--------------------------------------------------------------------------------
/bdio-protobuf/src/main/java/com/blackducksoftware/bdio/proto/impl/AbstractProtobufBdioVersionWriter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Black Duck Software Inc.
3 | * http://www.blackducksoftware.com/
4 | * All rights reserved.
5 | *
6 | * This software is the confidential and proprietary information of
7 | * Black Duck Software ("Confidential Information"). You shall not
8 | * disclose such Confidential Information and shall use it only in
9 | * accordance with the terms of the license agreement you entered into
10 | * with Black Duck Software.
11 | */
12 | package com.blackducksoftware.bdio.proto.impl;
13 |
14 | import java.io.IOException;
15 | import java.util.Objects;
16 | import java.util.zip.ZipEntry;
17 | import java.util.zip.ZipOutputStream;
18 |
19 | import com.blackducksoftware.bdio.proto.BdioConstants;
20 | import com.blackducksoftware.bdio.proto.BdioEntryType;
21 | import com.blackducksoftware.bdio.proto.api.IProtobufBdioValidator;
22 | import com.blackducksoftware.bdio.proto.api.IProtobufBdioVersionWriter;
23 | import com.google.common.primitives.Shorts;
24 | import com.google.protobuf.Message;
25 |
26 | /**
27 | * Provides common methods for writing bdio data
28 | *
29 | * @author sharapov
30 | *
31 | */
32 | public abstract class AbstractProtobufBdioVersionWriter implements IProtobufBdioVersionWriter {
33 |
34 | private long bytesRemaining = 0L;
35 |
36 | private int entryCount = 0;
37 |
38 | protected final IProtobufBdioValidator validator;
39 |
40 | public AbstractProtobufBdioVersionWriter(IProtobufBdioValidator validator) {
41 | this.validator = Objects.requireNonNull(validator);
42 | }
43 |
44 | protected abstract short getVersion();
45 |
46 | protected abstract void writeHeaderNode(ZipOutputStream bdioArchive, Message header) throws IOException;
47 |
48 | protected abstract void writeDataNode(ZipOutputStream bdioArchive, Message protoNode) throws IOException;
49 |
50 | @Override
51 | public void writeToHeader(ZipOutputStream bdioArchive, Message header) throws IOException {
52 | bdioArchive.putNextEntry(new ZipEntry(BdioConstants.HEADER_FILE_NAME));
53 | bdioArchive.write(Shorts.toByteArray((short) BdioEntryType.HEADER.ordinal())); // bdio entry type
54 | bdioArchive.write(Shorts.toByteArray(getVersion())); // format version
55 |
56 | writeHeaderNode(bdioArchive, header);
57 | }
58 |
59 | @Override
60 | public void writeToEntry(ZipOutputStream bdioArchive, Message protoNode) throws IOException {
61 | boolean newEntry = (bytesRemaining - protoNode.getSerializedSize() - 4) <= 0;
62 | bytesRemaining = newEntry ? BdioConstants.MAX_CHUNK_SIZE : bytesRemaining; // reset remaining bytes for new
63 | // entry
64 | bytesRemaining -= protoNode.getSerializedSize() + 4;
65 |
66 | if (newEntry) {
67 | createNewArchiveEntry(bdioArchive);
68 | entryCount++;
69 | }
70 |
71 | validator.validate(protoNode);
72 |
73 | writeDataNode(bdioArchive, protoNode);
74 | }
75 |
76 | private void createNewArchiveEntry(ZipOutputStream bdioArchive) throws IOException {
77 | bdioArchive.putNextEntry(new ZipEntry(String.format(BdioConstants.ENTRY_FILE_NAME_TEMPLATE, entryCount)));
78 | bdioArchive.write(Shorts.toByteArray((short) BdioEntryType.CHUNK.ordinal())); // bdio entry type
79 | bdioArchive.write(Shorts.toByteArray(getVersion())); // format version
80 | }
81 |
82 | }
83 |
--------------------------------------------------------------------------------
/bdio-protobuf/src/main/java/com/blackducksoftware/bdio/proto/impl/ProtoChunkBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Black Duck Software Inc.
3 | * http://www.blackducksoftware.com/
4 | * All rights reserved.
5 | *
6 | * This software is the confidential and proprietary information of
7 | * Black Duck Software ("Confidential Information"). You shall not
8 | * disclose such Confidential Information and shall use it only in
9 | * accordance with the terms of the license agreement you entered into
10 | * with Black Duck Software.
11 | */
12 | package com.blackducksoftware.bdio.proto.impl;
13 |
14 | import java.util.HashSet;
15 | import java.util.Set;
16 |
17 | import com.blackducksoftware.bdio.proto.domain.ProtoAnnotationNode;
18 | import com.blackducksoftware.bdio.proto.domain.ProtoBdbaFileNode;
19 | import com.blackducksoftware.bdio.proto.domain.ProtoChunk;
20 | import com.blackducksoftware.bdio.proto.domain.ProtoComponentNode;
21 | import com.blackducksoftware.bdio.proto.domain.ProtoContainerLayerNode;
22 | import com.blackducksoftware.bdio.proto.domain.ProtoContainerNode;
23 | import com.blackducksoftware.bdio.proto.domain.ProtoDependencyNode;
24 | import com.blackducksoftware.bdio.proto.domain.ProtoFileNode;
25 | import com.google.protobuf.Message;
26 |
27 | /**
28 | * Builder for bdio chunk
29 | *
30 | * @author sharapov
31 | *
32 | */
33 | public class ProtoChunkBuilder {
34 |
35 | private final Set fileNodes = new HashSet<>();
36 |
37 | private final Set dependencyNodes = new HashSet<>();
38 |
39 | private final Set componentNodes = new HashSet<>();
40 |
41 | private final Set annotationNodes = new HashSet<>();
42 |
43 | private final Set containerNodes = new HashSet<>();
44 |
45 | private final Set containerLayerNodes = new HashSet<>();
46 |
47 | private final Set bdbaFileNodes = new HashSet<>();
48 |
49 | public ProtoChunkBuilder add(Message node) {
50 | if (node instanceof ProtoDependencyNode) {
51 | dependencyNodes.add((ProtoDependencyNode) node);
52 | } else if (node instanceof ProtoComponentNode) {
53 | componentNodes.add((ProtoComponentNode) node);
54 | } else if (node instanceof ProtoFileNode) {
55 | fileNodes.add((ProtoFileNode) node);
56 | } else if (node instanceof ProtoAnnotationNode) {
57 | annotationNodes.add((ProtoAnnotationNode) node);
58 | } else if (node instanceof ProtoContainerNode) {
59 | containerNodes.add((ProtoContainerNode) node);
60 | } else if (node instanceof ProtoContainerLayerNode) {
61 | containerLayerNodes.add((ProtoContainerLayerNode) node);
62 | } else if (node instanceof ProtoBdbaFileNode) {
63 | bdbaFileNodes.add((ProtoBdbaFileNode) node);
64 | } else {
65 | throw new RuntimeException("Unknown type: " + node.getClass().getName());
66 | }
67 |
68 | return this;
69 | }
70 |
71 | public ProtoChunk build() {
72 | return new ProtoChunk(
73 | fileNodes,
74 | dependencyNodes,
75 | componentNodes,
76 | annotationNodes,
77 | containerNodes,
78 | containerLayerNodes,
79 | bdbaFileNodes);
80 | }
81 |
82 | }
83 |
--------------------------------------------------------------------------------
/bdio-protobuf/src/main/java/com/blackducksoftware/bdio/proto/impl/ProtobufBdioServiceProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Black Duck Software Inc.
3 | * http://www.blackducksoftware.com/
4 | * All rights reserved.
5 | *
6 | * This software is the confidential and proprietary information of
7 | * Black Duck Software ("Confidential Information"). You shall not
8 | * disclose such Confidential Information and shall use it only in
9 | * accordance with the terms of the license agreement you entered into
10 | * with Black Duck Software.
11 | */
12 | package com.blackducksoftware.bdio.proto.impl;
13 |
14 | import java.util.HashMap;
15 | import java.util.Map;
16 |
17 | import com.blackducksoftware.bdio.proto.BdioConstants;
18 | import com.blackducksoftware.bdio.proto.api.IProtobufBdioValidator;
19 | import com.blackducksoftware.bdio.proto.api.IProtobufBdioVersionReader;
20 | import com.blackducksoftware.bdio.proto.api.IProtobufBdioVersionWriter;
21 |
22 | /**
23 | * Provides service for specific version
24 | *
25 | * @author sharapov
26 | *
27 | */
28 | public class ProtobufBdioServiceProvider {
29 |
30 | private final Map protobufValidators = new HashMap<>();
31 |
32 | private final Map protobufReaders = new HashMap<>();
33 |
34 | private final Map protobufWriters = new HashMap<>();
35 |
36 | public ProtobufBdioServiceProvider() {
37 |
38 | ProtobufBdioV1Validator v1Validator = new ProtobufBdioV1Validator();
39 | ProtobufBdioV1Reader v1Reader = new ProtobufBdioV1Reader(v1Validator);
40 | IProtobufBdioVersionWriter v1Writer = new ProtobufBdioV1Writer(v1Validator);
41 |
42 | protobufValidators.put(BdioConstants.VERSION_1, v1Validator);
43 | protobufReaders.put(BdioConstants.VERSION_1, v1Reader);
44 | protobufWriters.put(BdioConstants.VERSION_1, v1Writer);
45 |
46 | ProtobufBdioV2Validator v2Validator = new ProtobufBdioV2Validator();
47 | ProtobufBdioV2Reader v2Reader = new ProtobufBdioV2Reader(v2Validator);
48 | IProtobufBdioVersionWriter v2Writer = new ProtobufBdioV2Writer(v2Validator);
49 |
50 | protobufValidators.put(BdioConstants.VERSION_2, v2Validator);
51 | protobufReaders.put(BdioConstants.VERSION_2, v2Reader);
52 | protobufWriters.put(BdioConstants.VERSION_2, v2Writer);
53 |
54 | }
55 |
56 | public IProtobufBdioValidator getProtobufBdioValidator(short version) {
57 |
58 | IProtobufBdioValidator validator = protobufValidators.get(version);
59 |
60 | if (validator == null) {
61 | throw new RuntimeException("Unknow version is detected: " + version);
62 | }
63 |
64 | return validator;
65 | }
66 |
67 | public IProtobufBdioVersionReader getProtobufBdioReader(short version) {
68 |
69 | IProtobufBdioVersionReader reader = protobufReaders.get(version);
70 |
71 | if (reader == null) {
72 | throw new RuntimeException("Unknow version is detected: " + version);
73 | }
74 |
75 | return reader;
76 | }
77 |
78 | public IProtobufBdioVersionWriter getProtobufBdioWriter(short version) {
79 |
80 | IProtobufBdioVersionWriter writer = protobufWriters.get(version);
81 |
82 | if (writer == null) {
83 | throw new RuntimeException("Unknow version is detected: " + version);
84 | }
85 |
86 | return writer;
87 | }
88 |
89 | }
90 |
--------------------------------------------------------------------------------
/bdio-protobuf/src/main/java/com/blackducksoftware/bdio/proto/impl/ProtobufBdioV1Reader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Black Duck Software Inc.
3 | * http://www.blackducksoftware.com/
4 | * All rights reserved.
5 | *
6 | * This software is the confidential and proprietary information of
7 | * Black Duck Software ("Confidential Information"). You shall not
8 | * disclose such Confidential Information and shall use it only in
9 | * accordance with the terms of the license agreement you entered into
10 | * with Black Duck Software.
11 | */
12 | package com.blackducksoftware.bdio.proto.impl;
13 |
14 | import java.io.IOException;
15 | import java.io.InputStream;
16 | import java.util.HashSet;
17 | import java.util.List;
18 | import java.util.Set;
19 |
20 | import com.blackducksoftware.bdio.proto.api.IProtobufBdioValidator;
21 | import com.blackducksoftware.bdio.proto.domain.ProtoChunk;
22 | import com.blackducksoftware.bdio.proto.domain.ProtoFileNode;
23 | import com.blackducksoftware.bdio.proto.domain.ProtoScanHeader;
24 | import com.google.common.collect.ImmutableList;
25 |
26 | /**
27 | * Reads the protobuf bdio data of version 1
28 | *
29 | * @author sharapov
30 | *
31 | */
32 | public class ProtobufBdioV1Reader extends AbstractProtobufBdioVersionReader {
33 |
34 | public ProtobufBdioV1Reader(IProtobufBdioValidator validator) {
35 | super(validator);
36 | }
37 |
38 | @Override
39 | public ProtoScanHeader readHeaderChunk(InputStream in) throws IOException {
40 | return ProtoScanHeader.parseFrom(in);
41 | }
42 |
43 | @Override
44 | public List> getClassesList() {
45 | return ImmutableList.of(ProtoFileNode.class);
46 | }
47 |
48 | @Override
49 | public ProtoChunk readProtoChunk(InputStream in) throws IOException {
50 | Set fileNodes = new HashSet<>();
51 |
52 | ProtoFileNode node;
53 |
54 | // in version 1 only file nodes may be present
55 | while ((node = ProtoFileNode.parseDelimitedFrom(in)) != null) {
56 | validator.validate(node);
57 | fileNodes.add(node);
58 | }
59 |
60 | return new ProtoChunk(fileNodes);
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/bdio-protobuf/src/main/java/com/blackducksoftware/bdio/proto/impl/ProtobufBdioV1Validator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Black Duck Software Inc.
3 | * http://www.blackducksoftware.com/
4 | * All rights reserved.
5 | *
6 | * This software is the confidential and proprietary information of
7 | * Black Duck Software ("Confidential Information"). You shall not
8 | * disclose such Confidential Information and shall use it only in
9 | * accordance with the terms of the license agreement you entered into
10 | * with Black Duck Software.
11 | */
12 | package com.blackducksoftware.bdio.proto.impl;
13 |
14 | import com.blackducksoftware.bdio.proto.api.BdioValidationException;
15 | import com.blackducksoftware.bdio.proto.domain.ProtoFileNode;
16 | import com.google.protobuf.Message;
17 |
18 | /**
19 | * Validate version 1 bdio data
20 | *
21 | * @author sharapov
22 | *
23 | */
24 | public class ProtobufBdioV1Validator extends AbstractProtobufBdioValidator {
25 |
26 | @Override
27 | public void validate(Message message) {
28 | if (message instanceof ProtoFileNode) {
29 | validate((ProtoFileNode) message);
30 | } else {
31 | throw new BdioValidationException("Unknown message type in version 1: " + message.getClass().getName());
32 | }
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/bdio-protobuf/src/main/java/com/blackducksoftware/bdio/proto/impl/ProtobufBdioV1Writer.java:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | * Copyright (C) 2023 Black Duck Software Inc.
4 | * http://www.blackducksoftware.com/
5 | * All rights reserved.
6 | *
7 | * This software is the confidential and proprietary information of
8 | * Black Duck Software ("Confidential Information"). You shall not
9 | * disclose such Confidential Information and shall use it only in
10 | * accordance with the terms of the license agreement you entered into
11 | * with Black Duck Software.
12 | */
13 | package com.blackducksoftware.bdio.proto.impl;
14 |
15 | import java.io.IOException;
16 | import java.util.zip.ZipOutputStream;
17 |
18 | import com.blackducksoftware.bdio.proto.BdioConstants;
19 | import com.blackducksoftware.bdio.proto.api.IProtobufBdioValidator;
20 | import com.google.protobuf.Message;
21 |
22 | /**
23 | * Implements methods to write version 1 bdio data
24 | *
25 | * @author sharapov
26 | *
27 | */
28 | public class ProtobufBdioV1Writer extends AbstractProtobufBdioVersionWriter {
29 |
30 | public ProtobufBdioV1Writer(IProtobufBdioValidator validator) {
31 | super(validator);
32 | }
33 |
34 | @Override
35 | public short getVersion() {
36 | return BdioConstants.VERSION_1;
37 | }
38 |
39 | @Override
40 | protected void writeHeaderNode(ZipOutputStream bdioArchive, Message header) throws IOException {
41 | header.writeTo(bdioArchive);
42 | }
43 |
44 | @Override
45 | public void writeDataNode(ZipOutputStream bdioArchive, Message node) throws IOException {
46 | node.writeDelimitedTo(bdioArchive);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/bdio-protobuf/src/main/java/com/blackducksoftware/bdio/proto/impl/ProtobufBdioV2Reader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Black Duck Software Inc.
3 | * http://www.blackducksoftware.com/
4 | * All rights reserved.
5 | *
6 | * This software is the confidential and proprietary information of
7 | * Black Duck Software ("Confidential Information"). You shall not
8 | * disclose such Confidential Information and shall use it only in
9 | * accordance with the terms of the license agreement you entered into
10 | * with Black Duck Software.
11 | */
12 | package com.blackducksoftware.bdio.proto.impl;
13 |
14 | import java.util.List;
15 |
16 | import com.blackducksoftware.bdio.proto.api.IProtobufBdioValidator;
17 | import com.blackducksoftware.bdio.proto.domain.ProtoAnnotationNode;
18 | import com.blackducksoftware.bdio.proto.domain.ProtoBdbaFileNode;
19 | import com.blackducksoftware.bdio.proto.domain.ProtoComponentNode;
20 | import com.blackducksoftware.bdio.proto.domain.ProtoContainerLayerNode;
21 | import com.blackducksoftware.bdio.proto.domain.ProtoContainerNode;
22 | import com.blackducksoftware.bdio.proto.domain.ProtoDependencyNode;
23 | import com.blackducksoftware.bdio.proto.domain.ProtoFileNode;
24 | import com.google.common.collect.ImmutableList;
25 | import com.google.protobuf.Message;
26 |
27 | /**
28 | * Reads the protobuf bdio data of version 2
29 | *
30 | * @author sharapov
31 | *
32 | */
33 | public class ProtobufBdioV2Reader extends AbstractProtobufBdioVersionReader {
34 |
35 | public ProtobufBdioV2Reader(IProtobufBdioValidator validator) {
36 | super(validator);
37 | }
38 |
39 | @Override
40 | public List> getClassesList() {
41 | return ImmutableList.of(
42 | ProtoDependencyNode.class,
43 | ProtoComponentNode.class,
44 | ProtoFileNode.class,
45 | ProtoAnnotationNode.class,
46 | ProtoContainerNode.class,
47 | ProtoContainerLayerNode.class,
48 | ProtoBdbaFileNode.class);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/bdio-protobuf/src/main/java/com/blackducksoftware/bdio/proto/impl/ProtobufBdioV2Validator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Black Duck Software Inc.
3 | * http://www.blackducksoftware.com/
4 | * All rights reserved.
5 | *
6 | * This software is the confidential and proprietary information of
7 | * Black Duck Software ("Confidential Information"). You shall not
8 | * disclose such Confidential Information and shall use it only in
9 | * accordance with the terms of the license agreement you entered into
10 | * with Black Duck Software.
11 | */
12 | package com.blackducksoftware.bdio.proto.impl;
13 |
14 | import com.blackducksoftware.bdio.proto.domain.ProtoAnnotationNode;
15 | import com.blackducksoftware.bdio.proto.domain.ProtoBdbaFileNode;
16 | import com.blackducksoftware.bdio.proto.domain.ProtoComponentNode;
17 | import com.blackducksoftware.bdio.proto.domain.ProtoContainerLayerNode;
18 | import com.blackducksoftware.bdio.proto.domain.ProtoContainerNode;
19 | import com.blackducksoftware.bdio.proto.domain.ProtoDependencyNode;
20 | import com.blackducksoftware.bdio.proto.domain.ProtoFileNode;
21 | import com.google.protobuf.Message;
22 |
23 | /**
24 | * Validate version 2 bdio data
25 | *
26 | * @author sharapov
27 | *
28 | */
29 | public class ProtobufBdioV2Validator extends AbstractProtobufBdioValidator {
30 |
31 | @Override
32 | public void validate(Message message) {
33 |
34 | if (message instanceof ProtoDependencyNode) {
35 | validate((ProtoDependencyNode) message);
36 | } else if (message instanceof ProtoComponentNode) {
37 | validate((ProtoComponentNode) message);
38 | } else if (message instanceof ProtoFileNode) {
39 | validate((ProtoFileNode) message);
40 | } else if (message instanceof ProtoAnnotationNode) {
41 | validate((ProtoAnnotationNode) message);
42 | } else if (message instanceof ProtoContainerNode) {
43 | validate((ProtoContainerNode) message);
44 | } else if (message instanceof ProtoContainerLayerNode) {
45 | validate((ProtoContainerLayerNode) message);
46 | } else if (message instanceof ProtoBdbaFileNode) {
47 | validate((ProtoBdbaFileNode) message);
48 | } else {
49 | throw new RuntimeException("Unknown type: " + message.getClass().getName());
50 | }
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/bdio-protobuf/src/main/java/com/blackducksoftware/bdio/proto/impl/ProtobufBdioV2Writer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Black Duck Software Inc.
3 | * http://www.blackducksoftware.com/
4 | * All rights reserved.
5 | *
6 | * This software is the confidential and proprietary information of
7 | * Black Duck Software ("Confidential Information"). You shall not
8 | * disclose such Confidential Information and shall use it only in
9 | * accordance with the terms of the license agreement you entered into
10 | * with Black Duck Software.
11 | */
12 | package com.blackducksoftware.bdio.proto.impl;
13 |
14 | import java.io.IOException;
15 | import java.util.zip.ZipOutputStream;
16 |
17 | import com.blackducksoftware.bdio.proto.BdioConstants;
18 | import com.blackducksoftware.bdio.proto.api.IProtobufBdioValidator;
19 | import com.google.protobuf.Any;
20 | import com.google.protobuf.Message;
21 |
22 | /**
23 | * Implements methods to write version 2 bdio data
24 | *
25 | * @author sharapov
26 | *
27 | */
28 | public class ProtobufBdioV2Writer extends AbstractProtobufBdioVersionWriter {
29 |
30 | public ProtobufBdioV2Writer(IProtobufBdioValidator validator) {
31 | super(validator);
32 | }
33 |
34 | @Override
35 | protected short getVersion() {
36 | return BdioConstants.VERSION_2;
37 | }
38 |
39 | @Override
40 | protected void writeHeaderNode(ZipOutputStream bdioArchive, Message header) throws IOException {
41 | Any any = Any.pack(header);
42 | any.writeTo(bdioArchive);
43 | }
44 |
45 | @Override
46 | public void writeDataNode(ZipOutputStream bdioArchive, Message node) throws IOException {
47 | Any any = Any.pack(node);
48 | any.writeDelimitedTo(bdioArchive);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/bdio-protobuf/src/main/proto/file_node_v1.proto:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 Synopsys Inc.
3 | * http://www.synopsys.com/
4 | * All rights reserved.
5 | *
6 | * This software is the confidential and proprietary information of
7 | * Synopsys ("Confidential Information"). You shall not
8 | * disclose such Confidential Information and shall use it only in
9 | * accordance with the terms of the license agreement you entered into
10 | * with Synopsys.
11 | */
12 | syntax = "proto3";
13 |
14 | package bdio.v1;
15 |
16 | option java_multiple_files = true;
17 | option java_package = "com.blackducksoftware.bdio.proto.domain";
18 | option java_outer_classname = "FileNodeProto";
19 |
20 | /**
21 | * See here for guidelines on avoiding breaking changes to message formats: https://developers.google.com/protocol-buffers/docs/proto#updating
22 | * If those are not possible, or the message is sufficiently different, a new version should be created.
23 | */
24 | message ProtoFileNode {
25 |
26 | // The numeric ID of this file node.
27 | int64 id = 1;
28 |
29 | // The full URI of this file.
30 | // Example: file:///Users/hjoe/dev/bdio/bdio-reactor/src/test/java/com/blackducksoftware/bdio2
31 | string uri = 2;
32 |
33 | // The path to this file relative to the root node of this scan.
34 | // Example: bdio-reactor/src/test/java/com/blackducksoftware/bdio2/
35 | string path = 3;
36 |
37 | // The name of this file/directory/archive.
38 | // Example: bdio2
39 | string name = 4;
40 |
41 | // The size of this file in bytes.
42 | int64 size = 5;
43 |
44 | // The file system type of this node.
45 | // See com.blackducksoftware.scan.api.NodeType for possible values.
46 | string file_system_type = 6;
47 |
48 | // The ID of this node's parent. Root node does not have parent, but in this case parent id is set to -1
49 | int64 parent_id = 7;
50 |
51 | // The path of archive that this file is contained in, if any. Archive context is not set for file nodes
52 | // that are present outside the context of any archive
53 | // Example: gradle/wrapper/gradle-wrapper.jar!/
54 | optional string archive_context = 8;
55 |
56 | // The number of directories that are immediate children of this node. This is not set for usual files,
57 | // since they don't have any children.
58 | optional int64 shallow_directory_count = 9;
59 |
60 | // The number of all directories that are descendents of this node. This is not set for usual files,
61 | // since they don't have any children.
62 | optional int64 deep_directory_count = 10;
63 |
64 | // The number of all files that are descendents of this node. This is not set for usual files,
65 | // since they don't have any children.
66 | optional int64 deep_file_count = 11;
67 |
68 | // The distance from the root node of this scan
69 | optional int64 distance_from_root = 12;
70 |
71 | // The distance from the inner root
72 | optional int64 distance_from_inner_root = 13;
73 |
74 | // A map of signature type to signature value for all signatures generated for this node.
75 | // Signature type key must be in the interval [0,6] (inclusive), with the following meaning:
76 | // 0 - sha1 signature
77 | // 1 - clean sha1 signature
78 | // 2 - deep with size signature
79 | // 3 - deep no size signature
80 | // 4 - structure only signature
81 | // 5 - shallow with size
82 | // 6 - shallow no size
83 | map signatures = 14;
84 | }
85 |
--------------------------------------------------------------------------------
/bdio-protobuf/src/test/resources/scan_data/dummy.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blackducksoftware/bdio/cb631d8b49b992d9ad73a9d3e5262d8c7b789901/bdio-protobuf/src/test/resources/scan_data/dummy.txt
--------------------------------------------------------------------------------
/bdio-reactor/build.gradle:
--------------------------------------------------------------------------------
1 | description = 'Black Duck I/O for Project Reactor'
2 |
3 | dependencyRecommendations {
4 | mavenBom module: 'io.projectreactor:reactor-bom:Bismuth-SR8'
5 | }
6 |
7 | dependencies {
8 | compile project(':bdio2')
9 | compile 'com.blackducksoftware.magpie:magpie'
10 | compile 'com.github.jsonld-java:jsonld-java'
11 | compile 'com.google.code.findbugs:jsr305'
12 | compile 'com.google.guava:guava'
13 | compile 'io.projectreactor:reactor-core'
14 | compile 'org.reactivestreams:reactive-streams'
15 |
16 | testCompile project(':bdio-test')
17 | testCompile 'com.google.truth:truth'
18 | testCompile 'junit:junit'
19 | }
20 |
--------------------------------------------------------------------------------
/bdio-reactor/src/main/java/com/blackducksoftware/bdio2/reactor/ReactorBdioDocument.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Black Duck Software, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.blackducksoftware.bdio2.reactor;
17 |
18 | import java.io.InputStream;
19 |
20 | import org.reactivestreams.Publisher;
21 | import org.reactivestreams.Subscriber;
22 |
23 | import com.blackducksoftware.bdio2.BdioContext;
24 | import com.blackducksoftware.bdio2.BdioDocument;
25 | import com.blackducksoftware.bdio2.BdioMetadata;
26 | import com.blackducksoftware.bdio2.BdioSubscriber;
27 | import com.blackducksoftware.bdio2.BdioWriter.StreamSupplier;
28 | import com.blackducksoftware.bdio2.Emitter;
29 | import com.blackducksoftware.bdio2.EmitterFactory;
30 |
31 | import reactor.core.publisher.EmitterProcessor;
32 | import reactor.core.publisher.Flux;
33 |
34 | /**
35 | * Project Reactor implementation of the BDIO document API.
36 | *
37 | * @author jgustie
38 | */
39 | public class ReactorBdioDocument extends BdioDocument {
40 |
41 | public ReactorBdioDocument(BdioContext context) {
42 | super(context);
43 | }
44 |
45 | @Override
46 | public Flux