package org.wsdmdemo.service.weatherStation.callbacks;
import org.apache.ws.resource.properties.ResourceProperty;
import org.apache.ws.resource.properties.ResourcePropertyCallback;
import org.apache.ws.resource.properties.impl.CallbackFailedException;
import org.wsdmdemo.service.InteropConstants;
import org.wsdmdemo.service.weatherStation.VisibilityMetricType;
import java.util.Calendar;
/**
* @author Sal Campana
*/
public class VisibilityCallback implements ResourcePropertyCallback
{
private double m_lastTemp = InteropConstants.DEFAULT_VISIBILITY;
public ResourceProperty refreshProperty(ResourceProperty resourceProperty) throws CallbackFailedException
{
Calendar resetAt = Calendar.getInstance();
VisibilityMetricType prop_visibility = (VisibilityMetricType) resourceProperty.get(0);
prop_visibility.setResetAt(resetAt);
prop_visibility.setDoubleValue(CallbackUtils.getNextRandomValue(m_lastTemp, InteropConstants.MAX_VISIBILITY, InteropConstants.MIN_VISIBILITY));
return resourceProperty;
}
}