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

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


    }

    public boolean moveProduct(Hashtable<String, Object> productHash, String newPath)
            throws DataTransferException {

        Product p = XmlRpcStructFactory.getProductFromXmlRpc(productHash);

        // first thing we care about is if the product is flat or heirarchical
        if (p.getProductStructure().equals(Product.STRUCTURE_FLAT)) {
            // we just need to get its first reference
            if (p.getProductReferences() == null
                    || (p.getProductReferences() != null && p
                            .getProductReferences().size() != 1)) {
                throw new DataTransferException(
                        "Flat products must have a single reference: cannot move");
            }

            // okay, it's fine to move it
            // first, we need to update the data store ref
            Reference r = (Reference) p.getProductReferences().get(0);
            if (r.getDataStoreReference().equals(
                    new File(newPath).toURI().toString())) {
                throw new DataTransferException("cannot move product: ["
                        + p.getProductName() + "] to same location: ["
                        + r.getDataStoreReference() + "]");
            }

            // create a copy of the current data store path: we'll need it to
            // do the data transfer
            Reference copyRef = new Reference(r);

            // update the copyRef to have the data store ref as the orig ref
            // the the newLoc as the new ref
            copyRef.setOrigReference(r.getDataStoreReference());
            copyRef.setDataStoreReference(new File(newPath).toURI().toString());

            p.getProductReferences().clear();
            p.getProductReferences().add(copyRef);

            // now transfer it
            try {
                this.dataTransfer.transferProduct(p);
            } catch (IOException e) {
View Full Code Here


    public boolean removeFile(String filePath) {
        return new File(filePath).delete();
    }

    public boolean modifyProduct(Hashtable productHash) throws CatalogException {
        Product p = XmlRpcStructFactory.getProductFromXmlRpc(productHash);

        try {
            catalog.modifyProduct(p);
        } catch (CatalogException e) {
            LOG.log(Level.WARNING, "Exception modifying product: ["
                    + p.getProductId() + "]: Message: " + e.getMessage(), e);
            throw e;
        }

        return true;
    }
View Full Code Here

        return true;
    }

    public boolean removeProduct(Hashtable<String, Object> productHash) throws CatalogException {
        Product p = XmlRpcStructFactory.getProductFromXmlRpc(productHash);

        try {
            catalog.removeProduct(p);
        } catch (CatalogException e) {
            LOG.log(Level.WARNING, "Exception modifying product: ["
                    + p.getProductId() + "]: Message: " + e.getMessage(), e);
            throw e;
        }

        return true;
    }
View Full Code Here

    }

    private void setProductType(List<Product> products) throws Exception {
        if (products != null && products.size() > 0) {
            for (Iterator<Product> i = products.iterator(); i.hasNext();) {
                Product p = i.next();
                try {
                    p.setProductType(repositoryManager.getProductTypeById(p
                            .getProductType().getProductTypeId()));
                } catch (RepositoryManagerException e) {
                    throw new Exception(e.getMessage());
                }
            }
View Full Code Here

            if (productIdList != null && productIdList.size() > 0) {
                productList = new Vector<Product>(productIdList.size());
                for (Iterator<String> i = productIdList.iterator(); i.hasNext();) {
                    String productId = i.next();
                    Product product = catalog.getProductById(productId);
                    // it is possible here that the underlying catalog did not
                    // set the ProductType
                    // to obey the contract of the File Manager, we need to make
                    // sure its set here
                    product.setProductType(this.repositoryManager
                            .getProductTypeById(product.getProductType()
                                    .getProductTypeId()));
                    productList.add(product);
                }
                return productList;
            } else {
View Full Code Here

 
      return status;
    }

    public boolean transferringProduct(Hashtable<String, Object> productHash) {
        Product p = XmlRpcStructFactory.getProductFromXmlRpc(productHash);
        transferStatusTracker.transferringProduct(p);
        return true;
    }
View Full Code Here

        } else
            return new Vector<Hashtable<String, Object>>();
    }

    public double getProductPctTransferred(Hashtable<String, Object> productHash) {
        Product product = XmlRpcStructFactory.getProductFromXmlRpc(productHash);
        double pct = transferStatusTracker.getPctTransferred(product);
        return pct;
    }
View Full Code Here

        }
        return pct;
    }

    public boolean removeProductTransferStatus(Hashtable<String, Object> productHash) {
        Product product = XmlRpcStructFactory.getProductFromXmlRpc(productHash);
        transferStatusTracker.removeProductTransferStatus(product);
        return true;
    }
View Full Code Here

        transferStatusTracker.removeProductTransferStatus(product);
        return true;
    }

    public boolean isTransferComplete(Hashtable<String, Object> productHash) {
        Product product = XmlRpcStructFactory.getProductFromXmlRpc(productHash);
        return transferStatusTracker.isTransferComplete(product);
    }
View Full Code Here

    }

    public synchronized boolean setProductTransferStatus(
            Hashtable<String, Object> productHash)
            throws CatalogException {
        Product product = XmlRpcStructFactory.getProductFromXmlRpc(productHash);
        catalog.setProductTransferStatus(product);
        return true;
    }
View Full Code Here

TOP

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

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.