Author: ips
Date: Tue Apr  5 14:07:37 2005
New Revision: 160220

URL: http://svn.apache.org/viewcvs?view=rev&rev=160220
Log:
fixed duration metric values

Modified:
    
incubator/muse/trunk/src/site/content/interop/src/java/org/everestWeather/wsdm/samples/x2005/x04/schema/WeatherstationResource.java

Modified: 
incubator/muse/trunk/src/site/content/interop/src/java/org/everestWeather/wsdm/samples/x2005/x04/schema/WeatherstationResource.java
URL: 
http://svn.apache.org/viewcvs/incubator/muse/trunk/src/site/content/interop/src/java/org/everestWeather/wsdm/samples/x2005/x04/schema/WeatherstationResource.java?view=diff&r1=160219&r2=160220
==============================================================================
--- 
incubator/muse/trunk/src/site/content/interop/src/java/org/everestWeather/wsdm/samples/x2005/x04/schema/WeatherstationResource.java
 (original)
+++ 
incubator/muse/trunk/src/site/content/interop/src/java/org/everestWeather/wsdm/samples/x2005/x04/schema/WeatherstationResource.java
 Tue Apr  5 14:07:37 2005
@@ -15,8 +15,8 @@
 import org.apache.ws.muws.v1_0.topics.impl.XmlBeansManagementEventTopicImpl;
 import org.apache.ws.notification.topics.TopicSpace;
 import org.apache.ws.notification.topics.impl.TopicSpaceImpl;
-import org.apache.ws.resource.properties.ResourceProperty;
 import org.apache.ws.resource.example.InteropConstants;
+import org.apache.ws.resource.properties.ResourceProperty;
 import org.apache.ws.util.XmlBeanUtils;
 import org.apache.xmlbeans.GDurationBuilder;
 import org.apache.xmlbeans.XmlObject;
@@ -31,7 +31,6 @@
 import 
org.oasisOpen.docs.wsdm.x2004.x12.mows.wsdmMows.NumberOfFailedRequestsDocument;
 import 
org.oasisOpen.docs.wsdm.x2004.x12.mows.wsdmMows.NumberOfRequestsDocument;
 import 
org.oasisOpen.docs.wsdm.x2004.x12.mows.wsdmMows.NumberOfSuccessfulRequestsDocument;
-import org.oasisOpen.docs.wsdm.x2004.x12.mows.wsdmMows.OperationalStateType;
 import org.oasisOpen.docs.wsdm.x2004.x12.mows.wsdmMows.ServiceTimeDocument;
 import 
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.CorrelatablePropertiesDocument;
 import 
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.CorrelatablePropertiesType;
@@ -42,9 +41,7 @@
 import 
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipDocument;
 import 
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipParticipantType;
 import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipType;
-import 
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipTypeType;
 import 
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.StateTransitionType;
-import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.StateType;
 import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmPbm.MatchDocument;
 import org.xmlsoap.schemas.ws.x2004.x08.addressing.AttributedURI;
 import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
