Closing resources for deleted repository

2021-03-05 Thread jorgeeflorez
Hello,
when I am deleting a repository (that uses a file data store and Lucene
indexes are stored in the file system). I first delete content nodes and
nodetypes so the repository is "empty". After that, I call
RepositoryImpl.shutdown() and DocumentNodeStore.dispose().
The final step of my process is to delete the folder in the file system
where the repository files and Lucene index files are stored. I have a
problem here:

java.io.IOException: Unable to delete file:
E:\repo1\index\LucenePrimaryType\_3.cfs
at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:2400)

It appears Lucene files are still being used. Is there another method I
should call also to release those "locks"?

Thanks.

Jorge


Re: User created date property

2021-02-16 Thread jorgeeflorez
Hi Angela,
thanks a lot for your reply. Yes, I thought using my own property to store
the creation date would be best, but never considered using an
AuthorizableAction.
I will take a look into it.

Best Regards.
Jorge


El mar., 16 de febrero de 2021 2:45 a. m., Angela Schreiber
 escribió:

> Hi Jorge
>
> Your observation is correct: Authorizable.getProperty filters out
> properties in the jcr or rep namespace and only returns properties that
> could also be set using Authorizable.setProperty.
>
> If you add mix:created to a given user node (IMHO that is allowed) to have
> the jcr:created property set, you need to get the user node to read the
> jcr:created property. Alternatively, if you wish to avoid having that
> implementation detail (i.e. user is stored as a node) in your application,
> I suggest using a custom 'AuthorizableAction' that sets a custom 'created'
> property upon user creation.
>
> see
> http://jackrabbit.apache.org/oak/docs/security/user/authorizableaction.html
> for the corresponding documentation. NOTE: i recently fixed that part of
> the documentation. it missed to point to the required-service-ids in the
> security provider (see
> http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-doc/src/site/markdown/security/user/authorizableaction.md?r1=1846652=1885915).
> that is necessary in order to make sure the security provider is only
> registered if all dependencies are properly registered.
>
> Hope that helps
> Angela
>
> 
> From: jorgeeflorez 
> Sent: Thursday, February 11, 2021 8:37 PM
> To: oak-dev@jackrabbit.apache.org 
> Subject: User created date property
>
> Hi,
> I need to put and use additional properties on users and so far no problems
> with those properties. I could even add a mixin to the node that represents
> the user! (I am not sure if this is allowed).
>
> It seems that the "jcr:created" property cannot be seen using
> Authorizable.getProperty method. Should I get the node using the
> autorizable's path and get the property? or should I handle a custom
> property for that in this case? I just want to get the date the user was
> created...
>
> Thanks.
>
> Jorge
>


Re: Lucene index not working correctly

2021-02-12 Thread jorgeeflorez
Hi,
I am not an Oak Developer, but maybe I can help you (maybe :) ) can you
please provide information about the node types, their properties and how
do they relate?

Can you please attach an example of those nodes (and their properties) that
also come in the search results?

Thanks.

Jorge

El mar, 9 feb 2021 a las 10:35, Philipp Koetz ()
escribió:

> Dear Oak Community,
>
> we are trying to enable a fulltext index for a few properties, but it
> doesn't find the correct results. We are using OAK 1.6.20
>
> First of all, the index looks like this:
> /oak:index/lucene
>   - compatVersion = 2
>   - async = "async"
>   - jcr:primaryType = oak:QueryIndexDefinition
>   - evaluatePathRestrictions = true
>   - type = "lucene"
>   + indexRules
>+ mix:node
> + properties
>  + primaryType
>   - name = "jcr:primaryType"
>   - propertyIndex = true
>+ mix:contentAttribute
> + properties
>  + richDescription
>   - name = "richDescription"
>   - analyzed = true
>  + primaryType
>   - name = "jcr:primaryType"
>   - propertyIndex = true
>+ mix:content
> + properties
>  + articleNumber
>   - name = "articleNumber"
>   - analyzed = true
>  + primaryType
>   - name = "jcr:primaryType"
>   - propertyIndex = true
>  + description
>   - name = "jcr:description"
>   - analyzed = true
>  + title
>   - name = "jcr:title"
>   - analyzed = true
>  + uuid
>   - name = "jcr:uuid"
>   - propertyIndex = true
>   - notNullCheckEnabled = true
>  + tags
>   - name = "tags"
>   - analyzed = true
>
> The query looks like this:
>
> SELECT node.* FROM [mix:node] AS node INNER JOIN [mix:content] AS content
> ON node.[content] = content.[jcr:uuid] INNER JOIN [mix:contentAttribute] AS
> attribute ON ISCHILDNODE(attribute, content) WHERE
> ISDESCENDANTNODE(node, '/collections') AND
> (
> CONTAINS(content.[jcr:title],'Lorem') OR
> CONTAINS(content.[jcr:description],'Lorem') OR
> CONTAINS(attribute.[richDescription],'Lorem') OR
> CONTAINS(content.[tags],'Lorem') OR
> CONTAINS(content.[articleNumber],'Lorem')
> )
> AND NOT node.deleted = CAST('true' AS BOOLEAN)
>
> From the repository configuration I can read this:
> query.full.text.search.supported: false
> and I don't know how to get rid of it.
>
> After many tests we got the index running (it indexes something and we see
> logs for e.g. reindexing and no warnings, no errors while creating the
> repository, these look fine).
> My query also returns results, but they have nothing to do with the values
> I added in the query. It looks like I get back everything which got
> indexed. At least I can say, I receive always the same results, regardless
> of the search term.
>
> When I set
> QueryEngineSettings queryEngineSettings = new QueryEngineSettings();
> queryEngineSettings.setFullTextComparisonWithoutIndex(true);
> oak.with(queryEngineSettings);
> and delete the fulltext index, I get correct search results, but it's not
> quite fast. But it should prof at least that the query is correct.
>
> What can we do here to fix or inspect it? I ran out of ideas how to handle
> these false results when using the index. If you need additional
> information to help, please ask for it, I will try to provide what is
> needed.
>
> Mit freundlichen Grüßen / Kind regards
> Philipp Koetz
>


User created date property

2021-02-11 Thread jorgeeflorez
Hi,
I need to put and use additional properties on users and so far no problems
with those properties. I could even add a mixin to the node that represents
the user! (I am not sure if this is allowed).

It seems that the "jcr:created" property cannot be seen using
Authorizable.getProperty method. Should I get the node using the
autorizable's path and get the property? or should I handle a custom
property for that in this case? I just want to get the date the user was
created...

Thanks.

Jorge


Re: Mongo DB name max length

2021-02-06 Thread jorgeeflorez
Hi Marcel, thank you for your reply.

You could try creating the database before starting Oak.
>

I am not sure what you mean. We assume the database is created when we
login to the repository the first time. Anyway, I think we probably will
let the user define the database name up to 50 characters, it is long
enough I believe.

Regards.
Jorge Flórez


El vie, 5 feb 2021 a las 4:37, Marcel Reutegger ()
escribió:

> Hi,
>
> On 03.02.21, 18:17, "jorgeeflorez"  wrote:
> > My question is: is there another way to "create" the database having 64
> > characters? or should I establish 63 (or maybe less) as the limit for db
> > names?
>
> You could try creating the database before starting Oak. Otherwise it may
> also be a flaw in the driver and worth a JIRA ticket with MongoDB.
>
> https://jira.mongodb.org/browse/JAVA
>
> Regards
>  Marcel
>
>


Mongo DB name max length

2021-02-03 Thread jorgeeflorez
Hi all, I hope you are all doing well...

According to the documentation
, in MongoDB I can create
a database whose name is up to 64 characters. When I try to connect to a
repository (Oak 1.12.0) that does not exist and use a db name with 64
characters I am getting:

Exception in thread "main" com.mongodb.MongoCommandException: Command
failed with error 73 (InvalidNamespace): 'Invalid database name:
'repository123456789012345678901234567890123456789012345678901234'' on
server 192.168.200.1:37017. The full response is { "ok" : 0.0, "errmsg" :
"Invalid database name:
'repository123456789012345678901234567890123456789012345678901234'", "code"
: 73, "codeName" : "InvalidNamespace" }

After some debugging, I found out that the driver appends .$cmd to the
database name, and with that, exceeds the 64 limit. If I use a db name with
63 it appears to work.

My test class has the following :

public static void main(String[] args) throws RepositoryException {
String repositoryName =
"repository123456789012345678901234567890123456789012345678901234";
OakFileDataStore fileDataStore = new OakFileDataStore();
fileDataStore.setMinRecordLength(0);
File repositoryFolder = new File("E:\\repos", repositoryName);
fileDataStore.init(repositoryFolder.getAbsolutePath());

DataStoreBlobStore dsbs = new DataStoreBlobStore(fileDataStore);

MongoDocumentNodeStoreBuilder builder = new
MongoDocumentNodeStoreBuilder().
setMongoDB("mongodb://forest:forest@192.168.200.1:37017",
repositoryName, 16).
setClusterId(123456).
setAsyncDelay(1000).
setBlobStore(dsbs);

DocumentNodeStore docStore = builder.build();

Oak oak = new Oak(docStore);

LuceneIndexProvider luceneProvider = new LuceneIndexProvider();

Jcr jcr = new Jcr(oak)
.with(new LuceneIndexEditorProvider())
.with((QueryIndexProvider) luceneProvider)
.with((Observer) luceneProvider)
.withAsyncIndexing();


Repository repository = jcr.createRepository();
RepositoryImpl repImpl = (RepositoryImpl) repository;
Session session = null;
try {
session = repImpl.login(new SimpleCredentials("admin",
"admin".toCharArray()), null, new HashMap());

Node root = session.getRootNode();
System.out.println(root.getPath());
}
finally {
if(session != null) {
session.logout();
}

repImpl.shutdown();
docStore.dispose();
}
}

My question is: is there another way to "create" the database having 64
characters? or should I establish 63 (or maybe less) as the limit for db
names?

Thanks.

Regards.

Jorge Flórez


Property in node type

2020-11-03 Thread jorgeeflorez
Hi all, I hope you are doing well...

I am not sure if this has been asked before. Is it possible to define/set a
property in the node type's node, so I can check its value? (I don't want a
property for nodes I create of that type, just to be clear).

Regards.

Jorge


Listening for changes made by other back-ends

2020-10-06 Thread jorgeeflorez
Hi all,
I am not sure if this has been answered before or there is online
documentation. If I have 3 Oak instances for the same repository, how can
an instance be informed about the children that have been added/removed to
some node by the other instances? How can an instance be "notified" about
it so I can implement some logic?

Thanks. Regards.

Jorge


Re: Multiple property definition for same property

2020-06-23 Thread jorgeeflorez .
Hi Angela,

I am not too familiar with the node type registration but I would assume
> that the nodes storing node type definitions are protected and you won't be
> able to remove them using JCR API calls. So, you probably need to resort to
> some low level operations like e.g. the tools in oak-run.
>

well, I used the following code (I simplified it a little bit) and it seems
I could delete all the duplicates.
NodeTypeManager nodeTypeManager =
session.getWorkspace().getNodeTypeManager();
String duplicateDefinitionName = "testProperty";
NodeType repositoryType = nodeTypeManager.getNodeType("oak8961");
NodeTypeTemplate repositoryTypeTemplate =
nodeTypeManager.createNodeTypeTemplate(repositoryType);
boolean definitionFound = false;
List duplicates = new ArrayList<>();
for(Object obj :
repositoryTypeTemplate.getPropertyDefinitionTemplates()){
PropertyDefinitionTemplate definitionTemplate =
(PropertyDefinitionTemplate) obj;


if(definitionTemplate.getName().equals(duplicateDefinitionName)){
if(!definitionFound){
definitionFound = true;
}
else{
duplicates.add(obj);
}
}
}

for(Object obj : duplicates){

repositoryTypeTemplate.getPropertyDefinitionTemplates().remove(obj);
}

nodeTypeManager.registerNodeType(repositoryTypeTemplate, true);
session.save();

Is there any chance you could provide a patch to fix the bug you reported?
> That might help getting it addressed.
>

I will try to look at the source code, in case I find a solution I will let
you know.

Regards.

Jorge

El mar., 23 jun. 2020 a las 1:43, Angela Schreiber
() escribió:

> Hi Jorge
>
> I am not too familiar with the node type registration but I would assume
> that the nodes storing node type definitions are protected and you won't be
> able to remove them using JCR API calls. So, you probably need to resort to
> some low level operations like e.g. the tools in oak-run.
>
> Is there any chance you could provide a patch to fix the bug you reported?
> That might help getting it addressed.
>
> wdyt?
>
> Kind regards
> Angela
> 
> From: jorgeeflorez . 
> Sent: Friday, June 19, 2020 2:30 AM
> To: oak-dev@jackrabbit.apache.org 
> Subject: Re: Multiple property definition for same property
>
> Hi all,
> I just created a maven project, used Oak version 1.30.0 and tested the
> problem I reported on OAK-8961
> <https://issues.apache.org/jira/browse/OAK-8961>. It still happens. I will
> see if I am able to delete the duplicate jcr:propertyDefinition nodes, any
> ideas are welcome :)
>
> Regards.
>
> Jorge
>
> El mié., 18 mar. 2020 a las 11:19, jorgeeflorez . (<
> jorgeeduardoflo...@gmail.com>) escribió:
>
> > Hi Angela,
> > thank you for your help. I created
> > https://issues.apache.org/jira/browse/OAK-8961.
> >
> > Regards.
> >
> > Jorge
> >
> > El mié., 18 mar. 2020 a las 10:09, Angela Schreiber
> > () escribió:
> >
> >> Hi Jorge
> >>
> >> That sounds like a bug to me... after all you will not be able to set
> >> multiple properties that have exactly the same PropertyDefinition and as
> >> far as I remember it should not even be possible to create multiple
> >> properties with the same name.
> >>
> >> Can you create a bug for this in JIRA? As usual detailed steps to
> >> reproduce, test cases or even a patch are very much welcome.
> >>
> >> Kind regards
> >> Angela
> >> 
> >> From: jorgeeflorez . 
> >> Sent: Wednesday, March 18, 2020 3:57 PM
> >> To: oak-dev@jackrabbit.apache.org 
> >> Subject: Multiple property definition for same property
> >>
> >> Hi all,
> >> using the following code, I am able to update an existing node type by
> >> inserting a new property:
> >>
> >> NodeTypeManager nodeTypeManager =
> >> session.getWorkspace().getNodeTypeManager();
> >>
> >> NodeType repositoryType = nodeTypeManager.getNodeType("testType");
> >> NodeTypeTemplate repositoryTypeTemplate =
> >> nodeTypeManager.createNodeTypeTemplate(repositoryType);
> >> PropertyDefinitionTemplate testProperty =
> >> nodeTypeManager.createPropertyDefinitionTemplate();
> >> testProperty.setName("testProperty");
> >> testProperty.setRequiredType(PropertyType.STRING);
> >> testProperty.setMandatory(false);
> >> testProperty.setMultiple(false);
> >> testProp

Re: Multiple property definition for same property

2020-06-18 Thread jorgeeflorez .
 Hi all,
I just created a maven project, used Oak version 1.30.0 and tested the
problem I reported on OAK-8961
<https://issues.apache.org/jira/browse/OAK-8961>. It still happens. I will
see if I am able to delete the duplicate jcr:propertyDefinition nodes, any
ideas are welcome :)

Regards.

Jorge

El mié., 18 mar. 2020 a las 11:19, jorgeeflorez . (<
jorgeeduardoflo...@gmail.com>) escribió:

