|
14 | 14 | import java.util.Iterator; |
15 | 15 | import java.util.List; |
16 | 16 |
|
| 17 | +import org.apache.logging.log4j.LogManager; |
| 18 | +import org.apache.logging.log4j.Logger; |
17 | 19 | import org.dspace.authorize.AuthorizeException; |
18 | 20 | import org.dspace.content.Collection; |
19 | 21 | import org.dspace.content.Community; |
|
51 | 53 | */ |
52 | 54 | @Suspendable(invoked = Curator.Invoked.INTERACTIVE) |
53 | 55 | public class CompareWithAIP extends AbstractCurationTask { |
| 56 | + private final Logger log = LogManager.getLogger(); |
| 57 | + |
54 | 58 | private String archFmt; |
55 | 59 | private int status = Curator.CURATE_UNSET; |
56 | 60 | private String result = null; |
@@ -88,7 +92,10 @@ public int perform(DSpaceObject dso) throws IOException { |
88 | 92 | File archive = packer.pack(packDir); |
89 | 93 | String chkSum = Utils.checksum(archive, "MD5"); |
90 | 94 | // remove local archive file -- it's no longer needed |
91 | | - archive.delete(); |
| 95 | + //boolean successful = archive.delete(); |
| 96 | + //if (!successful) { |
| 97 | + // log.warn("Failed to delete archive {}", archive.getAbsolutePath()); |
| 98 | + //} |
92 | 99 |
|
93 | 100 | // compare with replica |
94 | 101 | String repChkSum = repMan.objectAttribute(storeGroupName, objId, "checksum"); |
@@ -133,25 +140,25 @@ private void auditExtent(Context context, ReplicaManager repMan, DSpaceObject ds |
133 | 140 |
|
134 | 141 | // If container is a Collection, make sure all Items have AIPs in remote storage |
135 | 142 | if (Constants.COLLECTION == type) { |
136 | | - Collection coll = (Collection)dso; |
137 | | - Iterator<Item> iter = itemService.findByCollection(context, coll); |
| 143 | + Collection collection = (Collection)dso; |
| 144 | + Iterator<Item> iter = itemService.findByCollection(context, collection); |
138 | 145 | while (iter.hasNext()) { |
139 | 146 | checkReplica(context, repMan, iter.next()); |
140 | 147 | } |
141 | 148 | } else if (Constants.COMMUNITY == type) { |
142 | | - // If Community, make sure all Sub-Communities/Collections have AIPs in remote storage |
143 | | - Community comm = (Community)dso; |
144 | | - for (Community subcomm : comm.getSubcommunities()) { |
145 | | - checkReplica(context, repMan, subcomm); |
| 149 | + // If it is a Community, make sure all Sub-Communities/Collections have AIPs in remote storage |
| 150 | + Community community = (Community)dso; |
| 151 | + for (Community subCommunity : community.getSubcommunities()) { |
| 152 | + checkReplica(context, repMan, subCommunity); |
146 | 153 | } |
147 | | - for (Collection coll : comm.getCollections()) { |
148 | | - checkReplica(context, repMan, coll); |
| 154 | + for (Collection collection : community.getCollections()) { |
| 155 | + checkReplica(context, repMan, collection); |
149 | 156 | } |
150 | 157 | } else if (Constants.SITE == type) { |
151 | | - // If Site, check to see all Top-Level Communities have an AIP in remote storage |
152 | | - List<Community> topComm = communityService.findAllTop(context); |
153 | | - for (Community comm : topComm) { |
154 | | - checkReplica(context, repMan, comm); |
| 158 | + // If it is a Site, check to see all Top-Level Communities have an AIP in remote storage |
| 159 | + List<Community> topCommunities = communityService.findAllTop(context); |
| 160 | + for (Community topCommunity : topCommunities) { |
| 161 | + checkReplica(context, repMan, topCommunity); |
155 | 162 | } |
156 | 163 | } |
157 | 164 | } |
|
0 commit comments