Skip to content

Supply parsed JSON content through the importer interface#19

Open
Alfusainey wants to merge 7379 commits intoapache:trunkfrom
Alfusainey:second-poc
Open

Supply parsed JSON content through the importer interface#19
Alfusainey wants to merge 7379 commits intoapache:trunkfrom
Alfusainey:second-poc

Conversation

@Alfusainey
Copy link
Copy Markdown

/cc @dbu
/cc @anchela

jukka and others added 30 commits January 23, 2013 13:15
…WebDav

Restore binary compatibility.

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/trunk@1438158 13f79535-47bb-0310-9956-ffa450edef68
The release checker script now lives on dist.apache.org.
Also update the release profile.

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/trunk@1439346 13f79535-47bb-0310-9956-ffa450edef68
…WebDav

Stick to absolute URIs as the default.

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/trunk@1439797 13f79535-47bb-0310-9956-ffa450edef68
… has the invalid child node entry, not the missing child node

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/trunk@1440059 13f79535-47bb-0310-9956-ffa450edef68
Mark the failing test as a known issue.

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/trunk@1440336 13f79535-47bb-0310-9956-ffa450edef68
Patch by Randall Hauch.

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/trunk@1440456 13f79535-47bb-0310-9956-ffa450edef68
… in the repository that should be indexed are present in the index. because this check will take more time and resources it must be explicitly enabled using a system property.

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/trunk@1440908 13f79535-47bb-0310-9956-ffa450edef68
…on storage via the internal version management API

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/trunk@1440917 13f79535-47bb-0310-9956-ffa450edef68
…itional check overall performance has actually increased it is not necessary to be able to skip the reverse check anymore.

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/trunk@1442061 13f79535-47bb-0310-9956-ffa450edef68
… version history in order that repositories can prevent such actions as a matter of repository-wide policy

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/trunk@1443652 13f79535-47bb-0310-9956-ffa450edef68
…ermission for repository wide version removal policy. need to rethink this.

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/trunk@1443943 13f79535-47bb-0310-9956-ffa450edef68
tripodsan and others added 20 commits February 11, 2014 19:28
AbstractAccessControlEntryImpl: add proper implementation for getRestrictions

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/trunk@1569523 13f79535-47bb-0310-9956-ffa450edef68
…ned from VersionHistory.getAllVersions().

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/trunk@1576368 13f79535-47bb-0310-9956-ffa450edef68
git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/trunk@1576690 13f79535-47bb-0310-9956-ffa450edef68
…r registering event listeners

Initial version of new API

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/trunk@1577213 13f79535-47bb-0310-9956-ffa450edef68
…r registering event listeners

JackrabbitObservationManager should extend from ObservationManager

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/trunk@1577242 13f79535-47bb-0310-9956-ffa450edef68
Initial implementation

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/trunk@1577244 13f79535-47bb-0310-9956-ffa450edef68
Applying modified patch from Amit Jain
-- Made derby and commons-dbcp as optional
-- Removed dependency on commons-collection as it is not required

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/trunk@1577422 13f79535-47bb-0310-9956-ffa450edef68
Added an overloaded method which takes Properties instance

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/trunk@1577475 13f79535-47bb-0310-9956-ffa450edef68
As CachingDataStore invokes init directly its not possible to use the other init method. Added another way where clients can provide the required properties while creating S3DataStore

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/trunk@1577481 13f79535-47bb-0310-9956-ffa450edef68
git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/trunk@1577526 13f79535-47bb-0310-9956-ffa450edef68
… registering event listeners

 - updated OSGi package versions



git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/trunk@1577545 13f79535-47bb-0310-9956-ffa450edef68
…figuration file

Applying patch from Shashank. Thanks!



git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/trunk@1578774 13f79535-47bb-0310-9956-ffa450edef68
@Alfusainey
Copy link
Copy Markdown
Author

This implementation parses serialized content in jsop format to nodes and properties. The content tree is then serialized to xml and the resulting xml containing all the nodes and properties gets written to the repository using session.ImportXml(,,,). Therefore, adding nodes(entire subtree of nodes) to the repository is not written using regular write methods but rather using session.ImportXml.
The remoting server, as far as adding nodes are concern, uses the importer regardless of whether the content is protected or not. The reason for choosing this approach is that a node that might not be protected can have protected properties. Thus even though the node itself can be written using API write methods, its protected properties cannot. For this reason, i do not want to use API write methods to write the node itself and to use importXml to write its protected properties- resulting in a clumsy code. This is the reason why i pack the whole content in a tree, serialize the tree to xml and write the resulting xml data using session.ImportXml.

