Skip to content

Commit 68798f3

Browse files
committed
Added or improved Javadoc
1 parent dfe8030 commit 68798f3

File tree

21 files changed

+90
-3
lines changed

21 files changed

+90
-3
lines changed

core/core-mcp/src/main/java/ai/wanaku/core/mcp/common/resolvers/Resolver.java

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919

2020
import java.io.File;
2121

22+
/**
23+
* A resolver that consumes MCP requests and resolves what type of tool or resource acquirer
24+
* should handle it
25+
*/
2226
public interface Resolver {
2327
String DEFAULT_RESOURCES_INDEX_FILE_NAME = "resources.json";
2428
String DEFAULT_TOOLS_INDEX_FILE_NAME = "tools.json";

core/core-mcp/src/main/java/ai/wanaku/core/mcp/common/resolvers/ResourceResolver.java

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
import ai.wanaku.api.types.ResourceReference;
2626
import io.quarkiverse.mcp.server.ResourceManager;
2727

28+
/**
29+
* A resolver that consumes MCP requests and resolves what type of resource acquirer
30+
* should handle it
31+
*/
2832
public interface ResourceResolver extends Resolver {
2933

3034

core/core-mcp/src/main/java/ai/wanaku/core/mcp/common/resolvers/ToolsResolver.java

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
import ai.wanaku.api.types.ToolReference;
2525
import ai.wanaku.core.mcp.common.Tool;
2626

27+
/**
28+
* A resolver that consumes MCP requests and resolves what type of tool
29+
* should handle it
30+
*/
2731
public interface ToolsResolver extends Resolver {
2832

2933
/**

core/core-services/src/main/java/ai/wanaku/core/services/config/WanakuProviderConfig.java

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
import io.smallrye.config.ConfigMapping;
44
import io.smallrye.config.WithDefault;
55

6+
/**
7+
* Configuration class for providers
8+
*/
69
@ConfigMapping(prefix = "wanaku.service.provider")
710
public interface WanakuProviderConfig extends WanakuServiceConfig {
811

core/core-services/src/main/java/ai/wanaku/core/services/config/WanakuRoutingConfig.java

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
import io.smallrye.config.ConfigMapping;
44
import io.smallrye.config.WithDefault;
55

6+
/**
7+
* Configuration class for tool services
8+
*/
69
@ConfigMapping(prefix = "wanaku.service.routing")
710
public interface WanakuRoutingConfig extends WanakuServiceConfig {
811

core/core-services/src/main/java/ai/wanaku/core/services/config/WanakuServiceConfig.java

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
import ai.wanaku.core.config.WanakuConfig;
66
import io.smallrye.config.ConfigMapping;
77

8+
/**
9+
* Base configuration class for the downstream services
10+
*/
811
@ConfigMapping(prefix = "wanaku.service")
912
public interface WanakuServiceConfig extends WanakuConfig {
1013

core/core-services/src/main/java/ai/wanaku/core/services/provider/AbstractResourceDelegate.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public abstract class AbstractResourceDelegate implements ResourceAcquirerDelega
3636
* The parameters are already merged w/ the requested ones, but feel free to override or
3737
* add more if necessary.
3838
* @param request the request
39-
* @param parameters the merged (between config and defauts) request parameters
39+
* @param parameters the merged (between config and defaults) request parameters
4040
* @return the URI as a string
4141
*/
4242
protected abstract String getEndpointUri(ResourceRequest request, Map<String, String> parameters);
@@ -45,7 +45,8 @@ public abstract class AbstractResourceDelegate implements ResourceAcquirerDelega
4545
* Convert the response in whatever format it is to a String
4646
* @param response the response
4747
* @return the response as a String
48-
* @throws InvalidResponseTypeException if the response cannot be converted
48+
* @throws InvalidResponseTypeException if the response type is invalid (such as null)
49+
* @throws NonConvertableResponseException if the response cannot be converted
4950
*/
5051
protected abstract String coerceResponse(Object response)
5152
throws InvalidResponseTypeException, NonConvertableResponseException;

core/core-services/src/main/java/ai/wanaku/core/services/provider/DefaultResourceConsumer.java

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
import org.apache.camel.CamelContext;
66
import org.apache.camel.ConsumerTemplate;
77

8+
/**
9+
* A simple consumer of resources implemented on top of Camel's ConsumerTemplate
10+
*/
811
@ApplicationScoped
912
public class DefaultResourceConsumer implements ResourceConsumer {
1013
private final ConsumerTemplate consumer;
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
package ai.wanaku.core.services.provider;
22

3+
/**
4+
* Consumes a resource from a service providing it
5+
*/
36
public interface ResourceConsumer {
7+
/**
8+
* Consume the resource
9+
* @param uri The URI pointing to the service to consume
10+
* @return Whatever response was obtained by calling the server (it must be convertible to a String)
11+
*/
412
Object consume(String uri);
513
}

core/core-services/src/main/java/ai/wanaku/core/services/routing/Client.java

+9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
import ai.wanaku.api.exceptions.WanakuException;
44
import ai.wanaku.core.exchange.ToolInvokeRequest;
55

6+
/**
7+
* A client is responsible for exchanging data with a service
8+
*/
69
public interface Client {
10+
/**
11+
* Exchange data with a service
12+
* @param request The tool invocation request as received by the MCP router
13+
* @return Whatever response was obtained by calling the server (it must be convertible to a String)
14+
* @throws WanakuException if the operation cannot be executed
15+
*/
716
Object exchange(ToolInvokeRequest request) throws WanakuException;
817
}

core/core-services/src/main/java/ai/wanaku/core/services/util/URIHelper.java

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
import java.util.Map;
44

5+
/**
6+
* Utility class to build URIs
7+
*/
58
public class URIHelper {
69

710
private static String buildFromBaseUri(Map<String, String> parameters, StringBuilder uri) {

core/core-util/src/main/java/ai/wanaku/core/config/WanakuConfig.java

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
import io.smallrye.config.ConfigMapping;
44

5+
/**
6+
* Base configuration class
7+
*/
58
@ConfigMapping(prefix = "wanaku")
69
public interface WanakuConfig {
710
}

routers/wanaku-router/src/main/java/ai/wanaku/routers/AbstractProvider.java

+18
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
import ai.wanaku.core.mcp.common.resolvers.Resolver;
2525
import ai.wanaku.core.util.IndexHelper;
2626

27+
/**
28+
* Base provider class for tools and resources
29+
* @param <Y> The type of the resolver
30+
*/
2731
abstract class AbstractProvider<Y extends Resolver> {
2832
private static File createSettingsDirectory(String settingsDirectory) {
2933
File resourcesDir = new File(settingsDirectory);
@@ -34,6 +38,12 @@ private static File createSettingsDirectory(String settingsDirectory) {
3438
return resourcesDir;
3539
}
3640

41+
/**
42+
* Initializes the persisted index of resources
43+
* @param resourcesPath the path to the index file
44+
* @param fileName the name of the index file
45+
* @return the File object representing the initialized index of resources
46+
*/
3747
protected File initializeResourcesIndex(String resourcesPath, String fileName) {
3848
File settingsDirectory = createSettingsDirectory(resourcesPath);
3949
File indexFile = new File(settingsDirectory, fileName);
@@ -47,7 +57,15 @@ protected File initializeResourcesIndex(String resourcesPath, String fileName) {
4757
return indexFile;
4858
}
4959

60+
/**
61+
* Initializes the persisted index of resources
62+
* @return the File object representing the initialized index of resources
63+
*/
5064
abstract File initializeIndex();
5165

66+
/**
67+
* Gets the resolver associated with this provider
68+
* @return the resolver instance
69+
*/
5270
abstract Y getResolver();
5371
}

routers/wanaku-router/src/main/java/ai/wanaku/routers/ResourcesProvider.java

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030

3131
import static ai.wanaku.core.mcp.common.resolvers.Resolver.DEFAULT_RESOURCES_INDEX_FILE_NAME;
3232

33+
/**
34+
* A provider for resources resolvers
35+
*/
3336
@ApplicationScoped
3437
public class ResourcesProvider extends AbstractProvider<ResourceResolver> {
3538
@Inject

routers/wanaku-router/src/main/java/ai/wanaku/routers/ToolsProvider.java

+3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535

3636
import static ai.wanaku.core.mcp.common.resolvers.Resolver.DEFAULT_TOOLS_INDEX_FILE_NAME;
3737

38+
/**
39+
* A provider for tools resolvers
40+
*/
3841
@ApplicationScoped
3942
public class ToolsProvider extends AbstractProvider<ToolsResolver> {
4043
private static final Logger LOG = Logger.getLogger(ToolsProvider.class);

routers/wanaku-router/src/main/java/ai/wanaku/routers/WanakuRouterMain.java

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
import io.quarkus.runtime.annotations.QuarkusMain;
2525
import picocli.CommandLine;
2626

27+
/**
28+
* Main class for the router
29+
*/
2730
@QuarkusMain(name = "base")
2831
@CommandLine.Command(name = "camel", mixinStandardHelpOptions = true)
2932
public class WanakuRouterMain implements Runnable, QuarkusApplication {

routers/wanaku-router/src/main/java/ai/wanaku/routers/config/WanakuRouterConfig.java

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
import io.smallrye.config.ConfigMapping;
55
import io.smallrye.config.WithDefault;
66

7+
/**
8+
* Base configuration class for the router
9+
*/
710
@ConfigMapping(prefix = "wanaku.router")
811
public interface WanakuRouterConfig extends WanakuConfig {
912

routers/wanaku-router/src/main/java/ai/wanaku/routers/proxies/Proxy.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
public interface Proxy {
2626
/**
2727
* The name of the proxy
28-
* @return
28+
* @return the name of the proxy
2929
*/
3030
String name();
3131

routers/wanaku-router/src/main/java/ai/wanaku/routers/proxies/resources/ResourceAcquirerProxy.java

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
import io.quarkiverse.mcp.server.TextResourceContents;
3838
import org.jboss.logging.Logger;
3939

40+
/**
41+
* A proxy class for acquiring resources
42+
*/
4043
public class ResourceAcquirerProxy implements ResourceProxy {
4144
private static final Logger LOG = Logger.getLogger(ResourceAcquirerProxy.class);
4245

routers/wanaku-router/src/main/java/ai/wanaku/routers/proxies/tools/InvokerProxy.java

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
import io.quarkiverse.mcp.server.ToolResponse;
3838
import org.jboss.logging.Logger;
3939

40+
/**
41+
* A proxy class for invoking tools
42+
*/
4043
public class InvokerProxy implements ToolsProxy {
4144
private static final Logger LOG = Logger.getLogger(InvokerProxy.class);
4245

routers/wanaku-router/src/main/java/ai/wanaku/routers/resolvers/WanakuResourceResolver.java

+3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
import ai.wanaku.core.mcp.common.resolvers.ResourceResolver;
2929
import ai.wanaku.routers.proxies.ResourceProxy;
3030

31+
/**
32+
* Represents resolvers for Wanaku resources
33+
*/
3134
public class WanakuResourceResolver implements ResourceResolver {
3235
private static final Logger LOG = Logger.getLogger(WanakuResourceResolver.class);
3336
private final File indexFile;

0 commit comments

Comments
 (0)