private PushNotificationManager findConnection(PushApp app) throws Exception { PushNotificationManager connection = this.connections.get(app.getAppId()); if(connection == null) { connection = PushNotificationManager.getInstance(); this.connections.put(app.getAppId(), connection); //Connect ByteArrayInputStream certStream = null; try { certStream = new ByteArrayInputStream(app.getCertificate()); String certPassword = app.getCertificatePassword(); connection.initializeConnection(this.host, this.port, certStream, certPassword, SSLConnectionHelper.KEYSTORE_TYPE_PKCS12); } finally { if(certStream != null) { certStream.close(); } } } return connection; } }
private void disqualifyApps(List<PushApp> apps, String channel) { List<PushApp> remove = new ArrayList<PushApp>(); for(PushApp local:apps) { if(!local.getChannels().contains(channel)) { remove.add(local); } } apps.removeAll(remove); }
private List<PushApp> findDevicePushApps(String deviceId) { List<PushApp> apps = new ArrayList<PushApp>(); List<PushApp> all = this.pushAppController.readAll(); for(PushApp local:all) { boolean deviceFound = local.getDevices().contains(deviceId); if(deviceFound) { apps.add(local); } } return apps; }
if(pushApp == null) pushApp = new PushApp(); pushApp.setAppId(appId); pushApp.setChannels(storedChannels); pushApp.addDevice(device.getIdentifier()); pushApp.setAppId(appId); pushApp.addDevice(device.getIdentifier()); pushApp.addChannel(channel); pushApp.setChannels(null);
if(local.getAppId().equals(appId))