Class OSGiArchiveDetector
- java.lang.Object
-
- org.glassfish.extras.osgicontainer.OSGiArchiveDetector
-
- All Implemented Interfaces:
ArchiveDetector
@Service(name="osgi") @Singleton public class OSGiArchiveDetector extends Object implements ArchiveDetector
Detects OSGi type archives. This never participates in detection process. it is explicitly specified in user input (in --type argument). So, it always returns false inhandles(ReadableArchive). It's rank can be set using system propertyOSGI_ARCHIVE_DETECTOR_RANK_PROP. Default rank isDEFAULT_OSGI_ARCHIVE_DETECTOR_RANK.- Author:
- sanjeeb.sahoo@oracle.com
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_OSGI_ARCHIVE_DETECTOR_RANKstatic StringOSGI_ARCHIVE_DETECTOR_RANK_PROPstatic StringOSGI_ARCHIVE_TYPE
-
Constructor Summary
Constructors Constructor Description OSGiArchiveDetector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ArchiveHandlergetArchiveHandler()Return a ArchiveHandler that can handle the archive recognised by this ArchiveDetector.ArchiveTypegetArchiveType()Returns the type of the deployment unit or archive or module whichever way you want to call what's being depoyed.booleanhandles(ReadableArchive archive)This method is used to detect the archive type.intrank()Since archive detection logic is typically executed at a very early stage of deployment, it is mainly heuristic.
-
-
-
Field Detail
-
OSGI_ARCHIVE_DETECTOR_RANK_PROP
public static final String OSGI_ARCHIVE_DETECTOR_RANK_PROP
- See Also:
- Constant Field Values
-
DEFAULT_OSGI_ARCHIVE_DETECTOR_RANK
public static final int DEFAULT_OSGI_ARCHIVE_DETECTOR_RANK
- See Also:
- Constant Field Values
-
OSGI_ARCHIVE_TYPE
public static final String OSGI_ARCHIVE_TYPE
- See Also:
- Constant Field Values
-
-
Method Detail
-
rank
public int rank()
Description copied from interface:ArchiveDetectorSince archive detection logic is typically executed at a very early stage of deployment, it is mainly heuristic. So some detectors can incorrectly recognize archives that they actually don't support. e.g., take a war file inside an ear file. and asssume that the war file contains some .jsp files. The archive detector responsible for handling the war file could be fooled into thinking the ear file is a war file since it contains jsp files, yet in reality, it only owns one of the sub archive bundled inside the composite ear file. To deal with such situations, each detector can specify a rank which can be used to order the detectors. Since detectors can come from separate authors, rank of a detector must be configurable in an installation. The order in which detectors are used during archive detection is based on the rank. Lower the integer value as returned by this method, earlier it is used during detection.- Specified by:
rankin interfaceArchiveDetector- Returns:
- the rank of this detector
-
handles
public boolean handles(ReadableArchive archive) throws IOException
Description copied from interface:ArchiveDetectorThis method is used to detect the archive type. If this detector can recognize the given archive, then it must return true.- Specified by:
handlesin interfaceArchiveDetector- Returns:
- Throws:
IOException
-
getArchiveHandler
public ArchiveHandler getArchiveHandler()
Description copied from interface:ArchiveDetectorReturn a ArchiveHandler that can handle the archive recognised by this ArchiveDetector.- Specified by:
getArchiveHandlerin interfaceArchiveDetector- Returns:
-
getArchiveType
public ArchiveType getArchiveType()
Description copied from interface:ArchiveDetectorReturns the type of the deployment unit or archive or module whichever way you want to call what's being depoyed. Each archive handler is responsible for only one type of archive and the type of the archive is represented byArchiveType.- Specified by:
getArchiveTypein interfaceArchiveDetector- Returns:
- the type of the archive or deployment unit that can be detected by this detector
-
-