Package gr.ekt.bte.core

Examples of gr.ekt.bte.core.DataLoader


        {
            this.providers = new ArrayList<DataLoader>();

            for (String providerName : dataLoader.getProvidersMap().keySet())
            {
                DataLoader p = dataLoader.getProvidersMap().get(providerName);

                this.providers.add(p);

                // Do not do that for file providers
                if (p instanceof FileDataLoader)
View Full Code Here


        List<String> allSupportedIdentifiers = new ArrayList<String>();
        MultipleSubmissionLookupDataLoader dataLoader = (MultipleSubmissionLookupDataLoader) phase1TransformationEngine
                .getDataLoader();
        for (String providerName : dataLoader.getProvidersMap().keySet())
        {
            DataLoader provider = dataLoader.getProvidersMap()
                    .get(providerName);
            if (provider instanceof SubmissionLookupDataLoader)
            {
                for (String identifier : ((SubmissionLookupDataLoader) provider)
                        .getSupportedIdentifiers())
View Full Code Here

        // KSTA:ToDo: Support timeout (problematic) providers
        // List<String> timeoutProviders = new ArrayList<String>();
        for (String providerName : filterProviders().keySet())
        {
            DataLoader provider = dataloadersMap.get(providerName);
            RecordSet subRecordSet = provider.getRecords();
            recordSet.addAll(subRecordSet);
            // Add in each record the provider name... a new provider doesn't
            // need to know about it!
            for (Record record : subRecordSet.getRecords())
            {
                if (record.isMutable())
                {
                    record.makeMutable().addValue(
                            SubmissionLookupService.PROVIDER_NAME_FIELD,
                            new StringValue(providerName));
                }
            }
        }

        // Question: Do we want that in case of file data loader?
        // for each publication in the record set, if it has a DOI, try to find
        // extra pubs from the other providers
        if (searchTerms != null
                || (identifiers != null && !identifiers
                        .containsKey(SubmissionLookupDataLoader.DOI)))
        { // Extend
            Map<String, Set<String>> provider2foundDOIs = new HashMap<String, Set<String>>();
            List<String> foundDOIs = new ArrayList<String>();

            for (Record publication : recordSet.getRecords())
            {
                String providerName = SubmissionLookupUtils.getFirstValue(
                        publication,
                        SubmissionLookupService.PROVIDER_NAME_FIELD);

                String doi = null;

                if (publication.getValues(SubmissionLookupDataLoader.DOI) != null
                        && publication
                                .getValues(SubmissionLookupDataLoader.DOI)
                                .size() > 0)
                    doi = publication.getValues(SubmissionLookupDataLoader.DOI)
                            .iterator().next().getAsString();
                if (doi == null)
                {
                    doi = NOT_FOUND_DOI;
                }
                else
                {
                    doi = SubmissionLookupUtils.normalizeDOI(doi);
                    if (!foundDOIs.contains(doi))
                    {
                        foundDOIs.add(doi);
                    }
                    Set<String> tmp = provider2foundDOIs.get(providerName);
                    if (tmp == null)
                    {
                        tmp = new HashSet<String>();
                        provider2foundDOIs.put(providerName, tmp);
                    }
                    tmp.add(doi);
                }
            }

            for (String providerName : dataloadersMap.keySet())
            {
                DataLoader genProvider = dataloadersMap.get(providerName);

                if (!(genProvider instanceof SubmissionLookupDataLoader))
                {
                    continue;
                }
View Full Code Here

        if (dataloadersMap != null)
        {
            for (String providerName : dataloadersMap.keySet())
            {
                DataLoader provider = dataloadersMap.get(providerName);
                if (provider instanceof NetworkSubmissionLookupDataLoader)
                {
                    ((NetworkSubmissionLookupDataLoader) provider)
                            .setIdentifiers(identifiers);
                }
View Full Code Here

        if (dataloadersMap != null)
        {
            for (String providerName : dataloadersMap.keySet())
            {
                DataLoader provider = dataloadersMap.get(providerName);
                if (provider instanceof NetworkSubmissionLookupDataLoader)
                {
                    ((NetworkSubmissionLookupDataLoader) provider)
                            .setSearchTerms(searchTerms);
                }
View Full Code Here

        if (dataloadersMap != null)
        {
            for (String providerName : dataloadersMap.keySet())
            {
                DataLoader provider = dataloadersMap.get(providerName);
                if (provider instanceof FileDataLoader)
                {
                    ((FileDataLoader) provider).setFilename(filename);
                }
            }
View Full Code Here

    public Map<String, DataLoader> filterProviders()
    {
        Map<String, DataLoader> result = new HashMap<String, DataLoader>();
        for (String providerName : dataloadersMap.keySet())
        {
            DataLoader dataLoader = dataloadersMap.get(providerName);
            if (searchTerms != null && identifiers == null && filename == null)
            {
                if (dataLoader instanceof SubmissionLookupDataLoader
                        && ((SubmissionLookupDataLoader) dataLoader)
                                .isSearchProvider())
View Full Code Here

 
  public List<String> getFileDataLoaders(){
    List<String> result = new ArrayList<String>();
       
    for (String key : dataLoaders.keySet()){
      DataLoader dl = dataLoaders.get(key);
      if (dl instanceof FileDataLoader){
        result.add(key);
      }
    }
    return result;
View Full Code Here

      else { //This indicates a UI import, working dir is preconfigured
        outputFolder = workingDir;
      }

        BTEBatchImportService dls  = new DSpace().getSingletonService(BTEBatchImportService.class);
        DataLoader dataLoader = dls.getDataLoaders().get(inputType);
        Map<String, String> outputMap = dls.getOutputMap();
        TransformationEngine te = dls.getTransformationEngine();

        if (dataLoader==null){
            System.out.println("ERROR: The key used in -i parameter must match a valid DataLoader in the BTE Spring XML configuration file!");
            return;
        }

        if (outputMap==null){
            System.out.println("ERROR: The key used in -i parameter must match a valid outputMapping in the BTE Spring XML configuration file!");
            return;
        }

        if (dataLoader instanceof FileDataLoader){
            FileDataLoader fdl = (FileDataLoader) dataLoader;
            if (!StringUtils.isBlank(sourceDir)) {
                System.out.println("INFO: Dataloader will load data from the file specified in the command prompt (and not from the Spring XML configuration file)");
                fdl.setFilename(sourceDir);
            }
        }
        else if (dataLoader instanceof OAIPMHDataLoader){
            OAIPMHDataLoader fdl = (OAIPMHDataLoader) dataLoader;
            System.out.println(sourceDir);
            if (!StringUtils.isBlank(sourceDir)){
                System.out.println("INFO: Dataloader will load data from the address specified in the command prompt (and not from the Spring XML configuration file)");
                fdl.setServerAddress(sourceDir);
            }
        }
        if (dataLoader!=null){
            System.out.println("INFO: Dataloader " + dataLoader.toString()+" will be used for the import!");

          te.setDataLoader(dataLoader);

          DSpaceOutputGenerator outputGenerator = new DSpaceOutputGenerator(outputMap);
          outputGenerator.setOutputDirectory(outputFolder);
View Full Code Here

TOP

Related Classes of gr.ekt.bte.core.DataLoader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.