Package org.apache.oodt.cas.filemgr.structs

Examples of org.apache.oodt.cas.filemgr.structs.ProductPage


         *
         * @see org.apache.oodt.cas.filemgr.catalog.DataSourceCatalog#getFirstPage(org.apache.oodt.cas.filemgr.structs.ProductType)
         */
        public ProductPage getFirstPage(ProductType type) {
            Query query = new Query();
            ProductPage firstPage = null;

            try {
                firstPage = pagedQuery(query, type, 1);
            } catch (CatalogException e) {
                LOG.log(Level.WARNING,
View Full Code Here


            if (currentPage.isLastPage()) {
                return currentPage;
            }

            ProductPage nextPage = null;
            Query query = new Query();

            try {
                nextPage = pagedQuery(query, type, currentPage.getPageNum() + 1);
            } catch (CatalogException e) {
View Full Code Here

        XmlRpcFileManagerClient client = config.getXMLRpcClient();
        ProductType type = client.getProductTypeByName(productTypeName);
        if (type == null) {
            throw new Exception("FileManager returned null ProductType");
        }
        ProductPage firstPage = client.getFirstPage(type);
        if (firstPage == null) {
            throw new Exception("FileManager returned null product page");
        }

        Map<String, Map<String, String>> o = new HashMap<String, Map<String, String>>();

        for (int pid = 0; pid < firstPage.getTotalPages(); pid++) {
            if (pid > 0) {
                firstPage = client.getNextPage(type, firstPage);
            }
            for (Product p : firstPage.getPageProducts()) {
                Metadata met = client.getMetadata(p);

                Map<String, String> h = new HashMap<String, String>();
                h.put("name", p.getProductName());
                h.put("type", p.getProductType().getName());
View Full Code Here

    @SuppressWarnings("unchecked")
    public ProductPage getFirstPage(ProductType type) throws CatalogException {
        Vector<Object> argList = new Vector<Object>();
        argList.add(XmlRpcStructFactory.getXmlRpcProductType(type));

        ProductPage page = null;
        Hashtable<String, Object> pageHash = null;

        try {
            pageHash = (Hashtable<String, Object>) client.execute(
                    "filemgr.getFirstPage", argList);
View Full Code Here

    @SuppressWarnings("unchecked")
    public ProductPage getLastPage(ProductType type) throws CatalogException {
        Vector<Object> argList = new Vector<Object>();
        argList.add(XmlRpcStructFactory.getXmlRpcProductType(type));

        ProductPage page = null;
        Hashtable<String, Object> pageHash = null;

        try {
            pageHash = (Hashtable<String, Object>) client.execute(
                    "filemgr.getLastPage", argList);
View Full Code Here

            throws CatalogException {
        Vector<Object> argList = new Vector<Object>();
        argList.add(XmlRpcStructFactory.getXmlRpcProductType(type));
        argList.add(XmlRpcStructFactory.getXmlRpcProductPage(currPage));

        ProductPage page = null;
        Hashtable<String, Object> pageHash = null;

        try {
            pageHash = (Hashtable<String, Object>) client.execute(
                    "filemgr.getNextPage", argList);
View Full Code Here

    }

    public void moveProducts(ProductType type) throws Exception {
        // paginate through the product list

        ProductPage page = fmgrClient.getFirstPage(type);

        for (int i = 0; i < page.getTotalPages(); i++) {
            if (page.getPageProducts() != null
                    && page.getPageProducts().size() > 0) {
                for (Iterator j = page.getPageProducts().iterator(); j
                        .hasNext();) {
                    Product p = (Product) j.next();
                    p.setProductReferences(fmgrClient.getProductReferences(p));
                    Metadata met = fmgrClient.getMetadata(p);
                    Reference r = ((Reference) p.getProductReferences().get(0));
                    String newLocPath = PathUtils.replaceEnvVariables(
                            this.pathSpec, met);
                   
                    if (locationsMatch(r.getDataStoreReference(), newLocPath)) {
                      LOG.log(Level.INFO, "Current and New locations match. "+p.getProductName()+" was not moved.");
                      continue;
                    }
                   
                    LOG.log(Level.INFO, "Moving product: ["
                            + p.getProductName() + "] from: ["
                            + new File(new URI(r.getDataStoreReference()))
                            + "] to: [" + newLocPath + "]");
                    long timeBefore = System.currentTimeMillis();
                    fmgrClient.moveProduct(p, newLocPath);
                    long timeAfter = System.currentTimeMillis();
                    double seconds = ((timeAfter - timeBefore) * 1.0) / (1000.0);
                    LOG.log(Level.INFO, "Product: [" + p.getProductName()
                            + "] move successful: took: [" + seconds
                            + "] seconds");
                }

                if (!page.isLastPage()) {
                    page = fmgrClient.getNextPage(type, page);
                }
            }
        }
    }
View Full Code Here

            throws CatalogException {
        Vector<Object> argList = new Vector<Object>();
        argList.add(XmlRpcStructFactory.getXmlRpcProductType(type));
        argList.add(XmlRpcStructFactory.getXmlRpcProductPage(currPage));

        ProductPage page = null;
        Hashtable<String, Object> pageHash = null;

        try {
            pageHash = (Hashtable<String, Object>) client.execute(
                    "filemgr.getPrevPage", argList);
View Full Code Here

        return productPageHash;
    }

    @SuppressWarnings("unchecked")
    public static ProductPage getProductPageFromXmlRpc(Hashtable<String, Object> productPageHash) {
        ProductPage page = new ProductPage();
        page.setPageNum(((Integer) productPageHash.get("pageNum")).intValue());
        page
                .setPageSize(((Integer) productPageHash.get("pageSize"))
                        .intValue());
        page.setTotalPages(((Integer) productPageHash.get("totalPages"))
                .intValue());
        page.setPageProducts(getProductListFromXmlRpc((Vector<Hashtable<String, Object>>) productPageHash
                .get("pageProducts")));
        return page;
    }
View Full Code Here

   * @param queryResponse
   * @return
   */
  private ProductPage newProductPage(int pageNum, QueryResponse queryResponse) {
   
    ProductPage page = new ProductPage();
    page.setPageNum(pageNum);
    page.setPageSize(queryResponse.getProducts().size());
    page.setNumOfHits(queryResponse.getNumFound());
    page.setPageProducts(queryResponse.getProducts());
    page.setTotalPages(PaginationUtils.getTotalPage(queryResponse.getNumFound(), Parameters.PAGE_SIZE));
    return page;
   
  }
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.filemgr.structs.ProductPage

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.