middleware)
{
if (middleware == null)
diff --git a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/BotFrameworkAdapter.java b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/BotFrameworkAdapter.java
index 321e6176..779366ec 100644
--- a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/BotFrameworkAdapter.java
+++ b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/BotFrameworkAdapter.java
@@ -25,24 +25,24 @@ import java.util.function.Function;
import static com.ea.async.Async.await;
import static java.util.concurrent.CompletableFuture.completedFuture;
-///
-/// A bot adapter that can connect a bot to a service endpoint.
-///
-/// The bot adapter encapsulates authentication processes and sends
-/// activities to and receives activities from the Bot Connector Service. When your
-/// bot receives an activity, the adapter creates a context object, passes it to your
-/// bot's application logic, and sends responses back to the user's channel.
-/// Use to add objects
-/// to your adapter’s middleware collection. The adapter processes and directs
-/// incoming activities in through the bot middleware pipeline to your bot’s logic
-/// and then back out again. As each activity flows in and out of the bot, each piece
-/// of middleware can inspect or act upon the activity, both before and after the bot
-/// logic runs.
-///
-///
-///
-///
-///
+/**
+ * A bot adapter that can connect a bot to a service endpoint.
+ * The bot adapter encapsulates authentication processes and sends
+ * activities to and receives activities from the Bot Connector Service. When your
+ * bot receives an activity, the adapter creates a context object, passes it to your
+ * bot's application logic, and sends responses back to the user's channel.
+ * Use {@link Use(Middleware)} to add {@link Middleware} objects
+ * to your adapter’s middleware collection. The adapter processes and directs
+ * incoming activities in through the bot middleware pipeline to your bot’s logic
+ * and then back out again. As each activity flows in and out of the bot, each piece
+ * of middleware can inspect or act upon the activity, both before and after the bot
+ * logic runs.
+ *
+ * {@linkalso TurnContext}
+ * {@linkalso Activity}
+ * {@linkalso Bot}
+ * {@linkalso Middleware}
+ */
public class BotFrameworkAdapter extends BotAdapter {
private final CredentialProvider _credentialProvider;
@@ -52,20 +52,20 @@ public class BotFrameworkAdapter extends BotAdapter {
private final String InvokeReponseKey = "BotFrameworkAdapter.InvokeResponse";
private boolean isEmulatingOAuthCards = false;
- ///
- /// Initializes a new instance of the class,
- /// using a credential provider.
- ///
- /// The credential provider.
- /// Retry strategy for retrying HTTP operations.
- /// The HTTP client.
- /// The middleware to initially add to the adapter.
- ///
- /// is null.
- /// Use a object to add multiple middleware
- /// components in the conustructor. Use the method to
- /// add additional middleware to the adapter after construction.
- ///
+ /**
+ * Initializes a new instance of the {@link BotFrameworkAdapter} class,
+ * using a credential provider.
+ * @param credentialProvider The credential provider.
+ * @param connectorClientRetryStrategy Retry strategy for retrying HTTP operations.
+ * @param httpClient The HTTP client.
+ * @param middleware The middleware to initially add to the adapter.
+ * @throws IllegalArgumentException
+ * {@code credentialProvider} is {@code null}.
+ * Use a {@link MiddlewareSet} object to add multiple middleware
+ * components in the conustructor. Use the {@link Use(Middleware)} method to
+ * add additional middleware to the adapter after construction.
+ *
+ */
public BotFrameworkAdapter(CredentialProvider credentialProvider) {
this(credentialProvider, null, null, null);
}
@@ -90,32 +90,32 @@ public class BotFrameworkAdapter extends BotAdapter {
}
}
- ///
- /// Sends a proactive message from the bot to a conversation.
- ///
- /// The application ID of the bot. This is the appId returned by Portal registration, and is
- /// generally found in the "MicrosoftAppId" parameter in appSettings.json.
- /// A reference to the conversation to continue.
- /// The method to call for the resulting bot turn.
- /// A task that represents the work queued to execute.
- ///
- /// , , or
- /// is null.
- /// Call this method to proactively send a message to a conversation.
- /// Most channels require a user to initaiate a conversation with a bot
- /// before the bot can send activities to the user.
- /// This method registers the following.services().for the turn.
- /// - (key = "BotIdentity"), a claims identity for the bot.
- /// - , the channel connector client to use this turn.
- ///
- ///
- /// This overload differers from the Node implementation by requiring the BotId to be
- /// passed in. The .Net code allows multiple bots to be hosted in a single adapter which
- /// isn't something supported by Node.
- ///
- ///
- ///
- ///
+ /**
+ * Sends a proactive message from the bot to a conversation.
+ * @param botAppId The application ID of the bot. This is the appId returned by Portal registration, and is
+ * generally found in the "MicrosoftAppId" parameter in appSettings.json.
+ * @param reference A reference to the conversation to continue.
+ * @param callback The method to call for the resulting bot turn.
+ * @return A task that represents the work queued to execute.
+ * @throws IllegalArgumentException
+ * {@code botAppId}, {@code reference}, or
+ * {@code callback} is {@code null}.
+ * Call this method to proactively send a message to a conversation.
+ * Most channels require a user to initaiate a conversation with a bot
+ * before the bot can send activities to the user.
+ * This method registers the following.services().for the turn.
+ * - {@link ConnectorClient}, the channel connector client to use this turn.
+ *
+ *
+ * This overload differers from the Node implementation by requiring the BotId to be
+ * passed in. The .Net code allows multiple bots to be hosted in a single adapter which
+ * isn't something supported by Node.
+ *
+ *
+ * {@linkalso ProcessActivity(String, Activity, Func{TurnContext, Task})}
+ * {@linkalso BotAdapter.RunPipeline(TurnContext, Func{TurnContext, Task}}
+ */
@Override
public CompletableFuture ContinueConversation(String botAppId, ConversationReference reference, Function callback) throws Exception {
if (StringUtils.isEmpty(botAppId))
@@ -143,19 +143,19 @@ public class BotFrameworkAdapter extends BotAdapter {
return completedFuture(null);
}
- ///
- /// Initializes a new instance of the class,
- /// using an application ID and secret.
- ///
- /// The application ID of the bot.
- /// The application secret for the bot.
- /// Retry policy for retrying HTTP operations.
- /// The HTTP client.
- /// The middleware to initially add to the adapter.
- /// Use a object to add multiple middleware
- /// components in the conustructor. Use the method to
- /// add additional middleware to the adapter after construction.
- ///
+ /**
+ * Initializes a new instance of the {@link BotFrameworkAdapter} class,
+ * using an application ID and secret.
+ * @param appId The application ID of the bot.
+ * @param appPassword The application secret for the bot.
+ * @param connectorClientRetryStrategy Retry policy for retrying HTTP operations.
+ * @param httpClient The HTTP client.
+ * @param middleware The middleware to initially add to the adapter.
+ * Use a {@link MiddlewareSet} object to add multiple middleware
+ * components in the conustructor. Use the {@link Use(Middleware)} method to
+ * add additional middleware to the adapter after construction.
+ *
+ */
public BotFrameworkAdapter(String appId, String appPassword) {
this(appId, appPassword, null, null, null);
}
@@ -172,42 +172,42 @@ public class BotFrameworkAdapter extends BotAdapter {
this(new SimpleCredentialProvider(appId, appPassword), connectorClientRetryStrategy, httpClient, middleware);
}
- ///
- /// Adds middleware to the adapter's pipeline.
- ///
- /// The middleware to add.
- /// The updated adapter object.
- /// Middleware is added to the adapter at initialization time.
- /// For each turn, the adapter calls middleware in the order in which you added it.
- ///
+ /**
+ * Adds middleware to the adapter's pipeline.
+ * @param middleware The middleware to add.
+ * @return The updated adapter object.
+ * Middleware is added to the adapter at initialization time.
+ * For each turn, the adapter calls middleware in the order in which you added it.
+ *
+ */
public BotFrameworkAdapter Use(Middleware middleware) {
super._middlewareSet.Use(middleware);
return this;
}
- ///
- /// Creates a turn context and runs the middleware pipeline for an incoming activity.
- ///
- /// The HTTP authentication header of the request.
- /// The incoming activity.
- /// The code to run at the end of the adapter's middleware
- /// pipeline.
- /// A task that represents the work queued to execute. If the activity type
- /// was 'Invoke' and the corresponding key (channelId + activityId) was found
- /// then an InvokeResponse is returned, otherwise null is returned.
- ///
- /// is null.
- ///
- /// authentication failed.
- /// Call this method to reactively send a message to a conversation.
- /// This method registers the following.services().for the turn.
- /// - (key = "BotIdentity"), a claims identity for the bot.
- /// - , the channel connector client to use this turn.
- ///
- ///
- ///
- ///
+ /**
+ * Creates a turn context and runs the middleware pipeline for an incoming activity.
+ * @param authHeader The HTTP authentication header of the request.
+ * @param activity The incoming activity.
+ * @param callback The code to run at the end of the adapter's middleware
+ * pipeline.
+ * @return A task that represents the work queued to execute. If the activity type
+ * was 'Invoke' and the corresponding key (channelId + activityId) was found
+ * then an InvokeResponse is returned, otherwise null is returned.
+ * @throws IllegalArgumentException
+ * {@code activity} is {@code null}.
+ * @throws UnauthorizedAccessException
+ * authentication failed.
+ * Call this method to reactively send a message to a conversation.
+ * This method registers the following.services().for the turn.
+ * - {@link ConnectorClient}, the channel connector client to use this turn.
+ *
+ *
+ * {@linkalso ContinueConversation(String, ConversationReference, Func{TurnContext, Task})}
+ * {@linkalso BotAdapter.RunPipeline(TurnContext, Func{TurnContext, Task})}
+ */
public CompletableFuture ProcessActivity(String authHeader, ActivityImpl activity, Function callback) throws Exception {
BotAssert.ActivityNotNull(activity);
@@ -247,16 +247,16 @@ public class BotFrameworkAdapter extends BotAdapter {
}
}
- ///
- /// Sends activities to the conversation.
- ///
- /// The context object for the turn.
- /// The activities to send.
- /// A task that represents the work queued to execute.
- /// If the activities are successfully sent, the task result contains
- /// an array of objects containing the IDs that
- /// the receiving channel assigned to the activities.
- ///
+ /**
+ * Sends activities to the conversation.
+ * @param context The context object for the turn.
+ * @param activities The activities to send.
+ * @return A task that represents the work queued to execute.
+ * If the activities are successfully sent, the task result contains
+ * an array of {@link ResourceResponse} objects containing the IDs that
+ * the receiving channel assigned to the activities.
+ * {@linkalso TurnContext.OnSendActivities(SendActivitiesHandler)}
+ */
public CompletableFuture SendActivities(TurnContext context, Activity[] activities) throws InterruptedException {
if (context == null) {
throw new IllegalArgumentException("context");
@@ -323,18 +323,18 @@ public class BotFrameworkAdapter extends BotAdapter {
return completedFuture(responses);
}
- ///
- /// Replaces an existing activity in the conversation.
- ///
- /// The context object for the turn.
- /// New replacement activity.
- /// A task that represents the work queued to execute.
- /// If the activity is successfully sent, the task result contains
- /// a object containing the ID that the receiving
- /// channel assigned to the activity.
- /// Before calling this, set the ID of the replacement activity to the ID
- /// of the activity to replace.
- ///
+ /**
+ * Replaces an existing activity in the conversation.
+ * @param context The context object for the turn.
+ * @param activity New replacement activity.
+ * @return A task that represents the work queued to execute.
+ * If the activity is successfully sent, the task result contains
+ * a {@link ResourceResponse} object containing the ID that the receiving
+ * channel assigned to the activity.
+ * Before calling this, set the ID of the replacement activity to the ID
+ * of the activity to replace.
+ * {@linkalso TurnContext.OnUpdateActivity(UpdateActivityHandler)}
+ */
@Override
public CompletableFuture UpdateActivity(TurnContext context, Activity activity) {
ConnectorClient connectorClient = context.getServices().Get("ConnectorClient");
@@ -343,15 +343,15 @@ public class BotFrameworkAdapter extends BotAdapter {
return completedFuture(null);
}
- ///
- /// Deletes an existing activity in the conversation.
- ///
- /// The context object for the turn.
- /// Conversation reference for the activity to delete.
- /// A task that represents the work queued to execute.
- /// The of the conversation
- /// reference identifies the activity to delete.
- ///
+ /**
+ * Deletes an existing activity in the conversation.
+ * @param context The context object for the turn.
+ * @param reference Conversation reference for the activity to delete.
+ * @return A task that represents the work queued to execute.
+ * The {@link ConversationReference.ActivityId} of the conversation
+ * reference identifies the activity to delete.
+ * {@linkalso TurnContext.OnDeleteActivity(DeleteActivityHandler)}
+ */
public CompletableFuture DeleteActivity(TurnContext context, ConversationReference reference) {
return CompletableFuture.supplyAsync(() -> {
ConnectorClientImpl connectorClient = context.getServices().Get("ConnectorClient");
@@ -368,12 +368,12 @@ public class BotFrameworkAdapter extends BotAdapter {
});
}
- ///
- /// Deletes a member from the current conversation
- ///
- /// The context object for the turn.
- /// ID of the member to delete from the conversation
- ///
+ /**
+ * Deletes a member from the current conversation
+ * @param context The context object for the turn.
+ * @param memberId ID of the member to delete from the conversation
+ * @return
+ */
public CompletableFuture DeleteConversationMember(TurnContextImpl context, String memberId) {
if (context.getActivity().conversation() == null)
throw new IllegalArgumentException("BotFrameworkAdapter.deleteConversationMember(): missing conversation");
@@ -390,12 +390,12 @@ public class BotFrameworkAdapter extends BotAdapter {
return completedFuture(null);
}
- ///
- /// Lists the members of a given activity.
- ///
- /// The context object for the turn.
- /// (Optional) Activity ID to enumerate. If not specified the current activities ID will be used.
- /// List of Members of the activity
+ /**
+ * Lists the members of a given activity.
+ * @param context The context object for the turn.
+ * @param activityId (Optional) Activity ID to enumerate. If not specified the current activities ID will be used.
+ * @return List of Members of the activity
+ */
public CompletableFuture> GetActivityMembers(TurnContextImpl context) {
return GetActivityMembers(context, null);
}
@@ -420,11 +420,11 @@ public class BotFrameworkAdapter extends BotAdapter {
return completedFuture(null);
}
- ///
- /// Lists the members of the current conversation.
- ///
- /// The context object for the turn.
- /// List of Members of the current conversation
+ /**
+ * Lists the members of the current conversation.
+ * @param context The context object for the turn.
+ * @return List of Members of the current conversation
+ */
public CompletableFuture> GetConversationMembers(TurnContextImpl context) {
if (context.getActivity().conversation() == null)
throw new IllegalArgumentException("BotFrameworkAdapter.GetActivityMembers(): missing conversation");
@@ -440,22 +440,22 @@ public class BotFrameworkAdapter extends BotAdapter {
return completedFuture(null);
}
- ///
- /// Lists the Conversations in which this bot has participated for a given channel server. The
- /// channel server returns results in pages and each page will include a `continuationToken`
- /// that can be used to fetch the next page of results from the server.
- ///
- /// The URL of the channel server to query. This can be retrieved
- /// from `context.activity.serviceUrl`.
- /// The credentials needed for the Bot to connect to the.services().
- /// (Optional) token used to fetch the next page of results
- /// from the channel server. This should be left as `null` to retrieve the first page
- /// of results.
- /// List of Members of the current conversation
- ///
- /// This overload may be called from outside the context of a conversation, as only the
- /// Bot's ServiceUrl and credentials are required.
- ///
+ /**
+ * Lists the Conversations in which this bot has participated for a given channel server. The
+ * channel server returns results in pages and each page will include a `continuationToken`
+ * that can be used to fetch the next page of results from the server.
+ * @param serviceUrl The URL of the channel server to query. This can be retrieved
+ * from `context.activity.serviceUrl`.
+ * @param credentials The credentials needed for the Bot to connect to the.services().
+ * @param continuationToken (Optional) token used to fetch the next page of results
+ * from the channel server. This should be left as `null` to retrieve the first page
+ * of results.
+ * @return List of Members of the current conversation
+ *
+ * This overload may be called from outside the context of a conversation, as only the
+ * Bot's ServiceUrl and credentials are required.
+ *
+ */
public CompletableFuture GetConversations(String serviceUrl, MicrosoftAppCredentials credentials) throws MalformedURLException, URISyntaxException {
return GetConversations(serviceUrl, credentials, null);
}
@@ -473,21 +473,21 @@ public class BotFrameworkAdapter extends BotAdapter {
return completedFuture(null);
}
- ///
- /// Lists the Conversations in which this bot has participated for a given channel server. The
- /// channel server returns results in pages and each page will include a `continuationToken`
- /// that can be used to fetch the next page of results from the server.
- ///
- /// The context object for the turn.
- /// (Optional) token used to fetch the next page of results
- /// from the channel server. This should be left as `null` to retrieve the first page
- /// of results.
- /// List of Members of the current conversation
- ///
- /// This overload may be called during standard Activity processing, at which point the Bot's
- /// service URL and credentials that are part of the current activity processing pipeline
- /// will be used.
- ///
+ /**
+ * Lists the Conversations in which this bot has participated for a given channel server. The
+ * channel server returns results in pages and each page will include a `continuationToken`
+ * that can be used to fetch the next page of results from the server.
+ * @param context The context object for the turn.
+ * @param continuationToken (Optional) token used to fetch the next page of results
+ * from the channel server. This should be left as `null` to retrieve the first page
+ * of results.
+ * @return List of Members of the current conversation
+ *
+ * This overload may be called during standard Activity processing, at which point the Bot's
+ * service URL and credentials that are part of the current activity processing pipeline
+ * will be used.
+ *
+ */
public CompletableFuture GetConversations(TurnContextImpl context) {
return GetConversations(context, null);
}
@@ -500,12 +500,13 @@ public class BotFrameworkAdapter extends BotAdapter {
}
- /// Attempts to retrieve the token for a user that's in a login flow.
- ///
- /// Context for the current turn of conversation with the user.
- /// Name of the auth connection to use.
- /// (Optional) Optional user entered code to validate.
- /// Token Response
+ /**
+ * Attempts to retrieve the token for a user that's in a login flow.
+ * @param context Context for the current turn of conversation with the user.
+ * @param connectionName Name of the auth connection to use.
+ * @param magicCode (Optional) Optional user entered code to validate.
+ * @return Token Response
+ */
public CompletableFuture GetUserToken(TurnContextImpl context, String connectionName, String magicCode) {
BotAssert.ContextNotNull(context);
if (context.getActivity().from() == null || StringUtils.isEmpty(context.getActivity().from().id()))
@@ -519,12 +520,12 @@ public class BotFrameworkAdapter extends BotAdapter {
return completedFuture(null);
}
- ///
- /// Get the raw signin link to be sent to the user for signin for a connection name.
- ///
- /// Context for the current turn of conversation with the user.
- /// Name of the auth connection to use.
- ///
+ /**
+ * Get the raw signin link to be sent to the user for signin for a connection name.
+ * @param context Context for the current turn of conversation with the user.
+ * @param connectionName Name of the auth connection to use.
+ * @return
+ */
public CompletableFuture GetOauthSignInLink(TurnContextImpl context, String connectionName) {
BotAssert.ContextNotNull(context);
if (StringUtils.isEmpty(connectionName))
@@ -535,12 +536,12 @@ public class BotFrameworkAdapter extends BotAdapter {
return completedFuture(null);
}
- ///
- /// Signs the user out with the token server.
- ///
- /// Context for the current turn of conversation with the user.
- /// Name of the auth connection to use.
- ///
+ /**
+ * Signs the user out with the token server.
+ * @param context Context for the current turn of conversation with the user.
+ * @param connectionName Name of the auth connection to use.
+ * @return
+ */
public CompletableFuture SignOutUser(TurnContextImpl context, String connectionName) {
BotAssert.ContextNotNull(context);
if (StringUtils.isEmpty(connectionName))
@@ -551,26 +552,26 @@ public class BotFrameworkAdapter extends BotAdapter {
return completedFuture(null);
}
- ///
- /// Creates a conversation on the specified channel.
- ///
- /// The ID for the channel.
- /// The channel's service URL endpoint.
- /// The application credentials for the bot.
- /// The conversation information to use to
- /// create the conversation.
- /// The method to call for the resulting bot turn.
- /// A task that represents the work queued to execute.
- /// To start a conversation, your bot must know its account information
- /// and the user's account information on that channel.
- /// Most channels only support initiating a direct message (non-group) conversation.
- /// The adapter attempts to create a new conversation on the channel, and
- /// then sends a conversationUpdate activity through its middleware pipeline
- /// to the method.
- /// If the conversation is established with the
- /// specified users, the ID of the activity's
- /// will contain the ID of the new conversation.
- ///
+ /**
+ * Creates a conversation on the specified channel.
+ * @param channelId The ID for the channel.
+ * @param serviceUrl The channel's service URL endpoint.
+ * @param credentials The application credentials for the bot.
+ * @param conversationParameters The conversation information to use to
+ * create the conversation.
+ * @param callback The method to call for the resulting bot turn.
+ * @return A task that represents the work queued to execute.
+ * To start a conversation, your bot must know its account information
+ * and the user's account information on that channel.
+ * Most channels only support initiating a direct message (non-group) conversation.
+ * The adapter attempts to create a new conversation on the channel, and
+ * then sends a {@code conversationUpdate} activity through its middleware pipeline
+ * to the {@code callback} method.
+ * If the conversation is established with the
+ * specified users, the ID of the activity's {@link Activity.Conversation}
+ * will contain the ID of the new conversation.
+ *
+ */
public CompletableFuture CreateConversation(String channelId, String serviceUrl, MicrosoftAppCredentials
credentials, ConversationParameters conversationParameters, Function callback) throws Exception {
// Validate serviceUrl - can throw
@@ -651,13 +652,13 @@ public class BotFrameworkAdapter extends BotAdapter {
return new OAuthClient(client, AuthenticationConstants.OAuthUrl);
}
- ///
- /// Creates the connector client asynchronous.
- ///
- /// The service URL.
- /// The claims identity.
- /// ConnectorClient instance.
- /// ClaimsIdemtity cannot be null. Pass Anonymous ClaimsIdentity if authentication is turned off.
+ /**
+ * Creates the connector client asynchronous.
+ * @param serviceUrl The service URL.
+ * @param claimsIdentity The claims identity.
+ * @return ConnectorClient instance.
+ * @throws UnsupportedOperationException ClaimsIdemtity cannot be null. Pass Anonymous ClaimsIdentity if authentication is turned off.
+ */
private CompletableFuture CreateConnectorClientAsync(String serviceUrl, ClaimsIdentity claimsIdentity) {
return CompletableFuture.supplyAsync(() -> {
@@ -720,12 +721,12 @@ public class BotFrameworkAdapter extends BotAdapter {
}
- ///
- /// Creates the connector client.
- ///
- /// The service URL.
- /// The application credentials for the bot.
- /// Connector client instance.
+ /**
+ * Creates the connector client.
+ * @param serviceUrl The service URL.
+ * @param appCredentials The application credentials for the bot.
+ * @return Connector client instance.
+ */
private ConnectorClient CreateConnectorClient(String serviceUrl) throws MalformedURLException, URISyntaxException {
return CreateConnectorClient(serviceUrl, null);
}
@@ -749,12 +750,12 @@ public class BotFrameworkAdapter extends BotAdapter {
}
- ///
- /// Gets the application credentials. App Credentials are cached so as to ensure we are not refreshing
- /// token everytime.
- ///
- /// The application identifier (AAD Id for the bot).
- /// App credentials.
+ /**
+ * Gets the application credentials. App Credentials are cached so as to ensure we are not refreshing
+ * token everytime.
+ * @param appId The application identifier (AAD Id for the bot).
+ * @return App credentials.
+ */
private CompletableFuture GetAppCredentialsAsync(String appId) {
CompletableFuture result = CompletableFuture.supplyAsync(() -> {
if (appId == null) {
diff --git a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/BotState.java b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/BotState.java
index ba3a66e4..fdcac760 100644
--- a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/BotState.java
+++ b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/BotState.java
@@ -15,11 +15,11 @@ import java.util.stream.StreamSupport;
import static com.ea.async.Async.await;
import static java.util.concurrent.CompletableFuture.completedFuture;
-///
-/// Abstract Base class which manages details of automatic loading and saving of bot state.
-///
-/// The type of the bot state object.
-//public class BotState : IMiddleware
+/**
+ * Abstract Base class which manages details of automatic loading and saving of bot state.
+ * @param TState The type of the bot state object.
+ */
+//public class BotState : Middleware
// where TState : class, new()
public class BotState implements Middleware
{
@@ -30,12 +30,12 @@ public class BotState implements Middleware
private final String propertyName;
private final Supplier extends TState> ctor;
- ///
- /// Creates a new middleware object.
- ///
- /// The name to use to load or save the state object.
- /// The storage provider to use.
- /// The state persistance options to use.
+ /**
+ * Creates a new {@link BotState{TState}} middleware object.
+ * @param name The name to use to load or save the state object.
+ * @param storage The storage provider to use.
+ * @param settings The state persistance options to use.
+ */
public BotState(Storage storage, String propertyName, Function keyDelegate, Supplier extends TState> ctor) {
this(storage, propertyName, keyDelegate, ctor, null);
}
@@ -63,15 +63,15 @@ public class BotState implements Middleware
}
- ///
- /// Processess an incoming activity.
- ///
- /// The context object for this turn.
- /// The delegate to call to continue the bot middleware pipeline.
- /// A task that represents the work queued to execute.
- /// This middleware loads the state object on the leading edge of the middleware pipeline
- /// and persists the state object on the trailing edge.
- ///
+ /**
+ * Processess an incoming activity.
+ * @param context The context object for this turn.
+ * @param next The delegate to call to continue the bot middleware pipeline.
+ * @return A task that represents the work queued to execute.
+ * This middleware loads the state object on the leading edge of the middleware pipeline
+ * and persists the state object on the trailing edge.
+ *
+ */
public CompletableFuture OnTurn(TurnContext context, NextDelegate next) throws Exception {
await(ReadToContextService(context));
await(next.next());
@@ -116,11 +116,11 @@ public class BotState implements Middleware
return completedFuture(await(Write(context, state)));
}
- ///
- /// Reads state from storage.
- ///
- /// The type of the bot state object.
- /// The context object for this turn.
+ /**
+ * Reads state from storage.
+ * @param TState The type of the bot state object.
+ * @param context The context object for this turn.
+ */
public CompletableFuture Read(TurnContext context) throws JsonProcessingException {
String key = this.keyDelegate.apply(context);
Map items = await( storage.Read(new String[] { key }));
@@ -136,11 +136,11 @@ public class BotState implements Middleware
return completedFuture(state);
}
- ///
- /// Writes state to storage.
- ///
- /// The context object for this turn.
- /// The state object.
+ /**
+ * Writes state to storage.
+ * @param context The context object for this turn.
+ * @param state The state object.
+ */
public CompletableFuture Write(TurnContext context, TState state) throws Exception {
HashMap changes = new HashMap();
//List> changes = new ArrayList>();
diff --git a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/CatchExceptionMiddleware.java b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/CatchExceptionMiddleware.java
index 863550f9..caca1803 100644
--- a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/CatchExceptionMiddleware.java
+++ b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/CatchExceptionMiddleware.java
@@ -7,17 +7,16 @@ import java.util.concurrent.CompletableFuture;
import static com.ea.async.Async.await;
import static java.util.concurrent.CompletableFuture.completedFuture;
-///
-/// This piece of middleware can be added to allow you to handle exceptions when they are thrown
-/// within your bot's code or middleware further down the pipeline. Using this handler you might
-/// send an appropriate message to the user to let them know that something has gone wrong.
-/// You can specify the type of exception the middleware should catch and this middleware can be added
-/// multiple times to allow you to handle different exception types in different ways.
-///
-///
-/// The type of the exception that you want to catch. This can be 'Exception' to
-/// catch all or a specific type of exception
-///
+/**
+ * This piece of middleware can be added to allow you to handle exceptions when they are thrown
+ * within your bot's code or middleware further down the pipeline. Using this handler you might
+ * send an appropriate message to the user to let them know that something has gone wrong.
+ * You can specify the type of exception the middleware should catch and this middleware can be added
+ * multiple times to allow you to handle different exception types in different ways.
+ * @param T
+ * The type of the exception that you want to catch. This can be 'Exception' to
+ * catch all or a specific type of exception
+ */
public class CatchExceptionMiddleware implements Middleware {
private final CallOnException _handler;
private final Class _exceptionType;
diff --git a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/ConversationState.java b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/ConversationState.java
index 2cebdf25..67234b10 100644
--- a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/ConversationState.java
+++ b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/ConversationState.java
@@ -4,15 +4,15 @@ import com.microsoft.bot.builder.TurnContext;
import java.util.function.Supplier;
-///
-/// Handles persistence of a conversation state object using the conversation ID as part of the key.
-///
-/// The type of the conversation state object.
+/**
+ * Handles persistence of a conversation state object using the conversation ID as part of the key.
+ * @param TState The type of the conversation state object.
+ */
public class ConversationState extends BotState
{
- ///
- /// The key to use to read and write this conversation state object to storage.
- ///
+ /**
+ * The key to use to read and write this conversation state object to storage.
+ */
//
// Note: Hard coded to maintain compatibility with C#
// "ConversationState:{typeof(ConversationState).Namespace}.{typeof(ConversationState).Name}"
@@ -20,11 +20,11 @@ public class ConversationState extends BotState
return String.format("ConversationState:Microsoft.Bot.Builder.Core.Extensions.ConversationState`1");
}
- ///
- /// Creates a new object.
- ///
- /// The storage provider to use.
- /// The state persistance options to use.
+ /**
+ * Creates a new {@link ConversationState{TState}} object.
+ * @param storage The storage provider to use.
+ * @param settings The state persistance options to use.
+ */
public ConversationState(Storage storage, Supplier extends TState> ctor) {
this(storage, null, ctor);
}
@@ -38,11 +38,11 @@ public class ConversationState extends BotState
settings);
}
- ///
- /// Gets the conversation state object from turn context.
- ///
- /// The context object for this turn.
- /// The coversation state object.
+ /**
+ * Gets the conversation state object from turn context.
+ * @param context The context object for this turn.
+ * @return The coversation state object.
+ */
public static TState Get(TurnContext context) throws IllegalArgumentException {
return context.getServices().Get(PropertyName());
}
diff --git a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/DeleteActivityHandler.java b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/DeleteActivityHandler.java
index 48064812..c55767b2 100644
--- a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/DeleteActivityHandler.java
+++ b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/DeleteActivityHandler.java
@@ -5,23 +5,23 @@ import com.microsoft.bot.schema.models.ConversationReference;
import java.util.concurrent.Callable;
import java.util.concurrent.CompletableFuture;
-///
-/// A method that can participate in delete activity events for the current turn.
-///
-/// The context object for the turn.
-/// The conversation containing the activity.
-/// The delegate to call to continue event processing.
-/// A task that represents the work queued to execute.
-/// A handler calls the delegate to pass control to
-/// the next registered handler. If a handler doesn’t call the next delegate,
-/// the adapter does not call any of the subsequent handlers and does not delete the
-///activity.
-/// The conversation reference's
-/// indicates the activity in the conversation to replace.
-///
-///
-///
-///
+/**
+ * A method that can participate in delete activity events for the current turn.
+ * @param context The context object for the turn.
+ * @param reference The conversation containing the activity.
+ * @param next The delegate to call to continue event processing.
+ * @return A task that represents the work queued to execute.
+ * A handler calls the {@code next} delegate to pass control to
+ * the next registered handler. If a handler doesn’t call the next delegate,
+ * the adapter does not call any of the subsequent handlers and does not delete the
+ *activity.
+ * The conversation reference's {@link ConversationReference.ActivityId}
+ * indicates the activity in the conversation to replace.
+ *
+ * {@linkalso BotAdapter}
+ * {@linkalso SendActivitiesHandler}
+ * {@linkalso UpdateActivityHandler}
+ */
@FunctionalInterface
public interface DeleteActivityHandler {
CompletableFuture handle(TurnContext context, ConversationReference reference, Callable next);
diff --git a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/InvokeResponse.java b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/InvokeResponse.java
index 4fbbf187..accec9cf 100644
--- a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/InvokeResponse.java
+++ b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/InvokeResponse.java
@@ -1,16 +1,16 @@
package com.microsoft.bot.builder;
-///
-/// Tuple class containing an HTTP Status Code and a JSON Serializable
-/// object. The HTTP Status code is, in the invoke activity scenario, what will
-/// be set in the resulting POST. The Body of the resulting POST will be
-/// the JSON Serialized content from the Body property.
-///
+/**
+ * Tuple class containing an HTTP Status Code and a JSON Serializable
+ * object. The HTTP Status code is, in the invoke activity scenario, what will
+ * be set in the resulting POST. The Body of the resulting POST will be
+ * the JSON Serialized content from the Body property.
+ */
public class InvokeResponse {
- ///
- /// The POST that is generated in response to the incoming Invoke Activity
- /// will have the HTTP Status code specificied by this field.
- ///
+ /**
+ * The POST that is generated in response to the incoming Invoke Activity
+ * will have the HTTP Status code specificied by this field.
+ */
private int _status;
public int getStatus() {
@@ -21,10 +21,10 @@ public class InvokeResponse {
this._status = status;
}
- ///
- /// The POST that is generated in response to the incoming Invoke Activity
- /// will have a body generated by JSON serializing the object in the Body field.
- ///
+ /**
+ * The POST that is generated in response to the incoming Invoke Activity
+ * will have a body generated by JSON serializing the object in the Body field.
+ */
private Object _body;
public Object getBody() {
diff --git a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/Middleware.java b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/Middleware.java
index ca401da7..34ec8483 100644
--- a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/Middleware.java
+++ b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/Middleware.java
@@ -4,54 +4,54 @@ package com.microsoft.bot.builder;
import java.util.concurrent.CompletableFuture;
-///
-/// Represents middleware that can operate on incoming activities.
-///
-/// A passes incoming activities from the user's
-/// channel to the middleware's
-/// method.
-/// You can add middleware objects to your adapter’s middleware collection. The
-/// adapter processes and directs incoming activities in through the bot middleware
-/// pipeline to your bot’s logic and then back out again. As each activity flows in
-/// and out of the bot, each piece of middleware can inspect or act upon the activity,
-/// both before and after the bot logic runs.
-/// For each activity, the adapter calls middleware in the order in which you
-/// added it.
-///
-///
-/// This defines middleware that sends "before" and "after" messages
-/// before and after the adapter calls the bot's
-/// method.
-///
-/// public class SampleMiddleware : IMiddleware
-/// {
-/// public async Task OnTurn(ITurnContext context, MiddlewareSet.NextDelegate next)
-/// {
-/// context.SendActivity("before");
-/// await next().ConfigureAwait(false);
-/// context.SendActivity("after");
-/// }
-/// }
-///
-///
-///
+/**
+ * Represents middleware that can operate on incoming activities.
+ * A {@link BotAdapter} passes incoming activities from the user's
+ * channel to the middleware's {@link OnTurn(TurnContext, NextDelegate)}
+ * method.
+ * You can add middleware objects to your adapter’s middleware collection. The
+ * adapter processes and directs incoming activities in through the bot middleware
+ * pipeline to your bot’s logic and then back out again. As each activity flows in
+ * and out of the bot, each piece of middleware can inspect or act upon the activity,
+ * both before and after the bot logic runs.
+ * For each activity, the adapter calls middleware in the order in which you
+ * added it.
+ *
+ *
+ * This defines middleware that sends "before" and "after" messages
+ * before and after the adapter calls the bot's
+ * {@link Bot.OnTurn(TurnContext)} method.
+ *
+ * public class SampleMiddleware : Middleware
+ * {
+ * public async Task OnTurn(TurnContext context, MiddlewareSet.NextDelegate next)
+ * {
+ * context.SendActivity("before");
+ * await next().ConfigureAwait(false);
+ * context.SendActivity("after");
+ * }
+ * }
+ *
+ *
+ * {@linkalso Bot}
+ */
public interface Middleware
{
- ///
- /// Processess an incoming activity.
- ///
- /// The context object for this turn.
- /// The delegate to call to continue the bot middleware pipeline.
- /// A task that represents the work queued to execute.
- /// Middleware calls the delegate to pass control to
- /// the next middleware in the pipeline. If middleware doesn’t call the next delegate,
- /// the adapter does not call any of the subsequent middleware’s request handlers or the
- /// bot’s receive handler, and the pipeline short circuits.
- /// The provides information about the
- /// incoming activity, and other data needed to process the activity.
- ///
- ///
- ///
+ /**
+ * Processess an incoming activity.
+ * @param context The context object for this turn.
+ * @param next The delegate to call to continue the bot middleware pipeline.
+ * @return A task that represents the work queued to execute.
+ * Middleware calls the {@code next} delegate to pass control to
+ * the next middleware in the pipeline. If middleware doesn’t call the next delegate,
+ * the adapter does not call any of the subsequent middleware’s request handlers or the
+ * bot’s receive handler, and the pipeline short circuits.
+ * The {@code context} provides information about the
+ * incoming activity, and other data needed to process the activity.
+ *
+ * {@linkalso TurnContext}
+ * {@linkalso Bot.Schema.Activity}
+ */
CompletableFuture OnTurn(TurnContext context, NextDelegate next) throws Exception;
}
diff --git a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/MiddlewareSet.java b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/MiddlewareSet.java
index 1c4940f2..35938d07 100644
--- a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/MiddlewareSet.java
+++ b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/MiddlewareSet.java
@@ -52,11 +52,11 @@ public class MiddlewareSet implements Middleware
return null;
}
- ///
- /// Intended to be called from Bot, this method performs exactly the same as the
- /// standard ReceiveActivity, except that it runs a user-defined delegate returns
- /// if all Middleware in the receive pipeline was run.
- ///
+ /**
+ * Intended to be called from Bot, this method performs exactly the same as the
+ * standard ReceiveActivity, except that it runs a user-defined delegate returns
+ * if all Middleware in the receive pipeline was run.
+ */
public CompletableFuture ReceiveActivityWithStatus(TurnContext context, Function callback)
throws Exception {
return ReceiveActivityInternal(context, callback);
diff --git a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/SendActivitiesHandler.java b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/SendActivitiesHandler.java
index f146f0d8..133f9e1f 100644
--- a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/SendActivitiesHandler.java
+++ b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/SendActivitiesHandler.java
@@ -12,4 +12,4 @@ import java.util.concurrent.CompletableFuture;
public interface SendActivitiesHandler {
CompletableFuture handle(TurnContext context, List activities, Callable> next);
}
-// public delegate CompletableFuture SendActivitiesHandler(ITurnContext context, List activities, Func> next);
+// public delegate CompletableFuture SendActivitiesHandler(TurnContext context, List activities, Func> next);
diff --git a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/StateTurnContextExtensions.java b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/StateTurnContextExtensions.java
index b7827d1f..7d49fe56 100644
--- a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/StateTurnContextExtensions.java
+++ b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/StateTurnContextExtensions.java
@@ -4,28 +4,28 @@ import com.microsoft.bot.builder.ConversationState;
import com.microsoft.bot.builder.TurnContext;
import com.microsoft.bot.builder.UserState;
-///
-/// Provides helper methods for getting state objects from the turn context.
-///
+/**
+ * Provides helper methods for getting state objects from the turn context.
+ */
public class StateTurnContextExtensions
{
- ///
- /// Gets a conversation state object from the turn context.
- ///
- /// The type of the state object to get.
- /// The context object for this turn.
- /// The state object.
+ /**
+ * Gets a conversation state object from the turn context.
+ * @param TState The type of the state object to get.
+ * @param context The context object for this turn.
+ * @return The state object.
+ */
public static TState GetConversationState(TurnContext context) throws IllegalArgumentException {
return ConversationState.Get(context);
}
- ///
- /// Gets a user state object from the turn context.
- ///
- /// The type of the state object to get.
- /// The context object for this turn.
- /// The state object.
+ /**
+ * Gets a user state object from the turn context.
+ * @param TState The type of the state object to get.
+ * @param context The context object for this turn.
+ * @return The state object.
+ */
public static TState GetUserState(TurnContext context) throws IllegalArgumentException {
return UserState.Get(context);
}
diff --git a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/Storage.java b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/Storage.java
index c96b6724..c1b8df39 100644
--- a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/Storage.java
+++ b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/Storage.java
@@ -11,23 +11,23 @@ import java.util.concurrent.CompletableFuture;
public interface Storage
{
- ///
- /// Read StoreItems from storage
- ///
- /// keys of the storeItems to read
- /// StoreItem dictionary
+ /**
+ * Read StoreItems from storage
+ * @param keys keys of the storeItems to read
+ * @return StoreItem dictionary
+ */
CompletableFuture