use of org.apache.directory.api.ldap.model.schema.registries.Schema in project directory-ldap-api by apache.
the class JarLdifSchemaLoader method loadMatchingRules.
/**
* {@inheritDoc}
*/
@Override
public List<Entry> loadMatchingRules(Schema... schemas) throws LdapException, IOException {
List<Entry> matchingRuleList = new ArrayList<>();
if (schemas == null) {
return matchingRuleList;
}
for (Schema schema : schemas) {
String start = getSchemaDirectoryString(schema) + SchemaConstants.MATCHING_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, "matchingRules LDIF file");
LdifReader reader = new LdifReader(resource.openStream());
LdifEntry entry = reader.next();
reader.close();
matchingRuleList.add(entry.getEntry());
}
}
}
return matchingRuleList;
}
use of org.apache.directory.api.ldap.model.schema.registries.Schema in project directory-ldap-api by apache.
the class JarLdifSchemaLoader method loadDitContentRules.
/**
* {@inheritDoc}
*/
@Override
public List<Entry> loadDitContentRules(Schema... schemas) throws LdapException, IOException {
List<Entry> ditContentRulesList = new ArrayList<>();
if (schemas == null) {
return ditContentRulesList;
}
for (Schema schema : schemas) {
String start = getSchemaDirectoryString(schema) + SchemaConstants.DIT_CONTENT_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, "ditContentRule LDIF file");
LdifReader reader = new LdifReader(resource.openStream());
LdifEntry entry = reader.next();
reader.close();
ditContentRulesList.add(entry.getEntry());
}
}
}
return ditContentRulesList;
}
use of org.apache.directory.api.ldap.model.schema.registries.Schema in project directory-ldap-api by apache.
the class LdifSchemaLoader method loadSyntaxCheckers.
/**
* {@inheritDoc}
*/
@Override
public List<Entry> loadSyntaxCheckers(Schema... schemas) throws LdapException, IOException {
List<Entry> syntaxCheckerList = new ArrayList<>();
if (schemas == null) {
return syntaxCheckerList;
}
for (Schema schema : schemas) {
File syntaxCheckersDirectory = new File(getSchemaDirectory(schema), SchemaConstants.SYNTAX_CHECKERS_PATH);
if (!syntaxCheckersDirectory.exists()) {
return syntaxCheckerList;
}
File[] syntaxCheckerFiles = syntaxCheckersDirectory.listFiles(ldifFilter);
if (syntaxCheckerFiles != null) {
for (File ldifFile : syntaxCheckerFiles) {
LdifReader reader = new LdifReader(ldifFile);
LdifEntry entry = reader.next();
reader.close();
syntaxCheckerList.add(entry.getEntry());
}
}
}
return syntaxCheckerList;
}
use of org.apache.directory.api.ldap.model.schema.registries.Schema in project directory-ldap-api by apache.
the class LdifSchemaLoader 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) {
File normalizersDirectory = new File(getSchemaDirectory(schema), SchemaConstants.NORMALIZERS_PATH);
if (!normalizersDirectory.exists()) {
return normalizerList;
}
File[] normalizerFiles = normalizersDirectory.listFiles(ldifFilter);
if (normalizerFiles != null) {
for (File ldifFile : normalizerFiles) {
LdifReader reader = new LdifReader(ldifFile);
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 loadComparators.
/**
* {@inheritDoc}
*/
@Override
public List<Entry> loadComparators(Schema... schemas) throws LdapException, IOException {
List<Entry> comparatorList = new ArrayList<>();
if (schemas == null) {
return comparatorList;
}
for (Schema schema : schemas) {
File comparatorsDirectory = new File(getSchemaDirectory(schema), SchemaConstants.COMPARATORS_PATH);
if (!comparatorsDirectory.exists()) {
return comparatorList;
}
File[] comparators = comparatorsDirectory.listFiles(ldifFilter);
if (comparators != null) {
for (File ldifFile : comparators) {
LdifReader reader = new LdifReader(ldifFile);
LdifEntry entry = reader.next();
reader.close();
comparatorList.add(entry.getEntry());
}
}
}
return comparatorList;
}
Aggregations