awrb commented on code in PR #1677:
URL: https://github.com/apache/karaf/pull/1677#discussion_r1005817727


##########
cache/commands/src/main/java/org/apache/karaf/cache/core/commands/Create.java:
##########
@@ -0,0 +1,39 @@
+package org.apache.karaf.cache.core.commands;
+
+import org.apache.karaf.cache.api.CacheService;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+
+import javax.cache.configuration.Configuration;
+import javax.cache.configuration.MutableConfiguration;
+import javax.cache.expiry.CreatedExpiryPolicy;
+import javax.cache.expiry.Duration;
+
+@Service
+@Command(scope = "cache", name = "create", description = "")
+public class Create implements Action {
+
+    @Argument(index = 0, required = true)
+    String cacheName;
+    @Argument(index = 1, required = true)
+    String keyType;
+    @Argument(index = 2, required = true)
+    String valueType;
+    @Reference
+    private CacheService cacheService;
+
+    @Override
+    public Object execute() throws Exception {
+        Class keyClass = Class.forName(keyType);
+        Class valueClass = Class.forName(valueType);
+        Configuration<?, ?> configuration = new MutableConfiguration<>()

Review Comment:
   This is just hard-coded for now but I'll extend this (add arguments to 
specify the cache size, or the xml configuration path, probably make the 
key/value type resolution smarter, so something like `cache:create myCache long 
string <other args>` also works).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to