本文整理汇总了Java中javapns.communication.exceptions.KeystoreException类的典型用法代码示例。如果您正苦于以下问题:Java KeystoreException类的具体用法?Java KeystoreException怎么用?Java KeystoreException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
KeystoreException类属于javapns.communication.exceptions包,在下文中一共展示了KeystoreException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: send
import javapns.communication.exceptions.KeystoreException; //导入依赖的package包/类
public IosResponse send(Payload payload, File certificado, String keyFile,
Boolean productionMode, List<String> devices) throws BusinessException {
try {
LOGGER.info("Enviando notificacion IOS");
PushedNotifications result;
String threads = parametroDao.getByName("IOS_THREADS").getValor();
if (threads != null && devices.size() >= Integer.parseInt(threads)) {
result = Push.payload(payload, certificado,
keyFile, productionMode, Integer.parseInt(threads), devices);
} else {
result = Push.payload(payload, certificado,
keyFile, productionMode, devices);
}
LOGGER.info("Procesando response: " + result.toString());
return procesarResponse(result);
} catch (CommunicationException e) {
LOGGER.error("CommunicationException" + e.getMessage());
throw new BusinessException(GlobalCodes.errors.IOS_COMM, e);
} catch (KeystoreException e1) {
LOGGER.error("KeystoreException" + e1.getMessage());
throw new BusinessException(GlobalCodes.errors.IOS_KEY_STORE, e1);
} catch (Exception ex) {
LOGGER.error("Exception" + ex.getMessage());
throw new BusinessException(GlobalCodes.errors.IOS_PUSH_PAYLOAD, ex);
}
}
示例2: getInactiveDevices
import javapns.communication.exceptions.KeystoreException; //导入依赖的package包/类
/**
*
* @param certificado
* @param keyFile
* @param productionMode
* @return
* @throws BusinessException
*/
public List<Device> getInactiveDevices(File certificado, String keyFile,
Boolean productionMode) throws BusinessException {
try {
List<Device> lista;
lista = (List) Push.feedback(certificado, keyFile, productionMode);
return lista;
} catch (CommunicationException e) {
throw new BusinessException(GlobalCodes.errors.IOS_COMM, e);
} catch (KeystoreException e1) {
throw new BusinessException(GlobalCodes.errors.IOS_KEY_STORE, e1);
}
}
示例3: initializeConnection
import javapns.communication.exceptions.KeystoreException; //导入依赖的package包/类
private boolean initializeConnection() throws KeystoreException,
CommunicationException {
if (keystore != null) {
AppleNotificationServer server = new AppleNotificationServerBasicImpl(
keystore, PASSWORD, PRODUCTION);
pushManager.initializeConnection(server);
isConnected = true;
} else {
isConnected = false;
}
return isConnected;
}
示例4: initializeConnection
import javapns.communication.exceptions.KeystoreException; //导入依赖的package包/类
private void initializeConnection() throws KeystoreException, CommunicationException {
AppleNotificationServer server = new AppleNotificationServerBasicImpl(
keystore, password, production);
pushManager.initializeConnection(server);
isConnected = true;
}
示例5: sendAlert
import javapns.communication.exceptions.KeystoreException; //导入依赖的package包/类
/**
* Sends an alert notification to a list of devices.
*
* @param alertMessage alert to be sent as a push notification
* @param deviceTokens the list of tokens for devices to which the notifications should be sent
* @return a list of pushed notifications that contain details on transmission results.
* @throws javapns.communication.exceptions.CommunicationException thrown if an error occurred while communicating with the target
* server even after a few retries.
* @throws javapns.communication.exceptions.KeystoreException thrown if an error occurs with using the certificate.
*/
public PushedNotifications sendAlert(String alertMessage, String[] deviceTokens)
throws CommunicationException, KeystoreException {
log.info("Sending alert='" + alertMessage + "' to " + deviceTokens.length
+ " devices started at " + dateFormat.format(new Date()) + ".");
PushedNotifications notifications =
sendPayload(PushNotificationPayload.alert(alertMessage), deviceTokens);
log.info("Sending alert='" + alertMessage + "' to " + deviceTokens.length
+ " devices completed at " + dateFormat.format(new Date()) + ".");
return notifications;
}
示例6: sendAlert
import javapns.communication.exceptions.KeystoreException; //导入依赖的package包/类
/**
* Sends an alert notification to a list of devices.
*
* @param alertMessage alert to be sent as a push notification
* @param deviceTokens the list of tokens for devices to which the notifications should be sent
* @return a list of pushed notifications that contain details on transmission results.
* @throws CommunicationException thrown if an error occurred while communicating with the target
* server even after a few retries.
* @throws KeystoreException thrown if an error occurs with using the certificate.
*/
public PushedNotifications sendAlert(String alertMessage, String[] deviceTokens)
throws CommunicationException, KeystoreException {
log.info("Sending alert='" + alertMessage + "' to " + deviceTokens.length
+ " devices started at " + dateFormat.format(new Date()) + ".");
PushedNotifications notifications =
sendPayload(PushNotificationPayload.alert(alertMessage), deviceTokens);
log.info("Sending alert='" + alertMessage + "' to " + deviceTokens.length
+ " devices completed at " + dateFormat.format(new Date()) + ".");
return notifications;
}
示例7: getSSLSocket
import javapns.communication.exceptions.KeystoreException; //导入依赖的package包/类
/**
* Create a SSLSocket which will be used to send data to Apple
* @return the SSLSocket
* @throws KeystoreException
* @throws CommunicationException
*/
public SSLSocket getSSLSocket() throws KeystoreException, CommunicationException {
SSLSocketFactory socketFactory = getSSLSocketFactory();
logger.debug("Creating SSLSocket to " + getServerHost() + ":" + getServerPort());
try {
if (ProxyManager.isUsingProxy(server)) {
return tunnelThroughProxy(socketFactory);
} else {
return (SSLSocket) socketFactory.createSocket(getServerHost(), getServerPort());
}
} catch (Exception e) {
throw new CommunicationException("Communication exception: " + e, e);
}
}
示例8: initializeConnection
import javapns.communication.exceptions.KeystoreException; //导入依赖的package包/类
private void initializeConnection() throws KeystoreException, CommunicationException {
AppleNotificationServer server =
new AppleNotificationServerBasicImpl(keystore, password, production);
pushManager.initializeConnection(server);
isConnected = true;
}
开发者ID:GoogleCloudPlatform,项目名称:solutions-ios-push-notification-sample-backend-java,代码行数:8,代码来源:PushNotificationSender.java
示例9: sendAlert
import javapns.communication.exceptions.KeystoreException; //导入依赖的package包/类
/**
* Sends an alert notification to a list of devices.
*
* @param alertMessage alert to be sent as a push notification
* @param deviceTokens the list of tokens for devices to which the notifications should be sent
* @return a list of pushed notifications that contain details on transmission results.
* @throws CommunicationException thrown if an error occurred while communicating with the target
* server even after a few retries.
* @throws KeystoreException thrown if an error occurs with using the certificate.
*/
public PushedNotifications sendAlert(String alertMessage, String[] deviceTokens)
throws CommunicationException, KeystoreException {
log.info("Sending alert='" + alertMessage + "' to " + deviceTokens.length
+ " devices started at " + dateFormat.format(new Date()) + ".");
PushedNotifications notifications =
sendPayload(PushNotificationPayload.alert(alertMessage), deviceTokens);
log.info("Sending alert='" + alertMessage + "' to " + deviceTokens.length
+ " devices completed at " + dateFormat.format(new Date()) + ".");
return notifications;
}
开发者ID:GoogleCloudPlatform,项目名称:solutions-ios-push-notification-sample-backend-java,代码行数:24,代码来源:PushNotificationSender.java
示例10: getSSLSocketFactory
import javapns.communication.exceptions.KeystoreException; //导入依赖的package包/类
public SSLSocketFactory getSSLSocketFactory() throws KeystoreException {
if (socketFactory == null) socketFactory = createSSLSocketFactory();
return socketFactory;
}
示例11: stopConnection
import javapns.communication.exceptions.KeystoreException; //导入依赖的package包/类
/**
* Stop connection and closes the socket
*
* @throws CommunicationException
* thrown if an error occurred while communicating with the
* target server even after a few retries.
* @throws KeystoreException
* thrown if an error occurs with using the certificate.
*/
public void stopConnection() throws CommunicationException,
KeystoreException {
pushManager.stopConnection();
isConnected = false;
}
示例12: stopConnection
import javapns.communication.exceptions.KeystoreException; //导入依赖的package包/类
/**
* Stop connection and closes the socket
*
* @throws javapns.communication.exceptions.CommunicationException thrown if an error occurred while communicating with the target
* server even after a few retries.
* @throws javapns.communication.exceptions.KeystoreException thrown if an error occurs with using the certificate.
*/
public void stopConnection() throws CommunicationException, KeystoreException {
pushManager.stopConnection();
isConnected = false;
}
示例13: stopConnection
import javapns.communication.exceptions.KeystoreException; //导入依赖的package包/类
/**
* Stop connection and closes the socket
*
* @throws CommunicationException thrown if an error occurred while communicating with the target
* server even after a few retries.
* @throws KeystoreException thrown if an error occurs with using the certificate.
*/
public void stopConnection() throws CommunicationException, KeystoreException {
pushManager.stopConnection();
isConnected = false;
}
示例14: ConnectionToAppleServer
import javapns.communication.exceptions.KeystoreException; //导入依赖的package包/类
/**
* Builds a connection to an Apple server.
*
* @param server connection details
* @throws KeystoreException thrown if an error occurs when loading the keystore
*/
public ConnectionToAppleServer(AppleServer server) throws KeystoreException {
this.server = server;
this.keyStore = KeystoreManager.loadKeystore(server);
}
示例15: createSSLSocketFactory
import javapns.communication.exceptions.KeystoreException; //导入依赖的package包/类
/**
* Return a SSLSocketFactory for creating sockets to communicate with Apple.
*
* @return SSLSocketFactory
* @throws KeystoreException
*/
public SSLSocketFactory createSSLSocketFactory() throws KeystoreException {
return createSSLSocketFactoryWithTrustManagers(new TrustManager[] { new ServerTrustingTrustManager() });
}