> Hi Angela,
> thank you for your help. I created
> https://issues.apache.org/jira/browse/OAK-8961.
>
> Regards.
>
> Jorge
>
> El mié., 18 mar. 2020 a las 10:09, Angela Schreiber
> () escribió:
>
>> Hi Jorge
>>
>> That sounds like a bug to me... after all you will not be able to set
>> multiple properties that have exactly the same PropertyDefinition and as
>> far as I remember it should not even be possible to create multiple
>> properties with the same name.
>>
>> Can you create a bug for this in JIRA? As usual detailed steps to
>> reproduce, test cases or even a patch are very much welcome.
>>
>> Kind regards
>> Angela
>> 
>> From: jorgeeflorez . 
>> Sent: Wednesday, March 18, 2020 3:57 PM
>> To: oak-dev@jackrabbit.apache.org 
>> Subject: Multiple property definition for same property
>>
>> Hi all,
>> using the following code, I am able to update an existing node type by
>> inserting a new property:
>>
>> NodeTypeManager nodeTypeManager =
>> session.getWorkspace().getNodeTypeManager();
>>
>> NodeType repositoryType = nodeTypeManager.getNodeType("testType");
>> NodeTypeTemplate repositoryTypeTemplate =
>> nodeTypeManager.createNodeTypeTemplate(repositoryType);
>> PropertyDefinitionTemplate testProperty =
>> nodeTypeManager.createPropertyDefinitionTemplate();
>> testProperty.setName("testProperty");
>> testProperty.setRequiredType(PropertyType.STRING);
>> testProperty.setMandatory(false);
>> testProperty.setMultiple(false);
>> testProperty.setDefaultValues(new Value[0]);
>> testProperty.setValueConstraints(new String[0]);
>> repositoryTypeTemplate.getPropertyDefinitionTemplates().add(testProperty);
>>
>> nodeTypeManager.registerNodeType(repositoryTypeTemplate, true);
>> session.save();
>>
>> I prefer this way, instead using CND
>> <https://jackrabbit.apache.org/jcr/node-type-notation.html> because I
>> understand it better and is cleaner, compared to having everything inside
>> a
>> String (am I doing it correctly?).
>>
>> Because of a bug I was tracking, I found out that, if you invoke this code
>> several times, it will insert a new property definition each time, so in
>> the repository you could end up with this (I removed a lot of stuff to
>> keep
>> it small):
>> {
>> "node": "testType",
>> "path": "/jcr:system/jcr:nodeTypes/testType",
>> "children": [
>> {
>> "node": "jcr:propertyDefinition",
>> "path":
>> "/jcr:system/jcr:nodeTypes/testType/jcr:propertyDefinition",
>> "properties": [
>> *"jcr:name = testProperty"*
>> ]
>> },
>> {
>> "node": "jcr:propertyDefinition[10]",
>> "path":
>> "/jcr:system/jcr:nodeTypes/testType/jcr:propertyDefinition[10]",
>> "mixins": [],
>> "children": [],
>> "properties": [
>> *"jcr:name = testProperty"*
>> ]
>> },
>> {
>> "node": "jcr:propertyDefinition[2]",
>> "path":
>> "/jcr:system/jcr:nodeTypes/testType/jcr:propertyDefinition[2]",
>> "mixins": [],
>> "children": [],
>> "properties": [
>> *"jcr:name = testProperty"*
>> ]
>> },
>> {
>> "node": "jcr:propertyDefinition[3]",
>> "path":
>> "/jcr:system/jcr:nodeTypes/testType/jcr:propertyDefinition[3]",
>> "mixins": [],
>> "children": [],
>> "properties": [
>> *"jcr:name = testProperty"*
>> ]
>> },
>> {
&

Re: Getting Repository Statistics

2020-05-20 Thread jorgeeflorez .
Hi,
is it possible to have access to metrics like the ones in
https://jackrabbit.apache.org/oak/docs/nodestore/document/metrics.html in a
non osgi environment?
Should I create a StatisticsProvider and use getCounterStats?

Jorge

El dom., 17 may. 2020 a las 10:00, jorgeeflorez . (<
jorgeeduardoflo...@gmail.com>) escribió:

> Hi all,
> I would like to know some statistics from a repository (a rather large
> repository):
> 1. Node count from each node type.
> 2. Total node count (from user created node types).
> 3. Total file size (maybe including/excluding version files).
> 4. How many files are stored for a specific extension.
> 5. The smallest file stored (and its size), maybe  for a specific
> extension.
> 6. The largest file stored (and its size) , maybe  for a specific
> extension.
>
> I think node counts can be known by making a query (e.g. SELECT [name()]
>  FROM [MyType]), iterating and counting, but that can take some time in my
> repository and for each node type. Is there another way?
> I am not sure how would I get file size statistics, maybe with some method
> from the node/data store?
>
> Any help is appreciated :)
>
> Best Regards.
>
> Jorge
>


Re: Query ordered by node name

2020-05-19 Thread jorgeeflorez .
Hi Julian, thanks for your reply.

> You could try the Oak Index Definition Generator.
>
> http://oakutils.appspot.com/generate/index
>
I regularly use that page to generate the index definitions I need. It was
odd, when I tried the suggested index it was not chosen. It was cheaper to
traverse. I deleted the index, created it again and now it is chosen, but
it takes more time than traversing.

Traversing takes around 24 seconds.
With name = ":name" takes around 39 seconds.
With name = "fn:name()" takes around 39 seconds.


When the index is created this is some of the log it prints:
INFO org.apache.jackrabbit.oak.plugins.index.IndexUpdate  - Reindexing
Traversed #86 /repo1/pruebaJF2/Doc 463312580 [4673.91 nodes/s,
16826067.39 nodes/hr] (Elapsed 3.078 min, Expected 2.000 s, Completed
98.92%)
INFO org.apache.jackrabbit.oak.plugins.index.IndexUpdate  - Indexing report
- /oak:index/bigIndex*(81213)

INFO org.apache.jackrabbit.oak.plugins.index.IndexUpdate  - Reindexing
completed
INFO org.apache.jackrabbit.oak.plugins.index.AsyncIndexUpdate  - [async]
Reindexing completed for indexes: [/oak:index/bigIndex*(81213)] in 3.093
min (185608 ms)

I do not know what is going on. Maybe the index takes into account more
nodes that it should (like version nodes) or something like that to take
longer than traversing...

Regards.

Jorge




El mar., 19 may. 2020 a las 4:02, Julian Sedding ()
escribió:

> Or alternatively try [function = "fn:name()"], i.e. with the brackets "()".
>
> Regards
> Julian
>
> On Tue, May 19, 2020 at 10:57 AM Julian Sedding 
> wrote:
> >
> > Hi Jorge
> >
> > You could try the Oak Index Definition Generator.
> >
> > http://oakutils.appspot.com/generate/index
> >
> > FWIW, in the "name" property node it sets [name = ":name"] instead of
> > [function = "fn:name"]. I don't know if that makes a difference and
> > which is better, if any.
> >
> > Regards
> > Julian
> >
> > On Mon, May 18, 2020 at 11:55 PM jorgeeflorez .
> >  wrote:
> > >
> > > Hello,
> > > with the following query  I am able to get file nodes ordered by name:
> > >
> > > SELECT * FROM [nt:file] AS s WHERE ISCHILDNODE(s, [/repo1/pruebaJF1])
> ORDER
> > > BY NAME([s]) DESC
> > >
> > > unfortunately, because I do not have an index, on a big repository I
> have
> > > warnings like:
> > >
> > > WARN org.apache.jackrabbit.oak.plugins.index.Cursors$TraversingCursor
> -
> > > Traversed 81000 nodes with filter Filter(query=SELECT * FROM [nt:file]
> AS s
> > > WHERE ISCHILDNODE(s, [/repo1/pruebaJF1]) ORDER BY NAME([s]) DESC,
> > > path=/repo1/pruebaJF1/*); consider creating an index or changing the
> query
> > >
> > > and the query takes a lot of time.
> > >
> > > I do not know how to define a proper index for name(). if I use the
> > > following:
> > >   - compatVersion = 2
> > >   - async = "async"
> > >   - jcr:primaryType = oak:QueryIndexDefinition
> > >   - evaluatePathRestrictions = true
> > >   - type = "lucene"
> > >   + indexRules
> > >+ nt:file
> > > + properties
> > >  + primaryType
> > >   - name = "jcr:primaryType"
> > >   - propertyIndex = true
> > >  + name
> > >   - function = "fn:name"
> > >   - ordered = true
> > >   - type = "String"
> > >
> > > the index is used (index cost is 501 compared to 80946 for traverse),
> but
> > > it takes more time than traversing with warnings like:
> > >
> > > WARN
> > >
> org.apache.jackrabbit.oak.plugins.index.search.spi.query.FulltextIndex$FulltextPathCursor
> > >  - Index-Traversed 8 nodes with filter Filter(query=SELECT * FROM
> > > [nt:file] AS s WHERE ISCHILDNODE(s, [/repo1/pruebaJF1]) ORDER BY
> NAME([s])
> > > DESC, path=/repo1/pruebaJF1/*)
> > >
> > > Thanks in advance.
> > >
> > > Regards.
> > >
> > > Jorge
>


Query ordered by node name

2020-05-18 Thread jorgeeflorez .
Hello,
with the following query  I am able to get file nodes ordered by name:

SELECT * FROM [nt:file] AS s WHERE ISCHILDNODE(s, [/repo1/pruebaJF1]) ORDER
BY NAME([s]) DESC

unfortunately, because I do not have an index, on a big repository I have
warnings like:

WARN org.apache.jackrabbit.oak.plugins.index.Cursors$TraversingCursor  -
Traversed 81000 nodes with filter Filter(query=SELECT * FROM [nt:file] AS s
WHERE ISCHILDNODE(s, [/repo1/pruebaJF1]) ORDER BY NAME([s]) DESC,
path=/repo1/pruebaJF1/*); consider creating an index or changing the query

and the query takes a lot of time.

I do not know how to define a proper index for name(). if I use the
following:
  - compatVersion = 2
  - async = "async"
  - jcr:primaryType = oak:QueryIndexDefinition
  - evaluatePathRestrictions = true
  - type = "lucene"
  + indexRules
   + nt:file
+ properties
 + primaryType
  - name = "jcr:primaryType"
  - propertyIndex = true
 + name
  - function = "fn:name"
  - ordered = true
  - type = "String"

the index is used (index cost is 501 compared to 80946 for traverse), but
it takes more time than traversing with warnings like:

WARN
org.apache.jackrabbit.oak.plugins.index.search.spi.query.FulltextIndex$FulltextPathCursor
 - Index-Traversed 8 nodes with filter Filter(query=SELECT * FROM
[nt:file] AS s WHERE ISCHILDNODE(s, [/repo1/pruebaJF1]) ORDER BY NAME([s])
DESC, path=/repo1/pruebaJF1/*)

Thanks in advance.

Regards.

Jorge


Getting Repository Statistics

2020-05-17 Thread jorgeeflorez .
Hi all,
I would like to know some statistics from a repository (a rather large
repository):
1. Node count from each node type.
2. Total node count (from user created node types).
3. Total file size (maybe including/excluding version files).
4. How many files are stored for a specific extension.
5. The smallest file stored (and its size), maybe  for a specific extension.
6. The largest file stored (and its size) , maybe  for a specific
extension.

I think node counts can be known by making a query (e.g. SELECT [name()]
 FROM [MyType]), iterating and counting, but that can take some time in my
repository and for each node type. Is there another way?
I am not sure how would I get file size statistics, maybe with some method
from the node/data store?

Any help is appreciated :)

Best Regards.

Jorge


Re: Edit group

2020-05-13 Thread jorgeeflorez .
Hi,
to answer my own question (and "for the record"). The user id or group id
cannot be changed once it is created (see
https://jackrabbit.apache.org/oak/docs/security/user/default.html ).
However, it is possible to set a value for a property with the name you
want to the Authorizable (user or group) and use that property as you see
fit. For example:

UserManager um = session.getUserManager();
Group myGroup = um.createGroup("myAwesomeGroup");
myGroup.setProperty("color" new StringValue("yellow"));

To get the value after you retrieved an authorizable you can use:
UserManager um = session.getUserManager();
Authorizable authorizable = um.getAuthorizable(group.getId());
Value[] propertyValues = authorizable.getProperty("color");
String color = null;
if (propertyValues != null) {
color = propertyValues[0].getString();
}

Jorge

El jue., 7 may. 2020 a las 12:50, jorgeeflorez . (<
jorgeeduardoflo...@gmail.com>) escribió:

> Hi all,
> I was wondering, is it possible to change the name of a group?
> I am not sure about it and I want to confirm it, please.
>
> Thanks.
>
> Best Regards.
>
> Jorge
>


Edit group

2020-05-07 Thread jorgeeflorez .
Hi all,
I was wondering, is it possible to change the name of a group?
I am not sure about it and I want to confirm it, please.

Thanks.

Best Regards.

Jorge


Extract text and reindex a specific node

2020-04-22 Thread jorgeeflorez .
Hi all,
I know the process of text extraction using Tika (so it can be added to an
index) is asynchronous and it is performed when adding a file node, or
updating the file in a file node.
I have a question: I configured a Tika parser that performs OCR over png
files. I would like to know if there is a way to launch the text extraction
process over a node,so the OCR can be performed again over a node (and the
index gets updated), without having to update anything in the node. I hope
it is clear what I need...

Thanks in advance.

Regards.

Jorge


Re: Custom FileDataStore

2020-04-14 Thread jorgeeflorez .
Hi Jörg,

thank you for your reply. Indeed, LVM sounds like an interesting
alternative. I will read more about it.

Jorge


El mar., 14 abr. 2020 a las 8:29, Jörg Hoh ()
escribió:

> HI Jorge,
>
> If the only concern is that you might run out of disk space, I would
> propose that you use a volume manager on an OS level. It allows you to
> merge multiple physical devices into a single logical volume; for example
> the LVM of Linux is capable to do that and increase the volumes also online
> (that means while the filesystem is mounted). I would not try to solve your
> requirement on an Oak level.
>
> Jörg
>
> Am Di., 14. Apr. 2020 um 14:35 Uhr schrieb jorgeeflorez . <
> jorgeeduardoflo...@gmail.com>:
>
> > Hi all,
> > I have been tasked to store repository files in file system, but not like
> > it is handled by OakFileDataStore which uses a single directory. Instead,
> > the customer wants to define one or more directories that can be on
> > different hard disks, so that "in theory" disk space will never be a
> > problem, you just "add" another directory and use it to store files.
> >
> > I am thinking that this could be possible, I could just create a class
> that
> > works like FileDataStore but handling several directories instead just
> one
> > and implement SharedDataStore like OakFileDataStore does.
> >
> > I am still thinking about it. If you think it is not possible or if there
> > is another alternative, please let me know. Thanks.
> >
> > Regards.
> >
> > Jorge
> >
>
>
> --
> Cheers,
> Jörg Hoh,
>
> http://cqdump.wordpress.com
> Twitter: @joerghoh
>


Custom FileDataStore

2020-04-14 Thread jorgeeflorez .
Hi all,
I have been tasked to store repository files in file system, but not like
it is handled by OakFileDataStore which uses a single directory. Instead,
the customer wants to define one or more directories that can be on
different hard disks, so that "in theory" disk space will never be a
problem, you just "add" another directory and use it to store files.

I am thinking that this could be possible, I could just create a class that
works like FileDataStore but handling several directories instead just one
and implement SharedDataStore like OakFileDataStore does.

I am still thinking about it. If you think it is not possible or if there
is another alternative, please let me know. Thanks.

Regards.

Jorge


Re: Multiple property definition for same property

2020-03-18 Thread jorgeeflorez .
Hi Angela,
thank you for your help. I created
https://issues.apache.org/jira/browse/OAK-8961.

Regards.

Jorge

El mié., 18 mar. 2020 a las 10:09, Angela Schreiber
() escribió:

> Hi Jorge
>
> That sounds like a bug to me... after all you will not be able to set
> multiple properties that have exactly the same PropertyDefinition and as
> far as I remember it should not even be possible to create multiple
> properties with the same name.
>
> Can you create a bug for this in JIRA? As usual detailed steps to
> reproduce, test cases or even a patch are very much welcome.
>
> Kind regards
> Angela
> ____
> From: jorgeeflorez . 
> Sent: Wednesday, March 18, 2020 3:57 PM
> To: oak-dev@jackrabbit.apache.org 
> Subject: Multiple property definition for same property
>
> Hi all,
> using the following code, I am able to update an existing node type by
> inserting a new property:
>
> NodeTypeManager nodeTypeManager =
> session.getWorkspace().getNodeTypeManager();
>
> NodeType repositoryType = nodeTypeManager.getNodeType("testType");
> NodeTypeTemplate repositoryTypeTemplate =
> nodeTypeManager.createNodeTypeTemplate(repositoryType);
> PropertyDefinitionTemplate testProperty =
> nodeTypeManager.createPropertyDefinitionTemplate();
> testProperty.setName("testProperty");
> testProperty.setRequiredType(PropertyType.STRING);
> testProperty.setMandatory(false);
> testProperty.setMultiple(false);
> testProperty.setDefaultValues(new Value[0]);
> testProperty.setValueConstraints(new String[0]);
> repositoryTypeTemplate.getPropertyDefinitionTemplates().add(testProperty);
>
> nodeTypeManager.registerNodeType(repositoryTypeTemplate, true);
> session.save();
>
> I prefer this way, instead using CND
> <https://jackrabbit.apache.org/jcr/node-type-notation.html> because I
> understand it better and is cleaner, compared to having everything inside a
> String (am I doing it correctly?).
>
> Because of a bug I was tracking, I found out that, if you invoke this code
> several times, it will insert a new property definition each time, so in
> the repository you could end up with this (I removed a lot of stuff to keep
> it small):
> {
> "node": "testType",
> "path": "/jcr:system/jcr:nodeTypes/testType",
> "children": [
> {
> "node": "jcr:propertyDefinition",
> "path":
> "/jcr:system/jcr:nodeTypes/testType/jcr:propertyDefinition",
> "properties": [
> *"jcr:name = testProperty"*
> ]
> },
> {
> "node": "jcr:propertyDefinition[10]",
> "path":
> "/jcr:system/jcr:nodeTypes/testType/jcr:propertyDefinition[10]",
> "mixins": [],
> "children": [],
> "properties": [
> *"jcr:name = testProperty"*
> ]
> },
> {
> "node": "jcr:propertyDefinition[2]",
> "path":
> "/jcr:system/jcr:nodeTypes/testType/jcr:propertyDefinition[2]",
> "mixins": [],
> "children": [],
> "properties": [
> *"jcr:name = testProperty"*
> ]
> },
> {
> "node": "jcr:propertyDefinition[3]",
> "path":
> "/jcr:system/jcr:nodeTypes/testType/jcr:propertyDefinition[3]",
> "mixins": [],
> "children": [],
> "properties": [
> *"jcr:name = testProperty"*
> ]
> },
> {
> "node": "jcr:propertyDefinition[4]",
> "path":
> "/jcr:system/jcr:nodeTypes/testType/jcr:propertyDefinition[4]",
> "mixins": [],
> "children": [],
> "properties": [
> *"jcr:name = testProperty"*
> ]
> },
> {
> "node": "jcr:propertyDefinition[5]",
> "path":
> "/jcr:system/jcr:nodeTypes/testType/jcr:propertyDefinition[5]",
> "mixins": [],
> "children": [],
> "properties": [
> *"jcr:name = testProperty"*
> ]
> },
> {
> "

Multiple property definition for same property

2020-03-18 Thread jorgeeflorez .
Hi all,
using the following code, I am able to update an existing node type by
inserting a new property:

NodeTypeManager nodeTypeManager =
session.getWorkspace().getNodeTypeManager();

NodeType repositoryType = nodeTypeManager.getNodeType("testType");
NodeTypeTemplate repositoryTypeTemplate =
nodeTypeManager.createNodeTypeTemplate(repositoryType);
PropertyDefinitionTemplate testProperty =
nodeTypeManager.createPropertyDefinitionTemplate();
testProperty.setName("testProperty");
testProperty.setRequiredType(PropertyType.STRING);
testProperty.setMandatory(false);
testProperty.setMultiple(false);
testProperty.setDefaultValues(new Value[0]);
testProperty.setValueConstraints(new String[0]);
repositoryTypeTemplate.getPropertyDefinitionTemplates().add(testProperty);

nodeTypeManager.registerNodeType(repositoryTypeTemplate, true);
session.save();

I prefer this way, instead using CND
 because I
understand it better and is cleaner, compared to having everything inside a
String (am I doing it correctly?).

Because of a bug I was tracking, I found out that, if you invoke this code
several times, it will insert a new property definition each time, so in
the repository you could end up with this (I removed a lot of stuff to keep
it small):
{
"node": "testType",
"path": "/jcr:system/jcr:nodeTypes/testType",
"children": [
{
"node": "jcr:propertyDefinition",
"path":
"/jcr:system/jcr:nodeTypes/testType/jcr:propertyDefinition",
"properties": [
*"jcr:name = testProperty"*
]
},
{
"node": "jcr:propertyDefinition[10]",
"path":
"/jcr:system/jcr:nodeTypes/testType/jcr:propertyDefinition[10]",
"mixins": [],
"children": [],
"properties": [
*"jcr:name = testProperty"*
]
},
{
"node": "jcr:propertyDefinition[2]",
"path":
"/jcr:system/jcr:nodeTypes/testType/jcr:propertyDefinition[2]",
"mixins": [],
"children": [],
"properties": [
*"jcr:name = testProperty"*
]
},
{
"node": "jcr:propertyDefinition[3]",
"path":
"/jcr:system/jcr:nodeTypes/testType/jcr:propertyDefinition[3]",
"mixins": [],
"children": [],
"properties": [
*"jcr:name = testProperty"*
]
},
{
"node": "jcr:propertyDefinition[4]",
"path":
"/jcr:system/jcr:nodeTypes/testType/jcr:propertyDefinition[4]",
"mixins": [],
"children": [],
"properties": [
*"jcr:name = testProperty"*
]
},
{
"node": "jcr:propertyDefinition[5]",
"path":
"/jcr:system/jcr:nodeTypes/testType/jcr:propertyDefinition[5]",
"mixins": [],
"children": [],
"properties": [
*"jcr:name = testProperty"*
]
},
{
"node": "jcr:propertyDefinition[6]",
"path":
"/jcr:system/jcr:nodeTypes/testType/jcr:propertyDefinition[6]",
"mixins": [],
"children": [],
"properties": [
*"jcr:name = testProperty"*
]
},
{
"node": "jcr:propertyDefinition[7]",
"path":
"/jcr:system/jcr:nodeTypes/testType/jcr:propertyDefinition[7]",
"mixins": [],
"children": [],
"properties": [
*"jcr:name = testProperty"*
]
},
{
"node": "jcr:propertyDefinition[8]",
"path":
"/jcr:system/jcr:nodeTypes/testType/jcr:propertyDefinition[8]",
"mixins": [],
"children": [],
"properties": [
*"jcr:name = testProperty"*
]
},
{
"node": "jcr:propertyDefinition[9]",
"path":
"/jcr:system/jcr:nodeTypes/testType/jcr:propertyDefinition[9]",
"mixins": [],
"children": [],
"properties": [
*"jcr:name = testProperty"*
]
},
{
"node": "rep:namedPropertyDefinitions",
"path":
"/jcr:system/jcr:nodeTypes/testType/rep:namedPropertyDefinitions",
"children": [
{
"node": "jcr:created",
"path":
"/jcr:system/jcr:nodeTypes/testType/rep:namedPropertyDefinitions/jcr:created",
},
{
"node": "jcr:createdBy",
"path":
"/jcr:system/jcr:nodeTypes/testType/rep:namedPropertyDefinitions/jcr:createdBy",
},
{
"node": "rep:mixinTypes",
"path":

Re: Lucene index in filesystem

2020-03-05 Thread jorgeeflorez .
Hi,
I guess nobody has ever tried this. I will try to setup an environment and
test, to see if this is possible. I will write on this thread what I find
(problems for me probably XD).

El lun., 24 feb. 2020 a las 10:32, jorgeeflorez . (<
jorgeeduardoflo...@gmail.com>) escribió:

> Hi,
> reading
> https://jackrabbit.apache.org/oak/docs/query/lucene.html#persisting-indexes
> I see that is possible to take indexes out the node store (in my case the
> mongoDB node store). There, I see the following:
>
> If the backend NodeStore supports clustering then index data would not be
>> accessible on other cluster nodes
>
>
> If I understand this correctly, if I take out an index to a folder in the
> same server Mongo is running, Oak instances running in other servers will
> not be able to access the index (because is no longer in the Mongo
> database). But, if that folder is "visible" to the other servers, the index
> would be visible and accessible?
>
> Thanks.
>
> Jorge
>
>


Re: Cluster Info problem

2020-03-03 Thread jorgeeflorez .
For now,
if I use setLeaseCheckMode(LeaseCheckMode.DISABLED) in the document store,
I should stop seeing that error, right?

El mar., 3 mar. 2020 a las 12:38, jorgeeflorez . (<
jorgeeduardoflo...@gmail.com>) escribió:

> It is done: https://issues.apache.org/jira/browse/OAK-8935
>
> El mar., 3 mar. 2020 a las 10:06, Julian Reschke ()
> escribió:
>
>> On 03.03.2020 15:48, jorgeeflorez . wrote:
>> >>
>> >> First step would be to upgrade to 1.24.0
>> >>
>> > We just upgraded from 1.5 last year. I guess I will not find much
>> trouble
>> > upgrading from 1.12, right?
>>
>> 1.5 was an unstable branch, you shouldn't use that in production anyway.
>>
>> 1.24.0 has replaced 1.12.0 as latest stable release.
>>
>> > the output of "ipconfig -a" for that machine would be helpful.
>> >>
>> >
>> > Here is the output, MAC changed and IP addresses hidden/changed.
>> >
>> > docker0   Link encap:Ethernet  HWaddr 02:4E:C5:4B:C5:E5
>> >inet addr:xxx.xx.x.x  Bcast:xxx.xxx.xxx.xxx  Mask:xxx.xxx.x.x
>> >UP BROADCAST MULTICAST  MTU:1500  Metric:1
>> >RX packets:0 errors:0 dropped:0 overruns:0 frame:0
>> >TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
>> >collisions:0 txqueuelen:0
>> >RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
>> >
>> > eth0  Link encap:Ethernet  HWaddr 06:C5:FB:F8:CF:C7
>> >inet addr:xxx.xx.xx.xx  Bcast:xxx.xxx.xxx.xxx
>> Mask:xxx.xxx.xxx.xx
>> >inet6 addr: fe80::4c8:fafd:fec1:cfc0/64 Scope:Link
>> >UP BROADCAST RUNNING MULTICAST  MTU:9001  Metric:1
>> >RX packets:2694 errors:0 dropped:0 overruns:0 frame:0
>> >TX packets:2721 errors:0 dropped:0 overruns:0 carrier:0
>> >collisions:0 txqueuelen:1000
>> >RX bytes:306659 (299.4 KiB)  TX bytes:343151 (335.1 KiB)
>> >
>> > loLink encap:Local Loopback
>> >inet addr:127.0.0.1  Mask:255.0.0.0
>> >inet6 addr: ::1/128 Scope:Host
>> >UP LOOPBACK RUNNING  MTU:65536  Metric:1
>> >RX packets:35 errors:0 dropped:0 overruns:0 frame:0
>> >TX packets:35 errors:0 dropped:0 overruns:0 carrier:0
>> >collisions:0 txqueuelen:1000
>> >RX bytes:81477 (79.5 KiB)  TX bytes:81477 (79.5 KiB)
>> > ...
>>
>> Ack. So yes, it probably would be good to extend the hack that we
>> introduced in https://issues.apache.org/jira/browse/OAK-3885 for that
>> interface.
>>
>> Can you open a Jira ticket for this?
>>
>> Best regards, Julian
>>
>


Re: Cluster Info problem

2020-03-03 Thread jorgeeflorez .
It is done: https://issues.apache.org/jira/browse/OAK-8935

El mar., 3 mar. 2020 a las 10:06, Julian Reschke ()
escribió:

> On 03.03.2020 15:48, jorgeeflorez . wrote:
> >>
> >> First step would be to upgrade to 1.24.0
> >>
> > We just upgraded from 1.5 last year. I guess I will not find much trouble
> > upgrading from 1.12, right?
>
> 1.5 was an unstable branch, you shouldn't use that in production anyway.
>
> 1.24.0 has replaced 1.12.0 as latest stable release.
>
> > the output of "ipconfig -a" for that machine would be helpful.
> >>
> >
> > Here is the output, MAC changed and IP addresses hidden/changed.
> >
> > docker0   Link encap:Ethernet  HWaddr 02:4E:C5:4B:C5:E5
> >inet addr:xxx.xx.x.x  Bcast:xxx.xxx.xxx.xxx  Mask:xxx.xxx.x.x
> >UP BROADCAST MULTICAST  MTU:1500  Metric:1
> >RX packets:0 errors:0 dropped:0 overruns:0 frame:0
> >TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
> >collisions:0 txqueuelen:0
> >RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
> >
> > eth0  Link encap:Ethernet  HWaddr 06:C5:FB:F8:CF:C7
> >inet addr:xxx.xx.xx.xx  Bcast:xxx.xxx.xxx.xxx
> Mask:xxx.xxx.xxx.xx
> >inet6 addr: fe80::4c8:fafd:fec1:cfc0/64 Scope:Link
> >UP BROADCAST RUNNING MULTICAST  MTU:9001  Metric:1
> >RX packets:2694 errors:0 dropped:0 overruns:0 frame:0
> >TX packets:2721 errors:0 dropped:0 overruns:0 carrier:0
> >collisions:0 txqueuelen:1000
> >RX bytes:306659 (299.4 KiB)  TX bytes:343151 (335.1 KiB)
> >
> > loLink encap:Local Loopback
> >inet addr:127.0.0.1  Mask:255.0.0.0
> >inet6 addr: ::1/128 Scope:Host
> >UP LOOPBACK RUNNING  MTU:65536  Metric:1
> >RX packets:35 errors:0 dropped:0 overruns:0 frame:0
> >TX packets:35 errors:0 dropped:0 overruns:0 carrier:0
> >collisions:0 txqueuelen:1000
> >RX bytes:81477 (79.5 KiB)  TX bytes:81477 (79.5 KiB)
> > ...
>
> Ack. So yes, it probably would be good to extend the hack that we
> introduced in https://issues.apache.org/jira/browse/OAK-3885 for that
> interface.
>
> Can you open a Jira ticket for this?
>
> Best regards, Julian
>


Re: Cluster Info problem

2020-03-03 Thread jorgeeflorez .
>
> First step would be to upgrade to 1.24.0
>
We just upgraded from 1.5 last year. I guess I will not find much trouble
upgrading from 1.12, right?

the output of "ipconfig -a" for that machine would be helpful.
>

Here is the output, MAC changed and IP addresses hidden/changed.

docker0   Link encap:Ethernet  HWaddr 02:4E:C5:4B:C5:E5
  inet addr:xxx.xx.x.x  Bcast:xxx.xxx.xxx.xxx  Mask:xxx.xxx.x.x
  UP BROADCAST MULTICAST  MTU:1500  Metric:1
  RX packets:0 errors:0 dropped:0 overruns:0 frame:0
  TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:0
  RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

eth0  Link encap:Ethernet  HWaddr 06:C5:FB:F8:CF:C7
  inet addr:xxx.xx.xx.xx  Bcast:xxx.xxx.xxx.xxx  Mask:xxx.xxx.xxx.xx
  inet6 addr: fe80::4c8:fafd:fec1:cfc0/64 Scope:Link
  UP BROADCAST RUNNING MULTICAST  MTU:9001  Metric:1
  RX packets:2694 errors:0 dropped:0 overruns:0 frame:0
  TX packets:2721 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:1000
  RX bytes:306659 (299.4 KiB)  TX bytes:343151 (335.1 KiB)

loLink encap:Local Loopback
  inet addr:127.0.0.1  Mask:255.0.0.0
  inet6 addr: ::1/128 Scope:Host
  UP LOOPBACK RUNNING  MTU:65536  Metric:1
  RX packets:35 errors:0 dropped:0 overruns:0 frame:0
  TX packets:35 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:1000
  RX bytes:81477 (79.5 KiB)  TX bytes:81477 (79.5 KiB)

El mar., 3 mar. 2020 a las 9:29, Julian Reschke ()
escribió:

> On 03.03.2020 15:15, jorgeeflorez . wrote:
> > Hi Julian, thanks for your reply,
> >
> > a) I am using version 1.12.0.
> > b) As far as I know, Oak is not running in Docker. It is running in the
> > JVM installed on the Linux machine, but not inside Docker.
> > c) I see... some things may add a "low" mac address to the machine,
> > interfering with the cluster info.
> >
> > Jorge
> > ...
>
>
> First step would be to upgrade to 1.24.0. If that doesn't change things,
> the output of "ipconfig -a" for that machine would be helpful.
>
> Best regards, Julian
>


Re: Cluster Info problem

2020-03-03 Thread jorgeeflorez .
Hi Julian, thanks for your reply,

a) I am using version 1.12.0.
b) As far as I know, Oak is not running in Docker. It is running in the JVM
installed on the Linux machine, but not inside Docker.
c) I see... some things may add a "low" mac address to the machine,
interfering with the cluster info.

Jorge

El mar., 3 mar. 2020 a las 8:16, Julian Reschke ()
escribió:

> On 03.03.2020 13:45, jorgeeflorez . wrote:
> > Hi,
> > I am having some problems starting a node store in a server. I am
> getting:
> > DocumentStoreException: Configured cluster node id 123 already in use:
> > needs recovery and machineId/instanceId do not match:
> > mac:02421b0c73d3//home/ec2-user != mac:0242a5c0c5e5//home/ec2-user
> >
> > I read the code from class ClusterNodeInfo and I see that, the algorithm
> > uses the lowest mac address found in the machine. The problem is that in
> > the server there is a "docker0" interface (I don't know what for), and
> that
> > interface's mac address always changes (always being the lowest).
> > For example (after using ifconfig -a):
> >
> > docker0   Link encap:Ethernet  HWaddr 02:42:C5:C3:C5:E5
> >
> > eth0  Link encap:Ethernet  HWaddr 06:C5:FB:D5:C2:C0
> >
> > loLink encap:Local Loopback
> >
> > Does anyone see alternatives other than disabling the lease check or
> > "uninstalling" docker0?
> >
> > Thanks.
> >
> > Jorge.
>
> a) What Oak version are you on?
>
> b) Is Oak running *inside* docker?
>
> c) We've seen similar issues in the past
> (https://issues.apache.org/jira/browse/OAK-3885), but not with Docker.
> Maybe we should add yet another special case...
>
> Best regards, Julian
>
>


Cluster Info problem

2020-03-03 Thread jorgeeflorez .
Hi,
I am having some problems starting a node store in a server. I am getting:
DocumentStoreException: Configured cluster node id 123 already in use:
needs recovery and machineId/instanceId do not match:
mac:02421b0c73d3//home/ec2-user != mac:0242a5c0c5e5//home/ec2-user

I read the code from class ClusterNodeInfo and I see that, the algorithm
uses the lowest mac address found in the machine. The problem is that in
the server there is a "docker0" interface (I don't know what for), and that
interface's mac address always changes (always being the lowest).
For example (after using ifconfig -a):

docker0   Link encap:Ethernet  HWaddr 02:42:C5:C3:C5:E5

eth0  Link encap:Ethernet  HWaddr 06:C5:FB:D5:C2:C0

loLink encap:Local Loopback

Does anyone see alternatives other than disabling the lease check or
"uninstalling" docker0?

Thanks.

Jorge.


Re: Versionable node deletion

2020-02-24 Thread jorgeeflorez .
Hi Marco,
I agree, it is related to OAK-8048.

> But since it
> isn't, there is still one node that references the binary, so (the binary)
> is not removed when running the garbage collector.
>
> I am not sure about this. I just printed the rootVersion node and it has
nothing related to the node that was deleted, this is an example:

"node": "jcr:rootVersion",
"path":
"/jcr:system/jcr:versionStorage/03/06/92/03069247-5a8e-4957-89d6-3ccaf32edad3/jcr:rootVersion",
"mixins": [],
"children": [{
 "node": "jcr:frozenNode",
 "path":
"/jcr:system/jcr:versionStorage/03/06/92/03069247-5a8e-4957-89d6-3ccaf32edad3/jcr:rootVersion/jcr:frozenNode",
 "mixins": [],
 "children": [],
 "properties": [
 "jcr:frozenPrimaryType = nt:file",
 "jcr:frozenUuid = 03069247-5a8e-4957-89d6-3ccaf32edad3",
 "jcr:primaryType = nt:frozenNode",
 "jcr:uuid = 3a63f325-2e8b-415e-8aa1-6112d4a9049a",
 "jcr:frozenMixinTypes =
mix:lastModified,mix:referenceable,rep:AccessControllable,mix:versionable"
]
}],
"properties": [
 "jcr:predecessors = ",
 "jcr:created = 2020-02-21T17:42:44.771-05:00",
 "jcr:primaryType = nt:version",
 "jcr:uuid = a3eae304-16f2-438d-a482-e6dbf5b3d198",
 "jcr:successors = "
]

Thinking about what I want, maybe it is not that easy to mark a binary as
"orphan" (i.e. no node is referencing it) in runtime. But it would be great
of some method could be called that gets all orphan binaries and deletes
them. To save space. I do not if something like that exists.

Jorge


El lun., 24 feb. 2020 a las 9:17, Marco Piovesana ()
escribió:

> Hi Jorge,
> I'm not an expert, but I think it might be related to OAK-804
> <https://issues.apache.org/jira/browse/OAK-8048>. The root version should
> be automatically removed when removing the last version. But since it
> isn't, there is still one node that references the binary, so (the binary)
> is not removed when running the garbage collector.
>
> Marco.
>
> On Mon, Feb 24, 2020 at 9:42 PM jorgeeflorez . <
> jorgeeduardoflo...@gmail.com>
> wrote:
>
> > Hi,
> > I managed to delete all versions for nodes that no longer exist (except
> the
> > jcr:rootVersion nodes, they are "protected"). I was expecting that the
> > total size of my binary storage would decrease (I am using
> > OakFileDataStore), since some files are no longer referenced in any
> nodes.
> > But that did not happen...
> >
> > Any help is appreciated.
> >
> > Jorge
> >
> > El vie., 21 feb. 2020 a las 15:12, jorgeeflorez . (<
> > jorgeeduardoflo...@gmail.com>) escribió:
> >
> > > Hi,
> > > when I delete a node that has version history, using node.remove() and
> > > then session.save(), should all version info related to that node be
> > > deleted automatically? what about the files in that version history?
> > >
> > > After deleting, I print all nodes of the repository and I keep seeing
> > > those version nodes. Actually, I was working with a repository uses a
> > > DataStoreBlobStore and after deleting some file nodes I was expecting
> > that
> > > the total size of the folder that contains the files would decrease and
> > it
> > > did not happen, which led me to make this question :)
> > >
> > > Thanks.
> > >
> > > Jorge
> > >
> >
>


Re: Versionable node deletion

2020-02-24 Thread jorgeeflorez .
Hi,
I managed to delete all versions for nodes that no longer exist (except the
jcr:rootVersion nodes, they are "protected"). I was expecting that the
total size of my binary storage would decrease (I am using
OakFileDataStore), since some files are no longer referenced in any nodes.
But that did not happen...

Any help is appreciated.

Jorge

El vie., 21 feb. 2020 a las 15:12, jorgeeflorez . (<
jorgeeduardoflo...@gmail.com>) escribió:

> Hi,
> when I delete a node that has version history, using node.remove() and
> then session.save(), should all version info related to that node be
> deleted automatically? what about the files in that version history?
>
> After deleting, I print all nodes of the repository and I keep seeing
> those version nodes. Actually, I was working with a repository uses a
> DataStoreBlobStore and after deleting some file nodes I was expecting that
> the total size of the folder that contains the files would decrease and it
> did not happen, which led me to make this question :)
>
> Thanks.
>
> Jorge
>


Re: CachingFileDataStore vs DataStoreBlobStore

2020-02-22 Thread jorgeeflorez .
Hi Matt,

Just be sure that any Oak instances sharing the same file location belong
> to the same logical cluster.
>
> Sharing the same file location between multiple logical instances should
> "work", but certain capabilities like data store GC won't work well in that
> scenario.
>
> That doesn't mean you need a separate file server for each Oak cluster
> though.  One location per cluster should work fine - they could be
> different shares on the same server, or even different folders in the same
> share.


I am not sure if I am understanding you. I will have a different directory
for each repository and all Oak instances for the same repository will use
that directory as File Store. Each instance will have its own clusterId.

One question though - you said one customer has servers in Amazon (I assume
> EC2).  Where are they planning to store their binaries - in file storage
> mounted by the VM or in S3?  They may wish to consider using an S3 bucket
> instead and using S3DataStore - might cost less.
>

Yes, they have EC2 servers. Initially we had the binaries stored in
MongoDB, of course that is not good. So the idea is to store them in the
OS file system, but I think available space could run out quickly. I think
I once suggested using S3 but I am not sure if they want that. I will
mention it again.

TBH I don't see what caching gives you in this scenario.  The caching
> implementation will maintain a local cache of uploaded and downloaded
> files; the intent would be to improve latency, but caches also always add
> complexity.  With OakFileDataStore the files are already "local" anyway -
> even if across a network I don't know how much the cache buys you in terms
> of performance.


Yes, although it seemed cool when I read and tried it, I think using
CachingFileDataStore could make things a bit more difficult. I hope that
with OakFileDataStore be enough.

Thank you Matt. With your help, I understand this topic a lot more (it
feels like this some info of this thread should be in the online
documentation).

Best Regards.

Jorge

El vie., 21 feb. 2020 a las 18:57, Matt Ryan ()
escribió:

> Hi Jorge,
>
> On Fri, Feb 21, 2020 at 3:40 PM jorgeeflorez . <
> jorgeeduardoflo...@gmail.com>
> wrote:
>
> > Hi Matt, thanks a lot for your answer.
> >
> > If your storage is "local" (meaning it appears as a local filesystem to
> > > Oak), I'd probably use OakFileDataStore.  It implements SharedDataStore
> > so
> > > you can share the same location with multiple instances.  For example
> if
> > > you create a file share on a NAS and then mount that share on multiple
> > > servers - even though the storage is across the network, it is mounted
> in
> > > the filesystem and appears local.  OakFileDataStore should work well
> for
> > > this purpose.
> >
> >
> > I think this would be the case: I will have one or more servers, each one
> > with one or more Oak instances (we handle several repositories), all
> > "using" the same file store. One customer has those servers in the same
> > intranet and another has them in Amazon. But in both cases I could mount
> a
> > folder that would be "visible" to all servers, right?
> >
>
> Just be sure that any Oak instances sharing the same file location belong
> to the same logical cluster.
>
> Sharing the same file location between multiple logical instances should
> "work", but certain capabilities like data store GC won't work well in that
> scenario.
>
> That doesn't mean you need a separate file server for each Oak cluster
> though.  One location per cluster should work fine - they could be
> different shares on the same server, or even different folders in the same
> share.
>
> One question though - you said one customer has servers in Amazon (I assume
> EC2).  Where are they planning to store their binaries - in file storage
> mounted by the VM or in S3?  They may wish to consider using an S3 bucket
> instead and using S3DataStore - might cost less.
>
>
>
> >
> > Do you think it would be best to use OakFileDataStore over, for example
> > CachingFileDataStore? to keep things "simple"?
> >
>
> TBH I don't see what caching gives you in this scenario.  The caching
> implementation will maintain a local cache of uploaded and downloaded
> files; the intent would be to improve latency, but caches also always add
> complexity.  With OakFileDataStore the files are already "local" anyway -
> even if across a network I don't know how much the cache buys you in terms
> of performance.
>
>
>
> >
> > As for DataStoreBlobStore - DataStoreBlobStore is a wrapper around a

Re: CachingFileDataStore vs DataStoreBlobStore

2020-02-21 Thread jorgeeflorez .
Hi Matt, thanks a lot for your answer.

If your storage is "local" (meaning it appears as a local filesystem to
> Oak), I'd probably use OakFileDataStore.  It implements SharedDataStore so
> you can share the same location with multiple instances.  For example if
> you create a file share on a NAS and then mount that share on multiple
> servers - even though the storage is across the network, it is mounted in
> the filesystem and appears local.  OakFileDataStore should work well for
> this purpose.


I think this would be the case: I will have one or more servers, each one
with one or more Oak instances (we handle several repositories), all
"using" the same file store. One customer has those servers in the same
intranet and another has them in Amazon. But in both cases I could mount a
folder that would be "visible" to all servers, right?

Do you think it would be best to use OakFileDataStore over, for example
CachingFileDataStore? to keep things "simple"?

As for DataStoreBlobStore - DataStoreBlobStore is a wrapper around a class
> that implements DataStore to make it look like a BlobStore.
>
> I have been using something like this to setup my repository, I do not
know if there is another way...

FileDataStore fds = new FileDataStore();
File dir = ...;
fds.init(dir.getAbsolutePath());
DataStoreBlobStore dsbs = new DataStoreBlobStore(fds);
DocumentNodeStore docStore = new MongoDocumentNodeStoreBuilder().
setMongoDB("mongodb://user:password@" + host + ":" +
port, "repo1", 16).
setClusterId(123).
setAsyncDelay(10).
setBlobStore(dsbs).
build();


Jorge


El vie., 21 feb. 2020 a las 16:36, Matt Ryan ()
escribió:

> Hi,
>
> I think I probably will need a bit more information about your use case to
> know how to help you best; can you provide a bit more detail about your
> environment and what you are hoping to accomplish?
>
> If your storage is "local" (meaning it appears as a local filesystem to
> Oak), I'd probably use OakFileDataStore.  It implements SharedDataStore so
> you can share the same location with multiple instances.  For example if
> you create a file share on a NAS and then mount that share on multiple
> servers - even though the storage is across the network, it is mounted in
> the filesystem and appears local.  OakFileDataStore should work well for
> this purpose.
>
> The other common use case for a shared storage location is cloud-based
> storage, like AWS S3.  In this case use S3DataStore (for AWS S3) or
> AzureDataStore (for Microsoft Azure Blob Storage).
>
> Do you have a different use case than one of these?
>
>
> As for DataStoreBlobStore - DataStoreBlobStore is a wrapper around a class
> that implements DataStore to make it look like a BlobStore.  For reasons
> I'm not fully aware of (happened before my time - probably historical),
> binary object storage in Oak is usually available as an implementation of
> the Jackrabbit DataStore interface but Oak interacts with these as
> BlobStores.  You will usually set up your repository something like this:
>DataStore ds = new OakFileDataStore(); // or whatever DataStore type you
> choose
>ds.init(dataStoreHomeDirectory);
>BlobStore blobStore = new DataStoreBlobStore(ds);
> Then you would use the blobStore to create the FileStore that your node
> store requires.
>
>
> -MR
>
> On Fri, Feb 21, 2020 at 2:03 PM jorgeeflorez . <
> jorgeeduardoflo...@gmail.com>
> wrote:
>
> > Hi,
> > I am trying to pick one data store with the purpose of avoiding binary
> > storage in MongoDB blobs collection. I would like to know which should I
> > choose to be used in production.
> > I have explored a bit (1.12 version) and my guess is that
> > DataStoreBlobStore should be used when you want to store files in a local
> > directory (one oak instance only accessing the files) whereas
> > CachingFileDataStore should be used if the folder where you want to store
> > files is located in another host and can be seen from the machine running
> > Oak (several Oak instances can be accessing the files). Is this correct?
> >
>


Re: CachingFileDataStore vs DataStoreBlobStore

2020-02-21 Thread jorgeeflorez .
Ok, I meant DataStoreBlobStore wrapping a FileDataStore and
DataStoreBlobStore wrapping a CachingFileDataStore (I am still confused I
guess)...

El vie., 21 feb. 2020 a las 16:03, jorgeeflorez . (<
jorgeeduardoflo...@gmail.com>) escribió:

> Hi,
> I am trying to pick one data store with the purpose of avoiding binary
> storage in MongoDB blobs collection. I would like to know which should I
> choose to be used in production.
> I have explored a bit (1.12 version) and my guess is that
> DataStoreBlobStore should be used when you want to store files in a local
> directory (one oak instance only accessing the files) whereas
> CachingFileDataStore should be used if the folder where you want to store
> files is located in another host and can be seen from the machine running
> Oak (several Oak instances can be accessing the files). Is this correct?
>


CachingFileDataStore vs DataStoreBlobStore

2020-02-21 Thread jorgeeflorez .
Hi,
I am trying to pick one data store with the purpose of avoiding binary
storage in MongoDB blobs collection. I would like to know which should I
choose to be used in production.
I have explored a bit (1.12 version) and my guess is that
DataStoreBlobStore should be used when you want to store files in a local
directory (one oak instance only accessing the files) whereas
CachingFileDataStore should be used if the folder where you want to store
files is located in another host and can be seen from the machine running
Oak (several Oak instances can be accessing the files). Is this correct?


Versionable node deletion

2020-02-21 Thread jorgeeflorez .
Hi,
when I delete a node that has version history, using node.remove() and then
session.save(), should all version info related to that node be deleted
automatically? what about the files in that version history?

After deleting, I print all nodes of the repository and I keep seeing those
version nodes. Actually, I was working with a repository uses a
DataStoreBlobStore and after deleting some file nodes I was expecting that
the total size of the folder that contains the files would decrease and it
did not happen, which led me to make this question :)

Thanks.

Jorge


Fwd: Import problem

2020-01-21 Thread jorgeeflorez .
Hi Marcel,
yes, I am using Gradle 4.10. But I am starting to think that's the problem.
I just created the same project in maven 3.3, included the Tika dependency
and the exception was gone.

BTW; why do you have a dependency on jackrabbit-core
>
I just copied dependencies from another project I had. I can't remember why
I included jackrabbit core there :(

Thanks.



El mar., 21 ene. 2020 a las 1:10, Julian Reschke ()
escribió:

> On 21.01.2020 02:15, jorgeeflorez . wrote:
> > Hi Marcel,
> > thank you for your reply. These are the dependencies I declared in my
> > project:
> >  implementation group: 'org.apache.jackrabbit', name:
> 'jackrabbit-core',
> > version: '2.20.0'
> >  implementation group: 'org.apache.jackrabbit', name: 'oak-core',
> > version: '1.22.0'
> >  implementation group: 'org.apache.jackrabbit', name: 'oak-jcr',
> > version: '1.22.0'
> >  implementation group: 'org.apache.jackrabbit', name: 'oak-lucene',
> > version: '1.22.0'
> >  implementation group: 'org.apache.jackrabbit', name:
> 'oak-auth-ldap',
> > version: '1.22.0'
> >  implementation group: 'org.mongodb', name: 'mongo-java-driver',
> > version: '3.8.2'
> >  implementation group: 'org.apache.tika', name: 'tika-parsers',
> version:
> > '1.23'
> >
> >  implementation group: 'org.slf4j', name: 'slf4j-api', version:
> '1.7.30'
> >  implementation group: 'org.slf4j', name: 'slf4j-log4j12', version:
> > '1.7.30'
> >  implementation group: 'org.slf4j', name: 'slf4j-log4j12', version:
> > '1.7.30'
> >  implementation group: 'log4j', name: 'log4j', version: '1.2.16'
> >
> > If I remove the tika dependency my Main class runs without problem. I
> > looked at the parent pom
> > <
> https://repo1.maven.org/maven2/org/apache/jackrabbit/oak-parent/1.22.0/oak-parent-1.22.0.pom
> >and
> > added the dependency (I know Tika is used in text extraction and index
> > related stuff).
> > Will everything work if I remove it?
> >
> > Regards.
> > Jorge
>
> With Maven, you could do "mvn dependency:tree" to see who's referencing
> what. But you use a different tool, right?
>
> BTW; why do you have a dependency on jackrabbit-core
>
> Best regards, Julian
>


Re: Import problem

2020-01-20 Thread jorgeeflorez .
Hi Marcel,
thank you for your reply. These are the dependencies I declared in my
project:
implementation group: 'org.apache.jackrabbit', name: 'jackrabbit-core',
version: '2.20.0'
implementation group: 'org.apache.jackrabbit', name: 'oak-core',
version: '1.22.0'
implementation group: 'org.apache.jackrabbit', name: 'oak-jcr',
version: '1.22.0'
implementation group: 'org.apache.jackrabbit', name: 'oak-lucene',
version: '1.22.0'
implementation group: 'org.apache.jackrabbit', name: 'oak-auth-ldap',
version: '1.22.0'
implementation group: 'org.mongodb', name: 'mongo-java-driver',
version: '3.8.2'
implementation group: 'org.apache.tika', name: 'tika-parsers', version:
'1.23'

implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.30'
implementation group: 'org.slf4j', name: 'slf4j-log4j12', version:
'1.7.30'
implementation group: 'org.slf4j', name: 'slf4j-log4j12', version:
'1.7.30'
implementation group: 'log4j', name: 'log4j', version: '1.2.16'

If I remove the tika dependency my Main class runs without problem. I
looked at the parent pom
<https://repo1.maven.org/maven2/org/apache/jackrabbit/oak-parent/1.22.0/oak-parent-1.22.0.pom>and
added the dependency (I know Tika is used in text extraction and index
related stuff).
Will everything work if I remove it?

Regards.
Jorge

El lun., 20 ene. 2020 a las 2:48, Marcel Reutegger
() escribió:

> Hi,
>
> The Guava method sameThreadExecutor() was removed in version 21 [0].
> I assume there must be a more recent Guava version than 15 on your
> classpath.
>
> Regards
>  Marcel
>
> [0] https://github.com/google/guava/wiki/Release21#commonutilconcurrent
>
> On 18.01.20, 22:22, "jorgeeflorez ." 
> wrote:
>
> Hello all,
> I am trying to build a standalone application that will use Jackrabbit
> and
> Oak (a Gradle project). I am having problems when the node store is
> being
> built. This is the stack trace:
>
> Exception in thread "main" java.lang.NoSuchMethodError:
>
> com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor()Lcom/google/common/util/concurrent/ListeningExecutorService;
> at
>
> org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBuilder.getExecutor(DocumentNodeStoreBuilder.java:440)
> at
>
> org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.(DocumentNodeStore.java:554)
>
> It seems a Guava related problem. I tried to declare the dependency in
> my
> project to 15.0 version but the problem persists.
>
> Any help is welcome.
>
> Regards,
>
> Jorge
>
>
>


Import problem

2020-01-18 Thread jorgeeflorez .
Hello all,
I am trying to build a standalone application that will use Jackrabbit and
Oak (a Gradle project). I am having problems when the node store is being
built. This is the stack trace:

Exception in thread "main" java.lang.NoSuchMethodError:
com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor()Lcom/google/common/util/concurrent/ListeningExecutorService;
at
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBuilder.getExecutor(DocumentNodeStoreBuilder.java:440)
at
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.(DocumentNodeStore.java:554)

It seems a Guava related problem. I tried to declare the dependency in my
project to 15.0 version but the problem persists.

Any help is welcome.

Regards,

Jorge


Regarding DocumentStore and BlobStore

2020-01-12 Thread jorgeeflorez .
Hi all,
I am starting a personal project and I plan to use Oak and Jackrabbit. I
have read documentation about node storage a couple times and I think I
understand (I guess). Here are my questions:

If I use MongoDB as document store will I be able to set as blob store one
of the six available, right?

If the answer to the previous question is yes, if I create two backends
(Oak instances), both using the same type of document and blob store, and
both pointing to the same "location" (folder in a file system, S3 path,
etc). will they work without collisions or conflicts when reading/storing
files?

I am not sure if my questions make sense. Any help is appreciated.

Best Regards.

Jorge


Re: Alphabetical node name ordering

2019-12-13 Thread jorgeeflorez .
Hi Piotr, thank You. I knew it was not easy thing but I had to ask :). If I
have some free time maybe I will see what I can do.
Jorge


El vie., 13 de dic. de 2019 6:13 a. m., Piotr Tajduś 
escribió:

> Hi,
> AFAIK there is no direct way to do it, it uses java String comparing.
> You would have to split name into metadata like basename and number and
> order using both of them, or use names with preceding zeros, like
> analisis 1. Also be aware, that ordering is case sensitive, so you
> will have all upper letters before lower letters A-Za-z so you may need
> to order by lower() or upper() functions.
>
> Best regards,
> Piotr
>
>
> On 11.12.2019 13:10, jorgeeflorez . wrote:
> > Hi all,
> >
> > I am just wondering, because the customer will probably ask me. Is it
> > possible or is there a way to have node name alphabetical ordering? when
> I
> > execute for example:
> >
> > SELECT * FROM [nt:file] AS s WHERE ISCHILDNODE(s, [/repo4/Carpeta
> > 72224012]) ORDER BY NAME([s]) ASC
> >
> > So instead of getting
> >
> > 1. /repo4/Carpeta 72224012/analisis 1
> > 2. /repo4/Carpeta 72224012/analisis 10
> > 3. /repo4/Carpeta 72224012/analisis 2
> >
> > I could get
> > 1. /repo4/Carpeta 72224012/analisis 1
> > 2. /repo4/Carpeta 72224012/analisis 2
> > 3. /repo4/Carpeta 72224012/analisis 10
> >
> > I am also setting offset and limit to the query, by the way.
> >
> > Thanks.
> >
> > Best regards.
> >
> > Jorge
> >
>
>


Alphabetical node name ordering

2019-12-11 Thread jorgeeflorez .
Hi all,

I am just wondering, because the customer will probably ask me. Is it
possible or is there a way to have node name alphabetical ordering? when I
execute for example:

SELECT * FROM [nt:file] AS s WHERE ISCHILDNODE(s, [/repo4/Carpeta
72224012]) ORDER BY NAME([s]) ASC

So instead of getting

1. /repo4/Carpeta 72224012/analisis 1
2. /repo4/Carpeta 72224012/analisis 10
3. /repo4/Carpeta 72224012/analisis 2

I could get
1. /repo4/Carpeta 72224012/analisis 1
2. /repo4/Carpeta 72224012/analisis 2
3. /repo4/Carpeta 72224012/analisis 10

I am also setting offset and limit to the query, by the way.

Thanks.

Best regards.

Jorge


Re: Versioning of files

2019-12-09 Thread jorgeeflorez .
Hi Tanvi,

I know I am not part of developers team, but perhaps my little knowledge
can be of help :)

In our case we are versioning the file nodes i.e. the parent node of
jcr:content and so far, all is ok. Have you tried using "mix:versionable"
instead of NodeType.MIX_VERSIONABLE?

Regards.

Jorge

El lun., 9 dic. 2019 a las 5:17, Tanvi Shah ()
escribió:

>
> Hi,
> We are implementing versioning of jcr:content with repository having more
> than 20,000 of nodes. But after adding the mixin for mix:versionable the
> session is taking too much time for saving the data.
>
> The code is :
> final Node content = file.addNode(Property.JCR_CONTENT,
> NodeType.NT_RESOURCE);
> content.addMixin(NodeType.MIX_VERSIONABLE);
> content.setProperty(Property.JCR_DATA, binary);
> session.save();
> log.info("Saving session and chekin the node");
> versionManager.checkin(content.getPath());
>
> So please help me with tackling this problem where session takes minimum
> time for saving as this is stopping our release. Thank you in advance.
>
> Regards,
>
> Tanvi Shah
> Software Developer
> ECM
> SpringerNature Technology and Publishing Solutions
> Tower 8 & 9, Magarpatta City SEZ, Hadapsar, Pune 411 013, Maharashtra,
> India
> T +91 20 7100 7061
> tanvi.s...@springernature.com
> www.springernature.com
> ---
> Springer Nature is one of the world's leading global research, educational
> and professional publishers, created in 2015 through the combination of
> Nature Publishing Group,
> Palgrave Macmillan, Macmillan Education and Springer Science+Business
> Media.
>
> This e-mail is confidential and should not be used by anyone who is not
> the original intended recipient. If you have received this e-mail in error
> please inform the sender and delete it from your mailbox or any other
> storage mechanism. Springer Nature Technology and Publishing Solutions
> Private Limited does not accept liability for any statements made which are
> clearly the sender's own and not expressly made on behalf of Springer
> Nature Technology and Publishing Solutions Private Limited or one of their
> agents.
> Please note that Springer Nature Technology and Publishing Solutions
> Private Limited and their agents and affiliates do not accept any
> responsibility for viruses or malware that may be contained in this e-mail
> or its attachments and it is your responsibility to scan the e-mail and
> attachments (if any).
> Springer Nature Technology and Publishing Solutions Private Limited.
> Registered office: Upper Ground Floor, Wing B, Tower 8, Magarpatta City
> SEZ, Hadapsar Pune MH 411013 IN
> Registered number: U72200PN2006FTC128967
>


Re: SQL - Ordering by node name

2019-12-05 Thread jorgeeflorez .
Hi Piotr,
that did the trick. Thank you, I did not know I could do something like
that.
Thanks again :)

Jorge

El jue., 5 dic. 2019 a las 7:58, Piotr Tajduś ()
escribió:

> Hi,
> You could try:
> order by name([s]) asc
> order by name([s]) desc
>
>
> Best regards,
> Piotr
>
>
> On 05.12.2019 13:17, jorgeeflorez . wrote:
> > Hello again,
> > when I execute the following queries (Oak 1.12.0, with no indexes created
> > by me):
> >
> >
> >
> >
> >
> > *SELECT * FROM [nt:file] AS s WHERE ISCHILDNODE(s, [/repo4]) ORDER BY
> > [NAME()] DESCSELECT * FROM [nt:file] AS s WHERE ISCHILDNODE(s, [/repo4])
> > ORDER BY [NAME()] ASC*
> > I am getting the nodes in the same order (seems ascending), regardless I
> > use ASC or DESC. Is it currently possible to sort by node name?
> >
> > These are org.apache.jackrabbit.oak.query.QueryImpl details for each
> query,
> > in case it is useful...
> > - Parsing JCR-SQL2 statement: SELECT * FROM [nt:file] AS s WHERE
> > ISCHILDNODE(s, [/repo4]) ORDER BY [NAME()] ASC
> > - cost using filter Filter(query=SELECT * FROM [nt:file] AS s WHERE
> > ISCHILDNODE(s, [/repo4]) ORDER BY [NAME()] ASC, path=/repo4/*)
> > - cost for reference is Infinity
> > - cost for property is Infinity
> > - cost for nodeType is 44.0
> > - cost for lucene-property is Infinity
> > - cost for aggregate lucene is Infinity
> > - cost for traverse is 1000.0
> > - count: 1 query: SELECT * FROM [nt:file] AS s WHERE ISCHILDNODE(s,
> > [/repo4]) ORDER BY [NAME()] ASC
> > - query execute SELECT * FROM [nt:file] AS s WHERE ISCHILDNODE(s,
> [/repo4])
> > ORDER BY [NAME()] ASC
> > - query plan [nt:file] as [s] /* nodeType Filter(query=SELECT * FROM
> > [nt:file] AS s WHERE ISCHILDNODE(s, [/repo4]) ORDER BY [NAME()] ASC,
> > path=/repo4/*) where ischildnode([s], [/repo4]) */
> >
> >
> > - Parsing JCR-SQL2 statement: SELECT * FROM [nt:file] AS s WHERE
> > ISCHILDNODE(s, [/repo4]) ORDER BY [NAME()] DESC
> > - cost using filter Filter(query=SELECT * FROM [nt:file] AS s WHERE
> > ISCHILDNODE(s, [/repo4]) ORDER BY [NAME()] DESC, path=/repo4/*)
> > - cost for reference is Infinity
> > - cost for property is Infinity
> > - cost for nodeType is 44.0
> > - cost for lucene-property is Infinity
> > - cost for aggregate lucene is Infinity
> > - cost for traverse is 1000.0
> > - count: 1 query: SELECT * FROM [nt:file] AS s WHERE ISCHILDNODE(s,
> > [/repo4]) ORDER BY [NAME()] DESC
> > - query execute SELECT * FROM [nt:file] AS s WHERE ISCHILDNODE(s,
> [/repo4])
> > ORDER BY [NAME()] DESC
> > - query plan [nt:file] as [s] /* nodeType Filter(query=SELECT * FROM
> > [nt:file] AS s WHERE ISCHILDNODE(s, [/repo4]) ORDER BY [NAME()] DESC,
> > path=/repo4/*) where ischildnode([s], [/repo4]) */
> >
> > Thanks in advance.
> >
> > Jorge
> >
>
>


SQL - Ordering by node name

2019-12-05 Thread jorgeeflorez .
Hello again,
when I execute the following queries (Oak 1.12.0, with no indexes created
by me):





*SELECT * FROM [nt:file] AS s WHERE ISCHILDNODE(s, [/repo4]) ORDER BY
[NAME()] DESCSELECT * FROM [nt:file] AS s WHERE ISCHILDNODE(s, [/repo4])
ORDER BY [NAME()] ASC*
I am getting the nodes in the same order (seems ascending), regardless I
use ASC or DESC. Is it currently possible to sort by node name?

These are org.apache.jackrabbit.oak.query.QueryImpl details for each query,
in case it is useful...
- Parsing JCR-SQL2 statement: SELECT * FROM [nt:file] AS s WHERE
ISCHILDNODE(s, [/repo4]) ORDER BY [NAME()] ASC
- cost using filter Filter(query=SELECT * FROM [nt:file] AS s WHERE
ISCHILDNODE(s, [/repo4]) ORDER BY [NAME()] ASC, path=/repo4/*)
- cost for reference is Infinity
- cost for property is Infinity
- cost for nodeType is 44.0
- cost for lucene-property is Infinity
- cost for aggregate lucene is Infinity
- cost for traverse is 1000.0
- count: 1 query: SELECT * FROM [nt:file] AS s WHERE ISCHILDNODE(s,
[/repo4]) ORDER BY [NAME()] ASC
- query execute SELECT * FROM [nt:file] AS s WHERE ISCHILDNODE(s, [/repo4])
ORDER BY [NAME()] ASC
- query plan [nt:file] as [s] /* nodeType Filter(query=SELECT * FROM
[nt:file] AS s WHERE ISCHILDNODE(s, [/repo4]) ORDER BY [NAME()] ASC,
path=/repo4/*) where ischildnode([s], [/repo4]) */


- Parsing JCR-SQL2 statement: SELECT * FROM [nt:file] AS s WHERE
ISCHILDNODE(s, [/repo4]) ORDER BY [NAME()] DESC
- cost using filter Filter(query=SELECT * FROM [nt:file] AS s WHERE
ISCHILDNODE(s, [/repo4]) ORDER BY [NAME()] DESC, path=/repo4/*)
- cost for reference is Infinity
- cost for property is Infinity
- cost for nodeType is 44.0
- cost for lucene-property is Infinity
- cost for aggregate lucene is Infinity
- cost for traverse is 1000.0
- count: 1 query: SELECT * FROM [nt:file] AS s WHERE ISCHILDNODE(s,
[/repo4]) ORDER BY [NAME()] DESC
- query execute SELECT * FROM [nt:file] AS s WHERE ISCHILDNODE(s, [/repo4])
ORDER BY [NAME()] DESC
- query plan [nt:file] as [s] /* nodeType Filter(query=SELECT * FROM
[nt:file] AS s WHERE ISCHILDNODE(s, [/repo4]) ORDER BY [NAME()] DESC,
path=/repo4/*) where ischildnode([s], [/repo4]) */

Thanks in advance.

Jorge


Searching by node name

2019-12-03 Thread jorgeeflorez .
Hi all,
in Oak's lucene index web page I find queries like

*select [jcr:path] from [nt:base] where NAME() LIKE ‘kite%’*

to search nodes based on their name.

Is it possible to search by node name using function contains()?

Thanks.

Jorge


Use Lucene Index for all property types?

2019-11-29 Thread jorgeeflorez .
Hi,
I apologize in advance if this email is too long to read.

I am trying to create one Lucene index that includes all user defined
properties and excludes some other "not visible" properties.

Should I include in my Lucene index, properties of type LONG, DOUBLE, DATE?
would it speed up numbers or dates comparison?
How values of these types are sent to the analyzer, as the string that
appears in the Mongo document (for example)?

I am having this problem:

I have a node with the following property (the property type is DOUBLE):
Node : /repo2/Folder3
Node type: FolderL1
Property L1_double  Value: 10.0147

When I execute this query :
SELECT * FROM [FolderL1] as n WHERE (n.[L1_double] = 10.0147)
having no lucene index I get the node. *Everything is ok so far*. This is
the query stuff:
Parsing JCR-SQL2 statement: SELECT * FROM [FolderL1] as n WHERE
(n.[L1_double] = 10.0147)
- cost using filter Filter(query=SELECT * FROM [FolderL1] as n WHERE
(n.[L1_double] = 10.0147), path=*, property=[L1_double=[10.0147]])
- cost for reference is Infinity
- cost for property is Infinity
- cost for nodeType is 24.0
- cost for lucene-property is Infinity
- cost for aggregate lucene is Infinity
- cost for traverse is 2148.0
- query plan [FolderL1] as [n] /* nodeType Filter(query=SELECT * FROM
[FolderL1] as n WHERE (n.[L1_double] = 10.0147), path=*,
property=[L1_double=[10.0147]]) where [n].[L1_double] = cast('10.0147' as
decimal) */

but when I define this index named *indice1* with the following:
  - compatVersion = 2
  - async = "async"
  - jcr:primaryType = oak:QueryIndexDefinition
  - type = "lucene"
  + indexRules
   + FolderL1
+ properties
 + L1_double
  - name = "L1_double"
  - propertyIndex = true

and execute the query, I don't get the node as result. This is the query
stuff:
- Parsing JCR-SQL2 statement: SELECT * FROM [FolderL1] as n WHERE
(n.[L1_double] = 10.0147)
- cost using filter Filter(query=SELECT * FROM [FolderL1] as n WHERE
(n.[L1_double] = 10.0147), path=*, property=[L1_double=[10.0147]])
- cost for reference is Infinity
- cost for property is Infinity
- cost for nodeType is 24.0
- cost for [/oak:index/indice1] of type (lucene-property) with plan
[lucene:indice1(/oak:index/indice1) L1_double:10.0147] is 2.00
- cost for lucene-property is Infinity
- cost for traverse is 2148.0
- count: 1 query: SELECT * FROM [FolderL1] as n WHERE (n.[L1_double] =
10.0147)
- query execute SELECT * FROM [FolderL1] as n WHERE (n.[L1_double] =
10.0147)
- query plan [FolderL1] as [n] /* lucene:indice1(/oak:index/indice1)
L1_double:10.0147 where [n].[L1_double] = cast('10.0147' as decimal) */

Maybe I am missing something...
I hope someone can help me. Thanks.

Jorge


Re: Lucene Index property Definitions

2019-11-29 Thread jorgeeflorez .
Hi Vikas,
I created OAK-8811 . Thanks
for your help.

Best Regards.
Jorge

El jue., 28 nov. 2019 a las 14:06, Vikas Saurabh ()
escribió:

> > I am searching using SQL-2  to create
> queries, those examples don't look familiar to me.
>
> //element(*, app:Asset)[jcr:contains(., ‘image’)] in sql2 would look like
> select [jcr:path] from [app:Asset] where contains(*, 'image')
>
> //element(*, app:Asset)[jcr:contains(jcr:content/metadata/@format,
> ‘image’)] in sql2 would look like select [jcr:path] from [app:Asset] where
> contains(jcr:content/metadata/format, 'image')
>
> Basically, nodeScopeIndex does a fulltext search on the whole selected node
> (that is the indexed property is indexed as if the node has the value being
> indexed). Otoh, analyzed would do fulltext search on the property being
> indexed itself.
>
> All that said, could you please open a doc issue to improve the language
> and add sql2 examples.
>
> --Vikas
> (sent from mobile)
>


Re: Lucene Index property Definitions

2019-11-28 Thread jorgeeflorez .
Thank you Vikas for your reply. I am searching using SQL-2  to create
queries, those examples don't look familiar to me. When I execute queries
here <http://oakutils.appspot.com/generate/index>, nodeScopeIndex is not
used so far.  Maybe if I dig into that syntax I will see the difference.

Jorge

El jue., 28 nov. 2019 a las 13:30, Vikas Saurabh ()
escribió:

> On Thu, 28 Nov, 2019, 23:54 jorgeeflorez ., 
> wrote:
>
> > from the reference
> <
>
> https://jackrabbit.apache.org/oak/docs/query/lucene.html#property-definitions
> >,
> it is not clear to me the difference between the fields analyzed,
> nodeScopeIndex, both says that should be set when using *contains* in
> queries. But it is not clear the difference or the specific situation, I
> think. Any additional reference or explanation is appreciated.
>
> The details of each field have examples to show the difference. Pasting
> from the docs:
> ---
> nodeScopeIndex
> Control whether the value of a property should be part of fulltext
> index. That is, you can do a jcr:contains(., ‘foo’) and it will return
> nodes that have a string property that contains the word foo. Example
>
> //element(*, app:Asset)[jcr:contains(., ‘image’)]
>
> In case of aggregation all properties would be indexed at node level by
> default if the property type is part of includePropertyTypes. However if
> there is an explicit property definition provided then it would only be
> included if nodeScopeIndex is set to true.
>
> analyzed
> Set this to true if the property is used as part of contains. Example
>
> //element(*, app:Asset)[jcr:contains(type, ‘image’)]
> //element(*, app:Asset)[jcr:contains(jcr:content/metadata/@format,
> ‘image’)]
> ---
>
> --Vikas
> (sent from mobile)
>


Lucene Index property Definitions

2019-11-28 Thread jorgeeflorez .
 Hi all,
from the reference
,
it is not clear to me the difference between the fields analyzed,
nodeScopeIndex, both says that should be set when using *contains* in
queries. But it is not clear the difference or the specific situation, I
think. Any additional reference or explanation is appreciated.

Best Regards,

Jorge


Solr Index

2019-10-04 Thread jorgeeflorez .
Hi all,
I have been reading/learning about Solr for some implementation I need to
do (basically, index information contained in a jcr repository). I have
also read about how Solr is used by Oak
 and I am a bit
confused. I would like to understand better how data is indexed...

What I get is that node data is indexed in a Collection name oak. Does this
mean that one collection in Solr will contain all data from all
repositories that use the Solr index?

Thanks.

Jorge


Re: Repository data encryption

2019-09-30 Thread jorgeeflorez .
Hi Marcel, thank you for your reply.

I was able to extract text correctly for those encrypted files: I created a
class that extends from AbstractParser, I specified this parser in the tika
config for the index. Inside that class, I use an instance of
AutoDetectParser that will be charged to return the supported types and to
extract text from the decrypted file (decryption performed in the parse
method).

The lucene index files will contain data that allows someone with access to
> the files on disk to reconstruct the text in the document.
>

You are right, they wanted to preserve search functionality and also wanted
that files were stored encrypted so anyone with access, even if they
managed to extract the file from DB, it would be useless. Anyway, the have
been warned :)

