@Override public Duration getPeriod(MALInteraction interaction) throws MALInteractionException, MALException { // Convert to seconds and return the value return new Duration(period / 1000); }
private void startReportingTimer(final Long statLinkId, final Duration interval, boolean immediateReport) { updateTimerList.get(statLinkId).scheduleAtFixedRate(new TimerTask() { @Override public void run() { //requirement: 3.6.2.h, 3.6.3.b if (active) { reportStatistic(statLinkId); } } }, immediateReport ? 0 : (int) (interval.getValue() * 1000), (int) (interval.getValue() * 1000)); //requirement: 3.6.2.h, 3.6.3.b }
if (! estimateDuration.equals(other.estimateDuration))
private void addPeriodicSampling(Long identityId) { final AggregationDefinitionDetails aggrDef = manager.getAggregationDefinition(identityId); if (!aggrDef.getGenerationEnabled()) { return; // Periodic Sampling shall not occur if the generation is not enabled at the definition level } final int parameterSetsTotal = aggrDef.getParameterSets().size(); int index = sampleTimerList.size(); for (int indexOfParameterSet = 0; indexOfParameterSet < parameterSetsTotal; indexOfParameterSet++) { Duration sampleInterval = aggrDef.getParameterSets().get(indexOfParameterSet).getSampleInterval(); //means ad hoc value, dont add to sample timer if (sampleInterval.getValue() > aggrDef.getReportInterval().getValue()) { sampleInterval = new Duration(0); } // Add to the Periodic Sampling Manager only if there's a sampleInterval selected for the parameterSet if (sampleInterval.getValue() != 0) { aggregationObjIdList.add(index, identityId); parameterSetIndexList.add(index, indexOfParameterSet); Timer timer = new Timer(); // Take care of adding a new timer sampleTimerList.add(index, timer); startTimer(index, sampleInterval); index++; } } }
/** * Returns a hash code for this object. * @return a hash code value for this object. */ public int hashCode() { int hash = 7; hash = 83 * hash + (success != null ? success.hashCode() : 0); hash = 83 * hash + (estimateDuration != null ? estimateDuration.hashCode() : 0); hash = 83 * hash + (nextDestination != null ? nextDestination.hashCode() : 0); return hash; }
return String.valueOf(((Duration) in).toString());
&& sampleInterval.getValue() != 0 && sampleInterval.getValue() < updateInterval.getValue()) { previousSetTimeStamp = new Time(currentTime.getValue() - (long) (updateInterval.getValue() * 1000)); } else { //otherwise its the time of the last value of the previous set previousSetTimeStamp = new Time(this.latestSampleTimeList.get(identityId).get(indexParameterSet - 1).getValue()); - (long) (sampleInterval.getValue() * 1000) * sampleCountList.get(identityId).get(indexParameterSet)); Duration deltaTime = new Duration(((float) (firstSampleTime.getValue() - previousSetTimeStamp.getValue())) / 1000);
/** * Returns a hash code for this object. * @return a hash code value for this object. */ public int hashCode() { int hash = 7; hash = 83 * hash + (cpuPercentage != null ? cpuPercentage.hashCode() : 0); hash = 83 * hash + (memoryPercentage != null ? memoryPercentage.hashCode() : 0); hash = 83 * hash + (priority != null ? priority.hashCode() : 0); hash = 83 * hash + (virt != null ? virt.hashCode() : 0); hash = 83 * hash + (res != null ? res.hashCode() : 0); hash = 83 * hash + (shr != null ? shr.hashCode() : 0); hash = 83 * hash + (status != null ? status.hashCode() : 0); hash = 83 * hash + (timeCPU != null ? timeCPU.hashCode() : 0); hash = 83 * hash + (command != null ? command.hashCode() : 0); return hash; }
@Override public Duration decodeDuration() throws MALException { return new Duration(sourceBuffer.getDouble()); }
private void startUpdatesTimer(final Long checkLinkId, final Duration interval) { updateTimerList.get(checkLinkId).scheduleAtFixedRate(new TimerTask() { @Override public void run() { try { //paramId is null for compound check final ObjectId paramSource = manager.getCheckLinkLinks(checkLinkId).getSource(); //requirement: 3.5.4.m -> Source Object = null manager.executeCheck(checkLinkId, paramSource == null ? null : parameterManager.getParameterValue(paramSource.getKey().getInstId()), false, true, null); } catch (MALInteractionException ex) { Logger.getLogger(CheckProviderServiceImpl.class.getName()).log(Level.SEVERE, null, ex); } } // the time is being converted to milliseconds by multiplying by 1000 (starting delay included) }, (int) (interval.getValue() * 1000), (int) (interval.getValue() * 1000)); // requirement: 3.5.3.ff }
if (! timeCPU.equals(other.timeCPU))
@Override public Duration decodeDuration() throws MALException { return new Duration(sourceBuffer.getDouble()); }
private void startTimer(final Long identityId, final Duration interval, final boolean useConverted) { // requirement: 3.6.2.g sampleTimerList.get(identityId).scheduleAtFixedRate(new TimerTask() { @Override public void run() { // Periodic sampling if (active) { sampleParamValue(identityId, useConverted); } } // the time has to be converted to milliseconds by multiplying by 1000 }, 0, (int) (interval.getValue() * 1000)); // requirement: 3.6.2.g }
/** * The getPeriod operation allows a consumer to get the period of the provider's heartbeat. * @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.Duration getPeriod() 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.heartbeat.HeartbeatHelper.GETPERIOD_OP, (Object[]) null); Object body0 = (Object) body.getBodyElement(0, new org.ccsds.moims.mo.mal.structures.Duration()); return (org.ccsds.moims.mo.mal.structures.Duration) body0; }
private void startFilterTimeoutTimer(final Long identityId, final Duration interval) { filterTimeoutTimerList.get(identityId).scheduleAtFixedRate(new TimerTask() { @Override public void run() { // requirement: 3.7.2.a.c, 3.7.3.n if (active) { manager.setFilterTriggered(identityId, true); //get the new samples and update the aggregation in the internal list for (int index = 0; index < manager.getAggregationDefinition(identityId).getParameterSets().size(); index++) { manager.sampleParam(identityId, index); } //publish the values in the internal list publishPeriodicAggregationUpdate(identityId, manager.getAggregationValue(identityId, GenerationMode.FILTERED_TIMEOUT)); manager.resetAggregationSampleHelperVariables(identityId); } } // the time is being converted to milliseconds by multiplying by 1000 }, 0, (int) (interval.getValue() * 1000)); }
return new Duration();
private void startTimer(final Long checkLinkId, Duration interval) { // requirement: 3.7.2.11 sampleTimerList.get(checkLinkId).scheduleAtFixedRate(new TimerTask() { @Override public void run() { // Periodic Checking if (active) { try { final ObjectId paramId = manager.getCheckLinkLinks(checkLinkId).getSource(); //todo: the source link should be the ObjectId-of the parameterValue manager.executeCheck(checkLinkId, paramId == null ? null : parameterManager.getParameterValue(manager.getCheckLinkLinks(checkLinkId).getSource().getKey().getInstId()), false, false, null); } catch (MALInteractionException ex) { Logger.getLogger(CheckProviderServiceImpl.class.getName()).log(Level.SEVERE, null, ex); } } } // the time has to be converted to milliseconds by multiplying by 1000 }, 0, (int) (interval.getValue() * 1000)); // requirement: 3.6.2.g }
/** * The patchImage operation allows a consumer to generate a new software image on the provider from a previous baseline Image. The operation can use the Activity Tracking service to report the progress of the generation. * @param baselineImage . * @param patchObjId . * @param adapter adapter Listener in charge of receiving the messages from the service provider. * @return The acknowledge 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.Duration patchImage(Long baselineImage, Long patchObjId, org.ccsds.moims.mo.softwaremanagement.softwareimage.consumer.SoftwareImageAdapter adapter) throws org.ccsds.moims.mo.mal.MALInteractionException, org.ccsds.moims.mo.mal.MALException { org.ccsds.moims.mo.mal.transport.MALMessageBody body = consumer.invoke(org.ccsds.moims.mo.softwaremanagement.softwareimage.SoftwareImageHelper.PATCHIMAGE_OP, adapter, (baselineImage == null) ? null : new org.ccsds.moims.mo.mal.structures.Union(baselineImage), (patchObjId == null) ? null : new org.ccsds.moims.mo.mal.structures.Union(patchObjId)); Object body0 = (Object) body.getBodyElement(0, new org.ccsds.moims.mo.mal.structures.Duration()); return (org.ccsds.moims.mo.mal.structures.Duration) body0; }
private void startUpdatesTimer(final Long identityId, final Duration interval) { updateTimerList.get(identityId).scheduleAtFixedRate(new TimerTask() { @Override public void run() { // requirement: 3.7.3.c if (active) { AggregationDefinitionDetails def = manager.getAggregationDefinition(identityId); checkSampleIntervalAndSampleParam(identityId, true); // To prevent race conditions with the other timer synchronized (lock) { if (!def.getFilterEnabled()) { // The Filter is not enabled? // requirement: 3.7.2.a.a, publishPeriodicAggregationUpdate(identityId, manager.getAggregationValue(identityId, GenerationMode.PERIODIC)); //requirement: 3.7.3.h manager.resetAggregationSampleHelperVariables(identityId); } else { // requirement: 3.7.2.a.c, if (manager.isFilterTriggered(identityId) == true) { // The Filter is on and triggered? requirement: 3.7.2.6 publishPeriodicAggregationUpdate(identityId, manager.getAggregationValue(identityId, GenerationMode.PERIODIC)); //requirement: 3.7.3.h manager.resetAggregationSampleHelperVariables(identityId); resetFilterTimeoutTimer(identityId); // Reset the timer } } } } } // the time is being converted to milliseconds by multiplying by 1000 }, (int) (interval.getValue() * 1000), (int) (interval.getValue() * 1000)); // requirement: 3.7.3.g }
/** * The getLastKnownPosition operation allows a consumer to retrieve the last known position that was provided by the GPS unit. * @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.platform.gps.body.GetLastKnownPositionResponse getLastKnownPosition() 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.platform.gps.GPSHelper.GETLASTKNOWNPOSITION_OP, (Object[]) null); Object body0 = (Object) body.getBodyElement(0, new org.ccsds.moims.mo.platform.gps.structures.Position()); Object body1 = (Object) body.getBodyElement(1, new org.ccsds.moims.mo.mal.structures.Duration()); return new org.ccsds.moims.mo.platform.gps.body.GetLastKnownPositionResponse((org.ccsds.moims.mo.platform.gps.structures.Position) body0, (org.ccsds.moims.mo.mal.structures.Duration) body1); }