You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by bf...@apache.org on 2010/12/23 03:48:11 UTC

svn commit: r1052148 [7/17] - in /oodt/branches/wengine-branch/filemgr: ./ .settings/ src/ src/main/ src/main/assembly/ src/main/bin/ src/main/java/ src/main/java/gov/ src/main/java/gov/nasa/ src/main/java/gov/nasa/jpl/ src/main/java/gov/nasa/jpl/oodt/...

Added: oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCache.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCache.java?rev=1052148&view=auto
==============================================================================
--- oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCache.java (added)
+++ oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCache.java Thu Dec 23 02:48:02 2010
@@ -0,0 +1,187 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.filemgr.ingest;
+
+//JDK imports
+import java.net.URL;
+import java.rmi.Naming;
+import java.rmi.RemoteException;
+import java.util.List;
+
+//OODT imports
+import org.apache.oodt.cas.filemgr.structs.exceptions.CacheException;
+
+/**
+ * @author mattmann
+ * @author bfoster
+ * @version $Revision$
+ * 
+ * <p>
+ * An RMI client to the {@link RmiCacheServer}, implementing an RMI front end
+ * to a {@link LocalCache}.
+ * </p>.
+ */
+public class RmiCache implements Cache {
+
+    private RemoteableCache rmiCacheServer;
+
+    public RmiCache(String rmiCacheServerUrn) throws InstantiationException {
+        try {
+            rmiCacheServer = (RemoteableCache) Naming.lookup(rmiCacheServerUrn);
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new InstantiationException(
+                    "Unable to connect to Rmi Cache Server at: ["
+                            + rmiCacheServerUrn + "]");
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.ingest.Cache#clear()
+     */
+    public void clear() {
+        try {
+            rmiCacheServer.clear();
+        } catch (RemoteException e) {
+        }
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.ingest.Cache#contains(java.lang.String)
+     */
+    public boolean contains(String productName) {
+        try {
+            return rmiCacheServer.contains(productName);
+        } catch (RemoteException e) {
+            return false;
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.ingest.Cache#setFileManager(java.net.URL)
+     */
+    public void setFileManager(URL fmUrl) {
+        try {
+            rmiCacheServer.setFileManager(fmUrl);
+        } catch (RemoteException e) {
+            
+        }
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.ingest.Cache#size()
+     */
+    public int size() {
+        try {
+            return rmiCacheServer.size();
+        } catch (RemoteException e) {
+            return -1;
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.ingest.Cache#sync(java.util.List)
+     */
+    public void sync(List<String> uniqueElementProductTypeNames) throws CacheException {
+        try {
+            rmiCacheServer.sync(uniqueElementProductTypeNames);
+        } catch (RemoteException e) {
+            throw new CacheException(e.getMessage());
+        }
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.ingest.Cache#sync(java.lang.String,
+     *      java.util.List)
+     */
+    public void sync(String uniqueElementName,
+            List<String> uniqueElementProductTypeNames) throws CacheException {
+        try {
+            rmiCacheServer.sync(uniqueElementName, uniqueElementProductTypeNames);
+        } catch (RemoteException e) {
+           throw new CacheException(e.getMessage());
+        }
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.ingest.Cache#setUniqueElementProductTypeName(java.util.List)
+     */
+    public void setUniqueElementProductTypeNames(
+            List<String> uniqueElementProductTypeNames) {
+        try {
+            rmiCacheServer
+                    .setUniqueElementProductTypeNames(uniqueElementProductTypeNames);
+        } catch (RemoteException e) {
+        }
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.ingest.Cache#sync()
+     */
+    public void sync() throws CacheException {
+        try {
+            rmiCacheServer.sync();
+        } catch (RemoteException e) {
+            throw new CacheException(e.getMessage());
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.ingest.Cache#setUniqueElementName(java.lang.String)
+     */
+    public void setUniqueElementName(String uniqueElementName) {
+        try {
+            rmiCacheServer.setUniqueElementName(uniqueElementName);
+        } catch (RemoteException e) {
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see gov.nasa.jpl.oodt.cas.filemgr.ingest.Cache#getFileManagerUrl()
+     */
+    public URL getFileManagerUrl() {
+        try {
+            return rmiCacheServer.getFileManagerUrl();
+        } catch (RemoteException e) {
+            return null;
+        }
+    }
+
+}

Added: oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCacheFactory.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCacheFactory.java?rev=1052148&view=auto
==============================================================================
--- oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCacheFactory.java (added)
+++ oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCacheFactory.java Thu Dec 23 02:48:02 2010
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.filemgr.ingest;
+
+//OODT imports
+import org.apache.oodt.cas.metadata.util.PathUtils;
+
+/**
+ * @author mattmann
+ * @version $Revision$
+ * 
+ * <p>
+ * Constructs new {@link RmiCache}s.
+ * </p>.
+ */
+public class RmiCacheFactory implements CacheFactory {
+
+    private String rmiCacheServerUrn;
+
+    public RmiCacheFactory() {
+        rmiCacheServerUrn = PathUtils
+                .replaceEnvVariables(System
+                        .getProperty("gov.nasa.jpl.oodt.cas.filemgr.ingest.cache.rmi.serverUrn"));
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.ingest.CacheFactory#createCache()
+     */
+    public Cache createCache() throws InstantiationException {
+        return new RmiCache(rmiCacheServerUrn);
+    }
+
+}

Added: oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCacheServer.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCacheServer.java?rev=1052148&view=auto
==============================================================================
--- oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCacheServer.java (added)
+++ oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCacheServer.java Thu Dec 23 02:48:02 2010
@@ -0,0 +1,197 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.filemgr.ingest;
+
+//JDK imports
+import java.io.Serializable;
+import java.net.URL;
+import java.rmi.Naming;
+import java.rmi.RemoteException;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+import java.rmi.server.UnicastRemoteObject;
+import java.util.List;
+
+//OODT imports
+import org.apache.oodt.cas.filemgr.structs.exceptions.CacheException;
+
+/**
+ * 
+ * @author bfoster
+ * @author mattmann
+ * 
+ * A Java RMI based interface to a backend {@link LocalCache}.
+ * 
+ */
+public class RmiCacheServer extends UnicastRemoteObject implements RemoteableCache, Serializable{
+
+    private static final long serialVersionUID = -538329403363156379L;
+
+    private LocalCache cache;
+
+    private String uniqueElementName;
+
+    private List<String> uniqueElementProductTypeNames;
+    
+    private Registry reg;
+
+    public RmiCacheServer(URL fmUrl, String rangeQueryElementName,
+            String rangeStartDateTime, String rangeEndDateTime,
+            String uniqueElementName, List<String> productTypeNames)
+            throws RemoteException {
+        // initialize the cache
+        cache = new LocalCache(fmUrl, rangeQueryElementName,
+                rangeStartDateTime, rangeEndDateTime);
+        this.uniqueElementName = uniqueElementName;
+        this.uniqueElementProductTypeNames = productTypeNames;
+
+    }
+
+    public void launchServer(int rmiPort) throws RemoteException {
+        launchServer(this.cache.getFileManagerUrl(), rmiPort);
+    }
+
+    public void launchServer(URL filemgrUrl, int rmiPort)
+            throws RemoteException {
+        syncWith(filemgrUrl);
+        launchRmiServer(rmiPort);
+    }
+
+    public void stopServer(int port) throws RemoteException {
+        try {
+            Naming.unbind("rmi://localhost:" + port + "/RmiDatabaseServer");
+            UnicastRemoteObject.unexportObject(reg,true);
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RemoteException(
+                    "Unable to unbind Database Server: reason: "
+                            + e.getMessage());
+        }
+    }
+
+    public void clear() throws RemoteException {
+        cache.clear();
+
+    }
+
+    public boolean contains(String productName) throws RemoteException {
+        return cache.contains(productName);
+    }
+
+    public void setFileManager(URL fmUrl) throws RemoteException {
+        cache.setFileManager(fmUrl);
+    }
+
+    public int size() throws RemoteException {
+        return cache.size();
+    }
+
+    public void sync(List<String> uniqueElementProductTypeNames) throws RemoteException {
+        try {
+            cache.sync(uniqueElementProductTypeNames);
+        } catch (CacheException e) {
+            throw new RemoteException(e.getMessage());
+        }
+
+    }
+
+    public void sync(String uniqueElementName,
+            List<String> uniqueElementProductTypeNames) throws RemoteException {
+        try {
+            cache.sync(uniqueElementName, uniqueElementProductTypeNames);
+        } catch (CacheException e) {
+            throw new RemoteException(e.getMessage());
+        }
+
+    }
+
+    public void sync() throws RemoteException {
+        if (this.uniqueElementName == null
+                || (this.uniqueElementProductTypeNames == null || (this.uniqueElementProductTypeNames != null && this.uniqueElementProductTypeNames
+                        .size() == 0))) {
+            throw new RemoteException(
+                    "Both uniqueElementName and uniqueElementProductTypeNames must "
+                            + "be defined in order to use this form of the sync operation!");
+        }
+
+        sync(this.uniqueElementName, this.uniqueElementProductTypeNames);
+
+    }
+
+    public URL getFileManagerUrl() throws RemoteException {
+        return cache.getFileManagerUrl();
+    }
+
+    /**
+     * @return the uniqueElementProductTypeNames
+     */
+    public List<String> getUniqueElementProductTypeNames() throws RemoteException {
+        return uniqueElementProductTypeNames;
+    }
+
+    /**
+     * @param uniqueElementProductTypeNames
+     *            the uniqueElementProductTypeNames to set
+     */
+    public void setUniqueElementProductTypeNames(
+            List<String> uniqueElementProductTypeNames) throws RemoteException {
+        this.uniqueElementProductTypeNames = uniqueElementProductTypeNames;
+    }
+
+    /**
+     * @return the uniqueElementName
+     */
+    public String getUniqueElementName() throws RemoteException {
+        return uniqueElementName;
+    }
+
+    /**
+     * @param uniqueElementName
+     *            the uniqueElementName to set
+     */
+    public void setUniqueElementName(String uniqueElementName)
+            throws RemoteException {
+        this.uniqueElementName = uniqueElementName;
+    }
+
+    private void syncWith(URL url) throws RemoteException {
+        cache.setFileManager(url);
+        try {
+            cache.sync(this.uniqueElementName,
+                    this.uniqueElementProductTypeNames);
+        } catch (CacheException e) {
+            throw new RemoteException(
+                    "Unable to sync cache with file manager: [" + url
+                            + "]: Message: " + e.getMessage());
+        }
+    }
+
+    private void launchRmiServer(int port) throws RemoteException {
+        try {
+            reg = LocateRegistry.createRegistry(port);
+            Naming.rebind("rmi://localhost:" + port + "/RmiDatabaseServer", this);
+            System.out.println("RMI server created at rmi://localhost:" + port
+                    + "/RmiDatabaseServer");
+        } catch (Exception e) {
+            throw new RemoteException("Failed to create RMI Server : "
+                    + e.getMessage());
+        }
+
+        
+    }
+
+}

Added: oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCacheServerFactory.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCacheServerFactory.java?rev=1052148&view=auto
==============================================================================
--- oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCacheServerFactory.java (added)
+++ oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/RmiCacheServerFactory.java Thu Dec 23 02:48:02 2010
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.filemgr.ingest;
+
+//JDK imports
+import java.io.FileInputStream;
+import java.net.URL;
+
+/**
+ * @author mattmann
+ * @version $Revision$
+ * 
+ * <p>
+ * Constructs new {@link RmiCacheServer}s.
+ * </p>.
+ */
+public class RmiCacheServerFactory extends AbstractCacheServerFactory{
+
+    /**
+     * @throws InstantiationException
+     */
+    public RmiCacheServerFactory() throws InstantiationException {
+        super();
+    }
+    
+    public Cache createCache() throws InstantiationException{
+        throw new InstantiationException("Don't call this method for the RmiCacheServer!");
+    }
+
+    public RmiCacheServer createRemoteCache() throws InstantiationException {
+        try {
+            return new RmiCacheServer(fmUrl, rangeQueryElementName,
+                    rangeStartDateTime, rangeEndDateTime, uniqueElementName,
+                    productTypeNames);
+
+        } catch (Exception e) {
+            throw new InstantiationException(e.getMessage());
+        }
+    }
+
+    public static void main(String[] args) {
+        String propFilePath = null, fileManagerUrl = null;
+        int rmiPort = -1;
+
+        String usage = "RmiCacheServer [options] \n"
+                + "--fileManagerUrl <url> \n" + "--rmiPort <port number> \n"
+                + "--propFile <path>\n";
+
+        for (int i = 0; i < args.length; i++) {
+            if (args[i].equals("--fileManagerUrl")) {
+                fileManagerUrl = args[++i];
+            } else if (args[i].equals("--propFile")) {
+                propFilePath = args[++i];
+            } else if (args[i].equals("--rmiPort")) {
+                rmiPort = Integer.parseInt(args[++i]);
+            }
+        }
+
+        if (propFilePath == null || fileManagerUrl == null || rmiPort == -1) {
+            System.out.println(usage);
+            return;
+        }
+
+        try {
+            System.getProperties().load(new FileInputStream(propFilePath));
+            RmiCacheServerFactory svrFactory = new RmiCacheServerFactory();
+            RmiCacheServer cache = (RmiCacheServer)svrFactory.createRemoteCache();
+            cache.launchServer(new URL(fileManagerUrl), rmiPort);
+        } catch (Exception e) {
+            System.err.println("Failed to launch RmiCacheServer : "
+                    + e.getMessage());
+        }
+    }
+
+}

Added: oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/StdIngester.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/StdIngester.java?rev=1052148&view=auto
==============================================================================
--- oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/StdIngester.java (added)
+++ oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/StdIngester.java Thu Dec 23 02:48:02 2010
@@ -0,0 +1,292 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.filemgr.ingest;
+
+//OODT imports
+import org.apache.oodt.cas.filemgr.metadata.CoreMetKeys;
+import org.apache.oodt.cas.filemgr.structs.Product;
+import org.apache.oodt.cas.filemgr.structs.ProductType;
+import org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
+import org.apache.oodt.cas.filemgr.structs.exceptions.ConnectionException;
+import org.apache.oodt.cas.filemgr.structs.exceptions.IngestException;
+import org.apache.oodt.cas.filemgr.structs.exceptions.RepositoryManagerException;
+import org.apache.oodt.cas.filemgr.system.XmlRpcFileManagerClient;
+import org.apache.oodt.cas.filemgr.util.GenericFileManagerObjectFactory;
+import org.apache.oodt.cas.filemgr.versioning.VersioningUtils;
+import org.apache.oodt.cas.metadata.MetExtractor;
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.metadata.exceptions.MetExtractionException;
+
+//JDK imports
+import java.io.File;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * @author mattmann
+ * @author bfoster
+ * @version $Revision$
+ * 
+ * <p>
+ * An implementation of the {@link Ingster} interface that uses the following
+ * pieces of {@link Metadata} information to determine how to ingest a
+ * {@link Product}:
+ * 
+ * <ul>
+ * <li>Filename - The name of the Product file to ingest.</li>
+ * <li>ProductType - The type of the Product to ingest.</li>
+ * <li>FileLocation - A full path pointer to directory containing the Product
+ * file to ingest.</li>
+ * </ul>
+ * 
+ * The {@link Ingester} supports overriding certain {@link Product} properties,
+ * including:
+ * 
+ * <ul>
+ * <li>Specification of <code>ProductStructure</code> parameter that will
+ * tell the {@link Ingester} whether or not the {@link Product} is a directory
+ * or a regular file.</li>
+ * <li>Specification of <code>ProductName</code> parameter that will tell the
+ * {@link Ingester} a name for the {@link Product} to use (default is using the
+ * specified {@link Metadata} field, <code>Filename</code>.</li>
+ * </ul>
+ * </p>.
+ */
+public class StdIngester implements Ingester, CoreMetKeys {
+
+    /* our log stream */
+    private final static Logger LOG = Logger.getLogger(StdIngester.class
+            .getName());
+
+    /* our file manager client */
+    private XmlRpcFileManagerClient fmClient = null;
+
+    /* client transfer service factory */
+    private String clientTransferServiceFactory = null;
+
+    public StdIngester(String transferService) {
+        this.clientTransferServiceFactory = transferService;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.ingest.Ingester#ingest(java.net.URL,
+     *      java.io.File, gov.nasa.jpl.oodt.cas.metadata.MetExtractor,
+     *      java.io.File)
+     */
+    public String ingest(URL fmUrl, File prodFile, MetExtractor extractor,
+            File metConfFile) throws IngestException {
+        Metadata met = null;
+        try {
+            met = extractor.extractMetadata(prodFile, metConfFile);
+        } catch (MetExtractionException e) {
+            e.printStackTrace();
+            throw new IngestException("Met extraction exception on product: ["
+                    + prodFile + "]: Message: " + e.getMessage(), e);
+        }
+
+        return ingest(fmUrl, prodFile, met);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.ingest.Ingester#ingest(java.net.URL,
+     *      java.util.List, gov.nasa.jpl.oodt.cas.metadata.MetExtractor,
+     *      java.io.File)
+     */
+    public void ingest(URL fmUrl, List<String> prodFiles, MetExtractor extractor,
+            File metConfFile) throws IngestException {
+        if (prodFiles != null && prodFiles.size() > 0) {
+            for (Iterator<String> i = prodFiles.iterator(); i.hasNext();) {
+                String prodFilePath = i.next();
+                String productID = ingest(fmUrl, new File(prodFilePath),
+                        extractor, metConfFile);
+                LOG.log(Level.INFO, "Product: [" + prodFilePath
+                        + "] ingested successfully! ID: [" + productID + "]");
+            }
+        }
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.ingest.Ingester#ingest(java.net.URL,
+     *      java.io.File, gov.nasa.jpl.oodt.cas.metadata.Metadata)
+     */
+    public String ingest(URL fmUrl, File prodFile, Metadata met)
+            throws IngestException {
+        checkOrSetFileManager(fmUrl);
+        String productType = met.getMetadata(PRODUCT_TYPE);
+        String fileLocation = met.getMetadata(FILE_LOCATION);
+        String fileName = met.getMetadata(FILENAME);
+
+        if (!check(productType, PRODUCT_TYPE)
+                || !check(fileLocation, FILE_LOCATION)
+                || !check(fileName, FILENAME)) {
+            throw new IngestException("Must specify: " + PRODUCT_TYPE + " and "
+                    + FILENAME + "and " + FILE_LOCATION
+                    + " within metadata file. Cannot ingest product: ["
+                    + prodFile.getAbsolutePath() + "]");
+        }
+
+        // allow user to override default product name (Filename)
+        String productName = met.getMetadata(PRODUCT_NAME) != null ? met
+                .getMetadata(PRODUCT_NAME) : fileName;
+
+        // check to see if product structure was specified
+        String productStructure = met.getMetadata(PRODUCT_STRUCTURE);
+        if (productStructure == null) {
+            // try and guess the structure
+            if (prodFile.isDirectory()) {
+                productStructure = Product.STRUCTURE_HIERARCHICAL;
+            } else
+                productStructure = Product.STRUCTURE_FLAT;
+        }
+
+        // create the product
+        Product product = new Product();
+        product.setProductName(productName);
+        product.setProductStructure(productStructure);
+        product.setProductType(getProductType(productType));
+
+        List<String> references = new Vector<String>();
+        if (!fileLocation.endsWith("/")) {
+            fileLocation += "/";
+        }
+
+        String fullFilePath = fileLocation + fileName;
+
+        references.add(new File(fullFilePath).toURI().toString());
+
+        if (productStructure.equals(Product.STRUCTURE_HIERARCHICAL)) {
+            references.addAll(VersioningUtils.getURIsFromDir(new File(
+                    fullFilePath)));
+        }
+
+        // build refs and attach to product
+        VersioningUtils.addRefsFromUris(product, references);
+
+        LOG.log(Level.INFO, "StdIngester: ingesting product: " + PRODUCT_NAME
+                + ": [" + productName + "]: " + PRODUCT_TYPE + ": ["
+                + productType + "]: " + FILE_LOCATION + ": [" + fileLocation
+                + "]");
+
+        String productID = null;
+
+        try {
+            productID = fmClient.ingestProduct(product, met, true);
+        } catch (Exception e) {
+            e.printStackTrace();
+            LOG.log(Level.WARNING, "exception ingesting product: ["
+                    + productName + "]: Message: " + e.getMessage());
+            throw new IngestException("exception ingesting product: ["
+                    + productName + "]: Message: " + e.getMessage());
+        }
+
+        return productID;
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.ingest.Ingester#hasProduct(java.net.URL,
+     *      java.io.File)
+     */
+    public boolean hasProduct(URL fmUrl, File prodFile) throws CatalogException{
+        return hasProduct(fmUrl, prodFile.getName());
+    }
+
+    private boolean check(String property, String propName) {
+        if (property == null) {
+            LOG.log(Level.WARNING, "Property: [" + propName
+                    + "] is not provided");
+            return false;
+        } else
+            return true;
+    }
+
+    private void checkOrSetFileManager(URL url) {
+        if (this.fmClient != null && this.fmClient.getFileManagerUrl() != null) {
+
+            if (!this.fmClient.getFileManagerUrl().equals(url)) {
+                setFileManager(url);
+            }
+        } else {
+            setFileManager(url);
+        }
+    }
+
+    private void setFileManager(URL url) {
+        try {
+            fmClient = new XmlRpcFileManagerClient(url);
+            LOG.log(Level.INFO, "StdIngester: connected to file manager: ["
+                    + url + "]");
+            // instantiate the client transfer object
+            // the crawler will have the client perform the transfer
+            fmClient
+                    .setDataTransfer(GenericFileManagerObjectFactory
+                            .getDataTransferServiceFromFactory(this.clientTransferServiceFactory));
+        } catch (ConnectionException e) {
+            e.printStackTrace();
+            LOG.log(Level.WARNING, "Unable to connect to file manager: [" + url
+                    + "]: message: " + e.getMessage());
+        }
+
+    }
+
+    private ProductType getProductType(String productTypeName) {
+        ProductType type = null;
+
+        try {
+            type = fmClient.getProductTypeByName(productTypeName);
+        } catch (RepositoryManagerException e) {
+            LOG.log(Level.WARNING, "Unable to obtain product type: ["
+                    + productTypeName + "] from File Manager at: ["
+                    + fmClient.getFileManagerUrl() + "]: Message: "
+                    + e.getMessage());
+        }
+
+        return type;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.ingest.Ingester#hasProduct(java.net.URL,
+     *      java.lang.String)
+     */
+    public boolean hasProduct(URL fmUrl, String productName) throws CatalogException{
+        checkOrSetFileManager(fmUrl);
+        try {
+            return fmClient.hasProduct(productName);
+        } catch (CatalogException e) {
+            LOG.log(Level.WARNING,
+                    "Unable to check for existance of product: [" + productName
+                            + "]: Message: " + e.getMessage(), e);
+            throw e;
+        }
+    }
+
+}

Added: oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/CoreMetKeys.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/CoreMetKeys.java?rev=1052148&view=auto
==============================================================================
--- oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/CoreMetKeys.java (added)
+++ oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/CoreMetKeys.java Thu Dec 23 02:48:02 2010
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.filemgr.metadata;
+
+/**
+ * @author mattmann
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>Describe your class here</p>.
+ */
+public interface CoreMetKeys {
+  
+  public static final String PRODUCT_NAME = "ProductName";
+  
+  public static final String PRODUCT_ID = "ProductId";
+  
+  public static final String PRODUCT_RECEVIED_TIME = "ProductReceivedTime";
+  
+  public static final String FILE_LOCATION = "FileLocation";
+  
+  public static final String FILENAME = "Filename";
+  
+  public static final String PRODUCT_STATUS = "Status";
+  
+  public static final String PRODUCT_TYPE = "ProductType";
+  
+  public static final String PRODUCT_STRUCTURE = "ProductStructure";
+
+  public static final String PRODUCT_ROOT_REF_DATA_STORE = "ProductRootRefDataStore";
+
+  public static final String PRODUCT_ROOT_REF_ORIG = "ProductRootRefOrig";
+  
+  public static final String PRODUCT_ROOT_REF_FILE_SIZE = "ProductRootRefFileSize";
+  
+  public static final String PRODUCT_ROOT_REF_MIME_TYPE = "ProductRootRefMimeType";
+  
+  public static final String PRODUCT_REFERENCE_DATA_STORE = "ProductRefDataStore";
+  
+  public static final String PRODUCT_REFERENCE_ORIGINAL = "ProductRefOrig";
+  
+  public static final String PRODUCT_REFERENCE_FILE_SIZE = "ProductRefFileSize";
+  
+  public static final String PRODUCT_REFERENCE_MIME_TYPE = "MimeType";
+    
+}

Added: oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/AbstractFilemgrMetExtractor.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/AbstractFilemgrMetExtractor.java?rev=1052148&view=auto
==============================================================================
--- oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/AbstractFilemgrMetExtractor.java (added)
+++ oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/AbstractFilemgrMetExtractor.java Thu Dec 23 02:48:02 2010
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.filemgr.metadata.extractors;
+
+//JDK imports
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.List;
+import java.util.Properties;
+
+//OODT imports
+import org.apache.oodt.cas.filemgr.structs.Product;
+import org.apache.oodt.cas.filemgr.structs.Reference;
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.metadata.exceptions.MetExtractionException;
+
+/**
+ * @author mattmann
+ * @version $Revision$
+ * 
+ * <p>
+ * An abstract base class providing functionality to any sub-classing
+ * {@link FilemgrMetExtractor}s.
+ * </p>.
+ */
+public abstract class AbstractFilemgrMetExtractor implements
+        FilemgrMetExtractor {
+
+    protected Properties configuration;
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.metadata.extractors.
+     *      FilemgrMetExtractor#extractMetadata(gov.nasa.jpl.oodt.cas.filemgr.structs.Product,
+     *      gov.nasa.jpl.oodt.cas.metadata.Metadata)
+     */
+    public Metadata extractMetadata(Product product, Metadata met)
+            throws MetExtractionException {
+        validateProduct(product, met);
+        return doExtract(product, met);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.metadata.extractors.FilemgrMetExtractor#configure(java.util.Properties)
+     */
+    public void configure(Properties props) {
+        this.configuration = props;
+        doConfigure();
+    }
+
+    public abstract Metadata doExtract(Product product, Metadata met)
+            throws MetExtractionException;
+
+    public abstract void doConfigure();
+
+    protected void validateProduct(Product product, Metadata met)
+            throws MetExtractionException {
+        if (product.getProductType() == null
+                || (product.getProductType() != null && (product
+                        .getProductType().getName() == null || (product
+                        .getProductType().getName() != null && product
+                        .getProductType().getName().equals(""))))) {
+            throw new MetExtractionException("Product Type undefined");
+        }
+
+        if (product.getProductReferences() == null
+                || (product.getProductReferences() != null && product
+                        .getProductReferences().size() == 0)) {
+            throw new MetExtractionException("Product references undefined");
+        }
+
+        /*
+         * if (met == null || (met != null && (met.getHashtable() == null ||
+         * (met .getHashtable() != null && met.getHashtable().keySet() .size() ==
+         * 0)))) { throw new MetExtractionException("Metadata undefined"); }
+         */
+
+    }
+
+    protected void addMetadataIfUndefined(Metadata origMet, Metadata destMet,
+            String key, String val) {
+        if (!origMet.containsKey(key)) {
+            destMet.addMetadata(key, val);
+        }
+    }
+
+    protected void merge(Metadata src, Metadata dest) {
+        dest.addMetadata(src.getHashtable());
+    }
+
+    protected File getProductFile(Product product)
+            throws MetExtractionException {
+        File prodFile = null;
+
+        if (product.getProductStructure()
+                .equals(Product.STRUCTURE_HIERARCHICAL)) {
+            try {
+                prodFile = new File(getRootRefPath(product
+                        .getProductReferences(), product.getProductType()
+                        .getProductRepositoryPath()));
+            } catch (Exception e) {
+                e.printStackTrace();
+                throw new MetExtractionException("URI exception parsing: ["
+                        + product.getRootRef().getOrigReference() + "]");
+            }
+        } else {
+            try {
+                prodFile = new File(new URI(((Reference) product
+                        .getProductReferences().get(0)).getOrigReference()));
+            } catch (Exception e) {
+                throw new MetExtractionException("URI exception parsing: ["
+                        + ((Reference) product.getProductReferences().get(0))
+                                .getOrigReference() + "]");
+
+            }
+        }
+
+        return prodFile;
+    }
+
+    protected String getRootRefPath(List<Reference> refs,
+            String productTypeRepoPath) throws URISyntaxException {
+        // product type repo: file://foo/path
+        // ref data store path: file:/foo/path/myproddir/dir1/file
+
+        String productTypeAbsPath = new File(new URI(productTypeRepoPath))
+                .getAbsolutePath();
+        String anyRefDataStorePath = new File(new URI(refs.get(0)
+                .getDataStoreReference())).getAbsolutePath();
+        String lastDirPath = anyRefDataStorePath;
+
+        while (!anyRefDataStorePath.equals(productTypeAbsPath)) {
+            lastDirPath = anyRefDataStorePath;
+            // chop off last dir
+            anyRefDataStorePath = anyRefDataStorePath.substring(0,
+                    anyRefDataStorePath.lastIndexOf("/"));
+        }
+
+        return lastDirPath;
+
+    }
+
+}

Added: oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/CoreMetExtractor.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/CoreMetExtractor.java?rev=1052148&view=auto
==============================================================================
--- oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/CoreMetExtractor.java (added)
+++ oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/CoreMetExtractor.java Thu Dec 23 02:48:02 2010
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.filemgr.metadata.extractors;
+
+//OODT imports
+import org.apache.oodt.cas.filemgr.metadata.CoreMetKeys;
+import org.apache.oodt.cas.filemgr.structs.Product;
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.metadata.exceptions.MetExtractionException;
+import org.apache.oodt.commons.util.DateConvert;
+
+//JDK imports
+import java.io.File;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author mattmann
+ * @author bfoster
+ * @version $Revision$
+ * 
+ * <p>
+ * The core {@link FilemgrMetExtractor} providing the {@link CoreMetKeys}
+ * for this {@link Product}.
+ * </p>.
+ */
+public class CoreMetExtractor extends AbstractFilemgrMetExtractor implements
+        CoreMetKeys {
+
+    private boolean namespaceAware = false;
+
+    private String elementNs;
+
+    private static final String nsSeparator = ".";
+
+    private List<String> nsReplaceElements;
+
+    public CoreMetExtractor() {
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.metadata.extractors.
+     *      AbstractFilemgrMetExtractor#doExtract(gov.nasa.jpl.oodt.cas.filemgr.structs.Product,
+     *      gov.nasa.jpl.oodt.cas.metadata.Metadata)
+     */
+    public Metadata doExtract(Product product, Metadata met)
+            throws MetExtractionException {
+        Metadata extractMet = new Metadata();
+        /* copy through original metadata */
+        merge(met, extractMet);
+
+        File prodFile = getProductFile(product);
+
+        extractMet
+                .addMetadata(isNsReplace(PRODUCT_ID) ? elementNs + nsSeparator
+                        + PRODUCT_ID : PRODUCT_ID, product.getProductId());
+        addMetadataIfUndefined(met, extractMet,
+                isNsReplace(FILENAME) ? elementNs + nsSeparator + FILENAME
+                        : FILENAME, prodFile.getName());
+        addMetadataIfUndefined(met, extractMet,
+                isNsReplace(FILE_LOCATION) ? elementNs + nsSeparator
+                        + FILE_LOCATION : FILE_LOCATION, prodFile
+                        .getParentFile().getAbsolutePath());
+        addMetadataIfUndefined(met, extractMet,
+                isNsReplace(PRODUCT_NAME) ? elementNs + nsSeparator
+                        + PRODUCT_NAME : PRODUCT_NAME, product.getProductName());
+        addMetadataIfUndefined(met, extractMet,
+                isNsReplace(PRODUCT_STRUCTURE) ? elementNs + nsSeparator
+                        + PRODUCT_STRUCTURE : PRODUCT_STRUCTURE, product
+                        .getProductStructure());
+        extractMet.addMetadata(isNsReplace(PRODUCT_RECEVIED_TIME) ? elementNs
+                + nsSeparator + PRODUCT_RECEVIED_TIME : PRODUCT_RECEVIED_TIME,
+                DateConvert.isoFormat(new Date()));
+        addMetadataIfUndefined(met, extractMet,
+                isNsReplace(PRODUCT_TYPE) ? elementNs + nsSeparator
+                        + PRODUCT_TYPE : PRODUCT_TYPE, product.getProductType()
+                        .getName());
+
+        return extractMet;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.metadata.extractors.AbstractFilemgrMetExtractor#doConfigure()
+     */
+    public void doConfigure() {
+        if (this.configuration != null) {
+            namespaceAware = Boolean.valueOf(
+                    this.configuration.getProperty("nsAware")).booleanValue();
+
+            if (namespaceAware) {
+                elementNs = this.configuration.getProperty("elementNs");
+                String replaceElemStr = this.configuration
+                        .getProperty("elements");
+                nsReplaceElements = Arrays.asList(replaceElemStr.split(","));
+            }
+        }
+    }
+
+    private boolean isNsReplace(String elemName) {
+        if (this.nsReplaceElements == null
+                || (this.nsReplaceElements != null && this.nsReplaceElements
+                        .size() == 0)) {
+            return false;
+        }
+
+        return namespaceAware && this.nsReplaceElements.contains(elemName);
+    }
+
+}

Added: oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/FilemgrMetExtractor.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/FilemgrMetExtractor.java?rev=1052148&view=auto
==============================================================================
--- oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/FilemgrMetExtractor.java (added)
+++ oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/FilemgrMetExtractor.java Thu Dec 23 02:48:02 2010
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.filemgr.metadata.extractors;
+
+//JDK imports
+import java.util.Properties;
+
+//OODT imports
+import org.apache.oodt.cas.filemgr.structs.Product;
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.metadata.exceptions.MetExtractionException;
+
+/**
+ * @author mattmann
+ * @version $Revision$
+ * 
+ * <p>
+ * The core interface for {@link Metadata} extraction on the File Manager server
+ * side.
+ * </p>.
+ */
+public interface FilemgrMetExtractor {
+
+    /**
+     * Extracts {@link Metadata} from the given {@link Product}.
+     * 
+     * @param product
+     *            The given {@link Product}.
+     * @param met
+     *            The original {@link Metadata} provided during ingestion.
+     * @return Extracted {@link Metadata} derived from the existing
+     *         {@link Metadata} and {@link Product} provided.
+     */
+    public Metadata extractMetadata(Product product, Metadata met)
+            throws MetExtractionException;
+
+    /**
+     * Sets the configuration for this Metadata extractor.
+     * 
+     * @param props
+     *            The {@link Properties} object to configure this Metadata
+     *            extractor with.
+     */
+    public void configure(Properties props);
+}

Added: oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/examples/MimeTypeExtractor.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/examples/MimeTypeExtractor.java?rev=1052148&view=auto
==============================================================================
--- oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/examples/MimeTypeExtractor.java (added)
+++ oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/examples/MimeTypeExtractor.java Thu Dec 23 02:48:02 2010
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.filemgr.metadata.extractors.examples;
+
+//OODT imports
+import org.apache.oodt.cas.filemgr.metadata.extractors.AbstractFilemgrMetExtractor;
+import org.apache.oodt.cas.filemgr.structs.Product;
+import org.apache.oodt.cas.filemgr.structs.Reference;
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.metadata.exceptions.MetExtractionException;
+
+//OODT static imports
+import static org.apache.oodt.cas.filemgr.metadata.CoreMetKeys.*;
+
+/**
+ * @author mattmann
+ * @version $Revision$
+ * 
+ * <p>
+ * An example {@link FilemgrMetExtractor} to extract out a Product's 
+ * Mime Type.
+ * </p>.
+ */
+public class MimeTypeExtractor extends AbstractFilemgrMetExtractor {
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.metadata.extractors.AbstractFilemgrMetExtractor#doConfigure()
+     */
+    public void doConfigure() {
+        // TODO Auto-generated method stub
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.metadata.extractors.AbstractFilemgrMetExtractor#doExtract(gov.nasa.jpl.oodt.cas.filemgr.structs.Product,
+     *      gov.nasa.jpl.oodt.cas.metadata.Metadata)
+     */
+    public Metadata doExtract(Product product, Metadata met)
+            throws MetExtractionException {
+        Metadata extractMet = new Metadata();
+        merge(met, extractMet);
+
+        if (product.getProductStructure().equals(Product.STRUCTURE_FLAT)) {
+            Reference prodRef = (Reference) product.getProductReferences().get(
+                    0);
+            /*Reference mimeRef = new Reference(prodRef.getOrigReference(),
+                    prodRef.getDataStoreReference(), prodRef.getFileSize());*/
+
+            extractMet.addMetadata(PRODUCT_REFERENCE_MIME_TYPE, prodRef.getMimeType().getName());
+            extractMet.addMetadata(PRODUCT_REFERENCE_MIME_TYPE, prodRef.getMimeType()
+                    .getPrimaryType());
+            extractMet.addMetadata(PRODUCT_REFERENCE_MIME_TYPE, prodRef.getMimeType()
+                    .getSubType());
+        }
+
+        return extractMet;
+    }
+
+}

Added: oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/DataSourceRepositoryManager.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/DataSourceRepositoryManager.java?rev=1052148&view=auto
==============================================================================
--- oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/DataSourceRepositoryManager.java (added)
+++ oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/DataSourceRepositoryManager.java Thu Dec 23 02:48:02 2010
@@ -0,0 +1,531 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.filemgr.repository;
+
+//JDK imports
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.List;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.sql.DataSource;
+
+//OODT imports
+import org.apache.oodt.cas.filemgr.structs.ProductType;
+import org.apache.oodt.cas.filemgr.structs.exceptions.RepositoryManagerException;
+import org.apache.oodt.cas.filemgr.util.DbStructFactory;
+
+/**
+ * @author mattmann
+ * @author bfoster
+ * @version $Revision$
+ * 
+ * <p>
+ * An implementation of the {@link RepositoryManager} interface that is backed
+ * by a {@link DataSource} for storing and retreiving {@link Product} policy in
+ * the form of {@link ProductType}s.
+ * </p>
+ * 
+ */
+public class DataSourceRepositoryManager implements RepositoryManager {
+
+    /* our sql data source */
+    private DataSource dataSource = null;
+
+    /* our log stream */
+    private static Logger LOG = Logger.getLogger(DataSourceRepositoryManager.class
+            .getName());
+
+    /**
+     * 
+     * <p>
+     * Default Constructor
+     * </p>.
+     * 
+     * @param ds
+     *            The DataSource to initialize this repository manager with.
+     */
+    public DataSourceRepositoryManager(DataSource ds) {
+        this.dataSource = ds;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.repository.RepositoryManager#addProductType(gov.nasa.jpl.oodt.cas.filemgr.structs.ProductType)
+     */
+    public synchronized void addProductType(ProductType productType)
+            throws RepositoryManagerException {
+        Connection conn = null;
+        Statement statement = null;
+        ResultSet rs = null;
+
+        try {
+            conn = dataSource.getConnection();
+            conn.setAutoCommit(false);
+            statement = conn.createStatement();
+
+            String addProductTypeSql = "INSERT INTO product_types (product_type_name, product_type_description, product_type_repository_path, product_type_versioner_class) "
+                    + "VALUES ('"
+                    + productType.getName()
+                    + "', '"
+                    + productType.getDescription()
+                    + "', '"
+                    + productType.getProductRepositoryPath()
+                    + "', '"
+                    + productType.getVersioner() + "')";
+
+            LOG.log(Level.FINE, "addProductType: Executing: "
+                    + addProductTypeSql);
+            statement.execute(addProductTypeSql);
+
+            String productTypeId = new String();
+            String getProductTypeIdSql = "SELECT MAX(product_type_id) AS max_id FROM product_types";
+
+            rs = statement.executeQuery(getProductTypeIdSql);
+
+            while (rs.next()) {
+                productTypeId = String.valueOf(rs.getInt("max_id"));
+            }
+
+            productType.setProductTypeId(productTypeId);
+
+            // create the references table
+            String createRefSql = "CREATE TABLE product_reference_"
+                    + productTypeId
+                    + " (product_id int NOT NULL, product_orig_reference varchar(255), product_datastore_reference varchar(255))";
+            LOG.log(Level.FINE, "addProductType: Executing: " + createRefSql);
+            statement.execute(createRefSql);
+
+            // create the metadata table
+            String createMetaSql = "CREATE TABLE product_metadata_"
+                    + productTypeId
+                    + " (product_id int NOT NULL, element_id int NOT NULL, metadata_value varchar(2000) NOT NULL)";
+            LOG.log(Level.FINE, "addProductType: Executing: " + createMetaSql);
+            statement.execute(createMetaSql);
+            conn.commit();
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            LOG.log(Level.WARNING, "Exception adding product type. Message: "
+                    + e.getMessage());
+            try {
+                conn.rollback();
+            } catch (SQLException e2) {
+                LOG.log(Level.SEVERE,
+                        "Unable to rollback addProductType transaction. Message: "
+                                + e2.getMessage());
+            }
+            throw new RepositoryManagerException(e.getMessage());
+        } finally {
+
+            if (rs != null) {
+                try {
+                    rs.close();
+                } catch (SQLException ignore) {
+                }
+
+                rs = null;
+            }
+
+            if (statement != null) {
+                try {
+                    statement.close();
+                } catch (SQLException ignore) {
+                }
+
+                statement = null;
+            }
+
+            if (conn != null) {
+                try {
+                    conn.close();
+
+                } catch (SQLException ignore) {
+                }
+
+                conn = null;
+            }
+        }
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.repository.RepositoryManager#modifyProductType(gov.nasa.jpl.oodt.cas.filemgr.structs.ProductType)
+     */
+    public synchronized void modifyProductType(ProductType productType)
+            throws RepositoryManagerException {
+        Connection conn = null;
+        Statement statement = null;
+
+        try {
+            conn = dataSource.getConnection();
+            conn.setAutoCommit(false);
+            statement = conn.createStatement();
+
+            String modifyProductTypeSql = "UPDATE product_types SET product_type_name='"
+                    + productType.getName()
+                    + "', product_type_description='"
+                    + productType.getDescription()
+                    + "', "
+                    + "product_type_versioner_class='"
+                    + productType.getVersioner()
+                    + "', product_type_repository_path='"
+                    + productType.getProductRepositoryPath()
+                    + "' "
+                    + "WHERE product_type_id = "
+                    + productType.getProductTypeId();
+
+            LOG.log(Level.FINE, "modifyProductType: Executing: "
+                    + modifyProductTypeSql);
+            statement.execute(modifyProductTypeSql);
+            conn.commit();
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            LOG.log(Level.WARNING,
+                    "Exception modifying product type. Message: "
+                            + e.getMessage());
+            try {
+                conn.rollback();
+            } catch (SQLException e2) {
+                LOG.log(Level.SEVERE,
+                        "Unable to rollback modifyProductType transaction. Message: "
+                                + e2.getMessage());
+            }
+            throw new RepositoryManagerException(e.getMessage());
+        } finally {
+
+            if (statement != null) {
+                try {
+                    statement.close();
+                } catch (SQLException ignore) {
+                }
+
+                statement = null;
+            }
+
+            if (conn != null) {
+                try {
+                    conn.close();
+
+                } catch (SQLException ignore) {
+                }
+
+                conn = null;
+            }
+        }
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.repository.RepositoryManager#removeProductType(gov.nasa.jpl.oodt.cas.filemgr.structs.ProductType)
+     */
+    public void removeProductType(ProductType productType)
+            throws RepositoryManagerException {
+        Connection conn = null;
+        Statement statement = null;
+
+        try {
+            conn = dataSource.getConnection();
+            conn.setAutoCommit(false);
+            statement = conn.createStatement();
+
+            String deleteProductTypeSql = "DELETE FROM product_types WHERE product_type_id = "
+                    + productType.getProductTypeId();
+
+            LOG.log(Level.FINE, "removeProductType: Executing: "
+                    + deleteProductTypeSql);
+            statement.execute(deleteProductTypeSql);
+
+            // TODO: Decide if it makes sense to delete the references table
+            // and the metadata table here. For now, we won't because maybe
+            // they'll just want to remove the ability to deal with this product
+            // type
+            // rather than remove all of the metdata and references for the
+            // products with it
+            conn.commit();
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            LOG.log(Level.WARNING, "Exception removing product type. Message: "
+                    + e.getMessage());
+            try {
+                conn.rollback();
+            } catch (SQLException e2) {
+                LOG.log(Level.SEVERE,
+                        "Unable to rollback removeProductType transaction. Message: "
+                                + e2.getMessage());
+            }
+            throw new RepositoryManagerException(e.getMessage());
+        } finally {
+            if (statement != null) {
+                try {
+                    statement.close();
+                } catch (SQLException ignore) {
+                }
+
+                statement = null;
+            }
+
+            if (conn != null) {
+                try {
+                    conn.close();
+
+                } catch (SQLException ignore) {
+                }
+
+                conn = null;
+            }
+        }
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.repository.RepositoryManager#getProductTypeById(java.lang.String)
+     */
+    public ProductType getProductTypeById(String productTypeId)
+            throws RepositoryManagerException {
+        Connection conn = null;
+        Statement statement = null;
+        ResultSet rs = null;
+
+        ProductType productType = null;
+
+        try {
+            conn = dataSource.getConnection();
+            statement = conn.createStatement();
+
+            String getProductTypeSql = "SELECT * from product_types WHERE product_type_id = "
+                    + productTypeId;
+
+            LOG.log(Level.FINE, "getProductTypeById: Executing: "
+                    + getProductTypeSql);
+            rs = statement.executeQuery(getProductTypeSql);
+
+            while (rs.next()) {
+                productType = DbStructFactory.getProductType(rs);
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            LOG.log(Level.WARNING, "Exception getting product type. Message: "
+                    + e.getMessage());
+            try {
+                conn.rollback();
+            } catch (SQLException e2) {
+                LOG.log(Level.SEVERE,
+                        "Unable to rollback getProductTypeById transaction. Message: "
+                                + e2.getMessage());
+            }
+            throw new RepositoryManagerException(e.getMessage());
+        } finally {
+
+            if (rs != null) {
+                try {
+                    rs.close();
+                } catch (SQLException ignore) {
+                }
+
+                rs = null;
+            }
+
+            if (statement != null) {
+                try {
+                    statement.close();
+                } catch (SQLException ignore) {
+                }
+
+                statement = null;
+            }
+
+            if (conn != null) {
+                try {
+                    conn.close();
+
+                } catch (SQLException ignore) {
+                }
+
+                conn = null;
+            }
+        }
+
+        return productType;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.repository.RepositoryManager#getProductTypeByName(java.lang.String)
+     */
+    public ProductType getProductTypeByName(String productTypeName)
+            throws RepositoryManagerException {
+        Connection conn = null;
+        Statement statement = null;
+        ResultSet rs = null;
+
+        ProductType productType = null;
+
+        try {
+            conn = dataSource.getConnection();
+            statement = conn.createStatement();
+
+            String getProductTypeSql = "SELECT * from product_types WHERE product_type_name = '"
+                    + productTypeName + "'";
+
+            LOG.log(Level.FINE, "getProductTypeByName: Executing: "
+                    + getProductTypeSql);
+            rs = statement.executeQuery(getProductTypeSql);
+
+            while (rs.next()) {
+                productType = DbStructFactory.getProductType(rs);
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            LOG.log(Level.WARNING, "Exception getting product type. Message: "
+                    + e.getMessage());
+            try {
+                conn.rollback();
+            } catch (SQLException e2) {
+                LOG.log(Level.SEVERE,
+                        "Unable to rollback getProductTypeByName transaction. Message: "
+                                + e2.getMessage());
+            }
+            throw new RepositoryManagerException(e.getMessage());
+        } finally {
+
+            if (rs != null) {
+                try {
+                    rs.close();
+                } catch (SQLException ignore) {
+                }
+
+                rs = null;
+            }
+
+            if (statement != null) {
+                try {
+                    statement.close();
+                } catch (SQLException ignore) {
+                }
+
+                statement = null;
+            }
+
+            if (conn != null) {
+                try {
+                    conn.close();
+
+                } catch (SQLException ignore) {
+                }
+
+                conn = null;
+            }
+        }
+
+        return productType;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.repository.RepositoryManager#getProductTypes()
+     */
+    public List<ProductType> getProductTypes() throws RepositoryManagerException {
+        Connection conn = null;
+        Statement statement = null;
+        ResultSet rs = null;
+
+        List<ProductType> productTypes = null;
+
+        try {
+            conn = dataSource.getConnection();
+            statement = conn.createStatement();
+
+            String getProductTypeSql = "SELECT * from product_types";
+
+            LOG.log(Level.FINE, "getProductTypes: Executing: "
+                    + getProductTypeSql);
+            rs = statement.executeQuery(getProductTypeSql);
+
+            productTypes = new Vector<ProductType>();
+            while (rs.next()) {
+                ProductType productType = DbStructFactory.getProductType(rs);
+                productTypes.add(productType);
+            }
+
+            if (productTypes.size() == 0) {
+                productTypes = null;
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            LOG.log(Level.WARNING, "Exception getting product types. Message: "
+                    + e.getMessage());
+            try {
+                conn.rollback();
+            } catch (SQLException e2) {
+                LOG.log(Level.SEVERE,
+                        "Unable to rollback getProductTypes transaction. Message: "
+                                + e2.getMessage());
+            }
+            throw new RepositoryManagerException(e.getMessage());
+        } finally {
+
+            if (rs != null) {
+                try {
+                    rs.close();
+                } catch (SQLException ignore) {
+                }
+
+                rs = null;
+            }
+
+            if (statement != null) {
+                try {
+                    statement.close();
+                } catch (SQLException ignore) {
+                }
+
+                statement = null;
+            }
+
+            if (conn != null) {
+                try {
+                    conn.close();
+
+                } catch (SQLException ignore) {
+                }
+
+                conn = null;
+            }
+        }
+
+        return productTypes;
+    }
+
+}

Added: oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/DataSourceRepositoryManagerFactory.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/DataSourceRepositoryManagerFactory.java?rev=1052148&view=auto
==============================================================================
--- oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/DataSourceRepositoryManagerFactory.java (added)
+++ oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/DataSourceRepositoryManagerFactory.java Thu Dec 23 02:48:02 2010
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.filemgr.repository;
+
+//OODT imports
+import org.apache.oodt.commons.database.DatabaseConnectionBuilder;
+
+//JDK imports
+import javax.sql.DataSource;
+
+/**
+ * @author mattmann
+ * @version $Revision$
+ * 
+ * <p>
+ * A Factory for creating {@link DataSourceRepositoryManager}s.
+ * </p>
+ * 
+ */
+public class DataSourceRepositoryManagerFactory implements
+        RepositoryManagerFactory {
+
+    /* our data source */
+    private DataSource dataSource = null;
+
+    /**
+     * <p>
+     * Default Constructor
+     * </p>.
+     */
+    public DataSourceRepositoryManagerFactory() throws Exception {
+        String jdbcUrl = null, user = null, pass = null, driver = null;
+
+        jdbcUrl = System
+                .getProperty("gov.nasa.jpl.oodt.cas.filemgr.repositorymgr.datasource.jdbc.url");
+        user = System
+                .getProperty("gov.nasa.jpl.oodt.cas.filemgr.repositorymgr.datasource.jdbc.user");
+        pass = System
+                .getProperty("gov.nasa.jpl.oodt.cas.filemgr.repositorymgr.datasource.jdbc.pass");
+        driver = System
+                .getProperty("gov.nasa.jpl.oodt.cas.filemgr.repositorymgr.datasource.jdbc.driver");
+
+        dataSource = DatabaseConnectionBuilder.buildDataSource(user, pass,
+                driver, jdbcUrl);
+    }
+
+    /**
+     * <p>
+     * Constructs a RepositoryManager from the given {@link DataSource}.
+     * </p>
+     * 
+     * @param ds
+     *            The DataSource to construct the RepositoryManager from.
+     */
+    public DataSourceRepositoryManagerFactory(DataSource ds) {
+        dataSource = ds;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see gov.nasa.jpl.oodt.cas.filemgr.repository.RepositoryManagerFactory#createRepositoryManager()
+     */
+    public RepositoryManager createRepositoryManager() {
+        return new DataSourceRepositoryManager(dataSource);
+    }
+
+}

Added: oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/RepositoryManager.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/RepositoryManager.java?rev=1052148&view=auto
==============================================================================
--- oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/RepositoryManager.java (added)
+++ oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/RepositoryManager.java Thu Dec 23 02:48:02 2010
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.filemgr.repository;
+
+//JDK imports
+import java.util.List;
+
+//OODT imports
+import org.apache.oodt.cas.filemgr.structs.Product;
+import org.apache.oodt.cas.filemgr.structs.ProductType;
+import org.apache.oodt.cas.filemgr.structs.exceptions.RepositoryManagerException;
+
+/**
+ * @author mattmann
+ * @author bfoster
+ * @version $Revision$
+ * 
+ * A Repository Manager is an extension point that is responsible for managing
+ * {@link ProductType} information which boils down to policy information about
+ * {@link Product}s that are ingested into the File Manager. This includes
+ * information such as the root repository path for a product type, what type of
+ * URI generation scheme to apply, etc.
+ * </p>
+ * 
+ */
+public interface RepositoryManager {
+
+    /* extension point ID */
+    public static String X_POINT_ID = RepositoryManager.class.getName();
+
+    /**
+     * <p>
+     * Adds a ProductType to the RepositoryManager.
+     * </p>
+     * 
+     * @param productType
+     *            The {@link ProductType} to add.
+     * @throws RepositoryManagerException
+     */
+    public void addProductType(ProductType productType)
+            throws RepositoryManagerException;
+
+    /**
+     * <p>
+     * Modifies a ProductType in the RepositoryManager with the specified ID
+     * field of the <code>productType</code>.
+     * </p>
+     * 
+     * @param productType
+     *            The new {@link ProductType} information.
+     * @throws RepositoryManagerException
+     *             If any error occurs.
+     */
+    public void modifyProductType(ProductType productType)
+            throws RepositoryManagerException;
+
+    /**
+     * <p>
+     * Removes a ProductType from the RepositoryManager
+     * </p>.
+     * 
+     * @param productType
+     *            The productType to remove.
+     * @throws RepositoryManagerException
+     *             If any error occurs during the removal.
+     */
+    public void removeProductType(ProductType productType)
+            throws RepositoryManagerException;
+
+    /**
+     * <p>
+     * Gets a {link ProductType} from the RepositoryManager identified by its
+     * <code>productTypeId</code>.
+     * </p>
+     * 
+     * @param productTypeId
+     *            The ID of the ProductType to retrieve.
+     * @return The {@link ProductType} corresponding to the specified
+     *         <code>productTypeId</code>.
+     * @throws RepositoryManagerException
+     *             If any error occurs.
+     */
+    public ProductType getProductTypeById(String productTypeId)
+            throws RepositoryManagerException;
+
+    /**
+     * <p>
+     * Gets a {@link ProductType} specified by its <code>productTypeName</code>,
+     * from the RepositoryManager.
+     * </p>
+     * 
+     * @param productTypeName
+     *            The name of the ProductType to get.
+     * @return A {@link ProductType}, with the specified name.
+     * @throws RepositoryManagerException
+     *             If any error occurs.
+     */
+    public ProductType getProductTypeByName(String productTypeName)
+            throws RepositoryManagerException;
+
+    /**
+     * <p>
+     * Gets all the {@link ProductType}s from the repository.
+     * </p>
+     * 
+     * @return A {@link List} of {@link ProductType}s from the repository.
+     * @throws RepositoryManagerException
+     *             If any error occurs.
+     */
+    public List<ProductType> getProductTypes() throws RepositoryManagerException;
+}

Added: oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/RepositoryManagerFactory.java
URL: http://svn.apache.org/viewvc/oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/RepositoryManagerFactory.java?rev=1052148&view=auto
==============================================================================
--- oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/RepositoryManagerFactory.java (added)
+++ oodt/branches/wengine-branch/filemgr/src/main/java/org/apache/oodt/cas/filemgr/repository/RepositoryManagerFactory.java Thu Dec 23 02:48:02 2010
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oodt.cas.filemgr.repository;
+
+/**
+ * @author mattmann
+ * @version $Revision$
+ * 
+ * <p>
+ * A Factory interface for creating {@link RepositoryManager} objects.
+ * </p>
+ * 
+ */
+public interface RepositoryManagerFactory {
+
+    public RepositoryManager createRepositoryManager();
+}