JCR Support 4 Dropwizard Project

Parent bundle for Dropwizard to support Java Content Repository

Лицензия

Лицензия

Категории

Категории

DropWizard Контейнер Микросервисы
Группа

Группа

com.github.justcoke
Идентификатор

Идентификатор

dropwizard-jcr-parent
Последняя версия

Последняя версия

1.1.0-rc4
Дата

Дата

Тип

Тип

pom
Описание

Описание

JCR Support 4 Dropwizard Project
Parent bundle for Dropwizard to support Java Content Repository
Ссылка на сайт

Ссылка на сайт

http://github.com/justcoke/dropwizard-jcr
Система контроля версий

Система контроля версий

https://github.com/justcoke/dropwizard-jcr.git

Скачать dropwizard-jcr-parent

Имя Файла Размер
dropwizard-jcr-parent-1.1.0-rc4.pom 6 KB
Обзор

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.justcoke/dropwizard-jcr-parent/ -->
<dependency>
    <groupId>com.github.justcoke</groupId>
    <artifactId>dropwizard-jcr-parent</artifactId>
    <version>1.1.0-rc4</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/com.github.justcoke/dropwizard-jcr-parent/
implementation 'com.github.justcoke:dropwizard-jcr-parent:1.1.0-rc4'
// https://jarcasting.com/artifacts/com.github.justcoke/dropwizard-jcr-parent/
implementation ("com.github.justcoke:dropwizard-jcr-parent:1.1.0-rc4")
'com.github.justcoke:dropwizard-jcr-parent:pom:1.1.0-rc4'
<dependency org="com.github.justcoke" name="dropwizard-jcr-parent" rev="1.1.0-rc4">
  <artifact name="dropwizard-jcr-parent" type="pom" />
</dependency>
@Grapes(
@Grab(group='com.github.justcoke', module='dropwizard-jcr-parent', version='1.1.0-rc4')
)
libraryDependencies += "com.github.justcoke" % "dropwizard-jcr-parent" % "1.1.0-rc4"
[com.github.justcoke/dropwizard-jcr-parent "1.1.0-rc4"]

Зависимости

test (3)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12
org.mockito : mockito-core jar 2.7.12
org.assertj : assertj-core jar 3.6.2

Модули Проекта

  • dropwizard-jcr
  • dropwizard-jackrabbit

JCR support 4 dropwizard

Travis (Linux & MacOS build) Appveyor (Windows build) MavenCentral Dependency Status

A set of modules for connecting a Dropwizard app to a Java Content Repository

The set contains:

  • dropwizard-jcr - some basic jcr interfaces and classes
  • dropwizard-jackrabbit - support for jackrabbit (the reference implementation of jcr)
  • dropwizard-jackrabbit-example - a basic example dropwizard app that uses the dropwizard

Usage

This module assumes you are including it in a Dropwizard 0.9.0 application with dropwizard-guice wiring.

Include as a maven dependency:

<dependency>
    <groupId>com.github.justcoke</groupId>
    <artifactId>dropwizard-jackrabbit</artifactId>
    <version>${version.dropwizard-jackrabbit}</version>
</dependency>

Add configuration to your application's configuration class, like:

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.dropwizard.Configuration;
import com.github.justcoke.dropwizard.jackrabbit.JackrabbitRepositoryFactory;

public class HelloWorldConfiguration extends Configuration {
	@Valid
	@NotNull
	@JsonProperty
	private JackrabbitRepositoryFactory repository = new JackrabbitRepositoryFactory();

	public JackrabbitRepositoryFactory getRepository() {
		return repository;
	}
}

Add reasonable configuration options to your application YML file:

...
repository:
    homeDir: <mandatory; path where to store the te repository>
    configFile: <xml-configuration of the jcr; if not set built in defaultRepository.xml will be used>
...

Make sure your Guice wiring "provides" the Repository as a bean so you are able to inject it in your business code:

import java.io.IOException;
import javax.inject.Named;
import javax.jcr.Repository;
import javax.jcr.RepositoryException;
import com.google.inject.AbstractModule;
import com.google.inject.Provides;

public class HelloWorldModule extends AbstractModule {
	...
	@Provides
	@Named("jcr")
	public Repository provideRepository(HelloWorldConfiguration configuration) {
		try {
			return configuration.getRepository().build(null);
		} catch (RepositoryException | IOException e) {
			e.printStackTrace();
			return null;
		}
	}
}

Finally in your application's main initialize() method, add your new HelloWorldModule to your guice bundle, for example:

import com.hubspot.dropwizard.guice.GuiceBundle;

	private GuiceBundle<HelloWorldConfiguration> guiceBundle = null;

	@Override
	public void initialize(Bootstrap<HelloWorldConfiguration> bootstrap) {
		// Guice
		guiceBundle = GuiceBundle.<HelloWorldConfiguration> newBuilder().addModule(new HelloWorldModule())
				.enableAutoConfig(getClass().getPackage().getName()).setConfigClass(HelloWorldConfiguration.class)
				.build();

		bootstrap.addBundle(guiceBundle);
	}

Also have look at the dropwizard-jackrabbit-example.

Версии библиотеки

Версия
1.1.0-rc4
0.2.3