Re: [osgi-dev] Loading dynamically generated classes

2012-03-19 Thread chris . gray
Justin,

 Why does this design require that these classes be exported? As long as the
 bundle registering them as services has access to the dynamic classes,
no
 other bundle needs to.

That is correct, and the recipient of a proxy service objects have no
legitimate interest in its implementation; it should be happy that it
implements the interface they want and has whatever properties were
specified in the filter (if any).

But before we can create any proxy instance, the class needs to exist
which means that some ClassLoader somewhere has to call defineClass().  Or
am I missing something?

 Alternatively, you could register a special Classloader as a service
which
 could be used to load them.

Hm, that doesn't smell too good (creating custom ClassLoaders in an OSGi
system), but it might work.  Need to examine that more closely.

Thx

Chris

 Justin

 On Sun, Mar 18, 2012 at 5:07 PM, chris.g...@k-embedded-java.com wrote:

 Hello all,
 I am working on a design which involves generating new classes at runtime,
 so that afterwards I can create one or more instances which will be
registered as services.  Generating the class files (or byte arrays)
goes
 fine, introducing them into the environment is less obvious; I need to
somehow persuade some bundle classloader to read in my hand-crafted
bytes
 and pass them to defineClass().  The best I have been able to come up with
 so far is to wrap up the generated class in a bundle fragment and ask the
 framework to install this - which seems a little baroque, so I am just
wondering if there is some API I've missed which would do this more
naturally?
 If I wanted to modify the original class I could of course use weaving
hooks, but I would really prefer to create a new class.
 Thanks,
 Chris
 ___
 OSGi Developer Mail List
 osgi-dev@mail.osgi.org
 https://mail.osgi.org/mailman/listinfo/osgi-dev
 ___
 OSGi Developer Mail List
 osgi-dev@mail.osgi.org
 https://mail.osgi.org/mailman/listinfo/osgi-dev




___
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev


Re: [osgi-dev] Loading dynamically generated classes

2012-03-19 Thread David Kemper
The bundle that registers the service could create this custom class loader 
with its bundle class loader as its parent, and with appropriate imports for 
that bundle the custom class loader would be able to resolve external 
references in your bag of class bytes. This would include the import of the 
package that holds your service interface. The life cycle of the class loader 
and the service registration would be tied to the life cycle of this 
implementation bundle.

In this way your creation of a custom class loader is simply an 
implementation detail of your bundle. If you're going to be materializing a bag 
of bytes into a class, you're going to need a class loader *somewhere*, so 
you're not *adding* any additional smell. ;-)

/djk

On Mar 19, 2012, at 5:02 AM, chris.g...@k-embedded-java.com
 wrote:

 Hm, that doesn't smell too good (creating custom ClassLoaders in an OSGi
 system), but it might work.  Need to examine that more closely.


___
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev


[osgi-dev] run JavaFx and Fxml in OSGI

2012-03-19 Thread Filipe Portes
hello,

I'm working to run javafx in the Apache felix osgi runtime,
using Bundle-NativeCode and lots of Import/Export-Package I make an javafx
bundle, that work properly to run javaFx interfaces write in plain java...
but, when I try to load an fxml file I'm getting this issue:

javafx.fxml.LoadException: BorderPane is not a valid type.
at javafx.fxml.FXMLLoader.createElement(Unknown Source)
at javafx.fxml.FXMLLoader.processStartElement(Unknown Source)
at javafx.fxml.FXMLLoader.load(Unknown Source)



the exception give me no more information... I think, It's occuring some
problem to find BorderPane class by It's name...

ps.: the same fxml file run fine outside the osgi runtime.

best regards.

-- 
Filipe Portes - @filipeportes
Java Architec - Senior Java EE/Web/Flex Developer
JUGLeader Gojava http://www.gojava.org/ - @gojava
___
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Re: [osgi-dev] run JavaFx and Fxml in OSGI

2012-03-19 Thread Filipe Portes
I'm already saw this post,

I can't understand what he is doing, there's no doc and reading the code I
just found a lot of eclipse rcp specific code.

On Mon, Mar 19, 2012 at 11:14 AM, Ferry Huberts maili...@hupie.com wrote:

  you might want to checkout Tom Schindl's blog:
 http://tomsondev.bestsolution.at/2012/03/11/javafx2-and-osgi-deployment-model/


 On 19-03-12 15:07, Filipe Portes wrote:

 hello,

 I'm working to run javafx in the Apache felix osgi runtime,
 using Bundle-NativeCode and lots of Import/Export-Package I make an javafx
 bundle, that work properly to run javaFx interfaces write in plain java...
 but, when I try to load an fxml file I'm getting this issue:

 javafx.fxml.LoadException: BorderPane is not a valid type.
   at javafx.fxml.FXMLLoader.createElement(Unknown Source)
   at javafx.fxml.FXMLLoader.processStartElement(Unknown Source)
   at javafx.fxml.FXMLLoader.load(Unknown Source)



 the exception give me no more information... I think, It's occuring some
 problem to find BorderPane class by It's name...

  ps.: the same fxml file run fine outside the osgi runtime.

 best regards.

  --
 Filipe Portes - @filipeportes
 Java Architec - Senior Java EE/Web/Flex Developer
 JUGLeader Gojava http://www.gojava.org/ - @gojava


 ___
 OSGi Developer Mail 
 listosgi-...@mail.osgi.orghttps://mail.osgi.org/mailman/listinfo/osgi-dev


 --
 Ferry Huberts




-- 
Filipe Portes - @filipeportes
Java Architec - Senior Java EE/Web/Flex Developer
JUGLeader Gojava http://www.gojava.org/ - @gojava
___
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Re: [osgi-dev] run JavaFx and Fxml in OSGI

2012-03-19 Thread Ferry Huberts
you might want to checkout Tom Schindl's blog: 
http://tomsondev.bestsolution.at/2012/03/11/javafx2-and-osgi-deployment-model/


On 19-03-12 15:07, Filipe Portes wrote:

hello,

I'm working to run javafx in the Apache felix osgi runtime,
using Bundle-NativeCode and lots of Import/Export-Package I make an 
javafx bundle, that work properly to run javaFx interfaces write in 
plain java...

but, when I try to load an fxml file I'm getting this issue:

|javafx.fxml.LoadException: BorderPane is not a valid type.
at javafx.fxml.FXMLLoader.createElement(Unknown Source)
at javafx.fxml.FXMLLoader.processStartElement(Unknown Source)
at javafx.fxml.FXMLLoader.load(Unknown Source)
|


the exception give me no more information... I think, It's occuring 
some problem to find BorderPane class by It's name...


ps.: the same fxml file run fine outside the osgi runtime.

best regards.

--
Filipe Portes - @filipeportes
Java Architec - Senior Java EE/Web/Flex Developer
JUGLeader Gojava http://www.gojava.org/ - @gojava


___
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev


--
Ferry Huberts

___
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev