There is no simple way to do that.
All the information is available in at least two places, now the format is really dependent on the server you are using.
In apacheDS, you can read the schema from cn=schema, or from ou=schema. They offer a different vision of the same thing.
ou=schema is the static schema, containing every elements that the server knows about, but which are not necessary activated (ie, you may not use all of them). It's ApacheDS specific
cn=schema contains the information about the available elements (ie, those you can use)
In any case, if you want to get the list of attributes for a given object class, you first have to load the entry associated to this object class and read the m-must and m-may attributes (they contain the list of attributes you can use in an ObjectClass). But this is far from being enough : you have to do so for every ObjectClass the current objectClass extends... And you may have a lot !
This is also very specific to ApacheDS.
Another way, which is supposed to be working with any server, would be to load the cn=schema entry, which contains the list of all the ObjectClasses in the objectClasses attribute. You will get the result in a format you will have to parse :
( 0.9.2342.19200300.100.4.18 NAME 'friendlyCountry' SUP country STRUCTURAL MUST co X-SCHEMA 'cosine' )
You can use the ObjectClassDescriptionSchemaParser.parse( String ) method to parse such an ObjectClass attribute, it will return an instance of teh ObjectClass java class, and you'll again have to read the may and must values using the getMayAttributeTypes() and getMustAttributeTypes() methods. Also keep in mind to prcess the inherited ObjectClasses using the getSuperiors() method.
Last, not least, the cn=schema entry might not be present at the top level : in LDAP, you may have more than one schema...
Side Note : it took us months to implement the schema browser in Apache Directory Studio, for the exact same reasons plus some other I haven't describe here...