You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by ma...@apache.org on 2011/01/11 02:09:13 UTC
svn commit: r1057431 - in /oodt/trunk: CHANGES.txt
filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/InPlaceVersioner.java
filemgr/src/test/org/apache/oodt/cas/filemgr/versioning/TestInPlaceVersioner.java
Author: mattmann
Date: Tue Jan 11 01:09:12 2011
New Revision: 1057431
URL: http://svn.apache.org/viewvc?rev=1057431&view=rev
Log:
- fix for OODT-108 Ability for the file manager to ingest a file in place
Added:
oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/InPlaceVersioner.java (with props)
oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/versioning/TestInPlaceVersioner.java (with props)
Modified:
oodt/trunk/CHANGES.txt
Modified: oodt/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/oodt/trunk/CHANGES.txt?rev=1057431&r1=1057430&r2=1057431&view=diff
==============================================================================
--- oodt/trunk/CHANGES.txt (original)
+++ oodt/trunk/CHANGES.txt Tue Jan 11 01:09:12 2011
@@ -4,6 +4,9 @@ Apache OODT Change Log
Release 0.2 (Current Development)
--------------------------------------------
+* OODT-108 Ability for the file manager to ingest a file in
+ place (Faranak Davoodi via mattmann)
+
* OODT-73 Update the OODT website @ http://oodt.apache.org (goodale, kelly)
* OODT-86 The Product Server Should Have the Capability to Turn Off
Added: oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/InPlaceVersioner.java
URL: http://svn.apache.org/viewvc/oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/InPlaceVersioner.java?rev=1057431&view=auto
==============================================================================
--- oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/InPlaceVersioner.java (added)
+++ oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/InPlaceVersioner.java Tue Jan 11 01:09:12 2011
@@ -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.versioning;
+
+//JDK imports
+import java.util.logging.Logger;
+import java.util.logging.Level;
+
+//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.filemgr.structs.exceptions.VersioningException;
+
+/**
+ *
+ * A Inplace versioner that ingests the file without moving the actual file. It
+ * just copies the file's orgin ref to its datastor ref.
+ *
+ * @author davoodi
+ *
+ */
+public class InPlaceVersioner implements Versioner {
+
+ /* our log stream */
+ private static final Logger LOG = Logger.getLogger(InPlaceVersioner.class
+ .getName());
+
+ /**
+ *
+ */
+ public InPlaceVersioner() {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.oodt.cas.versioning.Versioner#createDataStoreReferences(org.
+ * apache.oodt.cas.data.structs.Product)
+ */
+ public void createDataStoreReferences(Product product, Metadata metadata)
+ throws VersioningException {
+
+ if (product.getProductStructure().equals(Product.STRUCTURE_FLAT)) {
+
+ for (Reference r : product.getProductReferences()) {
+ r.setDataStoreReference(r.getOrigReference());
+ LOG.log(Level.INFO, "in-place ingestion at datastore path: "
+ + r.getDataStoreReference()
+ + ".which is the same as the product's origin: "
+ + r.getOrigReference());
+ }
+ } else {
+ throw new VersioningException("Unsupported product structure: "
+ + product.getProductStructure());
+ }
+
+ }
+
+}
Propchange: oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/InPlaceVersioner.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/versioning/TestInPlaceVersioner.java
URL: http://svn.apache.org/viewvc/oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/versioning/TestInPlaceVersioner.java?rev=1057431&view=auto
==============================================================================
--- oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/versioning/TestInPlaceVersioner.java (added)
+++ oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/versioning/TestInPlaceVersioner.java Tue Jan 11 01:09:12 2011
@@ -0,0 +1,54 @@
+/**
+ * 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.versioning;
+
+//Junit imports
+import junit.framework.TestCase;
+
+//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;
+
+/**
+ *
+ * Test suite for the {@link InPlaceVersioner}.
+ *
+ * @author davoodi
+ * @author mattmann
+ *
+ */
+public class TestInPlaceVersioner extends TestCase {
+
+ /**
+ * @since OODT-108
+ */
+ public void testVersioner() {
+ Product p = Product.getDefaultFlatProduct("test", "urn:oodt:GenericFile");
+ Reference r = new Reference("file:///tmp/test.txt", null, 0L);
+ p.getProductReferences().add(r);
+ InPlaceVersioner versioner = new InPlaceVersioner();
+ Metadata met = new Metadata();
+ try {
+ versioner.createDataStoreReferences(p, met);
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ assertTrue(r.getDataStoreReference().equals(r.getOrigReference()));
+ }
+}
Propchange: oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/versioning/TestInPlaceVersioner.java
------------------------------------------------------------------------------
svn:eol-style = native