Class PluginType

    • Field Detail

      • MAX_INTERFACENAME_LENGTH

        public static final int MAX_INTERFACENAME_LENGTH
        The maximum length of the interface name that can be stored in the database. Check the length against this value before calling the setInterfaceName(String) method to avoid exceptions.
        See Also:
        Constant Field Values
      • MAX_JARFILE_LENGTH

        public static final int MAX_JARFILE_LENGTH
        The maximum length of the jar path name that can be stored in the database.
        Since:
        3.0
        See Also:
        Constant Field Values
    • Constructor Detail

      • PluginType

        PluginType​(PluginTypeData data)
        Creates a plugin type item.
        Parameters:
        data - the data
    • Method Detail

      • getNew

        public static PluginType getNew​(DbControl dc,
                                        String interfaceName,
                                        String jarFile)
                                 throws BaseException
        Create a new PluginType item.
        Parameters:
        dc - The DbControl which will be used for permission checking and database access.
        interfaceName - The name of an interface that a plugin must implement to be of this type
        jarFile - Optional file name of the JAR file which contains the plugin class. The JAR file must be located in the plugins.dir directory. If not specified the plugin must be in the classpath
        Returns:
        The new PluginDefinition item
        Throws:
        BaseException - If there is an error
      • getType

        public Item getType()
        Description copied from interface: Identifiable
        Get the type of item represented by the object. The returned value is one of the values defined in the Item enumeration.
        Specified by:
        getType in interface Identifiable
        Returns:
        A value indicating the type of item
      • getName

        public String getName()
        Description copied from interface: Nameable
        Get the name of the item.
        Specified by:
        getName in interface Nameable
        Returns:
        A String with the name of the item
      • getDescription

        public String getDescription()
        Description copied from interface: Nameable
        Get the description for the item.
        Specified by:
        getDescription in interface Nameable
        Returns:
        A String with a description of the item
      • initPermissions

        void initPermissions​(int granted,
                             int denied)
                      throws BaseException
        All users get READ access.
        Overrides:
        initPermissions in class BasicItem
        Parameters:
        granted - Permissions that have been granted by the subclass
        denied - Permissions that have been denied by the subclass
        Throws:
        BaseException - If the permissions couldn't be initialised
      • isRemoved

        public boolean isRemoved()
        Description copied from interface: Removable
        Check if the removed flag is set for this item.
        Specified by:
        isRemoved in interface Removable
        Returns:
        TRUE if the item is flagged as removed, FALSE otherwise
      • getEntryDate

        public Date getEntryDate()
        Description copied from interface: Registered
        Get the date that the item was registered in the database.
        Specified by:
        getEntryDate in interface Registered
        Returns:
        A date or null if this is not known
      • setEntryDate

        public void setEntryDate​(Date entryDate)
        Description copied from interface: Registered
        Set the date the entry was registered in the database. Implementations should only allow this property to be set before the item is first stored in the database. The intention of this method is to facilitate export/import of data between server.
        Specified by:
        setEntryDate in interface Registered
        Parameters:
        entryDate - A date or null to use today's date
      • getInterfaceName

        public String getInterfaceName()
        Get the class name of the Java class that implements this plugin. The specified class must implement the Plugin interface.
        Returns:
        The class name for this plugin
      • getJarFile

        public String getJarFile()
        Get the name of the JAR file that contains this plug-in. If this value is null, the plug-in must be on the classpath (eg. in WEB-INF/lib).
        Since:
        3.0
      • getJarPath

        public String getJarPath()
        Get the path to the JAR file that contains the plugin class file. If this value is null, the plugin must be on the classpath.
      • loadInterfaceInformation

        public void loadInterfaceInformation​(String jarFile,
                                             String interfaceName)
                                      throws InvalidDataException,
                                             BaseException
        Parameters:
        jarFile - File name of the jar file containing the plug-in. The JAR file must be located in the directory spercified by 'plugins.dir' setting in base.config. Null is allowed if plugin is located in the classpath (eg. WEB-INF/lib).
        interfaceName - The name of an interface that a plugin must implement to be of this type.
        Throws:
        InvalidDataException - If the found class not really is an interface, or if the found interface doesn't extend from Plugin
        BaseException - If there is some other error.