I agree, encryption at rest would be best. But I have heard is expensive...

Thanks for your help.

Regards.

Jorge

El lun., 30 sept. 2019 a las 5:52, Marcel Reutegger
() escribió:

> Hi,
>
> On 27.09.19, 14:39, "jorgeeflorez ." 
> wrote:
> > thank you for your reply. Yes, it seems pretty much impossible to do
> > that. Now I am trying something "simpler": I want to encrypt a file
> > before adding it to a node. I am able to do that, but I realize I will
> > lose text extraction because what FulltextBinaryTextExtractor will
> > receive is the encrypted file. Any ideas how can I manage to decrypt
> > before passing the file to tika?
>
> Well, even if you manage to do this, you will have another problem. The
> lucene index files will contain data that allows someone with access to
> the files on disk to reconstruct the text in the document. I don't think
> there's a solution to your problem. I would still suggest the system should
> rely on encryption at rest mechanisms as supported by MongoDB.
>
> Regards
>  Marcel
>
>


Re: Repository data encryption

2019-09-27 Thread jorgeeflorez .
Hi Marcel,
thank you for your reply. Yes, it seems pretty much impossible to do that.
Now I am trying something "simpler": I want to encrypt a file before adding
it to a node. I am able to do that, but I realize I will lose text
extraction because what FulltextBinaryTextExtractor will receive is the
encrypted file. Any ideas how can I manage to decrypt before passing the
file to tika?

