Skip to content

Commit

Permalink
Improve catalog creation methods name
Browse files Browse the repository at this point in the history
  • Loading branch information
kokosing committed Sep 30, 2019
1 parent b78775d commit 00cc4a3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,15 @@ public synchronized void addConnectorFactory(ConnectorFactory connectorFactory)
handleResolver.addConnectorName(connectorFactory.getName(), connectorFactory.getHandleResolver());
}

public synchronized CatalogName createConnection(String catalogName, String connectorName, Map<String, String> properties)
public synchronized CatalogName createCatalog(String catalogName, String connectorName, Map<String, String> properties)
{
requireNonNull(connectorName, "connectorName is null");
ConnectorFactory connectorFactory = connectorFactories.get(connectorName);
checkArgument(connectorFactory != null, "No factory for connector '%s'. Available factories: %s", connectorName, connectorFactories.keySet());
return createConnection(catalogName, connectorFactory, properties);
return createCatalog(catalogName, connectorFactory, properties);
}

private synchronized CatalogName createConnection(String catalogName, ConnectorFactory connectorFactory, Map<String, String> properties)
private synchronized CatalogName createCatalog(String catalogName, ConnectorFactory connectorFactory, Map<String, String> properties)
{
checkState(!stopped.get(), "ConnectorManager is stopped");
requireNonNull(catalogName, "catalogName is null");
Expand All @@ -187,12 +187,12 @@ private synchronized CatalogName createConnection(String catalogName, ConnectorF
CatalogName catalog = new CatalogName(catalogName);
checkState(!connectors.containsKey(catalog), "Catalog '%s' already exists", catalog);

addCatalogConnector(catalog, connectorFactory, properties);
createCatalog(catalog, connectorFactory, properties);

return catalog;
}

private synchronized void addCatalogConnector(CatalogName catalogName, ConnectorFactory factory, Map<String, String> properties)
private synchronized void createCatalog(CatalogName catalogName, ConnectorFactory factory, Map<String, String> properties)
{
// create all connectors before adding, so a broken connector does not leave the system half updated
MaterializedConnector connector = new MaterializedConnector(catalogName, createConnector(catalogName, factory, properties));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private static class SystemConnectorRegistrar
public SystemConnectorRegistrar(ConnectorManager manager, GlobalSystemConnectorFactory globalSystemConnectorFactory)
{
manager.addConnectorFactory(globalSystemConnectorFactory);
manager.createConnection(GlobalSystemConnector.NAME, GlobalSystemConnector.NAME, ImmutableMap.of());
manager.createCatalog(GlobalSystemConnector.NAME, GlobalSystemConnector.NAME, ImmutableMap.of());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private void loadCatalog(File file)
String connectorName = properties.remove("connector.name");
checkState(connectorName != null, "Catalog configuration %s does not contain connector.name", file.getAbsoluteFile());

connectorManager.createConnection(catalogName, connectorName, ImmutableMap.copyOf(properties));
connectorManager.createCatalog(catalogName, connectorName, ImmutableMap.copyOf(properties));
log.info("-- Added catalog %s using connector %s --", catalogName, connectorName);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ public CatalogName createCatalog(String catalogName, String connectorName)

public CatalogName createCatalog(String catalogName, String connectorName, Map<String, String> properties)
{
CatalogName catalog = connectorManager.createConnection(catalogName, connectorName, properties);
CatalogName catalog = connectorManager.createCatalog(catalogName, connectorName, properties);
updateConnectorIdAnnouncement(announcer, catalog, nodeManager);
return catalog;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ private LocalQueryRunner(Session defaultSession, FeaturesConfig featuresConfig,
new SessionPropertyDefaults(nodeInfo));

connectorManager.addConnectorFactory(globalSystemConnectorFactory);
connectorManager.createConnection(GlobalSystemConnector.NAME, GlobalSystemConnector.NAME, ImmutableMap.of());
connectorManager.createCatalog(GlobalSystemConnector.NAME, GlobalSystemConnector.NAME, ImmutableMap.of());

// add bogus connector for testing session properties
catalogManager.registerCatalog(createBogusTestingCatalog(TESTING_CATALOG));
Expand Down Expand Up @@ -529,7 +529,7 @@ public void createCatalog(String catalogName, ConnectorFactory connectorFactory,
{
nodeManager.addCurrentNodeConnector(new CatalogName(catalogName));
connectorManager.addConnectorFactory(connectorFactory);
connectorManager.createConnection(catalogName, connectorFactory.getName(), properties);
connectorManager.createCatalog(catalogName, connectorFactory.getName(), properties);
}

@Override
Expand Down

0 comments on commit 00cc4a3

Please sign in to comment.