You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by "Michael Mertins (JIRA)" <ji...@apache.org> on 2009/12/15 14:57:18 UTC
[jira] Created: (CMIS-78) Load Node Types only once
Load Node Types only once
-------------------------
Key: CMIS-78
URL: https://issues.apache.org/jira/browse/CMIS-78
Project: Chemistry
Issue Type: Improvement
Components: jcr
Reporter: Michael Mertins
Attachments: JcrRepository.patch
Implementation of ToDo in getType() and getTypes(). Please look at my implementation of getType() carefully as I'm not sure if the typeId can equal the .getName()
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CMIS-78) Load JCR Node Types only once
Posted by "Florent Guillaume (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CMIS-78?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Florent Guillaume updated CMIS-78:
----------------------------------
Summary: Load JCR Node Types only once (was: Load Node Types only once)
> Load JCR Node Types only once
> -----------------------------
>
> Key: CMIS-78
> URL: https://issues.apache.org/jira/browse/CMIS-78
> Project: Chemistry
> Issue Type: Improvement
> Components: jcr
> Reporter: Michael Mertins
> Attachments: JcrRepository.patch
>
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> Implementation of ToDo in getType() and getTypes(). Please look at my implementation of getType() carefully as I'm not sure if the typeId can equal the .getName()
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CMIS-78) Load Node Types only once
Posted by "Michael Mertins (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CMIS-78?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Mertins updated CMIS-78:
--------------------------------
Attachment: JcrRepository.patch
> Load Node Types only once
> -------------------------
>
> Key: CMIS-78
> URL: https://issues.apache.org/jira/browse/CMIS-78
> Project: Chemistry
> Issue Type: Improvement
> Components: jcr
> Reporter: Michael Mertins
> Attachments: JcrRepository.patch
>
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> Implementation of ToDo in getType() and getTypes(). Please look at my implementation of getType() carefully as I'm not sure if the typeId can equal the .getName()
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CMIS-78) Load Node Types only once
Posted by "Michael Mertins (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CMIS-78?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Mertins updated CMIS-78:
--------------------------------
Status: Patch Available (was: Open)
This is my patch:
> Load Node Types only once
> -------------------------
>
> Key: CMIS-78
> URL: https://issues.apache.org/jira/browse/CMIS-78
> Project: Chemistry
> Issue Type: Improvement
> Components: jcr
> Reporter: Michael Mertins
> Attachments: JcrRepository.patch
>
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> Implementation of ToDo in getType() and getTypes(). Please look at my implementation of getType() carefully as I'm not sure if the typeId can equal the .getName()
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Issue Comment Edited: (CMIS-78) Load Node Types only once
Posted by "Michael Mertins (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CMIS-78?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12790746#action_12790746 ]
Michael Mertins edited comment on CMIS-78 at 12/15/09 1:58 PM:
---------------------------------------------------------------
This is my patch:
Index: JcrRepository.java
===================================================================
--- JcrRepository.java (revision 890780)
+++ JcrRepository.java (working copy)
@@ -67,7 +67,9 @@
private final String workspace;
private final SimpleCredentials creds;
-
+
+ private NodeTypeIterator nodeTypes = null;
+
public JcrRepository(javax.jcr.Repository repository, String workspace,
SimpleCredentials creds) {
this.repository = repository;
@@ -115,9 +117,23 @@
try {
Session session = repository.login(creds, workspace);
- // TODO fetch the types only once, include other types
- NodeTypeManager ntmgr = session.getWorkspace().getNodeTypeManager();
- NodeType nt = ntmgr.getNodeType(typeId);
+
+ // get matching NodeType either from session or from nodeTypes
+ // iterator
+ NodeType nt = null;
+ if (nodeTypes == null) {
+ NodeTypeManager ntmgr = session.getWorkspace()
+ .getNodeTypeManager();
+ nt = ntmgr.getNodeType(typeId);
+ } else {
+ while (nodeTypes.hasNext()) {
+ // can .getName() ever match typeId?
+ if (nodeTypes.nextNodeType().getName().equals(typeId)) {
+ nt = nodeTypes.nextNodeType();
+ break;
+ }
+ }
+ }
BaseType baseType = BaseType.FOLDER;
if (JcrCmisMap.isBaseTypeDocument(nt.getName())) {
@@ -142,10 +158,13 @@
try {
List<Type> result = new ArrayList<Type>();
-
- Session session = repository.login(creds, workspace);
-
- NodeTypeIterator nodeTypes = session.getWorkspace().getNodeTypeManager().getAllNodeTypes();
+ // fetch types only once
+ if (this.nodeTypes == null) {
+ Session session = repository.login(creds, workspace);
+ this.nodeTypes = session.getWorkspace().getNodeTypeManager()
+ .getAllNodeTypes();
+ }
+
while (nodeTypes.hasNext()) {
NodeType nodeType = nodeTypes.nextNodeType();
if (nodeType.isMixin()) {
was (Author: mmertins):
This is my patch:
> Load Node Types only once
> -------------------------
>
> Key: CMIS-78
> URL: https://issues.apache.org/jira/browse/CMIS-78
> Project: Chemistry
> Issue Type: Improvement
> Components: jcr
> Reporter: Michael Mertins
> Attachments: JcrRepository.patch
>
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> Implementation of ToDo in getType() and getTypes(). Please look at my implementation of getType() carefully as I'm not sure if the typeId can equal the .getName()
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.