Thanks.

Best Regards.

Jorge

El jue., 26 sept. 2019 a las 8:56, Marcel Reutegger
() escribió:

> Hi,
>
> No, this is not possible with Oak. You'd have to rely on MongoDB encryption
> at rest.
>
> Regards
>  Marcel
>
> On 26.09.19, 14:42, "jorgeeflorez ." 
> wrote:
>
> Hi,
> I am sorry if the following questions are vague: is it possible to
> encrypt
> all repository content so data that is stored in MongoDB cannot be
> read? I
> mean, if I don't want to use MongoDB encryption can I store all nodes
> and
> their properties encrypted, will everything still working in
> Jackrabbit and
> in Oak?
>
> Sorry again if I cannot explain myself better.
>
> Thanks.
>
> Jorge
>
>
>


Repository data encryption

2019-09-26 Thread jorgeeflorez .
Hi,
I am sorry if the following questions are vague: is it possible to encrypt
all repository content so data that is stored in MongoDB cannot be read? I
mean, if I don't want to use MongoDB encryption can I store all nodes and
their properties encrypted, will everything still working in Jackrabbit and
in Oak?

Sorry again if I cannot explain myself better.

Thanks.

Jorge


Re: Lucene Index Extraction

2019-09-05 Thread jorgeeflorez .
Hi Vikas,
I created OAK-8597 <https://issues.apache.org/jira/browse/OAK-8597>. Thank
you for your reply.

