Hi Matthew,

   check out SchemaOps.loadStaticOIDs (below).  There really is no short
cut here because each syntax is slightly different.. however if all you
want to do is figure out which syntaxes *aren't* 'normal strings', it's
probably easier just to exclude the string oids.

    Making things more complex, there is actually a specific 'binary'
syntax (intended I believe for unstructured binary data), however I think
what you mean is 'non string', which includes things like ASN.1 encodings
of certificates and CRLs, and some image formats.

   Anyway; there's a method in DXAttribute called 'isStringSyntax()' which
might do what you want; it's a bit of a hacky method that tries to figure
out if an attribute syntax is "stringy enough" to bother trying to display
it in a UI :-).

   - Chris


protected void loadStaticOIDs()
    {
        // a quick pick of common syntaxes for Active Directory support
        // (and other servers that don't publish syntax descriptions)
        // taken from rfc 2252

        oids.put("1.3.6.1.4.1.1466.115.121.1.1", "ACI Item");
        oids.put("1.3.6.1.4.1.1466.115.121.1.2", "Access Point");
        oids.put("1.3.6.1.4.1.1466.115.121.1.3", "Attribute Type
Description");
        oids.put("1.3.6.1.4.1.1466.115.121.1.4", "Audio");
        oids.put("1.3.6.1.4.1.1466.115.121.1.5", "Binary");
        oids.put("1.3.6.1.4.1.1466.115.121.1.6", "Bit String");
        oids.put("1.3.6.1.4.1.1466.115.121.1.7", "Boolean");
        oids.put("1.3.6.1.4.1.1466.115.121.1.8", "Certificate");
        oids.put("1.3.6.1.4.1.1466.115.121.1.9", "Certificate List");
        oids.put("1.3.6.1.4.1.1466.115.121.1.10", "Certificate Pair");
        oids.put("1.3.6.1.4.1.1466.115.121.1.11", "Country String");
        oids.put("1.3.6.1.4.1.1466.115.121.1.12", "DN");
        oids.put("1.3.6.1.4.1.1466.115.121.1.13", "Data Quality Syntax");
        oids.put("1.3.6.1.4.1.1466.115.121.1.14", "Delivery Method");
        oids.put("1.3.6.1.4.1.1466.115.121.1.15", "Directory String");
        oids.put("1.3.6.1.4.1.1466.115.121.1.16", "DIT Content Rule
Description");
        oids.put("1.3.6.1.4.1.1466.115.121.1.17", "DIT Structure Rule
Description");
        oids.put("1.3.6.1.4.1.1466.115.121.1.18", "DL Submit Permission");
        oids.put("1.3.6.1.4.1.1466.115.121.1.19", "DSA Quality Syntax");
        oids.put("1.3.6.1.4.1.1466.115.121.1.20", "DSE Type");
        oids.put("1.3.6.1.4.1.1466.115.121.1.21", "Enhanced Guide");
        oids.put("1.3.6.1.4.1.1466.115.121.1.22", "Facsimile Telephone
Number");
        oids.put("1.3.6.1.4.1.1466.115.121.1.23", "Fax");
        oids.put("1.3.6.1.4.1.1466.115.121.1.24", "Generalized Time");
        oids.put("1.3.6.1.4.1.1466.115.121.1.25", "Guide");
        oids.put("1.3.6.1.4.1.1466.115.121.1.26", "IA5 String");
        oids.put("1.3.6.1.4.1.1466.115.121.1.27", "INTEGER");
        oids.put("1.3.6.1.4.1.1466.115.121.1.28", "JPEG");
        oids.put("1.3.6.1.4.1.1466.115.121.1.54", "LDAP Syntax
Description");
        oids.put("1.3.6.1.4.1.1466.115.121.1.56", "LDAP Schema Definition");
        oids.put("1.3.6.1.4.1.1466.115.121.1.57", "LDAP Schema
Description");
        oids.put("1.3.6.1.4.1.1466.115.121.1.29", "Master And Shadow Access
Points");
        oids.put("1.3.6.1.4.1.1466.115.121.1.30", "Matching Rule
Description");
        oids.put("1.3.6.1.4.1.1466.115.121.1.31", "Matching Rule Use
Description");
        oids.put("1.3.6.1.4.1.1466.115.121.1.32", "Mail Preference");
        oids.put("1.3.6.1.4.1.1466.115.121.1.33", "MHS OR Address");
        oids.put("1.3.6.1.4.1.1466.115.121.1.55", "Modify Rights");
        oids.put("1.3.6.1.4.1.1466.115.121.1.34", "Name And Optional UID");
        oids.put("1.3.6.1.4.1.1466.115.121.1.35", "Name Form Description");
        oids.put("1.3.6.1.4.1.1466.115.121.1.36", "Numeric String");
        oids.put("1.3.6.1.4.1.1466.115.121.1.37", "Object Class
Description");
        oids.put("1.3.6.1.4.1.1466.115.121.1.40", "Octet String");
        oids.put("1.3.6.1.4.1.1466.115.121.1.38", "OID");
        oids.put("1.3.6.1.4.1.1466.115.121.1.39", "Other Mailbox");
        oids.put("1.3.6.1.4.1.1466.115.121.1.41", "Postal Address");
        oids.put("1.3.6.1.4.1.1466.115.121.1.42", "Protocol Information");
        oids.put("1.3.6.1.4.1.1466.115.121.1.43", "Presentation Address");
        oids.put("1.3.6.1.4.1.1466.115.121.1.44", "Printable String");
        oids.put("1.3.6.1.4.1.1466.115.121.1.58", "Substring Assertion");
        oids.put("1.3.6.1.4.1.1466.115.121.1.45", "Subtree Specification");
        oids.put("1.3.6.1.4.1.1466.115.121.1.46", "Supplier Information");
        oids.put("1.3.6.1.4.1.1466.115.121.1.47", "Supplier Or Consumer");
        oids.put("1.3.6.1.4.1.1466.115.121.1.48", "Supplier And Consumer");
        oids.put("1.3.6.1.4.1.1466.115.121.1.49", "Supported Algorithm");
        oids.put("1.3.6.1.4.1.1466.115.121.1.50", "Telephone Number");
        oids.put("1.3.6.1.4.1.1466.115.121.1.51", "Teletex Terminal
Identifier");
        oids.put("1.3.6.1.4.1.1466.115.121.1.52", "Telex Number");
        oids.put("1.3.6.1.4.1.1466.115.121.1.53", "UTC Time");
    }




On 9 November 2012 08:36, Matthew Abbott <dduck1...@gmail.com> wrote:

> Chris,
>
> I was working with going through the schema and getting the binary
> attributes by looking up their syntax ID # and see if it is Binary or
> not.   The issue im running into for example userCertificate and
> certificateRevocationList have different Syntax, and i would need to
> hardcode ALL the ids, hopefully getting them all based on the
> documentation of the Oracle Attributes.
>
> In your DXAttribute class your get() method tacks on a ";binary" to the
> name.
>
> Anyway, i got my list of MUST and MAY attributes, and it is all
> ordered nicely.  Just wanted to make sure hardcoding the IDs is the
> ONLY way to go.  Also, why do they make it so difficult?  You did say
> it is a black art lol.
>
> Thanks!
>
> -Matthew
>
> On Wed, Nov 7, 2012 at 3:26 PM, Chris Betts <pega...@gmail.com> wrote:
> > Hi Matthew,
> >
> >     the attribute OID is unique to the actual attribute type, whereas the
> > Syntax is the structure of the data; e.g. 'jpegPhoto' is a type of data,
> but
> > you might have attributes 'userThumbnail', 'staffPhoto' or even
> > 'jpegPhoto'(as an attribute).  It's a bit confusing that the attribute
> name
> > and the syntax name are so similar!
> >
> >     If you're looking for some code to get you started, try
> > com.ca.commons.jndi.SchemaOps - you intialise a SchemaOps object with a
> jndi
> > context and you should be able to read out a whole lot of schema info.
> >
> >     Have a look at the expandAllAttributes() method in
> > com.ca.commons.naming.DXAttributes for example usage:
> >
> > (schema is a schemaOps object)
> >
> >                 Attributes ocAttrs =
> schema.getAttributes("ClassDefinition/"
> > + objectClass);
> >                 Attribute mustAtt = ocAttrs.get("MUST");  // get
> mandatory
> > attribute IDs
> >                 Attribute mayAtt  = ocAttrs.get("MAY");   // get optional
> > attribute IDs
> >
> >    cheers,
> >
> >       - Chris
> >
> > P.S. you should note that reading schema in general is a bit of a black
> art;
> > if you're using a 'normal' directory you should be able to read it off
> from
> > the 'subschema subentry', but some directories with an X.500 heritage can
> > actually have different schemas in different sub-trees!
> >
> >
> >
> >
> > On 8 November 2012 06:57, Matthew Abbott <dduck1...@gmail.com> wrote:
> >>
> >> Chris,
> >>
> >> I would like to do the full schema and cache it as well, but for now a
> >> particular entry would be good.
> >> In oracle my dn would be cn=matthew.abbott,cn=users,dc=rampod,dc=net
> >>
> >> I have a DirContext object and was looking in JX for some examples of
> >> how you were listing all the attributes.
> >>
> >> I know there is a MUST/MAY etc with attributes and such too.
> >>
> >> So, two things..
> >> 1.  if i pass in my DN to my user account, id like to get a list of
> >> all the attributes by looking at the schema for that entry.
> >> 2.  yes about your non-string attributes.   I can look at the syntax
> >> Strings you are right.
> >>
> >> (
> http://docs.oracle.com/cd/B28196_01/idmanage.1014/b15998/schema_overview.htm
> )
> >>
> >> Question..
> >> Syntax says 1.3.6.1.4.1.1466.115.121.1.28 for jpegPhoto, but it says
> >> on the Attribute page the Attribute OID is 0.9.2342.19200300.100.1.60
> >> What is the difference here?
> >>
> >> 1.3.6.1.4.1.1466.115.121.1.5 is binary, but there are other binary
> >> syntax like jpegPhoto.
> >>
> >> -Matthew
> >>
> >>
> >> On Wed, Nov 7, 2012 at 2:46 PM, Chris Betts <pega...@gmail.com> wrote:
> >> > Hi Matthew,
> >> >
> >> >     just to clarify, you're basically trying to download the full
> >> > schema?
> >> > Or just the schema a particular entry?
> >> >
> >> >    If the latter, it's a multi-step process; read the entries object
> >> > classes, and then look each of those up in turn.
> >> >
> >> >    In general, finding 'non-string' attributes is a bit tricky, but
> not
> >> > conceptually hard:
> >> >    step 1: find object classes
> >> >    step 2: find all attributes (by looking up the schema)
> >> >    step 3: look up each attribute syntax (by looking up the schema)
> >> >    step 4: compare this syntax with the 'standard' string syntaxes
> (you
> >> > can
> >> > hard code these, they don't usually change); if it isn't one of those
> >> > it's
> >> > 'non-string'!
> >> >
> >> >    When you look at JX code it can be a little confusing, as we try to
> >> > cache
> >> > a lot of this stuff so that we're not always interrogating the schema
> >> > (that's the reason for the slow initial connection; JX slurps down the
> >> > schema when we first connect).
> >> >
> >> >    Anyway, let me know if this is the sort of thing you're trying to
> do
> >> > and
> >> > I'll chase down the exact code in JX
> >> >
> >> >     - Chris
> >> >
> >> >
> >> > On 8 November 2012 05:29, Matthew Abbott <dduck1...@gmail.com> wrote:
> >> >>
> >> >> Chris,
> >> >>
> >> >>
> >> >> I have emailed you before on my hotmail account (abbo...@hotmail.com
> )
> >> >> but I decided to send from my gmail account.
> >> >> Im back to working with the Oracle LDAP schema.
> >> >>
> >> >> I still have not been able to point it to a DN and get ALL the
> >> >> attributes available.  Everything I try is getting the attributes
> that
> >> >> have a value assigned to them.
> >> >> Also, I wondered if there was a way to go out and list the attributes
> >> >> that are binary.
> >> >>
> >> >> http://docs.oracle.com/javase/jndi/tutorial/ldap/misc/attrs.html
> >> >>
> >> >> If you scroll down it lists the binary attributes and it says there
> is
> >> >> not a programmatic way to determine if the syntax is nonstring.  It
> >> >> says The LDAP service provider has a built-in list of attribute
> names.
> >> >>  How does one get to this list using Java?
> >> >>
> >> >> I was looking at your SchemaOps java code, but haven't been
> successful
> >> >> yet.
> >> >>
> >> >> Also, as a side note..in the SchemaOps.java the comments for
> >> >> getSpecificName() and getTypeName() are the same.  Is this correct?
> >> >>
> >> >> Any help is appreciated, and I appreciate your past help greatly!!
> >> >>
> >> >> -Matthew
> >> >
> >> >
> >> >
> >> >
> >> > --
> >> > Dr Christopher Betts
> >> > Pegacat Software
> >> > Melbourne, Australia
> >> > m: 0408 533 456
> >
> >
> >
> >
> > --
> > Dr Christopher Betts
> > Pegacat Software
> > Melbourne, Australia
> > m: 0408 533 456
>



-- 
Dr Christopher Betts
Pegacat Software
Melbourne, Australia
m: 0408 533 456
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov
_______________________________________________
Jxplorer-users mailing list
Jxplorer-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jxplorer-users

Reply via email to