-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OpenSaml resolver creation WIP.
- Loading branch information
Bill Smith
committed
Aug 7, 2018
1 parent
b75e14b
commit 7785704
Showing
6 changed files
with
252 additions
and
1 deletion.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
...roovy/edu/internet2/tier/shibboleth/admin/ui/service/LuceneMetadataResolverService.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| package edu.internet2.tier.shibboleth.admin.ui.service | ||
|
|
||
| import net.shibboleth.utilities.java.support.component.ComponentInitializationException | ||
| import org.apache.lucene.document.Document | ||
| import org.apache.lucene.document.Field | ||
| import org.apache.lucene.document.StringField | ||
| import org.apache.lucene.document.TextField | ||
| import org.apache.lucene.index.IndexWriter | ||
| import org.opensaml.saml.metadata.resolver.impl.AbstractMetadataResolver | ||
| import org.slf4j.Logger | ||
| import org.slf4j.LoggerFactory | ||
| import org.springframework.stereotype.Service | ||
|
|
||
| /** | ||
| * @author Bill Smith (wsmith@unicon.net) | ||
| */ | ||
| @Service | ||
| class LuceneMetadataResolverService { | ||
| private static final Logger logger = LoggerFactory.getLogger(LuceneMetadataResolverService.class) | ||
|
|
||
| void addIndexedDescriptorsFromBackingStore(AbstractMetadataResolver.EntityBackingStore backingStore, String resourceId, IndexWriter indexWriter) { | ||
| for (String entityId : backingStore.getIndexedDescriptors().keySet()) { | ||
| Document document = new Document() | ||
| document.add(new StringField("id", entityId, Field.Store.YES)) | ||
| document.add(new TextField( "content", entityId, Field.Store.YES)) // TODO: change entityId to be content of entity descriptor block | ||
| document.add(new StringField("tag", resourceId, Field.Store.YES)) | ||
| try { | ||
| indexWriter.addDocument(document) | ||
| } catch (IOException e) { | ||
| logger.error(e.getMessage(), e) | ||
| } | ||
| } | ||
| try { | ||
| indexWriter.commit() | ||
| } catch (IOException e) { | ||
| throw new ComponentInitializationException(e) | ||
| } | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters