You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2014/05/15 15:42:20 UTC
svn commit: r1594912 - in /sling/trunk/tooling/ide/impl-vlt: .options
META-INF/MANIFEST.MF build.properties plugin.xml
src/org/apache/sling/ide/impl/vlt/Activator.java
src/org/apache/sling/ide/impl/vlt/AddOrUpdateNodeCommand.java
Author: rombert
Date: Thu May 15 13:42:20 2014
New Revision: 1594912
URL: http://svn.apache.org/r1594912
Log:
SLING-3566 - Properties from extended file aggregates are not
synchronized
Added tracing to the impl-vlt plugin, right now for the
AddOrUpdateNodeCommand.
Added:
sling/trunk/tooling/ide/impl-vlt/.options
sling/trunk/tooling/ide/impl-vlt/plugin.xml (with props)
sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/Activator.java (with props)
Modified:
sling/trunk/tooling/ide/impl-vlt/META-INF/MANIFEST.MF
sling/trunk/tooling/ide/impl-vlt/build.properties
sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/AddOrUpdateNodeCommand.java
Added: sling/trunk/tooling/ide/impl-vlt/.options
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/.options?rev=1594912&view=auto
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/.options (added)
+++ sling/trunk/tooling/ide/impl-vlt/.options Thu May 15 13:42:20 2014
@@ -0,0 +1 @@
+org.apache.sling.ide.impl-vlt/debug=false
\ No newline at end of file
Modified: sling/trunk/tooling/ide/impl-vlt/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/META-INF/MANIFEST.MF?rev=1594912&r1=1594911&r2=1594912&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/META-INF/MANIFEST.MF (original)
+++ sling/trunk/tooling/ide/impl-vlt/META-INF/MANIFEST.MF Thu May 15 13:42:20 2014
@@ -1,6 +1,6 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.apache.sling.ide.impl-vlt
+Bundle-SymbolicName: org.apache.sling.ide.impl-vlt;singleton:=true
Bundle-Version: 0.0.1.qualifier
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
@@ -17,10 +17,16 @@ Import-Package: javax.jcr,
org.apache.jackrabbit.vault.fs.impl.aggregator,
org.apache.jackrabbit.vault.fs.impl.io,
org.apache.jackrabbit.vault.util,
+ org.apache.sling.ide.eclipse.core,
+ org.apache.sling.ide.eclipse.core.debug,
org.apache.sling.ide.filter,
org.apache.sling.ide.serialization,
org.apache.sling.ide.transport,
org.apache.sling.ide.util,
- org.osgi.service.event;version="1.3.0"
+ org.eclipse.core.runtime;version="3.4.0",
+ org.osgi.framework;version="1.7.0",
+ org.osgi.service.event;version="1.3.0",
+ org.osgi.util.tracker;version="1.5.1"
Export-Package: org.apache.sling.ide.jcr
Service-Component: OSGI-INF/*.xml
+Bundle-Activator: org.apache.sling.ide.impl.vlt.Activator
Modified: sling/trunk/tooling/ide/impl-vlt/build.properties
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/build.properties?rev=1594912&r1=1594911&r2=1594912&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/build.properties (original)
+++ sling/trunk/tooling/ide/impl-vlt/build.properties Thu May 15 13:42:20 2014
@@ -1,5 +1,7 @@
output.. = bin/
bin.includes = .,\
META-INF/,\
- OSGI-INF/
+ OSGI-INF/,\
+ plugin.xml,\
+ .options
source.. = src/
Added: sling/trunk/tooling/ide/impl-vlt/plugin.xml
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/plugin.xml?rev=1594912&view=auto
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/plugin.xml (added)
+++ sling/trunk/tooling/ide/impl-vlt/plugin.xml Thu May 15 13:42:20 2014
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.trace.traceComponents">
+ <component
+ id="org.eclipse.ui.trace.tracingPrefPage"
+ label="Sling IDE Tooling">
+ <bundle
+ name="org.apache.sling.ide.impl-vlt"></bundle>
+ </component>
+ </extension>
+</plugin>
\ No newline at end of file
Propchange: sling/trunk/tooling/ide/impl-vlt/plugin.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sling/trunk/tooling/ide/impl-vlt/plugin.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/Activator.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/Activator.java?rev=1594912&view=auto
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/Activator.java (added)
+++ sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/Activator.java Thu May 15 13:42:20 2014
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.ide.impl.vlt;
+
+import org.apache.sling.ide.eclipse.core.ServiceUtil;
+import org.apache.sling.ide.eclipse.core.debug.PluginLogger;
+import org.apache.sling.ide.eclipse.core.debug.PluginLoggerRegistrar;
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * The activator class controls the plug-in life cycle
+ *
+ * <p>
+ * Since the WST framework is based on Eclipse extension points, rather than OSGi services, this class provides a static
+ * entry point to well-known services.
+ * </p>
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.apache.sling.ide.impl-vlt"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ private ServiceTracker<?, ?> tracer;
+
+ private ServiceRegistration<?> tracerRegistration;
+
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+
+ tracerRegistration = PluginLoggerRegistrar.register(this);
+
+ // ugh
+ ServiceReference<Object> reference = (ServiceReference<Object>) tracerRegistration.getReference();
+ tracer = new ServiceTracker<Object, Object>(context, reference, null);
+ tracer.open();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+
+ tracerRegistration.unregister();
+
+ tracer.close();
+
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ public PluginLogger getPluginLogger() {
+ return (PluginLogger) ServiceUtil.getNotNull(tracer);
+ }
+}
Propchange: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/Activator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/Activator.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision Rev URL
Modified: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/AddOrUpdateNodeCommand.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/AddOrUpdateNodeCommand.java?rev=1594912&r1=1594911&r2=1594912&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/AddOrUpdateNodeCommand.java (original)
+++ sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/AddOrUpdateNodeCommand.java Thu May 15 13:42:20 2014
@@ -91,8 +91,12 @@ public class AddOrUpdateNodeCommand exte
Node node;
if (nodeExists) {
node = session.getNode(path);
+ Activator.getDefault().getPluginLogger()
+ .trace("Found existing node at {0} with primaryType {1}", path, node.getPrimaryNodeType().getName());
} else {
node = createNode(resource, session);
+ Activator.getDefault().getPluginLogger()
+ .trace("Created node at {0} with primaryType {1}", path, node.getPrimaryNodeType().getName());
}
updateNode(node, resource);
@@ -108,7 +112,9 @@ public class AddOrUpdateNodeCommand exte
if (primaryTypeHasChanged) {
session.save();
}
+
NodeType primaryNodeType = node.getPrimaryNodeType();
+
if (primaryNodeType.hasOrderableChildNodes()) {
reorderChildNodes(node, resource);
}
@@ -252,6 +258,8 @@ public class AddOrUpdateNodeCommand exte
if (!node.getPrimaryNodeType().getName().equals(primaryType)) {
node.setPrimaryType(primaryType);
primaryTypeHasChanged = true;
+ Activator.getDefault().getPluginLogger()
+ .trace("Set new primary type {0} for node at {1}", primaryType, node.getPath());
}
// TODO - review for completeness and filevault compatibility
@@ -344,8 +352,12 @@ public class AddOrUpdateNodeCommand exte
if (value != null) {
node.setProperty(propertyName, value);
+ Object[] arguments = { propertyName, value, propertyValue, node.getPath() };
+ Activator.getDefault().getPluginLogger().trace("Set property {0} with value {1} (raw = {2}) on node at {3}", arguments);
} else if (values != null) {
node.setProperty(propertyName, values);
+ Object[] arguments = { propertyName, values, propertyValue, node.getPath() };
+ Activator.getDefault().getPluginLogger().trace("Set property {0} with values {1} (raw = {2}) on node at {3}", arguments);
} else {
throw new IllegalArgumentException("Unable to extract a value or a value array for property '"
+ propertyName + "' with value '" + propertyValue + "'");
@@ -354,6 +366,8 @@ public class AddOrUpdateNodeCommand exte
for ( String propertyToRemove : propertiesToRemove ) {
node.getProperty(propertyToRemove).remove();
+ Activator.getDefault().getPluginLogger()
+ .trace("Removed property {0} from node at {1}", propertyToRemove, node.getPath());
}
}
@@ -380,10 +394,14 @@ public class AddOrUpdateNodeCommand exte
for (String mixinToAdd : mixinsToAdd) {
node.addMixin(mixinToAdd);
+ Activator.getDefault().getPluginLogger()
+ .trace("Added new mixin {0} to node at path {1}", mixinToAdd, node.getPath());
}
for (String mixinToRemove : mixinsToRemove) {
node.removeMixin(mixinToRemove);
+ Activator.getDefault().getPluginLogger()
+ .trace("Removed mixin {0} from node at path {1}", mixinToRemove, node.getPath());
}
}
@@ -408,6 +426,9 @@ public class AddOrUpdateNodeCommand exte
}
}
+ Activator.getDefault().getPluginLogger()
+ .trace("Updating {} property on node at {} ", JCR_DATA, contentNode.getPath());
+
FileInputStream inputStream = new FileInputStream(file);
try {
Binary binary = node.getSession().getValueFactory().createBinary(inputStream);
@@ -415,6 +436,7 @@ public class AddOrUpdateNodeCommand exte
// TODO: might have to be done differently since the client and server's clocks can differ
// and the last_modified should maybe be taken from the server's time..
contentNode.setProperty(JCR_LASTMODIFIED, Calendar.getInstance());
+
} finally {
try {
inputStream.close();