Regards.

Jorge

El mié., 4 sept. 2019 a las 16:47, Vikas Saurabh ()
escribió:

> Sounds like a bug to me. Can you please open an issue?
>
> --Vikas
> (sent from mobile)
>
> On Thu, 5 Sep, 2019, 01:23 jorgeeflorez ., 
> wrote:
>
> > Hello,
> >
> > I am trying to extract a Lucene index from a Repository stored in
> MongoDB.
> > I tried to use oak-run (1.12.0) as depicted in
> > https://jackrabbit.apache.org/oak/docs/query/lucene.html#luke (I
> > downloaded
> > the jar) but no luck so far.
> >
> > This is what I get when I try to get index info:
> >
> > C:\Users\Jorge Eduardo\Desktop>java -jar oak-run-1.12.0.jar console
> > --read-write mongodb://localhost:37017/rRepo4
> > Apache Jackrabbit Oak 1.12.0
> > Jackrabbit Oak Shell (Apache Jackrabbit Oak 1.12.0, JVM: 1.8.0_191)
> > Type ':help' or ':h' for help.
> >
> >
> ---
> > /> lc info /oak:index/LuceneFullText
> > ERROR groovy.lang.GroovyRuntimeException:
> > Could not find matching constructor for:
> >
> >
> org.apache.jackrabbit.oak.plugins.index.lucene.directory.OakDirectory(org.apache.jackrabbit.oak.spi.state.ReadOnlyBuilder,
> > org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition,
> > java.lang.Boolean)
> > at
> > org.apache.jackrabbit.oak.console.commands.LuceneCommand.getDirectory
> > (LuceneCommand.groovy:132)
> > at
> > org.apache.jackrabbit.oak.console.commands.LuceneCommand$_closure1.doCall
> > (LuceneCommand.groovy:54)
> > at java_lang_Runnable$run.call (Unknown Source)
> > at org.apache.jackrabbit.oak.console.GroovyConsole$OakSh.run
> > (GroovyConsole.groovy:265)
> > at org.apache.jackrabbit.oak.console.GroovyConsole.run
> > (GroovyConsole.groovy:74)
> > at org.apache.jackrabbit.oak.console.Console.main
> (Console.java:74)
> > at org.apache.jackrabbit.oak.run.ConsoleCommand.execute
> > (ConsoleCommand.java:27)
> > at org.apache.jackrabbit.oak.run.Main.main (Main.java:49)
> > />
> >
> > Similiar error if I try to dump the index:
> > C:\Users\Jorge Eduardo\Desktop>java -jar oak-run-1.12.0.jar console
> > mongodb://localhost:37017/rRepo4
> > Apache Jackrabbit Oak 1.12.0
> > Repository connected in read-only mode. Use '--read-write' for write
> > operations
> > Jackrabbit Oak Shell (Apache Jackrabbit Oak 1.12.0, JVM: 1.8.0_191)
> > Type ':help' or ':h' for help.
> >
> >
> ---
> > /> lc dump "C:\Users\Jorge Eduardo\Desktop\lc" /oak:index/LuceneFullText
> > ERROR groovy.lang.GroovyRuntimeException:
> > Could not find matching constructor for:
> >
> >
> org.apache.jackrabbit.oak.plugins.index.lucene.directory.OakDirectory(org.apache.jackrabbit.oak.spi.state.ReadOnlyBuilder,
> > org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition,
> > java.lang.Boolean)
> > at
> > org.apache.jackrabbit.oak.console.commands.LuceneCommand.getDirectory
> > (LuceneCommand.groovy:132)
> > at
> > org.apache.jackrabbit.oak.console.commands.LuceneCommand$_closure2.doCall
> > (LuceneCommand.groovy:77)
> > at java_lang_Runnable$run.call (Unknown Source)
> > at org.apache.jackrabbit.oak.console.GroovyConsole$OakSh.run
> > (GroovyConsole.groovy:265)
> > at org.apache.jackrabbit.oak.console.GroovyConsole.run
> > (GroovyConsole.groovy:74)
> > at org.apache.jackrabbit.oak.console.Console.main
> (Console.java:74)
> > at org.apache.jackrabbit.oak.run.ConsoleCommand.execute
> > (ConsoleCommand.java:27)
> > at org.apache.jackrabbit.oak.run.Main.main (Main.java:49)
> >
> > I am pretty certain that I am missing or misusing something, or just
> > ignoring some necessary condition that makes it work.
> >
> > Anyway, any help is greatly appreciated.
> >
> > Regards,
> >
> > Jorge Flórez
> >
>


