All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sap.cds.feature.services.db.hana.HanaDataSourceDescriptor Maven / Gradle / Ivy

There is a newer version: 3.6.0
Show newest version
/**************************************************************************
 * (C) 2019-2020 SAP SE or an SAP affiliate company. All rights reserved. *
 **************************************************************************/
package com.sap.cds.feature.services.db.hana;

import java.util.Map;

import com.sap.cds.feature.platform.ServiceBinding;
import com.sap.cds.feature.services.db.DataSourceDescriptor;

/**
 * Converts a HANA {@link ServiceBinding} into a {@link DataSourceDescriptor}
 */
public class HanaDataSourceDescriptor implements DataSourceDescriptor {

	private final String name;
	private final String url;
	private final String username;
	private final String password;

	public HanaDataSourceDescriptor(ServiceBinding binding) {
		this.name = binding.getServiceInstanceName();

		Map credentials = binding.getCredentials();
		this.url = (String) credentials.get("url");
		this.username = (String) credentials.get("user");
		this.password = (String) credentials.get("password");
	}

	@Override
	public String getServiceName() {
		return name;
	}

	@Override
	public String getDriverClassName() {
		return "com.sap.db.jdbc.Driver";
	}

	@Override
	public String getUrl() {
		return url;
	}

	@Override
	public String getUsername() {
		return username;
	}

	@Override
	public String getPassword() {
		return password;
	}

	@Override
	public boolean isEmbedded() {
		return false;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy