Skip to content

Commit ce6109b

Browse files
committed
split SqlServerService to Task.
1 parent e073893 commit ce6109b

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/toolkit/intellij/sqlserver/CreateSqlServerAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
import com.microsoft.azure.toolkit.lib.common.operation.AzureOperation;
1313
import com.microsoft.azure.toolkit.lib.common.task.AzureTask;
1414
import com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager;
15+
import com.microsoft.azure.toolkit.intellij.sqlserver.task.CreateSqlServerTask;
1516
import com.microsoft.azure.toolkit.lib.sqlserver.SqlServerConfig;
16-
import com.microsoft.azure.toolkit.lib.sqlserver.SqlServerService;
1717
import com.microsoft.azure.toolkit.lib.sqlserver.service.ISqlServer;
1818
import com.microsoft.azuretools.authmanage.AuthMethodManager;
1919
import com.microsoft.azuretools.utils.AzureUIRefreshCore;
@@ -74,7 +74,7 @@ private void createSqlServer(final SqlServerConfig config, SqlServerCreationDial
7474
final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
7575
indicator.setIndeterminate(true);
7676
DefaultLoader.getIdeHelper().invokeLater(dialog::close);
77-
ISqlServer server = SqlServerService.getInstance().create(config);
77+
ISqlServer server = new CreateSqlServerTask(config).execute();
7878
refreshAzureExplorer(server);
7979
};
8080
String progressMessage = Node.getProgressMessage(AzureActionEnum.CREATE.getDoingName(), SqlServerModule.MODULE_NAME, config.getServerName());

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/toolkit/lib/sqlserver/SqlServerService.java renamed to PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/toolkit/intellij/sqlserver/task/CreateSqlServerTask.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*/
55

6-
package com.microsoft.azure.toolkit.lib.sqlserver;
6+
package com.microsoft.azure.toolkit.intellij.sqlserver.task;
77

88
import com.microsoft.azure.management.Azure;
99
import com.microsoft.azure.management.resources.ResourceGroup;
1010
import com.microsoft.azure.toolkit.intellij.common.Draft;
1111
import com.microsoft.azure.toolkit.lib.common.model.Region;
1212
import com.microsoft.azure.toolkit.lib.common.operation.AzureOperation;
13-
import com.microsoft.azure.toolkit.lib.sqlserver.model.SqlFirewallRuleEntity;
13+
import com.microsoft.azure.toolkit.lib.sqlserver.SqlServerConfig;
1414
import com.microsoft.azure.toolkit.lib.sqlserver.model.SqlServerEntity;
1515
import com.microsoft.azure.toolkit.lib.sqlserver.service.AzureSqlServer;
1616
import com.microsoft.azure.toolkit.lib.sqlserver.service.ISqlServer;
@@ -25,11 +25,12 @@
2525

2626
import java.util.Collections;
2727

28-
public class SqlServerService {
29-
private static final SqlServerService instance = new SqlServerService();
28+
public class CreateSqlServerTask {
3029

31-
public static SqlServerService getInstance() {
32-
return SqlServerService.instance;
30+
private final SqlServerConfig config;
31+
32+
public CreateSqlServerTask(SqlServerConfig config) {
33+
this.config = config;
3334
}
3435

3536
@AzureOperation(
@@ -40,7 +41,7 @@ public static SqlServerService getInstance() {
4041
},
4142
type = AzureOperation.Type.SERVICE
4243
)
43-
public ISqlServer create(final SqlServerConfig config) {
44+
public ISqlServer execute() {
4445
final Operation operation = TelemetryManager.createOperation(ActionConstants.MySQL.CREATE);
4546
try {
4647
operation.start();

0 commit comments

Comments
 (0)