Author: unico
Date: Mon Jun 11 18:34:01 2012
New Revision: 1348956
URL: http://svn.apache.org/viewvc?rev=1348956&view=rev
Log:
RAVE-603 resources cannot be reloaded
Modified:
rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/Module.java
rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleImporter.java
rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleRegistry.java
rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleScanner.java
rave/sandbox/content-services/rave-jcr-config/src/test/java/org/apache/rave/jcr/bootstrapping/ModuleRegistryTest.java
rave/sandbox/content-services/rave-jcr-config/src/test/java/org/apache/rave/jcr/bootstrapping/ModuleScannerTest.java
rave/sandbox/content-services/rave-jcr-config/src/test/resources/META-INF/rave/module.json
Modified:
rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/Module.java
URL:
http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/Module.java?rev=1348956&r1=1348955&r2=1348956&view=diff
==============================================================================
---
rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/Module.java
(original)
+++
rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/Module.java
Mon Jun 11 18:34:01 2012
@@ -187,11 +187,11 @@ public final class Module {
return resources;
}
- void addResource(String name, String path, String parent, boolean reload,
String workspace, ImportBehavior importBehavior, Status status) {
+ void addResource(String name, String path, String parent, String
workspace, ImportBehavior importBehavior, Status status) {
if (resources == null) {
resources = new ArrayList<Resource>();
}
- resources.add(new Resource(name, path, parent, reload, workspace,
importBehavior, status));
+ resources.add(new Resource(name, path, parent, workspace,
importBehavior, status));
}
@Override
@@ -542,15 +542,13 @@ public final class Module {
private final String path;
private final String parent;
- private final boolean reload;
private final String workspace;
private ImportBehavior importBehavior;
- private Resource(String name, String path, String parent, boolean
reload, String workspace, ImportBehavior importBehavior, Status status) {
+ private Resource(String name, String path, String parent, String
workspace, ImportBehavior importBehavior, Status status) {
super(name, status);
this.path = path;
this.parent = parent;
- this.reload = reload;
this.workspace = workspace;
this.importBehavior = importBehavior;
}
@@ -599,9 +597,6 @@ public final class Module {
final Resource resource = (Resource) o;
- if (reload != resource.reload) {
- return false;
- }
if (!parent.equals(resource.parent)) {
return false;
}
@@ -617,7 +612,6 @@ public final class Module {
int result = super.hashCode();
result = 31 * result + (path != null ? path.hashCode() : 0);
result = 31 * result + parent.hashCode();
- result = 31 * result + (reload ? 1 : 0);
result = importBehavior == null ? result : 31 * result +
importBehavior.hashCode();
return result;
}
Modified:
rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleImporter.java
URL:
http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleImporter.java?rev=1348956&r1=1348955&r2=1348956&view=diff
==============================================================================
---
rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleImporter.java
(original)
+++
rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleImporter.java
Mon Jun 11 18:34:01 2012
@@ -85,6 +85,7 @@ public final class ModuleImporter {
log.info("Preparing for import");
final Collection<Module.Content> reloadContents = new
ArrayList<Module.Content>();
+ final Collection<Module.Resource> reloadResources = new
ArrayList<Module.Resource>();
for (final Module module : modules) {
for (final Module.Namespace namespace : module.getNamespaces()) {
if (namespace.getStatus() == Module.Status.NEW) {
@@ -125,10 +126,6 @@ public final class ModuleImporter {
for (Module.Resource resource : module.getResources()) {
if (resource.getStatus() == Module.Status.NEW ||
resource.getStatus() == Module.Status.FAILED) {
resources.add(resource);
- } else if (resource.getModule().getStatus() ==
Module.Status.GRADED) {
- if (resource.isReload() && resource.getStatus() !=
Module.Status.REMOVED) {
- resources.add(resource);
- }
}
}
@@ -145,7 +142,6 @@ public final class ModuleImporter {
}
}
-
Collections.sort(cnds, CndComparator.INSTANCE);
Collections.sort(contents, ContentComparator.INSTANCE);
Modified:
rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleRegistry.java
URL:
http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleRegistry.java?rev=1348956&r1=1348955&r2=1348956&view=diff
==============================================================================
---
rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleRegistry.java
(original)
+++
rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleRegistry.java
Mon Jun 11 18:34:01 2012
@@ -372,14 +372,13 @@ public final class ModuleRegistry {
final Node item = iter.nextNode();
final String path = item.getProperty(PATH).getString();
final String parent = item.getProperty(PARENT).getString();
- final boolean reload = !item.hasProperty(RELOAD) ||
item.getProperty(RELOAD).getBoolean();
final String workspace = !item.hasProperty(WORKSPACE) ? null :
item.getProperty(WORKSPACE).getString();
ImportBehavior importBehavior = null;
if (item.hasProperty(IMPORTBEHAVIOR)) {
importBehavior =
ImportBehavior.valueOf(item.getProperty(IMPORTBEHAVIOR).getString().toUpperCase());
}
status =
Module.Status.valueOf(item.getProperty(STATUS).getString());
- module.addResource(item.getName(), path, parent, reload,
workspace, importBehavior, status);
+ module.addResource(item.getName(), path, parent, workspace,
importBehavior, status);
}
}
Modified:
rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleScanner.java
URL:
http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleScanner.java?rev=1348956&r1=1348955&r2=1348956&view=diff
==============================================================================
---
rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleScanner.java
(original)
+++
rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleScanner.java
Mon Jun 11 18:34:01 2012
@@ -98,8 +98,8 @@ public final class ModuleScanner {
if (!object.has(NAME)) {
throw new BootstrapException("module definition must specify a
name field");
}
- final String moduleName = object.get(NAME).textValue();
+ final String moduleName = object.get(NAME).textValue();
final String newVersion = object.has(VERSION) ?
object.get(VERSION).textValue() : null;
final Module module = new Module(moduleName, baseUrl, newVersion);
@@ -169,13 +169,12 @@ public final class ModuleScanner {
}
final String path = resource.has(PATH) ?
resource.get(PATH).textValue() : "";
final String parent = resource.get(PARENT).textValue();
- final boolean reload = !resource.has(RELOAD) ||
resource.get(RELOAD).booleanValue();
final String workspace = !resource.has(WORKSPACE) ? null :
resource.get(WORKSPACE).textValue();;
ImportBehavior importBehavior = null;
if (resource.has(IMPORTBEHAVIOR)) {
importBehavior =
ImportBehavior.valueOf(resource.get(IMPORTBEHAVIOR).textValue().toUpperCase());
}
- module.addResource(name, path, parent, reload, workspace,
importBehavior, null);
+ module.addResource(name, path, parent, workspace,
importBehavior, null);
}
}
Modified:
rave/sandbox/content-services/rave-jcr-config/src/test/java/org/apache/rave/jcr/bootstrapping/ModuleRegistryTest.java
URL:
http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-config/src/test/java/org/apache/rave/jcr/bootstrapping/ModuleRegistryTest.java?rev=1348956&r1=1348955&r2=1348956&view=diff
==============================================================================
---
rave/sandbox/content-services/rave-jcr-config/src/test/java/org/apache/rave/jcr/bootstrapping/ModuleRegistryTest.java
(original)
+++
rave/sandbox/content-services/rave-jcr-config/src/test/java/org/apache/rave/jcr/bootstrapping/ModuleRegistryTest.java
Mon Jun 11 18:34:01 2012
@@ -120,9 +120,6 @@ public class ModuleRegistryTest extends
assertEquals("quux", resourceNode.getProperty("path").getString());
assertTrue(resourceNode.hasProperty("parent"));
assertEquals("/testroot",
resourceNode.getProperty("parent").getString());
- assertTrue(resourceNode.hasProperty("reload"));
- assertFalse(resourceNode.getProperty("reload").getBoolean());
- assertTrue(resourceNode.hasProperty("importBehavior"));
assertEquals("SKIP",
resourceNode.getProperty("importBehavior").getString());
}
Modified:
rave/sandbox/content-services/rave-jcr-config/src/test/java/org/apache/rave/jcr/bootstrapping/ModuleScannerTest.java
URL:
http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-config/src/test/java/org/apache/rave/jcr/bootstrapping/ModuleScannerTest.java?rev=1348956&r1=1348955&r2=1348956&view=diff
==============================================================================
---
rave/sandbox/content-services/rave-jcr-config/src/test/java/org/apache/rave/jcr/bootstrapping/ModuleScannerTest.java
(original)
+++
rave/sandbox/content-services/rave-jcr-config/src/test/java/org/apache/rave/jcr/bootstrapping/ModuleScannerTest.java
Mon Jun 11 18:34:01 2012
@@ -81,7 +81,6 @@ public class ModuleScannerTest {
final Module.Resource resource =
module.getResources().iterator().next();
assertEquals("quux", resource.getPath());
assertEquals("/testroot", resource.getParent());
- assertFalse(resource.isReload());
assertEquals(ImportBehavior.SKIP, resource.getImportBehavior());
}
Modified:
rave/sandbox/content-services/rave-jcr-config/src/test/resources/META-INF/rave/module.json
URL:
http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-config/src/test/resources/META-INF/rave/module.json?rev=1348956&r1=1348955&r2=1348956&view=diff
==============================================================================
---
rave/sandbox/content-services/rave-jcr-config/src/test/resources/META-INF/rave/module.json
(original)
+++
rave/sandbox/content-services/rave-jcr-config/src/test/resources/META-INF/rave/module.json
Mon Jun 11 18:34:01 2012
@@ -28,8 +28,7 @@
"quux" : {
"path" : "quux",
"parent" : "/testroot",
- "importBehavior" : "skip",
- "reload" : false
+ "importBehavior" : "skip"
}
}
}