Package javax.xml.datatype

Examples of javax.xml.datatype.Duration


        if (!shouldRunTest("Duration")) {
            return;
        }
        javax.xml.datatype.DatatypeFactory datatypeFactory = javax.xml.datatype.DatatypeFactory.newInstance();

        Duration x = datatypeFactory.newDuration("P1Y35DT60M60.500S");
        Duration yOrig = datatypeFactory.newDuration("-P2MT24H60S");

        Holder<Duration> y = new Holder<Duration>(yOrig);
        Holder<Duration> z = new Holder<Duration>();

        Duration ret;
        if (testDocLiteral) {
            ret = docClient.testDuration(x, y, z);
        } else if (testXMLBinding) {
            ret = xmlClient.testDuration(x, y, z);
        } else {
View Full Code Here


        } else {
            acksTo = defaultAcksTo;
        }
        create.setAcksTo(acksTo);

        Duration d = sp.getSequenceExpiration();
        if (null != d) {
            Expires expires = RMUtils.getWSRMFactory().createExpires();
            expires.setValue(d)
            create.setExpires(expires);
        }
View Full Code Here

        Expires expires = factory.createExpires();
        seq.setExpires(expires);
           
        assertTrue(!seq.isExpired());
       
        Duration d = DatatypeFactory.PT0S;         
        expires.setValue(d);
        seq.setExpires(expires);
        try {
            Thread.sleep(1000);
        } catch (InterruptedException ex) {
View Full Code Here

        CreateSequenceResponseType createResponse =
            RMUtils.getWSRMFactory().createCreateSequenceResponseType();       
        createResponse.setIdentifier(destination.generateSequenceIdentifier());
       
        DestinationPolicyType dp = reliableEndpoint.getManager().getDestinationPolicy();
        Duration supportedDuration = dp.getSequenceExpiration();
        if (null == supportedDuration) {
            supportedDuration = DatatypeFactory.PT0S;
        }
        Expires ex = create.getExpires();
       
        if (null != ex) {
            Duration effectiveDuration = ex.getValue();
            // PT0S represents 0 second and the shortest duration but in ws-rm, considered the longest
            if (DatatypeFactory.PT0S.equals(effectiveDuration)
                || (!DatatypeFactory.PT0S.equals(supportedDuration)
                    &&  supportedDuration.isShorterThan(effectiveDuration)))  {
                effectiveDuration = supportedDuration;
View Full Code Here

        } else {
            acksTo = defaultAcksTo;
        }
        create.setAcksTo(acksTo);

        Duration d = sp.getSequenceExpiration();
        if (null != d) {
            Expires expires = new Expires();
            expires.setValue(d)
            create.setExpires(expires);
        }
View Full Code Here

        RMManager manager = control.createMock(RMManager.class);
        EasyMock.expect(rme.getManager()).andReturn(manager).anyTimes();
        SourcePolicyType sp = control.createMock(SourcePolicyType.class);
        EasyMock.expect(manager.getSourcePolicy()).andReturn(sp).anyTimes();
        EasyMock.expect(sp.getAcksTo()).andReturn(null).anyTimes();
        Duration d = DatatypeFactory.createDuration("PT12H");
        EasyMock.expect(sp.getSequenceExpiration()).andReturn(d).anyTimes();
        EasyMock.expect(sp.isIncludeOffer()).andReturn(Boolean.TRUE).anyTimes();
        Duration dOffered = DatatypeFactory.createDuration("PT24H");
        EasyMock.expect(sp.getOfferedSequenceExpiration()).andReturn(dOffered).anyTimes();
        Source source = control.createMock(Source.class);
        EasyMock.expect(rme.getSource()).andReturn(source).anyTimes();
        Identifier offeredId = control.createMock(Identifier.class);
        EasyMock.expect(source.generateSequenceIdentifier()).andReturn(offeredId).anyTimes();
View Full Code Here

            // A lot of testing to keep it as derived types.
            boolean isDTDur = dtXSDdayTimeDuration.equals(nv1.getDatatypeURI()) &&
                              dtXSDdayTimeDuration.equals(nv2.getDatatypeURI()) ;
            boolean isYMDur = dtXSDyearMonthDuration.equals(nv1.getDatatypeURI()) &&
                              dtXSDyearMonthDuration.equals(nv2.getDatatypeURI()) ;
            Duration d3 = nv1.getDuration().add(nv2.getDuration()) ;
            String lex = d3.toString() ;
            Node n ;
            if ( isDTDur )
                n = NodeFactoryExtra.createLiteralNode(lex, null, dtXSDdayTimeDuration) ;
            else if ( isYMDur )
                n = NodeFactoryExtra.createLiteralNode(lex, null, dtXSDyearMonthDuration) ;
View Full Code Here

         // A lot of testing to keep it as derived types.
            boolean isDTDur = dtXSDdayTimeDuration.equals(nv1.getDatatypeURI()) &&
                              dtXSDdayTimeDuration.equals(nv2.getDatatypeURI()) ;
            boolean isYMDur = dtXSDyearMonthDuration.equals(nv1.getDatatypeURI()) &&
                              dtXSDyearMonthDuration.equals(nv2.getDatatypeURI()) ;
            Duration d3 = nv1.getDuration().subtract(nv2.getDuration()) ;
            String lex = d3.toString() ;
            Node n ;
            if ( isDTDur )
                n = NodeFactoryExtra.createLiteralNode(lex, null, dtXSDdayTimeDuration) ;
            else if ( isYMDur )
                n = NodeFactoryExtra.createLiteralNode(lex, null, dtXSDyearMonthDuration) ;
View Full Code Here

            return XSDFuncOp.numMultiply(nv1, nv2) ;

        if ( vs1.equals(VSPACE_DURATION) && vs2.equals(VSPACE_NUM) )
        {
            // ONLY defined for dayTime.
            Duration dur = nv1.getDuration() ;
            boolean valid = XSDFuncOp.isDayTime(dur) ;
            if ( ! valid )
                throw new ExprEvalTypeException("Operator '*': only dayTime duration.  Got: "+nv1) ;
            BigDecimal dec = nv2.getDecimal() ;
            Duration r = dur.multiply(dec) ;
            Node n = NodeFactoryExtra.createLiteralNode(r.toString(), null, dtXSDdayTimeDuration) ;
            return NodeValue.makeNodeDuration(r, n) ;
        }
        throw new ExprEvalTypeException("Operator '*' : Undefined multiply: "+nv1+" and "+nv2) ;
    }
View Full Code Here

    public boolean isDuration()     { return false ; }

    public boolean isYearMonth()
    {
        if ( ! isDuration() ) return false ;
        Duration dur = getDuration() ;
        return ( dur.isSet(YEARS) || dur.isSet(MONTHS) ) &&
               ! dur.isSet(DAYS) && ! dur.isSet(HOURS) && ! dur.isSet(MINUTES) && ! dur.isSet(SECONDS) ;
    }
View Full Code Here

TOP

Related Classes of javax.xml.datatype.Duration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.