Class Importer
- java.lang.Object
-
- de.unirostock.sems.cbarchive.web.importer.Importer
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
GitImporter
,HttpImporter
public abstract class Importer extends Object implements Closeable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
Importer.DefaultNameTransformer
The Class DefaultNameTransformer.protected static class
Importer.GitNameTransformer
The Class GitNameTransformer.protected class
Importer.ImportVCard
Wrapper class for VCard datamodel, adding equals and hashCode for better determination in HashMaps/-Sets
-
Field Summary
Fields Modifier and Type Field Description static String
IMPORT_GIT
static String
IMPORT_HTTP
protected String
remoteUrl
protected File
tempFile
protected UserManager
user
-
Constructor Summary
Constructors Constructor Description Importer(UserManager user)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
close()
protected File
createTempDir()
creates a temporary directory, should be cleaned in close.static Importer
getImporter(Archive archive, UserManager user)
Gets an importer corresponding to the type of archive.static Importer
getImporter(String type, String remoteUrl, UserManager user)
Gets an importer corresponding to the given type.String
getRemoteUrl()
String
getSuggestedName()
Suggest a name, in case the user does not provide oneFile
getTempFile()
abstract Importer
importRepo()
static boolean
isImportable(Archive archive)
Checks if the given archive contains import information.
-
-
-
Field Detail
-
IMPORT_HTTP
public static final String IMPORT_HTTP
- See Also:
- Constant Field Values
-
IMPORT_GIT
public static final String IMPORT_GIT
- See Also:
- Constant Field Values
-
remoteUrl
protected String remoteUrl
-
tempFile
protected File tempFile
-
user
protected UserManager user
-
-
Constructor Detail
-
Importer
public Importer(UserManager user)
-
-
Method Detail
-
getImporter
public static Importer getImporter(Archive archive, UserManager user) throws ImporterException
Gets an importer corresponding to the type of archive.- Parameters:
archive
- the archiveuser
- the user- Returns:
- the importer
- Throws:
ImporterException
- the importer exception
-
getImporter
public static Importer getImporter(String type, String remoteUrl, UserManager user) throws ImporterException
Gets an importer corresponding to the given type.- Parameters:
type
- the typeremoteUrl
- the remote urluser
- the user- Returns:
- the importer
- Throws:
ImporterException
- the importer exception
-
isImportable
public static boolean isImportable(Archive archive)
Checks if the given archive contains import information.- Parameters:
archive
- the archive- Returns:
- true, if archive is importable
-
getTempFile
public File getTempFile()
-
getRemoteUrl
public String getRemoteUrl()
-
importRepo
public abstract Importer importRepo() throws ImporterException
- Throws:
ImporterException
-
close
public abstract void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
getSuggestedName
public String getSuggestedName()
Suggest a name, in case the user does not provide one- Returns:
- String
-
createTempDir
protected File createTempDir() throws ImporterException
creates a temporary directory, should be cleaned in close.- Returns:
- the temporary dir
- Throws:
ImporterException
- the importer exception
-
-