Examples of toGregorianCalendar()


Examples of javax.xml.datatype.XMLGregorianCalendar.toGregorianCalendar()

                    created = WSSConstants.datatypeFactory.newXMLGregorianCalendar(timestampType.getCreated().getValue());
                } catch (IllegalArgumentException e) {
                    throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY, e);
                }
                log.debug("Timestamp created: " + created);
                createdDate = created.toGregorianCalendar().getTime();
            }

            Date expiresDate = null;
            if (timestampType.getExpires() != null) {
                XMLGregorianCalendar expires;
View Full Code Here

Examples of javax.xml.datatype.XMLGregorianCalendar.toGregorianCalendar()

                    expires = WSSConstants.datatypeFactory.newXMLGregorianCalendar(timestampType.getExpires().getValue());
                } catch (IllegalArgumentException e) {
                    throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY, e);
                }
                log.debug("Timestamp expires: " + expires);
                expiresDate = expires.toGregorianCalendar().getTime();
            }

            Date rightNow = new Date();
            int ttl = tokenContext.getWssSecurityProperties().getTimestampTTL();
            int futureTTL = tokenContext.getWssSecurityProperties().getTimeStampFutureTTL();
View Full Code Here

Examples of javax.xml.datatype.XMLGregorianCalendar.toGregorianCalendar()

            try {
                created = WSSConstants.datatypeFactory.newXMLGregorianCalendar(attributedDateTimeCreated.getValue());
            } catch (IllegalArgumentException e) {
                throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY, e);
            }
            Date createdDate = created.toGregorianCalendar().getTime();
           
            // Validate whether the security semantics have expired
            if (!DateUtil.verifyCreated(createdDate, ttl, futureTTL)) {
                throw new WSSecurityException(WSSecurityException.ErrorCode.MESSAGE_EXPIRED);
            }
View Full Code Here

Examples of javax.xml.datatype.XMLGregorianCalendar.toGregorianCalendar()

  @Override
  public Date dateTimeValue(Value node) {
      try {
          XMLGregorianCalendar cal = ((Literal)node).calendarValue();
          //TODO: check if we need to deal with timezone and Local here
          return cal.toGregorianCalendar().getTime();
      } catch (ClassCastException e) {
          throw new IllegalArgumentException("Value "+node.stringValue()+" is not a literal" +
                  "but of type "+debugType(node));
      }
  }
View Full Code Here

Examples of javax.xml.datatype.XMLGregorianCalendar.toGregorianCalendar()

  public static Date dateFromXmlFormat( final String _xmlFormat, final TimeZone _timeZone )
  {
    try {
      final DatatypeFactory datatypeFactory = DatatypeFactory.newInstance();
      final XMLGregorianCalendar gregorianCalendar = datatypeFactory.newXMLGregorianCalendar( _xmlFormat );
      final Calendar calendar = gregorianCalendar.toGregorianCalendar( _timeZone, null, null );
      return calendar.getTime();
    } catch (DatatypeConfigurationException e) {
      throw new ConfigurationException( e );
    }
  }
View Full Code Here

Examples of javax.xml.datatype.XMLGregorianCalendar.toGregorianCalendar()

             }else{
                 throw XMLConversionException.incorrectTimestampDateTimeFormat(sourceString);
             }
        }

        GregorianCalendar cal = xmlGregorianCalender.toGregorianCalendar();
        if(xmlGregorianCalender.getTimezone() == DatatypeConstants.FIELD_UNDEFINED) {
            cal.setTimeZone(getTimeZone());
        }
        QName  calendarQName = xmlGregorianCalender.getXMLSchemaType();
        if(!calendarQName.equals(schemaType)){
View Full Code Here

Examples of javax.xml.datatype.XMLGregorianCalendar.toGregorianCalendar()

                        Thread.sleep(5000);
                        data.value.get(0).setExpiresAfter(null);
                        tckSubscriptionJoe.subscription.saveSubscription(authInfoJoe, data);
                        Assert.assertNotNull(data.value.get(0).getExpiresAfter());
                        Assert.assertNotSame(xcal, data.value.get(0).getExpiresAfter());
                        long initial = xcal.toGregorianCalendar().getTimeInMillis();
                        long finaltime = data.value.get(0).getExpiresAfter().toGregorianCalendar().getTimeInMillis();
                        Assert.assertTrue(finaltime > initial);

                } catch (Exception ex) {
                        HandleException(ex);
View Full Code Here

Examples of javax.xml.datatype.XMLGregorianCalendar.toGregorianCalendar()

      Calendar cal = (Calendar) source;
      calendar.setTimeZone(cal.getTimeZone());
      calendar.setTimeInMillis(cal.getTime().getTime());
    } else if (source instanceof XMLGregorianCalendar) {
      XMLGregorianCalendar xmlCal = (XMLGregorianCalendar) source;
      GregorianCalendar cal = xmlCal.toGregorianCalendar();
      calendar.setTimeZone(cal.getTimeZone());
      calendar.setTimeInMillis(cal.getTime().getTime());
    } else if (source instanceof Long)
      calendar.setTimeInMillis(((Long) source).longValue());
View Full Code Here

Examples of javax.xml.datatype.XMLGregorianCalendar.toGregorianCalendar()

    public static ExpirationType toExpirationTypeContainingDuration(XMLGregorianCalendar date) {
        ExpirationType et = new ExpirationType();
        XMLGregorianCalendar now = factory.newXMLGregorianCalendar(new GregorianCalendar());
        XMLGregorianCalendar then = factory.newXMLGregorianCalendar(date.toGregorianCalendar());
        long durationMillis = then.toGregorianCalendar().getTimeInMillis()
                - now.toGregorianCalendar().getTimeInMillis();
        Duration duration = factory.newDuration(durationMillis);
        et.setValue(duration.toString());
        return et;
    }
View Full Code Here

Examples of javax.xml.datatype.XMLGregorianCalendar.toGregorianCalendar()

     */
    public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException {
        final Calendar startupTime = context.getBroker().getBrokerPool().getStartupTime();

        final XMLGregorianCalendar xmlNow = context.getCalendar();
        final Calendar now = xmlNow.toGregorianCalendar();
        final long duration = now.getTimeInMillis() - startupTime.getTimeInMillis();
        return new DayTimeDurationValue(duration);

    }
}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.