Lucene Index Extraction

2019-09-04 Thread jorgeeflorez .
Hello,

I am trying to extract a Lucene index from a Repository stored in MongoDB.
I tried to use oak-run (1.12.0) as depicted in
https://jackrabbit.apache.org/oak/docs/query/lucene.html#luke (I downloaded
the jar) but no luck so far.

This is what I get when I try to get index info:

C:\Users\Jorge Eduardo\Desktop>java -jar oak-run-1.12.0.jar console
--read-write mongodb://localhost:37017/rRepo4
Apache Jackrabbit Oak 1.12.0
Jackrabbit Oak Shell (Apache Jackrabbit Oak 1.12.0, JVM: 1.8.0_191)
Type ':help' or ':h' for help.
---
/> lc info /oak:index/LuceneFullText
ERROR groovy.lang.GroovyRuntimeException:
Could not find matching constructor for:
org.apache.jackrabbit.oak.plugins.index.lucene.directory.OakDirectory(org.apache.jackrabbit.oak.spi.state.ReadOnlyBuilder,
org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition,
java.lang.Boolean)
at
org.apache.jackrabbit.oak.console.commands.LuceneCommand.getDirectory
(LuceneCommand.groovy:132)
at
org.apache.jackrabbit.oak.console.commands.LuceneCommand$_closure1.doCall
(LuceneCommand.groovy:54)
at java_lang_Runnable$run.call (Unknown Source)
at org.apache.jackrabbit.oak.console.GroovyConsole$OakSh.run
(GroovyConsole.groovy:265)
at org.apache.jackrabbit.oak.console.GroovyConsole.run
(GroovyConsole.groovy:74)
at org.apache.jackrabbit.oak.console.Console.main (Console.java:74)
at org.apache.jackrabbit.oak.run.ConsoleCommand.execute
(ConsoleCommand.java:27)
at org.apache.jackrabbit.oak.run.Main.main (Main.java:49)
/>

