-
Notifications
You must be signed in to change notification settings - Fork 443
Building Exhibitor
Exhibitor is not a complete application. You can add to it or use it as is. Follow these steps to build a complete Exhibitor based application.
You need to choose a JAX-RS implementation. The industry standard is Jersey. TBD
Exhibitor must be part of a Java Web Application Container. Some common containers are:
- Tomcat
- Jetty
- JBoss
You will need to write implementations (or use supplied defaults) for several interfaces:
Class | Default Implementation(s) | Description |
---|---|---|
BackupSource | FileBasedBackupSource | Used to backup/restore ZooKeeper data |
GlobalSharedConfig | FileBasedGlobalSharedConfig JDBCBasedGlobalSharedConfig |
Stores shared configuration between all instances being managed by Exhibitor |
ProcessOperations | StandardProcessOperations | Methods to start/stop/etc. the local ZooKeeper instance |
You must inject/allocate a singleton instance of the Exhibitor class and call its start() method. The Exhibitor constructor takes instances of the SPI objects as arguments. It also takes an instance of InstanceConfig which supplies various configuration values needed to run the local Exhibitor instance. Use the InstanceConfigBuilder to set the various values in InstanceConfig. The only required value is the hostname of the local instance.
The JAX-RS portion of Exhibitor requires that a singleton instance of UIContext be injected. UIContext implements ContextResolver so it should be simple to add to the JAX-RS implementation you are using. Jersey’s can be configured to search the CLASSPATH for JAX-RS classes. Otherwise, you can specify them with a Jersey Application object:
final UIContext context = new UIContext(exhibitor);
DefaultResourceConfig application = new DefaultResourceConfig()
{
@Override
public Set<Class<?>> getClasses()
{
Set<Class<?>> classes = new HashSet<Class<?>>();
classes.add(UIResource.class);
return classes;
}
@Override
public Set<Object> getSingletons()
{
Set<Object> singletons = new HashSet<Object>();
singletons.add(context);
return singletons;
}
};
ServletContainer container = new ServletContainer(application);
...
Contents
- Top
- Standalone Version
- WAR File
- Core/Library
- Features
- Shared Configuration
- Using Exhibitor
- REST API
- Contributions