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(); }
response.withVerb(identifyHandler.handle(parameters)); break; case ListSets:
@Override public Identify handle(OAICompiledRequest params) throws OAIException, HandlerException { Identify identify = new Identify(); RepositoryConfiguration configuration = getRepository().getConfiguration(); identify.withBaseURL(configuration.getBaseUrl()); identify.withRepositoryName(configuration.getRepositoryName());
response.withVerb(identifyHandler.handle(parameters)); break; case ListSets:
public IdentifyHandler(Context context, Repository repository) { super(context, repository); // Static validation RepositoryConfiguration configuration = getRepository().getConfiguration(); if (configuration == null) throw new InternalOAIException("No repository configuration provided"); if (configuration.getMaxListSets() <= 0) throw new InternalOAIException("The repository configuration must return maxListSets greater then 0"); if (configuration.getMaxListIdentifiers() <= 0) throw new InternalOAIException("The repository configuration must return maxListIdentifiers greater then 0"); if (configuration.getMaxListRecords() <= 0) throw new InternalOAIException("The repository configuration must return maxListRecords greater then 0"); if (configuration.getAdminEmails() == null || configuration.getAdminEmails().isEmpty()) throw new InternalOAIException("The repository configuration must return at least one admin email"); try { if (configuration.getBaseUrl() == null) throw new InternalOAIException("The repository configuration must return a valid base url (absolute)"); new URL(configuration.getBaseUrl()); } catch (MalformedURLException e) { throw new InternalOAIException("The repository configuration must return a valid base url (absolute)", e); } if (configuration.getDeleteMethod() == null) throw new InternalOAIException("The repository configuration must return a valid delete method"); if (configuration.getEarliestDate() == null) throw new InternalOAIException("The repository configuration must return a valid earliest date. That's the date of the first inserted item"); if (configuration.getRepositoryName() == null) throw new InternalOAIException("The repository configuration must return a valid repository name"); }
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(); }