Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [e4-dev] Model workbench + XWT for e4 photo demo

Yves,

It should load fine.  Consider this type of issue as well though (from EClassifierImpl):
  /**
   * Returns the <code>Class</code> object associated with the class or interface with the given name, as from a {@link
   * java.lang.Class#forName(String)} call; however, if this classifier belongs to a package, that package's class loader is
   * used. Since the package may be model-specific code in another plug-in, its class loader may be able to see classes
   * that Ecore's can't.
   */
  protected Class<?> getClassForName(String name) throws ClassNotFoundException
  {
    EPackage p = getEPackage();
    return p != null ? Class.forName(name, true, p.getClass().getClassLoader()) : Class.forName(name);
  }
I.e., keep in mind that it's highly significant what library the Class.forName call itself is in.   If it's in a utility library bundle, it won't see class in other bundles, unless you use a buddy class loading scheme.

Probably you need to provide a little more detail about the bundles and code involved than you have so far.

Cheers,
Ed


Yves YANG wrote:
My class is in the same bundle as e4 photo project. I have looked at the
model workbench. It seems there are more DefaultClassLoaders of OSGi are
created. 

Best regards
Yves YANG
Soyatec - Eclipse OutSourcing & XAML for java
http://www.soyatec.com
Tel: +33 1 60 13 06 67
Mobile: +33 6 20 74 39 45
Fax: +33 9 58 07 06 67
-----Original Message-----
From: e4-dev-bounces@xxxxxxxxxxx [mailto:e4-dev-bounces@xxxxxxxxxxx] On
Behalf Of Tom Schindl
Sent: Sunday, January 11, 2009 7:16 PM
To: E4 Project developer mailing list
Subject: Re: [e4-dev] Model workbench + XWT for e4 photo demo

Hi Yves,


Which bundle is the "Libary"-Class in and which one is your
"MyClass"-Class? Do they have a dependency?
If not this looks like standard OSGi-Behavior not? If the the bundle has
no dependency on the bundle the class is in you can't load it using
Class.forName().

If you know the bundle defining the class you could potentially use
Platform.getBundle("").loadClass("") but that's really a hack another
not very clean work-around is to use Buddy-ClassLoading.

Tom

Yves YANG schrieb:
  
Hi all,

 

I have looked at the possible integration of XWT with e4 photo demo. I
have noticed a problem that blocks this integration. In the Library
class, it is not possible to load a class dynamically.

            Class.forName("MyClass");

 

MyClass is defined in the project e4 phoho. Can someone help this issue?

 

Best regards

Yves YANG

Soyatec - Eclipse OutSourcing & XAML for java

http://www.soyatec.com <http://www.soyatec.com/>

Tel: +33 1 60 13 06 67

Mobile: +33 6 20 74 39 45

Fax: +33 9 58 07 06 67

 


------------------------------------------------------------------------

_______________________________________________
e4-dev mailing list
e4-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/e4-dev
    

  

Back to the top