View File | Revision Log | Show Annotations | Download File | View Changeset
/hippo/hippo-cms7/jackrabbit-patches/2.6.x/trunk/jackrabbit.patch
Revision: 41415
Committed: Mon Oct 28 16:56:19 2013 UTC (6 years, 9 months ago) by fvlankvelt
File size: 42268 byte(s)
Log Message:
REPO-811: delegate checking of diff to overridable method

File Contents

# Content
1 #
2 # The following patches are to be applied against
3 # Jackrabbit version 2.6.4 available at
4 # <URL:http://svn.apache.org/repos/asf/jackrabbit/tags/2.6.4/>
5 # It is created in the context format using svn diff [file] --diff-cmd diff -x --context
6 # The patchfile below is divided into sections per
7 # functionality/fix/workaround added. Each section contains a header
8 # with Jira issue key with as task to be able to get rid of these patches.
9 # These Jira issues are all subtasks of Jira issue REPO-187.
10 #
11 # Apply this file by running 'patch -c -p0 < jackrabbit.patch'
12 # from the jackrabbit root directory.
13 #
14
15 #
16 # REPO-187: forked Jackrabbit
17 # The following patches are intended to set a hippo-specific
18 # suffix to the version numbers of the produced artifacts.
19 # There are two changes with this patch, first the version
20 # number is changed from 2.6.4 to 2.6.4-h2 and secondly the
21 # maven repository to upload these artifacts to is set to the
22 # Hippo nexus server.
23 #
24 Index: pom.xml
25 ===================================================================
26 *** pom.xml (revision 1464061)
27 --- pom.xml (working copy)
28 ***************
29 *** 27,33 ****
30 <parent>
31 <groupId>org.apache.jackrabbit</groupId>
32 <artifactId>jackrabbit-parent</artifactId>
33 ! <version>2.6.4</version>
34 <relativePath>jackrabbit-parent/pom.xml</relativePath>
35 </parent>
36
37 --- 27,33 ----
38 <parent>
39 <groupId>org.apache.jackrabbit</groupId>
40 <artifactId>jackrabbit-parent</artifactId>
41 ! <version>2.6.4-h2</version>
42 <relativePath>jackrabbit-parent/pom.xml</relativePath>
43 </parent>
44
45 ***************
46 *** 37,61 ****
47
48 <modules>
49 <module>jackrabbit-parent</module>
50 ! <module>jackrabbit-api</module>
51 ! <module>jackrabbit-jcr-commons</module>
52 ! <module>jackrabbit-jcr-tests</module>
53 <module>jackrabbit-core</module>
54 ! <module>jackrabbit-webdav</module>
55 ! <module>jackrabbit-jcr-server</module>
56 ! <module>jackrabbit-jcr-rmi</module>
57 ! <module>jackrabbit-jcr-servlet</module>
58 ! <module>jackrabbit-webapp</module>
59 ! <module>jackrabbit-jca</module>
60 ! <module>jackrabbit-spi</module>
61 <module>jackrabbit-spi-commons</module>
62 ! <module>jackrabbit-jcr2spi</module>
63 ! <module>jackrabbit-spi2jcr</module>
64 ! <module>jackrabbit-spi2dav</module>
65 ! <module>jackrabbit-jcr2dav</module>
66 ! <module>jackrabbit-jcr-client</module>
67 ! <module>jackrabbit-bundle</module>
68 ! <module>jackrabbit-standalone</module>
69 </modules>
70
71 <scm>
72 --- 37,61 ----
73
74 <modules>
75 <module>jackrabbit-parent</module>
76 ! <!--<module>jackrabbit-api</module>-->
77 ! <!--<module>jackrabbit-jcr-commons</module>-->
78 ! <!--<module>jackrabbit-jcr-tests</module>-->
79 <module>jackrabbit-core</module>
80 ! <!--<module>jackrabbit-webdav</module>-->
81 ! <!--<module>jackrabbit-jcr-server</module>-->
82 ! <!--<module>jackrabbit-jcr-rmi</module>-->
83 ! <!--<module>jackrabbit-jcr-servlet</module>-->
84 ! <!--<module>jackrabbit-webapp</module>-->
85 ! <!--<module>jackrabbit-jca</module>-->
86 ! <!--<module>jackrabbit-spi</module>-->
87 <module>jackrabbit-spi-commons</module>
88 ! <!--<module>jackrabbit-jcr2spi</module>-->
89 ! <!--<module>jackrabbit-spi2jcr</module>-->
90 ! <!--<module>jackrabbit-spi2dav</module>-->
91 ! <!--<module>jackrabbit-jcr2dav</module>-->
92 ! <!--<module>jackrabbit-jcr-client</module>-->
93 ! <!--<module>jackrabbit-bundle</module>-->
94 ! <!--<module>jackrabbit-standalone</module>-->
95 </modules>
96
97 <scm>
98
99 Index: jackrabbit-parent/pom.xml
100 ===================================================================
101 *** jackrabbit-parent/pom.xml (revision 1429772)
102 --- jackrabbit-parent/pom.xml (working copy)
103 ***************
104 *** 34,40 ****
105 <groupId>org.apache.jackrabbit</groupId>
106 <artifactId>jackrabbit-parent</artifactId>
107 <name>Jackrabbit Parent POM</name>
108 ! <version>2.6.4</version>
109 <packaging>pom</packaging>
110
111 <issueManagement>
112 --- 34,40 ----
113 <groupId>org.apache.jackrabbit</groupId>
114 <artifactId>jackrabbit-parent</artifactId>
115 <name>Jackrabbit Parent POM</name>
116 ! <version>2.6.4-h2</version>
117 <packaging>pom</packaging>
118
119 <issueManagement>
120 ***************
121 *** 51,56 ****
122 --- 51,63 ----
123 <project.reporting.outputEncoding>${project.build.sourceEncoding}</project.reporting.outputEncoding>
124 </properties>
125
126 + <distributionManagement>
127 + <repository>
128 + <id>hippo-maven2</id>
129 + <url>https://maven.onehippo.com/content/repositories/releases/</url>
130 + </repository>
131 + </distributionManagement>
132 +
133 <url>http://jackrabbit.apache.org/</url>
134 <inceptionYear>2004</inceptionYear>
135 <description>
136 ***************
137 *** 184,189 ****
138 --- 191,208 ----
139 </excludes>
140 </configuration>
141 </plugin>
142 + <plugin>
143 + <groupId>org.apache.maven.plugins</groupId>
144 + <artifactId>maven-source-plugin</artifactId>
145 + <executions>
146 + <execution>
147 + <id>attach-sources</id>
148 + <goals>
149 + <goal>jar</goal>
150 + </goals>
151 + </execution>
152 + </executions>
153 + </plugin>
154 </plugins>
155 <pluginManagement>
156 <!-- JCRSITE-9: Fix versions of key Maven plugins -->
157 Index: jackrabbit-core/pom.xml
158 ===================================================================
159 *** jackrabbit-core/pom.xml (revision 1464061)
160 --- jackrabbit-core/pom.xml (working copy)
161 ***************
162 *** 26,32 ****
163 <parent>
164 <groupId>org.apache.jackrabbit</groupId>
165 <artifactId>jackrabbit-parent</artifactId>
166 ! <version>2.6.4</version>
167 <relativePath>../jackrabbit-parent/pom.xml</relativePath>
168 </parent>
169 <artifactId>jackrabbit-core</artifactId>
170 --- 26,32 ----
171 <parent>
172 <groupId>org.apache.jackrabbit</groupId>
173 <artifactId>jackrabbit-parent</artifactId>
174 ! <version>2.6.4-h2</version>
175 <relativePath>../jackrabbit-parent/pom.xml</relativePath>
176 </parent>
177 <artifactId>jackrabbit-core</artifactId>
178 *** 250,256 ****
179 <dependency>
180 <groupId>org.apache.jackrabbit</groupId>
181 <artifactId>jackrabbit-spi-commons</artifactId>
182 ! <version>2.6.4</version>
183 </dependency>
184 <dependency>
185 <groupId>org.apache.jackrabbit</groupId>
186 --- 250,256 ----
187 <dependency>
188 <groupId>org.apache.jackrabbit</groupId>
189 <artifactId>jackrabbit-spi-commons</artifactId>
190 ! <version>2.6.4-h2</version>
191 </dependency>
192 <dependency>
193 <groupId>org.apache.jackrabbit</groupId>
194 Index: jackrabbit-spi-commons/pom.xml
195 ===================================================================
196 *** jackrabbit-spi-commons/pom.xml (revision 1464061)
197 --- jackrabbit-spi-commons/pom.xml (working copy)
198 ***************
199 *** 26,32 ****
200 <parent>
201 <groupId>org.apache.jackrabbit</groupId>
202 <artifactId>jackrabbit-parent</artifactId>
203 ! <version>2.6.4</version>
204 <relativePath>../jackrabbit-parent/pom.xml</relativePath>
205 </parent>
206 <artifactId>jackrabbit-spi-commons</artifactId>
207 --- 26,32 ----
208 <parent>
209 <groupId>org.apache.jackrabbit</groupId>
210 <artifactId>jackrabbit-parent</artifactId>
211 ! <version>2.6.4-h2</version>
212 <relativePath>../jackrabbit-parent/pom.xml</relativePath>
213 </parent>
214 <artifactId>jackrabbit-spi-commons</artifactId>
215 #
216 # REPO-182: store mixintypes also in persistent store
217 # The following patches are a fix for JCR-2633.
218 # This changes the on disk format (forward and backward compatible) to
219 # also store the jcr:mixinTypes property. By storing these properties,
220 # also the modification count is persisted, which is needed for a check
221 # whether only the mixin types have changes, and the original node was
222 # purged from cache.
223 #
224 Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/NodePropBundle.java
225 ===================================================================
226 *** jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/NodePropBundle.java (revision 1429772)
227 --- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/NodePropBundle.java (working copy)
228 ***************
229 *** 306,312 ****
230 */
231 public void addProperty(PropertyEntry entry) {
232 assert !NameConstants.JCR_PRIMARYTYPE.equals(entry.getName());
233 - assert !NameConstants.JCR_MIXINTYPES.equals(entry.getName());
234 assert !NameConstants.JCR_UUID.equals(entry.getName());
235 properties.put(entry.getName(), entry);
236 }
237 --- 306,311 ----
238 Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java
239 ===================================================================
240 *** jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java (revision 1444080)
241 --- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java (working copy)
242 ***************
243 *** 641,647 ****
244 PropertyId id = (PropertyId) state.getId();
245 // skip redundant primaryType, mixinTypes and uuid properties
246 if (id.getName().equals(JCR_PRIMARYTYPE)
247 - || id.getName().equals(JCR_MIXINTYPES)
248 || id.getName().equals(JCR_UUID)) {
249 continue;
250 }
251 --- 641,646 ----
252 ***************
253 *** 689,695 ****
254 PropertyId id = (PropertyId) state.getId();
255 // skip primaryType pr mixinTypes properties
256 if (id.getName().equals(JCR_PRIMARYTYPE)
257 - || id.getName().equals(JCR_MIXINTYPES)
258 || id.getName().equals(JCR_UUID)) {
259 continue;
260 }
261 --- 688,693 ----
262 #
263 # REPO-190: Non-authorized dispatching of JCR events.
264 # The following patch makes events to be send to clients even though
265 # they are not allowed to read the node for which the event occurs.
266 # This will result in more events being received (albeit in practice
267 # not that many more), but significantly improves speed because the
268 # authorization does not need to be evaluated always.
269 #
270 Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventConsumer.java
271 ===================================================================
272 *** jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventConsumer.java (revision 1429772)
273 --- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventConsumer.java (working copy)
274 ***************
275 *** 303,309 ****
276 * @throws RepositoryException
277 */
278 private boolean canRead(EventState eventState) throws RepositoryException {
279 ! Path targetPath = pathFactory.create(eventState.getParentPath(), eventState.getChildRelPath().getName(), eventState.getChildRelPath().getNormalizedIndex(), true);
280 ! return session.getAccessManager().isGranted(targetPath, Permission.READ);
281 }
282 }
283 --- 303,308 ----
284 * @throws RepositoryException
285 */
286 private boolean canRead(EventState eventState) throws RepositoryException {
287 ! return true;
288 }
289 }
290 #
291 # REPO-191: Parameterized path entries in Jackrabbit
292 # The following patches implement the support for parameterized paths.
293 # - The patch to BatchedItemOperations is a removal of a piece of
294 # code that performs a sanity check in case of sharable nodes. Since we
295 # do not use this, and this check (but the check alone) conflicts with
296 # parameterized (free text) searches, the check is disabled.
297 # - The CargoPathElement then introduces a new kind of path element.
298 # A path normally is contained of path elements, in a simple path
299 # each path element is a name part in a relative path, i.e. /a/b/c
300 # contains name elements a, b and name element c. Other path elements
301 # are things like a identifier elements, such as the root node which is
302 # named /jcr:root, or a parent path element, a current path element,
303 # etcetera. A CargoPathElement indicates that it is both a named
304 # elements (denotesName() returns true) as an identifier element. This
305 # combination does not occur in JackRabbit, such that later on this can
306 # be used to identify the element by. The sole purpose of a
307 # CargoPathElement is to carry additional payload (cargo) that is user-
308 # defined, and otherwise it acts like a normal name element.
309 # - The patch to PathBuilder forces a lookup from the root (which is
310 # done a.o when you look up a node using Session.getNode(String)), to
311 # be resolved using the normal path factory (the one that can be
312 # overridden), rather than a hardcoded entry set at the root node.
313 # - Within the PathFactoryImpl there is one patch that creates
314 # a CargoPathElement when it encounters a '[' in the name. The
315 # pathbuilder would normally have transformed entries like a[2]
316 # into a name element with an additional parameter with value 2, however
317 # you can override the pathbuilder to pass certain other information
318 # a[b] and let this be retained in the name.
319 # - All other patches, including the other patch in PathFactoryImpl are
320 # all just about preserving a CargoPathElement when building one path
321 # from another path.
322 #
323 Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java
324 ===================================================================
325 *** jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java (revision 1429772)
326 --- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java (working copy)
327 ***************
328 *** 522,536 ****
329 throw new RepositoryException(msg);
330 }
331
332 - HierarchyManagerImpl hierMgr = (HierarchyManagerImpl) this.hierMgr;
333 - if (hierMgr.isShareAncestor(target.getNodeId(), destParent.getNodeId())) {
334 - String msg =
335 - safeGetJCRPath(destPath) + ": invalid destination path"
336 - + " (share cycle detected)";
337 - log.debug(msg);
338 - throw new RepositoryException(msg);
339 - }
340 -
341 // 2. check if target state can be removed from old/added to new parent
342
343 checkRemoveNode(target, srcParent.getNodeId(),
344 --- 521,526 ----
345 Index: jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/PathBuilder.java
346 ===================================================================
347 *** jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/PathBuilder.java (revision 1429772)
348 --- jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/PathBuilder.java (working copy)
349 ***************
350 *** 16,21 ****
351 --- 16,22 ----
352 */
353 package org.apache.jackrabbit.spi.commons.name;
354
355 + import javax.jcr.RepositoryException;
356 import org.apache.jackrabbit.spi.Name;
357 import org.apache.jackrabbit.spi.Path;
358 import org.apache.jackrabbit.spi.PathFactory;
359 ***************
360 *** 89,97 ****
361 */
362 public void addRoot() {
363 if (path != null) {
364 ! path = RootPath.ROOT_PATH.resolve(path);
365 } else {
366 ! path = RootPath.ROOT_PATH;
367 }
368 }
369
370 --- 90,98 ----
371 */
372 public void addRoot() {
373 if (path != null) {
374 ! path = ((Path)factory.getRootElement()).resolve(path);
375 } else {
376 ! path = (Path) factory.getRootElement();
377 }
378 }
379
380 ***************
381 *** 172,178 ****
382 * @param index
383 */
384 public void addLast(Name name, int index) {
385 ! path = new NamePath(path, name, index);
386 }
387
388 /**
389 --- 173,183 ----
390 * @param index
391 */
392 public void addLast(Name name, int index) {
393 ! try {
394 ! path = factory.create(path, name, index, false);
395 ! } catch(RepositoryException ex) {
396 ! // because normalize argument to create method is false, will not occur
397 ! }
398 }
399
400 /**
401 Index: jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/PathFactoryImpl.java
402 ===================================================================
403 *** jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/PathFactoryImpl.java (revision 1429772)
404 --- jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/PathFactoryImpl.java (working copy)
405 ***************
406 *** 124,129 ****
407 --- 124,131 ----
408 public Path create(Path.Element element) {
409 if (element.denotesCurrent()) {
410 return CurrentPath.CURRENT_PATH;
411 + } else if (element.denotesIdentifier() && element.denotesName()) {
412 + return new CargoNamePath(null, element.getName(), element.getIdentifier());
413 } else if (element.denotesIdentifier()) {
414 return new IdentifierPath(element.getIdentifier());
415 } else if (element.denotesName()) {
416 ***************
417 *** 146,151 ****
418 --- 148,155 ----
419 for (Path.Element element : elements) {
420 if (element.denotesCurrent()) {
421 path = new CurrentPath(path);
422 + } else if (element.denotesName() && element.denotesIdentifier()) {
423 + path = new CargoNamePath(path, element.getName(), element.getIdentifier());
424 } else if (element.denotesIdentifier()) {
425 if (path != null) {
426 throw new IllegalArgumentException();
427 ***************
428 *** 268,273 ****
429 --- 272,281 ----
430 if (pos1 == -1) {
431 throw new IllegalArgumentException("invalid PathElement literal: " + elementString + " (missing ']')");
432 }
433 + if(elementString.charAt(pos+1)=='[') {
434 + String argument = elementString.substring(pos + 2, pos1);
435 + return new CargoNamePath(null, name, argument);
436 + }
437 try {
438 int index = Integer.valueOf(elementString.substring(pos + 1, pos1));
439 if (index < 1) {
440 Index: jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/AbstractPath.java
441 ===================================================================
442 *** jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/AbstractPath.java (revision 1429772)
443 --- jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/AbstractPath.java (working copy)
444 ***************
445 *** 133,139 ****
446 }
447
448 public final Path resolve(Element element) {
449 ! if (element.denotesName()) {
450 return new NamePath(this, element.getName(), element.getIndex());
451 } else if (element.denotesParent()) {
452 if (isAbsolute() && getDepth() == 0) {
453 --- 133,141 ----
454 }
455
456 public final Path resolve(Element element) {
457 ! if (element.denotesName() && element.denotesIdentifier()) {
458 ! return new CargoNamePath(this, element.getName(), element.getIdentifier());
459 ! } else if (element.denotesName()) {
460 return new NamePath(this, element.getName(), element.getIndex());
461 } else if (element.denotesParent()) {
462 if (isAbsolute() && getDepth() == 0) {
463 ***************
464 *** 164,169 ****
465 --- 166,173 ----
466 return new CurrentPath(this);
467 } else if (relative.denotesParent()) {
468 return new ParentPath(this);
469 + } else if (relative.denotesIdentifier() && relative.denotesName()) {
470 + return new CargoNamePath(this, relative.getName(), relative.getIdentifier());
471 } else if (relative.denotesName()) {
472 return new NamePath(this, relative.getName(), relative.getIndex());
473 } else {
474 Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
475 ===================================================================
476 *** jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java (revision 1429772)
477 --- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java (working copy)
478 ***************
479 *** 255,261 ****
480 * relative path
481 */
482 private NodeId getNodeId(Path p) throws RepositoryException {
483 ! if (p.getLength() == 1 && p.denotesName()) {
484 // check if node entry exists
485 ChildNodeEntry cne = data.getNodeState().getChildNodeEntry(
486 p.getName(), p.getNormalizedIndex());
487 --- 255,261 ----
488 * relative path
489 */
490 private NodeId getNodeId(Path p) throws RepositoryException {
491 ! if (p.getLength() == 1 && p.denotesName() && !p.denotesIdentifier()) {
492 // check if node entry exists
493 ChildNodeEntry cne = data.getNodeState().getChildNodeEntry(
494 p.getName(), p.getNormalizedIndex());
495
496 Index: jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/CargoNamePath.java
497 ===================================================================
498 *** jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/CargoNamePath.java (revision 0)
499 --- jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/CargoNamePath.java (revision 0)
500 ***************
501 *** 0 ****
502 --- 1,175 ----
503 + /*
504 + * Licensed to the Apache Software Foundation (ASF) under one or more
505 + * contributor license agreements. See the NOTICE file distributed with
506 + * this work for additional information regarding copyright ownership.
507 + * The ASF licenses this file to You under the Apache License, Version 2.0
508 + * (the "License"); you may not use this file except in compliance with
509 + * the License. You may obtain a copy of the License at
510 + *
511 + * http://www.apache.org/licenses/LICENSE-2.0
512 + *
513 + * Unless required by applicable law or agreed to in writing, software
514 + * distributed under the License is distributed on an "AS IS" BASIS,
515 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
516 + * See the License for the specific language governing permissions and
517 + * limitations under the License.
518 + */
519 + package org.apache.jackrabbit.spi.commons.name;
520 +
521 + import javax.jcr.RepositoryException;
522 +
523 + import org.apache.jackrabbit.spi.Name;
524 + import org.apache.jackrabbit.spi.Path;
525 +
526 + public class CargoNamePath extends RelativePath {
527 +
528 + /** Serial version UID */
529 + private static final long serialVersionUID = -2887665244213430950L;
530 +
531 + /**
532 + * Name of the last path element.
533 + */
534 + private final Name name;
535 +
536 + /**
537 + * Optional index of the last path element. Set to
538 + * {@link Path#INDEX_UNDEFINED} if not explicitly specified,
539 + * otherwise contains the 1-based index.
540 + */
541 + private final int index;
542 +
543 + private final String argument;
544 +
545 + public CargoNamePath(Path parent, Name name, String argument) {
546 + super(parent);
547 + assert name != null;
548 + this.name = name;
549 + this.index = 0;
550 + this.argument = argument;
551 + }
552 +
553 + protected int getDepthModifier() {
554 + return 1;
555 + }
556 +
557 + protected Path getParent() throws RepositoryException {
558 + if (parent != null) {
559 + return parent;
560 + } else {
561 + return new CurrentPath(null);
562 + }
563 + }
564 +
565 + protected String getElementString() {
566 + if (index > Path.INDEX_DEFAULT) {
567 + return name + "[" + index + "]";
568 + } else {
569 + return name.toString();
570 + }
571 + }
572 +
573 + public Name getName() {
574 + return name;
575 + }
576 +
577 + @Override
578 + public int getIndex() {
579 + return Path.INDEX_DEFAULT;
580 + }
581 +
582 + @Override
583 + public String getIdentifier() {
584 + return argument;
585 + }
586 +
587 + @Override
588 + public boolean denotesIdentifier() {
589 + return true;
590 + }
591 +
592 + @Override
593 + public String getString() {
594 + return name + "[[" + argument + "]]";
595 + }
596 +
597 + @Override
598 + public int getNormalizedIndex() {
599 + return Path.INDEX_DEFAULT;
600 + }
601 +
602 + @Override
603 + public boolean denotesName() {
604 + return true;
605 + }
606 +
607 + public boolean isCanonical() {
608 + return parent != null && parent.isCanonical();
609 + }
610 +
611 + public boolean isNormalized() {
612 + return parent == null
613 + || (parent.isNormalized()
614 + && !parent.denotesCurrent());
615 + }
616 +
617 + public Path getNormalizedPath() throws RepositoryException {
618 + if (isNormalized()) {
619 + return this;
620 + } else {
621 + // parent is guaranteed to be !null
622 + Path normalized = parent.getNormalizedPath();
623 + if (normalized.denotesCurrent()) {
624 + normalized = null; // special case: ./a
625 + }
626 + return new CargoNamePath(normalized, name, argument);
627 + }
628 + }
629 +
630 + public Path getCanonicalPath() throws RepositoryException {
631 + if (isCanonical()) {
632 + return this;
633 + } else if (parent != null) {
634 + return new CargoNamePath(parent.getCanonicalPath(), name, argument);
635 + } else {
636 + throw new RepositoryException(
637 + "There is no canonical representation of " + this);
638 + }
639 + }
640 +
641 + /**
642 + * Returns the last element of this path.
643 + *
644 + * @return last element of this path
645 + */
646 + @Override
647 + public AbstractPath getLastElement() {
648 + if (parent != null) {
649 + return new CargoNamePath(null, name, argument);
650 + } else {
651 + return this;
652 + }
653 + }
654 +
655 + //--------------------------------------------------------------< Object >
656 +
657 + @Override
658 + public final boolean equals(Object that) {
659 + if (this == that) {
660 + return true;
661 + } else if (that instanceof Path) {
662 + Path path = (Path) that;
663 + return path.denotesName()
664 + && name.equals(path.getName())
665 + && getNormalizedIndex() == path.getNormalizedIndex()
666 + && super.equals(that);
667 + } else {
668 + return false;
669 + }
670 + }
671 +
672 + @Override
673 + public final int hashCode() {
674 + return super.hashCode() * 37 + name.hashCode() + getNormalizedIndex();
675 + }
676 +
677 + }
678
679 Property changes on: jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/CargoNamePath.java
680 ___________________________________________________________________
681 Added: svn:keywords
682 + Id
683 Added: svn:eol-style
684 + native
685
686 #
687 # REPO-187: creation of item state manager in session object rt workspace
688 # Get rid of switch on SessionImpl versus XASession in workspace object and
689 # delegate creation of local item state manager to session object. This
690 # also allows for the override to use a different cacheFactory.
691 #
692 Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
693 ===================================================================
694 *** jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java (revision 1429772)
695 --- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java (working copy)
696 ***************
697 *** 16,21 ****
698 --- 16,25 ----
699 */
700 package org.apache.jackrabbit.core;
701
702 + import org.apache.jackrabbit.core.observation.EventStateCollectionFactory;
703 + import org.apache.jackrabbit.core.state.ItemStateCacheFactory;
704 + import org.apache.jackrabbit.core.state.LocalItemStateManager;
705 + import org.apache.jackrabbit.core.state.SharedItemStateManager;
706 import static org.apache.jackrabbit.core.ItemValidator.CHECK_CHECKED_OUT;
707 import static org.apache.jackrabbit.core.ItemValidator.CHECK_CONSTRAINTS;
708 import static org.apache.jackrabbit.core.ItemValidator.CHECK_HOLD;
709 ***************
710 *** 1330,1333 ****
711 --- 1334,1340 ----
712 }
713 }
714
715 + public LocalItemStateManager createItemStateManager(RepositoryContext repositoryContext, WorkspaceImpl workspace, SharedItemStateManager sharedStateMgr, EventStateCollectionFactory factory, String attribute, ItemStateCacheFactory cacheFactory) {
716 + return LocalItemStateManager.createInstance(sharedStateMgr, factory, cacheFactory);
717 + }
718 }
719 Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/XASessionImpl.java
720 ===================================================================
721 *** jackrabbit-core/src/main/java/org/apache/jackrabbit/core/XASessionImpl.java (revision 1429772)
722 --- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/XASessionImpl.java (working copy)
723 ***************
724 *** 19,25 ****
725 --- 19,30 ----
726 import org.apache.jackrabbit.api.XASession;
727 import org.apache.jackrabbit.core.config.WorkspaceConfig;
728 import org.apache.jackrabbit.core.lock.XALockManager;
729 + import org.apache.jackrabbit.core.observation.EventStateCollectionFactory;
730 import org.apache.jackrabbit.core.security.authentication.AuthContext;
731 + import org.apache.jackrabbit.core.session.SessionContext;
732 + import org.apache.jackrabbit.core.state.ItemStateCacheFactory;
733 + import org.apache.jackrabbit.core.state.LocalItemStateManager;
734 + import org.apache.jackrabbit.core.state.SharedItemStateManager;
735 import org.apache.jackrabbit.core.state.XAItemStateManager;
736 import org.apache.jackrabbit.core.version.InternalVersionManager;
737 import org.apache.jackrabbit.core.version.InternalXAVersionManager;
738 ***************
739 *** 409,412 ****
740 --- 414,422 ----
741 return s1.equals(s2);
742 }
743 }
744 +
745 + @Override
746 + public LocalItemStateManager createItemStateManager(RepositoryContext repositoryContext, WorkspaceImpl workspace, SharedItemStateManager sharedStateMgr, EventStateCollectionFactory factory, String attributeName, ItemStateCacheFactory cacheFactory) {
747 + return XAItemStateManager.createInstance(sharedStateMgr, factory, attributeName, cacheFactory);
748 + }
749 }
750 Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
751 ===================================================================
752 *** jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java (revision 1429772)
753 --- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java (working copy)
754 ***************
755 *** 895,909 ****
756 SharedItemStateManager sism = getSharedItemStateManager();
757 ItemStateCacheFactory iscf =
758 context.getRepositoryContext().getItemStateCacheFactory();
759 !
760 ! // FIXME We should be able to avoid the instanceof operator here
761 ! if (context.getSessionImpl() instanceof XASessionImpl) {
762 ! return XAItemStateManager.createInstance(
763 ! sism, this, null, iscf);
764 ! } else {
765 ! return LocalItemStateManager.createInstance(
766 ! sism, this, iscf);
767 ! }
768
769 }
770
771 --- 895,901 ----
772 SharedItemStateManager sism = getSharedItemStateManager();
773 ItemStateCacheFactory iscf =
774 context.getRepositoryContext().getItemStateCacheFactory();
775 ! return context.getSessionImpl().createItemStateManager(this.context.getRepositoryContext(), this, sism, this, null, iscf);
776
777 }
778
779 #
780 # REPO-432 Hidden sns documents break JCR path retrieval and lookup
781 # We reorder the CNEs representing document nodes under a handle. However, when an external change
782 # of the handle node comes in the reordering we did is undone by the changes that are pulled in.
783 # We need access to the cache in order to get the handle state to do the reordering again during a stateModified event
784 # in the HippoLocalItemStateManager
785 #
786 Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java
787 ===================================================================
788 *** jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java (revision 1429772)
789 --- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java (working copy)
790 ***************
791 *** 38,44 ****
792 * cache of weak references to ItemState objects issued by this
793 * ItemStateManager
794 */
795 ! private final ItemStateCache cache;
796
797 /**
798 * Shared item state manager
799 --- 38,44 ----
800 * cache of weak references to ItemState objects issued by this
801 * ItemStateManager
802 */
803 ! protected final ItemStateCache cache;
804
805 /**
806 * Shared item state manager
807
808 #
809 # REPO-710 Session refresh triggers faceted navigation populate
810 # Don't retrieve item state during nodeDeleted event to optimize
811 # shareable node caching.
812 Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java
813 ===================================================================
814 *** jackrabbit-core/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java (revision 1486546)
815 --- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java (working copy)
816 ***************
817 *** 745,761 ****
818 if (entry != null && !entry.getId().equals(id)) {
819 return;
820 }
821 ! // if item is shareable, remove this path only, otherwise
822 ! // every path this item has been mapped to
823 ! NodeState child = null;
824 ! if (hasItemState(id)) {
825 ! child = (NodeState) getItemState(id);
826 ! }
827 ! if (child == null || !child.isShareable()) {
828 ! evictAll(id, true);
829 ! } else {
830 ! evict(element, true);
831 ! }
832 } else {
833 // element itself is not cached, but removal might cause SNS
834 // index shifting
835 --- 745,751 ----
836 if (entry != null && !entry.getId().equals(id)) {
837 return;
838 }
839 ! evictAll(id, true);
840 } else {
841 // element itself is not cached, but removal might cause SNS
842 // index shifting
843
844 #
845 # REPO-795/JCR-1880 Moving documents results in incorrect paths
846 # (to be removed when upgrading to 2.6.5)
847 #
848 Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
849 ===================================================================
850 *** jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java (revision 1532670)
851 --- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java (working copy)
852 ***************
853 *** 372,379 ****
854 }
855 }
856 if (oldEntry != null) {
857 ! notifyNodeAdded(newEntry);
858 ! notifyNodeRemoved(oldEntry);
859 return true;
860 }
861 return false;
862 --- 372,383 ----
863 }
864 }
865 if (oldEntry != null) {
866 ! if (oldEntry.getName().equals(newName)) {
867 ! notifyNodesReplaced();
868 ! } else {
869 ! notifyNodeAdded(newEntry);
870 ! notifyNodeRemoved(oldEntry);
871 ! }
872 return true;
873 }
874 return false;
875 Index: jackrabbit-core/src/test/java/org/apache/jackrabbit/core/MoveTest.java
876 ===================================================================
877 *** jackrabbit-core/src/test/java/org/apache/jackrabbit/core/MoveTest.java (revision 1532670)
878 --- jackrabbit-core/src/test/java/org/apache/jackrabbit/core/MoveTest.java (working copy)
879 ***************
880 *** 103,106 ****
881 --- 103,154 ----
882 assertEquals(testRootNode.getPath() + "/" + nodeName2, now);
883 }
884
885 + /**
886 + * Test reordering same-name-siblings using move
887 + */
888 + public void testReorderSameNameSiblingsUsingMove() throws RepositoryException {
889 + Session session = testRootNode.getSession();
890 + for (NodeIterator it = testRootNode.getNodes(); it.hasNext();) {
891 + it.nextNode().remove();
892 + session.save();
893 + }
894 + Node node1 = testRootNode.addNode(nodeName1);
895 + Node node2 = testRootNode.addNode(nodeName1);
896 + String path = node1.getPath();
897 +
898 + // re-order the nodes using move
899 + session.move(path, path);
900 +
901 + assertEquals(path + "[2]", node1.getPath());
902 + assertEquals(path, node2.getPath());
903 + }
904 +
905 + /**
906 + * Verify paths of same name siblings are correct after a (reordering) move
907 + * Issue JCR-1880
908 + */
909 + public void testGetPathDoesNotInfluencePathsAfterMove() throws RepositoryException {
910 + doTestMoveWithGetPath(false);
911 + doTestMoveWithGetPath(true);
912 + }
913 +
914 + private void doTestMoveWithGetPath(boolean index) throws RepositoryException {
915 + Session session = testRootNode.getSession();
916 + for (NodeIterator it = testRootNode.getNodes(); it.hasNext();) {
917 + it.nextNode().remove();
918 + session.save();
919 + }
920 + String testPath = testRootNode.getPath();
921 + Node a = testRootNode.addNode("a");
922 + Node b = a.addNode("b");
923 + session.save();
924 + session.move(testPath + "/a/b", testPath + "/a");
925 + if (index) {
926 + b.getPath();
927 + }
928 + session.move(testPath + "/a", testPath + "/a");
929 + assertEquals(testPath + "/a[2]", a.getPath());
930 + assertEquals(testPath + "/a", b.getPath());
931 + }
932 +
933 }
934 Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
935 ===================================================================
936 *** jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java (revision 1536369)
937 --- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java (working copy)
938 ***************
939 *** 429,468 ****
940 return getEffectiveNodeType(name);
941 }
942
943 ! if (!diff.isTrivial()) {
944 !
945 ! // TODO Implement checkForConflictingContent()
946 ! // make sure existing content would not conflict
947 ! // with new node type definition
948 ! //checkForConflictingContent(ntd);
949 ! //
950 ! // unregister old node type definition
951 ! //internalUnregister(name);
952 ! // register new definition
953 ! //EffectiveNodeType entNew = internalRegister(ntd);
954 ! //
955 ! // persist modified node type definitions
956 ! //customNTDefs.remove(name);
957 ! //customNTDefs.add(ntd);
958 ! //persistCustomNodeTypeDefs(customNTDefs);
959 ! //
960 ! // notify listeners
961 ! //notifyReRegistered(name);
962 ! //return entNew;
963 !
964 ! String message =
965 ! "The following node type change contains non-trivial changes."
966 ! + "Up until now only trivial changes are supported."
967 ! + " (see javadoc for "
968 ! + NodeTypeDefDiff.class.getName()
969 ! + "):\n" + diff.toString();
970 ! throw new RepositoryException(message);
971 ! }
972
973 /**
974 - * the change is trivial and has no effect on current content
975 - * (e.g. that would be the case when non-mandatory properties had
976 - * been added);
977 * re-register node type definition and update caches &
978 * notify listeners on re-registration
979 */
980 --- 429,439 ----
981 return getEffectiveNodeType(name);
982 }
983
984 ! // make sure existing content would not conflict
985 ! // with new node type definition
986 ! checkForConflictingContent(ntd, diff);
987
988 /**
989 * re-register node type definition and update caches &
990 * notify listeners on re-registration
991 */
992 ***************
993 *** 949,968 ****
994 * the above checks/actions are absolutely necessary in order to
995 * guarantee integrity of repository content.
996 *
997 * @param ntd The node type definition replacing the former node type
998 * definition of the same name.
999 * @throws RepositoryException If there is conflicting content or if the
1000 * check failed for some other reason.
1001 */
1002 ! protected void checkForConflictingContent(QNodeTypeDefinition ntd)
1003 throws RepositoryException {
1004 /**
1005 ! * collect names of node types that have dependencies on the given
1006 ! * node type
1007 */
1008 - //Set dependentNTs = getDependentNodeTypes(ntd.getName());
1009 -
1010 - throw new RepositoryException("not yet implemented");
1011 }
1012
1013 /**
1014 --- 920,956 ----
1015 * the above checks/actions are absolutely necessary in order to
1016 * guarantee integrity of repository content.
1017 *
1018 + *
1019 * @param ntd The node type definition replacing the former node type
1020 * definition of the same name.
1021 + * @param diff
1022 * @throws RepositoryException If there is conflicting content or if the
1023 * check failed for some other reason.
1024 */
1025 ! protected void checkForConflictingContent(QNodeTypeDefinition ntd, final NodeTypeDefDiff diff)
1026 throws RepositoryException {
1027 +
1028 + if (!diff.isTrivial()) {
1029 + /**
1030 + * collect names of node types that have dependencies on the given
1031 + * node type
1032 + */
1033 + //Set dependentNTs = getDependentNodeTypes(ntd.getName());
1034 +
1035 + String message =
1036 + "The following node type change contains non-trivial changes."
1037 + + "Up until now only trivial changes are supported."
1038 + + " (see javadoc for "
1039 + + NodeTypeDefDiff.class.getName()
1040 + + "):\n" + diff.toString();
1041 + throw new RepositoryException(message);
1042 + }
1043 +
1044 /**
1045 ! * the change is trivial and has no effect on current content
1046 ! * (e.g. that would be the case when non-mandatory properties had
1047 ! * been added);
1048 */
1049 }
1050
1051 /**

Properties

Name Value
svn:mergeinfo /hippo-cms7/archive/branches/Branch-HREPTWO-v2_16_xx/jackrabbit.patch:25772 /hippo-cms7/repository/branches/hippo-repository-2.18.xx/jackrabbit.patch:25702,25712,25714,25716,25742,25744,25795,26495,27506