|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one or more |
| 2 | +# contributor license agreements. See the NOTICE file distributed with |
| 3 | +# this work for additional information regarding copyright ownership. |
| 4 | +# The ASF licenses this file to You under the Apache License, Version 2.0 |
| 5 | +# (the "License"); you may not use this file except in compliance with |
| 6 | +# the License. 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 | +from google.protobuf.runtime_version import OSS_MAJOR, OSS_MINOR, OSS_PATCH |
| 17 | +from nifiapi.flowfilesource import FlowFileSource, FlowFileSourceResult |
| 18 | + |
| 19 | +class ProtobufVersion(FlowFileSource): |
| 20 | + class Java: |
| 21 | + implements = ['org.apache.nifi.python.processor.FlowFileSource'] |
| 22 | + |
| 23 | + class ProcessorDetails: |
| 24 | + description = "Test processor which outputs the version of the protobuf library" |
| 25 | + version = '0.0.1-SNAPSHOT' |
| 26 | + tags = ['test', 'protobuf', 'version'] |
| 27 | + dependencies = ['protobuf==5.29.1'] |
| 28 | + |
| 29 | + def __init__(self, jvm): |
| 30 | + pass |
| 31 | + |
| 32 | + def create(self, context): |
| 33 | + version = f"{OSS_MAJOR}.{OSS_MINOR}.{OSS_PATCH}" |
| 34 | + return FlowFileSourceResult('success', contents=version) |
0 commit comments