Class PluginActivator
- All Implemented Interfaces:
VersionHistory
,org.osgi.framework.BundleActivator
public class MyActivator extends PluginActivator {
public void start(BundleContext context) throws Exception {
// Always call start() of super class.
super.start(context);
// Register IXServerEvents implementation class:
registerService(IXServerEvents.class, new IXServerEventsImpl(this));
}
}
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.osgi.framework.BundleContext
OSGi bundle context.protected org.osgi.util.tracker.ServiceTracker<HostService,
HostService> Tracker to receive the HostService interface provided by Indexserver.protected final List<de.elo.ix.client.plugin.PluginActivator.ClassAndServiceRegistration>
Registration of interface implementations provided by this plugin. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetBundleProperty
(String key) Get a property from the bundle's manifest.Get DB connection for the current archive database.getDBConnectionForDataSource
(IXServerEventsContext ec, String dataSource) Get DB connection for the given data source.Read version history in given format.Get Indexserver's HostService interface.Get connection object initialized with the given ClientInfo.Get connection object for user attached to the given execution context.getIxConnect
(jakarta.servlet.http.HttpServletRequest request) Get the IXConnection object provided by Indexserver in a HTTP request.Get connection object with administrator permissions.Get plugin name, Bundle-Name from manifest.Get Bundle-Version from manifest.Get internal text resources.Get Indexserver's ScriptObjectFactory interface.Get Indexserver's ScriptObjectFactory interface.Get Indexserver's ScriptObjectFactory interface based on the given ClientInfo.Get plugin ID, Bundle-SymbolicName from manifest.void
registerService
(Class<?> interfaceClass, Object interfaceImplementation) Register a service implementation.void
setHistoryName
(String historyName) void
start
(org.osgi.framework.BundleContext context) void
stop
(org.osgi.framework.BundleContext context) void
throwException
(int code, String s) Throws an exception with the given code and message.void
throwException
(int code, String s, Throwable e) Throws an exception with the given code, message and cause.void
Throws an exception with given message.void
unregisterService
(Class<?> interfaceClass) Unregister the service with the given interface.
-
Field Details
-
serviceRegistrations
protected final List<de.elo.ix.client.plugin.PluginActivator.ClassAndServiceRegistration> serviceRegistrationsRegistration of interface implementations provided by this plugin. Invoke functionregisterService(Class, Object)
in order to register a service with OGSi. -
hostServiceTracker
Tracker to receive the HostService interface provided by Indexserver. -
context
protected volatile org.osgi.framework.BundleContext contextOSGi bundle context.
-
-
Constructor Details
-
PluginActivator
public PluginActivator()
-
-
Method Details
-
start
- Specified by:
start
in interfaceorg.osgi.framework.BundleActivator
- Throws:
Exception
-
registerService
Register a service implementation.- Parameters:
interfaceClass
- Class object of service interface, e.g. IXServerEvents.class.interfaceImplementation
- Service object that implements interfaceClass.
-
unregisterService
Unregister the service with the given interface.- Parameters:
interfaceClass
- Service interface.
-
stop
- Specified by:
stop
in interfaceorg.osgi.framework.BundleActivator
- Throws:
Exception
-
getHostService
Get Indexserver's HostService interface.- Returns:
- HostService interface.
-
getScriptObjectFactory
Get Indexserver's ScriptObjectFactory interface. This function internally callsgetHostService()
andHostService.getScriptObjectFactory(IXServerEventsContext)
.- Parameters:
ec
- Execution context.- Returns:
- ScriptObjectFactory interface. Must be closed after use.
-
getScriptObjectFactoryAdmin
Get Indexserver's ScriptObjectFactory interface. This function internally callsgetScriptObjectFactory(IXServerEventsContext)
passingIXServerEventsContext.ADMIN_CONTEXT
.- Returns:
- ScriptObjectFactory interface. Must be closed after use.
-
getScriptObjectFactoryFromClientInfo
Get Indexserver's ScriptObjectFactory interface based on the given ClientInfo.- Parameters:
ci
- ClientInfo, at least member ticket should be valid.- Returns:
- ScriptObjectFactory interface. Must be closed after use.
-
getIxConnect
Get connection object for user attached to the given execution context. This function internally callsScriptObjectFactory.getIxConnect()
.- Parameters:
ec
- Execution context.- Returns:
- IXConnection object.
- Throws:
UncheckedRemoteException
-
getIxConnectAdmin
Get connection object with administrator permissions. This function internally callsScriptObjectFactory.getIxConnectAdmin()
.- Returns:
- IXConnection object.
- Throws:
UncheckedRemoteException
-
getIxConnect
Get connection object initialized with the given ClientInfo.- Parameters:
ci
- ClientInfo, at least member ticket should be valid.- Returns:
- IXConnection object.
- Throws:
UncheckedRemoteException
-
getDBConnection
Get DB connection for the current archive database. This function internally callsScriptObjectFactory.getDBConnection()
.- Parameters:
ec
- Execution context.- Returns:
- DBConnection object.
- Throws:
UncheckedRemoteException
-
getDBConnectionForDataSource
Get DB connection for the given data source. The data source has to be declared in Tomcat's context.xml file. More information can be found atDBConnection
This function internally callsScriptObjectFactory.getDBConnectionForDataSource(String)
.- Parameters:
ec
- Execution context.- Returns:
- DBConnection object.
- Throws:
UncheckedRemoteException
-
throwException
Throws an exception with given message. Throws an exception with codeIXExceptionC.SCRIPT_ERROR
.- Parameters:
s
-- Throws:
byps.RemoteException
-
throwException
Throws an exception with the given code and message.- Parameters:
code
- Exception code, one of the constants inIXExceptionC
.s
- Message- Throws:
byps.RemoteException
-
throwException
Throws an exception with the given code, message and cause.- Parameters:
code
- Exception code, one of the constants inIXExceptionC
.s
- Messagee
- Cause- Throws:
byps.RemoteException
-
getIxConnect
Get the IXConnection object provided by Indexserver in a HTTP request. This function can be used by the plugin's implementation of a jakarta.servlet.Servlet to receive an IXConnection object e.g. created by authentication via SSO.If the request URI addresses /ix-archive/plugin-auth, a SSO authentication is performed and the returned connection represents a session for the authenticated user. The returned IXConnection object should be closed before the HTTP session expires in order to save resources.
If the request URL is /ix-archive/manager/plugin, the user is authenticated against Tomcat Manager role and an administrative connection is returned. The returned IXConnection object should be closed before the HTTP session expires in order to save resources.
If the request URL is /ix-archive/plugin and a cookie or parameter named "ticket" is supplied, a connection is created for this ticket. If neither matches the three cases, the function returns null. Closing this connection has no effect.
- Parameters:
request
-- Returns:
- IXConnection or null.
-
getResourceBundle
Get internal text resources.- Parameters:
ec
- Execution context.- Returns:
- ResourceBundle object.
-
getSymbolicName
Get plugin ID, Bundle-SymbolicName from manifest.- Returns:
- ID
-
getPluginName
Get plugin name, Bundle-Name from manifest.- Returns:
- Plugin name
-
getPluginVersion
Get Bundle-Version from manifest.- Returns:
- Version
-
getBundleProperty
Get a property from the bundle's manifest.- Parameters:
key
- Property key.- Returns:
- Property value.
-
getHistory
Description copied from interface:VersionHistory
Read version history in given format.- Specified by:
getHistory
in interfaceVersionHistory
- Returns:
- Version history in text format. This text is rendered as pre-formatted text in a HTML page.
- Throws:
IOException
-
getHistoryName
-
setHistoryName
-