@Override public StringList getDictionary(IntegerList wordIds, MALInteraction interaction) throws MALInteractionException, MALException { StringList output = new StringList(); for (Integer wordId : wordIds) { String word; try { word = dictionary.getWord(wordId); } catch (Exception ex) { word = null; Logger.getLogger(ArchiveSyncProviderServiceImpl.class.getName()).log(Level.SEVERE, null, ex); } output.add(word); } return output; }
public synchronized void init() { // Retrieve all the ids and providerURIs from the Database dbBackend.createEntityManager(); // Get All the providerURIs available Query query = dbBackend.getEM().createQuery(QUERY_SELECT_PROVIDERURI); List resultList = query.getResultList(); ArrayList<ProviderURIHolderEntity> providerURIHolderEntities = new ArrayList<ProviderURIHolderEntity>(); providerURIHolderEntities.addAll(resultList); dbBackend.closeEntityManager(); final IntegerList ids = new IntegerList(); final StringList providerURIs = new StringList(); // From the list of Entities to separate lists of ids and providerURIs for (int i = 0; i < providerURIHolderEntities.size(); i++) { ids.add(providerURIHolderEntities.get(i).getId()); providerURIs.add(providerURIHolderEntities.get(i).getProviderURIString()); } int max = 0; // Populate the variables on this class for (int i = 0; i < ids.size(); i++) { this.fastID.put(providerURIs.get(i), ids.get(i)); this.fastIDreverse.put(ids.get(i), providerURIs.get(i)); if (ids.get(i) > max) { // Get the maximum value max = ids.get(i); } } uniqueId = new AtomicInteger(max); }
/** * @param wordIds . * @return The return value of the interaction. * @throws org.ccsds.moims.mo.mal.MALInteractionException if there is a problem during the interaction as defined by the MAL specification. * @throws org.ccsds.moims.mo.mal.MALException if there is an implementation exception. */ public org.ccsds.moims.mo.mal.structures.StringList getDictionary(org.ccsds.moims.mo.mal.structures.IntegerList wordIds) throws org.ccsds.moims.mo.mal.MALInteractionException, org.ccsds.moims.mo.mal.MALException { org.ccsds.moims.mo.mal.transport.MALMessageBody body = consumer.request(org.ccsds.moims.mo.com.archivesync.ArchiveSyncHelper.GETDICTIONARY_OP, wordIds); Object body0 = (Object) body.getBodyElement(0, new org.ccsds.moims.mo.mal.structures.StringList()); return (org.ccsds.moims.mo.mal.structures.StringList) body0; }
/** * The checkPackageIntegrity operation allows a consumer to check the integrity of a certain package on the provider. * @param names The names field contains the names of the packages. * @return The return value of the interaction. * @throws org.ccsds.moims.mo.mal.MALInteractionException if there is a problem during the interaction as defined by the MAL specification. * @throws org.ccsds.moims.mo.mal.MALException if there is an implementation exception. */ public org.ccsds.moims.mo.softwaremanagement.packagemanagement.body.CheckPackageIntegrityResponse checkPackageIntegrity(org.ccsds.moims.mo.mal.structures.IdentifierList names) throws org.ccsds.moims.mo.mal.MALInteractionException, org.ccsds.moims.mo.mal.MALException { org.ccsds.moims.mo.mal.transport.MALMessageBody body = consumer.request(org.ccsds.moims.mo.softwaremanagement.packagemanagement.PackageManagementHelper.CHECKPACKAGEINTEGRITY_OP, names); Object body0 = (Object) body.getBodyElement(0, new org.ccsds.moims.mo.mal.structures.BooleanList()); Object body1 = (Object) body.getBodyElement(1, new org.ccsds.moims.mo.mal.structures.StringList()); return new org.ccsds.moims.mo.softwaremanagement.packagemanagement.body.CheckPackageIntegrityResponse((org.ccsds.moims.mo.mal.structures.BooleanList) body0, (org.ccsds.moims.mo.mal.structures.StringList) body1); }
boolean integrity = backend.checkPackageIntegrity(availablePackages.get(i));
private static StringList getAvailableTransports(AddressDetailsList addresses) { StringList transports = new StringList(); // List of transport names for (AddressDetails address : addresses) { // The name of the transport is always before ":" String[] parts = address.getServiceURI().toString().split(":"); transports.add(parts[0]); } return transports; }
return new StringList();
boolean integrity = backend.checkPackageIntegrity(availablePackages.get(i));
@Override public StringList getListOfPackages() throws IOException { // Go to the folder that contains the Packages and return the list of files! if (!folderWithPackages.exists()) { // The folder does not exist // Then create a new folder with a default name Logger.getLogger(NMFPackagePMBackend.class.getName()).log(Level.INFO, "The packages folder does not exist. It will be created in path: {0}", folderWithPackages.getCanonicalPath()); folderWithPackages.mkdir(); } File[] files = folderWithPackages.listFiles(); StringList packageNames = new StringList(files.length); // Cycle them and find the ones with the .nmfpack extension for (File file : files) { String name = file.getName(); // Check if the package ends with the expected suffix if (name.endsWith(HelperNMF.NMF_PACKAGE_SUFFIX)) { packageNames.add(name); } } // Return the filtered list return packageNames; }
/** * Called by the MAL when a REQUEST response is received from a provider. * @param msgHeader msgHeader The header of the received message. * @param body body The body of the received message. * @param qosProperties qosProperties The QoS properties associated with the message. * @throws org.ccsds.moims.mo.mal.MALException if an error is detected processing the message. */ public final void requestResponseReceived(org.ccsds.moims.mo.mal.transport.MALMessageHeader msgHeader, org.ccsds.moims.mo.mal.transport.MALMessageBody body, java.util.Map qosProperties) throws org.ccsds.moims.mo.mal.MALException { switch (msgHeader.getOperation().getValue()) { case org.ccsds.moims.mo.com.archivesync.ArchiveSyncHelper._GETTIME_OP_NUMBER: getTimeResponseReceived(msgHeader, (org.ccsds.moims.mo.mal.structures.FineTime) body.getBodyElement(0, new org.ccsds.moims.mo.mal.structures.FineTime()), (org.ccsds.moims.mo.mal.structures.FineTime) body.getBodyElement(1, new org.ccsds.moims.mo.mal.structures.FineTime()), qosProperties); break; case org.ccsds.moims.mo.com.archivesync.ArchiveSyncHelper._GETDICTIONARY_OP_NUMBER: getDictionaryResponseReceived(msgHeader, (org.ccsds.moims.mo.mal.structures.StringList) body.getBodyElement(0, new org.ccsds.moims.mo.mal.structures.StringList()), qosProperties); break; default: throw new org.ccsds.moims.mo.mal.MALException("Consumer adapter was not expecting operation number " + msgHeader.getOperation().getValue()); } }
if (newDefinitions.size() != names.size()) { // requirement: 3.5.15.2.f int min = Math.min(newDefinitions.size(), names.size()); int max = Math.max(newDefinitions.size(), names.size()); for (; min < max; min++) { invIndexList.add(new UInteger(min)); for (int i = 0; i < newDefinitions.size(); i++) { // requirement: 3.5.15.2.m CheckDefinitionDetails checkDef = (CheckDefinitionDetails) newDefinitions.get(i); final String name = names.get(i); ObjectId source = manager.storeCOMOperationActivity(interaction); for (int i = 0; i < newDefinitions.size(); i++) { idPairs.add(manager.add(names.get(i), (CheckDefinitionDetails) newDefinitions.get(i),
boolean integrity = backend.checkPackageIntegrity(availablePackages.get(i));
}); final StringList outputList = new StringList(); hdrlst.add(new UpdateHeader(timestamp, connection.getConnectionDetails().getProviderURI(), UpdateType.UPDATE, ekey)); outputList.add(outputText); publisher.publish(hdrlst, outputList); } catch (IllegalArgumentException ex) {
/** * Called by the MAL when a REQUEST response is received from a provider. * @param msgHeader msgHeader The header of the received message. * @param body body The body of the received message. * @param qosProperties qosProperties The QoS properties associated with the message. * @throws org.ccsds.moims.mo.mal.MALException if an error is detected processing the message. */ public final void requestResponseReceived(org.ccsds.moims.mo.mal.transport.MALMessageHeader msgHeader, org.ccsds.moims.mo.mal.transport.MALMessageBody body, java.util.Map qosProperties) throws org.ccsds.moims.mo.mal.MALException { switch (msgHeader.getOperation().getValue()) { case org.ccsds.moims.mo.softwaremanagement.packagemanagement.PackageManagementHelper._FINDPACKAGE_OP_NUMBER: findPackageResponseReceived(msgHeader, (org.ccsds.moims.mo.mal.structures.IdentifierList) body.getBodyElement(0, new org.ccsds.moims.mo.mal.structures.IdentifierList()), (org.ccsds.moims.mo.mal.structures.BooleanList) body.getBodyElement(1, new org.ccsds.moims.mo.mal.structures.BooleanList()), qosProperties); break; case org.ccsds.moims.mo.softwaremanagement.packagemanagement.PackageManagementHelper._CHECKPACKAGEINTEGRITY_OP_NUMBER: checkPackageIntegrityResponseReceived(msgHeader, (org.ccsds.moims.mo.mal.structures.BooleanList) body.getBodyElement(0, new org.ccsds.moims.mo.mal.structures.BooleanList()), (org.ccsds.moims.mo.mal.structures.StringList) body.getBodyElement(1, new org.ccsds.moims.mo.mal.structures.StringList()), qosProperties); break; default: throw new org.ccsds.moims.mo.mal.MALException("Consumer adapter was not expecting operation number " + msgHeader.getOperation().getValue()); } }
final StringList publicKeys = new StringList(); String publicKey = backend.getPublicKey(packageName.getValue()); integrities.add(integrity); publicKeys.add(publicKey);
/** * Called by the MAL when a PubSub update is received from a broker. * @param msgHeader msgHeader The header of the received message. * @param body body The body of the received message. * @param qosProperties qosProperties The QoS properties associated with the message. * @throws org.ccsds.moims.mo.mal.MALException if an error is detected processing the message. */ public final void notifyReceived(org.ccsds.moims.mo.mal.transport.MALMessageHeader msgHeader, org.ccsds.moims.mo.mal.transport.MALNotifyBody body, java.util.Map qosProperties) throws org.ccsds.moims.mo.mal.MALException { if ((org.ccsds.moims.mo.softwaremanagement.SoftwareManagementHelper.SOFTWAREMANAGEMENT_AREA_NUMBER.equals(msgHeader.getServiceArea())) && (org.ccsds.moims.mo.softwaremanagement.appslauncher.AppsLauncherHelper.APPSLAUNCHER_SERVICE_NUMBER.equals(msgHeader.getService()))) { switch (msgHeader.getOperation().getValue()) { case org.ccsds.moims.mo.softwaremanagement.appslauncher.AppsLauncherHelper._MONITOREXECUTION_OP_NUMBER: monitorExecutionNotifyReceived(msgHeader, (org.ccsds.moims.mo.mal.structures.Identifier) body.getBodyElement(0, new org.ccsds.moims.mo.mal.structures.Identifier()), (org.ccsds.moims.mo.mal.structures.UpdateHeaderList) body.getBodyElement(1, new org.ccsds.moims.mo.mal.structures.UpdateHeaderList()), (org.ccsds.moims.mo.mal.structures.StringList) body.getBodyElement(2, new org.ccsds.moims.mo.mal.structures.StringList()), qosProperties); break; default: throw new org.ccsds.moims.mo.mal.MALException("Consumer adapter was not expecting operation number " + msgHeader.getOperation().getValue()); } } else { notifyReceivedFromOtherService(msgHeader, body, qosProperties); } }