@@ -54,7 +51,6 @@
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.Calendar;
-import java.util.Date;
 
 /**
  * A Weatherstation WS-Resource.
@@ -89,7 +85,7 @@
 
         //MUWS TopicSpace
         TopicSpace muwsTopicSpace = new TopicSpaceImpl( 
MuwsConstants.NSURI_MUWS_PART2_TOPICS );
-        getTopicSpaceSet().addTopicSpace(muwsTopicSpace);
+        getTopicSpaceSet().addTopicSpace( muwsTopicSpace );
 
         ManagementEventTopic identityCapability = new 
XmlBeansManagementEventTopicImpl( "IdentityCapability" );
         muwsTopicSpace.addTopic( identityCapability );
@@ -109,7 +105,7 @@
 
         //MOWS TopicSpace
         TopicSpace mowsTopicSpace = new TopicSpaceImpl( 
MowsConstants.NSURI_MOWS_TOPICS );
-        getTopicSpaceSet().addTopicSpace(mowsTopicSpace);
+        getTopicSpaceSet().addTopicSpace( mowsTopicSpace );
 
         ManagementEventTopic mowsIdentificationCapability = new 
XmlBeansManagementEventTopicImpl(
                 "IdentificationCapability" );
@@ -227,35 +223,37 @@
         //relationshipType.setName( "" );//set name of relationship type  
OPTIONAL
         //relationshipType.setAccessEndpointReference();//need EPR    optional
 
-        QName qName = 
QName.valueOf("{"+WeatherstationPropertyQNames.FCCID.getNamespaceURI() + 
"}ResourceID");
+        QName qName = QName.valueOf( "{" + 
WeatherstationPropertyQNames.FCCID.getNamespaceURI() + "}ResourceID" );
         //add a participant
         RelationshipParticipantType relationshipParticipantType = 
relationshipType.addNewParticipant();
-        relationshipParticipantType.setResourceId(  "urn:" + 
InteropConstants.WEATHERSTATION_KEY1 );
+        relationshipParticipantType.setResourceId( "urn:" + 
InteropConstants.WEATHERSTATION_KEY1 );
         relationshipParticipantType.setRole( "urn://parent" );//uri
         EndpointReferenceType manageabilityEndpointReferenceType = 
relationshipParticipantType.addNewManageabilityEndpointReference();
-        
manageabilityEndpointReferenceType.addNewAddress().setStringValue(InteropConstants.SERVICES_URL
 + "/" + InteropConstants.WEATHERSTATION_SERVICE_NAME);
+        manageabilityEndpointReferenceType.addNewAddress().setStringValue(
+                InteropConstants.SERVICES_URL + "/" + 
InteropConstants.WEATHERSTATION_SERVICE_NAME );
         ReferencePropertiesType referencePropertiesType = 
manageabilityEndpointReferenceType.addNewReferenceProperties();
-        XmlObject key1 = 
XmlBeanUtils.addChildElement(referencePropertiesType,qName);
-        XmlBeanUtils.setValue(key1, InteropConstants.WEATHERSTATION_KEY1);
+        XmlObject key1 = XmlBeanUtils.addChildElement( 
referencePropertiesType, qName );
+        XmlBeanUtils.setValue( key1, InteropConstants.WEATHERSTATION_KEY1 );
 
         RelationshipParticipantType relationshipParticipantType2 = 
relationshipType.addNewParticipant();
-        relationshipParticipantType2.setResourceId(  "urn:" + 
InteropConstants.WEATHERSTATION_KEY2 );//spec optional
-        relationshipParticipantType2.setRole(  "urn://child1" );//uri
+        relationshipParticipantType2.setResourceId( "urn:" + 
InteropConstants.WEATHERSTATION_KEY2 );//spec optional
+        relationshipParticipantType2.setRole( "urn://child1" );//uri
         EndpointReferenceType manageabilityEndpointReferenceType2 = 
relationshipParticipantType.addNewManageabilityEndpointReference();
-        
manageabilityEndpointReferenceType2.addNewAddress().setStringValue(InteropConstants.SERVICES_URL
 + "/" + InteropConstants.WEATHERSTATION_SERVICE_NAME);
+        manageabilityEndpointReferenceType2.addNewAddress().setStringValue(
+                InteropConstants.SERVICES_URL + "/" + 
InteropConstants.WEATHERSTATION_SERVICE_NAME );
         ReferencePropertiesType referencePropertiesType2 = 
manageabilityEndpointReferenceType2.addNewReferenceProperties();
-        XmlObject key2 = 
XmlBeanUtils.addChildElement(referencePropertiesType2,qName);
-        XmlBeanUtils.setValue(key2, InteropConstants.WEATHERSTATION_KEY2);
+        XmlObject key2 = XmlBeanUtils.addChildElement( 
referencePropertiesType2, qName );
+        XmlBeanUtils.setValue( key2, InteropConstants.WEATHERSTATION_KEY2 );
 
         //add a relationshiptype
-        RelationshipTypeType relationshipTypeType = 
relationshipType.addNewType();
+        relationshipType.addNewType();
 
         resourceProperty.add( relationshipDocument );
 
         /*----------------- MOWS OperationalState props -----------------*/
         resourceProperty = resourcePropertySet.get( 
WeatherstationPropertyQNames.CURRENTOPERATIONALSTATE );
         CurrentOperationalStateDocument currentOperationalStateDocument = 
