Yes, I do understand much more about JaXB than I did last week. As luck would have it, I stumbled upon solution #2 shortly after I hit "send". I'm glad to see I'm on the right path.
Once I discovered that a *.episode file can be used as a binding file (thanks to this post, http://weblogs.java.net/blog/kohsuke/archive/2006/09/separate_compil.html), I made fast progress. I had used a different episode file (from the branch), but the effect seems to be the same - and your notes will help me convert back to the trunk. xjc -p com.montpeliertr.generated -d %OUTPUT% -npa -b ..\lsc-core-2.0\target\generated-sources\xjc\META-INF\sun-jaxb.episode %INPUT% -verbose -extension Many thanks, Hugh On Thu, May 10, 2012 at 5:28 PM, Sébastien Bahloul < [email protected]> wrote: > Hi Hugh, > > First sorry because you are the first to reach this point after me so I > need to improve the corresponding documentation to avoid such step-by-step > error after error discovery process ! > > The issue you are encountering can be solved through two ways : > - the quick and dirty way : generate the classes (all of them including > those already existing inside LSC core project), and remove all that are > are not related to your schema except ObjectFactory. Open your generated > classes and organize imports (automatic resolution by Eclipse) - I used > this method and you should be able to succeed through this way quite quickly > - the smart way (to read if you are interested to understand JaXB) : as > explained by Hudson/Jenkins lead developer in his blog ( > http://weblogs.java.net/blog/2006/09/05/separate-compilation-jaxb-ri-21) > you can use episode files which are sort of catalog of XML schema entities > related to the generated classes. You will find attached the lsc episode > file for the trunk. You can regenerate it if you want through the following > command line : > > "$JAVA_HOME/bin/xjc" -d src/main/java -p org.lsc.configuration > src/main/resources/schemas/lsc-core-2.0.xsd -b > src/main/resources/schemas/lsc-core-2.0.xjc -episode lsc.episode > > Then you can use it inside your own project like that : > > xjc -p com.montpeliertr.generated -b lsc.episode > hierarchicalldap-plugin\src\main\resources\HierarchicalJndiSrcServiceSettings.xsd > -d hierarchicalldap-plugin\src\main\java -extension > > And this will generate only the required classes that you will be able to > use inside your Service initialization piece of code. > > Good luck :) > > Sebastien. > -- > Sebastien BAHLOUL > IAM / Security specialist > Ldap Synchronization Connector : http://lsc-project.org > Blog : http://sbahloul.wordpress.com/ > > > > 2012/5/10 Hugh Kelley <[email protected]> > >> Has anyone generated a usable Java source file for an LSC plugin? My xjc >> commands run cleanly enough, but don't seem to be working at runtime. >> >> What I'm doing: >> >> 1) I start with this XSD (also attached). Note that I have simplified >> this to use only xsd:string, not lsc:valuesType, while I try to work out >> these issues. >> >> <?xml version="1.0" encoding="UTF-8"?> >> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >> xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" >> xmlns:lsc="http://lsc-project.org/XSD/lsc-core-2.0.xsd" >> xmlns=" >> http://montpeliertr.com/HierarchicalJndiSrcServiceSettings-0.1" >> targetNamespace=" >> http://montpeliertr.com/HierarchicalJndiSrcServiceSettings-0.1" >> elementFormDefault="qualified" >> jaxb:version="2.0"> >> >> <xsd:import namespace="http://lsc-project.org/XSD/lsc-core-2.0.xsd" >> schemaLocation=" >> https://lsc-project.org/svn/lsc/branches/v2.0/src/main/resources/schemas/lsc-core-2.0.xsd" >> /> >> >> <xsd:element name="hierarchicalJndiSrcServiceSettings"> >> <xsd:complexType> >> <xsd:sequence> >> <!-- Order must apparently match exactly with lsc.xml. Can >> this be loosened? --> >> <xsd:element name="baseDn" type="xsd:string" /> >> <xsd:element name="pivotAttributes" type="xsd:string" >> minOccurs="1" /> >> <xsd:element name="fetchedAttributes" type="xsd:string" >> minOccurs="1" /> >> <xsd:element name="getAllFilter" type="xsd:string" /> >> <xsd:element name="getOneFilter" type="xsd:string" /> >> <xsd:element name="cleanFilter" type="xsd:string" /> >> </xsd:sequence> >> </xsd:complexType> >> </xsd:element> >> >> </xsd:schema> >> >> 2) I run this command line: >> >> xjc -p com.montpeliertr.generated >> hierarchicalldap-plugin\src\main\resources\HierarchicalJndiSrcServiceSettings.xsd >> -d hierarchicalldap-plugin\src\main\java -verbose >> >> This compiles not just my XSD, but also compiles all of the "imported" >> LSC types as well (even though they are not being used in my schema). It >> also fails to add this line to my .java file: >> >> import org.lsc.configuration.ValuesType; >> >> >> Taking it only two steps at a time, am I making an obvious so far? I >> assume that the missing import statement is indicative of a larger problem, >> and may explain why I can't ever get this to work at runtime: >> >> serviceSettings = (HierarchicalJndiSrcServiceSettings) >> task.getPluginSourceService().getAny().get(0); >> >> Any pointers are appreciated. >> >> Hugh >> >> _______________________________________________________________ >> Ldap Synchronization Connector (LSC) - http://lsc-project.org >> >> lsc-dev mailing list >> [email protected] >> http://lists.lsc-project.org/listinfo/lsc-dev >> >> >
_______________________________________________________________ Ldap Synchronization Connector (LSC) - http://lsc-project.org lsc-dev mailing list [email protected] http://lists.lsc-project.org/listinfo/lsc-dev

