use of org.apache.directory.api.ldap.model.schema.registries.Schema in project directory-ldap-api by apache.
the class JarLdifSchemaLoader method loadDitStructureRules.
/**
* {@inheritDoc}
*/
@Override
public List<Entry> loadDitStructureRules(Schema... schemas) throws LdapException, IOException {
List<Entry> ditStructureRuleList = new ArrayList<>();
if (schemas == null) {
return ditStructureRuleList;
}
for (Schema schema : schemas) {
String start = getSchemaDirectoryString(schema) + SchemaConstants.DIT_STRUCTURE_RULES_PATH + "/" + "m-oid=";
String end = "." + LDIF_EXT;
for (String resourcePath : RESOURCE_MAP.keySet()) {
if (resourcePath.startsWith(start) && resourcePath.endsWith(end)) {
URL resource = getResource(resourcePath, "ditStructureRule LDIF file");
LdifReader reader = new LdifReader(resource.openStream());
LdifEntry entry = reader.next();
reader.close();
ditStructureRuleList.add(entry.getEntry());
}
}
}
return ditStructureRuleList;
}
use of org.apache.directory.api.ldap.model.schema.registries.Schema in project directory-ldap-api by apache.
the class JarLdifSchemaLoader method loadMatchingRuleUses.
/**
* {@inheritDoc}
*/
@Override
public List<Entry> loadMatchingRuleUses(Schema... schemas) throws LdapException, IOException {
List<Entry> matchingRuleUseList = new ArrayList<>();
if (schemas == null) {
return matchingRuleUseList;
}
for (Schema schema : schemas) {
String start = getSchemaDirectoryString(schema) + SchemaConstants.MATCHING_RULE_USE_PATH + "/" + "m-oid=";
String end = "." + LDIF_EXT;
for (String resourcePath : RESOURCE_MAP.keySet()) {
if (resourcePath.startsWith(start) && resourcePath.endsWith(end)) {
URL resource = getResource(resourcePath, "matchingRuleUse LDIF file");
LdifReader reader = new LdifReader(resource.openStream());
LdifEntry entry = reader.next();
reader.close();
matchingRuleUseList.add(entry.getEntry());
}
}
}
return matchingRuleUseList;
}
use of org.apache.directory.api.ldap.model.schema.registries.Schema in project directory-ldap-api by apache.
the class JarLdifSchemaLoader method loadNormalizers.
/**
* {@inheritDoc}
*/
@Override
public List<Entry> loadNormalizers(Schema... schemas) throws LdapException, IOException {
List<Entry> normalizerList = new ArrayList<>();
if (schemas == null) {
return normalizerList;
}
for (Schema schema : schemas) {
String start = getSchemaDirectoryString(schema) + SchemaConstants.NORMALIZERS_PATH + "/" + "m-oid=";
String end = "." + LDIF_EXT;
for (String resourcePath : RESOURCE_MAP.keySet()) {
if (resourcePath.startsWith(start) && resourcePath.endsWith(end)) {
URL resource = getResource(resourcePath, "normalizer LDIF file");
LdifReader reader = new LdifReader(resource.openStream());
LdifEntry entry = reader.next();
reader.close();
normalizerList.add(entry.getEntry());
}
}
}
return normalizerList;
}
use of org.apache.directory.api.ldap.model.schema.registries.Schema in project directory-ldap-api by apache.
the class LdifSchemaLoader method loadAttributeTypes.
/**
* {@inheritDoc}
*/
@Override
public List<Entry> loadAttributeTypes(Schema... schemas) throws LdapException, IOException {
List<Entry> attributeTypeList = new ArrayList<>();
if (schemas == null) {
return attributeTypeList;
}
for (Schema schema : schemas) {
// check that the attributeTypes directory exists for the schema
File attributeTypesDirectory = new File(getSchemaDirectory(schema), SchemaConstants.ATTRIBUTE_TYPES_PATH);
if (!attributeTypesDirectory.exists()) {
return attributeTypeList;
}
// get list of attributeType LDIF schema files in attributeTypes
File[] attributeTypeFiles = attributeTypesDirectory.listFiles(ldifFilter);
if (attributeTypeFiles != null) {
for (File ldifFile : attributeTypeFiles) {
LdifReader reader = new LdifReader(ldifFile);
LdifEntry entry = reader.next();
reader.close();
attributeTypeList.add(entry.getEntry());
}
}
}
return attributeTypeList;
}
use of org.apache.directory.api.ldap.model.schema.registries.Schema in project directory-ldap-api by apache.
the class LdifSchemaLoader method loadDitStructureRules.
/**
* {@inheritDoc}
*/
@Override
public List<Entry> loadDitStructureRules(Schema... schemas) throws LdapException, IOException {
List<Entry> ditStructureRuleList = new ArrayList<>();
if (schemas == null) {
return ditStructureRuleList;
}
for (Schema schema : schemas) {
File ditStructureRulesDirectory = new File(getSchemaDirectory(schema), SchemaConstants.DIT_STRUCTURE_RULES_PATH);
if (!ditStructureRulesDirectory.exists()) {
return ditStructureRuleList;
}
File[] ditStructureRuleFiles = ditStructureRulesDirectory.listFiles(ldifFilter);
if (ditStructureRuleFiles != null) {
for (File ldifFile : ditStructureRuleFiles) {
LdifReader reader = new LdifReader(ldifFile);
LdifEntry entry = reader.next();
reader.close();
ditStructureRuleList.add(entry.getEntry());
}
}
}
return ditStructureRuleList;
}
Aggregations