Added support for MS-SQL and Azure SQL DB
Added support for MS-SQL and Azure SQL DB
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package org.springframework.cloud.cloudfoundry;
|
||||
|
||||
import org.springframework.cloud.service.common.SqlServerServiceInfo;
|
||||
|
||||
public class SqlServerServiceInfoCreator extends
|
||||
RelationalServiceInfoCreator<SqlServerServiceInfo> {
|
||||
|
||||
public SqlServerServiceInfoCreator() {
|
||||
super(new Tags(), SqlServerServiceInfo.SQLSERVER_SCHEME); }
|
||||
|
||||
@Override
|
||||
public SqlServerServiceInfo createServiceInfo(String id, String url) {
|
||||
return new SqlServerServiceInfo(id, url);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,3 +7,4 @@ org.springframework.cloud.cloudfoundry.MonitoringServiceInfoCreator
|
||||
org.springframework.cloud.cloudfoundry.SmtpServiceInfoCreator
|
||||
org.springframework.cloud.cloudfoundry.OracleServiceInfoCreator
|
||||
org.springframework.cloud.cloudfoundry.DB2ServiceInfoCreator
|
||||
org.springframework.cloud.cloudfoundry.SqlServerServiceInfoCreator
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.springframework.cloud.service.common;
|
||||
|
||||
import org.springframework.cloud.service.ServiceInfo;
|
||||
|
||||
@ServiceInfo.ServiceLabel("sqlserver")
|
||||
public class SqlServerServiceInfo extends RelationalServiceInfo {
|
||||
private static final String JDBC_URL_TYPE = "sqlserver";
|
||||
|
||||
public static final String SQLSERVER_SCHEME = JDBC_URL_TYPE;
|
||||
|
||||
public SqlServerServiceInfo(String id, String url) {
|
||||
super(id, url, JDBC_URL_TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJdbcUrl()
|
||||
{
|
||||
return String.format("jdbc:%s://%s:%d;database=%s;user=%s;password=%s;",
|
||||
jdbcUrlDatabaseType,
|
||||
getHost(), getPort(), getPath(), getUserName(), getPassword());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.springframework.cloud.service.relational;
|
||||
|
||||
import org.springframework.cloud.service.common.SqlServerServiceInfo;
|
||||
import org.springframework.cloud.service.relational.DataSourceCreator;
|
||||
|
||||
public class SqlServerDataSourceCreator extends DataSourceCreator<SqlServerServiceInfo> {
|
||||
|
||||
private static final String[] DRIVERS = new String[]{"com.microsoft.sqlserver.jdbc.SQLServerDriver"};
|
||||
private static final String VALIDATION_QUERY = "SELECT 1";
|
||||
|
||||
public SqlServerDataSourceCreator() {
|
||||
super("spring-cloud.sqlserver.driver", DRIVERS, VALIDATION_QUERY);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,3 +6,4 @@ org.springframework.cloud.service.keyval.RedisConnectionFactoryCreator
|
||||
org.springframework.cloud.service.document.MongoDbFactoryCreator
|
||||
org.springframework.cloud.service.messaging.RabbitConnectionFactoryCreator
|
||||
org.springframework.cloud.service.smtp.MailSenderCreator
|
||||
org.springframework.cloud.service.relational.SqlServerDataSourceCreator
|
||||
|
||||
Reference in New Issue
Block a user