本文整理汇总了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;
}
示例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);
}
}
示例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;
}
示例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.");
}
}
示例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;
}
示例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();
}
示例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");
}