CurrentOperationalStateDocument.Factory.newInstance();
-        OperationalStateType operationalStateType = 
currentOperationalStateDocument.addNewCurrentOperationalState();
+        currentOperationalStateDocument.addNewCurrentOperationalState();
         //todo??
         resourceProperty.add( currentOperationalStateDocument );
         //todo not sure about change listener
@@ -263,8 +261,8 @@
         resourceProperty = resourcePropertySet.get( 
WeatherstationPropertyQNames.LASTOPERATIONALSTATETRANSITION );
         LastOperationalStateTransitionDocument 
lastOperationalStateTransitionDocument = 
LastOperationalStateTransitionDocument.Factory.newInstance();
         StateTransitionType stateTransitionType = 
lastOperationalStateTransitionDocument.addNewLastOperationalStateTransition();
-        StateType stateType = stateTransitionType.addNewEnteredState();
-        StateType prevStateType = stateTransitionType.addNewPreviousState();
+        stateTransitionType.addNewEnteredState();
+        stateTransitionType.addNewPreviousState();
         stateTransitionType.setTime( Calendar.getInstance() );
         stateTransitionType.setTransitionIdentifier( "" );
         resourceProperty.add( lastOperationalStateTransitionDocument );
@@ -275,7 +273,7 @@
         EndpointReferenceDocument endpointReferenceDocument = 
EndpointReferenceDocument.Factory.newInstance();
         EndpointReferenceType endpointReferenceType = 
endpointReferenceDocument.addNewEndpointReference();//temporary
         AttributedURI attributedURI = endpointReferenceType.addNewAddress();
-        attributedURI.setStringValue(InteropConstants.SERVICES_URL + "/" + 
InteropConstants.BLACKBERRY_SERVICE_NAME);
+        attributedURI.setStringValue( InteropConstants.SERVICES_URL + "/" + 
InteropConstants.BLACKBERRY_SERVICE_NAME );
         //endpointReferenceDocument.setEndpointReference(null);//todo need the 
real epr for interop
         resourceProperty.add( endpointReferenceDocument );
         resourceProperty.addChangeListener( mowsIdentificationCapability );
@@ -283,34 +281,28 @@
         resourceProperty = resourcePropertySet.get( 
WeatherstationPropertyQNames.ENDPOINTDESCRIPTIONS );
         EndpointDescriptionsDocument endpointDescriptionsDocument = 
EndpointDescriptionsDocument.Factory.newInstance();
         EndpointDescriptionsDocument.EndpointDescriptions endpointDescriptions 
= endpointDescriptionsDocument.addNewEndpointDescriptions();
-        endpointDescriptions.addDescription( InteropConstants.SERVICES_URL + 
"/" + InteropConstants.BLACKBERRY_SERVICE_NAME+"?wsdl" );
+        endpointDescriptions.addDescription(
+                InteropConstants.SERVICES_URL + "/" + 
InteropConstants.BLACKBERRY_SERVICE_NAME + "?wsdl" );
         resourceProperty.add( endpointDescriptionsDocument );
         resourceProperty.addChangeListener( mowsIdentificationCapability );
 
         /*----------------- MOWS Metrics props -----------------*/
 
         Calendar resetAt = Calendar.getInstance();
-        Date date = new Date();
-        date.setTime(date.getTime() + 86400000);//24hrs ahead
-        resetAt.setTime(date);
-
 
         resourceProperty = resourcePropertySet.get( 
WeatherstationPropertyQNames.NUMBEROFREQUESTS );
         NumberOfRequestsDocument numberOfRequestsDocument = 
NumberOfRequestsDocument.Factory.newInstance();
         IntegerCounter integerCounter = 
