http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/bootstrap.with_missing_key_line.conf ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/bootstrap.with_missing_key_line.conf b/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/bootstrap.with_missing_key_line.conf new file mode 100644 index 0000000..6ccdaaf --- /dev/null +++ b/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/bootstrap.with_missing_key_line.conf @@ -0,0 +1,60 @@ +# +# 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. +# + +# Java command to use when running nifi-registry +java=java + +# Username to use when running nifi-registry. This value will be ignored on Windows. +run.as= + +# Configure where nifi-registry's lib and conf directories live +lib.dir=./lib +conf.dir=./conf + +# How long to wait after telling nifi-registry to shutdown before explicitly killing the Process +graceful.shutdown.seconds=20 + +# Disable JSR 199 so that we can use JSP's without running a JDK +java.arg.1=-Dorg.apache.jasper.compiler.disablejsr199=true + +# JVM memory settings +java.arg.2=-Xms512m +java.arg.3=-Xmx512m + +# Enable Remote Debugging +#java.arg.debug=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000 + +java.arg.4=-Djava.net.preferIPv4Stack=true + +# allowRestrictedHeaders is required for Cluster/Node communications to work properly +java.arg.5=-Dsun.net.http.allowRestrictedHeaders=true +java.arg.6=-Djava.protocol.handler.pkgs=sun.net.www.protocol + +# Java 7 and below have issues with Code Cache. The following lines allow us to run well even with +# many classes loaded in the JVM. +#java.arg.7=-XX:ReservedCodeCacheSize=256m +#java.arg.8=-XX:CodeCacheFlushingMinimumFreeSpace=10m +#java.arg.9=-XX:+UseCodeCacheFlushing +#java.arg.11=-XX:PermSize=128M +#java.arg.12=-XX:MaxPermSize=128M + +# The G1GC is still considered experimental but has proven to be very advantageous in providing great +# performance without significant "stop-the-world" delays. +#java.arg.10=-XX:+UseG1GC + +# Master key in hexadecimal format for encrypted sensitive configuration values +# nifi.registry.bootstrap.sensitive.key is intentionally absent from this file \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.properties ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.properties b/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.properties new file mode 100644 index 0000000..a7efedb --- /dev/null +++ b/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.properties @@ -0,0 +1,45 @@ +# +# 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. +# + +# web properties # +nifi.registry.web.war.directory=./target/lib +nifi.registry.web.http.host= +nifi.registry.web.http.port=8080 +nifi.registry.web.https.host= +nifi.registry.web.https.port= +nifi.registry.web.jetty.working.directory=./target/work/jetty +nifi.registry.web.jetty.threads=1 + +# security properties # +nifi.registry.security.keystore= +nifi.registry.security.keystoreType= +nifi.registry.security.keystorePasswd= +nifi.registry.security.keyPasswd= +nifi.registry.security.truststore= +nifi.registry.security.truststoreType= +nifi.registry.security.truststorePasswd= +nifi.registry.security.needClientAuth= +nifi.registry.security.authorizers.configuration.file= +nifi.registry.security.authorizer= +nifi.registry.security.identity.providers.configuration.file= +nifi.registry.security.identity.provider= + +# kerberos properties +nifi.registry.kerberos.krb5.file=/path/to/krb5.conf +nifi.registry.kerberos.spnego.authentication.expiration=12 hours +nifi.registry.kerberos.spnego.principal=HTTP/localhost@LOCALHOST +nifi.registry.kerberos.spnego.keytab.location=/path/to/keytab http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_additional_sensitive_keys.properties ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_additional_sensitive_keys.properties b/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_additional_sensitive_keys.properties new file mode 100644 index 0000000..5afb3dd --- /dev/null +++ b/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_additional_sensitive_keys.properties @@ -0,0 +1,55 @@ +# +# 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. +# + +# web properties # +nifi.registry.web.war.directory=./target/lib +nifi.registry.web.http.host= +nifi.registry.web.http.port=8080 +nifi.registry.web.https.host= +nifi.registry.web.https.port= +nifi.registry.web.jetty.working.directory=./target/work/jetty +nifi.registry.web.jetty.threads=1 + +# security properties # +nifi.registry.security.keystore= +nifi.registry.security.keystoreType= +nifi.registry.security.keystorePasswd= +nifi.registry.security.keyPasswd= +nifi.registry.security.truststore= +nifi.registry.security.truststoreType= +nifi.registry.security.truststorePasswd= +nifi.registry.security.needClientAuth= +nifi.registry.security.authorizers.configuration.file= +nifi.registry.security.authorizer= +nifi.registry.security.identity.providers.configuration.file= +nifi.registry.security.identity.provider= + +# providers properties # +nifi.registry.providers.configuration.file= + +# database properties +nifi.registry.db.directory=./target/db +nifi.registry.db.url.append= + +# kerberos properties # +nifi.registry.kerberos.krb5.file=/path/to/krb5.conf +nifi.registry.kerberos.spnego.authentication.expiration=12 hours +nifi.registry.kerberos.spnego.principal=HTTP/localhost@LOCALHOST +nifi.registry.kerberos.spnego.keytab.location=/path/to/keytab + +# security properties # +nifi.registry.sensitive.props.additional.keys=nifi.registry.web.http.port, nifi.registry.web.http.host, nifi.registry.sensitive.props.additional.keys http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_fully_protected_aes_128.properties ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_fully_protected_aes_128.properties b/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_fully_protected_aes_128.properties new file mode 100644 index 0000000..90eb64f --- /dev/null +++ b/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_fully_protected_aes_128.properties @@ -0,0 +1,43 @@ +# +# 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. +# + +# web properties # +nifi.registry.web.war.directory=./target/lib +nifi.registry.web.http.host= +nifi.registry.web.http.port=8080 +nifi.registry.web.https.host= +nifi.registry.web.https.port= +nifi.registry.web.jetty.working.directory=./target/work/jetty +nifi.registry.web.jetty.threads=1 + +# security properties # +nifi.registry.security.keystore=/path/to/keystore.jks +nifi.registry.security.keystoreType=JKS +nifi.registry.security.keystorePasswd=6WUpex+VZiN05LXu||joWJMuoSzYniEC7IAoingTimlG7+RGk8I2irl/WTlIuMcg +nifi.registry.security.keystorePasswd.protected=aes/gcm/128 +nifi.registry.security.keyPasswd=6WUpex+VZiN05LXu||joWJMuoSzYniEC7IAoingTimlG7+RGk8I2irl/WTlIuMcg +nifi.registry.security.keyPasswd.protected=aes/gcm/128 +nifi.registry.security.truststore= +nifi.registry.security.truststoreType= +nifi.registry.security.truststorePasswd= +nifi.registry.security.needClientAuth= +nifi.registry.security.authorizers.configuration.file= +nifi.registry.security.authorizer= +nifi.registry.security.identity.providers.configuration.file= +nifi.registry.security.identity.provider= + +nifi.registry.sensitive.props.additional.keys= http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_protected_aes_128.properties ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_protected_aes_128.properties b/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_protected_aes_128.properties new file mode 100644 index 0000000..6ecd281 --- /dev/null +++ b/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_protected_aes_128.properties @@ -0,0 +1,43 @@ +# +# 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. +# + +# web properties # +nifi.registry.web.war.directory=./target/lib +nifi.registry.web.http.host= +nifi.registry.web.http.port=8080 +nifi.registry.web.https.host= +nifi.registry.web.https.port= +nifi.registry.web.jetty.working.directory=./target/work/jetty +nifi.registry.web.jetty.threads=1 + +# security properties # +nifi.registry.security.keystore=/path/to/keystore.jks +nifi.registry.security.keystoreType=JKS +nifi.registry.security.keystorePasswd=6WUpex+VZiN05LXu||joWJMuoSzYniEC7IAoingTimlG7+RGk8I2irl/WTlIuMcg +nifi.registry.security.keystorePasswd.protected=aes/gcm/128 +nifi.registry.security.keyPasswd=6WUpex+VZiN05LXu||joWJMuoSzYniEC7IAoingTimlG7+RGk8I2irl/WTlIuMcg +nifi.registry.security.keyPasswd.protected=aes/gcm/128 +nifi.registry.security.truststore= +nifi.registry.security.truststoreType= +nifi.registry.security.truststorePasswd= +nifi.registry.security.needClientAuth= +nifi.registry.security.authorizers.configuration.file= +nifi.registry.security.authorizer= +nifi.registry.security.identity.providers.configuration.file= +nifi.registry.security.identity.provider= + +nifi.registry.sensitive.props.additional.keys=nifi.registry.web.http.port http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_protected_aes_128_password.properties ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_protected_aes_128_password.properties b/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_protected_aes_128_password.properties new file mode 100644 index 0000000..a3b272d --- /dev/null +++ b/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_protected_aes_128_password.properties @@ -0,0 +1,43 @@ +# +# 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. +# + +# web properties # +nifi.registry.web.war.directory=./target/lib +nifi.registry.web.http.host= +nifi.registry.web.http.port=8080 +nifi.registry.web.https.host= +nifi.registry.web.https.port= +nifi.registry.web.jetty.working.directory=./target/work/jetty +nifi.registry.web.jetty.threads=1 + +# security properties # +nifi.registry.security.keystore=/path/to/keystore.jks +nifi.registry.security.keystoreType=JKS +nifi.registry.security.keystorePasswd=oa6Aaz5tlFprPuKt||IlVgftF2VqvBIambkP5HVDbRoyKzZl8wwKSw4O9tjHTALA +nifi.registry.security.keystorePasswd.protected=aes/gcm/128 +nifi.registry.security.keyPasswd=oa6Aaz5tlFprPuKt||IlVgftF2VqvBIambkP5HVDbRoyKzZl8wwKSw4O9tjHTALA +nifi.registry.security.keyPasswd.protected=aes/gcm/128 +nifi.registry.security.truststore= +nifi.registry.security.truststoreType= +nifi.registry.security.truststorePasswd= +nifi.registry.security.needClientAuth= +nifi.registry.security.authorizers.configuration.file= +nifi.registry.security.authorizer= +nifi.registry.security.identity.providers.configuration.file= +nifi.registry.security.identity.provider= + +nifi.registry.sensitive.props.additional.keys=nifi.registry.web.http.port http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_protected_aes_256.properties ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_protected_aes_256.properties b/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_protected_aes_256.properties new file mode 100644 index 0000000..97aaba0 --- /dev/null +++ b/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_protected_aes_256.properties @@ -0,0 +1,43 @@ +# +# 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. +# + +# web properties # +nifi.registry.web.war.directory=./target/lib +nifi.registry.web.http.host= +nifi.registry.web.http.port=8080 +nifi.registry.web.https.host= +nifi.registry.web.https.port= +nifi.registry.web.jetty.working.directory=./target/work/jetty +nifi.registry.web.jetty.threads=1 + +# security properties # +nifi.registry.security.keystore=/path/to/keystore.jks +nifi.registry.security.keystoreType=JKS +nifi.registry.security.keystorePasswd=oBjT92hIGRElIGOh||MZ6uYuWNBrOA6usq/Jt3DaD2e4otNirZDytac/w/KFe0HOkrJR03vcbo +nifi.registry.security.keystorePasswd.protected=aes/gcm/256 +nifi.registry.security.keyPasswd=ac/BaE35SL/esLiJ||+ULRvRLYdIDA2VqpE0eQXDEMjaLBMG2kbKOdOwBk/hGebDKlVg== +nifi.registry.security.keyPasswd.protected=aes/gcm/256 +nifi.registry.security.truststore= +nifi.registry.security.truststoreType= +nifi.registry.security.truststorePasswd= +nifi.registry.security.needClientAuth= +nifi.registry.security.authorizers.configuration.file= +nifi.registry.security.authorizer= +nifi.registry.security.identity.providers.configuration.file= +nifi.registry.security.identity.provider= + +nifi.registry.sensitive.props.additional.keys=nifi.registry.web.http.port http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_protected_aes_multiple_malformed.properties ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_protected_aes_multiple_malformed.properties b/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_protected_aes_multiple_malformed.properties new file mode 100644 index 0000000..d408df0 --- /dev/null +++ b/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_protected_aes_multiple_malformed.properties @@ -0,0 +1,43 @@ +# +# 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. +# + +# web properties # +nifi.registry.web.war.directory=./target/lib +nifi.registry.web.http.host= +nifi.registry.web.http.port=8080 +nifi.registry.web.https.host= +nifi.registry.web.https.port= +nifi.registry.web.jetty.working.directory=./target/work/jetty +nifi.registry.web.jetty.threads=1 + +# security properties # +nifi.registry.security.keystore=/path/to/keystore.jks +nifi.registry.security.keystoreType=JKS +nifi.registry.security.keystorePasswd=6WUpex+VZiN05LXu||thisIsAnIntentionallyMalformedCipherValue +nifi.registry.security.keystorePasswd.protected=aes/gcm/128 +nifi.registry.security.keyPasswd=6WUpex+VZiN05LXu||thisIsAnIntentionallyMalformedCipherValue +nifi.registry.security.keyPasswd.protected=aes/gcm/128 +nifi.registry.security.truststore= +nifi.registry.security.truststoreType= +nifi.registry.security.truststorePasswd= +nifi.registry.security.needClientAuth= +nifi.registry.security.authorizers.configuration.file= +nifi.registry.security.authorizer= +nifi.registry.security.identity.providers.configuration.file= +nifi.registry.security.identity.provider= + +nifi.registry.sensitive.props.additional.keys= http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_protected_aes_single_malformed.properties ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_protected_aes_single_malformed.properties b/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_protected_aes_single_malformed.properties new file mode 100644 index 0000000..8552f9e --- /dev/null +++ b/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_protected_aes_single_malformed.properties @@ -0,0 +1,43 @@ +# +# 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. +# + +# web properties # +nifi.registry.web.war.directory=./target/lib +nifi.registry.web.http.host= +nifi.registry.web.http.port=8080 +nifi.registry.web.https.host= +nifi.registry.web.https.port= +nifi.registry.web.jetty.working.directory=./target/work/jetty +nifi.registry.web.jetty.threads=1 + +# security properties # +nifi.registry.security.keystore=/path/to/keystore.jks +nifi.registry.security.keystoreType=JKS +nifi.registry.security.keystorePasswd=6WUpex+VZiN05LXu||thisIsAnIntentionallyMalformedCipherValue +nifi.registry.security.keystorePasswd.protected=aes/gcm/128 +nifi.registry.security.keyPasswd=6WUpex+VZiN05LXu||joWJMuoSzYniEC7IAoingTimlG7+RGk8I2irl/WTlIuMcg +nifi.registry.security.keyPasswd.protected=aes/gcm/128 +nifi.registry.security.truststore= +nifi.registry.security.truststoreType= +nifi.registry.security.truststorePasswd= +nifi.registry.security.needClientAuth= +nifi.registry.security.authorizers.configuration.file= +nifi.registry.security.authorizer= +nifi.registry.security.identity.providers.configuration.file= +nifi.registry.security.identity.provider= + +nifi.registry.sensitive.props.additional.keys= http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_protected_unknown.properties ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_protected_unknown.properties b/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_protected_unknown.properties new file mode 100644 index 0000000..8bd6f4f --- /dev/null +++ b/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_protected_unknown.properties @@ -0,0 +1,43 @@ +# +# 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. +# + +# web properties # +nifi.registry.web.war.directory=./target/lib +nifi.registry.web.http.host= +nifi.registry.web.http.port=8080 +nifi.registry.web.https.host= +nifi.registry.web.https.port= +nifi.registry.web.jetty.working.directory=./target/work/jetty +nifi.registry.web.jetty.threads=1 + +# security properties # +nifi.registry.security.keystore=/path/to/keystore.jks +nifi.registry.security.keystoreType=JKS +nifi.registry.security.keystorePasswd=oBjT92hIGRElIGOh||MZ6uYuWNBrOA6usq/Jt3DaD2e4otNirZDytac/w/KFe0HOkrJR03vcbo +nifi.registry.security.keystorePasswd.protected=unknown +nifi.registry.security.keyPasswd=ac/BaE35SL/esLiJ||+ULRvRLYdIDA2VqpE0eQXDEMjaLBMG2kbKOdOwBk/hGebDKlVg== +nifi.registry.security.keyPasswd.protected=unknown +nifi.registry.security.truststore= +nifi.registry.security.truststoreType= +nifi.registry.security.truststorePasswd= +nifi.registry.security.needClientAuth= +nifi.registry.security.authorizers.configuration.file= +nifi.registry.security.authorizer= +nifi.registry.security.identity.providers.configuration.file= +nifi.registry.security.identity.provider= + +nifi.registry.sensitive.props.additional.keys=nifi.registry.web.http.port, nifi.registry.web.http.host http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_unprotected.properties ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_unprotected.properties b/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_unprotected.properties new file mode 100644 index 0000000..b0f9f40 --- /dev/null +++ b/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_unprotected.properties @@ -0,0 +1,41 @@ +# +# 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. +# + +# web properties # +nifi.registry.web.war.directory=./target/lib +nifi.registry.web.http.host= +nifi.registry.web.http.port=8080 +nifi.registry.web.https.host= +nifi.registry.web.https.port= +nifi.registry.web.jetty.working.directory=./target/work/jetty +nifi.registry.web.jetty.threads=1 + +# security properties # +nifi.registry.security.keystore=path/to/keystore.jks +nifi.registry.security.keystoreType=JKS +nifi.registry.security.keystorePasswd=thisIsABadKeystorePassword +nifi.registry.security.keyPasswd=thisIsABadKeyPassword +nifi.registry.security.truststore= +nifi.registry.security.truststoreType= +nifi.registry.security.truststorePasswd= +nifi.registry.security.needClientAuth= +nifi.registry.security.authorizers.configuration.file= +nifi.registry.security.authorizer= +nifi.registry.security.identity.providers.configuration.file= +nifi.registry.security.identity.provider= + +nifi.registry.sensitive.props.additional.keys=nifi.registry.web.http.port, nifi.registry.web.http.host http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_unprotected_extra_line.properties ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_unprotected_extra_line.properties b/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_unprotected_extra_line.properties new file mode 100644 index 0000000..34b80a3 --- /dev/null +++ b/nifi-registry-core/nifi-registry-properties/src/test/resources/conf/nifi-registry.with_sensitive_props_unprotected_extra_line.properties @@ -0,0 +1,42 @@ +# +# 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. +# + +# web properties # +nifi.registry.web.war.directory=./target/lib +nifi.registry.web.http.host= +nifi.registry.web.http.port=8080 +nifi.registry.web.https.host= +nifi.registry.web.https.port= +nifi.registry.web.jetty.working.directory=./target/work/jetty +nifi.registry.web.jetty.threads=1 + +# security properties # +nifi.registry.security.keystore=path/to/keystore.jks +nifi.registry.security.keystoreType=JKS +nifi.registry.security.keystorePasswd=thisIsABadKeystorePassword +nifi.registry.security.keyPasswd=thisIsABadKeyPassword +nifi.registry.security.keyPasswd.protected= +nifi.registry.security.truststore= +nifi.registry.security.truststoreType= +nifi.registry.security.truststorePasswd= +nifi.registry.security.needClientAuth= +nifi.registry.security.authorizers.configuration.file= +nifi.registry.security.authorizer= +nifi.registry.security.identity.providers.configuration.file= +nifi.registry.security.identity.provider= + +nifi.registry.sensitive.props.additional.keys=nifi.registry.web.http.port, nifi.registry.web.http.host http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-provider-api/pom.xml ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-provider-api/pom.xml b/nifi-registry-core/nifi-registry-provider-api/pom.xml new file mode 100644 index 0000000..44dd56d --- /dev/null +++ b/nifi-registry-core/nifi-registry-provider-api/pom.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <groupId>org.apache.nifi.registry</groupId> + <artifactId>nifi-registry-core</artifactId> + <version>0.3.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>nifi-registry-provider-api</artifactId> + <packaging>jar</packaging> + + <dependencies> + </dependencies> +</project> http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/flow/FlowPersistenceException.java ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/flow/FlowPersistenceException.java b/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/flow/FlowPersistenceException.java new file mode 100644 index 0000000..4287fc8 --- /dev/null +++ b/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/flow/FlowPersistenceException.java @@ -0,0 +1,31 @@ +/* + * 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.nifi.registry.flow; + +/** + * An Exception for errors encountered when a FlowPersistenceProvider saves or retrieves a flow. + */ +public class FlowPersistenceException extends RuntimeException { + + public FlowPersistenceException(String message) { + super(message); + } + + public FlowPersistenceException(String message, Throwable cause) { + super(message, cause); + } +} http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/flow/FlowPersistenceProvider.java ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/flow/FlowPersistenceProvider.java b/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/flow/FlowPersistenceProvider.java new file mode 100644 index 0000000..90c872f --- /dev/null +++ b/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/flow/FlowPersistenceProvider.java @@ -0,0 +1,71 @@ +/* + * 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.nifi.registry.flow; + +import org.apache.nifi.registry.provider.Provider; + +/** + * A service that can store and retrieve flow contents. + * + * The flow contents will be a serialized VersionProcessGroup which came from the flowContents + * field of a VersionedFlowSnapshot. + * + * NOTE: Although this interface is intended to be an extension point, it is not yet considered stable and thus may + * change across releases until the registry matures. + */ +public interface FlowPersistenceProvider extends Provider { + + /** + * Persists the serialized content. + * + * @param context the context for the content being persisted + * @param content the serialized flow content to persist + * @throws FlowPersistenceException if the content could not be persisted + */ + void saveFlowContent(FlowSnapshotContext context, byte[] content) throws FlowPersistenceException; + + /** + * Retrieves the serialized content. + * + * @param bucketId the bucket id where the flow snapshot is located + * @param flowId the id of the versioned flow the snapshot belongs to + * @param version the version of the snapshot + * @return the bytes for the requested snapshot, or null if not found + * @throws FlowPersistenceException if the snapshot could not be retrieved due to an error in underlying provider + */ + byte[] getFlowContent(String bucketId, String flowId, int version) throws FlowPersistenceException; + + /** + * Deletes all content for the versioned flow with the given id in the given bucket. + * + * @param bucketId the bucket the versioned flow belongs to + * @param flowId the id of the versioned flow + * @throws FlowPersistenceException if the snapshots could not be deleted due to an error in underlying provider + */ + void deleteAllFlowContent(String bucketId, String flowId) throws FlowPersistenceException; + + /** + * Deletes the content for the given snapshot. + * + * @param bucketId the bucket id where the snapshot is located + * @param flowId the id of the versioned flow the snapshot belongs to + * @param version the version of the snapshot + * @throws FlowPersistenceException if the snapshot could not be deleted due to an error in underlying provider + */ + void deleteFlowContent(String bucketId, String flowId, int version) throws FlowPersistenceException; + +} http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/flow/FlowSnapshotContext.java ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/flow/FlowSnapshotContext.java b/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/flow/FlowSnapshotContext.java new file mode 100644 index 0000000..9c2a818 --- /dev/null +++ b/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/flow/FlowSnapshotContext.java @@ -0,0 +1,64 @@ +/* + * 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.nifi.registry.flow; + +/** + * The context that will be passed to the flow provider when saving a snapshot of a versioned flow. + */ +public interface FlowSnapshotContext { + + /** + * @return the id of the bucket this snapshot belongs to + */ + String getBucketId(); + + /** + * @return the name of the bucket this snapshot belongs to + */ + String getBucketName(); + + /** + * @return the id of the versioned flow this snapshot belongs to + */ + String getFlowId(); + + /** + * @return the name of the versioned flow this snapshot belongs to + */ + String getFlowName(); + + /** + * @return the version of the snapshot + */ + int getVersion(); + + /** + * @return the comments for the snapshot + */ + String getComments(); + + /** + * @return the timestamp the snapshot was created + */ + long getSnapshotTimestamp(); + + /** + * @return the author of the snapshot + */ + String getAuthor(); + +} http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/Event.java ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/Event.java b/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/Event.java new file mode 100644 index 0000000..2948962 --- /dev/null +++ b/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/Event.java @@ -0,0 +1,50 @@ +/* + * 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.nifi.registry.hook; + +import java.util.List; + +/** + * An event that will be passed to EventHookProviders. + */ +public interface Event { + + /** + * @return the type of the event + */ + EventType getEventType(); + + /** + * @return the fields of the event in the order they were added to the event + */ + List<EventField> getFields(); + + /** + * @param fieldName the name of the field to return + * @return the EventField with the given name, or null if it does not exist + */ + EventField getField(EventFieldName fieldName); + + /** + * Will be called before publishing the event to ensure the event contains the required + * fields for the given event type in the order specified by the type. + * + * @throws IllegalStateException if the event does not contain the required fields + */ + void validate() throws IllegalStateException; + +} http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/EventField.java ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/EventField.java b/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/EventField.java new file mode 100644 index 0000000..4859266 --- /dev/null +++ b/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/EventField.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.nifi.registry.hook; + +/** + * A field for an event. + */ +public interface EventField { + + /** + * @return the name of the field + */ + EventFieldName getName(); + + /** + * @return the value of the field + */ + String getValue(); +} http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/EventFieldName.java ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/EventFieldName.java b/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/EventFieldName.java new file mode 100644 index 0000000..35b0cfe --- /dev/null +++ b/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/EventFieldName.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.nifi.registry.hook; + +/** + * Enumeration of possible field names for an EventField. + */ +public enum EventFieldName { + + BUCKET_ID, + FLOW_ID, + VERSION, + USER, + COMMENT; + +} http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/EventHookException.java ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/EventHookException.java b/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/EventHookException.java new file mode 100644 index 0000000..2d91735 --- /dev/null +++ b/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/EventHookException.java @@ -0,0 +1,31 @@ +/* + * 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.nifi.registry.hook; + +/** + * An Exception for errors encountered when a EventHookProvider executes an action before/after a commit. + */ +public class EventHookException extends RuntimeException { + + public EventHookException(String message) { + super(message); + } + + public EventHookException(String message, Throwable cause) { + super(message, cause); + } +} http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/EventHookProvider.java ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/EventHookProvider.java b/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/EventHookProvider.java new file mode 100644 index 0000000..8d9f51c --- /dev/null +++ b/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/EventHookProvider.java @@ -0,0 +1,53 @@ +/* + * 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.nifi.registry.hook; + +import org.apache.nifi.registry.provider.Provider; + +/** + * An extension point that will be passed events produced by actions take in the registry. + * + * The list of event types can be found in {@link org.apache.nifi.registry.hook.EventType}. + * + * NOTE: Although this interface is intended to be an extension point, it is not yet considered stable and thus may + * change across releases until the registry matures. + */ +public interface EventHookProvider extends Provider { + + /** + * Handles the given event. + * + * @param event the event to handle + * @throws EventHookException if an error occurs handling the event + */ + void handle(Event event) throws EventHookException; + + /** + * Examines the values from the 'Whitelisted Event Type ' properties in the hook provider definition to determine + * if the Event should be invoked for this particular EventType + * + * @param eventType + * EventType that has been fired by the framework. + * + * @return + * True if the hook provider should be 'handled' and false otherwise. + */ + default boolean shouldHandle(EventType eventType) { + return true; + } + +} http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/EventType.java ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/EventType.java b/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/EventType.java new file mode 100644 index 0000000..c11a60c --- /dev/null +++ b/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/EventType.java @@ -0,0 +1,71 @@ +/* + * 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.nifi.registry.hook; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +/** + * Enumeration of possible EventTypes with the expected fields for each event. + * + * Producers of events must produce events with the fields in the same order specified here. + */ +public enum EventType { + + CREATE_BUCKET( + EventFieldName.BUCKET_ID, + EventFieldName.USER), + CREATE_FLOW( + EventFieldName.BUCKET_ID, + EventFieldName.FLOW_ID, + EventFieldName.USER), + CREATE_FLOW_VERSION( + EventFieldName.BUCKET_ID, + EventFieldName.FLOW_ID, + EventFieldName.VERSION, + EventFieldName.USER, + EventFieldName.COMMENT), + REGISTRY_START(), + UPDATE_BUCKET( + EventFieldName.BUCKET_ID, + EventFieldName.USER), + UPDATE_FLOW( + EventFieldName.BUCKET_ID, + EventFieldName.FLOW_ID, + EventFieldName.USER), + DELETE_BUCKET( + EventFieldName.BUCKET_ID, + EventFieldName.USER), + DELETE_FLOW( + EventFieldName.BUCKET_ID, + EventFieldName.FLOW_ID, + EventFieldName.USER); + + + private List<EventFieldName> fieldNames; + + EventType(EventFieldName... fieldNames) { + this.fieldNames = Collections.unmodifiableList(Arrays.asList(fieldNames)); + } + + public List<EventFieldName> getFieldNames() { + return this.fieldNames; + } + +} http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/WhitelistFilteringEventHookProvider.java ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/WhitelistFilteringEventHookProvider.java b/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/WhitelistFilteringEventHookProvider.java new file mode 100644 index 0000000..24ac3a4 --- /dev/null +++ b/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/hook/WhitelistFilteringEventHookProvider.java @@ -0,0 +1,70 @@ +/* + * 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.nifi.registry.hook; + +import org.apache.nifi.registry.provider.ProviderConfigurationContext; +import org.apache.nifi.registry.provider.ProviderCreationException; + +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public abstract class WhitelistFilteringEventHookProvider + implements EventHookProvider { + + static final String EVENT_WHITELIST_PREFIX = "Whitelisted Event Type "; + static final Pattern EVENT_WHITELIST_PATTERN = Pattern.compile(EVENT_WHITELIST_PREFIX + "\\S+"); + + protected Set<EventType> whiteListEvents = null; + + @Override + public void onConfigured(ProviderConfigurationContext configurationContext) throws ProviderCreationException { + whiteListEvents = new HashSet<>(); + for (Map.Entry<String,String> entry : configurationContext.getProperties().entrySet()) { + Matcher matcher = EVENT_WHITELIST_PATTERN.matcher(entry.getKey()); + if (matcher.matches() && (entry.getValue() != null && entry.getValue().length() > 0)) { + whiteListEvents.add(EventType.valueOf(entry.getValue())); + } + + } + } + + /** + * Standard method for deciding if the EventType should be handled by the Hook provider or not. + * + * @param eventType + * EventType that was fired by the framework. + * + * @return + * True if the EventType is in the whitelist set and false otherwise. + */ + @Override + public boolean shouldHandle(EventType eventType) { + if (whiteListEvents != null && whiteListEvents.size() > 0) { + if (whiteListEvents.contains(eventType)) { + return true; + } + } else { + // If the whitelist property is not set or empty we want to fire for all events. + return true; + } + return false; + } + +} http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/provider/Provider.java ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/provider/Provider.java b/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/provider/Provider.java new file mode 100644 index 0000000..4a4be28 --- /dev/null +++ b/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/provider/Provider.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.nifi.registry.provider; + +/** + * Base interface for providers. + */ +public interface Provider { + + /** + * Called to configure the Provider. + * + * @param configurationContext the context containing configuration for the given provider + * @throws ProviderCreationException if an error occurs while the provider is configured + */ + void onConfigured(ProviderConfigurationContext configurationContext) throws ProviderCreationException; + +} http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/provider/ProviderConfigurationContext.java ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/provider/ProviderConfigurationContext.java b/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/provider/ProviderConfigurationContext.java new file mode 100644 index 0000000..b4f7ed6 --- /dev/null +++ b/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/provider/ProviderConfigurationContext.java @@ -0,0 +1,36 @@ +/* + * 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.nifi.registry.provider; + +import java.util.Map; + +/** + * A context that will passed to providers in order to obtain configuration. + */ +public interface ProviderConfigurationContext { + + /** + * Retrieves all properties the provider currently understands regardless + * of whether a value has been set for them or not. If no value is present + * then its value is null and thus any registered default for the property + * descriptor applies. + * + * @return Map of all properties + */ + Map<String, String> getProperties(); + +} http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/provider/ProviderCreationException.java ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/provider/ProviderCreationException.java b/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/provider/ProviderCreationException.java new file mode 100644 index 0000000..d1e106c --- /dev/null +++ b/nifi-registry-core/nifi-registry-provider-api/src/main/java/org/apache/nifi/registry/provider/ProviderCreationException.java @@ -0,0 +1,39 @@ +/* + * 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.nifi.registry.provider; + +/** + * An exception that will be thrown if a provider can not be created. + */ +public class ProviderCreationException extends RuntimeException { + + public ProviderCreationException() { + } + + public ProviderCreationException(String message) { + super(message); + } + + public ProviderCreationException(String message, Throwable cause) { + super(message, cause); + } + + public ProviderCreationException(Throwable cause) { + super(cause); + } + +} http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-resources/pom.xml ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-resources/pom.xml b/nifi-registry-core/nifi-registry-resources/pom.xml new file mode 100644 index 0000000..7ecdf49 --- /dev/null +++ b/nifi-registry-core/nifi-registry-resources/pom.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.nifi.registry</groupId> + <artifactId>nifi-registry-core</artifactId> + <version>0.3.0-SNAPSHOT</version> + </parent> + <artifactId>nifi-registry-resources</artifactId> + <packaging>pom</packaging> + <description>holds common resources used to build installers</description> + <build> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <configuration> + <attach>true</attach> + </configuration> + <executions> + <execution> + <id>make shared resource</id> + <goals> + <goal>single</goal> + </goals> + <phase>package</phase> + <configuration> + <descriptors> + <descriptor>src/main/assembly/dependencies.xml</descriptor> + </descriptors> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-resources/src/main/assembly/dependencies.xml ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-resources/src/main/assembly/dependencies.xml b/nifi-registry-core/nifi-registry-resources/src/main/assembly/dependencies.xml new file mode 100644 index 0000000..fed8098 --- /dev/null +++ b/nifi-registry-core/nifi-registry-resources/src/main/assembly/dependencies.xml @@ -0,0 +1,36 @@ +<?xml version="1.0"?> +<!-- + 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. +--> +<assembly> + <id>resources</id> + <formats> + <format>zip</format> + </formats> + <includeBaseDirectory>false</includeBaseDirectory> + <fileSets> + <fileSet> + <directory>src/main/resources</directory> + <outputDirectory>/</outputDirectory> + </fileSet> + <fileSet> + <directory>src/main/resources/bin</directory> + <outputDirectory>/bin/</outputDirectory> + <includes> + <include>nifi-registry.sh</include> + </includes> + <fileMode>0750</fileMode> + </fileSet> + </fileSets> +</assembly> http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-resources/src/main/resources/bin/dump-nifi-registry.bat ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-resources/src/main/resources/bin/dump-nifi-registry.bat b/nifi-registry-core/nifi-registry-resources/src/main/resources/bin/dump-nifi-registry.bat new file mode 100644 index 0000000..9134aab --- /dev/null +++ b/nifi-registry-core/nifi-registry-resources/src/main/resources/bin/dump-nifi-registry.bat @@ -0,0 +1,49 @@ +@echo off +rem +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. +rem + +rem Use JAVA_HOME if it's set; otherwise, just use java + +if "%JAVA_HOME%" == "" goto noJavaHome +if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome +set JAVA_EXE=%JAVA_HOME%\bin\java.exe +goto startNiFiRegistry + +:noJavaHome +echo The JAVA_HOME environment variable is not defined correctly. +echo Instead the PATH will be used to find the java executable. +echo. +set JAVA_EXE=java +goto startNiFiRegistry + +:startNiFiRegistry +set NIFI_REGISTRY_ROOT=%~dp0..\ +pushd "%NIFI_REGISTRY%" +set LIB_DIR=%NIFI_REGISTRY_ROOT%\lib +set SHARED_DIR=%NIFI_REGISTRY_ROOT%\lib\shared +set BOOTSTRAP_DIR=%NIFI_REGISTRY_ROOT%\lib\bootstrap +set CONF_DIR=conf + +set BOOTSTRAP_CONF_FILE=%CONF_DIR%\bootstrap.conf +set JAVA_ARGS=-Dorg.apache.nifi.registry.bootstrap.config.file=%BOOTSTRAP_CONF_FILE% + +SET JAVA_PARAMS=-cp %CONF_DIR%;%LIB_DIR%\*;%SHARED_DIR%\*;%BOOTSTRAP_DIR%\* -Xms12m -Xmx24m %JAVA_ARGS% org.apache.nifi.registry.NiFiRegistry +set BOOTSTRAP_ACTION=dump + +cmd.exe /C "%JAVA_EXE%" %JAVA_PARAMS% %BOOTSTRAP_ACTION% + +popd http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-resources/src/main/resources/bin/nifi-registry-env.sh ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-resources/src/main/resources/bin/nifi-registry-env.sh b/nifi-registry-core/nifi-registry-resources/src/main/resources/bin/nifi-registry-env.sh new file mode 100644 index 0000000..216d484 --- /dev/null +++ b/nifi-registry-core/nifi-registry-resources/src/main/resources/bin/nifi-registry-env.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# +# 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. +# + +# The java implementation to use. +#export JAVA_HOME=/usr/java/jdk1.8.0/ + +export NIFI_REGISTRY_HOME=$(cd "${SCRIPT_DIR}" && cd .. && pwd) + +#The directory for the NiFi Registry pid file +export NIFI_REGISTRY_PID_DIR="${NIFI_REGISTRY_HOME}/run" + +#The directory for NiFi Registry log files +export NIFI_REGISTRY_LOG_DIR="${NIFI_REGISTRY_HOME}/logs" \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/6f26290d/nifi-registry-core/nifi-registry-resources/src/main/resources/bin/nifi-registry.sh ---------------------------------------------------------------------- diff --git a/nifi-registry-core/nifi-registry-resources/src/main/resources/bin/nifi-registry.sh b/nifi-registry-core/nifi-registry-resources/src/main/resources/bin/nifi-registry.sh new file mode 100644 index 0000000..aaf16fd --- /dev/null +++ b/nifi-registry-core/nifi-registry-resources/src/main/resources/bin/nifi-registry.sh @@ -0,0 +1,357 @@ +#!/bin/sh +# +# 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. + +# Script structure inspired from Apache Karaf and other Apache projects with similar startup approaches + +# Discover the path of the file + + +# Since MacOS X, FreeBSD and some other systems lack gnu readlink, we use a more portable +# approach based on following StackOverflow comment http://stackoverflow.com/a/1116890/888876 + +TARGET_FILE=$0 + +cd $(dirname $TARGET_FILE) +TARGET_FILE=$(basename $TARGET_FILE) + +# Iterate down a (possible) chain of symlinks +while [ -L "$TARGET_FILE" ] +do + TARGET_FILE=$(readlink $TARGET_FILE) + cd $(dirname $TARGET_FILE) + TARGET_FILE=$(basename $TARGET_FILE) +done + +# Compute the canonicalized name by finding the physical path +# for the directory we're in and appending the target file. +PHYS_DIR=$(pwd -P) + +SCRIPT_DIR=$PHYS_DIR +PROGNAME=$(basename "$0") + +. "${SCRIPT_DIR}/nifi-registry-env.sh" + + + +warn() { + echo "${PROGNAME}: $*" +} + +die() { + warn "$*" + exit 1 +} + +detectOS() { + # OS specific support (must be 'true' or 'false'). + cygwin=false; + aix=false; + os400=false; + darwin=false; + case "$(uname)" in + CYGWIN*) + cygwin=true + ;; + AIX*) + aix=true + ;; + OS400*) + os400=true + ;; + Darwin) + darwin=true + ;; + esac + # For AIX, set an environment variable + if ${aix}; then + export LDR_CNTRL=MAXDATA=0xB0000000@DSA + echo ${LDR_CNTRL} + fi + # In addition to those, go around the linux space and query the widely + # adopted /etc/os-release to detect linux variants + if [ -f /etc/os-release ] + then + . /etc/os-release + fi +} + +unlimitFD() { + # Use the maximum available, or set MAX_FD != -1 to use that + if [ "x${MAX_FD}" = "x" ]; then + MAX_FD="maximum" + fi + + # Increase the maximum file descriptors if we can + if [ "${os400}" = "false" ] && [ "${cygwin}" = "false" ]; then + MAX_FD_LIMIT=$(ulimit -H -n) + if [ "${MAX_FD_LIMIT}" != 'unlimited' ]; then + if [ $? -eq 0 ]; then + if [ "${MAX_FD}" = "maximum" -o "${MAX_FD}" = "max" ]; then + # use the system max + MAX_FD="${MAX_FD_LIMIT}" + fi + + ulimit -n ${MAX_FD} > /dev/null + # echo "ulimit -n" `ulimit -n` + if [ $? -ne 0 ]; then + warn "Could not set maximum file descriptor limit: ${MAX_FD}" + fi + else + warn "Could not query system maximum file descriptor limit: ${MAX_FD_LIMIT}" + fi + fi + fi +} + + + +locateJava() { + # Setup the Java Virtual Machine + if $cygwin ; then + [ -n "${JAVA}" ] && JAVA=$(cygpath --unix "${JAVA}") + [ -n "${JAVA_HOME}" ] && JAVA_HOME=$(cygpath --unix "${JAVA_HOME}") + fi + + if [ "x${JAVA}" = "x" ] && [ -r /etc/gentoo-release ] ; then + JAVA_HOME=$(java-config --jre-home) + fi + if [ "x${JAVA}" = "x" ]; then + if [ "x${JAVA_HOME}" != "x" ]; then + if [ ! -d "${JAVA_HOME}" ]; then + die "JAVA_HOME is not valid: ${JAVA_HOME}" + fi + JAVA="${JAVA_HOME}/bin/java" + else + warn "JAVA_HOME not set; results may vary" + JAVA=$(type java) + JAVA=$(expr "${JAVA}" : '.* \(/.*\)$') + if [ "x${JAVA}" = "x" ]; then + die "java command not found" + fi + fi + fi + # if command is env, attempt to add more to the classpath + if [ "$1" = "env" ]; then + [ "x${TOOLS_JAR}" = "x" ] && [ -n "${JAVA_HOME}" ] && TOOLS_JAR=$(find -H "${JAVA_HOME}" -name "tools.jar") + [ "x${TOOLS_JAR}" = "x" ] && [ -n "${JAVA_HOME}" ] && TOOLS_JAR=$(find -H "${JAVA_HOME}" -name "classes.jar") + if [ "x${TOOLS_JAR}" = "x" ]; then + warn "Could not locate tools.jar or classes.jar. Please set manually to avail all command features." + fi + fi + +} + +init() { + # Determine if there is special OS handling we must perform + detectOS + + # Unlimit the number of file descriptors if possible + unlimitFD + + # Locate the Java VM to execute + locateJava "$1" +} + + +install() { + detectOS + + if [ "${darwin}" = "true" ] || [ "${cygwin}" = "true" ]; then + echo 'Installing Apache NiFi Registry as a service is not supported on OS X or Cygwin.' + exit 1 + fi + + SVC_NAME=nifi-registry + if [ "x$2" != "x" ] ; then + SVC_NAME=$2 + fi + + # since systemd seems to honour /etc/init.d we don't still create native systemd services + # yet... + initd_dir='/etc/init.d' + SVC_FILE="${initd_dir}/${SVC_NAME}" + + if [ ! -w "${initd_dir}" ]; then + echo "Current user does not have write permissions to ${initd_dir}. Cannot install NiFi Registry as a service." + exit 1 + fi + +# Create the init script, overwriting anything currently present +cat <<SERVICEDESCRIPTOR > ${SVC_FILE} +#!/bin/sh + +# +# 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. +# +# chkconfig: 2345 20 80 +# description: Apache NiFi Registry is a complementary application that provides a central location for storage and management of shared resources across one or more instances of NiFi and/or MiNiFi. + +# Make use of the configured NIFI_REGISTRY_HOME directory and pass service requests to the nifi-registry.sh executable +NIFI_REGISTRY_HOME=${NIFI_REGISTRY_HOME} +bin_dir=\${NIFI_REGISTRY_HOME}/bin +nifi_registry_executable=\${bin_dir}/nifi-registry.sh + +\${nifi_registry_executable} "\$@" +SERVICEDESCRIPTOR + + if [ ! -f "${SVC_FILE}" ]; then + echo "Could not create service file ${SVC_FILE}" + exit 1 + fi + + # Provide the user execute access on the file + chmod u+x ${SVC_FILE} + + + # If SLES or OpenSuse... + if [ "${ID}" = "opensuse" ] || [ "${ID}" = "sles" ]; then + rm -f "/etc/rc.d/rc2.d/S65${SVC_NAME}" + ln -s "/etc/init.d/${SVC_NAME}" "/etc/rc.d/rc2.d/S65${SVC_NAME}" || { echo "Could not create link /etc/rc.d/rc2.d/S65${SVC_NAME}"; exit 1; } + rm -f "/etc/rc.d/rc2.d/K65${SVC_NAME}" + ln -s "/etc/init.d/${SVC_NAME}" "/etc/rc.d/rc2.d/K65${SVC_NAME}" || { echo "Could not create link /etc/rc.d/rc2.d/K65${SVC_NAME}"; exit 1; } + echo "Service ${SVC_NAME} installed" + # Anything other fallback to the old approach + else + rm -f "/etc/rc2.d/S65${SVC_NAME}" + ln -s "/etc/init.d/${SVC_NAME}" "/etc/rc2.d/S65${SVC_NAME}" || { echo "Could not create link /etc/rc2.d/S65${SVC_NAME}"; exit 1; } + rm -f "/etc/rc2.d/K65${SVC_NAME}" + ln -s "/etc/init.d/${SVC_NAME}" "/etc/rc2.d/K65${SVC_NAME}" || { echo "Could not create link /etc/rc2.d/K65${SVC_NAME}"; exit 1; } + echo "Service ${SVC_NAME} installed" + fi +} + +run() { + BOOTSTRAP_CONF_DIR="${NIFI_REGISTRY_HOME}/conf" + BOOTSTRAP_CONF="${BOOTSTRAP_CONF_DIR}/bootstrap.conf"; + BOOTSTRAP_LIBS="${NIFI_REGISTRY_HOME}/lib/bootstrap/*" + SHARED_LIBS="${NIFI_REGISTRY_HOME}/lib/shared/*" + + run_as_user=$(grep '^\s*run.as' "${BOOTSTRAP_CONF}" | cut -d'=' -f2) + # If the run as user is the same as that starting the process, ignore this configuration + if [ "${run_as_user}" = "$(whoami)" ]; then + unset run_as_user + fi + + if $cygwin; then + if [ -n "${run_as_user}" ]; then + echo "The run.as option is not supported in a Cygwin environment. Exiting." + exit 1 + fi; + + NIFI_REGISTRY_HOME=$(cygpath --path --windows "${NIFI_REGISTRY_HOME}") + NIFI_REGISTRY_LOG_DIR=$(cygpath --path --windows "${NIFI_REGISTRY_LOG_DIR}") + NIFI_REGISTRY_PID_DIR=$(cygpath --path --windows "${NIFI_REGISTRY_PID_DIR}") + BOOTSTRAP_CONF=$(cygpath --path --windows "${BOOTSTRAP_CONF}") + BOOTSTRAP_CONF_DIR=$(cygpath --path --windows "${BOOTSTRAP_CONF_DIR}") + BOOTSTRAP_LIBS=$(cygpath --path --windows "${BOOTSTRAP_LIBS}") + SHARED_LIBS=$(cygpath --path --windows "${SHARED_LIBS}") + BOOTSTRAP_CLASSPATH="${BOOTSTRAP_CONF_DIR};${SHARED_LIBS};${BOOTSTRAP_LIBS}" + if [ -n "${TOOLS_JAR}" ]; then + TOOLS_JAR=$(cygpath --path --windows "${TOOLS_JAR}") + BOOTSTRAP_CLASSPATH="${TOOLS_JAR};${BOOTSTRAP_CLASSPATH}" + fi + else + if [ -n "${run_as_user}" ]; then + if ! id -u "${run_as_user}" >/dev/null 2>&1; then + echo "The specified run.as user ${run_as_user} does not exist. Exiting." + exit 1 + fi + fi; + BOOTSTRAP_CLASSPATH="${BOOTSTRAP_CONF_DIR}:${SHARED_LIBS}:${BOOTSTRAP_LIBS}" + if [ -n "${TOOLS_JAR}" ]; then + BOOTSTRAP_CLASSPATH="${TOOLS_JAR}:${BOOTSTRAP_CLASSPATH}" + fi + fi + + echo + echo "Java home: ${JAVA_HOME}" + echo "NiFi Registry home: ${NIFI_REGISTRY_HOME}" + echo + echo "Bootstrap Config File: ${BOOTSTRAP_CONF}" + echo + + # run 'start' in the background because the process will continue to run, monitoring NiFi Registry. + # all other commands will terminate quickly so want to just wait for them + + #setup directory parameters + BOOTSTRAP_LOG_PARAMS="-Dorg.apache.nifi.registry.bootstrap.config.log.dir='${NIFI_REGISTRY_LOG_DIR}'" + BOOTSTRAP_PID_PARAMS="-Dorg.apache.nifi.registry.bootstrap.config.pid.dir='${NIFI_REGISTRY_PID_DIR}'" + BOOTSTRAP_CONF_PARAMS="-Dorg.apache.nifi.registry.bootstrap.config.file='${BOOTSTRAP_CONF}'" + + BOOTSTRAP_DIR_PARAMS="${BOOTSTRAP_LOG_PARAMS} ${BOOTSTRAP_PID_PARAMS} ${BOOTSTRAP_CONF_PARAMS}" + + run_nifi_registry_cmd="'${JAVA}' -cp '${BOOTSTRAP_CLASSPATH}' -Xms12m -Xmx24m ${BOOTSTRAP_DIR_PARAMS} org.apache.nifi.registry.bootstrap.RunNiFiRegistry $@" + + if [ -n "${run_as_user}" ]; then + # Provide SCRIPT_DIR and execute nifi-env for the run.as user command + run_nifi_registry_cmd="sudo -u ${run_as_user} sh -c \"SCRIPT_DIR='${SCRIPT_DIR}' && . '${SCRIPT_DIR}/nifi-registry-env.sh' && ${run_nifi_registry_cmd}\"" + fi + + if [ "$1" = "run" ]; then + # Use exec to handover PID to RunNiFi java process, instead of forking it as a child process + run_nifi_registry_cmd="exec ${run_nifi_registry_cmd}" + fi + + if [ "$1" = "start" ]; then + ( eval "cd ${NIFI_REGISTRY_HOME} && ${run_nifi_registry_cmd}" & )> /dev/null 1>&- + else + eval "cd ${NIFI_REGISTRY_HOME} && ${run_nifi_registry_cmd}" + fi + EXIT_STATUS=$? + + # Wait just a bit (3 secs) to wait for the logging to finish and then echo a new-line. + # We do this to avoid having logs spewed on the console after running the command and then not giving + # control back to the user + sleep 3 + echo +} + +main() { + init "$1" + run "$@" +} + + +case "$1" in + install) + install "$@" + ;; + start|stop|run|status|dump|env) + main "$@" + ;; + restart) + init + run "stop" + run "start" + ;; + *) + echo "Usage nifi-registry {start|stop|run|restart|status|dump|install}" + ;; +esac