You don't need to know anything about the static Java class. All you need
to know is the type name. You can then get the type and create the instance
like this:

      Type type = scope.getTypeHelper().getType("http://blablaURI";,
"blablaType");
      DataObject obj = scope.getDataFactory().create(type);

Alternatively, you can just call the other convenient create() method:

      DataObject obj = scope.getDataFactory().create("http://blablaURI";,
"blablaType");

If there is no static Java class then the returned obj will be an instance
of DynamicDataObjectImp:

      assertTrue(obj instanceof DynamicDataObjectImpl);

If there is a static implementation class, then it will be used:

      assertTrue(obj instanceof BlaBlaImpl);

Frank.

"Millies, Sebastian" <[email protected]> wrote on 10/06/2010
12:57:19 PM:

> [image removed]
>
> FW: [SDO] Samples for notification feature / register ?
>
> Millies, Sebastian
>
> to:
>
> user
>
> 10/06/2010 01:03 PM
>
> Please respond to user
>
> I think what I do not understand is just how to use the ?ordinary?
> factory to create instances of static data objects without static
> knowledge of the generated classes.
>
> I think my confusion stems from the call scope.getDataFactory(type).
> This calls the ?ordinary? factory, but  in order to supply the
> type argument, I?d need something like
> GeneratedFactory.INSTANCE.getBlablaType(), which
> would obviously presuppose static knowledge of the generated
> Java classes.
>
> --  Sebastian
>
>
> From: Frank Budinsky [mailto:[email protected]]
> Sent: Wednesday, October 06, 2010 2:31 PM
> To: [email protected]
> Subject: Re: FW: [SDO] Samples for notification feature / register ?
>
> I'm not sure I really understand what you're asking.
>
> There are 2 factories in the picture. The generated Factory that
> only knows how to create instances of the static SDO types, and the
> "ordinary" SDO DataFactory, that can be used to create instances of
> any type (static or dynamic). The second one is used in code that
> doesn't have static knowledge of the generated Java classes (for
> example, the loader).
>
> Frank.
>
>  "Millies, Sebastian" ---10/05/2010 01:54:26 PM---Hello Frank,
>
> From:
> "Millies, Sebastian" <[email protected]>
>
>
> To:
> <[email protected]>
>
>
> Date:
> 10/05/2010 01:54 PM
>
> Subject:
> FW: [SDO] Samples for notification feature / register ?
> ________________________________________
>
>
>
> Hello Frank,
>
> I am not sure I understand.
>
> I can call register(HelperContext) only after loading the factory class
> and obtaining an instance. For example, I could modify the static
> init() method
> to call instance.register(getScopeFromSomewhere()). Afterwards I could
call
> scope.getDataFactory(type) and so on.
>
> But what would be the purpose of obtaining a data factory in such a
> roundabout
> way? If I have to obtain an instance of the factory for the type in
> the first place,
> why should I not always use factory.create() directly?
>
> --   Sebastian
>
> From: Frank Budinsky [mailto:[email protected]]
> Sent: Tuesday, October 05, 2010 4:31 PM
> To: [email protected]
> Subject: Re: [SDO] Samples for notification feature / register ?
> [snip]
> For your second question, Factory.register() is used to define types
> with static implementation classes. Load from XSD is used for
> dynamic SDO types.
>
> Frank

Reply via email to