Package org.apache.oodt.cas.catalog.system

Examples of org.apache.oodt.cas.catalog.system.Catalog


  }
 
  public void addCatalog(String catalogId, Index index) throws CatalogServiceException {
    if (!this.containsCatalog(catalogId)) {
      try {
        this.replaceCatalog(new Catalog(catalogId, index, null, false, false));
      }catch (Exception e) {
       
      }
    } else {
      LOG.log(Level.WARNING, "Attempt to override an existing catalog '" + catalogId + "' already used in CatalogService, remedy and retry add -- no changes took place!");
View Full Code Here


  }
 
  public void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries) throws CatalogServiceException {
    if (!this.containsCatalog(catalogId)) {
      try {
        this.replaceCatalog(new Catalog(catalogId, index, dictionaries, false, false));
      }catch (Exception e) {
       
      }
    } else {
      LOG.log(Level.WARNING, "Attempt to override an existing catalog '" + catalogId + "' already used in CatalogService, remedy and retry add -- no changes took place!");
View Full Code Here

  }

  public void addCatalog(String catalogId, Index index, List<Dictionary> dictionaries, boolean restrictQueryPermission, boolean restrictIngestPermission) throws CatalogServiceException {
    if (!this.containsCatalog(catalogId)) {
      try {
        this.replaceCatalog(new Catalog(catalogId, index, dictionaries, restrictQueryPermission, restrictIngestPermission));
      }catch (Exception e) {
       
      }
    } else {
      LOG.log(Level.WARNING, "Attempt to override an existing catalog '" + catalogId + "' already used in CatalogService, remedy and retry add -- no changes took place!");
View Full Code Here

   * @param catalogUrn
   * @throws CatalogServiceException
   */
  public void removeCatalog(String catalogId, boolean preserveMapping) throws CatalogServiceException {
      this.catalogsLock.readLock().lock();
      Catalog rmCatalog = null;
      try {
        for (Catalog catalog : this.catalogs) {
          if (catalog.getId().equals(catalogId)) {
            rmCatalog = catalog;
            break;
View Full Code Here

    return properties;
  }
 
  public Properties getCalalogProperties(String catalogUrn) throws CatalogServiceException {
    try {
      Catalog catalog = this.getCatalog(catalogUrn);
      if (catalog != null)
        return catalog.getProperties();
      else
        return null;
    }catch (Exception e) {
      throw new CatalogServiceException("Failed to get catalog properties from catalog '" + catalogUrn + "' : " + e.getMessage(), e);
    }
View Full Code Here

    if (this.disableIntersectingCrossCatalogQueries) {
      try {
        int totalResults = 0;
        LinkedHashMap<String, Integer> catalogToSizeOfMap = new LinkedHashMap<String, Integer>();
        for (String catalogId : catalogIds) {
          Catalog catalog = this.getCatalog(catalogId);
          QueryExpression qe = this.reduceToUnderstoodExpressions(catalog, queryExpression);
          if (qe != null) {
            int catalogResultSize = catalog.sizeOf(qe);
            totalResults += catalogResultSize;
            catalogToSizeOfMap.put(catalogId, catalogResultSize);
          }
        }
       
        LOG.log(Level.INFO, "Routing query to catalogs as non-cross catalog intersecting queries . . .");
        if (totalResults <= this.crossCatalogResultSortingThreshold) {
          List<CatalogReceipt> catalogReceipts = new Vector<CatalogReceipt>();
          for (String catalogId : catalogToSizeOfMap.keySet()) {
            Catalog catalog = this.getCatalog(catalogId);
            QueryExpression qe = this.reduceToUnderstoodExpressions(catalog, queryExpression);
            if (qe != null)
              catalogReceipts.addAll(catalog.query(qe));
          }
          List<TransactionReceipt> transactionReceipts = this.getPossiblyUnindexedTransactionReceipts(catalogReceipts);
          LOG.log(Level.INFO, "Sorting Query Results . . . ");
          Collections.sort(transactionReceipts, new Comparator<TransactionReceipt>() {
            public int compare(TransactionReceipt o1,
                TransactionReceipt o2) {
              return o2.getTransactionDate().compareTo(o1.getTransactionDate());
            }
          });
          QueryPager queryPager = new QueryPager(transactionReceipts);
          queryPager.setPageInfo(pageInfo);
          return this.getPage(queryExpression, catalogIds, queryPager);
        }else {
          int currentIndex = 0;
          int desiredStartingIndex = pageInfo.getPageNum() * pageInfo.getPageSize();
          List<CatalogReceipt> pageOfReceipts = new Vector<CatalogReceipt>();
          for (Entry<String, Integer> entry : catalogToSizeOfMap.entrySet()) {
            if (desiredStartingIndex - currentIndex <= entry.getValue()) {
              Catalog catalog = this.getCatalog(entry.getKey());
              QueryExpression qe = this.reduceToUnderstoodExpressions(catalog, queryExpression);
              if (qe != null) {
                List<CatalogReceipt> receipts = catalog.query(qe, desiredStartingIndex - currentIndex, Math.min((desiredStartingIndex - currentIndex) + pageInfo.getPageSize(), entry.getValue()));
                pageOfReceipts.addAll(receipts);
                if (pageOfReceipts.size() >= pageInfo.getPageSize())
                  break;
              }
            }else {
View Full Code Here

    for (TransactionReceipt transactionReceipt : transactionReceipts) {
      Metadata metadata = new Metadata();
      Vector<CatalogReceipt> successfulCatalogReceipts = new Vector<CatalogReceipt>();
      for (CatalogReceipt catalogReceipt : transactionReceipt.getCatalogReceipts()) {
        try {
          Catalog catalog = this.getCatalog(catalogReceipt.getCatalogId());
          metadata.addMetadata(catalog.getMetadata(catalogReceipt.getTransactionId()));
          successfulCatalogReceipts.add(catalogReceipt);
        }catch (Exception e) {
          if (this.oneCatalogFailsAllFail)
            throw new CatalogServiceException("Failed to get metadata for transaction ids for catalog '" + catalogReceipt.getCatalogId() + "' : " + e.getMessage(), e);
          else
View Full Code Here

    try {
      if (metadata.getMetadata(CatalogServiceLocal.CATALOG_SERVICE_TRANSACTION_ID_MET_KEY) != null) {
        return this.generateTransactionId(metadata.getMetadata(CatalogServiceLocal.CATALOG_SERVICE_TRANSACTION_ID_MET_KEY));
      }else if (metadata.getMetadata(CatalogServiceLocal.CATALOG_TRANSACTION_ID_MET_KEY) != null && metadata.getMetadata(CatalogServiceLocal.CATALOG_ID_MET_KEY) != null) {
        String catalogId = metadata.getMetadata(CatalogServiceLocal.CATALOG_ID_MET_KEY);
        Catalog catalog = this.getCatalog(catalogId);
        if (catalog != null) {
          TransactionId<?> catalogTransactionId = catalog.getTransactionIdFromString(metadata.getMetadata(CatalogServiceLocal.CATALOG_TRANSACTION_ID_MET_KEY));
          TransactionId<?> catalogServiceTransactionId = this.ingestMapper.getCatalogServiceTransactionId(catalogTransactionId, catalogId);
          if (catalogServiceTransactionId == null)
            throw new CatalogServiceException("CatalogService's Catalog '" + catalog.getId() + "' is not aware of TransactionId '" + catalogTransactionId + "'s");
          return catalogServiceTransactionId;
        }else {
          throw new CatalogServiceException("This CatalogService has no Catalog with ID = '" + catalogId + "'");
        }
      }else if (generateNew) {
View Full Code Here

  }
 
  protected Set<Catalog> getFilteredCatalogList(Metadata metadata) throws CatalogServiceException {
    try {
      if (metadata.containsKey(CATALOG_ID_MET_KEY)) {
        Catalog catalog = this.getCatalog(metadata.getMetadata(CATALOG_ID_MET_KEY));
        if (catalog == null)
          throw new CatalogServiceException("Catalog '" + metadata.getMetadata(CATALOG_ID_MET_KEY) + "' is not managed by this CatalogService");
        else
          return Collections.singleton(catalog);
      }else if (metadata.containsKey(CATALOG_IDS_MET_KEY)) {
        HashSet<Catalog> filteredCatalogList = new HashSet<Catalog>();
        for (Object catalogUrn : metadata.getAllMetadata(CATALOG_IDS_MET_KEY)) {
          Catalog catalog = this.getCatalog((String) catalogUrn);
          if (catalog == null)
            throw new CatalogServiceException("Catalog '" + metadata.getMetadata(CATALOG_ID_MET_KEY) + "' is not managed by this CatalogService");
          else
            filteredCatalogList.add(catalog);
        }
View Full Code Here

  }
 
  public void addCatalog(String catalogId, Index index) throws CatalogServiceException {
    if (!this.containsCatalog(catalogId)) {
      try {
        this.replaceCatalog(new Catalog(catalogId, index, null, false, false));
      }catch (Exception e) {
       
      }
    } else {
      LOG.log(Level.WARNING, "Attempt to override an existing catalog '" + catalogId + "' already used in CatalogService, remedy and retry add -- no changes took place!");
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.catalog.system.Catalog

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.