-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3c64e5d
commit aa6e82c
Showing
12 changed files
with
640 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
dependencies { | ||
compile project(":metacat-connector-jdbc") | ||
runtime("com.amazon.redshift:redshift-jdbc42:${redshift_driver_version}") | ||
} |
47 changes: 47 additions & 0 deletions
47
...dshift/src/main/java/com/netflix/metacat/connector/redshift/RedshiftConnectorFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* | ||
* Copyright 2017 Netflix, Inc. | ||
* | ||
* Licensed 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:https://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.netflix.metacat.connector.redshift; | ||
|
||
import com.google.common.collect.Lists; | ||
import com.netflix.metacat.connector.jdbc.JdbcConnectorFactory; | ||
import lombok.NonNull; | ||
|
||
import javax.annotation.Nonnull; | ||
import java.util.Map; | ||
|
||
/** | ||
* Connector Factory for Redshift. | ||
* | ||
* @author tgianos | ||
* @since 0.1.52 | ||
*/ | ||
class RedshiftConnectorFactory extends JdbcConnectorFactory { | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param name The catalog name | ||
* @param configuration The catalog configuration | ||
*/ | ||
RedshiftConnectorFactory( | ||
@Nonnull @NonNull final String name, | ||
@Nonnull @NonNull final Map<String, String> configuration | ||
) { | ||
super(name, Lists.newArrayList(new RedshiftConnectorModule(name, configuration))); | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
...edshift/src/main/java/com/netflix/metacat/connector/redshift/RedshiftConnectorModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* | ||
* Copyright 2017 Netflix, Inc. | ||
* | ||
* Licensed 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:https://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.netflix.metacat.connector.redshift; | ||
|
||
import com.google.inject.AbstractModule; | ||
import com.google.inject.Scopes; | ||
import com.netflix.metacat.common.server.connectors.ConnectorDatabaseService; | ||
import com.netflix.metacat.common.server.connectors.ConnectorPartitionService; | ||
import com.netflix.metacat.common.server.connectors.ConnectorTableService; | ||
import com.netflix.metacat.common.util.DataSourceManager; | ||
import com.netflix.metacat.connector.jdbc.JdbcTypeConverter; | ||
import com.netflix.metacat.connector.jdbc.services.JdbcConnectorDatabaseService; | ||
import com.netflix.metacat.connector.jdbc.services.JdbcConnectorPartitionService; | ||
import com.netflix.metacat.connector.jdbc.services.JdbcConnectorTableService; | ||
import lombok.NonNull; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.sql.DataSource; | ||
import java.util.Map; | ||
|
||
/** | ||
* Guice module for the Redshift Connector. | ||
* | ||
* @author tgianos | ||
* @since 0.1.52 | ||
*/ | ||
public class RedshiftConnectorModule extends AbstractModule { | ||
|
||
private final String name; | ||
private final Map<String, String> configuration; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param name The name of the catalog this module is associated will be associated with | ||
* @param configuration The connector configuration | ||
*/ | ||
RedshiftConnectorModule( | ||
@Nonnull @NonNull final String name, | ||
@Nonnull @NonNull final Map<String, String> configuration | ||
) { | ||
this.name = name; | ||
this.configuration = configuration; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
protected void configure() { | ||
this.bind(DataSource.class) | ||
.toInstance(DataSourceManager.get().load(this.name, this.configuration).get(this.name)); | ||
this.bind(JdbcTypeConverter.class).to(RedshiftTypeConverter.class).in(Scopes.SINGLETON); | ||
this.bind(ConnectorDatabaseService.class).to(JdbcConnectorDatabaseService.class).in(Scopes.SINGLETON); | ||
this.bind(ConnectorTableService.class).to(JdbcConnectorTableService.class).in(Scopes.SINGLETON); | ||
this.bind(ConnectorPartitionService.class).to(JdbcConnectorPartitionService.class).in(Scopes.SINGLETON); | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
...edshift/src/main/java/com/netflix/metacat/connector/redshift/RedshiftConnectorPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* | ||
* Copyright 2017 Netflix, Inc. | ||
* | ||
* Licensed 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:https://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.netflix.metacat.connector.redshift; | ||
|
||
import com.netflix.metacat.common.server.connectors.ConnectorFactory; | ||
import com.netflix.metacat.common.server.connectors.ConnectorPlugin; | ||
import com.netflix.metacat.common.server.connectors.ConnectorTypeConverter; | ||
import lombok.NonNull; | ||
|
||
import javax.annotation.Nonnull; | ||
import java.util.Map; | ||
|
||
/** | ||
* Redshift Connector Plugin. | ||
* | ||
* @author tgianos | ||
* @since 0.1.52 | ||
*/ | ||
public class RedshiftConnectorPlugin implements ConnectorPlugin { | ||
|
||
private static final String CONNECTOR_TYPE = "redshift"; | ||
private static final RedshiftTypeConverter TYPE_CONVERTER = new RedshiftTypeConverter(); | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public String getType() { | ||
return CONNECTOR_TYPE; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public ConnectorFactory create( | ||
@Nonnull @NonNull final String connectorName, | ||
@Nonnull @NonNull final Map<String, String> configuration | ||
) { | ||
return new RedshiftConnectorFactory(connectorName, configuration); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public ConnectorTypeConverter getTypeConverter() { | ||
return TYPE_CONVERTER; | ||
} | ||
} |
Oops, something went wrong.