0.5.7-SNAPSHOT
- 2.2.6
+ 2.2.7
2.7.15
UTF-8
UTF-8
diff --git a/sofa-serverless-runtime/sofa-serverless-common/src/main/java/com/alipay/sofa/serverless/common/util/MultiBizProperties.java b/sofa-serverless-runtime/sofa-serverless-common/src/main/java/com/alipay/sofa/serverless/common/util/MultiBizProperties.java
new file mode 100644
index 000000000..3b91211ef
--- /dev/null
+++ b/sofa-serverless-runtime/sofa-serverless-common/src/main/java/com/alipay/sofa/serverless/common/util/MultiBizProperties.java
@@ -0,0 +1,450 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.alipay.sofa.serverless.common.util;
+
+import java.io.*;
+import java.util.*;
+import java.util.function.BiConsumer;
+import java.util.function.BiFunction;
+import java.util.function.Function;
+
+/**
+ * Support multi-business Properties
+ * Isolating configuration separation between different business modules
+ * The default value of the configuration of the base application is used
+ *
+ * If you want to use, you need to write the code in you base application
+ *
+ *
+ * MultiBizProperties.initSystem();
+ *
+ */
+public class MultiBizProperties extends Properties {
+
+ private final String bizClassLoaderName;
+
+ private static final String BIZ_CLASS_LOADER = "com.alipay.sofa.ark.container.service.classloader.BizClassLoader";
+
+ private Map> modifiedKeysMap = new HashMap<>();
+
+ private final Properties baseProperties;
+ private Map bizPropertiesMap;
+
+ private MultiBizProperties(String bizClassLoaderName, Properties baseProperties) {
+ this.bizPropertiesMap = new HashMap<>();
+ this.baseProperties = baseProperties;
+ this.bizClassLoaderName = bizClassLoaderName;
+ }
+
+ public MultiBizProperties(String bizClassLoaderName) {
+ this(bizClassLoaderName, new Properties());
+ }
+
+ public synchronized Object setProperty(String key, String value) {
+ addModifiedKey(key);
+ return getWriteProperties().setProperty(key, value);
+ }
+
+ @Override
+ public String getProperty(String key) {
+ return getReadProperties().getProperty(key);
+ }
+
+ @Override
+ public String getProperty(String key, String defaultValue) {
+ return getReadProperties().getProperty(key, defaultValue);
+ }
+
+ @Override
+ public synchronized void load(Reader reader) throws IOException {
+ Properties properties = new Properties();
+ properties.load(reader);
+ getWriteProperties().putAll(properties);
+ addModifiedKeys(properties.stringPropertyNames());
+ }
+
+ @Override
+ public synchronized void load(InputStream inStream) throws IOException {
+ Properties properties = new Properties();
+ properties.load(inStream);
+ getWriteProperties().putAll(properties);
+ addModifiedKeys(properties.stringPropertyNames());
+ }
+
+ @Override
+ public void list(PrintStream out) {
+ getWriteProperties().list(out);
+ }
+
+ @Override
+ public void list(PrintWriter out) {
+ getWriteProperties().list(out);
+ }
+
+ @Override
+ public void save(OutputStream out, String comments) {
+ Properties properties = getWriteProperties();
+ properties.save(out, comments);
+ }
+
+ @Override
+ public void store(Writer writer, String comments) throws IOException {
+ Properties properties = getReadProperties();
+ properties.store(writer, comments);
+ }
+
+ @Override
+ public void store(OutputStream out, String comments) throws IOException {
+ Properties properties = getReadProperties();
+ properties.store(out, comments);
+ }
+
+ @Override
+ public synchronized void loadFromXML(InputStream in) throws IOException {
+ Properties properties = new Properties();
+ properties.loadFromXML(in);
+ getWriteProperties().putAll(properties);
+ addModifiedKeys(properties.stringPropertyNames());
+ }
+
+ @Override
+ public void storeToXML(OutputStream os, String comment) throws IOException {
+ Properties properties = getReadProperties();
+ properties.storeToXML(os, comment);
+ }
+
+ @Override
+ public void storeToXML(OutputStream os, String comment, String encoding) throws IOException {
+ Properties properties = getReadProperties();
+ properties.storeToXML(os, comment, encoding);
+ }
+
+ @Override
+ public Enumeration> propertyNames() {
+ return getReadProperties().propertyNames();
+ }
+
+ @Override
+ public Set stringPropertyNames() {
+ return getReadProperties().stringPropertyNames();
+ }
+
+ @Override
+ public synchronized boolean remove(Object key, Object value) {
+ boolean success = getWriteProperties().remove(key, value);
+ if (success) {
+ addModifiedKey(key.toString());
+ }
+ return success;
+ }
+
+ @Override
+ public synchronized Object get(Object key) {
+ return getReadProperties().get(key);
+ }
+
+ @Override
+ public synchronized Object remove(Object key) {
+ if (key != null) {
+ addModifiedKey(key.toString());
+ }
+ return getWriteProperties().remove(key);
+ }
+
+ @Override
+ public synchronized Object put(Object key, Object value) {
+ String text = key == null ? null : key.toString();
+ addModifiedKey(text);
+ return getWriteProperties().put(key, value);
+ }
+
+ @Override
+ public synchronized boolean equals(Object o) {
+ return getReadProperties().equals(o);
+ }
+
+ @Override
+ public synchronized String toString() {
+ return getReadProperties().toString();
+ }
+
+ @Override
+ public Collection