getAttributes();
+}
diff --git a/azure-functions-java-core-library/src/main/java/com/microsoft/azure/functions/package-info.java b/azure-functions-java-core-library/src/main/java/com/microsoft/azure/functions/package-info.java
new file mode 100644
index 0000000..b42f15a
--- /dev/null
+++ b/azure-functions-java-core-library/src/main/java/com/microsoft/azure/functions/package-info.java
@@ -0,0 +1,11 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ */
+
+/**
+ * Root package
+ */
+
+package com.microsoft.azure.functions;
diff --git a/azure-functions-java-core-library/src/test/java/com/microsoft/azure/functions/HttpStatusTest.java b/azure-functions-java-core-library/src/test/java/com/microsoft/azure/functions/HttpStatusTest.java
new file mode 100644
index 0000000..a0d75d8
--- /dev/null
+++ b/azure-functions-java-core-library/src/test/java/com/microsoft/azure/functions/HttpStatusTest.java
@@ -0,0 +1,27 @@
+package com.microsoft.azure.functions;
+
+import org.junit.Test;
+
+import static junit.framework.TestCase.assertTrue;
+
+/**
+ * Unit tests that enforce annotation contracts and conventions for Functions
+ */
+public class HttpStatusTest {
+ @Test
+ public void set_custom_httpstatuscode() {
+ HttpStatusType customHttpStatus = HttpStatusType.custom(209);
+ assertTrue(customHttpStatus.value() == 209);
+ }
+
+ @Test
+ public void set_standard_httpstatuscode() {
+ HttpStatusType customHttpStatus = HttpStatus.OK;
+ assertTrue(customHttpStatus.value() == 200);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void set_invalid_httpstatuscode() {
+ HttpStatusType.custom(-100);
+ }
+}
diff --git a/azure-functions-java-core-library/updateVersions.bat b/azure-functions-java-core-library/updateVersions.bat
new file mode 100644
index 0000000..ecb1345
--- /dev/null
+++ b/azure-functions-java-core-library/updateVersions.bat
@@ -0,0 +1,13 @@
+set coreLibraryVersion=%1
+set libraryVersion=%2
+set pluginVersion=%3
+echo setting azure.functions.java.core.library.version to %coreLibraryVersion%
+call mvn versions:set-property -Dproperty=azure.functions.java.core.library.version -DnewVersion=%coreLibraryVersion% -U -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B
+IF DEFINED libraryVersion (
+echo setting azure.functions.java.library.version to %libraryVersion%
+call mvn versions:set-property -Dproperty=azure.functions.java.library.version -DnewVersion=%libraryVersion% -U -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B
+)
+IF DEFINED pluginVersion (
+echo setting azure.functions.maven.plugin.version to %pluginVersion%
+call mvn versions:set-property -Dproperty=azure.functions.maven.plugin.version -DnewVersion=%pluginVersion% -U -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B
+)
diff --git a/azure-functions-java-spi-library/.gitignore b/azure-functions-java-spi-library/.gitignore
new file mode 100644
index 0000000..044af7d
--- /dev/null
+++ b/azure-functions-java-spi-library/.gitignore
@@ -0,0 +1,41 @@
+# Compiled class file
+*.class
+
+# Log file
+*.log
+
+# BlueJ files
+*.ctxt
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.nar
+*.ear
+*.zip
+*.tar.gz
+*.rar
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+/.idea/*
+/target/*
+/bin
+/.classpath
+/.settings/*
+.project
+/azure-maven-archetypes/
+/azure-maven-plugins/
+/ciTestDir/*
+/target/
+/Azure.Functions.Cli/*
+/azure-functions-java-worker/
+
+#IDE
+*.iml
+
+#OSX
+.DS_Store
\ No newline at end of file
diff --git a/azure-functions-java-spi-library/pom.xml b/azure-functions-java-spi-library/pom.xml
new file mode 100644
index 0000000..4b4f51f
--- /dev/null
+++ b/azure-functions-java-spi-library/pom.xml
@@ -0,0 +1,128 @@
+
+ 4.0.0
+ com.microsoft.azure.functions
+ azure-functions-java-spi-library
+ 1.0.0
+ jar
+
+ com.microsoft.maven
+ java-8-parent
+ 8.0.1
+
+
+ Microsoft Azure Functions Java SPI Types
+ This package contains all SPI interfaces for third parties to interact with Microsoft Azure functions runtime.
+ https://azure.microsoft.com/en-us/services/functions
+
+
+ UTF-8
+
+
+
+
+ MIT License
+ https://opensource.org/licenses/MIT
+ repo
+
+
+
+
+ scm:git:https://github.com/Azure/azure-functions-java-worker
+ scm:git:git@github.com:Azure/azure-functions-java-worker
+ https://github.com/Azure/azure-functions-java-worker
+ HEAD
+
+
+
+
+ Microsoft
+ Microsoft Corporation
+
+
+
+
+
+ ossrh
+ Sonatype Snapshots
+ https://oss.sonatype.org/content/repositories/snapshots/
+ true
+ default
+
+
+
+
+
+ maven.snapshots
+ Maven Central Snapshot Repository
+ https://oss.sonatype.org/content/repositories/snapshots/
+
+ false
+
+
+ true
+
+
+
+
+
+
+ com.microsoft.azure.functions
+ azure-functions-java-core-library
+ 1.1.0
+ compile
+
+
+
+
+
+
+
+ maven-compiler-plugin
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
+
+ org.apache.maven.plugins
+ maven-enforcer-plugin
+ 3.0.0-M2
+
+
+ enforce-maven
+
+ enforce
+
+
+
+
+ 3.2.0
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ ${project.build.directory}
+
+
+ testing-project-jar
+ ${project.artifactId}-${project.version}-tests.jar
+
+
+
+
+
+
+
+
diff --git a/azure-functions-java-spi-library/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/Middleware.java b/azure-functions-java-spi-library/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/Middleware.java
new file mode 100644
index 0000000..b0b4602
--- /dev/null
+++ b/azure-functions-java-spi-library/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/Middleware.java
@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ */
+package com.microsoft.azure.functions.internal.spi.middleware;
+
+/**
+ * This interface is implemented by middlewares to include middleware core logics.
+ *
+ * This class is internal and is hence not for public use at this time. Its APIs are unstable and can change
+ * at any time.
+ */
+public interface Middleware {
+ /**
+ * Middlewares will override this method to include their own logics.
+ * @param context execution context that pass along middleware chain
+ * @param chain middleware chain {@link MiddlewareChain}
+ * @throws Exception any exception that is thrown out in next middleware
+ */
+ void invoke(MiddlewareContext context, MiddlewareChain chain) throws Exception;
+}
diff --git a/azure-functions-java-spi-library/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/MiddlewareChain.java b/azure-functions-java-spi-library/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/MiddlewareChain.java
new file mode 100644
index 0000000..566b6fb
--- /dev/null
+++ b/azure-functions-java-spi-library/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/MiddlewareChain.java
@@ -0,0 +1,21 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ */
+package com.microsoft.azure.functions.internal.spi.middleware;
+
+/**
+ * The middleware chain.
+ *
+ *
This class is internal and is hence not for public use at this time. Its APIs are unstable and can change
+ * at any time.
+ */
+public interface MiddlewareChain {
+ /**
+ * Invokes next middleware in the chain.
+ * @param context execution context that pass along middleware chain
+ * @throws Exception any exception that happen along middleware chain
+ */
+ void doNext(MiddlewareContext context) throws Exception;
+}
diff --git a/azure-functions-java-spi-library/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/MiddlewareContext.java b/azure-functions-java-spi-library/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/MiddlewareContext.java
new file mode 100644
index 0000000..70f4a96
--- /dev/null
+++ b/azure-functions-java-spi-library/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/MiddlewareContext.java
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ */
+
+package com.microsoft.azure.functions.internal.spi.middleware;
+
+import com.microsoft.azure.functions.ExecutionContext;
+
+/**
+ * Middleware Execution Context
+ *
+ *
This class is internal and is hence not for public use at this time. Its APIs are unstable and can change
+ * at any time.
+ */
+public interface MiddlewareContext extends ExecutionContext {
+ /**
+ * Returns the name of parameter defined in customer function.
+ * The input is the simple class name of target annotation.
+ * @param annotationSimpleClassName the simple class name of target annotation
+ * @return the name of parameter defined in customer function
+ */
+ //TODO: @Nullable
+ String getParameterName(String annotationSimpleClassName);
+
+ /**
+ * Returns corresponding parameter value sent from host by the given the parameter name.
+ * The return type is Object but the real type is String (currently only support get String type,
+ * planning to support other types in the future.)
+ * Make it return Object to avoid break this API in the future.
+ * @param name the name of parameter
+ * @return an object which will be String type that represents parameter value of customer function
+ */
+ //TODO: @Nullable
+ Object getParameterValue(String name);
+
+ /**
+ * Updates the parameter value by parameter name. It will be the actual parameter value
+ * used when invoke customer function. This API give middleware ability to update function input.
+ * @param name the name of parameter to be updated
+ * @param value the value of parameter to be updated
+ */
+ void updateParameterValue(String name, Object value);
+
+ /**
+ * Returns the return value from customer function invocation.
+ * @return an object that is the return value of customer function
+ */
+ //TODO: @Nullable
+ Object getReturnValue();
+
+ /**
+ * Updates the return value from customer function invocation.
+ * @param returnValue value that will be updated as function return value.
+ */
+ void updateReturnValue(Object returnValue);
+}
diff --git a/azure-functions-java-spi-library/src/main/java/com/microsoft/azure/functions/spi/inject/FunctionInstanceInjector.java b/azure-functions-java-spi-library/src/main/java/com/microsoft/azure/functions/spi/inject/FunctionInstanceInjector.java
new file mode 100644
index 0000000..fa95cd5
--- /dev/null
+++ b/azure-functions-java-spi-library/src/main/java/com/microsoft/azure/functions/spi/inject/FunctionInstanceInjector.java
@@ -0,0 +1,23 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ */
+package com.microsoft.azure.functions.spi.inject;
+
+/**
+ * The instance factory that used by DI framework to initialize function instance.
+ *
+ * @since 1.2.0
+ */
+public interface FunctionInstanceInjector {
+ /**
+ * This method is used by DI framework to initialize DI container. This method takes in the customer class and return
+ * an instance create by the DI framework, later customer functions will be invoked on this class instance.
+ * @param functionClass the class that contains customer functions
+ * @param customer functions class type
+ * @return the instance that will be invoked on by azure functions java worker
+ * @throws Exception any exception that is thrown out during DI framework create instance of function class
+ */
+ T getInstance(Class functionClass) throws Exception;
+}
diff --git a/pom.xml b/pom.xml
index 62284a2..afd9446 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,145 +1,20 @@
- 4.0.0
- com.microsoft.azure.functions
- azure-functions-java-core-library
- 1.1.0
- jar
-
- com.microsoft.maven
- java-8-parent
- 8.0.1
-
-
- Microsoft Azure Functions Java Core Types
- This package contains all Java interfaces and annotations to interact with Microsoft Azure functions runtime.
- https://azure.microsoft.com/en-us/services/functions
-
-
- UTF-8
-
-
-
-
- MIT License
- https://opensource.org/licenses/MIT
- repo
-
-
-
-
- scm:git:https://github.com/Azure/azure-functions-java-worker
- scm:git:git@github.com:Azure/azure-functions-java-worker
- https://github.com/Azure/azure-functions-java-worker
- HEAD
-
-
-
-
- pgopa
- Pragna Gopa
- pgopa@microsoft.com
-
-
- xscript
- Kevin Zhao
- kevinzha@microsoft.com
-
-
-
-
-
- ossrh
- Sonatype Snapshots
- https://oss.sonatype.org/content/repositories/snapshots/
- true
- default
-
-
-
-
-
- maven.snapshots
- Maven Central Snapshot Repository
- https://oss.sonatype.org/content/repositories/snapshots/
-
- false
-
-
- true
-
-
-
-
-
-
-
-
- org.reflections
- reflections
- test
-
-
- junit
- junit
- test
-
-
- org.mockito
- mockito-core
- test
-
-
-
-
-
-
-
- maven-compiler-plugin
-
-
- org.apache.maven.plugins
- maven-source-plugin
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- 3.0.0-M2
-
-
- enforce-maven
-
- enforce
-
-
-
-
- 3.2.0
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
- ${project.build.directory}
-
-
- testing-project-jar
- ${project.artifactId}-${project.version}-tests.jar
-
-
-
-
-
-
-
-
+ 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">
+ 4.0.0
+
+ com.microsoft.azure.functions
+ azure-functions-java-libs
+ pom
+ 1.0-SNAPSHOT
+
+ azure-functions-java-core-library
+ azure-functions-java-spi-library
+
+
+
+ 8
+ 8
+
+
+
\ No newline at end of file
From 3c0f4abb9aa2c5d02962a0c007d2fe85eb03823a Mon Sep 17 00:00:00 2001
From: kaibocai <89094811+kaibocai@users.noreply.github.com>
Date: Tue, 11 Oct 2022 14:32:38 -0500
Subject: [PATCH 02/14] update code owner
---
CODEOWNERS | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/CODEOWNERS b/CODEOWNERS
index 4ac24ef..b22ea0c 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -7,5 +7,6 @@
# https://help.github.com/articles/about-codeowners/
# Default owner for repo
-* @pragnagopa
-* @amamounelsayed
\ No newline at end of file
+* @amamounelsayed
+* @shreyas-gopalakrishna
+* @kaibocai
From 26094ad72db99f2b94a4053aa57513f02b99bc73 Mon Sep 17 00:00:00 2001
From: kaibocai <89094811+kaibocai@users.noreply.github.com>
Date: Tue, 11 Oct 2022 14:47:38 -0500
Subject: [PATCH 03/14] remove core lib pipeline files
---
azure-pipelines.yml | 74 ----------------
build.ps1 | 126 ---------------------------
mvnBuild.bat | 1 -
mvnBuildFunctionPluginsSkipTests.bat | 1 -
mvnBuildSkipTests.bat | 1 -
mvnGenerateArchetype.bat | 3 -
updateVersions.bat | 13 ---
7 files changed, 219 deletions(-)
delete mode 100644 azure-pipelines.yml
delete mode 100644 build.ps1
delete mode 100644 mvnBuild.bat
delete mode 100644 mvnBuildFunctionPluginsSkipTests.bat
delete mode 100644 mvnBuildSkipTests.bat
delete mode 100644 mvnGenerateArchetype.bat
delete mode 100644 updateVersions.bat
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
deleted file mode 100644
index 21d4780..0000000
--- a/azure-pipelines.yml
+++ /dev/null
@@ -1,74 +0,0 @@
-trigger:
- tags:
- include:
- - '*'
- branches:
- include:
- - dev
-pr:
- branches:
- include:
- - dev
- - master
-
-
-jobs:
- - job: "Build_And_Test_Java_Library_Windows"
- pool:
- name: '1ES-Hosted-AzFunc'
- demands:
- - ImageOverride -equals MMS2019TLS
-
- steps:
- - task: NuGetToolInstaller@1
- inputs:
- checkLatest: true
- - pwsh: |
- Write-Host "Java_HOME: $JAVA_HOME"
- Get-Command mvn
- displayName: 'Check Maven is installed'
-
- - pwsh: |
- Invoke-WebRequest 'https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.ps1' -OutFile 'dotnet-install.ps1'
- ./dotnet-install.ps1 -InstallDir "$env:ProgramFiles/dotnet" -Version "6.0.100-rc.2.21505.57" -Channel 'release'
- displayName: 'Install the .Net version used by the Core Tools for Windows'
- condition: eq( variables['Agent.OS'], 'Windows_NT' )
- - bash: |
- curl -sSL https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.sh | bash /dev/stdin -v '6.0.100-rc.2.21505.57' -c 'release' --install-dir /usr/share/dotnet
- displayName: 'Install the .Net version used by the Core Tools for Linux'
- condition: eq( variables['Agent.OS'], 'Linux' )
-
- - pwsh: '& .\build.ps1'
- displayName: 'Build project with java core library'
- - pwsh: |
- $currDir = Get-Location
- $Env:Path = $Env:Path+";$currDir\Azure.Functions.Cli"
- ls $currDir\Azure.Functions.Cli
- func --version
- cd ./azure-functions-java-worker/endtoendtests
- mvn clean package `-Dmaven`.javadoc`.skip=true `-Dmaven`.test`.skip `-Dorg`.slf4j`.simpleLogger`.log`.org`.apache`.maven`.cli`.transfer`.Slf4jMavenTransferListener=warn `-B
- Copy-Item "confluent_cloud_cacert.pem" ".\target\azure-functions\azure-functions-java-endtoendtests"
- displayName: 'Package Java for E2E'
- - task: DotNetCoreCLI@2
- inputs:
- command: 'test'
- projects: |
- azure-functions-java-worker\endtoendtests\Azure.Functions.Java.Tests.E2E\Azure.Functions.Java.Tests.E2E\Azure.Functions.Java.Tests.E2E.csproj
- env:
- AzureWebJobsStorage: $(AzureWebJobsStorage)
- AzureWebJobsCosmosDBConnectionString: $(AzureWebJobsCosmosDBConnectionString)
- AzureWebJobsServiceBus: $(AzureWebJobsServiceBus)
- AzureWebJobsEventHubReceiver: $(AzureWebJobsEventHubReceiver)
- AzureWebJobsEventHubSender_2: $(AzureWebJobsEventHubSender_2)
- AzureWebJobsEventHubSender: $(AzureWebJobsEventHubSender)
- AzureWebJobsEventHubPath: $(AzureWebJobsEventHubPath)
- SBTopicName: $(SBTopicName)
- SBTopicSubName: $(SBTopicSubName)
- CosmosDBDatabaseName: $(CosmosDBDatabaseName)
- SBQueueName: $(SBQueueName)
- BrokerList": $(BrokerList)
- ConfluentCloudUsername: $(ConfluentCloudUsername)
- ConfluentCloudPassword: $(ConfluentCloudPassword)
- AzureWebJobsEventGridOutputBindingTopicUriString: $(AzureWebJobsEventGridOutputBindingTopicUriString)
- AzureWebJobsEventGridOutputBindingTopicKeyString: $(AzureWebJobsEventGridOutputBindingTopicKeyString)
- displayName: 'Build & Run tests for java 8'
\ No newline at end of file
diff --git a/build.ps1 b/build.ps1
deleted file mode 100644
index ef3a03e..0000000
--- a/build.ps1
+++ /dev/null
@@ -1,126 +0,0 @@
-# A function that checks exit codes and fails script if an error is found
-function StopOnFailedExecution {
- if ($LastExitCode)
- {
- exit $LastExitCode
- }
-}
-
-# Clone and install function maven archetype
-git clone https://github.com/Microsoft/azure-maven-archetypes.git -b develop
-Push-Location -Path "./azure-maven-archetypes/azure-functions-archetype" -StackName libraryDir
-Write-Host "Build and install azure-maven-archetypes"
-cmd.exe /c '.\..\..\mvnBuildSkipTests.bat'
-StopOnFailedExecution
-Pop-Location -StackName "libraryDir"
-$archetypePom = Get-Content ".\azure-maven-archetypes\azure-functions-archetype\pom.xml" -Raw
-$archetypePom -match "(.*)"
-$atchetypeVersion = $matches[1]
-Write-Host "atchetypeVersion: " $atchetypeVersion
-
-# Clone and install function maven plugin
-git clone https://github.com/Microsoft/azure-maven-plugins.git -b develop
-Push-Location -Path "./azure-maven-plugins" -StackName libraryDir
-Write-Host "Build and install azure-functions-maven-plugins"
-cmd.exe /c '.\..\mvnBuildFunctionPluginsSkipTests.bat'
-StopOnFailedExecution
-Pop-Location -StackName "libraryDir"
-$pluginPom = Get-Content ".\azure-maven-plugins\azure-functions-maven-plugin\pom.xml" | where {$_ -ne ""}
-$nospace = $pluginPom -replace '\s'
-$versions =$nospace -match "(.*)<\/version>"
-$start = $versions[1].IndexOf('>')+1
-$end = $versions[1].LastIndexOf('<')
-$substringLen = $end-$start
-$pluginVersion = $versions[1].substring($start, $substringLen)
-Write-Host "pluginPomVersion: " $pluginVersion
-if ([string]::IsNullOrEmpty($pluginVersion))
-{
- exit -1
-}
-StopOnFailedExecution
-
-
-# Get azure-functions-core-library
-Write-Host "Build and install azure-functions-java-core-library"
-cmd.exe /c '.\mvnBuild.bat'
-StopOnFailedExecution
-$coreLibraryPom = Get-Content "pom.xml" -Raw
-$coreLibraryPom -match "(.*)"
-$coreLibraryVersion = $matches[1]
-Write-Host "coreLibraryVersion: " $coreLibraryVersion
-
-# Get azure-functions-library
-git clone https://github.com/Azure/azure-functions-java-library.git -b dev
-Push-Location -Path "./azure-functions-java-library" -StackName libraryDir
-Write-Host "Updating azure-functions-java-library to use current version of azure-functions-java-core-library"
-cmd.exe /c .\..\updateVersions.bat $coreLibraryVersion
-Write-Host "Building azure-functions-java-library"
-cmd.exe /c '.\mvnBuild.bat'
-StopOnFailedExecution
-$libraryPom = Get-Content "pom.xml" -Raw
-$libraryPom -match "(.*)"
-$libraryVersion = $matches[1]
-Write-Host "libraryVersion: " $libraryVersion
-Pop-Location -StackName "libraryDir"
-
-# Download azure-functions-core-tools
-$FUNC_RUNTIME_VERSION = '4'
-$arch = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLowerInvariant()
-$os = if ($IsWindows) { "win" } else { if ($IsMacOS) { "osx" } else { "linux" } }
-
-$currDir = Get-Location
-$skipCliDownload = $false
-if($args[0])
-{
-$skipCliDownload = $args[0]
-}
-Write-Host "skipCliDownload" $skipCliDownload
-if(!$skipCliDownload)
-{
-Write-Host "Deleting Functions Core Tools if exists...."
-Remove-Item -Force ./Azure.Functions.Cli.zip -ErrorAction Ignore
-Remove-Item -Recurse -Force ./Azure.Functions.Cli -ErrorAction Ignore
-
-Write-Host "Downloading Functions Core Tools...."
-Invoke-RestMethod -Uri "https://functionsclibuilds.blob.core.windows.net/builds/$FUNC_RUNTIME_VERSION/latest/version.txt" -OutFile version.txt
-Write-Host "Using Functions Core Tools version: $(Get-Content -Raw version.txt)"
-Remove-Item version.txt
-
-$url = "https://functionsclibuilds.blob.core.windows.net/builds/$FUNC_RUNTIME_VERSION/latest/Azure.Functions.Cli.$os-$arch.zip"
-$output = "$currDir\Azure.Functions.Cli.zip"
-$wc = New-Object System.Net.WebClient
-$wc.DownloadFile($url, $output)
-
-Write-Host "Extracting Functions Core Tools...."
-Expand-Archive ".\Azure.Functions.Cli.zip" -DestinationPath ".\Azure.Functions.Cli"
-}
-$Env:Path = $Env:Path+";$currDir\Azure.Functions.Cli"
-
-# Clone and build azure-functions-java-worker
-git clone https://github.com/azure/azure-functions-java-worker -b dev
-Push-Location -Path "./azure-functions-java-worker" -StackName libraryDir
-Write-Host "Updating azure-functions-java-worker to use current version of the java core library"
-
-cmd.exe /c .\..\updateVersions.bat $coreLibraryVersion
-Write-Host "Building azure-functions-java-worker"
-cmd.exe /c '.\mvnBuild.bat'
-StopOnFailedExecution
-Pop-Location -StackName "libraryDir"
-
-# Update core tools with the new Java worker
-Write-Host "Replacing Java worker binaries in the Core Tools..."
-Get-ChildItem -Path "./azure-functions-java-worker/target/*" -Include 'azure*' -Exclude '*shaded.jar','*tests.jar' | ForEach-Object {
- Copy-Item $_.FullName "./Azure.Functions.Cli/workers/java/azure-functions-java-worker.jar" -Force -Verbose
-}
-Copy-Item -Path "./azure-functions-java-worker/annotationLib" -Destination "./Azure.Functions.Cli/workers/java/annotationLib" -Recurse -Verbose
-Copy-Item -Path ".\Azure.Functions.Cli" -Destination ".\azure-functions-java-worker\Azure.Functions.Cli" -Recurse
-
-# Updating end to end tests with the new library
-Push-Location -Path "./azure-functions-java-worker/endtoendtests" -StackName libraryDir
-Write-Host "Updating azure-functions-java-worker endtoendtests to use current version of the java core library"
-
-cmd.exe /c .\..\..\updateVersions.bat $coreLibraryVersion $libraryVersion $pluginVersion
-Write-Host "Building azure-functions-java-worker end to end tests"
-cmd.exe /c '.\..\..\mvnBuild.bat'
-StopOnFailedExecution
-Pop-Location -StackName "libraryDir"
diff --git a/mvnBuild.bat b/mvnBuild.bat
deleted file mode 100644
index c78c8bb..0000000
--- a/mvnBuild.bat
+++ /dev/null
@@ -1 +0,0 @@
-mvn clean install -U -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B -Dgpg.skip
\ No newline at end of file
diff --git a/mvnBuildFunctionPluginsSkipTests.bat b/mvnBuildFunctionPluginsSkipTests.bat
deleted file mode 100644
index a20a03a..0000000
--- a/mvnBuildFunctionPluginsSkipTests.bat
+++ /dev/null
@@ -1 +0,0 @@
-mvn clean install -Dcheckstyle.skip -Dmaven.javadoc.skip=true -Dmaven.test.skip -U -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B
\ No newline at end of file
diff --git a/mvnBuildSkipTests.bat b/mvnBuildSkipTests.bat
deleted file mode 100644
index 34a2e05..0000000
--- a/mvnBuildSkipTests.bat
+++ /dev/null
@@ -1 +0,0 @@
-mvn clean install -Dmaven.javadoc.skip=true -Dmaven.test.skip -U -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B
\ No newline at end of file
diff --git a/mvnGenerateArchetype.bat b/mvnGenerateArchetype.bat
deleted file mode 100644
index f7bbf50..0000000
--- a/mvnGenerateArchetype.bat
+++ /dev/null
@@ -1,3 +0,0 @@
-set atchetypeVersion=%1
-
-mvn archetype:generate -DarchetypeCatalog="local" -DarchetypeGroupId="com.microsoft.azure" -DarchetypeArtifactId="azure-functions-archetype" -DarchetypeVersion="%atchetypeVersion%" -DgroupId="com.microsoft" -DartifactId="e2etestproject" -Dversion="1.0-SNAPSHOT" -Dpackage="com.microsoft" -DappRegion="westus" -DresourceGroup="e2etest-java-functions-group" -DappName="e2etest-java-functions" -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B
diff --git a/updateVersions.bat b/updateVersions.bat
deleted file mode 100644
index ecb1345..0000000
--- a/updateVersions.bat
+++ /dev/null
@@ -1,13 +0,0 @@
-set coreLibraryVersion=%1
-set libraryVersion=%2
-set pluginVersion=%3
-echo setting azure.functions.java.core.library.version to %coreLibraryVersion%
-call mvn versions:set-property -Dproperty=azure.functions.java.core.library.version -DnewVersion=%coreLibraryVersion% -U -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B
-IF DEFINED libraryVersion (
-echo setting azure.functions.java.library.version to %libraryVersion%
-call mvn versions:set-property -Dproperty=azure.functions.java.library.version -DnewVersion=%libraryVersion% -U -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B
-)
-IF DEFINED pluginVersion (
-echo setting azure.functions.maven.plugin.version to %pluginVersion%
-call mvn versions:set-property -Dproperty=azure.functions.maven.plugin.version -DnewVersion=%pluginVersion% -U -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B
-)
From a4b86c0ca16bbf5110e9cdbbad8c05db59012529 Mon Sep 17 00:00:00 2001
From: kaibocai <89094811+kaibocai@users.noreply.github.com>
Date: Tue, 11 Oct 2022 14:49:10 -0500
Subject: [PATCH 04/14] remove parent project src folder
---
.../functions/BrokerAuthenticationMode.java | 27 ------
.../azure/functions/BrokerProtocol.java | 19 ----
.../azure/functions/ExecutionContext.java | 54 -----------
.../microsoft/azure/functions/HttpMethod.java | 30 -------
.../azure/functions/HttpRequestMessage.java | 80 -----------------
.../azure/functions/HttpResponseMessage.java | 90 -------------------
.../microsoft/azure/functions/HttpStatus.java | 74 ---------------
.../azure/functions/HttpStatusType.java | 35 --------
.../azure/functions/OutputBinding.java | 26 ------
.../azure/functions/RetryContext.java | 37 --------
.../azure/functions/RpcException.java | 20 -----
.../azure/functions/TraceContext.java | 35 --------
.../internal/spi/middleware/Middleware.java | 22 -----
.../spi/middleware/MiddlewareChain.java | 21 -----
.../spi/middleware/MiddlewareContext.java | 58 ------------
.../azure/functions/package-info.java | 11 ---
.../azure/functions/HttpStatusTest.java | 27 ------
17 files changed, 666 deletions(-)
delete mode 100644 src/main/java/com/microsoft/azure/functions/BrokerAuthenticationMode.java
delete mode 100644 src/main/java/com/microsoft/azure/functions/BrokerProtocol.java
delete mode 100644 src/main/java/com/microsoft/azure/functions/ExecutionContext.java
delete mode 100644 src/main/java/com/microsoft/azure/functions/HttpMethod.java
delete mode 100644 src/main/java/com/microsoft/azure/functions/HttpRequestMessage.java
delete mode 100644 src/main/java/com/microsoft/azure/functions/HttpResponseMessage.java
delete mode 100644 src/main/java/com/microsoft/azure/functions/HttpStatus.java
delete mode 100644 src/main/java/com/microsoft/azure/functions/HttpStatusType.java
delete mode 100644 src/main/java/com/microsoft/azure/functions/OutputBinding.java
delete mode 100644 src/main/java/com/microsoft/azure/functions/RetryContext.java
delete mode 100644 src/main/java/com/microsoft/azure/functions/RpcException.java
delete mode 100644 src/main/java/com/microsoft/azure/functions/TraceContext.java
delete mode 100644 src/main/java/com/microsoft/azure/functions/internal/spi/middleware/Middleware.java
delete mode 100644 src/main/java/com/microsoft/azure/functions/internal/spi/middleware/MiddlewareChain.java
delete mode 100644 src/main/java/com/microsoft/azure/functions/internal/spi/middleware/MiddlewareContext.java
delete mode 100644 src/main/java/com/microsoft/azure/functions/package-info.java
delete mode 100644 src/test/java/com/microsoft/azure/functions/HttpStatusTest.java
diff --git a/src/main/java/com/microsoft/azure/functions/BrokerAuthenticationMode.java b/src/main/java/com/microsoft/azure/functions/BrokerAuthenticationMode.java
deleted file mode 100644
index 07fc003..0000000
--- a/src/main/java/com/microsoft/azure/functions/BrokerAuthenticationMode.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for
- * license information.
- */
-package com.microsoft.azure.functions;
-
-/**
- * Defines the broker authentication modes
- */
-public enum BrokerAuthenticationMode {
- NOTSET(-1),
- GSSAPI(0),
- PLAIN(1),
- SCRAMSHA256(2),
- SCRAMSHA512(3);
-
- private final int value;
-
- BrokerAuthenticationMode(final int value) {
- this.value = value;
- }
-
- public int getValue() {
- return value;
- }
-}
diff --git a/src/main/java/com/microsoft/azure/functions/BrokerProtocol.java b/src/main/java/com/microsoft/azure/functions/BrokerProtocol.java
deleted file mode 100644
index d3eaf34..0000000
--- a/src/main/java/com/microsoft/azure/functions/BrokerProtocol.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for
- * license information.
- */
-package com.microsoft.azure.functions;
-
-public enum BrokerProtocol {
- NOTSET(-1),
- PLAINTEXT(0),
- SSL(1),
- SASLPLAINTEXT(2),
- SASLSSL(3);
-
- private int value;
- BrokerProtocol(final int value) {
- this.value = value;
- }
-}
diff --git a/src/main/java/com/microsoft/azure/functions/ExecutionContext.java b/src/main/java/com/microsoft/azure/functions/ExecutionContext.java
deleted file mode 100644
index 7874d10..0000000
--- a/src/main/java/com/microsoft/azure/functions/ExecutionContext.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for
- * license information.
- */
-
-package com.microsoft.azure.functions;
-
-import java.util.logging.Logger;
-
-/**
- * The execution context enables interaction with the Azure Functions execution environment.
- *
- * @since 1.0.0
- */
-public interface ExecutionContext {
- /**
- * Returns the built-in logger, which is integrated with the logging functionality provided in the Azure Functions
- * portal, as well as in Azure Application Insights.
- *
- * @return A Java logger that will see output directed to Azure Portal, as well as any other configured output
- * locations.
- */
- Logger getLogger();
-
- /**
- * Returns the invocation ID for the function call.
- * @return the invocation ID for the function call.
- */
- String getInvocationId();
-
- /**
- * Returns the function name.
- * @return the function name.
- */
- String getFunctionName();
-
- /**
- * Returns the trace context.
- * @return the trace context
- */
- default TraceContext getTraceContext() {
- return null;
- }
-
- /**
- * Returns the retry context.
- * @return the retry context
- */
- default RetryContext getRetryContext() {
- return null;
- }
-}
-
diff --git a/src/main/java/com/microsoft/azure/functions/HttpMethod.java b/src/main/java/com/microsoft/azure/functions/HttpMethod.java
deleted file mode 100644
index d81ce30..0000000
--- a/src/main/java/com/microsoft/azure/functions/HttpMethod.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for
- * license information.
- */
-
-package com.microsoft.azure.functions;
-
-import java.util.Locale;
-
-/**
- * Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See
- * License.txt in the project root for license information.
- */
-
-public enum HttpMethod {
-
- GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE, PATCH;
-
- /**
- * Converts passed value to upper case to extract valueOf() of this Enum.
- *
- * @param value of http method in any case
- * @return this enum
- */
- public static HttpMethod value(String value) {
- return HttpMethod.valueOf(value.toUpperCase(Locale.ROOT));
- }
-
-}
diff --git a/src/main/java/com/microsoft/azure/functions/HttpRequestMessage.java b/src/main/java/com/microsoft/azure/functions/HttpRequestMessage.java
deleted file mode 100644
index 3c87019..0000000
--- a/src/main/java/com/microsoft/azure/functions/HttpRequestMessage.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for
- * license information.
- */
-
-package com.microsoft.azure.functions;
-
-import java.net.URI;
-import java.util.Map;
-
-/**
- * An HttpRequestMessage instance is provided to Azure functions that use
- * {https://github.com/Azure/azure-functions-java-library/blob/dev/src/main/java/com/microsoft/azure/functions/annotation/HttpTrigger.java HTTP Triggers}. For an example of how
- * to use the http functionality of Azure Functions, refer to the example in the
- * {https://github.com/Azure/azure-functions-java-library/blob/dev/src/main/java/com/microsoft/azure/functions/annotation/HttpTrigger.java}
- *
- * {https://github.com/Azure/azure-functions-java-library/blob/dev/src/main/java/com/microsoft/azure/functions/annotation/HttpTrigger.java}
- * @see HttpResponseMessage
- * @param The type of the body content that is expected to be received as part of this HTTP
- * request.
- * @since 1.0.0
- */
-public interface HttpRequestMessage {
- /**
- * Returns the URI that was called that resulted in this HTTP request being submitted.
- *
- * @return the URI that was called that resulted in this HTTP request being submitted.
- */
- URI getUri();
-
- /**
- * Returns the HTTP method name as Enum
- *
- * @return type of HttpMethod
- */
- HttpMethod getHttpMethod();
-
- /**
- * Returns a map of headers that were contained within this HTTP request.
- *
- * @return a map of headers that were contained within this HTTP request.
- */
- Map getHeaders();
-
- /**
- * Returns a map of query parameters that were included with this HTTP request.
- *
- * @return a map of query parameters that were included with this HTTP request.
- */
- Map getQueryParameters();
-
- /**
- * Returns any body content that was included with this HTTP request.
- *
- * @return any body content that was included with this HTTP request.
- */
- T getBody();
-
- /**
- * Returns a {@link HttpResponseMessage.Builder} instance to build a HttpResponseMessage with
- * standard HTTP status code and no response body.
- *
- * @param status The HTTP status code to return to the caller of the function.
- * @return An {@link HttpResponseMessage.Builder} instance containing the provided status and
- * empty body.
- */
- HttpResponseMessage.Builder createResponseBuilder(HttpStatus status);
-
- /**
- * Returns a {@link HttpResponseMessage.Builder} instance to build a HttpResponseMessage with
- * custome HTTP status code and no response body.
- *
- * @param status The HTTP status code to return to the caller of the function.
- * @return An {@link HttpResponseMessage.Builder} instance containing the provided status and
- * empty body.
- */
- HttpResponseMessage.Builder createResponseBuilder(HttpStatusType status);
-
-}
diff --git a/src/main/java/com/microsoft/azure/functions/HttpResponseMessage.java b/src/main/java/com/microsoft/azure/functions/HttpResponseMessage.java
deleted file mode 100644
index 67961dd..0000000
--- a/src/main/java/com/microsoft/azure/functions/HttpResponseMessage.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for
- * license information.
- */
-
-package com.microsoft.azure.functions;
-
-/**
- * An HttpResponseMessage instance is returned by Azure Functions methods that are triggered by an
- * {https://github.com/Azure/azure-functions-java-library/blob/dev/src/main/java/com/microsoft/azure/functions/annotation/HttpTrigger.java}.
- *
- * {https://github.com/Azure/azure-functions-java-library/blob/dev/src/main/java/com/microsoft/azure/functions/annotation/HttpTrigger.java}
- * @see HttpRequestMessage
- * @since 1.0.0
- */
-public interface HttpResponseMessage {
-
- /**
- * Returns the HTTP status code set on the HttpResponseMessage instance.
- *
- * @return the status code set on the HttpResponseMessage instance.
- */
- HttpStatusType getStatus();
-
- /**
- * Returns the HTTP status code set on the HttpResponseMessage instance.
- *
- * @return the status code set on the HttpResponseMessage instance.
- */
- default int getStatusCode() {
- return getStatus().value();
- }
-
- /**
- * Returns a header value for the given key.
- *
- * @param key The key for which the header value is sought.
- * @return Returns the value if the key has previously been added, or null if it has not.
- */
- String getHeader(String key);
-
- /**
- * Returns the body of the HTTP response.
- *
- * @return the body of the HTTP response.
- */
- Object getBody();
-
- /**
- * A builder to create an instance of HttpResponseMessage
- */
- public interface Builder {
-
- /**
- * Sets the status code to be used in the HttpResponseMessage object.
- *
- * You can provide standard HTTP Status using enum values from {@link HttpStatus}, or you can
- * create a custom status code using {@link HttpStatusType#custom(int)}.
- *
- * @param status An HTTP status code representing the outcome of the HTTP request.
- * @return this builder
- */
- Builder status(HttpStatusType status);
-
- /**
- * Adds a (key, value) header to the response.
- *
- * @param key The key of the header value.
- * @param value The value of the header value.
- * @return this builder
- */
- Builder header(String key, String value);
-
- /**
- * Sets the body of the HTTP response.
- *
- * @param body The body of the HTTP response
- * @return this builder
- */
- Builder body(Object body);
-
- /**
- * Creates an instance of HttpMessageResponse with the values configured in this builder.
- *
- * @return an HttpMessageResponse object
- */
- HttpResponseMessage build();
- }
-}
diff --git a/src/main/java/com/microsoft/azure/functions/HttpStatus.java b/src/main/java/com/microsoft/azure/functions/HttpStatus.java
deleted file mode 100644
index 1fb9100..0000000
--- a/src/main/java/com/microsoft/azure/functions/HttpStatus.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for
- * license information.
- */
-
-package com.microsoft.azure.functions;
-
-/**
- * Enum to represent HTTP Status codes.
- *
- * This enum lists all standard HTTP 1.1 status lines. For custom codes,
- * please refer to {@link HttpStatusType#custom(int)}.
- *
- * @author Bruno Borges
- * @since 1.0
- */
-public enum HttpStatus implements HttpStatusType {
-
- // HTTP Status 100+
- CONTINUE(100), SWITCHING_PROTOCOLS(101), PROCESSING(102), CHECKPOINT(103),
-
- // HTTP Status 200+
- OK(200), CREATED(201), ACCEPTED(202), NON_AUTHORITATIVE_INFORMATION(203), NO_CONTENT(204), RESET_CONTENT(205),
- PARTIAL_CONTENT(206), MULTI_STATUS(207), ALREADY_REPORTED(208), IM_USED(226),
-
- // HTTP Status 300+
- MULTIPLE_CHOICES(300), MOVED_PERMANENTLY(301), FOUND(302), SEE_OTHER(303), NOT_MODIFIED(304),
- TEMPORARY_REDIRECT(307), PERMANENT_REDIRECT(308),
-
- // HTTP Status 400+
- BAD_REQUEST(400), UNAUTHORIZED(401), PAYMENT_REQUIRED(402), FORBIDDEN(403), NOT_FOUND(404), METHOD_NOT_ALLOWED(405),
- NOT_ACCEPTABLE(406), PROXY_AUTHENTICATION_REQUIRED(407), REQUEST_TIMEOUT(408), CONFLICT(409), GONE(410),
- LENGTH_REQUIRED(411), PRECONDITION_FAILED(412), PAYLOAD_TOO_LARGE(413), URI_TOO_LONG(414),
- UNSUPPORTED_MEDIA_TYPE(415), REQUESTED_RANGE_NOT_SATISFIABLE(416), EXPECTATION_FAILED(417), I_AM_A_TEAPOT(418),
- UNPROCESSABLE_ENTITY(422), LOCKED(423), FAILED_DEPENDENCY(424), UPGRADE_REQUIRED(426), PRECONDITION_REQUIRED(428),
- TOO_MANY_REQUESTS(429), REQUEST_HEADER_FIELDS_TOO_LARGE(431), UNAVAILABLE_FOR_LEGAL_REASONS(451),
-
- // HTTP Status 500+
- INTERNAL_SERVER_ERROR(500), NOT_IMPLEMENTED(501), BAD_GATEWAY(502), SERVICE_UNAVAILABLE(503), GATEWAY_TIMEOUT(504),
- HTTP_VERSION_NOT_SUPPORTED(505), VARIANT_ALSO_NEGOTIATES(506), INSUFFICIENT_STORAGE(507), LOOP_DETECTED(508),
- BANDWIDTH_LIMIT_EXCEEDED(509), NOT_EXTENDED(510), NETWORK_AUTHENTICATION_REQUIRED(511);
-
- private final int value;
-
- HttpStatus(int value) {
- this.value = value;
- }
-
- /**
- * Returns the code of this HTTPStatus enum.
- *
- * @return int value for this http status
- */
- public int value() {
- return this.value;
- }
-
- /**
- * Maps an int code to a standard HTTP status code.
- *
- * @param value for http code
- * @return HttpStatus enum
- */
- public static HttpStatus valueOf(int value) {
- for (final HttpStatus status : HttpStatus.values()) {
- if (value == status.value) {
- return status;
- }
- }
-
- throw new IllegalArgumentException("HTTP Status code unknown: " + value);
- }
-}
diff --git a/src/main/java/com/microsoft/azure/functions/HttpStatusType.java b/src/main/java/com/microsoft/azure/functions/HttpStatusType.java
deleted file mode 100644
index 2e24789..0000000
--- a/src/main/java/com/microsoft/azure/functions/HttpStatusType.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for
- * license information.
- */
-
-package com.microsoft.azure.functions;
-
-/**
- * Defines an HTTP Status Type
- *
- * @since 1.0
- */
-public interface HttpStatusType {
-
- int value();
-
- /**
- * Creates a custom (non-standard) HTTP Status code.
- * @param code for HttpStatusCode
- * @return HttpStatusType
- */
- static HttpStatusType custom(final int code) {
- if (code <= 0) {
- throw new IllegalArgumentException("A positive integer must be provided.");
- }
-
- return new HttpStatusType() {
- @Override
- public int value() {
- return code;
- }
- };
- }
-}
diff --git a/src/main/java/com/microsoft/azure/functions/OutputBinding.java b/src/main/java/com/microsoft/azure/functions/OutputBinding.java
deleted file mode 100644
index 8beb1a1..0000000
--- a/src/main/java/com/microsoft/azure/functions/OutputBinding.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for
- * license information.
- */
-
-package com.microsoft.azure.functions;
-
-/**
- * This type should be used with the parameter of output bindings.
- *
- * @since 1.0.0
- */
-public interface OutputBinding {
- /**
- * Get the value to be passed to the output binding.
- * @return The actual value to be passed to the output binding.
- */
- T getValue();
-
- /**
- * Set the value to be passed to the output binding.
- * @param value The actual value to be passed to the output binding.
- */
- void setValue(T value);
-}
diff --git a/src/main/java/com/microsoft/azure/functions/RetryContext.java b/src/main/java/com/microsoft/azure/functions/RetryContext.java
deleted file mode 100644
index 40e7121..0000000
--- a/src/main/java/com/microsoft/azure/functions/RetryContext.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for
- * license information.
- */
-
-package com.microsoft.azure.functions;
-
-/**
- * The Retry context that is obtained from the host.
- *
- * @since 2.0.0
- */
-public interface RetryContext {
-
- /**
- * Returns the current retry count
- *
- * @return the current retry count.
- */
- int getRetrycount();
-
- /**
- * Returns the max retry count
- *
- * @return the max retry count.
- */
- int getMaxretrycount();
-
- /**
- * Returns the exception that caused the retry
- *
- * @return the exception that caused the retry.
- */
- RpcException getException();
-
-}
diff --git a/src/main/java/com/microsoft/azure/functions/RpcException.java b/src/main/java/com/microsoft/azure/functions/RpcException.java
deleted file mode 100644
index 5a4a826..0000000
--- a/src/main/java/com/microsoft/azure/functions/RpcException.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for
- * license information.
- */
-package com.microsoft.azure.functions;
-
-
-public interface RpcException {
-
- // Source of the exception
- String getSource();
-
- // Stack trace for the exception
- String getStacktrace();
-
- // Textual message describing the exception
- String getMessage();
-
-}
diff --git a/src/main/java/com/microsoft/azure/functions/TraceContext.java b/src/main/java/com/microsoft/azure/functions/TraceContext.java
deleted file mode 100644
index 7c6d54c..0000000
--- a/src/main/java/com/microsoft/azure/functions/TraceContext.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for
- * license information.
- */
-
-package com.microsoft.azure.functions;
-
-import java.util.Map;
-
-/**
- * The Tracing context that is obtained from the host.
- *
- * @since 1.0.0
- */
-public interface TraceContext {
- /**
- * Returns the TraceparentString from the Activity.
- *
- * @return the TraceparentString from the Activity.
- */
- String getTraceparent();
-
- /**
- * Returns the Tracestate which is Activity.Current?.Id from host.
- * @return the Tracestate which is Activity.Current?.Id from host.
- */
- String getTracestate();
-
- /**
- * Returns the attributes which correspond to the tags.
- * @return the attributes which correspond to the tags.
- */
- Map getAttributes();
-}
diff --git a/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/Middleware.java b/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/Middleware.java
deleted file mode 100644
index b0b4602..0000000
--- a/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/Middleware.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for
- * license information.
- */
-package com.microsoft.azure.functions.internal.spi.middleware;
-
-/**
- * This interface is implemented by middlewares to include middleware core logics.
- *
- * This class is internal and is hence not for public use at this time. Its APIs are unstable and can change
- * at any time.
- */
-public interface Middleware {
- /**
- * Middlewares will override this method to include their own logics.
- * @param context execution context that pass along middleware chain
- * @param chain middleware chain {@link MiddlewareChain}
- * @throws Exception any exception that is thrown out in next middleware
- */
- void invoke(MiddlewareContext context, MiddlewareChain chain) throws Exception;
-}
diff --git a/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/MiddlewareChain.java b/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/MiddlewareChain.java
deleted file mode 100644
index 566b6fb..0000000
--- a/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/MiddlewareChain.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for
- * license information.
- */
-package com.microsoft.azure.functions.internal.spi.middleware;
-
-/**
- * The middleware chain.
- *
- *
This class is internal and is hence not for public use at this time. Its APIs are unstable and can change
- * at any time.
- */
-public interface MiddlewareChain {
- /**
- * Invokes next middleware in the chain.
- * @param context execution context that pass along middleware chain
- * @throws Exception any exception that happen along middleware chain
- */
- void doNext(MiddlewareContext context) throws Exception;
-}
diff --git a/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/MiddlewareContext.java b/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/MiddlewareContext.java
deleted file mode 100644
index 70f4a96..0000000
--- a/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/MiddlewareContext.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for
- * license information.
- */
-
-package com.microsoft.azure.functions.internal.spi.middleware;
-
-import com.microsoft.azure.functions.ExecutionContext;
-
-/**
- * Middleware Execution Context
- *
- *
This class is internal and is hence not for public use at this time. Its APIs are unstable and can change
- * at any time.
- */
-public interface MiddlewareContext extends ExecutionContext {
- /**
- * Returns the name of parameter defined in customer function.
- * The input is the simple class name of target annotation.
- * @param annotationSimpleClassName the simple class name of target annotation
- * @return the name of parameter defined in customer function
- */
- //TODO: @Nullable
- String getParameterName(String annotationSimpleClassName);
-
- /**
- * Returns corresponding parameter value sent from host by the given the parameter name.
- * The return type is Object but the real type is String (currently only support get String type,
- * planning to support other types in the future.)
- * Make it return Object to avoid break this API in the future.
- * @param name the name of parameter
- * @return an object which will be String type that represents parameter value of customer function
- */
- //TODO: @Nullable
- Object getParameterValue(String name);
-
- /**
- * Updates the parameter value by parameter name. It will be the actual parameter value
- * used when invoke customer function. This API give middleware ability to update function input.
- * @param name the name of parameter to be updated
- * @param value the value of parameter to be updated
- */
- void updateParameterValue(String name, Object value);
-
- /**
- * Returns the return value from customer function invocation.
- * @return an object that is the return value of customer function
- */
- //TODO: @Nullable
- Object getReturnValue();
-
- /**
- * Updates the return value from customer function invocation.
- * @param returnValue value that will be updated as function return value.
- */
- void updateReturnValue(Object returnValue);
-}
diff --git a/src/main/java/com/microsoft/azure/functions/package-info.java b/src/main/java/com/microsoft/azure/functions/package-info.java
deleted file mode 100644
index b42f15a..0000000
--- a/src/main/java/com/microsoft/azure/functions/package-info.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for
- * license information.
- */
-
-/**
- * Root package
- */
-
-package com.microsoft.azure.functions;
diff --git a/src/test/java/com/microsoft/azure/functions/HttpStatusTest.java b/src/test/java/com/microsoft/azure/functions/HttpStatusTest.java
deleted file mode 100644
index 90798fd..0000000
--- a/src/test/java/com/microsoft/azure/functions/HttpStatusTest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.microsoft.azure.functions;
-
-import org.junit.*;
-
-import static junit.framework.TestCase.*;
-
-/**
- * Unit tests that enforce annotation contracts and conventions for Functions
- */
-public class HttpStatusTest {
- @Test
- public void set_custom_httpstatuscode() {
- HttpStatusType customHttpStatus = HttpStatusType.custom(209);
- assertTrue(customHttpStatus.value() == 209);
- }
-
- @Test
- public void set_standard_httpstatuscode() {
- HttpStatusType customHttpStatus = HttpStatus.OK;
- assertTrue(customHttpStatus.value() == 200);
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void set_invalid_httpstatuscode() {
- HttpStatusType.custom(-100);
- }
-}
From 8c0c2e9ce605956b2589c35906995a05fe7e1594 Mon Sep 17 00:00:00 2001
From: kaibocai <89094811+kaibocai@users.noreply.github.com>
Date: Wed, 12 Oct 2022 13:13:59 -0500
Subject: [PATCH 05/14] update readme - update pipeline
---
README.md | 204 +-----------------
azure-functions-java-core-library/README.md | 39 ++++
azure-functions-java-core-library/pom.xml | 26 +--
azure-functions-java-spi-library/README.md | 38 ++++
azure-functions-java-spi-library/pom.xml | 1 +
...azure-pipelines.yml => azure-pipelines.yml | 0
.../build.ps1 => build.ps1 | 0
.../mvnBuild.bat => mvnBuild.bat | 0
...at => mvnBuildFunctionPluginsSkipTests.bat | 0
...uildSkipTests.bat => mvnBuildSkipTests.bat | 0
...eArchetype.bat => mvnGenerateArchetype.bat | 0
pom.xml | 8 +-
.../updateVersions.bat => updateVersions.bat | 0
13 files changed, 93 insertions(+), 223 deletions(-)
create mode 100644 azure-functions-java-core-library/README.md
create mode 100644 azure-functions-java-spi-library/README.md
rename azure-functions-java-core-library/azure-pipelines.yml => azure-pipelines.yml (100%)
rename azure-functions-java-core-library/build.ps1 => build.ps1 (100%)
rename azure-functions-java-core-library/mvnBuild.bat => mvnBuild.bat (100%)
rename azure-functions-java-core-library/mvnBuildFunctionPluginsSkipTests.bat => mvnBuildFunctionPluginsSkipTests.bat (100%)
rename azure-functions-java-core-library/mvnBuildSkipTests.bat => mvnBuildSkipTests.bat (100%)
rename azure-functions-java-core-library/mvnGenerateArchetype.bat => mvnGenerateArchetype.bat (100%)
rename azure-functions-java-core-library/updateVersions.bat => updateVersions.bat (100%)
diff --git a/README.md b/README.md
index 6596f26..4f70760 100644
--- a/README.md
+++ b/README.md
@@ -5,8 +5,12 @@
|master|[](https://ci.appveyor.com/project/appsvc/azure-functions-java-library?branch=master)|
|dev|[](https://ci.appveyor.com/project/appsvc/azure-functions-java-library?branch=dev)|
-# Library for Azure Java Functions
-This repo contains library for building Azure Java Functions. Visit the [complete documentation of Azure Functions - Java Developer Guide](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-java) for more details.
+# Extend library for Azure Java Functions
+This repo contains two extend library for building Azure Java Functions.
+* [azure-functions-java-core-library](https://github.com/Microsoft/maven-java-parent)
+* [azure-functions-java-spi-library](https://github.com/Microsoft/maven-java-parent)
+
+For more information about Azure Java Functions please visit the [complete documentation of Azure Functions - Java Developer Guide](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-java) for more details.
## azure-functions-maven plugin
[How to use azure-functions-maven plugin to create, update, deploy and test azure java functions](https://docs.microsoft.com/en-us/java/api/overview/azure/maven/azure-functions-maven-plugin/readme?view=azure-java-stable)
@@ -23,205 +27,15 @@ Please see for details on Parent POM https://github.com/Microsoft/maven-java-par
Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. You can write just the code you need for the problem at hand, without worrying about a whole application or the infrastructure to run it. Functions can make development even more productive.Pay only for the time your code runs and trust Azure to scale as needed. Azure Functions lets you develop [serverless](https://azure.microsoft.com/en-us/solutions/serverless/) applications on Microsoft Azure.
-Azure Functions supports triggers, which are ways to start execution of your code, and bindings, which are ways to simplify coding for input and output data. A function should be a stateless method to process input and produce output. Although you are allowed to write instance methods, your function must not depend on any instance fields of the class. You need to make sure all the function methods are `public` accessible and method with annotation @FunctionName is unique as that defines the entry for the the function.
+Azure Functions supports triggers, which are ways to start execution of your code, and bindings, which are ways to simplify coding for input and output data. A function should be a stateless method to process input and produce output. Although you are allowed to write instance methods, your function must not depend on any instance fields of the class. You need to make sure all the function methods are `public` accessible and method with annotation @FunctionName is unique as that defines the entry for the function.
A deployable unit is an uber JAR containing one or more functions (see below), and a JSON file with the list of functions and triggers definitions, deployed to Azure Functions. The JAR can be created in many ways, although we recommend [Azure Functions Maven Plugin](https://docs.microsoft.com/en-us/java/api/overview/azure/maven/azure-functions-maven-plugin/readme), as it provides templates to get you started with key scenarios.
-All the input and output bindings can be defined in `function.json` (not recommended), or in the Java method by using annotations (recommended). All the types and annotations used in this document are included in the `azure-functions-java-library` package.
+All the input and output bindings can be defined in `function.json` (not recommended), or in the Java method by using annotations (recommended). All the types and annotations used in this document are included in the [azure-functions-java-library](https://github.com/Azure/azure-functions-java-library) package.
### Sample
-Here is an example of a HttpTrigger Azure function in Java:
-
-
-```java
-package com.example;
-
-import com.microsoft.azure.functions.annotation.*;
-
-public class Function {
- @FunctionName("echo")
- public static String echo(@HttpTrigger(name = "req", methods = { HttpMethod.POST }, authLevel = AuthorizationLevel.ANONYMOUS) String in) {
- return "Hello, " + in + ".";
- }
-}
-```
-
-### Adding 3rd Party Libraries
-
-Azure Functions supports the use of 3rd party libraries. If using the Maven plugin for Azure Functions, all of your dependencies specified in your `pom.xml` file will be automatically bundled during the `mvn package` step.
-
-## Data Types
-
-You are free to use all the data types in Java for the input and output data, including native types; customized POJO types and specialized Azure types defined in this API. Azure Functions runtime will try its best to convert the actual input value to the type you need (for example, a `String` input will be treated as a JSON string and be parsed to a POJO type defined in your code).
-
-### JSON Support
-The POJO types (Java classes) you may define have to be publicly accessible (`public` modifier). POJO properties/fields may be `private`. For example a JSON string `{ "x": 3 }` is able to be converted to the following POJO type:
-
-```java
-public class PojoData {
- private int x;
-}
-```
-
-### Other supported types
-Binary data is represented as `byte[]` or `Byte[]` in your Azure functions code. And make sure you specify `dataType = "binary"` in the corresponding triggers/bindings.
-
-Empty input values could be `null` as your functions argument, but a recommended way to deal with potential empty values is to use `Optional` type.
-
-
-## Inputs
-
-Inputs are divided into two categories in Azure Functions: one is the trigger input and the other is the additional input. Trigger input is the input who triggers your function. And besides that, you may also want to get inputs from other sources (like a blob), that is the additional input.
-
-Let's take the following code snippet as an example:
-
-```java
-package com.example;
-
-import com.microsoft.azure.functions.annotation.*;
-
-public class Function {
- @FunctionName("echo")
- public String echo(
- @HttpTrigger(name = "req", methods = { HttpMethod.PUT }, authLevel = AuthorizationLevel.ANONYMOUS, route = "items/{id}") String in,
- @TableInput(name = "item", tableName = "items", partitionKey = "example", rowKey = "{id}", connection = "AzureWebJobsStorage") TestInputData inputData
- ) {
- return "Hello, " + in + " and " + inputData.getRowKey() + ".";
- }
-
-}
-
-public class TestInputData {
- public String getRowKey() { return this.rowKey; }
- private String rowKey;
-}
-
-```
-
-When this function is invoked, the HTTP request payload will be passed as the `String` for argument `in`; and one entry will be retrieved from the Azure Table Storage and be passed to argument `inputData` as `TestInputData` type.
-
-To receive events in a batch when using EventHubTrigger, set cardinality to many and change input type to an array or List<>
-
-```java
-@FunctionName("ProcessIotMessages")
- public void processIotMessages(
- @EventHubTrigger(name = "message", eventHubName = "%AzureWebJobsEventHubPath%", connection = "AzureWebJobsEventHubSender", cardinality = Cardinality.MANY) List messages,
- final ExecutionContext context)
- {
- context.getLogger().info("Java Event Hub trigger received messages. Batch size: " + messages.size());
- }
-
- public class TestEventData {
- public String id;
-}
-
-```
-
-Note: You can also bind to String[], TestEventData[] or List
-
-## Outputs
-
-Outputs can be expressed in return value or output parameters. If there is only one output, you are recommended to use the return value. For multiple outputs, you have to use **output parameters**.
-
-Return value is the simplest form of output, you just return the value of any type, and Azure Functions runtime will try to marshal it back to the actual type (such as an HTTP response). You could apply any *output annotations* to the function method (the `name` property of the annotation has to be `$return`) to define the return value output.
-
-For example, a blob content copying function could be defined as the following code. `@StorageAccount` annotation is used here to prevent the duplicating of the `connection` property for both `@BlobTrigger` and `@BlobOutput`.
-
-```java
-package com.example;
-
-import com.microsoft.azure.functions.annotation.*;
-
-public class Function {
- @FunctionName("copy")
- @StorageAccount("AzureWebJobsStorage")
- @BlobOutput(name = "$return", path = "samples-output-java/{name}")
- public String copy(@BlobTrigger(name = "blob", path = "samples-input-java/{name}") String content) {
- return content;
- }
-}
-```
-
-To produce multiple output values, use `OutputBinding` type defined in the `azure-functions-java-library` package. If you need to make an HTTP response and push a message to a queue, you can write something like:
-
-```java
-package com.example;
-
-import com.microsoft.azure.functions.*;
-import com.microsoft.azure.functions.annotation.*;
-
-public class Function {
- @FunctionName("push")
- public String push(
- @HttpTrigger(name = "req", methods = { HttpMethod.POST }, authLevel = AuthorizationLevel.ANONYMOUS) String body,
- @QueueOutput(name = "message", queueName = "myqueue", connection = "AzureWebJobsStorage") OutputBinding queue
- ) {
- queue.setValue("This is the queue message to be pushed");
- return "This is the HTTP response content";
- }
-}
-```
-
-Use `OutputBinding` type to make a binary output value (for parameters); for return values, just use `byte[]`.
-
-## Execution Context
-
-You interact with Azure Functions execution environment via the `ExecutionContext` object defined in the `azure-functions-java-library` package. You are able to get the invocation ID, the function name and a built-in logger (which is integrated prefectly with Azure Function Portal experience as well as AppInsights) from the context object.
-
-What you need to do is just add one more `ExecutionContext` typed parameter to your function method. Let's take a timer triggered function as an example:
-
-```java
-package com.example;
-
-import com.microsoft.azure.functions.*;
-import com.microsoft.azure.functions.annotation.*;
-
-public class Function {
- @FunctionName("heartbeat")
- public static void heartbeat(
- @TimerTrigger(name = "schedule", schedule = "*/30 * * * * *") String timerInfo,
- ExecutionContext context
- ) {
- context.getLogger().info("Heartbeat triggered by " + context.getFunctionName());
- }
-}
-```
-
-
-## Specialized Data Types
-
-### HTTP Request and Response
-
-Sometimes a function need to take a more detailed control of the input and output, and that's why we also provide some specialized types in the `azure-functions-java-library` package for you to manipulate:
-
-| Specialized Type | Target | Typical Usage |
-| ------------------------ | :-----------------: | ------------------------------ |
-| `HttpRequestMessage` | HTTP Trigger | Get method, headers or queries |
-| `HttpResponseMessage` | HTTP Output Binding | Return status other than 200 |
-
-### Metadata
-
-Metadata comes from different sources, like HTTP headers, HTTP queries, and [trigger metadata](https://docs.microsoft.com/en-us/azure/azure-functions/functions-triggers-bindings#trigger-metadata-properties). You can use `@BindingName` annotation together with the metadata name to get the value.
-
-For example, the `queryValue` in the following code snippet will be `"test"` if the requested URL is `http://{example.host}/api/metadata?name=test`.
-
-```java
-package com.example;
-
-import java.util.Optional;
-import com.microsoft.azure.functions.annotation.*;
-
-public class Function {
- @FunctionName("metadata")
- public static String metadata(
- @HttpTrigger(name = "req", methods = { HttpMethod.GET, HttpMethod.POST }, authLevel = AuthorizationLevel.ANONYMOUS) Optional body,
- @BindingName("name") String queryValue
- ) {
- return body.orElse(queryValue);
- }
-}
-```
+For an example of a HttpTrigger Azure function in Java please refer to [HttpTrigger sample](https://github.com/Azure/azure-functions-java-library#sample)
### License
diff --git a/azure-functions-java-core-library/README.md b/azure-functions-java-core-library/README.md
new file mode 100644
index 0000000..13c7a32
--- /dev/null
+++ b/azure-functions-java-core-library/README.md
@@ -0,0 +1,39 @@
+
+
+# Core library for Azure Java Functions
+This repo contains core library for building Azure Java Functions. `azure-functions-java-core-library` contains base class for building Azure Java Functions.
+However, You don't need to include `azure-functions-java-core-library` as a dependency when you build your function app, because it comes with [azure-functions-java-library](https://github.com/Azure/azure-functions-java-library)
+You only need to include `azure-functions-java-library` as your function app dependency then you will have access to all class in `azure-functions-core-library`
+
+For more information about Azure Java Functions please visit the [complete documentation of Azure Functions - Java Developer Guide](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-java) for more details.
+
+## azure-functions-maven plugin
+[How to use azure-functions-maven plugin to create, update, deploy and test azure java functions](https://docs.microsoft.com/en-us/java/api/overview/azure/maven/azure-functions-maven-plugin/readme?view=azure-java-stable)
+
+## Prerequisites
+
+* Java 8
+
+## Parent POM
+
+Please see for details on Parent POM https://github.com/Microsoft/maven-java-parent
+
+## Summary
+
+Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. You can write just the code you need for the problem at hand, without worrying about a whole application or the infrastructure to run it. Functions can make development even more productive.Pay only for the time your code runs and trust Azure to scale as needed. Azure Functions lets you develop [serverless](https://azure.microsoft.com/en-us/solutions/serverless/) applications on Microsoft Azure.
+
+Azure Functions supports triggers, which are ways to start execution of your code, and bindings, which are ways to simplify coding for input and output data. A function should be a stateless method to process input and produce output. Although you are allowed to write instance methods, your function must not depend on any instance fields of the class. You need to make sure all the function methods are `public` accessible and method with annotation @FunctionName is unique as that defines the entry for the function.
+
+A deployable unit is an uber JAR containing one or more functions (see below), and a JSON file with the list of functions and triggers definitions, deployed to Azure Functions. The JAR can be created in many ways, although we recommend [Azure Functions Maven Plugin](https://docs.microsoft.com/en-us/java/api/overview/azure/maven/azure-functions-maven-plugin/readme), as it provides templates to get you started with key scenarios.
+
+All the input and output bindings can be defined in `function.json` (not recommended), or in the Java method by using annotations (recommended). All the types and annotations used in this document are included in the [azure-functions-java-library](https://github.com/Azure/azure-functions-java-library) package.
+
+### Sample
+
+For an example of a HttpTrigger Azure function in Java please refer to [HttpTrigger sample](https://github.com/Azure/azure-functions-java-library#sample)
+
+### License
+
+This project is under the benevolent umbrella of the [.NET Foundation](http://www.dotnetfoundation.org/) and is licensed under [the MIT License](LICENSE.txt)
+
+This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
diff --git a/azure-functions-java-core-library/pom.xml b/azure-functions-java-core-library/pom.xml
index 1adb2bb..fd092d5 100644
--- a/azure-functions-java-core-library/pom.xml
+++ b/azure-functions-java-core-library/pom.xml
@@ -10,10 +10,11 @@
com.microsoft.maven
java-8-parent
8.0.1
+
Microsoft Azure Functions Java Core Types
- This package contains all Java interfaces and annotations to interact with Microsoft Azure functions runtime.
+ This package contains core Java classes to interact with Microsoft Azure functions runtime.
https://azure.microsoft.com/en-us/services/functions
@@ -37,14 +38,8 @@
- pgopa
- Pragna Gopa
- pgopa@microsoft.com
-
-
- xscript
- Kevin Zhao
- kevinzha@microsoft.com
+ Microsoft
+ Microsoft Corporation
@@ -73,24 +68,12 @@
-
-
- org.reflections
- reflections
- test
-
junit
junit
test
-
- org.mockito
- mockito-core
- test
-
-
@@ -105,6 +88,7 @@
org.apache.maven.plugins
maven-javadoc-plugin
+ 3.4.1
org.apache.maven.plugins
diff --git a/azure-functions-java-spi-library/README.md b/azure-functions-java-spi-library/README.md
new file mode 100644
index 0000000..3015cb4
--- /dev/null
+++ b/azure-functions-java-spi-library/README.md
@@ -0,0 +1,38 @@
+
+
+# Extend library for Azure Java Functions
+This repo contains spi library for building Azure Java Functions. **This library should not be used when build your function app.**
+This library provide hooks to third parties supporting them to interact with function runtime during function invocation process.
+
+For more information about Azure Java Functions please visit the [complete documentation of Azure Functions - Java Developer Guide](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-java) for more details.
+
+## azure-functions-maven plugin
+[How to use azure-functions-maven plugin to create, update, deploy and test azure java functions](https://docs.microsoft.com/en-us/java/api/overview/azure/maven/azure-functions-maven-plugin/readme?view=azure-java-stable)
+
+## Prerequisites
+
+* Java 8
+
+## Parent POM
+
+Please see for details on Parent POM https://github.com/Microsoft/maven-java-parent
+
+## Summary
+
+Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. You can write just the code you need for the problem at hand, without worrying about a whole application or the infrastructure to run it. Functions can make development even more productive.Pay only for the time your code runs and trust Azure to scale as needed. Azure Functions lets you develop [serverless](https://azure.microsoft.com/en-us/solutions/serverless/) applications on Microsoft Azure.
+
+Azure Functions supports triggers, which are ways to start execution of your code, and bindings, which are ways to simplify coding for input and output data. A function should be a stateless method to process input and produce output. Although you are allowed to write instance methods, your function must not depend on any instance fields of the class. You need to make sure all the function methods are `public` accessible and method with annotation @FunctionName is unique as that defines the entry for the function.
+
+A deployable unit is an uber JAR containing one or more functions (see below), and a JSON file with the list of functions and triggers definitions, deployed to Azure Functions. The JAR can be created in many ways, although we recommend [Azure Functions Maven Plugin](https://docs.microsoft.com/en-us/java/api/overview/azure/maven/azure-functions-maven-plugin/readme), as it provides templates to get you started with key scenarios.
+
+All the input and output bindings can be defined in `function.json` (not recommended), or in the Java method by using annotations (recommended). All the types and annotations used in this document are included in the [azure-functions-java-library](https://github.com/Azure/azure-functions-java-library) package.
+
+### Sample
+
+For an example of a HttpTrigger Azure function in Java please refer to [HttpTrigger sample](https://github.com/Azure/azure-functions-java-library#sample)
+
+### License
+
+This project is under the benevolent umbrella of the [.NET Foundation](http://www.dotnetfoundation.org/) and is licensed under [the MIT License](LICENSE.txt)
+
+This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
diff --git a/azure-functions-java-spi-library/pom.xml b/azure-functions-java-spi-library/pom.xml
index 4b4f51f..454d500 100644
--- a/azure-functions-java-spi-library/pom.xml
+++ b/azure-functions-java-spi-library/pom.xml
@@ -10,6 +10,7 @@
com.microsoft.maven
java-8-parent
8.0.1
+
Microsoft Azure Functions Java SPI Types
diff --git a/azure-functions-java-core-library/azure-pipelines.yml b/azure-pipelines.yml
similarity index 100%
rename from azure-functions-java-core-library/azure-pipelines.yml
rename to azure-pipelines.yml
diff --git a/azure-functions-java-core-library/build.ps1 b/build.ps1
similarity index 100%
rename from azure-functions-java-core-library/build.ps1
rename to build.ps1
diff --git a/azure-functions-java-core-library/mvnBuild.bat b/mvnBuild.bat
similarity index 100%
rename from azure-functions-java-core-library/mvnBuild.bat
rename to mvnBuild.bat
diff --git a/azure-functions-java-core-library/mvnBuildFunctionPluginsSkipTests.bat b/mvnBuildFunctionPluginsSkipTests.bat
similarity index 100%
rename from azure-functions-java-core-library/mvnBuildFunctionPluginsSkipTests.bat
rename to mvnBuildFunctionPluginsSkipTests.bat
diff --git a/azure-functions-java-core-library/mvnBuildSkipTests.bat b/mvnBuildSkipTests.bat
similarity index 100%
rename from azure-functions-java-core-library/mvnBuildSkipTests.bat
rename to mvnBuildSkipTests.bat
diff --git a/azure-functions-java-core-library/mvnGenerateArchetype.bat b/mvnGenerateArchetype.bat
similarity index 100%
rename from azure-functions-java-core-library/mvnGenerateArchetype.bat
rename to mvnGenerateArchetype.bat
diff --git a/pom.xml b/pom.xml
index afd9446..7fe7a1e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,17 +4,11 @@
4.0.0
com.microsoft.azure.functions
- azure-functions-java-libs
+ azure-functions-java-extend-library
pom
1.0-SNAPSHOT
azure-functions-java-core-library
azure-functions-java-spi-library
-
-
- 8
- 8
-
-
\ No newline at end of file
diff --git a/azure-functions-java-core-library/updateVersions.bat b/updateVersions.bat
similarity index 100%
rename from azure-functions-java-core-library/updateVersions.bat
rename to updateVersions.bat
From a6af748f5426fb0583818f55e18bfce25c0714f9 Mon Sep 17 00:00:00 2001
From: kaibocai <89094811+kaibocai@users.noreply.github.com>
Date: Wed, 12 Oct 2022 13:22:43 -0500
Subject: [PATCH 06/14] add CHANGELOG.md & pull request template file
---
.github/pull_request_template.md | 17 +++++++++++++++++
CHANGELOG.md | 10 ++++++++++
2 files changed, 27 insertions(+)
create mode 100644 .github/pull_request_template.md
create mode 100644 CHANGELOG.md
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
new file mode 100644
index 0000000..741701b
--- /dev/null
+++ b/.github/pull_request_template.md
@@ -0,0 +1,17 @@
+
+
+### Issue describing the changes in this PR
+
+resolves #issue_for_this_pr
+
+### Pull request checklist
+
+* [ ] My changes **do not** require documentation changes
+ * [ ] Otherwise: Documentation issue linked to PR
+* [ ] My changes are added to the `CHANGELOG.md`
+* [ ] I have added all required tests (Unit tests, E2E tests)
+
+
+### Additional information
+
+Additional PR information
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..98e3b7b
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,10 @@
+## azure-functions-java-spi-library_1.0.0
+
+### New
+* to be update
+
+### Updates
+* to be update
+
+### Breaking changes
+* to be update
\ No newline at end of file
From a036cbb91ebadf1603cd07bd350597e4a009f8a9 Mon Sep 17 00:00:00 2001
From: kaibocai <89094811+kaibocai@users.noreply.github.com>
Date: Wed, 12 Oct 2022 14:29:27 -0500
Subject: [PATCH 07/14] update pipeline
---
build.ps1 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/build.ps1 b/build.ps1
index ef3a03e..e53e505 100644
--- a/build.ps1
+++ b/build.ps1
@@ -15,8 +15,8 @@ StopOnFailedExecution
Pop-Location -StackName "libraryDir"
$archetypePom = Get-Content ".\azure-maven-archetypes\azure-functions-archetype\pom.xml" -Raw
$archetypePom -match "(.*)"
-$atchetypeVersion = $matches[1]
-Write-Host "atchetypeVersion: " $atchetypeVersion
+$archetypeVersion = $matches[1]
+Write-Host "archetypeVersion: " $archetypeVersion
# Clone and install function maven plugin
git clone https://github.com/Microsoft/azure-maven-plugins.git -b develop
@@ -44,7 +44,7 @@ StopOnFailedExecution
Write-Host "Build and install azure-functions-java-core-library"
cmd.exe /c '.\mvnBuild.bat'
StopOnFailedExecution
-$coreLibraryPom = Get-Content "pom.xml" -Raw
+$coreLibraryPom = Get-Content "azure-functions-java-core-library\pom.xml" -Raw
$coreLibraryPom -match "(.*)"
$coreLibraryVersion = $matches[1]
Write-Host "coreLibraryVersion: " $coreLibraryVersion
From 5f770ddec78d3c14ec6b21ea098704ffe524a1eb Mon Sep 17 00:00:00 2001
From: kaibocai <89094811+kaibocai@users.noreply.github.com>
Date: Wed, 12 Oct 2022 15:32:08 -0500
Subject: [PATCH 08/14] update CI point to test branch from worker
---
azure-functions-java-spi-library/README.md | 1 +
build.ps1 | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/azure-functions-java-spi-library/README.md b/azure-functions-java-spi-library/README.md
index 3015cb4..6b1f3ea 100644
--- a/azure-functions-java-spi-library/README.md
+++ b/azure-functions-java-spi-library/README.md
@@ -3,6 +3,7 @@
# Extend library for Azure Java Functions
This repo contains spi library for building Azure Java Functions. **This library should not be used when build your function app.**
This library provide hooks to third parties supporting them to interact with function runtime during function invocation process.
+**_This library should be used with scope as `provided`, because customer should not have transitive dependency on it_**
For more information about Azure Java Functions please visit the [complete documentation of Azure Functions - Java Developer Guide](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-java) for more details.
diff --git a/build.ps1 b/build.ps1
index e53e505..4b39490 100644
--- a/build.ps1
+++ b/build.ps1
@@ -97,7 +97,7 @@ Expand-Archive ".\Azure.Functions.Cli.zip" -DestinationPath ".\Azure.Functions.C
$Env:Path = $Env:Path+";$currDir\Azure.Functions.Cli"
# Clone and build azure-functions-java-worker
-git clone https://github.com/azure/azure-functions-java-worker -b dev
+git clone https://github.com/azure/azure-functions-java-worker -b kaibocai/test-spi-lib
Push-Location -Path "./azure-functions-java-worker" -StackName libraryDir
Write-Host "Updating azure-functions-java-worker to use current version of the java core library"
From cbe5dc9b93cb798e3d57e00ed78fc012c4748c13 Mon Sep 17 00:00:00 2001
From: kaibocai <89094811+kaibocai@users.noreply.github.com>
Date: Sat, 15 Oct 2022 08:06:40 -0500
Subject: [PATCH 09/14] refactor code
---
.gitignore | 2 +-
CHANGELOG.md | 2 +-
CODEOWNERS | 5 +--
README.md | 6 +--
azure-functions-java-core-library/.gitignore | 41 -------------------
azure-functions-java-core-library/README.md | 14 ++-----
azure-functions-java-core-library/pom.xml | 22 ++--------
azure-functions-java-spi-library/.gitignore | 41 -------------------
azure-functions-java-spi-library/README.md | 39 ------------------
azure-functions-java-spi/README.md | 33 +++++++++++++++
.../pom.xml | 26 +++---------
.../internal/spi/middleware/Middleware.java | 0
.../spi/middleware/MiddlewareChain.java | 0
.../spi/middleware/MiddlewareContext.java | 0
.../spi/inject/FunctionInstanceInjector.java | 10 ++---
build.ps1 | 8 +++-
pom.xml | 2 +-
17 files changed, 64 insertions(+), 187 deletions(-)
delete mode 100644 azure-functions-java-core-library/.gitignore
delete mode 100644 azure-functions-java-spi-library/.gitignore
delete mode 100644 azure-functions-java-spi-library/README.md
create mode 100644 azure-functions-java-spi/README.md
rename {azure-functions-java-spi-library => azure-functions-java-spi}/pom.xml (77%)
rename {azure-functions-java-spi-library => azure-functions-java-spi}/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/Middleware.java (100%)
rename {azure-functions-java-spi-library => azure-functions-java-spi}/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/MiddlewareChain.java (100%)
rename {azure-functions-java-spi-library => azure-functions-java-spi}/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/MiddlewareContext.java (100%)
rename {azure-functions-java-spi-library => azure-functions-java-spi}/src/main/java/com/microsoft/azure/functions/spi/inject/FunctionInstanceInjector.java (60%)
diff --git a/.gitignore b/.gitignore
index 044af7d..cd546b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,7 +22,7 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/.idea/*
-/target/*
+*/target/*
/bin
/.classpath
/.settings/*
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 98e3b7b..c507d4c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,4 @@
-## azure-functions-java-spi-library_1.0.0
+## azure-functions-java-spi_1.0.0
### New
* to be update
diff --git a/CODEOWNERS b/CODEOWNERS
index b22ea0c..4ac24ef 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -7,6 +7,5 @@
# https://help.github.com/articles/about-codeowners/
# Default owner for repo
-* @amamounelsayed
-* @shreyas-gopalakrishna
-* @kaibocai
+* @pragnagopa
+* @amamounelsayed
\ No newline at end of file
diff --git a/README.md b/README.md
index 4f70760..ca59c6f 100644
--- a/README.md
+++ b/README.md
@@ -6,9 +6,9 @@
|dev|[](https://ci.appveyor.com/project/appsvc/azure-functions-java-library?branch=dev)|
# Extend library for Azure Java Functions
-This repo contains two extend library for building Azure Java Functions.
-* [azure-functions-java-core-library](https://github.com/Microsoft/maven-java-parent)
-* [azure-functions-java-spi-library](https://github.com/Microsoft/maven-java-parent)
+This repo contains two additional libraries for building Azure Java Functions.
+* [azure-functions-java-core-library](https://github.com/Azure/azure-functions-java-???-library/azure-functions-java-core-library)
+* [azure-functions-java-spi](https://github.com/Azure/azure-functions-java-???-library/azure-functions-java-spi)
For more information about Azure Java Functions please visit the [complete documentation of Azure Functions - Java Developer Guide](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-java) for more details.
diff --git a/azure-functions-java-core-library/.gitignore b/azure-functions-java-core-library/.gitignore
deleted file mode 100644
index 044af7d..0000000
--- a/azure-functions-java-core-library/.gitignore
+++ /dev/null
@@ -1,41 +0,0 @@
-# Compiled class file
-*.class
-
-# Log file
-*.log
-
-# BlueJ files
-*.ctxt
-
-# Mobile Tools for Java (J2ME)
-.mtj.tmp/
-
-# Package Files #
-*.jar
-*.war
-*.nar
-*.ear
-*.zip
-*.tar.gz
-*.rar
-
-# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
-hs_err_pid*
-/.idea/*
-/target/*
-/bin
-/.classpath
-/.settings/*
-.project
-/azure-maven-archetypes/
-/azure-maven-plugins/
-/ciTestDir/*
-/target/
-/Azure.Functions.Cli/*
-/azure-functions-java-worker/
-
-#IDE
-*.iml
-
-#OSX
-.DS_Store
\ No newline at end of file
diff --git a/azure-functions-java-core-library/README.md b/azure-functions-java-core-library/README.md
index 13c7a32..036f422 100644
--- a/azure-functions-java-core-library/README.md
+++ b/azure-functions-java-core-library/README.md
@@ -2,8 +2,8 @@
# Core library for Azure Java Functions
This repo contains core library for building Azure Java Functions. `azure-functions-java-core-library` contains base class for building Azure Java Functions.
-However, You don't need to include `azure-functions-java-core-library` as a dependency when you build your function app, because it comes with [azure-functions-java-library](https://github.com/Azure/azure-functions-java-library)
-You only need to include `azure-functions-java-library` as your function app dependency then you will have access to all class in `azure-functions-core-library`
+However, you don't need to include `azure-functions-java-core-library` as a dependency when you build your function app, because it comes with [azure-functions-java-library](https://github.com/Azure/azure-functions-java-library)
+which has a transitive dependency on `azure-functions-java-core-library`
For more information about Azure Java Functions please visit the [complete documentation of Azure Functions - Java Developer Guide](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-java) for more details.
@@ -16,17 +16,11 @@ For more information about Azure Java Functions please visit the [complete docum
## Parent POM
-Please see for details on Parent POM https://github.com/Microsoft/maven-java-parent
+Please see for details on parent POM https://github.com/Microsoft/maven-java-parent
## Summary
-Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. You can write just the code you need for the problem at hand, without worrying about a whole application or the infrastructure to run it. Functions can make development even more productive.Pay only for the time your code runs and trust Azure to scale as needed. Azure Functions lets you develop [serverless](https://azure.microsoft.com/en-us/solutions/serverless/) applications on Microsoft Azure.
-
-Azure Functions supports triggers, which are ways to start execution of your code, and bindings, which are ways to simplify coding for input and output data. A function should be a stateless method to process input and produce output. Although you are allowed to write instance methods, your function must not depend on any instance fields of the class. You need to make sure all the function methods are `public` accessible and method with annotation @FunctionName is unique as that defines the entry for the function.
-
-A deployable unit is an uber JAR containing one or more functions (see below), and a JSON file with the list of functions and triggers definitions, deployed to Azure Functions. The JAR can be created in many ways, although we recommend [Azure Functions Maven Plugin](https://docs.microsoft.com/en-us/java/api/overview/azure/maven/azure-functions-maven-plugin/readme), as it provides templates to get you started with key scenarios.
-
-All the input and output bindings can be defined in `function.json` (not recommended), or in the Java method by using annotations (recommended). All the types and annotations used in this document are included in the [azure-functions-java-library](https://github.com/Azure/azure-functions-java-library) package.
+[Azure Functions Summary](https://github.com/Azure/azure-functions-java-library#summary)
### Sample
diff --git a/azure-functions-java-core-library/pom.xml b/azure-functions-java-core-library/pom.xml
index fd092d5..5879775 100644
--- a/azure-functions-java-core-library/pom.xml
+++ b/azure-functions-java-core-library/pom.xml
@@ -30,9 +30,9 @@
- scm:git:https://github.com/Azure/azure-functions-java-worker
- scm:git:git@github.com:Azure/azure-functions-java-worker
- https://github.com/Azure/azure-functions-java-worker
+ scm:git:https://github.com/Azure/azure-functions-java-core-library
+ scm:git:git@github.com:Azure/azure-functions-java-core-library
+ https://github.com/Azure/azure-functions-java-core-library
HEAD
@@ -82,16 +82,13 @@
maven-compiler-plugin
- org.apache.maven.plugins
maven-source-plugin
- org.apache.maven.plugins
maven-javadoc-plugin
3.4.1
- org.apache.maven.plugins
maven-enforcer-plugin
3.0.0-M2
@@ -110,19 +107,6 @@
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
- ${project.build.directory}
-
-
- testing-project-jar
- ${project.artifactId}-${project.version}-tests.jar
-
-
-
-
diff --git a/azure-functions-java-spi-library/.gitignore b/azure-functions-java-spi-library/.gitignore
deleted file mode 100644
index 044af7d..0000000
--- a/azure-functions-java-spi-library/.gitignore
+++ /dev/null
@@ -1,41 +0,0 @@
-# Compiled class file
-*.class
-
-# Log file
-*.log
-
-# BlueJ files
-*.ctxt
-
-# Mobile Tools for Java (J2ME)
-.mtj.tmp/
-
-# Package Files #
-*.jar
-*.war
-*.nar
-*.ear
-*.zip
-*.tar.gz
-*.rar
-
-# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
-hs_err_pid*
-/.idea/*
-/target/*
-/bin
-/.classpath
-/.settings/*
-.project
-/azure-maven-archetypes/
-/azure-maven-plugins/
-/ciTestDir/*
-/target/
-/Azure.Functions.Cli/*
-/azure-functions-java-worker/
-
-#IDE
-*.iml
-
-#OSX
-.DS_Store
\ No newline at end of file
diff --git a/azure-functions-java-spi-library/README.md b/azure-functions-java-spi-library/README.md
deleted file mode 100644
index 6b1f3ea..0000000
--- a/azure-functions-java-spi-library/README.md
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-# Extend library for Azure Java Functions
-This repo contains spi library for building Azure Java Functions. **This library should not be used when build your function app.**
-This library provide hooks to third parties supporting them to interact with function runtime during function invocation process.
-**_This library should be used with scope as `provided`, because customer should not have transitive dependency on it_**
-
-For more information about Azure Java Functions please visit the [complete documentation of Azure Functions - Java Developer Guide](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-java) for more details.
-
-## azure-functions-maven plugin
-[How to use azure-functions-maven plugin to create, update, deploy and test azure java functions](https://docs.microsoft.com/en-us/java/api/overview/azure/maven/azure-functions-maven-plugin/readme?view=azure-java-stable)
-
-## Prerequisites
-
-* Java 8
-
-## Parent POM
-
-Please see for details on Parent POM https://github.com/Microsoft/maven-java-parent
-
-## Summary
-
-Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. You can write just the code you need for the problem at hand, without worrying about a whole application or the infrastructure to run it. Functions can make development even more productive.Pay only for the time your code runs and trust Azure to scale as needed. Azure Functions lets you develop [serverless](https://azure.microsoft.com/en-us/solutions/serverless/) applications on Microsoft Azure.
-
-Azure Functions supports triggers, which are ways to start execution of your code, and bindings, which are ways to simplify coding for input and output data. A function should be a stateless method to process input and produce output. Although you are allowed to write instance methods, your function must not depend on any instance fields of the class. You need to make sure all the function methods are `public` accessible and method with annotation @FunctionName is unique as that defines the entry for the function.
-
-A deployable unit is an uber JAR containing one or more functions (see below), and a JSON file with the list of functions and triggers definitions, deployed to Azure Functions. The JAR can be created in many ways, although we recommend [Azure Functions Maven Plugin](https://docs.microsoft.com/en-us/java/api/overview/azure/maven/azure-functions-maven-plugin/readme), as it provides templates to get you started with key scenarios.
-
-All the input and output bindings can be defined in `function.json` (not recommended), or in the Java method by using annotations (recommended). All the types and annotations used in this document are included in the [azure-functions-java-library](https://github.com/Azure/azure-functions-java-library) package.
-
-### Sample
-
-For an example of a HttpTrigger Azure function in Java please refer to [HttpTrigger sample](https://github.com/Azure/azure-functions-java-library#sample)
-
-### License
-
-This project is under the benevolent umbrella of the [.NET Foundation](http://www.dotnetfoundation.org/) and is licensed under [the MIT License](LICENSE.txt)
-
-This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
diff --git a/azure-functions-java-spi/README.md b/azure-functions-java-spi/README.md
new file mode 100644
index 0000000..36cc53c
--- /dev/null
+++ b/azure-functions-java-spi/README.md
@@ -0,0 +1,33 @@
+
+
+# SPI for Azure Java Functions
+This repo contains SPI library for building Azure Java Functions. **This library should not be used when building your function app.**
+This library provides hooks to third parties supporting them to interact with function runtime during function invocation process.
+**_This library should be used with scope as `provided`, because customer should not have transitive dependency on it_**
+
+For more information about Azure Java Functions please visit the [complete documentation of Azure Functions - Java Developer Guide](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-java) for more details.
+
+## azure-functions-maven plugin
+[How to use azure-functions-maven plugin to create, update, deploy and test azure java functions](https://docs.microsoft.com/en-us/java/api/overview/azure/maven/azure-functions-maven-plugin/readme?view=azure-java-stable)
+
+## Prerequisites
+
+* Java 8
+
+## Parent POM
+
+Please see for details on parent POM https://github.com/Microsoft/maven-java-parent
+
+## Summary
+
+[Azure Functions Summary](https://github.com/Azure/azure-functions-java-library#summary)
+
+### Sample
+
+For an example of a HttpTrigger Azure function in Java please refer to [HttpTrigger sample](https://github.com/Azure/azure-functions-java-library#sample)
+
+### License
+
+This project is under the benevolent umbrella of the [.NET Foundation](http://www.dotnetfoundation.org/) and is licensed under [the MIT License](LICENSE.txt)
+
+This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
diff --git a/azure-functions-java-spi-library/pom.xml b/azure-functions-java-spi/pom.xml
similarity index 77%
rename from azure-functions-java-spi-library/pom.xml
rename to azure-functions-java-spi/pom.xml
index 454d500..59fbcf2 100644
--- a/azure-functions-java-spi-library/pom.xml
+++ b/azure-functions-java-spi/pom.xml
@@ -3,7 +3,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
com.microsoft.azure.functions
- azure-functions-java-spi-library
+ azure-functions-java-spi
1.0.0
jar
@@ -30,9 +30,9 @@
- scm:git:https://github.com/Azure/azure-functions-java-worker
- scm:git:git@github.com:Azure/azure-functions-java-worker
- https://github.com/Azure/azure-functions-java-worker
+ scm:git:https://github.com/Azure/azure-functions-java-core-library
+ scm:git:git@github.com:Azure/azure-functions-java-core-library
+ https://github.com/Azure/azure-functions-java-core-library
HEAD
@@ -72,7 +72,7 @@
com.microsoft.azure.functions
azure-functions-java-core-library
1.1.0
- compile
+ provided
@@ -83,15 +83,12 @@
maven-compiler-plugin
- org.apache.maven.plugins
maven-source-plugin
- org.apache.maven.plugins
maven-javadoc-plugin
- org.apache.maven.plugins
maven-enforcer-plugin
3.0.0-M2
@@ -110,19 +107,6 @@
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
- ${project.build.directory}
-
-
- testing-project-jar
- ${project.artifactId}-${project.version}-tests.jar
-
-
-
-
diff --git a/azure-functions-java-spi-library/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/Middleware.java b/azure-functions-java-spi/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/Middleware.java
similarity index 100%
rename from azure-functions-java-spi-library/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/Middleware.java
rename to azure-functions-java-spi/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/Middleware.java
diff --git a/azure-functions-java-spi-library/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/MiddlewareChain.java b/azure-functions-java-spi/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/MiddlewareChain.java
similarity index 100%
rename from azure-functions-java-spi-library/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/MiddlewareChain.java
rename to azure-functions-java-spi/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/MiddlewareChain.java
diff --git a/azure-functions-java-spi-library/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/MiddlewareContext.java b/azure-functions-java-spi/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/MiddlewareContext.java
similarity index 100%
rename from azure-functions-java-spi-library/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/MiddlewareContext.java
rename to azure-functions-java-spi/src/main/java/com/microsoft/azure/functions/internal/spi/middleware/MiddlewareContext.java
diff --git a/azure-functions-java-spi-library/src/main/java/com/microsoft/azure/functions/spi/inject/FunctionInstanceInjector.java b/azure-functions-java-spi/src/main/java/com/microsoft/azure/functions/spi/inject/FunctionInstanceInjector.java
similarity index 60%
rename from azure-functions-java-spi-library/src/main/java/com/microsoft/azure/functions/spi/inject/FunctionInstanceInjector.java
rename to azure-functions-java-spi/src/main/java/com/microsoft/azure/functions/spi/inject/FunctionInstanceInjector.java
index fa95cd5..1809d78 100644
--- a/azure-functions-java-spi-library/src/main/java/com/microsoft/azure/functions/spi/inject/FunctionInstanceInjector.java
+++ b/azure-functions-java-spi/src/main/java/com/microsoft/azure/functions/spi/inject/FunctionInstanceInjector.java
@@ -6,18 +6,18 @@
package com.microsoft.azure.functions.spi.inject;
/**
- * The instance factory that used by DI framework to initialize function instance.
+ * The instance factory used by DI framework to initialize function instance.
*
- * @since 1.2.0
+ * @since 1.0.0
*/
public interface FunctionInstanceInjector {
/**
- * This method is used by DI framework to initialize DI container. This method takes in the customer class and return
- * an instance create by the DI framework, later customer functions will be invoked on this class instance.
+ * This method is used by DI framework to initialize the function instance. This method takes in the customer class and returns
+ * an instance create by the DI framework, later customer functions will be invoked on this instance.
* @param functionClass the class that contains customer functions
* @param customer functions class type
* @return the instance that will be invoked on by azure functions java worker
- * @throws Exception any exception that is thrown out during DI framework create instance of function class
+ * @throws Exception any exception that is thrown by the DI framework during instance creation
*/
T getInstance(Class functionClass) throws Exception;
}
diff --git a/build.ps1 b/build.ps1
index 4b39490..4a10984 100644
--- a/build.ps1
+++ b/build.ps1
@@ -40,14 +40,18 @@ if ([string]::IsNullOrEmpty($pluginVersion))
StopOnFailedExecution
-# Get azure-functions-core-library
-Write-Host "Build and install azure-functions-java-core-library"
+# Get azure-functions-core-library and azure-functions-spi
+Write-Host "Build and install azure-functions-java-core-library and azure-functions-spi"
cmd.exe /c '.\mvnBuild.bat'
StopOnFailedExecution
$coreLibraryPom = Get-Content "azure-functions-java-core-library\pom.xml" -Raw
$coreLibraryPom -match "(.*)"
$coreLibraryVersion = $matches[1]
Write-Host "coreLibraryVersion: " $coreLibraryVersion
+$spiLibraryPom = Get-Content "azure-functions-java-spi\pom.xml" -Raw
+$spiLibraryPom -match "(.*)"
+$spiLibraryVersion = $matches[1]
+Write-Host "spiLibraryVersion: " $spiLibraryVersion
# Get azure-functions-library
git clone https://github.com/Azure/azure-functions-java-library.git -b dev
diff --git a/pom.xml b/pom.xml
index 7fe7a1e..0368837 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,6 +9,6 @@
1.0-SNAPSHOT
azure-functions-java-core-library
- azure-functions-java-spi-library
+ azure-functions-java-spi
\ No newline at end of file
From fe7ec899b76447b9cdc556d25a8177d1b913799d Mon Sep 17 00:00:00 2001
From: kaibocai <89094811+kaibocai@users.noreply.github.com>
Date: Sat, 15 Oct 2022 08:19:20 -0500
Subject: [PATCH 10/14] update README.md
---
README.md | 11 +++--------
azure-functions-java-core-library/README.md | 3 ++-
azure-functions-java-spi/README.md | 3 ++-
3 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/README.md b/README.md
index ca59c6f..56107fe 100644
--- a/README.md
+++ b/README.md
@@ -25,17 +25,12 @@ Please see for details on Parent POM https://github.com/Microsoft/maven-java-par
## Summary
-Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. You can write just the code you need for the problem at hand, without worrying about a whole application or the infrastructure to run it. Functions can make development even more productive.Pay only for the time your code runs and trust Azure to scale as needed. Azure Functions lets you develop [serverless](https://azure.microsoft.com/en-us/solutions/serverless/) applications on Microsoft Azure.
-
-Azure Functions supports triggers, which are ways to start execution of your code, and bindings, which are ways to simplify coding for input and output data. A function should be a stateless method to process input and produce output. Although you are allowed to write instance methods, your function must not depend on any instance fields of the class. You need to make sure all the function methods are `public` accessible and method with annotation @FunctionName is unique as that defines the entry for the function.
-
-A deployable unit is an uber JAR containing one or more functions (see below), and a JSON file with the list of functions and triggers definitions, deployed to Azure Functions. The JAR can be created in many ways, although we recommend [Azure Functions Maven Plugin](https://docs.microsoft.com/en-us/java/api/overview/azure/maven/azure-functions-maven-plugin/readme), as it provides templates to get you started with key scenarios.
-
-All the input and output bindings can be defined in `function.json` (not recommended), or in the Java method by using annotations (recommended). All the types and annotations used in this document are included in the [azure-functions-java-library](https://github.com/Azure/azure-functions-java-library) package.
+[Azure Functions Summary](https://github.com/Azure/azure-functions-java-library#summary)
### Sample
-For an example of a HttpTrigger Azure function in Java please refer to [HttpTrigger sample](https://github.com/Azure/azure-functions-java-library#sample)
+For samples of Azure function in Java please refer to [Azure Function Java Samples](https://github.com/Azure/azure-functions-java-library#sample)
+and [Azure Functions Java Samples Repository](https://github.com/Azure-Samples/azure-functions-samples-java)
### License
diff --git a/azure-functions-java-core-library/README.md b/azure-functions-java-core-library/README.md
index 036f422..ad11714 100644
--- a/azure-functions-java-core-library/README.md
+++ b/azure-functions-java-core-library/README.md
@@ -24,7 +24,8 @@ Please see for details on parent POM https://github.com/Microsoft/maven-java-par
### Sample
-For an example of a HttpTrigger Azure function in Java please refer to [HttpTrigger sample](https://github.com/Azure/azure-functions-java-library#sample)
+For samples of Azure function in Java please refer to [Azure Function Java Samples](https://github.com/Azure/azure-functions-java-library#sample)
+and [Azure Functions Java Samples Repository](https://github.com/Azure-Samples/azure-functions-samples-java)
### License
diff --git a/azure-functions-java-spi/README.md b/azure-functions-java-spi/README.md
index 36cc53c..959da28 100644
--- a/azure-functions-java-spi/README.md
+++ b/azure-functions-java-spi/README.md
@@ -24,7 +24,8 @@ Please see for details on parent POM https://github.com/Microsoft/maven-java-par
### Sample
-For an example of a HttpTrigger Azure function in Java please refer to [HttpTrigger sample](https://github.com/Azure/azure-functions-java-library#sample)
+For samples of Azure function in Java please refer to [Azure Function Java Samples](https://github.com/Azure/azure-functions-java-library#sample)
+and [Azure Functions Java Samples Repository](https://github.com/Azure-Samples/azure-functions-samples-java)
### License
From bc5c2a3235808319a1657586e27b1b2cdc78dda3 Mon Sep 17 00:00:00 2001
From: kaibocai <89094811+kaibocai@users.noreply.github.com>
Date: Tue, 25 Oct 2022 11:50:13 -0500
Subject: [PATCH 11/14] update repo name to azure-functions-java-additions
---
README.md | 8 ++++----
pom.xml | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index 56107fe..0a4fffc 100644
--- a/README.md
+++ b/README.md
@@ -5,10 +5,10 @@
|master|[](https://ci.appveyor.com/project/appsvc/azure-functions-java-library?branch=master)|
|dev|[](https://ci.appveyor.com/project/appsvc/azure-functions-java-library?branch=dev)|
-# Extend library for Azure Java Functions
-This repo contains two additional libraries for building Azure Java Functions.
-* [azure-functions-java-core-library](https://github.com/Azure/azure-functions-java-???-library/azure-functions-java-core-library)
-* [azure-functions-java-spi](https://github.com/Azure/azure-functions-java-???-library/azure-functions-java-spi)
+# Additional artifacts for Azure Java Functions
+This repo contains two additional artifacts for building Azure Java Functions.
+* [azure-functions-java-core-library](https://github.com/Azure/azure-functions-java-additions/azure-functions-java-core-library)
+* [azure-functions-java-spi](https://github.com/Azure/azure-functions-java-additions/azure-functions-java-spi)
For more information about Azure Java Functions please visit the [complete documentation of Azure Functions - Java Developer Guide](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-java) for more details.
diff --git a/pom.xml b/pom.xml
index 0368837..287774f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
4.0.0
com.microsoft.azure.functions
- azure-functions-java-extend-library
+ azure-functions-java-additions
pom
1.0-SNAPSHOT
From e6ed9b9c35edc3edd2b624b01b250c697ffd9bff Mon Sep 17 00:00:00 2001
From: kaibocai <89094811+kaibocai@users.noreply.github.com>
Date: Tue, 25 Oct 2022 12:53:13 -0500
Subject: [PATCH 12/14] minor updates
---
azure-functions-java-spi/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/azure-functions-java-spi/README.md b/azure-functions-java-spi/README.md
index 959da28..23d1243 100644
--- a/azure-functions-java-spi/README.md
+++ b/azure-functions-java-spi/README.md
@@ -1,7 +1,7 @@

# SPI for Azure Java Functions
-This repo contains SPI library for building Azure Java Functions. **This library should not be used when building your function app.**
+This repo contains SPI for building Azure Java Functions. **This library should not be used when building your function app.**
This library provides hooks to third parties supporting them to interact with function runtime during function invocation process.
**_This library should be used with scope as `provided`, because customer should not have transitive dependency on it_**
From e7abd608470cf11aeab7a98251d01177244eeaf4 Mon Sep 17 00:00:00 2001
From: kaibocai <89094811+kaibocai@users.noreply.github.com>
Date: Thu, 27 Oct 2022 17:20:16 -0500
Subject: [PATCH 13/14] resolve final comments
---
.gitignore | 2 +-
azure-functions-java-core-library/README.md | 6 +-----
azure-functions-java-core-library/pom.xml | 10 ----------
azure-functions-java-spi/README.md | 8 ++------
azure-functions-java-spi/pom.xml | 10 ----------
5 files changed, 4 insertions(+), 32 deletions(-)
diff --git a/.gitignore b/.gitignore
index cd546b7..ace21a3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,7 +22,7 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/.idea/*
-*/target/*
+target
/bin
/.classpath
/.settings/*
diff --git a/azure-functions-java-core-library/README.md b/azure-functions-java-core-library/README.md
index ad11714..ee4c2a2 100644
--- a/azure-functions-java-core-library/README.md
+++ b/azure-functions-java-core-library/README.md
@@ -5,7 +5,7 @@ This repo contains core library for building Azure Java Functions. `azure-functi
However, you don't need to include `azure-functions-java-core-library` as a dependency when you build your function app, because it comes with [azure-functions-java-library](https://github.com/Azure/azure-functions-java-library)
which has a transitive dependency on `azure-functions-java-core-library`
-For more information about Azure Java Functions please visit the [complete documentation of Azure Functions - Java Developer Guide](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-java) for more details.
+For more information about Azure Java Functions please visit the [complete documentation of Azure Functions - Java Developer Guide](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-java).
## azure-functions-maven plugin
[How to use azure-functions-maven plugin to create, update, deploy and test azure java functions](https://docs.microsoft.com/en-us/java/api/overview/azure/maven/azure-functions-maven-plugin/readme?view=azure-java-stable)
@@ -14,10 +14,6 @@ For more information about Azure Java Functions please visit the [complete docum
* Java 8
-## Parent POM
-
-Please see for details on parent POM https://github.com/Microsoft/maven-java-parent
-
## Summary
[Azure Functions Summary](https://github.com/Azure/azure-functions-java-library#summary)
diff --git a/azure-functions-java-core-library/pom.xml b/azure-functions-java-core-library/pom.xml
index 5879775..8692de2 100644
--- a/azure-functions-java-core-library/pom.xml
+++ b/azure-functions-java-core-library/pom.xml
@@ -43,16 +43,6 @@
-
-
- ossrh
- Sonatype Snapshots
- https://oss.sonatype.org/content/repositories/snapshots/
- true
- default
-
-
-
maven.snapshots
diff --git a/azure-functions-java-spi/README.md b/azure-functions-java-spi/README.md
index 23d1243..1e67bc6 100644
--- a/azure-functions-java-spi/README.md
+++ b/azure-functions-java-spi/README.md
@@ -3,9 +3,9 @@
# SPI for Azure Java Functions
This repo contains SPI for building Azure Java Functions. **This library should not be used when building your function app.**
This library provides hooks to third parties supporting them to interact with function runtime during function invocation process.
-**_This library should be used with scope as `provided`, because customer should not have transitive dependency on it_**
+**_This library should be used with scope as `provided`, because customers should not inherit it via a transitive dependency_**
-For more information about Azure Java Functions please visit the [complete documentation of Azure Functions - Java Developer Guide](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-java) for more details.
+For more information about Azure Java Functions please visit the [complete documentation of Azure Functions - Java Developer Guide](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-java).
## azure-functions-maven plugin
[How to use azure-functions-maven plugin to create, update, deploy and test azure java functions](https://docs.microsoft.com/en-us/java/api/overview/azure/maven/azure-functions-maven-plugin/readme?view=azure-java-stable)
@@ -14,10 +14,6 @@ For more information about Azure Java Functions please visit the [complete docum
* Java 8
-## Parent POM
-
-Please see for details on parent POM https://github.com/Microsoft/maven-java-parent
-
## Summary
[Azure Functions Summary](https://github.com/Azure/azure-functions-java-library#summary)
diff --git a/azure-functions-java-spi/pom.xml b/azure-functions-java-spi/pom.xml
index 59fbcf2..8a5395f 100644
--- a/azure-functions-java-spi/pom.xml
+++ b/azure-functions-java-spi/pom.xml
@@ -43,16 +43,6 @@
-
-
- ossrh
- Sonatype Snapshots
- https://oss.sonatype.org/content/repositories/snapshots/
- true
- default
-
-
-
maven.snapshots
From 1b8cb3e42c5b7c23aebb769ecc6b6802e5843011 Mon Sep 17 00:00:00 2001
From: kaibocai <89094811+kaibocai@users.noreply.github.com>
Date: Thu, 27 Oct 2022 18:19:59 -0500
Subject: [PATCH 14/14] change back to dev branch in pipeline tests
---
build.ps1 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/build.ps1 b/build.ps1
index 4a10984..ddaad01 100644
--- a/build.ps1
+++ b/build.ps1
@@ -101,7 +101,7 @@ Expand-Archive ".\Azure.Functions.Cli.zip" -DestinationPath ".\Azure.Functions.C
$Env:Path = $Env:Path+";$currDir\Azure.Functions.Cli"
# Clone and build azure-functions-java-worker
-git clone https://github.com/azure/azure-functions-java-worker -b kaibocai/test-spi-lib
+git clone https://github.com/azure/azure-functions-java-worker -b dev
Push-Location -Path "./azure-functions-java-worker" -StackName libraryDir
Write-Host "Updating azure-functions-java-worker to use current version of the java core library"