Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * Copyright 2014 dc-square GmbH
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.
package com.dcsquare.hivemq.spi;
The HiveMQ Plugin Guice Module class from which you should inherit when writing a HiveMQ plugin.

Essentially you have to provide a with subclasses of org.apache.commons.configuration.AbstractConfigurations which provide the configuration properties for your plugin. com.dcsquare.hivemq.spi.config.Configurations provides convenient methods for simplifying implementing this Provider.

The entryPointClass() must return a subclass of PluginEntryPoint. It's possible to use Dependency Injection with Guice in this entry point

Dominik Obermaier
public abstract class HiveMQPluginModule extends AbstractModule {

Returns all configurations which are needed for the plugin. It's possible to return different configuration sources like databases, files, etc.

The com.dcsquare.hivemq.spi.config.Configurations class offers some useful utilities for dealing with configuration providers.

a Provider with a list of org.apache.commons.configuration.AbstractConfigurations.
    public abstract Provider<Iterable<? extends AbstractConfiguration>> getConfigurations();

    protected final void configure() {
        final Multibinder<AbstractConfigurationmultibinder = Multibinder.newSetBinder(binder(), AbstractConfiguration.class);
        final Provider<Iterable<? extends AbstractConfiguration>> configurations = getConfigurations();
        final Iterable<? extends AbstractConfigurationabstractConfigurations = configurations.get();
        for (AbstractConfiguration abstractConfiguration : abstractConfigurations) {
        //Bind the main entry class and immediately start injection

This method should be used to configure the Guice Bindings and Guice Configurations.
    protected abstract void configurePlugin();

Must return the main plugin class which is the "entry point" of the plugin.

Note: This plugin class can use Dependency Injection via Guice

the main entry class
    protected abstract Class<? extends PluginEntryPointentryPointClass();
New to GrepCode? Check out our FAQ X