Sun directory and schema enforement RRS feed

  • Question

  • One of the, er, interesting aspects of Sun directory that I've recently learned is that it does not enforce schema limitations. For example, I have a field in a Sun directory defined as "boolean" and the values are "on" or "off" (perhaps the implementor decided he was saving a lot of extra punchcards by wasting the extra 2-3 bytes to use "true" or "false" ?). I can just as easily set the attribute to "test" and Sun will happily accept and record it.


    Anyway, the point is that MIIS perceives the field to be defined as "boolean" but cannot seem to distinguish between the correct values. All values, from the MIIS perspective, are "false". I can't seem to find any way to get MIIS to change its view of these fields.


    Has anyone run into this before? Am I just out of luck (short of a redefinition of the field, and modification of dependent code?)

    Thursday, October 4, 2007 3:16 AM


  • I've only dealt with vendor-provided schemas, so not sure how our boolean attributes are defined.


    The only way around it I see is to either start using "true" and "false" or change the schema of the attribute so MIIS sees it as a string attribute.

    Monday, October 8, 2007 3:33 PM

All replies

  • Not sure the low-level details of the Sun APIs, but if the implementor is putting "on" and "off" in a boolean when it should be "true" or "false", I'm going to speculate that is why MIIS can't interpret the values correctly.


    However, I'm looking at the Sun MA I have locally, and we do have one attribute that is "boolean" but MIIS lists it as a string attribute.  Have you tried accessing the attribute using .Value or .StringValue?  That may return the "on" and "off" strings you need.

    Thursday, October 4, 2007 1:54 PM
  • Yeah, I ran into this:




    ...after you mentioned the MA interpreting it as a string.  It looks like the schema allows these values and MIIS inteprets it as a string because of that.  This means that you'd need to perform a type safe conversion in a rules extension if you wanted it to actually be a boolean in the metaverse.  That is a pretty odd representation of a boolean...


    Thursday, October 4, 2007 9:00 PM
  • Sorry, I'm not following... my problem is that the field in the Connector Space is typed (automatically) as "boolean" in accordance with the schema. The values of these "boolean" fields in the Connector Space are always false.


    I don't see any configuration settings within the MA to (re-)define what MIIS pulls from the attribute schema of the Sun LDAP server. So although using the field as a string might be a great idea... I'm not sure how this would work since the way MIIS perceives the attributes seems completely tied to the Sun LDAP schema definition.

    Thursday, October 4, 2007 9:19 PM
  • Thanks for clarifying Jim - in some cases you can change the value of an imported attribute type (usually in the DBMS MA's) but what you're looking at is the result of MIIS doing a validation of sample data combined with pulling the schema definitions over itself.  The fact that you and Michael are seeing two different things tells me that it's either due to the versions of Sun One you're connecting to, some customization of the schema at play, or more likely the data itself that MIIS sampled.  It's also always good to mention that you should make sure you're on the latest and greatest SP and hotfix rollup as some of these little items tend to be resolve in hotfixes.


    Can you verify the versions of Sun One and MIIS you are using?


    Thursday, October 4, 2007 9:43 PM
  • No need to thank me. I appreciate you both taking the time to respond to my perplexing predicament.


    On the MIIS side, I'm running MIIS SP2. I don't think any hotfix rollups have been released for SP2, yet.

    On the Sun side, it's Sun Java(TM) System Directory Server/5.2_Patch_3


    Michael -- if you're still reading this, can you tell us what you're running?

    Friday, October 5, 2007 1:25 AM
  • Like Brad mentioned, one can convert attribute types through an extension. I am using a function for that once or twice:


    Code Block

        Function convertCS(ByVal cs As Attrib) As Object
            Dim csValue As String
            Select Case cs.DataType
                Case AttributeType.Binary
                    Throw New UnauthorizedAccessException("Can't convert binary data")

                Case AttributeType.Boolean
                    csValue = "'" & cs.BooleanValue.ToString & "'"
                    If csValue.ToLower = "'false'" Then
                        csValue = "0"
                        Return csValue
                    ElseIf csValue.ToLower = "'true'" Then
                        csValue = "1"
                        Return csValue
                        Return csValue
                    End If

                Case AttributeType.Integer
                    csValue = "'" & EscapeStringForExport(cs.IntegerValue.ToString) & "'"
                    Return csValue

                Case AttributeType.Reference, AttributeType.String
                    csValue = "'" & EscapeStringForExport(cs.Value.ToString) & "'"
                    Return csValue

                Case Else
                    Throw New UnauthorizedAccessException("Don't know how to convert data of this type")
            End Select
        End Function






    Friday, October 5, 2007 10:27 PM
  • That's a handy little function you have there Danny - I have a similiar "ToString" function that I use as well.  In any case, you come up against this sort of thing regular enough to have a function to perform the action.  I'm still not sure why we're seeing two different instances of the same MA reporting data types inconsistantly. 


    Monday, October 8, 2007 5:47 AM
  • I've only dealt with vendor-provided schemas, so not sure how our boolean attributes are defined.


    The only way around it I see is to either start using "true" and "false" or change the schema of the attribute so MIIS sees it as a string attribute.

    Monday, October 8, 2007 3:33 PM

    I have seen stuff like this with Sun Iplanet a couple times.....


    Unfortunately there is not much you can do to modify it because the Schema is not defined it is automatically discovered..


    You could use and extensible ma.... But that requires a development effort... Doesn't really seam worth it for one attribute..


    You are going to have to change the type of attribute in Sun to get the right value in MIIS.....



    Monday, October 8, 2007 6:50 PM