Package org.apache.oodt.cas.catalog.page

Examples of org.apache.oodt.cas.catalog.page.CatalogReceipt


            if (performUpdate) {
              if (!Boolean.parseBoolean(metadata.getMetadata(ENABLE_UPDATE_MET_KEY)))
                throw new CatalogServiceException("TransactionId '" + catalogServiceTransactionId + "' already exists -- enable update by setting metadata key '" + ENABLE_UPDATE_MET_KEY + "'=true");
              TransactionId<?> catalogTransactionId = this.ingestMapper.getCatalogTransactionId(catalogServiceTransactionId, catalog.getId());
              if (catalogTransactionId != null) {
                CatalogReceipt catalogReceipt = catalog.update(catalogTransactionId, metadata);
                if (catalogReceipt != null) {
                  if (!catalogReceipt.getTransactionId().equals(catalogTransactionId)) {
                    this.ingestMapper.deleteTransactionIdMapping(catalogTransactionId, catalog.getId());
                    this.ingestMapper.storeTransactionIdMapping(catalogServiceTransactionId, this.transactionIdFactory, catalogReceipt, catalog.getTransactionIdFactory());
                  }
                  catalogReceipts.add(catalogReceipt);
                  LOG.log(Level.INFO, "Successfully updated metadata to catalog '" + catalog + "' for TransactionId '" + catalogServiceTransactionId + "'");
                }else {
                  LOG.log(Level.SEVERE, "Update attempt to catalog '" + catalog + "' failed for TransactionId '" + catalogServiceTransactionId + "' -- update returned false");
                }
              }else {
                LOG.log(Level.INFO, "Catalog '" + catalog + "' was not on ingest list for TransactionId '" + catalogServiceTransactionId + "' -- skipping");
              }
            // perform ingest 
            }else {
              LOG.log(Level.INFO, "Performing ingest for TransactionId '" + catalogServiceTransactionId + "' to catalog '" + catalog + "'");
              CatalogReceipt catalogReceipt = catalog.ingest(metadata);
              if (catalogReceipt != null) {
                LOG.log(Level.INFO, "Successfully ingested metadata -- Indexing TransactionId information for ingest (CatalogService TransactionId = '" + catalogServiceTransactionId + "', Catalog TransactionId = '" + catalogReceipt.getTransactionId() + "', catalog = '" + catalogReceipt.getCatalogId() + "')");
                this.ingestMapper.storeTransactionIdMapping(catalogServiceTransactionId, this.transactionIdFactory, catalogReceipt, catalog.getTransactionIdFactory());
                catalogReceipts.add(catalogReceipt);
              }else {
                LOG.log(Level.WARNING, "Catalog '" + catalog + "' not interested in any Metadata for TransactionId '" + catalogServiceTransactionId + "'");
              }
View Full Code Here


    for (TransactionId<?> catalogServiceTransactionId : catalogServiceTransactionIds) {
      Metadata metadata = new Metadata();
      Vector<CatalogReceipt> catalogReceipts = new Vector<CatalogReceipt>();
      for (Catalog catalog : this.getCurrentCatalogList()) {
        try {
          CatalogReceipt catalogReceipt = this.ingestMapper.getCatalogReceipt(catalogServiceTransactionId, catalog.getId());
          if (catalogReceipt != null) {
            metadata.addMetadata(catalog.getMetadata(catalogReceipt.getTransactionId()).getHashtable());
            catalogReceipts.add(catalogReceipt);
          }
        }catch (Exception e) {
          if (this.oneCatalogFailsAllFail)
            throw new CatalogServiceException("Failed to get metadata for transaction ids for catalog '" + catalog.getId() + "' : " + e.getMessage(), e);
View Full Code Here

    try {
      if (this.isIngestable()) {
        List<TermBucket> termBuckets = this.getTermBuckets(metadata);
        if (termBuckets.size() > 0) {
          LOG.log(Level.INFO, "Catalog '" + this + "' attemping ingest metadata");
          return new CatalogReceipt(((IngestService) this.index).ingest(termBuckets), this.getId());
        }else {
          LOG.log(Level.WARNING, "Catalog '" + this + "' dictionaries did not generate any TermBuckets from Metadata");
          return null;
        }
      }else {
View Full Code Here

        List<TermBucket> termBuckets = this.getTermBuckets(metadata);
        if (termBuckets.size() > 0) {
          LOG.log(Level.INFO, "Catalog '" + this + "' attemping update metadata for catalog TransactionId [id = '" + transactionId + "']");
          IngestReceipt ingestReceipt = ((IngestService) this.index).update(transactionId, termBuckets);
          if (ingestReceipt != null)
            return new CatalogReceipt(ingestReceipt, this.getId());
          else
            return null;
        }else {
          LOG.log(Level.WARNING, "Catalog '" + this + "' did not generate any TermBuckets from Metadata for catalog TransactionId [id = '" + transactionId + "']");
          return null;
View Full Code Here

    try {
      if (this.isQueriable()) {
        QueryService queryService = (QueryService) this.index;
        List<CatalogReceipt> catalogReceipts = new Vector<CatalogReceipt>();
        for (IngestReceipt ingestReceipt : queryService.query(queryExpression))
          catalogReceipts.add(new CatalogReceipt(ingestReceipt, this.getId()));
        return Collections.unmodifiableList(catalogReceipts);
      }else {
        LOG.log(Level.WARNING, "Catalog '" + this + "' is not queriable");
        return Collections.emptyList();
      }
View Full Code Here

    try {
      if (this.isQueriable()) {
        QueryService queryService = (QueryService) this.index;
        List<CatalogReceipt> catalogReceipts = new Vector<CatalogReceipt>();
        for (IngestReceipt ingestReceipt : queryService.query(queryExpression, startIndex, endIndex))
          catalogReceipts.add(new CatalogReceipt(ingestReceipt, this.getId()));
        return Collections.unmodifiableList(catalogReceipts);
      }else {
        LOG.log(Level.WARNING, "Catalog '" + this + "' is not queriable");
        return Collections.emptyList();
      }
View Full Code Here

            if (performUpdate) {
              if (!Boolean.parseBoolean(metadata.getMetadata(ENABLE_UPDATE_MET_KEY)))
                throw new CatalogServiceException("TransactionId '" + catalogServiceTransactionId + "' already exists -- enable update by setting metadata key '" + ENABLE_UPDATE_MET_KEY + "'=true");
              TransactionId<?> catalogTransactionId = this.ingestMapper.getCatalogTransactionId(catalogServiceTransactionId, catalog.getId());
              if (catalogTransactionId != null) {
                CatalogReceipt catalogReceipt = catalog.update(catalogTransactionId, metadata);
                if (catalogReceipt != null) {
                  if (!catalogReceipt.getTransactionId().equals(catalogTransactionId)) {
                    this.ingestMapper.deleteTransactionIdMapping(catalogTransactionId, catalog.getId());
                    this.ingestMapper.storeTransactionIdMapping(catalogServiceTransactionId, this.transactionIdFactory, catalogReceipt, catalog.getTransactionIdFactory());
                  }
                  catalogReceipts.add(catalogReceipt);
                  LOG.log(Level.INFO, "Successfully updated metadata to catalog '" + catalog + "' for TransactionId '" + catalogServiceTransactionId + "'");
                }else {
                  LOG.log(Level.SEVERE, "Update attempt to catalog '" + catalog + "' failed for TransactionId '" + catalogServiceTransactionId + "' -- update returned false");
                }
              }else {
                LOG.log(Level.INFO, "Catalog '" + catalog + "' was not on ingest list for TransactionId '" + catalogServiceTransactionId + "' -- skipping");
              }
            // perform ingest 
            }else {
              LOG.log(Level.INFO, "Performing ingest for TransactionId '" + catalogServiceTransactionId + "' to catalog '" + catalog + "'");
              CatalogReceipt catalogReceipt = catalog.ingest(metadata);
              if (catalogReceipt != null) {
                LOG.log(Level.INFO, "Successfully ingested metadata -- Indexing TransactionId information for ingest (CatalogService TransactionId = '" + catalogServiceTransactionId + "', Catalog TransactionId = '" + catalogReceipt.getTransactionId() + "', catalog = '" + catalogReceipt.getCatalogId() + "')");
                this.ingestMapper.storeTransactionIdMapping(catalogServiceTransactionId, this.transactionIdFactory, catalogReceipt, catalog.getTransactionIdFactory());
                catalogReceipts.add(catalogReceipt);
              }else {
                LOG.log(Level.WARNING, "Catalog '" + catalog + "' not interested in any Metadata for TransactionId '" + catalogServiceTransactionId + "'");
              }
View Full Code Here

    for (TransactionId<?> catalogServiceTransactionId : catalogServiceTransactionIds) {
      Metadata metadata = new Metadata();
      Vector<CatalogReceipt> catalogReceipts = new Vector<CatalogReceipt>();
      for (Catalog catalog : this.getCurrentCatalogList()) {
        try {
          CatalogReceipt catalogReceipt = this.ingestMapper.getCatalogReceipt(catalogServiceTransactionId, catalog.getId());
          if (catalogReceipt != null) {
            metadata.addMetadata(catalog.getMetadata(catalogReceipt.getTransactionId()).getHashtable());
            catalogReceipts.add(catalogReceipt);
          }
        }catch (Exception e) {
          if (this.oneCatalogFailsAllFail)
            throw new CatalogServiceException("Failed to get metadata for transaction ids for catalog '" + catalog.getId() + "' : " + e.getMessage(), e);
View Full Code Here

      rs = stmt.executeQuery("SELECT CAT_TRANS_ID, CAT_TRANS_FACTORY, CAT_TRANS_DATE FROM CatalogServiceMapper WHERE CAT_SERV_TRANS_ID = '"+ catalogServiceTransactionId + "' AND CATALOG_ID = '" + catalogId + "'");
     
      if(rs.next()) {
        TransactionId<?> catalogTransactionId =  ((TransactionIdFactory) Class.forName(rs.getString("CAT_TRANS_FACTORY")).newInstance()).createTransactionId(rs.getString("CAT_TRANS_ID"));
        Date transactionDate = DateUtils.toCalendar(rs.getString("CAT_TRANS_DATE"), DateUtils.FormatType.UTC_FORMAT).getTime();
        return new CatalogReceipt(new IngestReceipt(catalogTransactionId, transactionDate), catalogId);
      }else {
        return null;
      }
    }catch (Exception e) {
      throw new CatalogRepositoryException(e.getMessage(), e);
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.catalog.page.CatalogReceipt

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.