当前位置: 首页>>代码示例>>Java>>正文


Java ConnectivityConfiguration类代码示例

本文整理汇总了Java中com.sap.core.connectivity.api.configuration.ConnectivityConfiguration的典型用法代码示例。如果您正苦于以下问题:Java ConnectivityConfiguration类的具体用法?Java ConnectivityConfiguration怎么用?Java ConnectivityConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ConnectivityConfiguration类属于com.sap.core.connectivity.api.configuration包,在下文中一共展示了ConnectivityConfiguration类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: retrieveConnectivityConfiguration

import com.sap.core.connectivity.api.configuration.ConnectivityConfiguration; //导入依赖的package包/类
/**
 * Initializes and returns singleton ConnectivityConfiguration.
 * 
 * @return singleton ConnectivityConfiguration.
 */
public static ConnectivityConfiguration retrieveConnectivityConfiguration() {
	if (ConnectivityConfigurationProvider.connectivityConfiguration == null) {
		synchronized (ConnectivityConfigurationProvider.class) {
			if (ConnectivityConfigurationProvider.connectivityConfiguration == null) {
				ConnectivityConfigurationProvider.connectivityConfiguration = initConnectivityConfiguration();
			}
		}
	}

	return ConnectivityConfigurationProvider.connectivityConfiguration;
}
 
开发者ID:SAP,项目名称:cloud-ariba-partner-flow-extension-ext,代码行数:17,代码来源:ConnectivityConfigurationProvider.java

示例2: lookupDestinationConfiguration

import com.sap.core.connectivity.api.configuration.ConnectivityConfiguration; //导入依赖的package包/类
private DestinationConfiguration lookupDestinationConfiguration() throws IOException {
	ConnectivityConfiguration connectivityConfiguration = lookupConnectivityConfiguration();

	DestinationConfiguration destinationConfiguration = connectivityConfiguration.getConfiguration(destinationName);
	if (destinationConfiguration == null) {
		String errorMessage = MessageFormat.format(ERROR_DESTINATION_NOT_FOUND, destinationName);
		LOGGER.error(errorMessage);
		throw new IOException(errorMessage);
	}
	return destinationConfiguration;
}
 
开发者ID:SAP,项目名称:cloud-c4c-ticket-duplicate-finder-ext,代码行数:12,代码来源:HTTPConnector.java

示例3: lookupConnectivityConfiguration

import com.sap.core.connectivity.api.configuration.ConnectivityConfiguration; //导入依赖的package包/类
private synchronized ConnectivityConfiguration lookupConnectivityConfiguration() throws IOException {
	try {
		if (this.localConnectivityConfiguration == null) {
			Context ctx = new InitialContext();
			this.localConnectivityConfiguration = (ConnectivityConfiguration) ctx.lookup(CONNECTIVITY_CONFIGURATION_LOOKUP_NAME);
		}
		return this.localConnectivityConfiguration;
	} catch (NamingException e) {
		throw new IOException(e.getMessage(), e);
	}
}
 
开发者ID:SAP,项目名称:cloud-c4c-ticket-duplicate-finder-ext,代码行数:12,代码来源:HTTPConnector.java

示例4: getDestConfiguration

import com.sap.core.connectivity.api.configuration.ConnectivityConfiguration; //导入依赖的package包/类
private DestinationConfiguration getDestConfiguration() throws NamingException {
	// Look up the connectivity configuration API
	javax.naming.Context ctx = new InitialContext();
	ConnectivityConfiguration configuration = (ConnectivityConfiguration) ctx
			.lookup("java:comp/env/connectivityConfiguration");
	// Get destination configuration for "destinationName"
	DestinationConfiguration destConfiguration = configuration.getConfiguration("onprem-plantdata-dest");
	return destConfiguration;
}
 
开发者ID:AnujMehta07,项目名称:cloud-pollutionmonitoringapp,代码行数:10,代码来源:PlantDataService.java

示例5: init

import com.sap.core.connectivity.api.configuration.ConnectivityConfiguration; //导入依赖的package包/类
@Override
public void init() throws ServletException {
	// Look up the connectivity configuration API
	try {
		Context ctx = new InitialContext();
		configuration = (ConnectivityConfiguration) ctx.lookup(CONNECTIVITY_CONFIGURATION);
	} catch (NamingException e) {
		LOGGER.error("Could not lookup Connectivity Configuration [ {} ] ", CONNECTIVITY_CONFIGURATION, e);
		throw new UnavailableException("Could not lookup Connectivity Configuration. See logs for details.");
	}

	if (configuration == null) {
		throw new UnavailableException("Looking up Conenctivity Configuration returned null.");
	}
}
 
开发者ID:SAP,项目名称:cloud-concur-expenses-ext,代码行数:16,代码来源:ExpensesServlet.java

示例6: prepareCompanyPollutionData

