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 classImporter.DefaultNameTransformerThe Class DefaultNameTransformer.protected static classImporter.GitNameTransformerThe Class GitNameTransformer.protected classImporter.ImportVCardWrapper class for VCard datamodel, adding equals and hashCode for better determination in HashMaps/-Sets
-
Field Summary
Fields Modifier and Type Field Description static StringIMPORT_GITstatic StringIMPORT_HTTPprotected StringremoteUrlprotected FiletempFileprotected UserManageruser
-
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 voidclose()protected FilecreateTempDir()creates a temporary directory, should be cleaned in close.static ImportergetImporter(Archive archive, UserManager user)Gets an importer corresponding to the type of archive.static ImportergetImporter(String type, String remoteUrl, UserManager user)Gets an importer corresponding to the given type.StringgetRemoteUrl()StringgetSuggestedName()Suggest a name, in case the user does not provide oneFilegetTempFile()abstract ImporterimportRepo()static booleanisImportable(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:
closein interfaceAutoCloseable- Specified by:
closein 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
-
-