You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Jie Chen <jc...@wisc.edu> on 2015/01/29 07:34:10 UTC
How to combine OAK into spring boot application
Hi,
Currently I am working in a Spring boot application, but I also want to
check out Oak to be the content management layer. I know Sling could be a
good choice to work with Oak. But my project requires me to use Spring
boot. Can you help guide me to go through this problem?
Best,
Jie
Re: How to combine OAK into spring boot application
Posted by Mike Nimer <mn...@gmail.com>.
I'm using it inside of a spring boot project (in development). The 3 steps are
1. Add the maven dependencies, as needed, for javax.jcr, oak-*, and
jackrabbit-*
2. Create a @Configuration class that will configure Oak.
--------------
FileBlobStore fileBlobStore = new FileBlobStore(repoDir.getAbsolutePath());
FileStore source = new FileStore(fileBlobStore, repoDir, 100, true);
NodeStore segmentNodeStore = new SegmentNodeStore(source);
Oak oak = new Oak(segmentNodeStore)
.with("AppName")
.with(new InitialDAMContent(segmentNodeStore)) // add
initial content and folder structure
//.with(new SecurityProviderImpl()) // use the default security
//.with(new DefaultTypeEditor()) // automatically
set default types
//.with(new NameValidatorProvider()) // allow only
valid JCR names
//.with(new OpenSecurityProvider())
//.with(new PropertyIndexHook()) // simple indexing support
//.with(new PropertyIndexProvider()) // search support
for the indexes
.with(new CommitDAMHook())
.withAsyncIndexing();
return oak;
-------------
And configure a Repository Bean that you can use throughout your application.
------------
// create JCR object
Jcr jcr = new Jcr(getOak())
.withAsyncIndexing();
// Create repository
Repository repository = jcr.createRepository();
return repository;
-----------
3. From here you just need to call repository.login to get a valid
session (repository.login(...)) and then you can start interacting
with the OAK apis. In my case I'm using Basic Auth with my Spring MVC
REST services to expose the JCR.
Hope this helps,
--mike
On Thu, Jan 29, 2015 at 12:34 AM, Jie Chen <jc...@wisc.edu> wrote:
>
> Hi,
>
> Currently I am working in a Spring boot application, but I also want to
> check out Oak to be the content management layer. I know Sling could be a
> good choice to work with Oak. But my project requires me to use Spring
> boot. Can you help guide me to go through this problem?
>
>
> Best,
> Jie
Re: How to combine OAK into spring boot application
Posted by Marcel Reutegger <mr...@adobe.com>.
Hi Jie,
I don't know how Spring boot works, but your question is
probably around how to bootstrap Oak.
See the following page how to start an Oak repository:
http://jackrabbit.apache.org/oak/docs/construct.html
Regards
Marcel
On 29/01/15 07:34, "Jie Chen" <jc...@wisc.edu> wrote:
>Hi,
>
>Currently I am working in a Spring boot application, but I also want to
>check out Oak to be the content management layer. I know Sling could be a
>good choice to work with Oak. But my project requires me to use Spring
>boot. Can you help guide me to go through this problem?
>
>
>Best,
>Jie