/** * (non-Javadoc) * * @see FermatEventHandler#handleEvent(FermatEvent) * @param platformEvent * @throws Exception */ @Override public void handleEvent(FermatEvent platformEvent) throws FermatException { System.out.println( "CompleteComponentRegistrationNotificationEventHandler - handleEvent platformEvent =" + platformEvent); if (((Service) this.cryptoTransmissionNetworkServicePluginRoot).getStatus() == ServiceStatus.STARTED) { CompleteComponentRegistrationNotificationEvent completeComponentRegistrationNotificationEvent = (CompleteComponentRegistrationNotificationEvent) platformEvent; if (completeComponentRegistrationNotificationEvent .getPlatformComponentProfileRegistered() .getPlatformComponentType() == PlatformComponentType.NETWORK_SERVICE_COMPONENT && completeComponentRegistrationNotificationEvent .getPlatformComponentProfileRegistered() .getNetworkServiceType() == NetworkServiceType.NETWORK_SERVICE_TEMPLATE_TYPE) { /* * TemplateManager make the job */ this.cryptoTransmissionNetworkServicePluginRoot .handleCompleteComponentRegistrationNotificationEvent( completeComponentRegistrationNotificationEvent .getPlatformComponentProfileRegistered()); } } }
/** * (non-Javadoc) * * @see FermatEventHandler#handleEvent(FermatEvent) * @param platformEvent * @throws Exception */ @Override public void handleEvent(FermatEvent platformEvent) throws FermatException { // System.out.println("CompleteComponentRegistrationNotificationEventHandler - handleEvent // platformEvent ="+platformEvent ); if (((Service) this.networkService).getStatus().equals(ServiceStatus.STARTED)) { CompleteComponentRegistrationNotificationEvent completeComponentRegistrationNotificationEvent = (CompleteComponentRegistrationNotificationEvent) platformEvent; if (completeComponentRegistrationNotificationEvent .getPlatformComponentProfileRegistered() .getNetworkServiceType() == networkService.getNetworkServiceType() || completeComponentRegistrationNotificationEvent .getPlatformComponentProfileRegistered() .getPlatformComponentType() == PlatformComponentType.COMMUNICATION_CLOUD_CLIENT) { /* * networkService make the job */ this.networkService.handleCompleteComponentRegistrationNotificationEvent( completeComponentRegistrationNotificationEvent.getPlatformComponentProfileRegistered()); } } }
/** * Handle the event CompleteComponentRegistrationNotificationEvent * * @param event */ public void handleCompleteComponentRegistrationNotificationEvent( CompleteComponentRegistrationNotificationEvent event) { try { if (wsCommunicationsCloudClientManager .getCommunicationsCloudClientConnection(networkServiceType) .isRegister() && event.getPlatformComponentProfileRegistered().getPlatformComponentType() == PlatformComponentType.COMMUNICATION_CLOUD_CLIENT && !this.register) { if (communicationRegistrationProcessNetworkServiceAgent != null && communicationRegistrationProcessNetworkServiceAgent.getActive()) { communicationRegistrationProcessNetworkServiceAgent.stop(); communicationRegistrationProcessNetworkServiceAgent = null; } wsCommunicationsCloudClientManager .getCommunicationsCloudClientConnection(networkServiceType) .registerComponentForCommunication( this.getNetworkServiceProfile().getNetworkServiceType(), this.getNetworkServiceProfile()); } if (event.getPlatformComponentProfileRegistered().getPlatformComponentType() == PlatformComponentType.NETWORK_SERVICE && event.getPlatformComponentProfileRegistered().getNetworkServiceType() == getNetworkServiceProfile().getNetworkServiceType() && event .getPlatformComponentProfileRegistered() .getIdentityPublicKey() .equals(identity.getPublicKey())) { System.out.println( "###################\n" + "NETWORK SERVICE REGISTERED: " + name + "\n###################"); this.register = Boolean.TRUE; onNetworkServiceRegistered(); } if (event.getPlatformComponentProfileRegistered().getPlatformComponentType() != PlatformComponentType.COMMUNICATION_CLOUD_CLIENT && event.getPlatformComponentProfileRegistered().getPlatformComponentType() != PlatformComponentType.NETWORK_SERVICE) { onComponentRegistered(event.getPlatformComponentProfileRegistered()); } } catch (Exception e) { e.printStackTrace(); } }