|
|
|
@ -4,6 +4,7 @@ import com.fanruan.config.impl.data.ConnectionConfigProvider;
|
|
|
|
|
import com.fanruan.config.impl.data.ConnectionConfigWriter; |
|
|
|
|
import com.fr.data.impl.Connection; |
|
|
|
|
import com.fr.file.ConnectionConfig; |
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
import com.fr.transaction.Configurations; |
|
|
|
|
import com.fr.transaction.WorkerAdaptor; |
|
|
|
|
import org.jetbrains.annotations.NotNull; |
|
|
|
@ -141,6 +142,23 @@ public class ConnectionConfigWrapper implements ConnectionConfigProvider, Connec
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean updateConnection(String oldName, String connName, Connection connection) { |
|
|
|
|
try { |
|
|
|
|
Configurations.update(new WorkerAdaptor(ConnectionConfig.class) { |
|
|
|
|
@Override |
|
|
|
|
public void run() { |
|
|
|
|
ConnectionConfig.getInstance().removeConnection(oldName); |
|
|
|
|
ConnectionConfig.getInstance().addConnection(connName, connection); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
return true; |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
FineLoggerFactory.getLogger().error("update old connection fail , old name is {} , new name is {}", oldName, connection); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean isPutPermitted() { |
|
|
|
|
return ConnectionConfig.getInstance().isPutPermitted(); |
|
|
|
|