Hi Niloofar,
One key aspect is the ProductType. Filling it requires knowledge and
information that the repository manager provides. Check out the way that the
product type gets filled on ingest, and that will lead you down a path for
figuring this out.
Thanks,
Chris
On Mar 17, 2011, at 6:23 PM, niloofar montazeri wrote:
> Hi!
>
> I am having trouble with trackimg a design decision about the FileManager
> component back into the code.
>
> The decision is: "The system Interface uses the information about Product
> Type policy made available by the Repository Manager in order to understand
> whether or not the product should be transferred, where its root repository
> path should be, and so on ."
>
> Looking at the code of ingestProduct method and examining all the methods
> that access the FileManager's repositoryManager instance, I found that the
> only role the repositoryManager plays in ingestProduct method is to assign
> meta-data to the product. After that, there is no such decision point for
> sending or not sending the product (the product is always transferred):
>
> public String ingestProduct(Hashtable<String, Object> productHash,
> Hashtable<String, String> metadata, boolean clientTransfer)
> throws VersioningException, RepositoryManagerException,
> DataTransferException, CatalogException {
>
> Product p = XmlRpcStructFactory.getProductFromXmlRpc(productHash);
>
> try {
> // first, create the product
> p.setTransferStatus(Product.STATUS_TRANSFER);
> catalogProduct(p);
>
> // now add the metadata
> Metadata m = new Metadata();
> m.addMetadata((Hashtable)metadata);
>
> addMetadata(p, m);
>
> if (!clientTransfer) {
> LOG.log(Level.FINEST,
> "File Manager: ingest: no client transfer enabled, "
> + "server transfering product: [" + p.getProductName() + "]");
>
> // version the product
> Versioner versioner = null;
> try {
> versioner = GenericFileManagerObjectFactory
> .getVersionerFromClassName(p.getProductType().getVersioner());
> versioner.createDataStoreReferences(p, m);
> } catch (Exception e) {
> LOG.log(Level.SEVERE,
> "ingestProduct: VersioningException when versioning Product: "
> + p.getProductName() + " with Versioner "
> + p.getProductType().getVersioner() + ": Message: "
> + e.getMessage());
> throw new VersioningException(e);
> }
>
> // add the newly versioned references to the data store
> addProductReferences(p);
>
> // now transfer the product
> try {
> dataTransfer.transferProduct(p);
> // now update the product's transfer status in the data store
> p.setTransferStatus(Product.STATUS_RECEIVED);
>
> try {
> catalog.setProductTransferStatus(p);
> } catch (CatalogException e) {
> LOG.log(Level.SEVERE, "ingestProduct: CatalogException "
> + "when updating product transfer status for Product: "
> + p.getProductName() + " Message: " + e.getMessage());
> throw e;
> }
> } catch (Exception e) {
> LOG.log(Level.SEVERE,
> "ingestProduct: DataTransferException when transfering Product:
> "
> + p.getProductName() + ": Message: " + e.getMessage());
> throw new DataTransferException(e);
> }
> }
>
> // that's it!
> return p.getProductId();
> } catch (Exception e) {
> e.printStackTrace();
> throw new CatalogException("Error ingesting product [" + p + "] : "
> + e.getMessage());
> }
>
>
> Am I missing something?
>
> Thanks,
> Niloofar
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Chris Mattmann, Ph.D.
Senior Computer Scientist
NASA Jet Propulsion Laboratory Pasadena, CA 91109 USA
Office: 171-266B, Mailstop: 171-246
Email: [email protected]
WWW: http://sunset.usc.edu/~mattmann/
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adjunct Assistant Professor, Computer Science Department
University of Southern California, Los Angeles, CA 90089 USA
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++