private CommunityInfo getCommunityInfo() { String dsAddress = null; DiscoveryServiceClientDAO dsDao = PeerDAOFactory.getInstance().getDiscoveryServiceClientDAO(); dsAddress = dsDao.getDsAddresses().toString(); List<String> connectedPeers = new ArrayList<String>(); for (String peerAddress : dsDao.getRemoteWorkerProvidersAddress()) { connectedPeers.add(StringUtil.addressToUserAtServer(peerAddress)); } return new CommunityInfo( dsAddress, dsDao.isConnected() ? DiscoveryServiceState.UP : DiscoveryServiceState.CONTACTING, connectedPeers); }
public List<IResponseTO> execute(NotifyRemoteWorkerProviderRecoveryRequestTO request) { List<IResponseTO> responses = new ArrayList<IResponseTO>(); if (CertificationUtils.getCertSubjectDN(request.getMyCertPath()) .equals(CertificationUtils.getCertSubjectDN(request.getRwpCertPath()))) { LoggerResponseTO loggerResponse = new LoggerResponseTO( DiscoveryServiceClientMessages.getSameCertificateDNMessage(request.getRwpAddress()), LoggerResponseTO.DEBUG); responses.add(loggerResponse); ReleaseResponseTO releaseTO = new ReleaseResponseTO(); releaseTO.setStubAddress(request.getRwpAddress()); responses.add(releaseTO); return responses; } Collection<CertificateCRLPair> receivedPeersCAsData = PeerDAOFactory.getInstance().getPeerCertificationDAO().getReceivedPeersCAsData(); if (receivedPeersCAsData != null && !receivedPeersCAsData.isEmpty()) { if (!CertificationUtils.isCertificateValid(request.getRwpCertPath())) { LoggerResponseTO loggerResponse = new LoggerResponseTO( DiscoveryServiceClientMessages.getInvalidCertPathMessage(request.getRwpAddress()), LoggerResponseTO.WARN); responses.add(loggerResponse); ReleaseResponseTO releaseTO = new ReleaseResponseTO(); releaseTO.setStubAddress(request.getRwpAddress()); responses.add(releaseTO); return responses; } if (!CertificationUtils.isCertPathIssuedByCA( request.getRwpCertPath(), receivedPeersCAsData)) { LoggerResponseTO loggerResponse = new LoggerResponseTO( DiscoveryServiceClientMessages.getNonIssuedCertPathMessage(request.getRwpAddress()), LoggerResponseTO.WARN); responses.add(loggerResponse); ReleaseResponseTO releaseTO = new ReleaseResponseTO(); releaseTO.setStubAddress(request.getRwpAddress()); responses.add(releaseTO); return responses; } } DiscoveryServiceClientDAO dao = PeerDAOFactory.getInstance().getDiscoveryServiceClientDAO(); dao.addRemoteWorkerProviderAddress(request.getRwpAddress()); PeerControl.getInstance() .insertPeer( responses, request.getRwpUserAtServer(), CertificationUtils.getCertSubjectDN(request.getRwpCertPath())); return responses; }