public XdataProvider (Context context, Repository repository) { this.repository = repository; this.dateProvider = new UTCDateProvider(); this.identifyHandler = new IdentifyHandler(context, repository); this.listSetsHandler = new ListSetsHandler(context, repository); this.listMetadataFormatsHandler = new ListMetadataFormatsHandler(context, repository); this.listRecordsHandler = new XlistRecordsHandler(context, repository); this.listIdentifiersHandler = new ListIdentifiersHandler(context, repository); //this.getRecordHandler = new GetRecordHandler(context, repository); this.getRecordHandler = new XgetRecordHandler(context, repository); this.errorsHandler = new ErrorHandler(); }
public ListMetadataFormatsHandler(Context context, Repository repository) { super(context, repository); itemRepositoryHelper = new ItemRepositoryHelper(repository.getItemRepository()); // Static validation if (getContext().getMetadataFormats() == null || getContext().getMetadataFormats().isEmpty()) throw new InternalOAIException("The context must expose at least one metadata format"); }
break; case ListMetadataFormats: response.withVerb(listMetadataFormatsHandler.handle(parameters)); break; case GetRecord:
@Override public ListMetadataFormats handle(OAICompiledRequest params) throws OAIException, HandlerException { ListMetadataFormats result = new ListMetadataFormats(); if (params.hasIdentifier()) { Item item = itemRepositoryHelper.getItem(params.getIdentifier()); List<MetadataFormat> metadataFormats = getContext().formatFor(getRepository().getFilterResolver(), item); if (metadataFormats.isEmpty()) throw new NoMetadataFormatsException(); for (MetadataFormat metadataFormat : metadataFormats) { com.lyncode.xoai.model.oaipmh.MetadataFormat format = new com.lyncode.xoai.model.oaipmh.MetadataFormat() .withMetadataPrefix(metadataFormat.getPrefix()) .withMetadataNamespace(metadataFormat.getNamespace()) .withSchema(metadataFormat.getSchemaLocation()); result.withMetadataFormat(format); } } else { for (MetadataFormat metadataFormat : getContext().getMetadataFormats()) { com.lyncode.xoai.model.oaipmh.MetadataFormat format = new com.lyncode.xoai.model.oaipmh.MetadataFormat() .withMetadataPrefix(metadataFormat.getPrefix()) .withMetadataNamespace(metadataFormat.getNamespace()) .withSchema(metadataFormat.getSchemaLocation()); result.withMetadataFormat(format); } } return result; }
break; case ListMetadataFormats: response.withVerb(listMetadataFormatsHandler.handle(parameters)); break; case GetRecord:
public DataProvider (Context context, Repository repository) { this.repository = repository; this.dateProvider = new UTCDateProvider(); this.identifyHandler = new IdentifyHandler(context, repository); this.listSetsHandler = new ListSetsHandler(context, repository); this.listMetadataFormatsHandler = new ListMetadataFormatsHandler(context, repository); this.listRecordsHandler = new ListRecordsHandler(context, repository); this.listIdentifiersHandler = new ListIdentifiersHandler(context, repository); this.getRecordHandler = new GetRecordHandler(context, repository); this.errorsHandler = new ErrorHandler(); }