To bring this thread full circle  (apologies for all of the detours into
the build environment setup),  I think this "issue" of not preserving the
LDAP hierarchical order can be addressed by changing only a few lines of
the base LSC code (although I've now built the plugin - how's that for
irony?).

In org.lsc.jndi.JndiServices.getAttrsList(),  by simply changing this
HashMap

      Map<String, LscDatasets> res = new HashMap<String, LscDatasets>();

to a LinkedHashMap (
http://docs.oracle.com/javase/6/docs/api/java/util/LinkedHashMap.html)

      Map<String, LscDatasets> res = new LinkedHashMap<String,
LscDatasets>();

the insertion order of the entries is preserved (the order in which the
source directory returned them).

In my case, Active Directory was providing the objects in a top-down
sequence, as desired.  It was the HashMap returned by
IService.getListPivots() that was causing the scrambling.

Can anyone see a downside to making this change?

Hugh



On Tue, May 8, 2012 at 10:34 PM, Hugh Kelley <[email protected]> wrote:

> In addition the missing import in the .java file,  I seem to have one
> other runtime issue (after I cheat and manually insert the "import
> org.lsc.configuration.
>
>> ValuesType;" statement so that I can build).
>>
>> By default, my xjc command creates a long list of .java source files
>> (approximately 40) in addition to my settings file and ObjectFactory.java.
>>
>> If I leave them there (in the target\ . . .\ generated folder), Eclipse
>> complains:
>>
>> Two classes have the same XML type name "{
>> http://lsc-project.org/XSD/lsc-core-2.0.xsd}tasksType";. Use
>> @XmlType.name and @XmlType.namespace to assign different names to them.
>>     this problem is related to the following location:
>>         at org.lsc.configuration.TasksType
>>         at protected org.lsc.configuration.TasksType
>> org.lsc.configuration.Lsc.tasks
>>         at org.lsc.configuration.Lsc
>>         at public org.lsc.configuration.Lsc
>> org.lsc.configuration.ObjectFactory.createLsc()
>>         at org.lsc.configuration.ObjectFactory
>>     this problem is related to the following location:
>>         at com.montpeliertr.generated.TasksType
>>         at protected com.montpeliertr.generated.TasksType
>> com.montpeliertr.generated.Lsc.tasks
>>         at com.montpeliertr.generated.Lsc
>>         at public com.montpeliertr.generated.Lsc
>> com.montpeliertr.generated.ObjectFactory.createLsc()
>>         at com.montpeliertr.generated.ObjectFactory
>>
>> If I remove all but the critical two, I get something like this:
>>
>> Caused by: java.lang.ClassNotFoundException:
>> com.montpeliertr.generated.MultiDestinationServiceType
>>
>> Do these sound familiar?
>>
>>
>> Hugh
>>
>>
>
> On Tue, May 8, 2012 at 5:08 PM, Hugh Kelley <[email protected]> wrote:
>
>> I know this isn't a JAXB forum so I apologize in advance for taking this
>> thread a bit off-topic.
>>
>> I am using this XSD:
>>
>> <?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";
>>             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:import namespace="http://lsc-project.org/XSD/lsc-core-2.0.xsd";
>> />
>>
>>        <xsd:element name="HierarchicalJndiSrcServiceSettings">
>>         <xsd:complexType>
>>             <xsd:sequence>
>>                 <xsd:element name="baseDn" type="xsd:string" />
>>                 <xsd:element name="getAllFilter" type="xsd:string" />
>>                 <xsd:element name="getOneFilter" type="xsd:string" />
>>                 <xsd:element name="cleanFilter" type="xsd:string" />
>>                 <xsd:element name="pivotAttributes" type="lsc:valuesType"
>> minOccurs="1" />
>>                 <xsd:element name="fetchedAttributes"
>> type="lsc:valuesType" minOccurs="1" />
>>             </xsd:sequence>
>>         </xsd:complexType>
>>        </xsd:element>
>>
>> </xsd:schema>
>>
>>
>> It is converting to a .java file without error, but the lsc:valuesType
>> elements are not being mapped to org.lsc.configuration.ValuesType in the
>> .java file (the import org.lsc.configuration.ValuesType;  directive is not
>> in the file).   I can add it manually, but that feels like cheating.
>>
>> Is there a hint I need to provide xjc to let it know which Java packages
>> to import?
>>
>> Hugh
>>
>>
>>
>>
>> On Tue, May 8, 2012 at 1:54 AM, Sébastien Bahloul <
>> [email protected]> wrote:
>>
>>> Hi Hugh,
>>>
>>> You are completely right, it's managed by the generated classes:
>>>
>>>
>>> https://lsc-project.org/svn/lsc-samples/lsc-embeddable-sample/trunk/src/main/java/com/foo/bar/generated/FooBarServiceSettings.java
>>>
>>> Regards,
>>>
>>> --
>>> Sebastien BAHLOUL
>>> IAM / Security specialist
>>> Ldap Synchronization Connector : http://lsc-project.org
>>> Blog : http://sbahloul.wordpress.com/
>>>
>>>
>>>
>>> 2012/5/7 Hugh Kelley <[email protected]>
>>>
>>>> One more conceptual question (again, revealing my unfamiliarity with
>>>> JAXB):
>>>>
>>>> In lsc.xml you are using the foobar XML namespace for your
>>>> plugin-specific elements (
>>>> https://lsc-project.org/svn/lsc-samples/lsc-embeddable-sample/trunk/src/main/resources/etc/lsc.xml
>>>> ).
>>>>
>>>>    <foobar:fooBarServiceSettings>
>>>>
>>>> Where are you telling the parser to use that namespace when it
>>>> validates the configuration?   I don't see any namespace specification
>>>> happening here (
>>>> https://lsc-project.org/svn/lsc-samples/lsc-embeddable-sample/trunk/src/main/java/com/foo/bar/FooBarLscService.java
>>>> ):
>>>>
>>>>   serviceSettings = (FooBarServiceSettings) 
>>>> task.getPluginDestinationService().getAny().get(0);
>>>>
>>>>
>>>> Hugh
>>>>
>>>>
>>>> On Thu, May 3, 2012 at 8:33 AM, Sébastien Bahloul <
>>>> [email protected]> wrote:
>>>>
>>>>> I've just added it to the following page :
>>>>> http://lsc-project.org/wiki/documentation/2.0/development/addingplugin
>>>>>
>>>>>
>>>>>    - Copy the XSD to your etc subdirectory (required to check the XML
>>>>>     structure)
>>>>>    - Run it with flag -DLSC.PLUGINS.PACKAGEPATH=com.foo.bar.generated
>>>>>    (so that JAXB parser could find the extended classes)
>>>>>
>>>>> --
>>>>> Sebastien BAHLOUL
>>>>> IAM / Security specialist
>>>>> Ldap Synchronization Connector : http://lsc-project.org
>>>>> Blog : http://sbahloul.wordpress.com/
>>>>>
>>>>>
>>>>>
>>>>> 2012/5/3 Sébastien Bahloul <[email protected]>
>>>>>
>>>>>> Hi Hugh,
>>>>>>
>>>>>> I need to add:
>>>>>>
>>>>>> Use -DLSC.PLUGINS.PACKAGEPATH=com.montpeliertr.lscplugins.generated
>>>>>>
>>>>>> where com.montpelietr.lscplugins.generated should contain the xjc
>>>>>> generated classes and especially the ObjectFactory class.
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> --
>>>>>> Sebastien BAHLOUL
>>>>>> IAM / Security specialist
>>>>>> Ldap Synchronization Connector : http://lsc-project.org
>>>>>> Blog : http://sbahloul.wordpress.com/
>>>>>>
>>>>>>
>>>>>>
>>>>>> 2012/5/3 Sébastien Bahloul <[email protected]>
>>>>>>
>>>>>>> Hi Hugh,
>>>>>>>
>>>>>>> This is a runtime setting : you need to define it when you launch
>>>>>>> your JRE java command line or instead the VM Arguments zone inside the
>>>>>>> Arguments tab of your Debug configuration. This is quite complex but
>>>>>>> strictly required  by the XML parser to support on-the-fly extension.
>>>>>>>
>>>>>>> Regards,
>>>>>>> --
>>>>>>> Sebastien BAHLOUL
>>>>>>> IAM / Security specialist
>>>>>>> Ldap Synchronization Connector : http://lsc-project.org
>>>>>>> Blog : http://sbahloul.wordpress.com/
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> 2012/5/3 Hugh Kelley <[email protected]>
>>>>>>>
>>>>>>>>  I've stepped through the code a bit and I'm making some
>>>>>>>> progress.   This particular block of code is being skipped.
>>>>>>>>
>>>>>>>>                 if(System.getProperty("LSC.PLUGINS.PACKAGEPATH") !=
>>>>>>>> null) {
>>>>>>>>                     String[] pathElements =
>>>>>>>> System.getProperty("LSC.PLUGINS.PACKAGEPATH").split(System.getProperty("path.separator"));
>>>>>>>>                     for(String pathElement: pathElements) {
>>>>>>>>
>>>>>>>> urls.addAll(ClasspathHelper.forPackage(pathElement));
>>>>>>>>                     }
>>>>>>>>                 }
>>>>>>>>
>>>>>>>> I'm guessing that has something to do with this:
>>>>>>>>
>>>>>>>>
>>>>>>>> org.lsc.exception.LscConfigurationException:
>>>>>>>> java.lang.UnsupportedOperationException: Unknown plugin implementation:
>>>>>>>> com.montpeliertr.lscplugins.SortedLdapSourceService
>>>>>>>>
>>>>>>>> How do I set LSC.PLUGINS.PACKAGEPATH ?   I didn't see a reference
>>>>>>>> to it in the
>>>>>>>> https://lsc-project.org/svn/lsc-samples/lsc-embeddable-sample/trunk/src/main/resources/etc/lsc.xmlexample.
>>>>>>>>
>>>>>>>> Hugh
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Tue, May 1, 2012 at 7:18 AM, Hugh Kelley 
>>>>>>>> <[email protected]>wrote:
>>>>>>>>
>>>>>>>>> Many thanks for your continued help with this.
>>>>>>>>>
>>>>>>>>> I am trying to implement the steps you gave me but am clearly
>>>>>>>>> going astray somewhere.  I have the following three files (attached). 
>>>>>>>>>  The
>>>>>>>>> plugin class is by no means final, but I wanted to make sure I had the
>>>>>>>>> configuration "wiring" correct, then finish the logic.
>>>>>>>>>
>>>>>>>>> I have put my plugin code in a jar and it appears to be added to
>>>>>>>>> the classpath.
>>>>>>>>>
>>>>>>>>> Adding
>>>>>>>>> C:\_Active\LSC\lsc-2.0rc2\bin\..\lib\mina-core-2.0.0-RC1.jar to 
>>>>>>>>> classpath
>>>>>>>>> *Adding
>>>>>>>>> C:\_Active\LSC\lsc-2.0rc2\bin\..\lib\montpeliertr-sortedldap.jar to
>>>>>>>>> classpath*
>>>>>>>>> Adding C:\_Active\LSC\lsc-2.0rc2\bin\..\lib\ocutil-2.5.2.jar to
>>>>>>>>> classpath
>>>>>>>>>
>>>>>>>>> but when the configuration engine goes to load the plugin, it can
>>>>>>>>> not/will not:
>>>>>>>>>
>>>>>>>>> [Loaded javax.naming.directory.Attribute from
>>>>>>>>> C:\_SDKs\Java\jdk1.6.0_30\jre\lib\rt.jar]
>>>>>>>>> May 01 07:13:27 - ERROR -
>>>>>>>>> org.lsc.exception.LscConfigurationException:
>>>>>>>>> java.lang.UnsupportedOperationException: Unknown plugin 
>>>>>>>>> implementation:
>>>>>>>>> com.montpeliertr.lscplugins.SortedLdapSourceService
>>>>>>>>> [Loaded ch.qos.logback.classic.spi.ThrowableProxy from
>>>>>>>>> file:/C:/_Active/LSC/lsc-2.0rc2/lib/logback-classic-0.9.21.jar]
>>>>>>>>>
>>>>>>>>> I would just step through the execution myself, but I still can't
>>>>>>>>> get past the slf4j-api runtime issue I mentioned on the other thread.
>>>>>>>>>
>>>>>>>>> Any suggestions are appreciated,
>>>>>>>>>
>>>>>>>>> Hugh
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Fri, Apr 27, 2012 at 11:28 AM, Sébastien Bahloul <
>>>>>>>>> [email protected]> wrote:
>>>>>>>>>
>>>>>>>>>> Hi Hugh,
>>>>>>>>>>
>>>>>>>>>> To configure and use a new service, please consider the
>>>>>>>>>> FooBarLscService sample as decribed below. This fake service has been
>>>>>>>>>> designed as an extension of a SimpleJdbcDestinationService to 
>>>>>>>>>> describe an
>>>>>>>>>> embeddable LSC :
>>>>>>>>>>
>>>>>>>>>> 1. First define the configuration extension format:
>>>>>>>>>>
>>>>>>>>>> https://lsc-project.org/svn/lsc-samples/lsc-embeddable-sample/trunk/src/main/resources/etc/foobar-lsc-1.0.xsd
>>>>>>>>>>
>>>>>>>>>> 2. Generate the corresponding source  :
>>>>>>>>>>
>>>>>>>>>> $JAVA_HOME/bin/xjc -p com.foo.bar.generated
>>>>>>>>>> src/main/resources/etc/foobar-lsc-1.0.xsd
>>>>>>>>>>
>>>>>>>>>> 3. Use it inside the  service itself:
>>>>>>>>>> https://lsc-project.org/svn/lsc-samples/lsc-embeddable-sample/trunk/src/main/java/com/foo/bar/FooBarLscService.java
>>>>>>>>>>  (see
>>>>>>>>>> the constructor)
>>>>>>>>>>
>>>>>>>>>> 4. Configure it :
>>>>>>>>>> https://lsc-project.org/svn/lsc-samples/lsc-embeddable-sample/trunk/src/main/resources/etc/lsc.xml
>>>>>>>>>>  (look
>>>>>>>>>> at the pluginDestinationService node)
>>>>>>>>>>
>>>>>>>>>> Regards,
>>>>>>>>>> --
>>>>>>>>>> Sebastien BAHLOUL
>>>>>>>>>> IAM / Security specialist
>>>>>>>>>> Ldap Synchronization Connector : http://lsc-project.org
>>>>>>>>>> Blog : http://sbahloul.wordpress.com/
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________________________
>>>>>>>> Ldap Synchronization Connector (LSC) - http://lsc-project.org
>>>>>>>>
>>>>>>>> lsc-users mailing list
>>>>>>>> [email protected]
>>>>>>>> http://lists.lsc-project.org/listinfo/lsc-users
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
_______________________________________________________________
Ldap Synchronization Connector (LSC) - http://lsc-project.org

lsc-users mailing list
[email protected]
http://lists.lsc-project.org/listinfo/lsc-users

Reply via email to