diff --git a/examples/java-matter-controller/BUILD.gn b/examples/java-matter-controller/BUILD.gn index ef80aec3e765c6..2eb8a691156f17 100644 --- a/examples/java-matter-controller/BUILD.gn +++ b/examples/java-matter-controller/BUILD.gn @@ -29,7 +29,20 @@ android_binary("java-matter-controller") { "${chip_root}/third_party/java_deps:annotation", ] - sources = [ "java/src/com/matter/controller/Main.java" ] + sources = [ + "java/src/com/matter/controller/Main.java", + "java/src/com/matter/controller/Off.java", + "java/src/com/matter/controller/On.java", + "java/src/com/matter/controller/commands/common/Argument.java", + "java/src/com/matter/controller/commands/common/ArgumentType.java", + "java/src/com/matter/controller/commands/common/Command.java", + "java/src/com/matter/controller/commands/common/CredentialsIssuer.java", + "java/src/com/matter/controller/commands/common/IPAddress.java", + "java/src/com/matter/controller/commands/common/MatterCommand.java", + "java/src/com/matter/controller/config/PersistentStorage.java", + "java/src/com/matter/controller/config/PersistentStorageOpCertStore.java", + "java/src/com/matter/controller/config/PersistentStorageOperationalKeystore.java", + ] javac_flags = [ "-Xlint:deprecation" ] } diff --git a/examples/java-matter-controller/java/src/com/matter/controller/Main.java b/examples/java-matter-controller/java/src/com/matter/controller/Main.java index 02ae2c00485918..f27e4463a6d20f 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/Main.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/Main.java @@ -15,12 +15,75 @@ * limitations under the License. * */ + package com.matter.controller; import chip.devicecontroller.ChipDeviceController; import chip.devicecontroller.ControllerParams; +import com.matter.controller.commands.common.Command; +import com.matter.controller.commands.common.CredentialsIssuer; +import java.util.Arrays; public class Main { + private static void ShowUsage(Command[] commands) { + StringBuffer arguments = new StringBuffer(); + StringBuffer attributes = new StringBuffer(); + + for (Command command : commands) { + arguments.append(" "); + arguments.append(command.getName()); + + int argumentsCount = command.getArgumentsCount(); + for (int j = 0; j < argumentsCount; j++) { + arguments.append(" "); + arguments.append(command.getArgumentName(j)); + } + + arguments.append("\n"); + + if ("read".equals(command.getName()) && command.getAttribute().isPresent()) { + attributes.append(" " + command.getAttribute().get() + "\n"); + } + } + + System.out.println( + String.format( + "Usage: \n" + + " java_matter_controller command [params]\n\n" + + " Supported commands and their parameters:\n%s\n" + + " Supported attribute names for the 'read' command:\n%s", + arguments, attributes)); + } + + private static void runCommand(CredentialsIssuer credIssuerCmds, String[] args) { + + // TODO::Start list of available commands, this hard coded list need to be replaced by command + // registration mechanism. + Command[] commands = {new On(credIssuerCmds), new Off(credIssuerCmds)}; + // End list of available commands + + if (args.length == 0) { + ShowUsage(commands); + return; + } + + for (Command cmd : commands) { + if (cmd.getName().equals(args[0])) { + String[] temp = Arrays.copyOfRange(args, 1, args.length); + + try { + cmd.initArguments(args.length - 1, temp); + cmd.run(); + } catch (IllegalArgumentException e) { + System.out.println("Arguments init failed with exception: " + e.getMessage()); + } catch (Exception e) { + System.out.println("Run command failed with exception: " + e.getMessage()); + } + break; + } + } + } + public static void main(String[] args) { ChipDeviceController controller = new ChipDeviceController( @@ -28,10 +91,9 @@ public static void main(String[] args) { .setUdpListenPort(0) .setControllerVendorId(0xFFF1) .build()); - System.out.println("Hello Matter Controller!"); - for (String s : args) { - System.out.println(s); - } + CredentialsIssuer credentialsIssuer = new CredentialsIssuer(); + + runCommand(credentialsIssuer, args); } } diff --git a/examples/java-matter-controller/java/src/com/matter/controller/Off.java b/examples/java-matter-controller/java/src/com/matter/controller/Off.java new file mode 100644 index 00000000000000..2eceb657222f50 --- /dev/null +++ b/examples/java-matter-controller/java/src/com/matter/controller/Off.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.matter.controller; + +import com.matter.controller.commands.common.CredentialsIssuer; +import com.matter.controller.commands.common.MatterCommand; +import java.util.concurrent.atomic.AtomicLong; + +public final class Off extends MatterCommand { + private final AtomicLong mNodeId = new AtomicLong(); + private final AtomicLong mFabricId = new AtomicLong(); + + public Off(CredentialsIssuer credIssuerCmds) { + super("off", credIssuerCmds); + addArgument("nodeid", 0L, Long.MAX_VALUE, mNodeId, null); + addArgument("fabricid", 0L, Long.MAX_VALUE, mFabricId, null); + } + + @Override + protected final void runCommand() {} +} diff --git a/examples/java-matter-controller/java/src/com/matter/controller/On.java b/examples/java-matter-controller/java/src/com/matter/controller/On.java new file mode 100644 index 00000000000000..29fb65fbf97117 --- /dev/null +++ b/examples/java-matter-controller/java/src/com/matter/controller/On.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.matter.controller; + +import com.matter.controller.commands.common.CredentialsIssuer; +import com.matter.controller.commands.common.MatterCommand; +import java.util.concurrent.atomic.AtomicLong; + +public final class On extends MatterCommand { + private final AtomicLong mNodeId = new AtomicLong(); + private final AtomicLong mFabricId = new AtomicLong(); + + public On(CredentialsIssuer credIssuerCmds) { + super("on", credIssuerCmds); + addArgument("nodeid", 0, Long.MAX_VALUE, mNodeId, null); + addArgument("fabricid", 0, Long.MAX_VALUE, mFabricId, null); + } + + @Override + protected final void runCommand() {} +} diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/common/Argument.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/Argument.java new file mode 100644 index 00000000000000..8cc53d22f3bbd9 --- /dev/null +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/Argument.java @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.matter.controller.commands.common; + +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.Optional; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicLong; +import javax.annotation.Nullable; + +public final class Argument { + private final String mName; + private final ArgumentType mType; + private final long mMin; + private final long mMax; + private final Object mValue; + private final Optional mDesc; + + public Argument(String name, IPAddress value) { + this.mName = name; + this.mType = ArgumentType.ADDRESS; + this.mMin = 0; + this.mMax = 0; + this.mValue = value; + this.mDesc = Optional.empty(); + } + + public Argument(String name, StringBuffer value, @Nullable String desc) { + this.mName = name; + this.mType = ArgumentType.STRING; + this.mMin = 0; + this.mMax = 0; + this.mValue = value; + this.mDesc = Optional.ofNullable(desc); + } + + public Argument(String name, AtomicBoolean value, @Nullable String desc) { + this.mName = name; + this.mType = ArgumentType.BOOL; + this.mMin = 0; + this.mMax = 0; + this.mValue = value; + this.mDesc = Optional.ofNullable(desc); + } + + public Argument(String name, short min, short max, AtomicInteger value, @Nullable String desc) { + this.mName = name; + this.mType = ArgumentType.NUMBER_INT16; + this.mMin = min; + this.mMax = max; + this.mValue = value; + this.mDesc = Optional.ofNullable(desc); + } + + public Argument(String name, int min, int max, AtomicInteger value, @Nullable String desc) { + this.mName = name; + this.mType = ArgumentType.NUMBER_INT32; + this.mMin = min; + this.mMax = max; + this.mValue = value; + this.mDesc = Optional.ofNullable(desc); + } + + public Argument(String name, long min, long max, AtomicLong value, @Nullable String desc) { + this.mName = name; + this.mType = ArgumentType.NUMBER_INT64; + this.mMin = min; + this.mMax = max; + this.mValue = value; + this.mDesc = Optional.ofNullable(desc); + } + + public String getName() { + return mName; + } + + public ArgumentType getType() { + return mType; + } + + public Object getValue() { + return mValue; + } + + public Optional getDesc() { + return mDesc; + } + + public void setValue(String value) { + boolean isValidArgument = false; + + switch (mType) { + case ATTRIBUTE: + String str = (String) mValue; + isValidArgument = value.equals(str); + break; + case NUMBER_INT32: + AtomicInteger num = (AtomicInteger) mValue; + num.set(Integer.parseInt(value)); + isValidArgument = (num.intValue() >= mMin && num.intValue() <= mMax); + break; + case ADDRESS: + try { + IPAddress ipAddress = (IPAddress) mValue; + ipAddress.setAddress(InetAddress.getByName(value)); + } catch (UnknownHostException e) { + isValidArgument = true; + } + break; + } + + if (!isValidArgument) { + throw new IllegalArgumentException("Invalid argument " + mName + ": " + value); + } + } +} diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/common/ArgumentType.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/ArgumentType.java new file mode 100644 index 00000000000000..e3ecccc923d1dc --- /dev/null +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/ArgumentType.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.matter.controller.commands.common; + +public enum ArgumentType { + NUMBER_INT8, + NUMBER_INT16, + NUMBER_INT32, + NUMBER_INT64, + FLOAT, + DOUBLE, + BOOL, + STRING, + CHARSTRING, + OCTETSTRING, + ATTRIBUTE, + ADDRESS, + COMPLEX, + CUSTOM, + VECTOR_BOOL, + VECTOR16, + VECTOR32, + VECTOR_CUSTOM, +} diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/common/Command.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/Command.java new file mode 100644 index 00000000000000..13ed473f43285f --- /dev/null +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/Command.java @@ -0,0 +1,194 @@ +/* + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.matter.controller.commands.common; + +import java.util.ArrayList; +import java.util.Optional; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicLong; +import javax.annotation.Nullable; + +/** + * @brief Matter Controller command + * @details The base class of all the commands the Matter Controller supports, which are actions + * that may be performed. Commands are verb-like, such as pair a Matter device or discover + * Matter devices from the environment. + */ +public abstract class Command { + private final String mName; + private final ArrayList mArgs = new ArrayList(); + private final Optional mHelpText; + + public Command(String commandName) { + this.mName = commandName; + this.mHelpText = Optional.empty(); + } + + public Command(String commandName, @Nullable String helpText) { + this.mName = commandName; + this.mHelpText = Optional.ofNullable(helpText); + } + + public final String getName() { + return mName; + } + + public final Optional getHelpText() { + return mHelpText; + } + + /** + * @brief Get attribute argument if it exists, there is at most one Attribute argument per command + * @return A pointer to an Optional where the Attribute argument will be stored + */ + public final Optional getAttribute() { + return mArgs + .stream() + .filter(arg -> arg.getType() == ArgumentType.ATTRIBUTE) + .findFirst() + .map(arg -> (String) arg.getValue()); + } + + public final String getArgumentName(int index) { + return mArgs.get(index).getName(); + } + + public final int getArgumentsCount() { + return mArgs.size(); + } + + /** + * @brief Get argument description if it exists + * @return A pointer to an Optional where the argument description will be stored + */ + public final Optional getArgumentDescription(int index) { + return mArgs.get(index).getDesc(); + } + + /** + * @brief Add a bool command argument + * @param name The name that will be displayed in the command help + * @param out A pointer to a MutableInteger where the argv value will be stored + * @param desc The description of the argument that will be displayed in the command help + * @return The number of arguments currently added to the command + */ + public final int addArgument(String name, AtomicBoolean out, @Nullable String desc) { + Argument arg = new Argument(name, out, desc); + mArgs.add(arg); + return mArgs.size(); + } + + /** + * @brief Add a short command argument + * @param name The name that will be displayed in the command help + * @param min The minimum value of the argv value + * @param max The minimum value of the argv value + * @param out A pointer to a MutableInteger where the argv value will be stored + * @param desc The description of the argument that will be displayed in the command help + * @return The number of arguments currently added to the command + */ + public final int addArgument( + String name, short min, short max, AtomicInteger out, @Nullable String desc) { + Argument arg = new Argument(name, min, max, out, desc); + mArgs.add(arg); + return mArgs.size(); + } + + /** + * @brief Add an int command argument + * @param name The name that will be displayed in the command help + * @param min The minimum value of the argv value + * @param max The minimum value of the argv value + * @param out A pointer to a MutableInteger where the argv value will be stored + * @param desc The description of the argument that will be displayed in the command help + * @return The number of arguments currently added to the command + */ + public final int addArgument( + String name, int min, int max, AtomicInteger out, @Nullable String desc) { + Argument arg = new Argument(name, min, max, out, desc); + mArgs.add(arg); + return mArgs.size(); + } + + /** + * @brief Add a long Integer command argument + * @param name The name that will be displayed in the command help + * @param min The minimum value of the argv value + * @param max The minimum value of the argv value + * @param out A pointer to a MutableInteger where the argv value will be stored + * @param desc The description of the argument that will be displayed in the command help + * @return The number of arguments currently added to the command + */ + public final int addArgument( + String name, long min, long max, AtomicLong out, @Nullable String desc) { + Argument arg = new Argument(name, min, max, out, desc); + mArgs.add(arg); + return mArgs.size(); + } + + /** + * @brief Add an IP address command argument + * @param name The name that will be displayed in the command help + * @param out A pointer to a IPAddress where the argv value will be stored + * @return The number of arguments currently added to the command + */ + public final int addArgument(String name, IPAddress out) { + Argument arg = new Argument(name, out); + mArgs.add(arg); + return mArgs.size(); + } + + /** + * @brief Add a String command argument + * @param name The name that will be displayed in the command help + * @param out A pointer to a StringBuffer where the argv value will be stored + * @param desc The description of the argument that will be displayed in the command help + * @return The number of arguments currently added to the command + */ + public final int addArgument(String name, StringBuffer out, @Nullable String desc) { + Argument arg = new Argument(name, out, desc); + mArgs.add(arg); + return mArgs.size(); + } + + /** + * @brief Initialize command arguments + * @param argc The number of arguments to a command (Does not include command itself) + * @param args Supplied command-line arguments as an array of String objects. + */ + public final void initArguments(int argc, String[] args) { + int argsCount = mArgs.size(); + + if (argsCount != argc) { + throw new IllegalArgumentException( + "Wrong arguments number: " + argc + " instead of " + argsCount); + } + + for (int i = 0; i < argsCount; i++) { + initArgument(i, args[i]); + } + } + + public void initArgument(int argIndex, String argValue) { + mArgs.get(argIndex).setValue(argValue); + } + + public abstract void run() throws Exception; +} diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/common/CredentialsIssuer.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/CredentialsIssuer.java new file mode 100644 index 00000000000000..a77508ea35a1bf --- /dev/null +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/CredentialsIssuer.java @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.matter.controller.commands.common; + +/** + * @brief Credentials Issuer for the Command + * @details Contains all credential information of the issuer of the command, such as operational + * credentials for a given fabric, the DAC verifier of the commisioner, etc .. + */ +public class CredentialsIssuer {} diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/common/IPAddress.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/IPAddress.java new file mode 100644 index 00000000000000..814a9c7efbd429 --- /dev/null +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/IPAddress.java @@ -0,0 +1,20 @@ +package com.matter.controller.commands.common; + +import java.net.InetAddress; + +public final class IPAddress { + private InetAddress address; + + public IPAddress(InetAddress address) { + this.address = address; + } + + public void setAddress(InetAddress address) { + this.address = address; + } + + @Override + public String toString() { + return address.toString(); + } +} diff --git a/examples/java-matter-controller/java/src/com/matter/controller/commands/common/MatterCommand.java b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/MatterCommand.java new file mode 100644 index 00000000000000..8b0b068ba5c2a9 --- /dev/null +++ b/examples/java-matter-controller/java/src/com/matter/controller/commands/common/MatterCommand.java @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.matter.controller.commands.common; + +import com.matter.controller.config.PersistentStorage; +import com.matter.controller.config.PersistentStorageOpCertStore; +import com.matter.controller.config.PersistentStorageOperationalKeystore; +import java.util.Optional; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicLong; + +public abstract class MatterCommand extends Command { + private final PersistentStorage mDefaultStorage = new PersistentStorage(); + private final PersistentStorage mCommissionerStorage = new PersistentStorage(); + private final PersistentStorageOperationalKeystore mOperationalKeystore = + new PersistentStorageOperationalKeystore(); + private final PersistentStorageOpCertStore mOpCertStore = new PersistentStorageOpCertStore(); + + private final Optional mCredIssuerCmds; + private final StringBuffer mCommissionerName = new StringBuffer(); + private final StringBuffer mPaaTrustStorePath = new StringBuffer(); + private final StringBuffer mCDTrustStorePath = new StringBuffer(); + private final AtomicLong mCommissionerNodeId = new AtomicLong(); + private final AtomicBoolean mUseMaxSizedCerts = new AtomicBoolean();; + private final AtomicBoolean mOnlyAllowTrustedCdKeys = new AtomicBoolean();; + + public MatterCommand(String commandName, CredentialsIssuer credIssuerCmds) { + this(commandName, credIssuerCmds, null); + } + + public MatterCommand(String commandName, CredentialsIssuer credIssuerCmds, String helpText) { + super(commandName, helpText); + this.mCredIssuerCmds = Optional.ofNullable(credIssuerCmds); + + addArgument( + "paa-trust-store-path", + mPaaTrustStorePath, + "Path to directory holding PAA certificate information. Can be absolute or relative to the current working " + + "directory."); + addArgument( + "cd-trust-store-path", + mCDTrustStorePath, + "Path to directory holding CD certificate information. Can be absolute or relative to the current working " + + "directory."); + addArgument( + "commissioner-name", + mCommissionerName, + "Name of fabric to use. Valid values are \"alpha\", \"beta\", \"gamma\", and integers greater than or equal to " + + "4. The default if not specified is \"alpha\"."); + addArgument( + "commissioner-nodeid", + 0, + Long.MAX_VALUE, + mCommissionerNodeId, + "The node id to use for chip-tool. If not provided, kTestControllerNodeId (112233, 0x1B669) will be used."); + addArgument( + "use-max-sized-certs", + mUseMaxSizedCerts, + "Maximize the size of operational certificates. If not provided or 0 (\"false\"), normally sized operational " + + "certificates are generated."); + addArgument( + "only-allow-trusted-cd-keys", + mOnlyAllowTrustedCdKeys, + "Only allow trusted CD verifying keys (disallow test keys). If not provided or 0 (\"false\"), untrusted CD " + + "verifying keys are allowed. If 1 (\"true\"), test keys are disallowed."); + } + + /////////// Command Interface ///////// + @Override + public void run() throws Exception { + maybeSetUpStack(); + runCommand(); + maybeTearDownStack(); + } + + protected abstract void runCommand(); + + private void maybeSetUpStack() throws Exception { + mDefaultStorage.init(); + mOperationalKeystore.init(mDefaultStorage); + mOpCertStore.init(mDefaultStorage); + } + + private void maybeTearDownStack() { + // ToDo:We need to call DeviceController::Shutdown() + } +} diff --git a/examples/java-matter-controller/java/src/com/matter/controller/config/PersistentStorage.java b/examples/java-matter-controller/java/src/com/matter/controller/config/PersistentStorage.java new file mode 100644 index 00000000000000..eea19943ddf83c --- /dev/null +++ b/examples/java-matter-controller/java/src/com/matter/controller/config/PersistentStorage.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.matter.controller.config; + +public class PersistentStorage { + public void init() throws Exception { + throw new Exception("Failed to initialize PersistentStorage"); + } +} diff --git a/examples/java-matter-controller/java/src/com/matter/controller/config/PersistentStorageOpCertStore.java b/examples/java-matter-controller/java/src/com/matter/controller/config/PersistentStorageOpCertStore.java new file mode 100644 index 00000000000000..04b5617e799c39 --- /dev/null +++ b/examples/java-matter-controller/java/src/com/matter/controller/config/PersistentStorageOpCertStore.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.matter.controller.config; + +public class PersistentStorageOpCertStore { + public int init(PersistentStorage storage) throws Exception { + throw new Exception("Failed to initialize PersistentStorageOpCertStore"); + } +} diff --git a/examples/java-matter-controller/java/src/com/matter/controller/config/PersistentStorageOperationalKeystore.java b/examples/java-matter-controller/java/src/com/matter/controller/config/PersistentStorageOperationalKeystore.java new file mode 100644 index 00000000000000..819a129af27448 --- /dev/null +++ b/examples/java-matter-controller/java/src/com/matter/controller/config/PersistentStorageOperationalKeystore.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.matter.controller.config; + +public class PersistentStorageOperationalKeystore { + public int init(PersistentStorage storage) throws Exception { + throw new Exception("Failed to initialize PersistentStorageOperationalKeystore"); + } +}