import com.sap.core.connectivity.api.configuration.ConnectivityConfiguration; //导入依赖的package包/类
private CompanyPollutionData prepareCompanyPollutionData(List<Plant> mfPlantList, HttpServletResponse response)
		throws Exception {
	HttpsURLConnection urlConnection = null;
	CompanyPollutionData companyPollutionData = new CompanyPollutionData();
	List<PlantPollutionDayData> plantPollutionDayDataList = new ArrayList<PlantPollutionDayData>();
	// Look up the connectivity configuration API
	javax.naming.Context ctx = new InitialContext();
	ConnectivityConfiguration configuration = (ConnectivityConfiguration) ctx
			.lookup("java:comp/env/connectivityConfiguration");
	// Get destination configuration for "destinationName"
	DestinationConfiguration destConfiguration = configuration.getConfiguration("openaq-api-dest");
	SSLSocketFactory socketFactory = null;
	// Get the destination URL
	String value = destConfiguration.getProperty("URL");
	URL baseUrl = new URL(value);
	socketFactory = establishedSSLConnection(response, baseUrl.getHost(), 443);
	for (Iterator<Plant> iterator = mfPlantList.iterator(); iterator.hasNext();) {
		Plant ogPlant = (Plant) iterator.next();
		final String destinationUrl = value + "?parameter=o3&location=" + ogPlant.getLocation() + "&date_from="
				+ ogPlant.getDateField() + "&date_to=" + ogPlant.getDateField();
		URL url = new URL(destinationUrl.replaceAll(" ", "%20"));
		urlConnection = (HttpsURLConnection) url.openConnection();
		urlConnection.setSSLSocketFactory(socketFactory);
		// Copy content from the incoming response to the outgoing response
		InputStream instream = urlConnection.getInputStream();
		String msgBody = getResponseBodyasJSONArray(instream);
		JSONObject cityO3 = new JSONObject(msgBody);
		PlantPollutionDayData plantPollutionDayData = new PlantPollutionDayData();
		plantPollutionDayData.setPlant(ogPlant);
		JSONArray jsonArray = cityO3.getJSONArray("results");
		if (!jsonArray.isNull(0) && jsonArray.get(0) != null) {
			JSONObject jsonObject = (JSONObject) jsonArray.get(0);
			if (jsonObject != null) {
				Double o3value = (Double) jsonObject.get("value");
				plantPollutionDayData.setCityOzoneLevel(o3value.toString());
			}
		} else {
			// Value is not available
			plantPollutionDayData.setCityOzoneLevel(" ");
		}
		plantPollutionDayDataList.add(plantPollutionDayData);
	}
	int size = plantPollutionDayDataList.size();
	int i = 0;
	int j = 5;
	int k = 0;
	while (size > 0) {
		companyPollutionData.getPlantsPollutionWeeklyData().put(Integer.toString(k),
				plantPollutionDayDataList.subList(i, j));
		i = i + 5;
		j = j + 5;
		size = size - 5;
		k++;
	}
	return companyPollutionData;
}
 
开发者ID:AnujMehta07,项目名称:cloud-pollutionmonitoringapp,代码行数:57,代码来源:PollutionDataService.java

示例7: getDestinationProperties

import com.sap.core.connectivity.api.configuration.ConnectivityConfiguration; //导入依赖的package包/类
/**
 * Connects to the destination by name and returns its configuration
 * properties
 * 
 * @param destinationName
 *            the destination name
 * @return map of all properties for the given destination
 */
public static Map<String, String> getDestinationProperties(String destinationName) {

	DestinationConfiguration destinationConfiguration = null;

	try {

		Context context = new InitialContext();
		ConnectivityConfiguration configuration = (ConnectivityConfiguration) context
				.lookup(CONNECTIVITY_CONFIGURATION);
		destinationConfiguration = configuration.getConfiguration(destinationName);

	} catch (NamingException e) {

		String message = MessageFormatter
				.format(ERROR_UNABLE_TO_CONNECT_TO_CONNECTIVITY_SERVICE_MESSAGE, destinationName).getMessage();
		LOGGER.error(message, e);
	}

	return destinationConfiguration.getAllProperties();

}
 
开发者ID:svilenkomitov,项目名称:Food-Calculator,代码行数:30,代码来源:HTTPUtils.java

示例8: geConnectivityConfiguration

import com.sap.core.connectivity.api.configuration.ConnectivityConfiguration; //导入依赖的package包/类
/**
 * Returns connectivity configuration object from JNDI context
 */
protected ConnectivityConfiguration geConnectivityConfiguration()
throws IOException {
	return getResource("connectivityConfiguration");
}
 
开发者ID:SAP,项目名称:iot-starterkit,代码行数:8,代码来源:AbstractDispatcherServlet.java


注:本文中的com.sap.core.connectivity.api.configuration.ConnectivityConfiguration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。