From 81378f3be9ebaee3ff77aa154eb4818923ca9d34 Mon Sep 17 00:00:00 2001 From: Peter Kriens Date: Mon, 12 Jul 2021 14:17:34 +0200 Subject: [PATCH] Python foreign provider --- biz.aQute.api/bnd.bnd | 3 +- biz.aQute.api/kpi.bnd | 1 + biz.aQute.api/python.bnd | 1 + .../python/api/ForeignPythonConstants.java | 6 + .../python/api/ProvideForeignPython.java | 20 + .../python/api/RequireForeignPython.java | 19 + .../foreign/python/api/package-info.java | 5 + .../src/main/java/biz/aQute/kpi/api/KPI.java | 25 + .../java/biz/aQute/kpi/api/package-info.java | 5 + biz.aQute.foreign.python.provider/.classpath | 9 + biz.aQute.foreign.python.provider/.project | 29 + .../.pydevproject | 5 + .../org.eclipse.core.resources.prefs | 2 + .../.settings/org.eclipse.core.runtime.prefs | 2 + .../.settings/org.eclipse.jdt.core.prefs | 517 ++++++++++++++++++ .../.settings/org.eclipse.jdt.ui.prefs | 148 +++++ biz.aQute.foreign.python.provider/bnd.bnd | 25 + .../resources/error.py | 5 + .../resources/forever.py | 11 + .../resources/gogo.py | 29 + .../resources/hello.py | 3 + .../python/configuration/Configuration.java | 6 + .../python/configuration/package-info.java | 6 + .../aQute/foreign/python/provider/About.java | 9 + .../foreign/python/provider/Exchange.java | 105 ++++ .../foreign/python/provider/GogoDTO.java | 96 ++++ .../foreign/python/provider/PythonAdmin.java | 74 +++ .../foreign/python/provider/PythonApp.java | 143 +++++ .../biz/aQute/foreign/python/provider/tmp | 94 ++++ .../python/__pycache__/socket.cpython-36.pyc | Bin 0 -> 373 bytes .../src/main/python/serviceregistry.py | 24 + .../src/main/python/socket.py | 9 + .../foreign/python/provider/PythonTest.java | 128 +++++ biz.aQute.foreign.python.provider/test.bndrun | 0 cnf/central.mvn | 4 + 35 files changed, 1567 insertions(+), 1 deletion(-) create mode 100644 biz.aQute.api/kpi.bnd create mode 100644 biz.aQute.api/python.bnd create mode 100644 biz.aQute.api/src/main/java/biz/aQute/foreign/python/api/ForeignPythonConstants.java create mode 100644 biz.aQute.api/src/main/java/biz/aQute/foreign/python/api/ProvideForeignPython.java create mode 100644 biz.aQute.api/src/main/java/biz/aQute/foreign/python/api/RequireForeignPython.java create mode 100644 biz.aQute.api/src/main/java/biz/aQute/foreign/python/api/package-info.java create mode 100644 biz.aQute.api/src/main/java/biz/aQute/kpi/api/KPI.java create mode 100644 biz.aQute.api/src/main/java/biz/aQute/kpi/api/package-info.java create mode 100644 biz.aQute.foreign.python.provider/.classpath create mode 100644 biz.aQute.foreign.python.provider/.project create mode 100644 biz.aQute.foreign.python.provider/.pydevproject create mode 100644 biz.aQute.foreign.python.provider/.settings/org.eclipse.core.resources.prefs create mode 100644 biz.aQute.foreign.python.provider/.settings/org.eclipse.core.runtime.prefs create mode 100644 biz.aQute.foreign.python.provider/.settings/org.eclipse.jdt.core.prefs create mode 100644 biz.aQute.foreign.python.provider/.settings/org.eclipse.jdt.ui.prefs create mode 100644 biz.aQute.foreign.python.provider/bnd.bnd create mode 100644 biz.aQute.foreign.python.provider/resources/error.py create mode 100644 biz.aQute.foreign.python.provider/resources/forever.py create mode 100644 biz.aQute.foreign.python.provider/resources/gogo.py create mode 100644 biz.aQute.foreign.python.provider/resources/hello.py create mode 100644 biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/configuration/Configuration.java create mode 100644 biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/configuration/package-info.java create mode 100644 biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/provider/About.java create mode 100644 biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/provider/Exchange.java create mode 100644 biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/provider/GogoDTO.java create mode 100644 biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/provider/PythonAdmin.java create mode 100644 biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/provider/PythonApp.java create mode 100644 biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/provider/tmp create mode 100644 biz.aQute.foreign.python.provider/src/main/python/__pycache__/socket.cpython-36.pyc create mode 100644 biz.aQute.foreign.python.provider/src/main/python/serviceregistry.py create mode 100644 biz.aQute.foreign.python.provider/src/main/python/socket.py create mode 100644 biz.aQute.foreign.python.provider/src/test/java/biz/aQute/foreign/python/provider/PythonTest.java create mode 100644 biz.aQute.foreign.python.provider/test.bndrun diff --git a/biz.aQute.api/bnd.bnd b/biz.aQute.api/bnd.bnd index 759baa9..841b379 100644 --- a/biz.aQute.api/bnd.bnd +++ b/biz.aQute.api/bnd.bnd @@ -9,6 +9,7 @@ org.osgi.annotation.bundle,\ org.osgi.dto,\ org.apache.felix.http.servlet-api,\ - org.osgi.service.component.annotations + org.osgi.service.component.annotations,\ + org.osgi.namespace.extender -sub: *.bnd \ No newline at end of file diff --git a/biz.aQute.api/kpi.bnd b/biz.aQute.api/kpi.bnd new file mode 100644 index 0000000..01ef973 --- /dev/null +++ b/biz.aQute.api/kpi.bnd @@ -0,0 +1 @@ +-includepackage: biz.aQute.kpi.api diff --git a/biz.aQute.api/python.bnd b/biz.aQute.api/python.bnd new file mode 100644 index 0000000..b4c9733 --- /dev/null +++ b/biz.aQute.api/python.bnd @@ -0,0 +1 @@ +-includepackage: biz.aQute.foreign.python.api diff --git a/biz.aQute.api/src/main/java/biz/aQute/foreign/python/api/ForeignPythonConstants.java b/biz.aQute.api/src/main/java/biz/aQute/foreign/python/api/ForeignPythonConstants.java new file mode 100644 index 0000000..a0624e5 --- /dev/null +++ b/biz.aQute.api/src/main/java/biz/aQute/foreign/python/api/ForeignPythonConstants.java @@ -0,0 +1,6 @@ +package biz.aQute.foreign.python.api; + +public interface ForeignPythonConstants { + String EXTENDER_NAME = "biz.aQute.foreign.python"; + String VERSION = "1.0.0"; +} diff --git a/biz.aQute.api/src/main/java/biz/aQute/foreign/python/api/ProvideForeignPython.java b/biz.aQute.api/src/main/java/biz/aQute/foreign/python/api/ProvideForeignPython.java new file mode 100644 index 0000000..00b0c41 --- /dev/null +++ b/biz.aQute.api/src/main/java/biz/aQute/foreign/python/api/ProvideForeignPython.java @@ -0,0 +1,20 @@ +package biz.aQute.foreign.python.api; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.osgi.annotation.bundle.Capability; +import org.osgi.namespace.extender.ExtenderNamespace; + +@Documented +@Retention(RetentionPolicy.CLASS) +@Target({ + ElementType.TYPE, ElementType.PACKAGE +}) +@Capability(namespace = ExtenderNamespace.EXTENDER_NAMESPACE, name=ForeignPythonConstants.EXTENDER_NAME, version=ForeignPythonConstants.VERSION) +public @interface ProvideForeignPython { + +} diff --git a/biz.aQute.api/src/main/java/biz/aQute/foreign/python/api/RequireForeignPython.java b/biz.aQute.api/src/main/java/biz/aQute/foreign/python/api/RequireForeignPython.java new file mode 100644 index 0000000..6541fe2 --- /dev/null +++ b/biz.aQute.api/src/main/java/biz/aQute/foreign/python/api/RequireForeignPython.java @@ -0,0 +1,19 @@ +package biz.aQute.foreign.python.api; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.osgi.annotation.bundle.Requirement; +import org.osgi.namespace.extender.ExtenderNamespace; + +@Documented +@Retention(RetentionPolicy.CLASS) +@Target({ + ElementType.TYPE, ElementType.PACKAGE +}) +@Requirement(namespace = ExtenderNamespace.EXTENDER_NAMESPACE, name = ForeignPythonConstants.EXTENDER_NAME, version=ForeignPythonConstants.VERSION) +public @interface RequireForeignPython { +} diff --git a/biz.aQute.api/src/main/java/biz/aQute/foreign/python/api/package-info.java b/biz.aQute.api/src/main/java/biz/aQute/foreign/python/api/package-info.java new file mode 100644 index 0000000..76ee060 --- /dev/null +++ b/biz.aQute.api/src/main/java/biz/aQute/foreign/python/api/package-info.java @@ -0,0 +1,5 @@ +@Version("1.0.0") +@org.osgi.annotation.bundle.Export +package biz.aQute.foreign.python.api; + +import org.osgi.annotation.versioning.Version; diff --git a/biz.aQute.api/src/main/java/biz/aQute/kpi/api/KPI.java b/biz.aQute.api/src/main/java/biz/aQute/kpi/api/KPI.java new file mode 100644 index 0000000..4dcfd9e --- /dev/null +++ b/biz.aQute.api/src/main/java/biz/aQute/kpi/api/KPI.java @@ -0,0 +1,25 @@ +package biz.aQute.kpi.api; + +import org.osgi.dto.DTO; + +/** + * A Key Performance Indicator (KPI) is a set of values representing the ongoing state of a service implementation. + *

+ * A service implementation can define a Data Transfer Object (DTO) that contains its measurements. This services + * van ask for a snapshot of this value. The caller then owns the returned object. The DTO can also be reset. + * + */ +public interface KPI { + + /** + * Reset any counters and time based values + */ + void reset(); + + /** + * Return a snapshot + * + * @return a snapshot of the KPI values + */ + DTO snapshot(); +} \ No newline at end of file diff --git a/biz.aQute.api/src/main/java/biz/aQute/kpi/api/package-info.java b/biz.aQute.api/src/main/java/biz/aQute/kpi/api/package-info.java new file mode 100644 index 0000000..da41e73 --- /dev/null +++ b/biz.aQute.api/src/main/java/biz/aQute/kpi/api/package-info.java @@ -0,0 +1,5 @@ +@org.osgi.annotation.bundle.Export +@Version("1.0.0") +package biz.aQute.kpi.api; + +import org.osgi.annotation.versioning.Version; diff --git a/biz.aQute.foreign.python.provider/.classpath b/biz.aQute.foreign.python.provider/.classpath new file mode 100644 index 0000000..efbdbe5 --- /dev/null +++ b/biz.aQute.foreign.python.provider/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/biz.aQute.foreign.python.provider/.project b/biz.aQute.foreign.python.provider/.project new file mode 100644 index 0000000..b8fffef --- /dev/null +++ b/biz.aQute.foreign.python.provider/.project @@ -0,0 +1,29 @@ + + + biz.aQute.foreign.python.provider + + + + + + org.python.pydev.PyDevBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + org.python.pydev.pythonNature + + diff --git a/biz.aQute.foreign.python.provider/.pydevproject b/biz.aQute.foreign.python.provider/.pydevproject new file mode 100644 index 0000000..2b04565 --- /dev/null +++ b/biz.aQute.foreign.python.provider/.pydevproject @@ -0,0 +1,5 @@ + + + Default + python interpreter + diff --git a/biz.aQute.foreign.python.provider/.settings/org.eclipse.core.resources.prefs b/biz.aQute.foreign.python.provider/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/biz.aQute.foreign.python.provider/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/biz.aQute.foreign.python.provider/.settings/org.eclipse.core.runtime.prefs b/biz.aQute.foreign.python.provider/.settings/org.eclipse.core.runtime.prefs new file mode 100644 index 0000000..5a0ad22 --- /dev/null +++ b/biz.aQute.foreign.python.provider/.settings/org.eclipse.core.runtime.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +line.separator=\n diff --git a/biz.aQute.foreign.python.provider/.settings/org.eclipse.jdt.core.prefs b/biz.aQute.foreign.python.provider/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..2aa9f14 --- /dev/null +++ b/biz.aQute.foreign.python.provider/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,517 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.builder.cleanOutputFolder=clean +org.eclipse.jdt.core.builder.duplicateResourceTask=warning +org.eclipse.jdt.core.builder.invalidClasspath=abort +org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore +org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch +org.eclipse.jdt.core.circularClasspath=error +org.eclipse.jdt.core.classpath.exclusionPatterns=enabled +org.eclipse.jdt.core.classpath.mainOnlyProjectHasTestOnlyDependency=error +org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled +org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullable.secondary= +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 +org.eclipse.jdt.core.compiler.problem.APILeak=warning +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=ignore +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.processAnnotations=disabled +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled +org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,NORMAL +org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME +org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false +org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=true +org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false +org.eclipse.jdt.core.formatter.align_with_spaces=false +org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=17 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 +org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_relational_operator=0 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=81 +org.eclipse.jdt.core.formatter.alignment_for_shift_operator=0 +org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0 +org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=false +org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true +org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.indent_tag_description=false +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=1 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=1 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert +org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.keep_code_block_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.keep_method_body_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false +org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.lineSplit=120 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true +org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true +org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true +org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true +org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_before_relational_operator=true +org.eclipse.jdt.core.formatter.wrap_before_shift_operator=true +org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.incompatibleJDKLevel=ignore +org.eclipse.jdt.core.incompleteClasspath=error +org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter diff --git a/biz.aQute.foreign.python.provider/.settings/org.eclipse.jdt.ui.prefs b/biz.aQute.foreign.python.provider/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 0000000..b67dd05 --- /dev/null +++ b/biz.aQute.foreign.python.provider/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,148 @@ +cleanup.add_default_serial_version_id=true +cleanup.add_generated_serial_version_id=false +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=true +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_functional_interfaces=true +cleanup.convert_to_enhanced_for_loop=true +cleanup.convert_to_enhanced_for_loop_if_loop_var_used=false +cleanup.correct_indentation=false +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.insert_inferred_type_arguments=false +cleanup.lazy_logical_operator=false +cleanup.make_local_variable_final=true +cleanup.make_parameters_final=false +cleanup.make_private_fields_final=true +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.merge_conditional_blocks=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.number_suffix=true +cleanup.objects_equals=true +cleanup.organize_imports=false +cleanup.precompile_regex=true +cleanup.push_down_negation=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_redundant_modifiers=true +cleanup.remove_redundant_semicolons=true +cleanup.remove_redundant_type_arguments=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_array_creation=true +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=true +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.simplify_lambda_expression_and_method_ref=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_anonymous_class_creation=false +cleanup.use_autoboxing=false +cleanup.use_blocks=false +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_directly_map_method=true +cleanup.use_lambda=true +cleanup.use_parentheses_in_expressions=false +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +cleanup.use_type_arguments=false +cleanup.use_unboxing=false +cleanup.use_var=false +cleanup_profile=_bnd +cleanup_settings_version=2 +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_bnd +formatter_settings_version=16 +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=false +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_functional_interfaces=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=true +sp_cleanup.insert_inferred_type_arguments=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_with_declaring_class=true +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_redundant_modifiers=true +sp_cleanup.remove_redundant_semicolons=true +sp_cleanup.remove_redundant_type_arguments=false +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_anonymous_class_creation=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_lambda=true +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true +sp_cleanup.use_type_arguments=false diff --git a/biz.aQute.foreign.python.provider/bnd.bnd b/biz.aQute.foreign.python.provider/bnd.bnd new file mode 100644 index 0000000..ae75b3a --- /dev/null +++ b/biz.aQute.foreign.python.provider/bnd.bnd @@ -0,0 +1,25 @@ +-buildpath: \ + org.osgi.service.component.annotations,\ + org.osgi.util.tracker,\ + org.osgi.framework,\ + aQute.libg,\ + biz.aQute.api.scheduler,\ + biz.aQute.api.python,\ + slf4j.api,\ + org.osgi.annotation.bundle,\ + osgi.annotation,\ + org.apache.felix.gogo.runtime,\ + org.osgi.dto,\ + biz.aQute.api.kpi + +-testpath: \ + biz.aQute.launchpad,\ + biz.aQute.wrapper.junit,\ + biz.aQute.wrapper.hamcrest,\ + osgi.core,\ + slf4j.simple,\ + org.assertj.core,\ + biz.aQute.osgi.configuration.util + + +-conditionalpackage: aQute.* diff --git a/biz.aQute.foreign.python.provider/resources/error.py b/biz.aQute.foreign.python.provider/resources/error.py new file mode 100644 index 0000000..737741f --- /dev/null +++ b/biz.aQute.foreign.python.provider/resources/error.py @@ -0,0 +1,5 @@ +import sys + +print("Error", file=sys.stderr) + +raise Exception("Some error") \ No newline at end of file diff --git a/biz.aQute.foreign.python.provider/resources/forever.py b/biz.aQute.foreign.python.provider/resources/forever.py new file mode 100644 index 0000000..9b0c6d3 --- /dev/null +++ b/biz.aQute.foreign.python.provider/resources/forever.py @@ -0,0 +1,11 @@ +import time +import sys + +print("forever",file=sys.stderr) +sys.stderr.flush() + +while True: + print(".",file=sys.stderr) + sys.stderr.flush() + time.sleep(0.25) + \ No newline at end of file diff --git a/biz.aQute.foreign.python.provider/resources/gogo.py b/biz.aQute.foreign.python.provider/resources/gogo.py new file mode 100644 index 0000000..28833dd --- /dev/null +++ b/biz.aQute.foreign.python.provider/resources/gogo.py @@ -0,0 +1,29 @@ +import json +import sys + +class Gogo(): + def __init__(self, instream, outstream): + self.instream = instream + self.outstream = outstream + def command(self, *args): + self.outstream.write( " ".join(args)+"\n") + self.outstream.flush() + json_data = self.instream.readline() + print("read " + json_data,file=sys.stderr) + sys.stderr.flush() + while json_data == None or json_data == "": + print("got none " + json_data,file=sys.stderr) + sys.stderr.flush() + json_data = self.instream.readline() + data = json.loads(json_data) + return data + + + +g = Gogo(sys.stdin, sys.stdout) +print("start python",file=sys.stderr) +sys.stderr.flush() + +while True: + r = g.command("test") + assert r['value'] == 42 \ No newline at end of file diff --git a/biz.aQute.foreign.python.provider/resources/hello.py b/biz.aQute.foreign.python.provider/resources/hello.py new file mode 100644 index 0000000..469f80a --- /dev/null +++ b/biz.aQute.foreign.python.provider/resources/hello.py @@ -0,0 +1,3 @@ +import sys + +print("Hello World", file=sys.stderr) \ No newline at end of file diff --git a/biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/configuration/Configuration.java b/biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/configuration/Configuration.java new file mode 100644 index 0000000..4441d53 --- /dev/null +++ b/biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/configuration/Configuration.java @@ -0,0 +1,6 @@ +package biz.aQute.foreign.python.configuration; + +public @interface Configuration { + String python() default "python3"; + long restartDelay() default 5000; +} diff --git a/biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/configuration/package-info.java b/biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/configuration/package-info.java new file mode 100644 index 0000000..44a107b --- /dev/null +++ b/biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/configuration/package-info.java @@ -0,0 +1,6 @@ +@org.osgi.annotation.bundle.Export +@Version("1.0.0") +package biz.aQute.foreign.python.configuration; + +import org.osgi.annotation.versioning.Version; + diff --git a/biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/provider/About.java b/biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/provider/About.java new file mode 100644 index 0000000..e5bf034 --- /dev/null +++ b/biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/provider/About.java @@ -0,0 +1,9 @@ +package biz.aQute.foreign.python.provider; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class About { + final static Logger logger = LoggerFactory.getLogger("biz.aQute.foreign.python"); + +} diff --git a/biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/provider/Exchange.java b/biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/provider/Exchange.java new file mode 100644 index 0000000..6811a82 --- /dev/null +++ b/biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/provider/Exchange.java @@ -0,0 +1,105 @@ +package biz.aQute.foreign.python.provider; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InterruptedIOException; + +public class Exchange extends InputStream implements Appendable { + final static int MASK = 0x1FFF; + char buffer[] = new char[MASK + 1]; + int available = buffer.length; + int in, out; + int count = 0; + int codepoint; + final String name; + + public Exchange(String name) { + this.name = name; + } + + @Override + public Appendable append(CharSequence csq) throws IOException { + return append(csq, 0, csq.length()); + } + + @Override + public Appendable append(CharSequence csq, int start, int end) throws IOException { + for (int i = start; i < end; i++) + append(csq.charAt(i)); + return this; + } + + @Override + public synchronized Appendable append(char c) throws IOException { + while (available == 0) { + try { + wait(); + } catch (InterruptedException e) { + throw new InterruptedIOException(); + } + } + available--; + buffer[in] = c; + in = (in + 1) & MASK; + notifyAll(); + return this; + } + + public synchronized char readChar() throws InterruptedIOException { + while (in == out) { + try { + wait(); + } catch (InterruptedException e) { + throw new InterruptedIOException(); + } + } + char c = buffer[out]; + out = (out + 1) & MASK; + available++; + return c; + } + + @Override + public int read() throws IOException { + if (count-- > 0) { + int r = codepoint >> (count * 6); + r &= 0b0011_1111; + r |= 0b1000_0000; + return r; + } + + codepoint = readChar(); + if (codepoint < 0) + return -1; + if (codepoint > 0xFFFF) + return 0; + + if (codepoint < 0x80) + return codepoint; + + if (codepoint < 0x800) { + count = 1; + int v = (codepoint >> 6) | 0b1100_0000; + return v; + } + count = 2; + int v = (codepoint >> 12) | 0b1110_0000; + return v; + } + + @Override + public synchronized int available() { + return available; + } + + @Override + public synchronized String toString() { + StringBuilder sb = new StringBuilder(name).append(": "); + int i=out; + while ( i!=out) { + sb.append(buffer[i]); + i = (i+1) & MASK; + } + return sb.toString(); + } +} diff --git a/biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/provider/GogoDTO.java b/biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/provider/GogoDTO.java new file mode 100644 index 0000000..c0bd62a --- /dev/null +++ b/biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/provider/GogoDTO.java @@ -0,0 +1,96 @@ +package biz.aQute.foreign.python.provider; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InterruptedIOException; +import java.nio.charset.StandardCharsets; + +import org.apache.felix.service.command.CommandProcessor; +import org.apache.felix.service.command.CommandSession; +import org.osgi.dto.DTO; + +import aQute.lib.io.IO; +import aQute.lib.json.JSONCodec; + +public class GogoDTO extends Thread implements AutoCloseable { + final static JSONCodec codec = new JSONCodec(); + final Exchange in; + final Exchange out; + final CommandSession session; + final ByteArrayOutputStream outputBuffer = new ByteArrayOutputStream(); + volatile long lasttime; + + public GogoDTO(CommandProcessor processor) { + in = new Exchange("fromPython"); + out = new Exchange("toPyton"); + this.session = processor.createSession(in, outputBuffer, System.err); + } + + public static class ResultDTO extends DTO { + public Object value; + public String console; + public String error; + } + + @Override + public void run() { + + try { + while (!isInterrupted()) { + String line = readLine(); + if (line == null) { + lasttime = Long.MAX_VALUE; + return; + } + lasttime = System.currentTimeMillis(); + ResultDTO result = new ResultDTO(); + try { + result.value = session.execute(line); + } catch (Exception e) { + result.error = e.getMessage(); + } + result.console = new String(outputBuffer.toByteArray(), StandardCharsets.UTF_8); + outputBuffer.reset(); + codec.enc().to(out).put(result).flush(); + out.append("\r\n"); + } + } catch (IOException e) { + // pipe closed + return; + } catch (Exception e) { + if (isInterrupted()) + return; + + About.logger.warn("reading Python gogo input failed {}", e, e); + } finally { + About.logger.info("exiting python app gogo shell"); + } + } + + private String readLine() throws InterruptedIOException { + StringBuilder sb = new StringBuilder(); + while (true) { + char ch = in.readChar(); + if (ch == '\n') + return sb.toString(); + sb.append(ch); + } + } + + @Override + public void close() throws Exception { + interrupt(); + IO.close(in); + IO.close(out); + } + + public InputStream getStdin() { + return out; + } + + public Appendable getStdout() { + return in; + } + +} diff --git a/biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/provider/PythonAdmin.java b/biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/provider/PythonAdmin.java new file mode 100644 index 0000000..cf6130d --- /dev/null +++ b/biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/provider/PythonAdmin.java @@ -0,0 +1,74 @@ +package biz.aQute.foreign.python.provider; + +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +import org.apache.felix.service.command.CommandProcessor; +import org.apache.felix.service.command.Descriptor; +import org.apache.felix.service.command.annotations.GogoCommand; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.BundleEvent; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; +import org.osgi.util.tracker.BundleTracker; +import org.osgi.util.tracker.BundleTrackerCustomizer; + +import biz.aQute.foreign.python.api.ProvideForeignPython; +import biz.aQute.foreign.python.configuration.Configuration; + +@ProvideForeignPython +@GogoCommand(scope = "python", function="python") +@Component(immediate = true, service = Object.class) +public class PythonAdmin implements BundleTrackerCustomizer { + final BundleTracker bundles; + final String python; + final CommandProcessor gogo; + final long restartDelay; + + @Activate + public PythonAdmin(BundleContext context, Configuration config, @Reference CommandProcessor cp) { + this.gogo = cp; + this.python = config.python(); + this.restartDelay = Math.max(1000 , config.restartDelay()); + this.bundles = new BundleTracker<>(context, Bundle.ACTIVE + Bundle.STARTING, this); + this.bundles.open(); + } + + @Override + public PythonApp addingBundle(Bundle bundle, BundleEvent event) { + URL entry = bundle.getEntry("python/app.py"); + if (entry == null) + return null; + try { + PythonApp app = new PythonApp(bundle, python,gogo, restartDelay); + app.open(); + return app; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + @Override + public void modifiedBundle(Bundle bundle, BundleEvent event, PythonApp object) { + + } + + @Override + public void removedBundle(Bundle bundle, BundleEvent event, PythonApp app) { + try { + app.close(); + } catch (InterruptedException e) { + // ignore + } + } + + @Descriptor("List the running Python applications and their status") + public List python() { + return new ArrayList<>(bundles.getTracked().values()); + } + +} diff --git a/biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/provider/PythonApp.java b/biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/provider/PythonApp.java new file mode 100644 index 0000000..827fc1e --- /dev/null +++ b/biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/provider/PythonApp.java @@ -0,0 +1,143 @@ +package biz.aQute.foreign.python.provider; + +import static biz.aQute.foreign.python.provider.About.logger; + +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.net.URL; +import java.util.Enumeration; +import java.util.Objects; + +import org.apache.felix.service.command.CommandProcessor; +import org.apache.felix.service.command.CommandSession; +import org.osgi.framework.Bundle; + +import aQute.lib.io.IO; +import aQute.libg.command.Command; + +class PythonApp extends Thread { + + final Bundle bundle; + final File storage; + final File version; + volatile Command command; + final String python; + volatile boolean closed; + final CommandProcessor gogo; + GogoDTO gogodto; + final long restartDelay; + + // KPI + volatile int restarts = 0; + boolean copied = false; + volatile int result; + + public PythonApp(Bundle bundle, String python, CommandProcessor gogo, long restartDelay) throws IOException { + super("Python " + bundle); + this.bundle = bundle; + this.python = python; + this.gogo = gogo; + this.restartDelay = restartDelay; + this.storage = bundle.getDataFile("python"); + this.version = IO.getFile(storage, ".version"); + } + + void open() throws Exception { + storage.mkdirs(); + if (!storage.isDirectory()) { + throw new IllegalArgumentException( + "Cannot create directory " + storage + " to store the python program for " + bundle); + } + + String newer = bundle.getLastModified() + ""; + if (storage.list().length == 0 || !Objects.equals(newer, IO.collect(version))) { + System.out.println("updating"); + IO.delete(storage); + URI base = bundle.getEntry("python/").toURI().normalize(); + Enumeration entries = bundle.findEntries("python", "*", true); + while (entries.hasMoreElements()) { + URL url = entries.nextElement(); + URI entry = url.toURI().normalize(); + String relativized = base.relativize(entry).getPath(); + File file = IO.getFile(storage, relativized); + file.getParentFile().mkdirs(); + IO.copy(url, file); + } + IO.store(newer, version); + copied = true; + } else + System.out.println("using cache"); + + start(); + } + + @Override + public void run() { + while (!closed) { + CommandSession session = null; + try { + try (GogoDTO gogo = new GogoDTO(this.gogo)) { + this.gogodto = gogo; + command = new Command(); + command.add(python); + command.add("app.py"); + command.setCwd(storage); + if (closed) + return; + + logger.debug("starting {}", this); + + gogo.start(); + command.setUseThreadForInput(true); + result = command.execute(gogo.getStdin(), gogo.getStdout(), System.err); + if (closed) { + logger.debug("executed {} result {}", this, result); + return; + } else { + logger.error("executed {} result {}", this, result); + } + } + restarts++; + Thread.sleep(restartDelay); + } catch (InterruptedException e) { + logger.info("leaving {}", this); + return; + } catch (Exception e) { + logger.error("executed {} result {}", this, e, e); + try { + Thread.sleep(4000); + } catch (InterruptedException e1) { + return; + } + } finally { + IO.close(session); + } + } + } + + synchronized void close() throws InterruptedException { + if (!this.closed) { + this.closed = true; + this.interrupt(); + if (command != null) + try { + this.command.cancel(); + } catch (Exception e) { + // ignore + } + this.join(); + } + } + + @Override + public String toString() { + long stale = -1; + if (gogodto != null) { + stale = System.currentTimeMillis() - gogodto.lasttime; + } + return "PythonApp [bundle=" + bundle + ", storage=" + storage + ", version=" + version + ", stale ms=" + + stale + "]"; + } + +} diff --git a/biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/provider/tmp b/biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/provider/tmp new file mode 100644 index 0000000..c903936 --- /dev/null +++ b/biz.aQute.foreign.python.provider/src/main/java/biz/aQute/foreign/python/provider/tmp @@ -0,0 +1,94 @@ +public class WriterOutputStream extends OutputStream { + final Writer writer; + + int count = 0; + int codepoint = 0; + + public WriterOutputStream(Writer writer) { + this.writer = writer; + } + + @Override + public void write(int b) throws IOException { + b &= 0xFF; + switch (b >> 4) { + case 0b0000: + case 0b0001: + case 0b0010: + case 0b0011: + case 0b0100: + case 0b0101: + case 0b0110: + case 0b0111: + count = 1; + codepoint = b; + break; + + case 0b1000: + case 0b1001: + case 0b1010: + case 0b1011: + codepoint <<= 6; + codepoint |= b & 0b0011_1111; + break; + + case 0b1100: + case 0b1101: + count = 2; + codepoint = b & 0b0001_1111; + break; + + case 0b1110: + count = 3; + codepoint = b & 0b0000_1111; + break; + + case 0b1111: + count = 4; + codepoint = b & 0b0000_0111; + break; + } + if (--count == 0) { + writer.write(codepoint); + } + } + } + + public class ReaderInputStream extends InputStream { + final Reader reader; + int count = 0; + int codepoint; + + public ReaderInputStream(Reader reader) { + this.reader = reader; + } + + @Override + public int read() throws IOException { + if (count-- > 0) { + int r = codepoint >> (count * 6); + r &= 0b0011_1111; + r |= 0b1000_0000; + return r; + } + + codepoint = reader.read(); + if (codepoint < 0) + return -1; + if (codepoint > 0xFFFF) + return 0; + + if (codepoint < 0x80) + return codepoint; + + if (codepoint < 0x800) { + count = 1; + int v = (codepoint >> 6) | 0b1100_0000; + return v; + } + count = 2; + int v = (codepoint >> 12) | 0b1110_0000; + return v; + } + } + \ No newline at end of file diff --git a/biz.aQute.foreign.python.provider/src/main/python/__pycache__/socket.cpython-36.pyc b/biz.aQute.foreign.python.provider/src/main/python/__pycache__/socket.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..826c333fc45bf74e85fac625f6db78a47b291d70 GIT binary patch literal 373 zcmYjMJ5Izf5FO{U3b19G`GIl_08!p2+xP@D`;R;lY zv*I(-JU`F8c^)6mX1nj_o7)BeJ}7@9B6dP)4+sPZrlDmeV;~|Czd{*FCZmCsv5fDN z0jQo_LY{t-8gk|*S4)(YsKfOqg5@ctof0^*9D*ItSTtYnok^|D{f9S( zLfR3&B)_&2Ew3JXC;1JLi$Lzwx)@nuY@>?aDgCduFep{i6{{DwG<2YOQbHoPSo5}0 z9p5&%HT8pZB=hm2@4}-ttP2b$g!4T0J8t}u>KY84vF@4ksdW{)zdg4sC5g|DS|fTb OkHdfsM$;%uGWHF{^I2d3 literal 0 HcmV?d00001 diff --git a/biz.aQute.foreign.python.provider/src/main/python/serviceregistry.py b/biz.aQute.foreign.python.provider/src/main/python/serviceregistry.py new file mode 100644 index 0000000..0ebd67a --- /dev/null +++ b/biz.aQute.foreign.python.provider/src/main/python/serviceregistry.py @@ -0,0 +1,24 @@ +from threading import Thread +from socket import * +import sys + +class Link(Thread): + + def __init__(self): + Thread.__init__(self) + self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + + + def open(self, host, port): + self.sock.connect((host, port)) + self.start() + + def run(self): + while True: + ch = self.sock.recv(1) + print(ch); + sys.out.flush() + +l = Link() +l.open("localhost", 29123) + \ No newline at end of file diff --git a/biz.aQute.foreign.python.provider/src/main/python/socket.py b/biz.aQute.foreign.python.provider/src/main/python/socket.py new file mode 100644 index 0000000..8a69bea --- /dev/null +++ b/biz.aQute.foreign.python.provider/src/main/python/socket.py @@ -0,0 +1,9 @@ + +from threading import Thread + +def fun(): + print("Hello world") + + +t = Thread(fun) +t.start() diff --git a/biz.aQute.foreign.python.provider/src/test/java/biz/aQute/foreign/python/provider/PythonTest.java b/biz.aQute.foreign.python.provider/src/test/java/biz/aQute/foreign/python/provider/PythonTest.java new file mode 100644 index 0000000..071faba --- /dev/null +++ b/biz.aQute.foreign.python.provider/src/test/java/biz/aQute/foreign/python/provider/PythonTest.java @@ -0,0 +1,128 @@ +package biz.aQute.foreign.python.provider; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.concurrent.Semaphore; +import java.util.concurrent.TimeUnit; + +import org.apache.felix.service.command.CommandProcessor; +import org.junit.Test; +import org.osgi.framework.Bundle; + +import aQute.launchpad.Launchpad; +import aQute.launchpad.LaunchpadBuilder; +import aQute.launchpad.Service; +import biz.aQute.foreign.python.configuration.Configuration; +import biz.aQute.osgi.configuration.util.ConfigSetter; + +public class PythonTest { + static LaunchpadBuilder builder = new LaunchpadBuilder().runfw("org.apache.felix.framework").gogo().bundles("org.apache.felix.scr, org.osgi.util.promise, org.osgi.util.function"); + + + @Test + public void testSimple() throws Exception { + try (Launchpad lp = builder.debug().gogo().create()) { + lp.bundle().includeResource("python/app.py", "resources/hello.py", false, false).start(); + Thread.sleep(1000); + } + } + + + @Service + CommandProcessor gogo; + + ConfigSetter cf = new ConfigSetter<>(Configuration.class); + /* + * See if a forever loop is properly terminated + */ + @Test + public void testForever() throws Exception { + + try (Launchpad lp = builder.debug().create().inject(this)) { + + PythonAdmin admin = new PythonAdmin(lp.getBundleContext(), cf.delegate(), gogo); + lp.register(PythonAdmin.class, admin); + assertThat(admin.python()).isEmpty(); + + Bundle start = lp.bundle().includeResource("python/app.py", "resources/forever.py", false, false).start(); + assertThat(admin.python()).isNotEmpty(); + + Thread.sleep(1000); + assertThat(admin.python()).isNotEmpty(); + PythonApp pythonApp = admin.python().get(0); + assertThat(pythonApp.restarts).isEqualTo(0); + start.stop(); + assertThat(admin.python()).isEmpty(); + + } + } + + /* + * Test if we can do a gogo command + */ + + Semaphore commandCalled = new Semaphore(0); + + public class GogoCommand { + public int test() { + System.out.println("called 42"); + commandCalled.release(); + return 42; + } + } + + @Test + public void testGogo() throws Exception { + try (Launchpad lp = builder.debug().create().inject(this)) { + + PythonAdmin admin = new PythonAdmin(lp.getBundleContext(), cf.delegate(), gogo); + lp.register(PythonAdmin.class, admin); + + lp.register(Object.class, new GogoCommand(), CommandProcessor.COMMAND_SCOPE, "scope", CommandProcessor.COMMAND_FUNCTION, new String[]{"test"}); + lp.bundle().includeResource("python/app.py", "resources/gogo.py", false, false).start(); + + assertThat(commandCalled.tryAcquire(1,TimeUnit.SECONDS)).isTrue(); + } + } + + @Test + public void testUpdate() throws Exception { + try (Launchpad lp = builder.debug().gogo().create().inject(this)) { + + PythonAdmin admin = new PythonAdmin(lp.getBundleContext(), cf.delegate(), gogo); + lp.register(PythonAdmin.class, admin); + + Bundle b = lp.bundle().includeResource("python/app.py", "resources/hello.py", false, false).install(); + b.start(); + PythonApp pythonApp = admin.python().get(0); + assertThat(pythonApp.copied).isTrue(); + Thread.sleep(2000); + b.stop(); + Thread.sleep(2000); + assertThat(admin.python()).isEmpty(); + b.start(); + pythonApp = admin.python().get(0); + assertThat(pythonApp.copied).isFalse(); + } + } + + @Test + public void testRestart() throws Exception { + ConfigSetter cf = new ConfigSetter<>(Configuration.class); + cf.set(cf.delegate().restartDelay()).to(1000L); + + try (Launchpad lp = builder.debug().gogo().create().inject(this)) { + + PythonAdmin admin = new PythonAdmin(lp.getBundleContext(), cf.delegate(), gogo); + lp.register(PythonAdmin.class, admin); + + Bundle b = lp.bundle().includeResource("python/app.py", "resources/error.py", false, false).install(); + b.start(); + Thread.sleep(3000); + PythonApp pythonApp = admin.python().get(0); + assertThat(pythonApp.restarts).isGreaterThan(1); + System.out.println(pythonApp.result); + assertThat(pythonApp.result).isNotEqualTo(0); + } + } +} diff --git a/biz.aQute.foreign.python.provider/test.bndrun b/biz.aQute.foreign.python.provider/test.bndrun new file mode 100644 index 0000000..e69de29 diff --git a/cnf/central.mvn b/cnf/central.mvn index f89eb07..86b3da8 100644 --- a/cnf/central.mvn +++ b/cnf/central.mvn @@ -154,3 +154,7 @@ io.netty:netty-all:4.1.58.Final org.apache.aries.rsa:org.apache.aries.rsa.core:1.16.0 org.apache.aries.rsa:org.apache.aries.rsa.spi:1.16.0 + + +org.eclipse.jgit:org.eclipse.jgit:5.12.0.202106070339-r +com.googlecode.javaewah:JavaEWAH:1.1.12 \ No newline at end of file