If in turn the xml importer detects that the content its trying to import is not protected, then it will use the API to directly write the content and if not, it will ask its p-i-import handlers to handle any content it detects as being protected.

/cc @anchela
/cc @dbu
/cc @tripodsan

@anchela
Copy link
Copy Markdown
Contributor

anchela commented May 26, 2014

hi alfusainey

i just had a closer look at your lastest patch.
while i definitely see that your current approach makes things easy from a developer
point of view, it somehow defeats the purpose of having json-based remoting if
the complete json string is finally just converted to xml. that's the biggest concern
that i currently have with your approach.

apart from that, just a kind reminder with respect to the diffs: i would be really glad
if you could make sure that your patches don't contain modifications unrelated to
your work.. that also applies for the import statements.

kind regards
angela

From: Alfusainey <notifications@github.commailto:notifications@github.com>
Reply-To: apache/jackrabbit <reply@reply.github.commailto:reply@reply.github.com>
Date: Sunday 25 May 2014 02:36
To: apache/jackrabbit <jackrabbit@noreply.github.commailto:jackrabbit@noreply.github.com>
Cc: anchela <angela@apache.orgmailto:angela@apache.org>
Subject: Re: [jackrabbit] XML content import for remoting server (#19)

Reply to this email directly or view it on GitHubhttps://github.com//pull/19#issuecomment-44108291.

@dbu
Copy link
Copy Markdown

dbu commented May 26, 2014

@Alfusainey while i see the benefit of having less redundant code, i think the additional serialize to xml and then in importXml deserialize again is a severe performance hit. can't you just use the same deserialized objects that represent the information and feed them into the same code?

another thing: to get the acl import working, i would not go about too heavy refactorings of jackrabbit. it will be much more difficult to convince people to accept a severe refactoring with all its potential of bugs or performance penalties over just handling acl nodes with a special handler, with almost no impact on the operations that where already supported.

this decision is up to @anchela and other jackrabbit maintainers but i guess they will be more at ease with less invasive changes. once you got your primary goal through, you can still look at jackrabbit and also oak and see if you want to propose further refactoring. but lets first focus on the primary goal of remoting acl information.

@Alfusainey Alfusainey changed the title XML content import for remoting server Supply parsed JSON content through the importer interface Jun 8, 2014
@Alfusainey
Copy link
Copy Markdown
Author

Hi Angela,

thanks for the feedback! please have a look at this latest patch which, instead of converting the json-string to xml, submits the parsed json content to the repository through the Importer interface.

In Session#getImportContentHander, a concrete importer instance was created and supplied to the XML import content handler which uses the importer instance to make calls for writing the parsed xml content.
I am taking this approach, which is to have the parsed json content submitted through the Importer which then knows how to write any type of content. This way i avoid doing any sort of content protection check on the server and instead defer it to the importer.

one change to the json-string: i now encode jcr properties as json objects instead of simple name:value(s) pairs. encoding properties as json objects helps to represent all information about a property i.e name, type, value(s), which is needed by the importer.

I take note of the diff info and seems to be inorder this time around!

cheers,
alfusainey

@tripodsan
Copy link
Copy Markdown
Contributor

Hi Alfusainey,

one change to the json-string: i now encode jcr properties as json objects instead of simple name:value(s) pairs

while I see that using objects for properties is more robust, it defies to purpose of using a simple, human readable format like json. for a machine-to-machine format we can use sysview XML.

I would really try to use name/value pairs as properties. and encode the type either in the value or in the name (the later has the advantage, that you can define types on jcr mv-properties easier). eg

{
"jcr:lastModified@Date": "2014-06-10T14:30Z",
"numbers@Long": []
}

(btw: I'd prefer this discussion on the jackrabbit dev mailing list)

@tripodsan
Copy link
Copy Markdown
Contributor

Hi Alfusainey,

rethinking this, we cannot change the format of the JSON for davex, as other clients also use it.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if importer was not given because the old constructor was used?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you instantiate an importer with the default behaviour in the constructor that has no importer argument?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the goal will be to finally remove the old constructor and have only one constructor- the one with the importer argument. i just did this because current JsonDiffHandler clients uses the first constructor, e.g in JcrRemotingServlet#processDiff, and i don't want to modify that code for this patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.