Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion etc/botframework-java-formatter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="48"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="64"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_loops" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@

package com.microsoft.bot.builder;

import com.microsoft.bot.connector.authentication.ClaimsIdentity;
import com.microsoft.bot.schema.Activity;
import com.microsoft.bot.schema.ConversationReference;
import com.microsoft.bot.schema.ResourceResponse;

import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import org.apache.commons.lang3.NotImplementedException;

/**
* Represents a bot adapter that can connect a bot to a service endpoint. This
Expand All @@ -32,6 +34,16 @@
* {@link TurnContext} {@link Activity} {@link Bot} {@link Middleware}
*/
public abstract class BotAdapter {
/**
* Key to store bot claims identity.
*/
public static final String BOT_IDENTITY_KEY = "BotIdentity";

/**
* Key to store bot oauth scope.
*/
public static final String OAUTH_SCOPE_KEY = "Microsoft.Bot.Builder.BotAdapter.OAuthScope";

/**
* The collection of middleware in the adapter's pipeline.
*/
Expand Down Expand Up @@ -213,18 +225,66 @@ public CompletableFuture<Void> continueConversation(
ConversationReference reference,
BotCallbackHandler callback
) {

CompletableFuture<Void> pipelineResult = new CompletableFuture<>();

try (TurnContextImpl context = new TurnContextImpl(
this,
reference.getContinuationActivity()
)) {
try (TurnContextImpl context =
new TurnContextImpl(this, reference.getContinuationActivity())) {
pipelineResult = runPipeline(context, callback);
} catch (Exception e) {
pipelineResult.completeExceptionally(e);
}

return pipelineResult;
}

/**
* Sends a proactive message to a conversation.
*
* <p>
* Call this method to proactively send a message to a conversation. Most
* channels require a user to initiate a conversation with a bot before the bot
* can send activities to the user.
* </p>
*
* @param claimsIdentity A ClaimsIdentity reference for the conversation.
* @param reference A reference to the conversation to continue.
* @param callback The method to call for the result bot turn.
* @return A task that represents the work queued to execute.
*/
public CompletableFuture<Void> continueConversation(
ClaimsIdentity claimsIdentity,
ConversationReference reference,
BotCallbackHandler callback
) {
CompletableFuture<Void> result = new CompletableFuture<>();
result.completeExceptionally(new NotImplementedException("continueConversation"));
return result;
}

/**
* Sends a proactive message to a conversation.
*
* <p>
* Call this method to proactively send a message to a conversation. Most
* channels require a user to initiate a conversation with a bot before the bot
* can send activities to the user.
* </p>
*
* @param claimsIdentity A ClaimsIdentity reference for the conversation.
* @param reference A reference to the conversation to continue.
* @param audience A value signifying the recipient of the proactive
* message.
* @param callback The method to call for the result bot turn.
* @return A task that represents the work queued to execute.
*/
public CompletableFuture<Void> continueConversation(
ClaimsIdentity claimsIdentity,
ConversationReference reference,
String audience,
BotCallbackHandler callback
) {
CompletableFuture<Void> result = new CompletableFuture<>();
result.completeExceptionally(new NotImplementedException("continueConversation"));
return result;
}
}
Loading