// the following types need unzippedDir
else if (fResource.getName().toLowerCase().endsWith(".zip")) {
File fUnzippedDir = unzipFileResource(tempFr);
if (fUnzippedDir == null) {
// in case of failure we forward the error message
throw new AddingResourceException("resource.error.zip");
}
if (TestFileResource.validate(fUnzippedDir)) tempFr = new TestFileResource();
else if (WikiResource.validate(fUnzippedDir)) tempFr = new WikiResource();
else if (PodcastFileResource.validate(fUnzippedDir)) tempFr = new PodcastFileResource(fResourceFileroot, fUnzippedDir);
else if (BlogFileResource.validate(fUnzippedDir)) tempFr = new BlogFileResource(fResourceFileroot, fUnzippedDir);
else if (SurveyFileResource.validate(fUnzippedDir)) tempFr = new SurveyFileResource();
// CP must be later entry... Test- and SurveyFileResource may contain
// imsmanifest.xml as well
else if (ImsCPFileResource.validate(fUnzippedDir)) tempFr = new ImsCPFileResource();
// scorm and cp now can throw an exception which helps to show a
// better error message in case
// of a failure in adding a new resource
else if (ScormCPFileResource.validate(fUnzippedDir)) tempFr = new ScormCPFileResource();
// glossary resources are packaged within zip for import/export
else if (GlossaryResource.validate(fUnzippedDir)) tempFr = new GlossaryResource();
else {
// just a generic ZIP file... we can delete the temporary unziped
// dir...
throw new AddingResourceException("doesn't matter what error key is declared");
}
}
} catch (AddingResourceException exception) {
// in case of failure we delete the resource and forward the error
// message