This repository has been archived by the owner on May 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- remaining fixes to make #93 functional
- still some issues with DRAT viz viz application 1. expects to have some "objects" in Solr of type: "project" i get the concept a project has a repo, and in the repo is the results of an audit so, type:project->type:software (stats), looks those up then it looks up all type:file which contain the audit results (license header parsing) however even if I hack it to display a project (even though drat stats doesn't index any objects of that type in solr) , it only "sort of works" and in doing so a bunch of stuff is messed up
- Loading branch information
1 parent
a37c0b2
commit a219e8a
Showing
6 changed files
with
78 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
extensions/src/main/java/org/apache/oodt/cas/pge/staging/HashingOrigFileStager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/** | ||
* 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.pge.staging; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.net.URI; | ||
import java.util.logging.Logger; | ||
import org.apache.commons.codec.digest.DigestUtils; | ||
import org.apache.oodt.cas.filemgr.structs.exceptions.DataTransferException; | ||
import org.apache.oodt.cas.pge.metadata.PgeMetadata; | ||
|
||
import com.google.common.io.Files; | ||
|
||
public class HashingOrigFileStager extends FileManagerFileStager { | ||
|
||
private static final Logger LOG = Logger | ||
.getLogger(HashingOrigFileStager.class.getName()); | ||
|
||
/* | ||
* (non-Javadoc) | ||
* | ||
* @see | ||
* org.apache.oodt.cas.pge.staging.FileManagerFileStager#stageFile(java.net. | ||
* URI, java.io.File, org.apache.oodt.cas.pge.metadata.PgeMetadata, | ||
* java.util.logging.Logger) | ||
*/ | ||
@Override | ||
public void stageFile(URI stageFile, File destDir, PgeMetadata pgeMetadata, | ||
Logger logger) | ||
throws IOException, DataTransferException, InstantiationException { | ||
super.stageFile(stageFile, destDir, pgeMetadata, logger); | ||
String appendUri = DigestUtils.md5Hex(new File(stageFile).getAbsolutePath()); | ||
String fromPath = destDir + File.separator | ||
+ new File(stageFile).getName(); | ||
String toPath = destDir + File.separator + appendUri + "-" | ||
+ new File(stageFile).getName(); | ||
LOG.info("Orig File Path: [" + stageFile.toString() + "]: MD5 Hash: [" | ||
+ appendUri + "]: renaming: [" + fromPath + "] to: [" + toPath + "]"); | ||
Files.move(new File(fromPath), new File(toPath)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters