Examples of FileTransferStatus


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

   @Override
   public FileTransferStatus getCurrentFileTransfer() {
      lastMethodCallDetails = new MethodCallDetails("getCurrentFileTransfer",
            Lists.newArrayList());
      FileTransferStatus status = new FileTransferStatus();
      status.setBytesTransferred(10);
      status.setFileRef(new Reference("file:/orig/file", "file:/ds/file", 4));
      Product p = new Product();
      p.setProductId("TestProductId");
      status.setParentProduct(p);
      return status;
   }
View Full Code Here

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

   @Override
   public List<FileTransferStatus> getCurrentFileTransfers() {
      lastMethodCallDetails = new MethodCallDetails("getCurrentFileTransfers",
            Lists.newArrayList());
      FileTransferStatus status = new FileTransferStatus();
      status.setBytesTransferred(10);
      status.setFileRef(new Reference("file:/orig/file", "file:/ds/file", 4));
      Product p = new Product();
      p.setProductId("TestProductId");
      status.setParentProduct(p);
      return Lists.newArrayList(status);
   }
View Full Code Here

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

    public FileTransferStatus getCurrentFileTransfer()
            throws DataTransferException {
        Vector<Object> argList = new Vector<Object>();

        Hashtable<String, Object> statusHash = null;
        FileTransferStatus status = null;

        try {
            statusHash = (Hashtable<String, Object>) client.execute(
                    "filemgr.getCurrentFileTransfer", argList);
        } catch (XmlRpcException e) {
View Full Code Here

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

    }

    @SuppressWarnings("unchecked")
    public static FileTransferStatus getFileTransferStatusFromXmlRpc(
            Hashtable<String, Object> statusHash) {
        FileTransferStatus status = new FileTransferStatus();
        status.setBytesTransferred(Long.parseLong(statusHash
                .get("bytesTransferred").toString()));
        status.setParentProduct(getProductFromXmlRpc((Hashtable<String, Object>) statusHash.get("parentProduct")));
        status.setFileRef(getReferenceFromXmlRpc((Hashtable<String, Object>) statusHash.get("fileRef")));
        return status;
    }
View Full Code Here

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

        Vector<Hashtable<String, Object>> statusVector = new Vector<Hashtable<String, Object>>();

        if (statuses != null && statuses.size() > 0) {

            for (Iterator<FileTransferStatus> i = statuses.iterator(); i.hasNext();) {
                FileTransferStatus status = i.next();
                statusVector.add(getXmlRpcFileTransferStatus(status));
            }
        }

        return statusVector;
View Full Code Here

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

        List<FileTransferStatus> statuses = new Vector<FileTransferStatus>();

        if (statusVector != null && statusVector.size() > 0) {
            for (Iterator<Hashtable<String, Object>> i = statusVector.iterator(); i.hasNext();) {
                Hashtable<String, Object> statusHash = i.next();
                FileTransferStatus status = getFileTransferStatusFromXmlRpc(statusHash);
                statuses.add(status);
            }
        }

        return statuses;
View Full Code Here

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

        transferStatusTracker.transferringProduct(p);
        return true;
    }

    public Hashtable<String, Object> getCurrentFileTransfer() {
        FileTransferStatus status = transferStatusTracker
                .getCurrentFileTransfer();
        if (status == null) {
            return new Hashtable<String, Object>();
        } else
            return XmlRpcStructFactory.getXmlRpcFileTransferStatus(status);
View Full Code Here

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

                XMLUtils.addNode(doc, channel, "category", "data transfer");
                XMLUtils.addNode(doc, channel, "generator", "CAS File Manager");
                XMLUtils.addNode(doc, channel, "lastBuildDate", buildPubDate);

                for (Iterator i = currentTransfers.iterator(); i.hasNext();) {
                    FileTransferStatus status = (FileTransferStatus) i.next();

                    Element item = XMLUtils.addNode(doc, channel, "item");

                    XMLUtils.addNode(doc, item, "title", status
                            .getParentProduct().getProductName());
                    XMLUtils.addNode(doc, item, "description", status
                            .getParentProduct().getProductType().getName());
                    XMLUtils.addNode(doc, item, "link", base
                            + "/viewTransfer?ref="
                            + status.getFileRef().getOrigReference() + "&size="
                            + status.getFileRef().getFileSize());

                    Metadata m = null;

                    try {
                        m = fClient.getMetadata(status.getParentProduct());

                        String productReceivedTime = m
                                .getMetadata("CAS.ProductReceivedTime");
                        Date receivedTime = null;

                        try {
                            receivedTime = DateConvert
                                    .isoParse(productReceivedTime);
                        } catch (ParseException ignore) {
                        }

                        if (receivedTime != null) {
                            XMLUtils.addNode(doc, item, "pubDate",
                                    dateFormatter.format(receivedTime));
                        }

                        // set product transfer metadata
                        m.addMetadata("BytesTransferred",
                          "" + status.getBytesTransferred());
                        m.addMetadata("TotalBytes",
                          "" + status.getFileRef().getFileSize());
                        m.addMetadata("PercentComplete",
                          "" + status.computePctTransferred());

                    } catch (CatalogException ignore) {
                    }

                    // add additional elements from the RSSConfig
View Full Code Here

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

    product1.setProductId("123");
    product1.setProductName("test product");
    product1.setProductStructure("flat");
    product1.setProductType(productType1);

    FileTransferStatus status1 = new FileTransferStatus(reference1, 1000, 100,
      product1);


    // Create another FileTransferStatus instance using Metadata, Reference,
    // ProductType and Product instances.
    Hashtable metadataEntries2 = new Hashtable<String, Object>();
    metadataEntries2.put("CAS.ProductReceivedTime", "2011-04-11T11:59:59.662Z");
    Metadata metadata2 = new Metadata();
    metadata2.addMetadata(metadataEntries2);

    Reference reference2 = new Reference("original2", "dataStore2", 500,
      new MimeTypes().forName("application/pdf"));

    ProductType productType2 = new ProductType("2", "TestType2", "test type 2",
        "repository2", "versioner2");

    Product product2 = new Product();
    product2.setProductId("456");
    product2.setProductName("test product 2");
    product2.setProductStructure("hierarchical");
    product2.setProductType(productType2);

    FileTransferStatus status2 = new FileTransferStatus(reference2, 500, 200,
      product2);


    // Create a TransfersResource using the two FileTransferStatus instances to
    // generate TransferResource instances for the TransfersResource.
    List<TransferResource> resources = new ArrayList<TransferResource>();
    resources.add(new TransferResource(product1, metadata1, status1));
    resources.add(new TransferResource(product2, metadata2, status2));
    TransfersResource resource = new TransfersResource("ALL", resources);

    // Generate the expected output.
    String expectedXml =
      "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"
      + "<transfers productId=\"ALL\">"
      + "<transfer>"
      + "<productName>" + product1.getProductName() + "</productName>"
      + "<productId>" + product1.getProductId() + "</productId>"
      + "<productTypeName>" + productType1.getName() + "</productTypeName>"
      + "<dataStoreReference>"
      +    reference1.getDataStoreReference()
      + "</dataStoreReference>"
      + "<origReference>" + reference1.getOrigReference() + "</origReference>"
      + "<mimeType>" + reference1.getMimeType().getName() + "</mimeType>"
      + "<fileSize>" + reference1.getFileSize() + "</fileSize>"
      + "<totalBytes>" + reference1.getFileSize() + "</totalBytes>"
      + "<bytesTransferred>"
      +    status1.getBytesTransferred()
      + "</bytesTransferred>"
      + "<percentComplete>"
      +    status1.computePctTransferred() * 100
      + "</percentComplete>"
      + "<productReceivedTime>"
      +    metadata1.getAllValues().get(0)
      + "</productReceivedTime>"
      + "</transfer>"
      + "<transfer>"
      + "<productName>" + product2.getProductName() + "</productName>"
      + "<productId>" + product2.getProductId() + "</productId>"
      + "<productTypeName>" + productType2.getName() + "</productTypeName>"
      + "<dataStoreReference>"
      +    reference2.getDataStoreReference()
      + "</dataStoreReference>"
      + "<origReference>" + reference2.getOrigReference() + "</origReference>"
      + "<mimeType>" + reference2.getMimeType().getName() + "</mimeType>"
      + "<fileSize>" + reference2.getFileSize() + "</fileSize>"
      + "<totalBytes>" + reference2.getFileSize() + "</totalBytes>"
      + "<bytesTransferred>"
      +    status2.getBytesTransferred()
      + "</bytesTransferred>"
      + "<percentComplete>"
      +    status2.computePctTransferred() * 100
      + "</percentComplete>"
      + "<productReceivedTime>"
      +    metadata2.getAllValues().get(0)
      + "</productReceivedTime>"
      + "</transfer>"
View Full Code Here

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

    product.setProductId("123");
    product.setProductName("test product");
    product.setProductStructure("flat");
    product.setProductType(productType);

    FileTransferStatus status = new FileTransferStatus(reference, 1000, 100,
      product);

    TransferResource resource = new TransferResource(product, metadata, status);


    // Generate the expected output.
    String expectedXml =
      "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"
      + "<transfer>"
      + "<productName>" + product.getProductName() + "</productName>"
      + "<productId>" + product.getProductId() + "</productId>"
      + "<productTypeName>" + productType.getName() + "</productTypeName>"
      + "<dataStoreReference>"
      +   reference.getDataStoreReference()
      + "</dataStoreReference>"
      + "<origReference>"
      +   reference.getOrigReference()
      + "</origReference>"
      + "<mimeType>" + reference.getMimeType().getName() + "</mimeType>"
      + "<fileSize>" + reference.getFileSize() + "</fileSize>"
      + "<totalBytes>" + reference.getFileSize() + "</totalBytes>"
      + "<bytesTransferred>"
      +    status.getBytesTransferred()
      + "</bytesTransferred>"
      + "<percentComplete>"
      +    status.computePctTransferred() * 100
      + "</percentComplete>"
      + "<productReceivedTime>"
      +    metadata.getAllValues().get(0)
      + "</productReceivedTime>"
      + "</transfer>";
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.