Similiar error if I try to dump the index:
C:\Users\Jorge Eduardo\Desktop>java -jar oak-run-1.12.0.jar console
mongodb://localhost:37017/rRepo4
Apache Jackrabbit Oak 1.12.0
Repository connected in read-only mode. Use '--read-write' for write
operations
Jackrabbit Oak Shell (Apache Jackrabbit Oak 1.12.0, JVM: 1.8.0_191)
Type ':help' or ':h' for help.
---
/> lc dump "C:\Users\Jorge Eduardo\Desktop\lc" /oak:index/LuceneFullText
ERROR groovy.lang.GroovyRuntimeException:
Could not find matching constructor for:
org.apache.jackrabbit.oak.plugins.index.lucene.directory.OakDirectory(org.apache.jackrabbit.oak.spi.state.ReadOnlyBuilder,
org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition,
java.lang.Boolean)
at
org.apache.jackrabbit.oak.console.commands.LuceneCommand.getDirectory
(LuceneCommand.groovy:132)
at
org.apache.jackrabbit.oak.console.commands.LuceneCommand$_closure2.doCall
(LuceneCommand.groovy:77)
at java_lang_Runnable$run.call (Unknown Source)
at org.apache.jackrabbit.oak.console.GroovyConsole$OakSh.run
(GroovyConsole.groovy:265)
at org.apache.jackrabbit.oak.console.GroovyConsole.run
(GroovyConsole.groovy:74)
at org.apache.jackrabbit.oak.console.Console.main (Console.java:74)
at org.apache.jackrabbit.oak.run.ConsoleCommand.execute
(ConsoleCommand.java:27)
at org.apache.jackrabbit.oak.run.Main.main (Main.java:49)

I am pretty certain that I am missing or misusing something, or just
ignoring some necessary condition that makes it work.

Anyway, any help is greatly appreciated.

Regards,

Jorge Flórez


Re: About text extraction for index

2019-08-23 Thread jorgeeflorez .
Hi,

I increased the maximum time (I set 300) for the text extraction and tested
it using a pdf file with many pages. I get the timeout in the log in the
expected time:
2019-08-23 09:02:38,380 DEBUG
[org.apache.jackrabbit.oak.plugins.index.search.spi.binary.FulltextBinaryTextExtractor]
(async-index-update-async) Extracting
/repo1/Carpeta1/File1/jcr:content@jcr:data,
4332681 bytes
2019-08-23 09:07:38,389 WARN
 
[org.apache.jackrabbit.oak.plugins.index.search.spi.binary.FulltextBinaryTextExtractor]
(async-index-update-async) [/oak:index/LuceneFullText] Failed to extract
text from a binary property due to timeout:
/repo1/Carpeta1/File1/jcr:content@jcr:data.

but I am having a problem: the thread that processes the pdf file keeps
running, creating images and performing OCR. Is this supposed to happen?
Should I check for something in that thread? (BTW, my application server is
wildfly 10, I don't know if that affects).

I will try again with oak.extraction.inCallerThread=true to see what
happens.

Regards,

Jorge Flórez

El vie., 23 ago. 2019 a las 7:13, jorgeeflorez . (<
jorgeeduardoflo...@gmail.com>) escribió:

> Hi Vikas,
>
> thank you for your reply. I will try to change those parameters and see
> what happens.
> To answer one of my questions, I found that text is extracted only from
> pdf if I add application/pdf to DefaultParser in the index
> Tika config file.
>
> Regards.
> Jorge Flórez
>
>
> El jue., 22 ago. 2019 a las 12:43, Vikas Saurabh ()
> escribió:
>
>> Hi,
>>
>> > Is it possible to change the maximum time for that text extraction
>>
>> You should be able to configure timeout by setting
>> -Doak.extraction.timeoutSeconds=120
>> [0] on ivm command line.
>>
>> Alternatively, you could also disable running in different thread by
>> setting -Doak.extraction.inCallerThread=true
>>
>> Hope that helps.
>>
>> [0]:
>>
>> http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ExtractedTextCache.java?view=markup=1814745#l61
>>
>> --Vikas
>> (sent from mobile)
>>
>


Re: About text extraction for index

2019-08-23 Thread jorgeeflorez .
Hi Vikas,

thank you for your reply. I will try to change those parameters and see
what happens.
To answer one of my questions, I found that text is extracted only from pdf
if I add application/pdf to DefaultParser in the index Tika
config file.

Regards.
Jorge Flórez


El jue., 22 ago. 2019 a las 12:43, Vikas Saurabh ()
escribió:

> Hi,
>
> > Is it possible to change the maximum time for that text extraction
>
> You should be able to configure timeout by setting
> -Doak.extraction.timeoutSeconds=120
> [0] on ivm command line.
>
> Alternatively, you could also disable running in different thread by
> setting -Doak.extraction.inCallerThread=true
>
> Hope that helps.
>
> [0]:
>
> http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ExtractedTextCache.java?view=markup=1814745#l61
>
> --Vikas
> (sent from mobile)
>


About text extraction for index

2019-08-22 Thread jorgeeflorez .
Hi all,

I have a question regarding text extraction when nt:file nodes are indexed
(I am using oak 1.12.0 and tika-parsers 1.20).
Is the text contained in a pdf file I attach to a file node extracted and
included in the index by default (when using the default tika config)? Or
should I explicitly include the mime type in the tika config file when I
create the index?

When I try to extract text from a pdf file that has none (generating an
image per page and applying OCR) in a custom tika parser I am getting this
warning.

WARN
 
[org.apache.jackrabbit.oak.plugins.index.search.spi.binary.FulltextBinaryTextExtractor]
(async-index-update-async) [/oak:index/LuceneFullText] Failed to extract
text from a binary property due to timeout

Is it possible to change the maximum time for that text extraction? or
should I use a different approach since image generation and OCR is time
consuming?

Thanks.

Regards,

Jorge Flórez


Re: Node name limit

2019-06-13 Thread jorgeeflorez .
)
at
org.apache.jackrabbit.oak.plugins.document.DocumentNodeState.asOperation(DocumentNodeState.java:417)
at
org.apache.jackrabbit.oak.plugins.document.CommitBuilder.addNode(CommitBuilder.java:125)
at
org.apache.jackrabbit.oak.plugins.document.CommitBuilder.addNode(CommitBuilder.java:107)
at
org.apache.jackrabbit.oak.plugins.document.CommitDiff.childNodeAdded(CommitDiff.java:92)
at
org.apache.jackrabbit.oak.plugins.memory.ModifiedNodeState.compareAgainstBaseState(ModifiedNodeState.java:412)
at
org.apache.jackrabbit.oak.plugins.document.CommitDiff.childNodeChanged(CommitDiff.java:107)
at
org.apache.jackrabbit.oak.plugins.memory.ModifiedNodeState.compareAgainstBaseState(ModifiedNodeState.java:416)
at
org.apache.jackrabbit.oak.plugins.document.CommitDiff.childNodeChanged(CommitDiff.java:107)
at
org.apache.jackrabbit.oak.plugins.memory.ModifiedNodeState.compareAgainstBaseState(ModifiedNodeState.java:416)
at
org.apache.jackrabbit.oak.plugins.document.ModifiedDocumentNodeState.compareAgainstBaseState(ModifiedDocumentNodeState.java:135)
at
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch$1.with(DocumentNodeStoreBranch.java:286)
at
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.newTrunkCommit(DocumentNodeStore.java:2702)
at
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.newCommit(DocumentNodeStore.java:871)
at
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch.persist(DocumentNodeStoreBranch.java:310)
at
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch.persist(DocumentNodeStoreBranch.java:282)
at
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch.access$500(DocumentNodeStoreBranch.java:56)
at
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch$InMemory.merge(DocumentNodeStoreBranch.java:546)
... 129 more


So, I see at this level that validation of 150 characters in Utils.java


I also got an exception in another test (extreme test, using a name of 1024
characters), this time related with MongoDB:

Caused by: javax.jcr.RepositoryException: OakOak0001: Command failed with
error 17280 (KeyTooLong): 'WiredTigerIndex::insert: key too large to index,
failing  1040 { :
"2:/407227280013734959708528118318952093084064569207429726193343548637460808460268104223906581254865802290258935504819974310975061749182107737738316234..."
}' on server localhost:37017. The full response is { "ok" : 0.0, "errmsg" :
"WiredTigerIndex::insert: key too large to index, failing  1040 { :
\"2:/407227280013734959708528118318952093084064569207429726193343548637460808460268104223906581254865802290258935504819974310975061749182107737738316234...\"
}", "code" : 17280, "codeName" : "KeyTooLong" }
[2:/4072272800137349597085281183189520930840645692074297261933435486374608084602681042239065812548658022902589355048199743109750617491821077377383162345520570006177166915460812955245780835424380018294032431729258142722707474814755158776843396532843109944058278/696756302458916847942831421688681983633928245650938885335886751177646874699388686412902753656937419332487096701690256632426299897454090986766522283931190852698316675068057518864462151023317412375687827844129230913349648972359203067139533086438054647309709175476674512716802103452817506694285179991498529686368088114276067069349131715925096423481836269442706743894060583262612436836407348589946765233888323123834742024652798286261591807840425694525652086967593960224497751587406005955043274304396073751436816433902743033088573922712263793857826312330037450203242797899319002418661621765033904434479296032023822428528778353266570030109332699241846277342343402918229512452280498030223077106797761792280651142490174117650115291138385415246795728520858854881718943179867246]
at
org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:250)
at
org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:213)
at
org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.newRepositoryException(SessionDelegate.java:669)
at
org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.save(SessionDelegate.java:495)
at
org.apache.jackrabbit.oak.jcr.session.SessionImpl$8.performVoid(SessionImpl.java:420)
at
org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.performVoid(SessionDelegate.java:273)
at
org.apache.jackrabbit.oak.jcr.session.SessionImpl.save(SessionImpl.java:417)
at
com.macroproyectos.ecm.ContainerManager.persistDataNode(ContainerManager.java:575)
... 118 more

So... from these tests I see that I will have to enforce a maximum node
name length of 150 characters. Using this restriction I created 8 nested
folders, each one with name of 150 characters and one file node with name
of 150 characters at the last level with no problems...

Thanks.

Jorge

El jue., 13 jun. 2019 a las 9:13, Julian Reschke ()
escribió:

> On 13.06.2019 15:50, jorgeeflorez . wrote

Node name limit

2019-06-13 Thread jorgeeflorez .
Hi all,

I have a question regarding the maximum length of a node name.
http://jackrabbit.apache.org/oak/docs/differences.html says that a node
name has a limit of 150 bytes. I checked
https://issues.apache.org/jira/browse/OAK-2644 and it seems this is because
some restriction on MongoDB. I tried to insert a node with a very long name
(256 characters) just to see what exception or error I would get, and it
seems that the node was inserted without problems (I am using Jackrabbit
2.18.1, Oak 1.12.0 and MongoDB 3.6.12). My Question is: does this
restriction still apply? if it does, should I expect some exception?


The following is a JSON I created with the node info.
{
"node":
"3169315059722962614227456320175199059913853009255219860458266103394194633118319270278710201318144527686273071548870516328353267979499815331437027907925925242122523054514744481172152272453111343480098098090442931957458936922661074583889069489740370502451106",
"path":
"/zzz3/3169315059722962614227456320175199059913853009255219860458266103394194633118319270278710201318144527686273071548870516328353267979499815331437027907925925242122523054514744481172152272453111343480098098090442931957458936922661074583889069489740370502451106",
"mixins": [
"mix:lockable",
"mix:lastModified",
"mix:referenceable",
"rep:AccessControllable",
"mix:versionable",
"mix:withHash"
],
"children": [{
"node": "jcr:content",
"path":
"/zzz3/3169315059722962614227456320175199059913853009255219860458266103394194633118319270278710201318144527686273071548870516328353267979499815331437027907925925242122523054514744481172152272453111343480098098090442931957458936922661074583889069489740370502451106/jcr:content",
"mixins": [],
"children": [],
"properties": [
"jcr:lastModifiedBy = admin",
"jcr:mimeType = image/png",
"jcr:data = [Contenido de archivo]",
"jcr:lastModified = 2019-06-13T08:24:16.510-05:00",
"jcr:primaryType = nt:resource",
"jcr:uuid = 37ff5d03-5183-4d07-b4c4-e83a69347ffc"
]
}],
"properties": [
"fileName = eurotext.png",
"jcr:created = 2019-06-13T08:24:16.464-05:00",
"jcr:lastModifiedBy = admin",
"jcr:createdBy = admin",
"jcr:uuid = aecb03ed-6cd8-4f2a-b663-acd9b4b5eb92",
"jcr:predecessors = ",
"jcr:versionHistory = 547c0b27-2ecb-44f8-baac-e8c12145cbb0",
"jcr:isCheckedOut = false",
"jcr:mixinTypes =
mix:lockable,mix:lastModified,mix:referenceable,rep:AccessControllable,mix:versionable,mix:withHash",
"jcr:lastModified = 2019-06-13T08:24:16.475-05:00",
"jcr:primaryType = tipo_archivo",
"hash = 79d8ffe8ff8eb95b5a4a9ef4bf7413e29fdbacee96ea6e69d473363be465f64d",
"jcr:baseVersion = 650df972-7f66-49ea-94c7-92cd94294d28"
]
}

