XMLGregorianCalendar and Duration classes

I have never used this type of classes before... I stopped programming Java a long time ago :p
I have an XMLGregorianCalendar (called start_date) with the current date set, which I use to set the start of an event.
I want to set an XMLGregorianCalendar end_date that will be a copy of the first one + 1minute
There is a method addDuration() but I couldn't figure out how to use it properly :-/
I know other ways to do that, but for this case I have to use these classes...
Please if you could look at these 2 classes quickly and explain me how to do it, it would be great!
[XMLGregorian Class-> Method addDuration() documentation|http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/datatype/XMLGregorianCalendar.html#add(javax.xml.datatype.Duration)]
[Class Duration doc|http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/datatype/Duration.html]
Edited by: ierpe on Aug 7, 2008 4:58 PM

Just do
end_date = start_date.add(DatatypeFactory.newInstance().newDuration(60000L));

Similar Messages

  • Using Timer and TimerTask classes in EJB's(J2EE)

    Does J2EE allow us to use Timer and TimerTask classes from java.util package in SessionBean EJB's ( Statless or Statefull )?.
    If J2EE does allow, I am not sure how things work in practical, Lets take simple example where a stateless SessionBean creates a Timer class
    and schedules a task to be executed after 5 hours and returns. Assuming
    GC kicks in many times in 5 hours, I wonder if the Timer object created by survives the GC run's so that it can execute the scheduled tasks.
    My gut feeling says that the Timer Object will not survive.. Just
    want to confirm that.
    I will be interested to know If there are any techiniques that can make
    the usage of Timer and TimeTask classes in EJB's possible as well as reliable with minmum impact on over all performance.

    Have a look at J2EE 1.4. I think they add a timer service for EJBs there...
    Kai

  • In the privacy policy, it states that percentages and durations of books read are being collected to ensure that publishers can have a metered price model, prices depending on how the book was read. Give me an example of a company with such a price model?

    In your privacy policy, you state that the percentages and durations of books read are being collected to ensure that publishers can choose a metered price model. Prices which depends on the duration for which the book was read.
    Give me an example of a company with such a price model? Are the information being collected even where the companies have not asked for the information, even when the metered price models are not being used?
    Here is an extract från the privacy policy:
    What information does Adobe Digital Editions collect and how is it used?
    The following information may be collected when an eBook with DRM is opened in Adobe Digital Editions software. If an eBook does not have any DRM associated with it, then no information is collected.
    User GUID: The User GUID is a unique value assigned in place of your User ID and is used to authenticate you.
    Device GUID: The Device GUID is a unique value generated to identify your device. It is used to ensure that the eBook may be viewed on your device and that the number of devices permitted by the license is not exceeded.
    Certified App ID: This ID represents the application that is being used to view the eBook, in this case Adobe Digital Editions. It is necessary to ensure that only a certified application may display an eBook. This helps to minimize piracy and theft of eBooks.
    Device IP (Internet Protocol): This identifies the country you are located in when you purchase an eBook.  It is used by eBook providers for the enablement of localized pricing models. Only the country identifier of the Device IP is stored.
    Duration for Which the Book was Read: This information may be collected to facilitate limited or metered pricing models entered into between eBook providers, such as publishers and distributors. These models are based on how long a reader has read an eBook. For example, you may borrow an eBook for a period of 30 days. While some publishers and distributors may charge libraries and resellers for 30 days from the date of the download, others may follow a metered pricing model and charge them for the actual time you read the eBook.
    Percentage of the eBook Read: The percentage of the eBook read may be collected to allow eBook providers such as publishers to implement subscription pricing models where they charge based on the percentage of the eBook read.
    Information provided by eBook providers relating to the eBook you have purchased: The following information is provided by the eBook provider to enable the delivery of the eBook to your device:Date of eBook purchase/download
    Distributor ID and Adobe Content Server Operator URL
    Metadata of the eBook, such as title, author, language, publisher list price, ISBN number
    How is the information transmitted?
    The data is sent periodically to Adobe via a secure transmission using HTTPS.
    How is the information used?
    Adobe uses the information collected about the eBook you have opened in Adobe Digital Editions software to ensure it is being viewed in accordance with the type of DRM license that accompanies that eBook. The type of license is determined by the eBook provider. For more information on how each piece of data is used, please see above.

    In your privacy policy, you state that the percentages and durations of books read are being collected to ensure that publishers can choose a metered price model. Prices which depends on the duration for which the book was read.
    Give me an example of a company with such a price model? Are the information being collected even where the companies have not asked for the information, even when the metered price models are not being used?
    Here is an extract från the privacy policy:
    What information does Adobe Digital Editions collect and how is it used?
    The following information may be collected when an eBook with DRM is opened in Adobe Digital Editions software. If an eBook does not have any DRM associated with it, then no information is collected.
    User GUID: The User GUID is a unique value assigned in place of your User ID and is used to authenticate you.
    Device GUID: The Device GUID is a unique value generated to identify your device. It is used to ensure that the eBook may be viewed on your device and that the number of devices permitted by the license is not exceeded.
    Certified App ID: This ID represents the application that is being used to view the eBook, in this case Adobe Digital Editions. It is necessary to ensure that only a certified application may display an eBook. This helps to minimize piracy and theft of eBooks.
    Device IP (Internet Protocol): This identifies the country you are located in when you purchase an eBook.  It is used by eBook providers for the enablement of localized pricing models. Only the country identifier of the Device IP is stored.
    Duration for Which the Book was Read: This information may be collected to facilitate limited or metered pricing models entered into between eBook providers, such as publishers and distributors. These models are based on how long a reader has read an eBook. For example, you may borrow an eBook for a period of 30 days. While some publishers and distributors may charge libraries and resellers for 30 days from the date of the download, others may follow a metered pricing model and charge them for the actual time you read the eBook.
    Percentage of the eBook Read: The percentage of the eBook read may be collected to allow eBook providers such as publishers to implement subscription pricing models where they charge based on the percentage of the eBook read.
    Information provided by eBook providers relating to the eBook you have purchased: The following information is provided by the eBook provider to enable the delivery of the eBook to your device:Date of eBook purchase/download
    Distributor ID and Adobe Content Server Operator URL
    Metadata of the eBook, such as title, author, language, publisher list price, ISBN number
    How is the information transmitted?
    The data is sent periodically to Adobe via a secure transmission using HTTPS.
    How is the information used?
    Adobe uses the information collected about the eBook you have opened in Adobe Digital Editions software to ensure it is being viewed in accordance with the type of DRM license that accompanies that eBook. The type of license is determined by the eBook provider. For more information on how each piece of data is used, please see above.

  • Whats the difference between an INTERFACE and a CLASS?

    Whats the difference between an INTERFACE and a CLASS?
    Please help.
    Thanx.

    http://search.java.sun.com/search/java/index.jsp?col=javaforums&qp=%2Bforum%3A31&qt=Difference+between+interface+and+class

  • Page Attributes and Application Class Attributes

    Hi, everyone,
    I am quite new to BSP.
    I have a question here:
    what is the difference between page attributes and application class attributes of a bsp application? As they are both global attributes, there seems to be no big difference when we use them.
    thanks a lot.
    Fan

    Hi Fan,
    a BSP application can be made up of many pages.
    A page attribute is visible only in the page it is associated with.
    Attributes of the application class are visible from every page in that application.
    Cheers
    Graham Robbo

  • What is the difference between document class and normal class

    Hi,
    Please let me know what is the difference between document class and normal class.
    And I have no idea which class should call as document class or call as an object.
    Thanks
    -Actionscript Developer

    the document class is invoked immediately when your swf opens.  the document class must subclass the sprite or movieclip class.
    all other classes are invoked explicitly with code and need not subclass any other class.

  • How to get the jar file without knowing its name and any class inside it?

    Hello, everybody!
    I would like to know if there's a way to get a reference programatically to the initial jar without knowing its name and any class contained in it. By "initial jar" I mean the jar that was called in the prompt, like this:
    java -jar jarfile.jaror in another way, in a graphical system. To be sincere what I really want is to get a reference to the jar's manifest, but I know if I can get a reference to the jar I can get a reference to its manifest file. Or if you know a way to get the manifest directly, it would also help. So, is there a way to do this?
    Thank you.
    Marcos

    jverd wrote:
    marcos_aps wrote:
    abillconsl wrote:
    Can you be more specific - IOW, can you cite a specific case?Absolutely. I want to access the jar in source code with the java.util.zip.JarFile class, for example.But why? You still haven't provided a use case or explained what you're trying to accomplish. As already pointed out, whatever you're trying to do, this is a brittle solution. If you explain what you're trying to accomplish with this, somebody may be able to suggest a better approach.jverd, I explained for baftos. Anyway, I will try to be more specific. I start my sytem like this, from, say, for example, jar1.jar:
    import br.product.System;
    public static void main(String[] args)
        System.start("NameOfTheSystem");
    }The System class is in util.jar, for example. This jar is used by all systems. I wouldn't like to pass in the name of the system, as above. I would like that the System class could read it from jar1.jar's manifest file. I just would like to have this:
    import br.product.System;
    public static void main(String[] args)
        System.start();
    }It is more elegant and I don't have the name of the system in two places: code and manifest file.
    Marcos

  • Problem in generic value copier class / reflection and generic classes

    Hello experts,
    I try to archive the following and am struggling for quite some time now. Can someone please give an assessment if this is possible:
    I am trying to write a generic data copy method. It searches for all (parameterless) getter methods in the source object that have a corresponding setter method (with same name but prefixed by "set" instead of "get" and with exactly one parameter) in the destination object.
    For each pair I found I do the following: If the param of the setter type (T2) is assignable from the return type of the getter (T1), I just assign the value. If the types are not compatible, I want to instantiate a new instance of T2, assign it via the setter, and invoke copyData recursively on the object I get from the getter (as source) and the newly created instance (as destination). The assumption is here, that the occurring source and destination objects are incompatible but have matching getter and setter names and at the leaves of the object tree, the types of the getters and setters are compatible so that the recursion ends.
    The core of the problem I am struggling with is the step where I instantiate the new destination object. If T2 is a non-generic type, this is straightforward. However, imagine T1 and T2 are parametrized collections: T1 is List<T3> and T2 is List<T4>. Then I need special handling of the collection. I can easily iterate over the elements of the source List and get the types of the elements, but I can not instantiate only a generic version of the destinatino List. Further I cannot create elements of T4 and add it to the list of T2 and go into recursion, since the information that the inner type of the destination list is T4 is not available at run-time.
    public class Source {
       T1 getA();
       setA(T1 x);
    public class Dest {
       T2 getA();
       setA(T2 x);
    public class BeanDataCopier {
       public static void copyData(Object source, Object destination) {
          for (Method getterMethod : sourceGetterMethods) {
             ... // find matching getter and setter names
             Class sourceParamT = [class of return value of the getter];
             Class destParamT = [class of single param of the setter];
             // special handling for collections -  I could use some help here
             // if types are not compatible
             Object destParam = destination.getClass().newInstance();
             Object sourceParam = source.[invoke getter method];
             copyData(sourceParam, destParam);
    // usage of the method
    Souce s = new Source(); // this is an example, I do not know the type of s at copying time
    Dest d = new Dest(); // the same is true for d
    // initialize s in a complicated way (actually JAX-B does this)
    // copy values of s to d
    BeanDataCopier.copyData(s, d);
    // now d should have copied values from s Can you provide me with any alternative approaches to implement this "duck typing" behaviour on copying properties?
    Best regards,
    Patrik
    PS: You might have guessed my overall use case: I am sending an object tree over a web service. On the server side, the web service operation has a deeply nested object structure as the return type. On the client side, these resulting object tree has instances not of the original classes, but of client classes generated by axis. The original and generated classes are of different types but have the identically named getter and setter methods (which again have incompatible parameter types that however have consistent names). On the client side, I want to simply create an object of the original class and have the values of the client object (including the whole object tree) copied into it.
    Edited by: Patrik_Spiess on Sep 3, 2008 5:09 AM

    As I understand your use case this is already supported by Axis with beanMapping [http://ws.apache.org/axis/java/user-guide.html#EncodingYourBeansTheBeanSerializer]
    - Roy

  • Problems using different tables for base class and derived class

    I have a class named SuperProject and another class Project derived from
    it. If I let SchemaTool generate the tables without specifying a "table"
    extension, I get a single TABLE with all the columns from both classes and
    everything works fine. But if I specify a "table" for the derived class,
    SchemaTool generates the derived class with just one column (corresponds
    to the attribute in derived class). Also it causes problems in using the
    Project class in collection attributes.
    JDO file:
    <jdo>
    <package name="jdo">
    <class name="Project" identity-type="application"
    persistence-capable-superclass="SuperProject">
    <extension vendor-name="kodo" key="table" value="PROJECT"/>
    </class>
    <class name="SuperProject" identity-type="application"
    objectid-class="ProjectId">
    <field name="id" primary-key="true"/>
    </class>
    </package>
    </jdo>
    java classes:
    public class Project extends SuperProject
    String projectSpecific
    public class SuperProject
    BigDecimal id;
    String name;
    tables generated by SchemaTool:
    TABLE SUPERPROJECTSX (IDX, JDOCLASSX, JDOLOCKX, NAMEX);
    TABLE PROJECT(PROJECTSPECIFICX)
    Thanks,
    Justine Thomas

    Justine,
    This will be resolved in 2.3.4, to be released later this evening.
    -Patrick
    In article <aofo2q$mih$[email protected]>, Justine Thomas wrote:
    I have a class named SuperProject and another class Project derived from
    it. If I let SchemaTool generate the tables without specifying a "table"
    extension, I get a single TABLE with all the columns from both classes and
    everything works fine. But if I specify a "table" for the derived class,
    SchemaTool generates the derived class with just one column (corresponds
    to the attribute in derived class). Also it causes problems in using the
    Project class in collection attributes.
    JDO file:
    <jdo>
    <package name="jdo">
    <class name="Project" identity-type="application"
    persistence-capable-superclass="SuperProject">
    <extension vendor-name="kodo" key="table" value="PROJECT"/>
    </class>
    <class name="SuperProject" identity-type="application"
    objectid-class="ProjectId">
    <field name="id" primary-key="true"/>
    </class>
    </package>
    </jdo>
    java classes:
    public class Project extends SuperProject
    String projectSpecific
    public class SuperProject
    BigDecimal id;
    String name;
    tables generated by SchemaTool:
    TABLE SUPERPROJECTSX (IDX, JDOCLASSX, JDOLOCKX, NAMEX);
    TABLE PROJECT(PROJECTSPECIFICX)
    Thanks,
    Justine Thomas
    Patrick Linskey [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • Batch Capture Changes Media Start, End, and Duration

    Hello all... For some reason, when I batch capture from an imported batch list in FCP 4.5, the program changes the media start, end, and duration just slightly once the capture has completed. Does anyone know why this might be occurring?

    OK... I don't believe it has to do with drop frame or non-drop frame issues, and here's why... I ran a series of tests.
    The footage was originally shot with two cameras, an A Cam and a B Cam, which were Jam Synced together. The original A Cam tapes were log and captured normally. But for the B Cam tapes, we exported a batch list to excel, performed a rename function where _B was added to all file names and reel names, and brought the data back into FCP by importing a Batch List at 29.97.
    For the tests, I experimented with only one clip. First, I noted the timecode for the media start and media end when the file was uncaptured. Next, I placed the A Cam Tape in the deck and did a batch capture on the one clip. The program changed the media start and end times upon hitting ok. Here were the results of the first test:
    LOGGED: MS (05:50:39:26) ME (05:51:41:01)
    CAPTURED A CAM: MS (05:50:39:17) ME (05:51:41:07)
    Then, I undid the capture so that the timecode would revert back to the precaptured state. I placed the B Cam tape in the deck and ran the capture again, on the same clip, in Batch Capture mode. The program changes the media start and end yet again, but this time, changed it in a different way:
    LOGGED: MS (05:50:39:26) ME (05:51:41:01)
    CAPTURED B CAM 1st Attempt: MS (05:50:39:16) ME (05:51:41:06)
    So then I undid the capture again to revert back to the logged settings, and put the EXACT same tape in the deck, and ran the batch capture in exactly the same way. This time however, FCP didn't change anything. It logged the clip correctly. I tried it yet again, in the same way, and it did it perfectly again:
    LOGGED: MS (05:50:39:26) ME (05:51:41:01)
    CAPTURED B CAM 2nd Attempt: MS (05:50:39:26) ME (05:51:41:01)
    CAPTURED B CAM 3rd Attempt: MS (05:50:39:26) ME (05:51:41:01)
    So I ask again... what is up with FCP 4.5?

  • Data class and Delivery class in ABAP Dictionary

    Hi all,
    I want to know the exact information about Data class and Delivery class in ABAP Dictionary
    Moderator message : Search for available information. Thread locked.
    Edited by: Vinod Kumar on Aug 3, 2011 1:35 PM

    As your name Suggests, there were exactly 21 rajapandian already who wanted exact information about  Data class and Delivery class. Fortunately some has found the information by own and some were dumped by SAP Police.
    Cheers
    Amit

  • BOR Object and ABAP Class

    Hi,
        Can anybody say when to use BOR object and Abap class in the task with an example.
    Thanks,
    Mugundhan

    There is no any specific condition or rule that for this purpose you need to use BOR and Class , it depends on your requirement. not only the requirement but also the new techniques to make classes not just as simple way to create objects but when you use classes in the Workflows they are not simple classes but they are BUSINESS CLASSES which makes a lot of difference.
    Check the blogs of [Jocelyn Dart|https://www.sdn.sap.com/irj/scn/wiki?path=/pages/viewpage.action%3fpageid=55566]

  • Difference between narrow() method usage and simple class cast for EJB

    Hi,
    I have a very simple question:
    what is the difference between PortableRemoteObject.narrow(fromObj,
    toClass) method usage and simple class cast for EJB.
    For example,
    1)
    EJBObject ejbObj;
    // somewhere in the code the home.create() called for bean ...
    ABean a = (ABean)PortableRemoteObject.narrow(ejbObj,ABean.class);
    OR
    2)
    EJBObject bean;
    // somewhere in the code the home.create() called for bean ...
    ABean a = (ABean)ejbObj;
    Which one is better?
    P.S. I'm working with WL 6.1 sp2
    Any help would be appreciated.
    Thanks in advance,
    Orly

    [email protected] (Orly) writes:
    Hi,
    I have a very simple question:
    what is the difference between PortableRemoteObject.narrow(fromObj,
    toClass) method usage and simple class cast for EJB.
    For example,
    1)
    EJBObject ejbObj;
    // somewhere in the code the home.create() called for bean ...
    ABean a = (ABean)PortableRemoteObject.narrow(ejbObj,ABean.class);
    OR
    2)
    EJBObject bean;
    // somewhere in the code the home.create() called for bean ...
    ABean a = (ABean)ejbObj;
    Which one is better?(1) is mandated by the spec. It is required because CORBA systems may
    not have sufficient type information available to do a simple case.
    P.S. I'm working with WL 6.1 sp2 You should always use PRO.narrow()
    andy

  • [svn:bz-trunk] 22429: Adding the default fallback of serializer and deserializer classes to amf deserializer and amf serializer

    Revision: 22429
    Revision: 22429
    Author:   [email protected]
    Date:     2011-09-07 08:04:46 -0700 (Wed, 07 Sep 2011)
    Log Message:
    Adding the default fallback of serializer and deserializer classes to amf deserializer and amf serializer
    Modified Paths:
        blazeds/trunk/modules/core/src/flex/messaging/io/SerializationContext.java

  • Problem in file association and main-class in JWS

    Hello , all
    I have a problem in JWS with file association and main-class. I have a java application that has two entry classes, one is appmain.class that is required to launch from web, and the other is player.class that is required to launch when user double-click the .abc extension file.
    In JWS 5.0+, there is a association element in JNLP syntax that can be used to make the file association with .abc extension. But how can I declare the main-class in JNLP file?
    If I declare the application-desc element as <application-desc main-class="player">, the player.class will be launched from web. But if I declare it as <application-desc main-class="appmain">, the .abc extension wil be associated to the appmain.class.
    Does anyone know how to solve this problem? Thank you for your kindly help.

    One way is to define a third main that refers
    to the other two, as appropriate. E.G. if the
    web based main does not include -open as
    its arguments, it is easy.class WebStartSpringboard {
      /** Call web based main unless args include -open. */
      public static void main(String[] args) {
        if (args[0].equals("-open") ) {
          OpenFileBasedClass.main(args);
        } else {
          WebBasedClass.main(args);
    }Other measures might be taken for a situation
    where the web based version does include a
    -open argument.

Maybe you are looking for