Package com.nomagic.magicdraw.plugins
Class PluginDescriptor
- java.lang.Object
-
- com.nomagic.magicdraw.plugins.PluginDescriptor
-
@OpenApiAll public class PluginDescriptor extends java.lang.Object
The plugin descriptor class. Contains all information about plugin. This information is taken fromplugin.xml
file.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PluginDescriptor.ClassLookupStrategy
Class lookup strategy.
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
mClass
The plugin class.private PluginDescriptor.ClassLookupStrategy
mClassLookupStrategy
If plugin uses separate class loader, you can specify strategy how classes should be locatedprivate boolean
mEnabled
Is enabled.private java.lang.String
mID
The plugin id.private int
mInternalVersion
The plugin internal version.private java.lang.String
mLicenseID
The plugin license id.private boolean
mLoaded
Is loaded.private java.lang.String
mName
The plugin name.private java.io.File
mPluginDirectory
The plugin installation directory.private java.lang.String
mProvider
The plugin provider name.private java.lang.String
mRequiresAPI
Version of MagicDraw plugin requires.private java.util.HashMap<java.lang.String,RequiredPlugin>
mRequiresPlugins
The required plugins.private java.net.URL[]
mRuntimeLibraries
The plugin runtime libraries(the jar files to be used in URLClassLoader).private boolean
mSeparateClassloader
Plugin needs separate classloaderprivate java.lang.String
mVersion
The plugin version.
-
Constructor Summary
Constructors Constructor Description PluginDescriptor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRequiredPlugin(java.lang.String pluginID, RequiredPlugin requiredPlugin)
Adds record about required plugin.PluginDescriptor.ClassLookupStrategy
getClassLookupStrategy()
Get class lookup strategy.java.lang.String
getClassName()
Returns plugin class name.java.lang.String
getID()
Returns plugin id.int
getInternalVersion()
Returns plugin internal version numberjava.lang.String
getLicenseID()
Returns plugin license id.java.lang.String
getName()
Returns plugin name.java.io.File
getPluginDirectory()
Returns the plugin installation directory.java.lang.String
getProvider()
Returns plugin provider.java.lang.String
getRequiresAPI()
Returns the required MagicDraw Open API version.java.util.Map<java.lang.String,RequiredPlugin>
getRequiresPlugins()
Returns record about required plugins.java.net.URL[]
getRuntimeLibraries()
Returns an array of required jars for this plugin.java.lang.String
getVersion()
Return plugin version.boolean
isEnabled()
Returns true, if this plugin is enabled by user.boolean
isLoaded()
Returns true, if this plugin is loaded.boolean
isSeparateClassloader()
Checks if plugin needs separate classloader.void
setClassLookupStrategy(PluginDescriptor.ClassLookupStrategy lookupStrategy)
Set class lookup strategy.void
setClassName(java.lang.String aClass)
Sets plugin class name.void
setEnabled(boolean enabled)
Sets enabled flag.void
setID(java.lang.String id)
Sets plugin id.void
setInternalVersion(int internalVersion)
Sets plugin internal version numbervoid
setLicenseID(java.lang.String id)
Sets plugin license id.void
setLoaded(boolean loaded)
Sets loaded flag.void
setName(java.lang.String name)
Sets the name of the plugin.void
setPluginDirectory(java.io.File directory)
Sets the plugin installation directory.void
setProvider(java.lang.String provider)
Sets plugin provider.void
setRequiresAPI(java.lang.String version)
Sets the required MagicDraw Open API version.void
setRuntimeLibraries(java.net.URL[] libraries)
Sets an array of required jars for this plugin.void
setSeparateClassloader(boolean separateClassloader)
Sets if use separate classloader.void
setVersion(java.lang.String version)
Sets the plugin version.java.lang.String
toString()
Provides some useful information about this class attributes.
-
-
-
Field Detail
-
mPluginDirectory
private java.io.File mPluginDirectory
The plugin installation directory.
-
mRuntimeLibraries
private java.net.URL[] mRuntimeLibraries
The plugin runtime libraries(the jar files to be used in URLClassLoader).
-
mID
private java.lang.String mID
The plugin id.
-
mLicenseID
private java.lang.String mLicenseID
The plugin license id.
-
mName
private java.lang.String mName
The plugin name.
-
mVersion
private java.lang.String mVersion
The plugin version.
-
mInternalVersion
private int mInternalVersion
The plugin internal version.
-
mProvider
private java.lang.String mProvider
The plugin provider name.
-
mRequiresAPI
@CheckForNull private java.lang.String mRequiresAPI
Version of MagicDraw plugin requires. If API version is smaller, plugin will not be loaded.
-
mRequiresPlugins
private final java.util.HashMap<java.lang.String,RequiredPlugin> mRequiresPlugins
The required plugins. Structure is pluginID-version
-
mClass
private java.lang.String mClass
The plugin class.
-
mEnabled
private boolean mEnabled
Is enabled.
-
mLoaded
private boolean mLoaded
Is loaded.
-
mSeparateClassloader
private boolean mSeparateClassloader
Plugin needs separate classloader
-
mClassLookupStrategy
private PluginDescriptor.ClassLookupStrategy mClassLookupStrategy
If plugin uses separate class loader, you can specify strategy how classes should be located
-
-
Method Detail
-
setClassName
public void setClassName(java.lang.String aClass)
Sets plugin class name.- Parameters:
aClass
- the plugin class name.
-
getClassName
public java.lang.String getClassName()
Returns plugin class name.- Returns:
- plugin class name.
-
setID
public void setID(java.lang.String id)
Sets plugin id.- Parameters:
id
- the plugin id.
-
getID
public java.lang.String getID()
Returns plugin id.- Returns:
- plugins id.
-
setLicenseID
public void setLicenseID(java.lang.String id)
Sets plugin license id.- Parameters:
id
- the plugin license id.
-
getLicenseID
public java.lang.String getLicenseID()
Returns plugin license id.- Returns:
- plugins license id.
-
getInternalVersion
public int getInternalVersion()
Returns plugin internal version number- Returns:
- internal version number
-
setInternalVersion
public void setInternalVersion(int internalVersion)
Sets plugin internal version number- Parameters:
internalVersion
- plugin internal version number
-
setName
public void setName(java.lang.String name)
Sets the name of the plugin.- Parameters:
name
- the plugin name.
-
getName
public java.lang.String getName()
Returns plugin name.- Returns:
- name of the plugin.
-
setProvider
public void setProvider(java.lang.String provider)
Sets plugin provider.- Parameters:
provider
- the plugin provider.
-
getProvider
public java.lang.String getProvider()
Returns plugin provider.- Returns:
- the plugin provider name(company or person).
-
setRequiresAPI
public void setRequiresAPI(@CheckForNull java.lang.String version)
Sets the required MagicDraw Open API version.- Parameters:
version
- the required version number. Must be double.
-
getRequiresAPI
@CheckForNull public java.lang.String getRequiresAPI()
Returns the required MagicDraw Open API version.- Returns:
- the required version number.
-
setRuntimeLibraries
public void setRuntimeLibraries(java.net.URL[] libraries)
Sets an array of required jars for this plugin.- Parameters:
libraries
- the array of required libraries.
-
getRuntimeLibraries
public java.net.URL[] getRuntimeLibraries()
Returns an array of required jars for this plugin.- Returns:
- the array of required libraries.
-
setVersion
public void setVersion(java.lang.String version)
Sets the plugin version.- Parameters:
version
- the plugin version.
-
getVersion
public java.lang.String getVersion()
Return plugin version.- Returns:
- the plugin version.
-
setPluginDirectory
public void setPluginDirectory(java.io.File directory)
Sets the plugin installation directory. This is a directory there plugin descriptor xml file was found.- Parameters:
directory
- the plugin directory.
-
getPluginDirectory
public java.io.File getPluginDirectory()
Returns the plugin installation directory. This is a directory there plugin descriptor xml file was found.- Returns:
- the plugin directory.
-
getRequiresPlugins
public java.util.Map<java.lang.String,RequiredPlugin> getRequiresPlugins()
Returns record about required plugins.- Returns:
- map of required plugins(key - plugin id, value - required plugin).
-
addRequiredPlugin
public void addRequiredPlugin(java.lang.String pluginID, RequiredPlugin requiredPlugin)
Adds record about required plugin.- Parameters:
pluginID
- the id of the plugin.requiredPlugin
- the required plugin descriptor
-
isEnabled
public boolean isEnabled()
Returns true, if this plugin is enabled by user.- Returns:
- true, if this plugin is enabled by user.
-
setEnabled
public void setEnabled(boolean enabled)
Sets enabled flag.- Parameters:
enabled
- the new value of enabled flag.
-
isLoaded
public boolean isLoaded()
Returns true, if this plugin is loaded.- Returns:
- true, if this plugin is loaded.
-
setLoaded
public void setLoaded(boolean loaded)
Sets loaded flag.- Parameters:
loaded
- the new value of loaded flag.
-
setSeparateClassloader
public void setSeparateClassloader(boolean separateClassloader)
Sets if use separate classloader.- Parameters:
separateClassloader
- true if use separate classloader.
-
isSeparateClassloader
public boolean isSeparateClassloader()
Checks if plugin needs separate classloader.- Returns:
- true if plugin needs separate classloader.
-
getClassLookupStrategy
public PluginDescriptor.ClassLookupStrategy getClassLookupStrategy()
Get class lookup strategy.- Returns:
- lookup strategy.
-
setClassLookupStrategy
public void setClassLookupStrategy(PluginDescriptor.ClassLookupStrategy lookupStrategy)
Set class lookup strategy.- Parameters:
lookupStrategy
- lookup strategy.
-
toString
public java.lang.String toString()
Provides some useful information about this class attributes.- Overrides:
toString
in classjava.lang.Object
- Returns:
- the string representation.
-
-