Thanks,

Best regards.

Jorge


Re: ldap user permission

2019-06-05 Thread jorgeeflorez .
Hi Angela,
thank you for your reply.
I think it is awesome all the things you guys made with Oak.

Unfortunately we are not using OSGi. Anyway, I will make it work as you say
and see what happens.

Thanks again.

Jorge

El lun., 3 jun. 2019 a las 1:24, Angela Schreiber
() escribió:

> hi jorge
>
> that should be easy to do by configuring your system to trigger the
> 'AccessControlAction' upon user/group creation. this action is part of the
> default action provider implementation and you can configure the desired
> privileges granted for users and group, respectively.
>
> in the OSGi console the provider is labeled "Apache Jackrabbit Oak
> AuthorizableActionProvider" and the corresponding configuration option
> "Configure AccessControlAction: User Privileges".
>
> the documentation for the actions is located at
> http://jackrabbit.apache.org/oak/docs/security/user/authorizableaction.html
>
> there should be tests available in oak-core that illustrate the behavior
> if you wanted to see it in action.
>
> hope that helps
> angela
>
> 
> From: jorgeeflorez . 
> Sent: Friday, May 31, 2019 2:34 PM
> To: oak-dev@jackrabbit.apache.org
> Subject: ldap user permission
>
> Hello,
>
> I am currently implementing user login using a ldap server. So far so good.
> I am able enter to the repositories and when the user that is logging in
> doesn't exist in the repository, it is automatically created.
>
> I am seeing that the created users have no privileges (which makes sense).
> Unfortunately, I am using a property from the authorizable to get the
> modules the user can see in the application. And when a new user logs in,
> he is not able to get its own authorizable and I cannot read the property.
> Is there an "easy" way to assign, to the user that is created
> automatically, jcr:read to it's own authorizable's path?
>
> If there is not I think I will go with the alternative. Just check if he
> has the permission, if not, grant it before getting its own authorizable...
>
> Thanks.
>
> Jorge Eduardo Flórez
>


ldap user permission

2019-05-31 Thread jorgeeflorez .
Hello,

I am currently implementing user login using a ldap server. So far so good.
I am able enter to the repositories and when the user that is logging in
doesn't exist in the repository, it is automatically created.

I am seeing that the created users have no privileges (which makes sense).
Unfortunately, I am using a property from the authorizable to get the
modules the user can see in the application. And when a new user logs in,
he is not able to get its own authorizable and I cannot read the property.
Is there an "easy" way to assign, to the user that is created
automatically, jcr:read to it's own authorizable's path?

If there is not I think I will go with the alternative. Just check if he
has the permission, if not, grant it before getting its own authorizable...

Thanks.

Jorge Eduardo Flórez


Re: Users, groups and permissions

2019-05-24 Thread jorgeeflorez .
Hi Angela,
thank you, you helped me a lot. I will put a breakpoint where you say and I
will check what's going on.

Regards.
Jorge

El vie., 24 may. 2019 a las 8:03, Angela Schreiber
() escribió:

> Hi Jorge
>
> If you are not using the default setup, the general notes should still
> apply... that is:
> What goes into the Subject upon authentication (or comes with the Subject
> in case of pre-authenticated login) is used for the permission evaluation.
> So, in other words: the relevant piece is the set of principals that is
> passed to the PermissionProvider and how the configured permission
> provider(s) (default implemenation or custom, single provider or
> composition of many) evaluate the effective permissions for these
> principals.
>
> If you are interested in the inner workings of Oak, you may start your
> investigation at MutableRoot line 127. There you can see how the
> PermissionProvider is constructed based on the principal set associated
> with the Subject, which in turn has been passed to the Root object upon
> construction in ContentSessionImpl line 105.
>
> How permissions are evaluation in a custom security setup obviously
> depends both on the authentication setup and how the set of principals is
> computed therein and the authorization mechanism i.e. how permissions for
> these principals are collected/weighted/ordered/evaluated.
>
> Hope that helps
> Angela
>
> 
> From: jorgeeflorez . 
> Sent: Friday, May 24, 2019 2:25 PM
> To: oak-dev@jackrabbit.apache.org
> Subject: Re: Users, groups and permissions
>
> Hello Angela,
>
> thank you for taking your time and writing this awesome reply. You saved my
> life :)
> It is clear to me now how it works by default. It seems that we are not
> using the default security setup for Oak. I will have to look into it.
>
> Best regards.
>
> Jorge Flórez
>
> El vie., 24 may. 2019 a las 2:03, Angela Schreiber
> () escribió:
>
> > Hi Jorge
> >
> > The
> https://jackrabbit.apache.org/oak/docs/security/user/groupaction.html
> > are not directly related to permission evaluation. This is just an
> optional
> > add on to perform specific verification or action upon modification of
> the
> > set of members of a given group e.g. write a log message.
> >
> > When it comes to permissions it all boils down to the set of principals
> > contained in the Subject after the Repository login and whether that set
> of
> > principals is granted permission to perform a given read/write action.
> >
> > So, for simplicity let's look at the default setup as present with Oak
> out
> > of the box:
> > - the default authentication will
> >   > verify the passed Credentials object,
> >   > lookup the user associated with the Credentials and get it's
> principal
> >   > resolve the declared and inherited group membership for that user and
> > get the group principals
> >   > update the subject with the complete set of principals both for the
> > user and it's groups
> > - the default authorization will
> >   > look at the permission entries for the set of principals and the
> > target path and all it's ancestors
> >   > verify if a given action is granted (or denied) for any of the user
> > principals or any of the group principals
> >   > if it is neither granted or explicitly denied, permission is not
> > granted
> >   see https://jackrabbit.apache.org/oak/docs/security/permission.html
> and
> >
> >
> https://jackrabbit.apache.org/oak/docs/security/permission/evaluation.html
> > for details and examples.
> >
> > So, back to your initial question:
> > If you take the default security setup of Oak, assign permissions to a
> > group principal  at /test/path and assign your user to that group will
> > result in your user inheriting the permissions of the group. if you
> remove
> > the user from the group again, the subject upon login will no longer be
> > populated with the group principal and therefore the user no longer
> > inherits the permissions granted/denied to that group.
> > similarly, if you remove that permission entry again and persist the
> > change, the test group and all of it's members will no longer get that
> > permission granted/denied (assuming there is no other entry that has the
> > same effect).
> >
> > Kind regards
> > Angela
> >
> > 
> > From: jorgeeflorez . 
> > Sent: Thursday, May 23, 2019 8:03 PM
> > To: oak-dev@jackrabbit.apache.org
> > Subject: Users, groups and permissions
> >

Re: Users, groups and permissions

2019-05-24 Thread jorgeeflorez .
Hello Angela,

thank you for taking your time and writing this awesome reply. You saved my
life :)
It is clear to me now how it works by default. It seems that we are not
using the default security setup for Oak. I will have to look into it.

Best regards.

Jorge Flórez

El vie., 24 may. 2019 a las 2:03, Angela Schreiber
() escribió:

> Hi Jorge
>
> The https://jackrabbit.apache.org/oak/docs/security/user/groupaction.html
> are not directly related to permission evaluation. This is just an optional
> add on to perform specific verification or action upon modification of the
> set of members of a given group e.g. write a log message.
>
> When it comes to permissions it all boils down to the set of principals
> contained in the Subject after the Repository login and whether that set of
> principals is granted permission to perform a given read/write action.
>
> So, for simplicity let's look at the default setup as present with Oak out
> of the box:
> - the default authentication will
>   > verify the passed Credentials object,
>   > lookup the user associated with the Credentials and get it's principal
>   > resolve the declared and inherited group membership for that user and
> get the group principals
>   > update the subject with the complete set of principals both for the
> user and it's groups
> - the default authorization will
>   > look at the permission entries for the set of principals and the
> target path and all it's ancestors
>   > verify if a given action is granted (or denied) for any of the user
> principals or any of the group principals
>   > if it is neither granted or explicitly denied, permission is not
> granted
>   see https://jackrabbit.apache.org/oak/docs/security/permission.html and
>
> https://jackrabbit.apache.org/oak/docs/security/permission/evaluation.html
> for details and examples.
>
> So, back to your initial question:
> If you take the default security setup of Oak, assign permissions to a
> group principal  at /test/path and assign your user to that group will
> result in your user inheriting the permissions of the group. if you remove
> the user from the group again, the subject upon login will no longer be
> populated with the group principal and therefore the user no longer
> inherits the permissions granted/denied to that group.
> similarly, if you remove that permission entry again and persist the
> change, the test group and all of it's members will no longer get that
> permission granted/denied (assuming there is no other entry that has the
> same effect).
>
> Kind regards
> Angela
>
> 
> From: jorgeeflorez . 
> Sent: Thursday, May 23, 2019 8:03 PM
> To: oak-dev@jackrabbit.apache.org
> Subject: Users, groups and permissions
>
> Hello,
>
> I have been reading regarding Jackrabbit and Oak security and I think I
> understand. but I would like to confirm before implementing something...
> When I create a group and assign a permission (e.g. rep:write) to that
> group over a node path.
> If I assign an user to that group then the user will have the permission
> that I gave to that group over that node?
> If I remove that user from the group the permission will be removed?
>
> From what I understand from here
> https://jackrabbit.apache.org/oak/docs/security/user/groupaction.html that
> will not happen, and I will have to make it happen, am I right?
>
> Thanks.
>


Users, groups and permissions

2019-05-23 Thread jorgeeflorez .
Hello,

I have been reading regarding Jackrabbit and Oak security and I think I
understand. but I would like to confirm before implementing something...
When I create a group and assign a permission (e.g. rep:write) to that
group over a node path.
If I assign an user to that group then the user will have the permission
that I gave to that group over that node?
If I remove that user from the group the permission will be removed?

>From what I understand from here
https://jackrabbit.apache.org/oak/docs/security/user/groupaction.html that
will not happen, and I will have to make it happen, am I right?

Thanks.


Creating repository

2019-05-22 Thread jorgeeflorez .
Hello,

I am switching the web application I am working on from oak 1.5.14 to
1.12.0, I had this code:
   oak = new Oak(docStore);
   LuceneIndexProvider provider = new LuceneIndexProvider();

   Jcr jcr = new Jcr(oak)
   .with(new LuceneIndexEditorProvider())
   .with((QueryIndexProvider) provider)
   .with((Observer) provider)
   .withAsyncIndexing();

And now my code look like this:
   oak = new Oak(docStore);
   LuceneIndexProvider provider = new LuceneIndexProvider();

   Jcr jcr = new Jcr(oak)
   .with(new LuceneIndexEditorProvider())
   .with((QueryIndexProvider) provider)
   .with((Observer) provider)
   .withAsyncIndexing("ecm_index_async", 5);

All this "with" invocations are still necessary, right? even the
"withAsyncIndexing"?

Thanks.

Best regards.

Jorge


Re: Retrieving permissions for user

2019-04-25 Thread jorgeeflorez
Hi Julian,
thank you. Some days ago, I proposed changing to a more recent version.
Hopefully, they will approve it...

Best Regards,
Jorge
El vie., 26 de abr. de 2019 12:02 a. m., Julian Reschke <
julian.resc...@gmx.de> escribió:

> On 25.04.2019 16:39, jorgeeflorez wrote:
> > Hello all,
> >
> > I am giving maintenance to an application that uses Jackrabbit and Oak
> > (1.5.14). (...)
>
> FWIW, that's an unstable release. Don't use in production. See
> <http://jackrabbit.apache.org/jcr/downloads.html>.
>
> Best regards, Julian
>


Re: Retrieving permissions for user

2019-04-25 Thread jorgeeflorez
Hi Angela,
thank you for your reply, I will try as you say. Thanks again.

Jorge Eduardo Flórez

El jue., 25 abr. 2019 a las 9:53, Angela Schreiber
() escribió:

> Hi Jorge
>
> The code you are describing relies on an implementation detail and you are
> right that it only works for administrative sessions. The reason for this
> is that using a different user to read from the permission store would
> essentially leak information that may not be accessible to that session.
>
> Also you have to keep in mind that this code only read information for one
> particular authorization model. If you Oak repository would for instance
> use more than one model, you would miss the effect the other would have.
>
> What you are probably looking for is
>
> AccessControlPolicy[] getEffectivePolicies(Set principals)
>
> this one would show the effective policies for a given set of principal
> taking the access rights of the editing session into account. so, if a
> given Session would not be allowed to read the access control setup at a
> given node or for a given principal, this information will not leak.
>
> Hope that helps
> Angela
>
>
>
> 
> From: jorgeeflorez 
> Sent: Thursday, April 25, 2019 4:39 PM
> To: oak-dev@jackrabbit.apache.org
> Subject: Retrieving permissions for user
>
> Hello all,
>
> I am giving maintenance to an application that uses Jackrabbit and Oak
> (1.5.14). In that software someone wrote the following code to get all
> permissions given to an user:
>
> List authPaths = new ArrayList<>();
> permissionParent = "/jcr:system/rep:permissionStore/default/" +
> principalName;
>
> Node parent = session.getNode(permissionParent);
>
> NodeIterator iter = parent.getNodes();
> String path;
>
> while (iter.hasNext()) {
> Node current = iter.nextNode();
>
> Property prop = current.getProperty("rep:accessControlledPath");
>
> authPaths.add(prop.getString() );
> }
>
> this way in the user interface all paths are shown and when one is
> selected, the privileges assigned can be shown.
>
> The problem with this code, is that only works when it is executed by the
> "admin" user (if I understood well, it is because the restricted access of
> "/jcr:system/rep:permissionStore" as explained here
> <https://jackrabbit.apache.org/oak/docs/security/permission/default.html
> >).
> I need to display all paths with privileges assigned to an user, and I
> think this is not possible using the methods described here
> <
> https://jackrabbit.apache.org/oak/docs/security/accesscontrol/editing.html
> >,
> because they receive a path as argument (maybe I am wrong). Is there a way
> to achieve this (and that works for admin and all users with proper
> permissions)?
>
> Thanks in advance.
> Best Regards.
>
> Jorge Eduardo Flórez
>


Retrieving permissions for user

2019-04-25 Thread jorgeeflorez
Hello all,

I am giving maintenance to an application that uses Jackrabbit and Oak
(1.5.14). In that software someone wrote the following code to get all
permissions given to an user:

List authPaths = new ArrayList<>();
permissionParent = "/jcr:system/rep:permissionStore/default/" +
principalName;

Node parent = session.getNode(permissionParent);

NodeIterator iter = parent.getNodes();
String path;

while (iter.hasNext()) {
Node current = iter.nextNode();

Property prop = current.getProperty("rep:accessControlledPath");

authPaths.add(prop.getString() );
}

this way in the user interface all paths are shown and when one is
selected, the privileges assigned can be shown.

The problem with this code, is that only works when it is executed by the
"admin" user (if I understood well, it is because the restricted access of
"/jcr:system/rep:permissionStore" as explained here
).
I need to display all paths with privileges assigned to an user, and I
think this is not possible using the methods described here
,
because they receive a path as argument (maybe I am wrong). Is there a way
to achieve this (and that works for admin and all users with proper
permissions)?

Thanks in advance.
Best Regards.

Jorge Eduardo Flórez