numberOfRequestsDocument.addNewNumberOfRequests();
-        //integerCounter.setDuration(new GDuration( ));
         integerCounter.setBigIntegerValue( BigInteger.valueOf( 120L ) );
-        integerCounter.setResetAt(resetAt);
+        integerCounter.setResetAt( resetAt );
         resourceProperty.add( numberOfRequestsDocument );
         resourceProperty.addChangeListener( mowsMetricsCapability );
 
-
-
         resourceProperty = resourcePropertySet.get( 
WeatherstationPropertyQNames.NUMBEROFSUCCESSFULREQUESTS );
         NumberOfSuccessfulRequestsDocument numberOfSuccessfulRequestsDocument 
= NumberOfSuccessfulRequestsDocument.Factory.newInstance();
         IntegerCounter successIntegerCounter = 
numberOfSuccessfulRequestsDocument.addNewNumberOfSuccessfulRequests();
         successIntegerCounter.setBigIntegerValue( BigInteger.valueOf( 90L ) );
-        successIntegerCounter.setResetAt(resetAt);
+        successIntegerCounter.setResetAt( resetAt );
         resourceProperty.add( numberOfSuccessfulRequestsDocument );
         resourceProperty.addChangeListener( mowsMetricsCapability );
 
@@ -318,21 +310,23 @@
         NumberOfFailedRequestsDocument numberOfFailedRequestsDocument = 
NumberOfFailedRequestsDocument.Factory.newInstance();
         IntegerCounter failedIntegerCounter = 
numberOfFailedRequestsDocument.addNewNumberOfFailedRequests();
         failedIntegerCounter.setBigIntegerValue( BigInteger.valueOf( 30L ) );
-        failedIntegerCounter.setResetAt(resetAt);
+        failedIntegerCounter.setResetAt( resetAt );
         resourceProperty.add( numberOfFailedRequestsDocument );
         resourceProperty.addChangeListener( mowsMetricsCapability );
 
         resourceProperty = resourcePropertySet.get( 
WeatherstationPropertyQNames.SERVICETIME );
         ServiceTimeDocument serviceTimeDocument = 
ServiceTimeDocument.Factory.newInstance();
-        DurationMetric durationMetric = 
serviceTimeDocument.addNewServiceTime();
+        DurationMetric serviceTimeMetric = 
serviceTimeDocument.addNewServiceTime();
         GDurationBuilder builder = new GDurationBuilder( +1, 1, 2, 3, 4, 5, 6, 
new BigDecimal( 0.789 ) );
-        durationMetric.setDuration(builder.toGDuration());
+        serviceTimeMetric.setGDurationValue( builder.toGDuration() );
+        serviceTimeMetric.setDuration( builder.toGDuration() );
         resourceProperty.add( serviceTimeDocument );
         resourceProperty.addChangeListener( mowsMetricsCapability );
 
         resourceProperty = resourcePropertySet.get( 
WeatherstationPropertyQNames.MAXRESPONSETIME );
         MaxResponseTimeDocument maxResponseTimeDocument = 
MaxResponseTimeDocument.Factory.newInstance();
         DurationMetric maxRespDurationMetric = 
maxResponseTimeDocument.addNewMaxResponseTime();
+        maxRespDurationMetric.setGDurationValue( builder.toGDuration() );
         maxRespDurationMetric.setDuration( builder.toGDuration() );
         resourceProperty.add( maxResponseTimeDocument );
         resourceProperty.addChangeListener( mowsMetricsCapability );
@@ -341,6 +335,7 @@
         LastResponseTimeDocument lastResponseTimeDocument = 
LastResponseTimeDocument.Factory.newInstance();
         DurationMetric lastRespDurationMetric = 
lastResponseTimeDocument.addNewLastResponseTime();
         lastRespDurationMetric.setGDurationValue( builder.toGDuration() );
+        lastRespDurationMetric.setDuration( builder.toGDuration() );
         resourceProperty.add( lastResponseTimeDocument );
         resourceProperty.addChangeListener( mowsMetricsCapability );
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to