use of com.netflix.metacat.common.server.connectors.ConnectorFactory in project metacat by Netflix.
the class ConnectorManager method getConnectorFactory.
/**
* Returns the connector factory for the given <code>catalogName</code>.
*
* @param catalogName catalog name
* @return Returns the connector factory for the given <code>catalogName</code>
*/
private ConnectorFactory getConnectorFactory(final String catalogName) {
Preconditions.checkNotNull(catalogName, "catalogName is null");
final ConnectorFactory result = connectorFactories.get(catalogName);
if (result == null) {
throw new CatalogNotFoundException(catalogName);
}
return result;
}
use of com.netflix.metacat.common.server.connectors.ConnectorFactory in project metacat by Netflix.
the class ConnectorManager method createConnection.
/**
* Creates a connection for the given catalog.
*
* @param catalogName catalog name
* @param connectorType connector type
* @param properties properties
*/
synchronized void createConnection(final String catalogName, final String connectorType, final Map<String, String> properties, final Registry registry) {
Preconditions.checkState(!stopped.get(), "ConnectorManager is stopped");
Preconditions.checkNotNull(catalogName, "catalogName is null");
Preconditions.checkNotNull(connectorType, "connectorName is null");
Preconditions.checkNotNull(properties, "properties is null");
final ConnectorPlugin connectorPlugin = plugins.get(connectorType);
if (connectorPlugin != null) {
Preconditions.checkState(!connectorFactories.containsKey(catalogName), "A connector %s already exists", catalogName);
final ConnectorFactory connectorFactory = connectorPlugin.create(this.config, catalogName, properties, registry);
connectorFactories.put(catalogName, connectorFactory);
final MetacatCatalogConfig catalogConfig = MetacatCatalogConfig.createFromMapAndRemoveProperties(connectorType, properties);
catalogs.put(catalogName, catalogConfig);
} else {
log.warn("No plugin for connector with type %s", connectorType);
}
}
Aggregations