private IdObjectTypeList getGroupObjectIdsFromGroupRecursive(GroupDetails group, LongList previousGroupInstances) { if (archiveService == null || group == null) { // If there's no archive... return null; } //easiest case: group contains non-group-instances //requirement: 3.9.4.h if (!group.getObjectType().equals(GroupHelper.GROUPIDENTITY_OBJECT_TYPE)) { // It is no group of groups? return new IdObjectTypeList(group.getInstanceIds(), group.getObjectType()); } else { //solve a case with less complexity: get the instances of the groups groups final LongList groupsGroupIdentityIds = group.getInstanceIds(); //the recursive method-calls should not check the instances that will be checked during the iterations in this method call LongList newPreviousGroupInstances = new LongList(); newPreviousGroupInstances.addAll(previousGroupInstances); newPreviousGroupInstances.addAll(groupsGroupIdentityIds); //iterate through all new Groups and add all their instances to the final list IdObjectTypeList idObjectTypeList = new IdObjectTypeList(); for (int i = 0; i < groupsGroupIdentityIds.size(); i++) { final Long groupInstance = groupsGroupIdentityIds.get(i); //this group wasnt checked yet? if (!previousGroupInstances.contains(groupInstance)) { previousGroupInstances.add(groupInstance); // Retrieve the groups group-ids from the archive // requirement: 3.9.4.h GroupDetails nextGroupInstance = retrieveGroupDetailsFromArchive(group.getDomain(), groupInstance); idObjectTypeList.addAll(this.getGroupObjectIdsFromGroupRecursive(nextGroupInstance, newPreviousGroupInstances)); } } return idObjectTypeList; } }
public Boolean reconfigureLinks(LongList objIds, StatisticCreationRequestList statisticParameterDetailsList) { if (objIds.size() != statisticParameterDetailsList.size()) { return false; } statLinks.clear(); for (int i = 0; i < objIds.size(); i++) { statLinks.put(objIds.get(i), statisticParameterDetailsList.get(i)); } return true; }
public PeriodicSamplingManager() { sampleTimerList = new ArrayList<Timer>(); aggregationObjIdList = new LongList(); parameterSetIndexList = new ArrayList<Integer>(); }
@Override public CheckTypedInstanceList listDefinition(IdentifierList names, MALInteraction interaction) throws MALInteractionException, MALException { LongList identityIds = new LongList(); UIntegerList unkIndexList = new UIntegerList(); CheckTypedInstanceList checkIdTypes = new CheckTypedInstanceList(); identityIds.clear(); // if the wildcard is in the middle of the input list, we clear the output list and... identityIds.addAll(manager.listAllIdentities()); // ... add all in a row unkIndexList.clear(); break; identityIds.add(manager.getIdentity(name));
public synchronized void init() { // Retrieve all the ids and objectTypes from the Database dbBackend.createEntityManager(); // Get All the objectTypes available Query query = dbBackend.getEM().createQuery(QUERY_SELECT_OBJECTTYPE); List resultList = query.getResultList(); ArrayList<ObjectTypeHolderEntity> objectTypeHolderEntities = new ArrayList<ObjectTypeHolderEntity>(); objectTypeHolderEntities.addAll(resultList); dbBackend.closeEntityManager(); final IntegerList ids = new IntegerList(); final LongList objectTypes = new LongList(); // From the list of entities to separate lists of ids and objectTypeIds for (int i = 0; i < objectTypeHolderEntities.size(); i++) { ids.add(objectTypeHolderEntities.get(i).getId()); objectTypes.add(objectTypeHolderEntities.get(i).getObjectType()); } int max = 0; // Populate the variables on this class for (int i = 0; i < ids.size(); i++) { this.fastID.put(objectTypes.get(i), ids.get(i)); this.fastIDreverse.put(ids.get(i), objectTypes.get(i)); if (ids.get(i) > max) { // Get the maximum value max = ids.get(i); } } uniqueId = new AtomicInteger(max); }
/** * Provides the current set of definitions available in the Manager. * * @return The definitions set and the corresponding object instance * identifiers. */ public synchronized ConfigurationObjectSetList getCurrentConfiguration() { LongList idObjIds = new LongList(); LongList defObjIds = new LongList(); for (ObjectInstancePair pair : this.namesToPairsMap.values()) { idObjIds.add(pair.getObjIdentityInstanceId()); defObjIds.add(pair.getObjDefInstanceId()); } ConfigurationObjectSet idents = new ConfigurationObjectSet(); idents.setDomain(ConfigurationProviderSingleton.getDomain()); idents.setObjInstIds(idObjIds); LongList currentObjIds1 = new LongList(); currentObjIds1.addAll(defObjIds); ConfigurationObjectSet defis = new ConfigurationObjectSet(); defis.setDomain(ConfigurationProviderSingleton.getDomain()); defis.setObjInstIds(currentObjIds1); ConfigurationObjectSetList list = new ConfigurationObjectSetList(); list.add(idents); list.add(defis); return list; }
private void startTimer(final int index, Duration interval) { // requirement: 3.7.2.11 final Long identityId = aggregationObjIdList.get(index); final int indexOfparameterSet = parameterSetIndexList.get(index); sampleTimerList.get(index).scheduleAtFixedRate(new TimerTask() { @Override public void run() { if (active) { // To prevent race conditions with the other timer synchronized (lock) { //create the new paraemtersamples and set them if filter triggered or not enabled manager.sampleAndFilterParam(identityId, indexOfparameterSet); } } } }, 0, (int) (interval.getValue() * 1000)); // the time has to be converted to milliseconds by multiplying by 1000 }
/** * This method is getting all instances contained in the given groups. The * only difference to the other method (check the see part) is: you dont * care about the values and just want to get the identities referenced by * the groups * * @see getGroupInstancesForServiceOperation(InstanceBooleanPairList * enableInstances, GroupRetrieval groupRetrievalInformation, ObjectType * identyObjectType, IdentifierList domain, LongList allIdentities) * * @param groupIds * @param groupRetrievalInformation * @param identyObjectType * @param domain * @param allIdentities * @return */ public GroupRetrieval getGroupInstancesForServiceOperation(LongList groupIds, GroupRetrieval groupRetrievalInformation, ObjectType identyObjectType, IdentifierList domain, LongList allIdentities) { //if you cont care about the values and just want to get the identities referenced by the groups: InstanceBooleanPairList instBoolPairList = new InstanceBooleanPairList(groupIds.size()); for (Long enableInstance : groupIds) { instBoolPairList.add(new InstanceBooleanPair(enableInstance, Boolean.TRUE)); } return getGroupInstancesForServiceOperation(instBoolPairList, groupRetrievalInformation, identyObjectType, domain, allIdentities); }
public void addObjIdToBeEnabled(Long objIdToBeEnabled) { this.objIdToBeEnabled.add(objIdToBeEnabled); }
for (int i = 0; i < checkIdentityIds.size(); i++) { if (checkIdentityIds.get(i) == 0L) { checkIdentityIds.clear(); checkIdentityIds.addAll(manager.listAllIdentities()); wildcardFound = true; break; for (int i = 0; i < checkIdentityIds.size(); i++) { if (!manager.existsIdentity(checkIdentityIds.get(i))) { unkIndexList.add(new UInteger(i)); for (int i = 0; i < checkIdentityIds.size(); i++) { if (i < checkIdentityIds.size() - 1) { interaction.sendUpdate(checkIdentityIds.get(i), manager.getCheckSummaries(checkIdentityIds.get(i))); } else { interaction.sendResponse(checkIdentityIds.get(i), manager.getCheckSummaries(checkIdentityIds.get(i)));
public LongList getStatisticLinksForFunction(Long statFuncId) { LongList foundList = new LongList(); final Set<Long> statLinkIds = statLinks.keySet(); for (Long statLinkId : statLinkIds) { if (statLinks.get(statLinkId).getStatFuncInstId().equals(statFuncId)) { foundList.add(statLinkId); } } return foundList; }
/** * @param patchName . * @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.LongList listPatch(org.ccsds.moims.mo.mal.structures.IdentifierList patchName) 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.softwareimage.SoftwareImageHelper.LISTPATCH_OP, patchName); Object body0 = (Object) body.getBodyElement(0, new org.ccsds.moims.mo.mal.structures.LongList()); return (org.ccsds.moims.mo.mal.structures.LongList) body0; }
public void loadPreviousConfigurations() throws IOException { // Activate the previous configuration this.reloadServiceConfigurations(reconfigurableServices, objIds); Logger.getLogger(PersistProviderConfiguration.class.getName()).log(Level.FINER, "The size of the objIds list is: " + objIds.size() + " and the size of the reconfigurableServices is: " + reconfigurableServices.size()); for (int i = 0; i < objIds.size(); i++) { final ReconfigurableService providerService = reconfigurableServices.get(i); final PersistLatestServiceConfigurationAdapter persistLatestConfig = new PersistLatestServiceConfigurationAdapter(providerService, objIds.get(i), this.archiveService, this.executor); providerService.setOnConfigurationChangeListener(persistLatestConfig); } }