Re: Interface generation

Martin Matula <[email protected]> Mon, 19 May 2003 18:48:28 +0200
Newsgroups gmane.comp.java.netbeans.modules.mdr.devel
Message-ID <[email protected]>
Hi,
what exceptions do you get? Can you track at least the first 3 of them 
and send the stacktraces? There may be several reasons why your code 
fails. E.g. I see that the string parameter you are passing to the XMI 
reader is a name of a file rather than its URI - that's the most obvious 
problem (you need to pass the string in URL format - try "new 
File(xmiFileName).toURL().toString()").
Also in the mapper.generate method, you can pass whole extent "ref" 
instead of "baseObject" to make sure that the interfaces for everything 
in the extent are generated.
Please post your further questions to the [email protected] mailing 
list - that list is intended for discussions about using MDR (dev@ 
mailing list is intended for discussions regarding implementation of 
MDR). Thanks.
Regards,
Martin

Proyecto CWM wrote:
> Hi,
>    We've been trying to generate the interfaces by a program, and can't 
> get it working, the test code goes as follows:
>  
>          org.netbeans.api.mdr.MDRepository repository =
>               new org.netbeans.mdr.NBMDRepositoryImpl();
>         RefPackage ref = repository.createExtent("ElXML");
>         JMIMapper mapper = JMIMapper.getDefault();
>         JMIStreamFactory streamFactory = new FileStreamFactory(new 
> File("c:/javaout"));
>         org.netbeans.api.mdr.XMIReader x= 
> org.netbeans.api.mdr.XMIReader.getDefault();
>         Collection c = x.read("d:/facultad/pgrad/xml.xml", ref);
>         Object[] arr =c.toArray();
>         RefBaseObject baseObject = (RefBaseObject)arr[0];
>         mapper.generate (streamFactory, baseObject);
>  
> We get plenty of exceptions. Does someone know what are we doing wrong?
> Maybe the problem is how to start a repository...
> Any pointer would help us us lot.
>  
> Many thanks,
> Máximo Gurméndez, Iang Yim
> CWM Repository Project (http://www.fing.edu.uy/~pgsdrcwm)