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 2013/07/19 17:03:53 UTC

svn commit: r1504905 - in /sling/whiteboard/asanso/plugins/eclipse: slingclipse-api/META-INF/ slingclipse-api/src/org/apache/sling/ide/ slingclipse-api/src/org/apache/sling/ide/serialization/ slingclipse-http/META-INF/ slingclipse-http/OSGI-INF/ slingc...

Author: rombert
Date: Fri Jul 19 15:03:52 2013
New Revision: 1504905

URL: http://svn.apache.org/r1504905
Log:
SLING-2973 - [Tooling] Align Eclipse tooling to proposed structure

Cleanup most of the previous implementation which relied on global
preferences and natures. The serialization details are now controlled by
a SerializationManager component and the access is made still from the
SlingclipsePlugin, but it's no longer static.

Added:
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-api/src/org/apache/sling/ide/
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-api/src/org/apache/sling/ide/serialization/
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-api/src/org/apache/sling/ide/serialization/SerializationManager.java   (contents, props changed)
      - copied, changed from r1504904, sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/src/org/apache/sling/slingclipse/preferences/PreferencesMessages.java
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/OSGI-INF/RepositoryImpl.xml   (contents, props changed)
      - copied, changed from r1504904, sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/OSGI-INF/component.xml
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/OSGI-INF/SimpleXmlSerializationManager.xml   (with props)
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/src/org/apache/sling/ide/
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/src/org/apache/sling/ide/serialization/
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/src/org/apache/sling/ide/serialization/simplexml/
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/src/org/apache/sling/ide/serialization/simplexml/SimpleXmlSerializationManager.java   (with props)
Removed:
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/OSGI-INF/component.xml
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/plugin.xml
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/src/org/apache/sling/slingclipse/SlingclipseListener.java
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/src/org/apache/sling/slingclipse/internal/AddSlingNatureAction.java
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/src/org/apache/sling/slingclipse/internal/SlingProjectBuilder.java
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/src/org/apache/sling/slingclipse/internal/SlingProjectNature.java
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/src/org/apache/sling/slingclipse/preferences/PreferenceInitializer.java
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/src/org/apache/sling/slingclipse/preferences/PreferencesMessages.java
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/src/org/apache/sling/slingclipse/preferences/SlingclipsePreferencePage.java
Modified:
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-api/META-INF/MANIFEST.MF
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/META-INF/MANIFEST.MF
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/META-INF/MANIFEST.MF
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/src/org/apache/sling/slingclipse/SlingclipsePlugin.java
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/src/org/apache/sling/slingclipse/helper/SlingclipseHelper.java
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-target-definition/org.apache.sling.slingclipse.target-definition.target
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/META-INF/MANIFEST.MF
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadBehaviour.java
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/ui/internal/ImportWizard.java
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/ui/internal/ImportWizardPage.java

Modified: sling/whiteboard/asanso/plugins/eclipse/slingclipse-api/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/slingclipse-api/META-INF/MANIFEST.MF?rev=1504905&r1=1504904&r2=1504905&view=diff
==============================================================================
--- sling/whiteboard/asanso/plugins/eclipse/slingclipse-api/META-INF/MANIFEST.MF (original)
+++ sling/whiteboard/asanso/plugins/eclipse/slingclipse-api/META-INF/MANIFEST.MF Fri Jul 19 15:03:52 2013
@@ -7,4 +7,5 @@ Require-Bundle: org.eclipse.ui,
  org.eclipse.core.runtime
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Export-Package: org.apache.sling.slingclipse.api
+Export-Package: org.apache.sling.ide.serialization,
+ org.apache.sling.slingclipse.api

Copied: sling/whiteboard/asanso/plugins/eclipse/slingclipse-api/src/org/apache/sling/ide/serialization/SerializationManager.java (from r1504904, sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/src/org/apache/sling/slingclipse/preferences/PreferencesMessages.java)
URL: http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/slingclipse-api/src/org/apache/sling/ide/serialization/SerializationManager.java?p2=sling/whiteboard/asanso/plugins/eclipse/slingclipse-api/src/org/apache/sling/ide/serialization/SerializationManager.java&p1=sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/src/org/apache/sling/slingclipse/preferences/PreferencesMessages.java&r1=1504904&r2=1504905&rev=1504905&view=diff
==============================================================================
--- sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/src/org/apache/sling/slingclipse/preferences/PreferencesMessages.java (original)
+++ sling/whiteboard/asanso/plugins/eclipse/slingclipse-api/src/org/apache/sling/ide/serialization/SerializationManager.java Fri Jul 19 15:03:52 2013
@@ -1,31 +1,33 @@
-/*
- * 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.slingclipse.preferences;
-
-public enum PreferencesMessages {
-	PASSWORD("password"), REPOSITORY_URL("repository.url"), USERNAME("username"), REPOSITORY_AUTO_SYNC("repository.auto.sync");
-
-	private final String key;
-
-	private PreferencesMessages(String key) {
-		this.key = key;
-	}
-
-	public String getKey() {
-		return this.key;
-	}
-}
+/*
+ * 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.serialization;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Map;
+
+public interface SerializationManager {
+
+    boolean isSerializationFile(String filePath);
+
+    String getSerializationFilePath(String baseFilePath);
+
+    void writeSerializationData(OutputStream destination, Map<String, String> data) throws IOException;
+
+    Map<String, String> readSerializationData(InputStream source) throws IOException;
+}

Propchange: sling/whiteboard/asanso/plugins/eclipse/slingclipse-api/src/org/apache/sling/ide/serialization/SerializationManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/whiteboard/asanso/plugins/eclipse/slingclipse-api/src/org/apache/sling/ide/serialization/SerializationManager.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Modified: sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/META-INF/MANIFEST.MF?rev=1504905&r1=1504904&r2=1504905&view=diff
==============================================================================
--- sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/META-INF/MANIFEST.MF (original)
+++ sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/META-INF/MANIFEST.MF Fri Jul 19 15:03:52 2013
@@ -11,4 +11,6 @@ Require-Bundle: org.eclipse.ui,
  org.eclipse.osgi.services;bundle-version="3.2.100"
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Service-Component: OSGI-INF/component.xml
+Service-Component: OSGI-INF/RepositoryImpl.xml,
+ OSGI-INF/SimpleXmlSerializationManager.xml
+Import-Package: org.json

Copied: sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/OSGI-INF/RepositoryImpl.xml (from r1504904, sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/OSGI-INF/component.xml)
URL: http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/OSGI-INF/RepositoryImpl.xml?p2=sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/OSGI-INF/RepositoryImpl.xml&p1=sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/OSGI-INF/component.xml&r1=1504904&r2=1504905&rev=1504905&view=diff
==============================================================================
--- sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/OSGI-INF/component.xml (original)
+++ sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/OSGI-INF/RepositoryImpl.xml Fri Jul 19 15:03:52 2013
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="false" name="org.apache.sling.slingclipse.http">
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="false">
    <implementation class="org.apache.sling.slingclipse.http.impl.RepositoryImpl"/>
    <service>
       <provide interface="org.apache.sling.slingclipse.api.Repository"/>

Propchange: sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/OSGI-INF/RepositoryImpl.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/OSGI-INF/RepositoryImpl.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/OSGI-INF/SimpleXmlSerializationManager.xml
URL: http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/OSGI-INF/SimpleXmlSerializationManager.xml?rev=1504905&view=auto
==============================================================================
--- sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/OSGI-INF/SimpleXmlSerializationManager.xml (added)
+++ sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/OSGI-INF/SimpleXmlSerializationManager.xml Fri Jul 19 15:03:52 2013
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="false">
+   <implementation class="org.apache.sling.ide.serialization.simplexml.SimpleXmlSerializationManager"/>
+   <service>
+      <provide interface="org.apache.sling.ide.serialization.SerializationManager"/>
+   </service>
+</scr:component>

Propchange: sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/OSGI-INF/SimpleXmlSerializationManager.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/OSGI-INF/SimpleXmlSerializationManager.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/src/org/apache/sling/ide/serialization/simplexml/SimpleXmlSerializationManager.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/src/org/apache/sling/ide/serialization/simplexml/SimpleXmlSerializationManager.java?rev=1504905&view=auto
==============================================================================
--- sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/src/org/apache/sling/ide/serialization/simplexml/SimpleXmlSerializationManager.java (added)
+++ sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/src/org/apache/sling/ide/serialization/simplexml/SimpleXmlSerializationManager.java Fri Jul 19 15:03:52 2013
@@ -0,0 +1,87 @@
+/*
+ * 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.serialization.simplexml;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.sling.ide.serialization.SerializationManager;
+import org.apache.sling.slingclipse.api.ProtectedNodes;
+import org.json.JSONException;
+import org.json.JSONML;
+import org.json.JSONObject;
+
+public class SimpleXmlSerializationManager implements SerializationManager {
+
+    private static final String CONTENT_XML = ".content.xml";
+    private static final String TAG_NAME = "tagName";
+
+    @Override
+    public boolean isSerializationFile(String filePath) {
+        return filePath.endsWith(CONTENT_XML);
+    }
+
+    @Override
+    public String getSerializationFilePath(String baseFilePath) {
+        return baseFilePath + File.separatorChar + CONTENT_XML;
+    }
+
+    @Override
+    public Map<String, String> readSerializationData(InputStream source) throws IOException {
+
+        try {
+            BufferedReader reader = new BufferedReader(new InputStreamReader(source));
+            StringBuilder out = new StringBuilder();
+            String line;
+            while ((line = reader.readLine()) != null) {
+                out.append(line);
+            }
+
+            return getModifiedProperties(out.toString());
+        } catch (JSONException e) {
+            // TODO Proper error handling
+            throw new RuntimeException(e);
+        }
+
+    }
+
+    private Map<String, String> getModifiedProperties(String fileContent) throws JSONException {
+
+        Map<String, String> properties = new HashMap<String, String>();
+        JSONObject json = JSONML.toJSONObject(fileContent);
+        json.remove(TAG_NAME);
+        for (Iterator<?> keys = json.keys(); keys.hasNext();) {
+            String key = (String) keys.next();
+            if (!ProtectedNodes.exists(key) && !key.contains("xmlns")) {
+                properties.put(key, json.optString(key));
+            }
+        }
+        return properties;
+    }
+
+    @Override
+    public void writeSerializationData(OutputStream destination, Map<String, String> data) throws IOException {
+    }
+
+}

Propchange: sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/src/org/apache/sling/ide/serialization/simplexml/SimpleXmlSerializationManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/src/org/apache/sling/ide/serialization/simplexml/SimpleXmlSerializationManager.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Modified: sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/META-INF/MANIFEST.MF?rev=1504905&r1=1504904&r2=1504905&view=diff
==============================================================================
--- sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/META-INF/MANIFEST.MF (original)
+++ sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/META-INF/MANIFEST.MF Fri Jul 19 15:03:52 2013
@@ -17,6 +17,7 @@ Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-ClassPath: .
 Service-Component: OSGI-INF/component.xml
-Import-Package: org.osgi.service.component;version="1.1.0"
+Import-Package: org.eclipse.osgi.service.debug;version="1.2.0",
+ org.osgi.service.component;version="1.1.0"
 Export-Package: org.apache.sling.slingclipse,
  org.apache.sling.slingclipse.helper

Modified: sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/src/org/apache/sling/slingclipse/SlingclipsePlugin.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/src/org/apache/sling/slingclipse/SlingclipsePlugin.java?rev=1504905&r1=1504904&r2=1504905&view=diff
==============================================================================
--- sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/src/org/apache/sling/slingclipse/SlingclipsePlugin.java (original)
+++ sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/src/org/apache/sling/slingclipse/SlingclipsePlugin.java Fri Jul 19 15:03:52 2013
@@ -16,11 +16,13 @@
  */
 package org.apache.sling.slingclipse;
 
+import org.apache.sling.ide.serialization.SerializationManager;
 import org.apache.sling.slingclipse.api.Repository;
 import org.apache.sling.slingclipse.helper.Tracer;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
 
 /**
  * The activator class controls the plug-in life cycle
@@ -33,11 +35,13 @@ public class SlingclipsePlugin extends A
 	// The shared instance
 	private static SlingclipsePlugin plugin;
 
-	//TODO is fine to be static?
-	private static Repository repository;
-	
+    private Repository repository;
+    private SerializationManager serializationManager;
 	private Tracer tracer;
 
+    private ServiceReference<Repository> repositoryRef;
+    private ServiceReference<SerializationManager> serializationManagerRef;
+
 	/*
 	 * (non-Javadoc)
 	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
@@ -47,6 +51,12 @@ public class SlingclipsePlugin extends A
 		plugin = this;
 		tracer = new Tracer();
 		tracer.register(getBundle().getBundleContext());
+
+        repositoryRef = context.getServiceReference(Repository.class);
+        repository = context.getService(repositoryRef);
+
+        serializationManagerRef = context.getServiceReference(SerializationManager.class);
+        serializationManager = context.getService(serializationManagerRef);
 	}
 
 	/*
@@ -54,7 +64,10 @@ public class SlingclipsePlugin extends A
 	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
 	 */
 	public void stop(BundleContext context) throws Exception {
-		plugin = null;
+        context.ungetService(repositoryRef);
+        context.ungetService(serializationManagerRef);
+
+        plugin = null;
 		super.stop(context);
 		tracer.unregister();
 	}
@@ -79,20 +92,15 @@ public class SlingclipsePlugin extends A
 		return imageDescriptorFromPlugin(PLUGIN_ID, path);
 	}
 
-	public void setRepository(Repository repository ){
-		this.repository=repository;
-
-	}
-
-	public void unsetRepository(Repository repository){
-		this.repository= null;
-	}
+    public Tracer getTracer() {
+        return tracer;
+    }
 
 	public Repository getRepository() {
-		return this.repository;
+        return repository;
 	}
 
-	public Tracer getTracer() {
-		return tracer;
-	}
+    public SerializationManager getSerializationManager() {
+        return serializationManager;
+    }
 }

Modified: sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/src/org/apache/sling/slingclipse/helper/SlingclipseHelper.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/src/org/apache/sling/slingclipse/helper/SlingclipseHelper.java?rev=1504905&r1=1504904&r2=1504905&view=diff
==============================================================================
--- sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/src/org/apache/sling/slingclipse/helper/SlingclipseHelper.java (original)
+++ sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/src/org/apache/sling/slingclipse/helper/SlingclipseHelper.java Fri Jul 19 15:03:52 2013
@@ -16,28 +16,11 @@
  */
 package org.apache.sling.slingclipse.helper;
 
+@Deprecated
 public class SlingclipseHelper {
 	
-	public static final String TAG_NAME= "tagName";
+    /**
+     * @deprecated Will be transformed into a per-project property
+     */
 	public static final String JCR_ROOT= "jcr_root";
-	public static final String CONTENT_XML= ".content.xml";
-	
-	public static boolean isValidSlingProjectPath(String path){
-		//TODO verify only one occurrence of JCR_ROOT.		
-		return path.indexOf(JCR_ROOT)!= -1;
-	}
-	
-	public static String getSlingProjectPath(String path){
-		int index= path.indexOf(JCR_ROOT)+JCR_ROOT.length();
-        return path.substring(index);
-	}
-	
-	public static boolean isFilePath(String path){
-		return path.indexOf(".")!=-1;
-	}
-	
-	public static boolean isFolderPath(String path){
-		return path.indexOf(".")==-1;
-	}
-
 }

Modified: sling/whiteboard/asanso/plugins/eclipse/slingclipse-target-definition/org.apache.sling.slingclipse.target-definition.target
URL: http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/slingclipse-target-definition/org.apache.sling.slingclipse.target-definition.target?rev=1504905&r1=1504904&r2=1504905&view=diff
==============================================================================
--- sling/whiteboard/asanso/plugins/eclipse/slingclipse-target-definition/org.apache.sling.slingclipse.target-definition.target (original)
+++ sling/whiteboard/asanso/plugins/eclipse/slingclipse-target-definition/org.apache.sling.slingclipse.target-definition.target Fri Jul 19 15:03:52 2013
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<?pde version="3.8"?><target sequenceNumber="3">
+<?pde version="3.8"?><target name="Slingclipse" sequenceNumber="8">
 <locations>
 <location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
 <unit id="org.apache.commons.httpclient" version="3.1.0.v201012070820"/>
@@ -8,7 +8,9 @@
 </location>
 <location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
 <unit id="org.eclipse.wst.server_adapters.feature.feature.group" version="3.2.100.v20110303-51EoAkF77g8HBSc"/>
+<unit id="org.eclipse.jdt.feature.group" version="3.7.2.v20120120-1414-7z8gFcuFMP7BW5XTz0jLTnz0l9B1"/>
 <unit id="org.eclipse.platform.feature.group" version="3.7.2.v20120207-1839-9gF7UHPDFxGjd-PqDr2jX_4yKaumkoHTz04_q-q"/>
+<unit id="org.eclipse.jst.enterprise_ui.feature.feature.group" version="3.3.2.v201111030500-7b7II1YFSK2WIuPRDEnExPV-RvTn"/>
 <repository location="http://download.eclipse.org/releases/indigo"/>
 </location>
 </locations>

Modified: sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/META-INF/MANIFEST.MF?rev=1504905&r1=1504904&r2=1504905&view=diff
==============================================================================
--- sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/META-INF/MANIFEST.MF (original)
+++ sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/META-INF/MANIFEST.MF Fri Jul 19 15:03:52 2013
@@ -5,7 +5,8 @@ Bundle-SymbolicName: org.apache.sling.sl
 Bundle-Version: 0.0.1.qualifier
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-ClassPath: .
-Import-Package: org.apache.sling.slingclipse,
+Import-Package: org.apache.sling.ide.serialization,
+ org.apache.sling.slingclipse,
  org.apache.sling.slingclipse.api,
  org.apache.sling.slingclipse.helper,
  org.eclipse.core.commands,

Modified: sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadBehaviour.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadBehaviour.java?rev=1504905&r1=1504904&r2=1504905&view=diff
==============================================================================
--- sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadBehaviour.java (original)
+++ sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/internal/SlingLaunchpadBehaviour.java Fri Jul 19 15:03:52 2013
@@ -16,26 +16,21 @@
  */
 package org.apache.sling.ide.eclipse.wst.internal;
 
-import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 
+import org.apache.sling.ide.serialization.SerializationManager;
 import org.apache.sling.slingclipse.SlingclipsePlugin;
 import org.apache.sling.slingclipse.api.Command;
 import org.apache.sling.slingclipse.api.FileInfo;
-import org.apache.sling.slingclipse.api.ProtectedNodes;
 import org.apache.sling.slingclipse.api.Repository;
 import org.apache.sling.slingclipse.api.RepositoryInfo;
 import org.apache.sling.slingclipse.api.ResponseType;
 import org.apache.sling.slingclipse.api.Result;
-import org.apache.sling.slingclipse.helper.SlingclipseHelper;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.resources.IResource;
@@ -50,12 +45,15 @@ import org.eclipse.wst.server.core.IServ
 import org.eclipse.wst.server.core.model.IModuleResource;
 import org.eclipse.wst.server.core.model.IModuleResourceDelta;
 import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
-import org.json.JSONException;
-import org.json.JSONML;
-import org.json.JSONObject;
 
 public class SlingLaunchpadBehaviour extends ServerBehaviourDelegate {
 
+    private SerializationManager serializationManager;
+
+    public SlingLaunchpadBehaviour() {
+        serializationManager = SlingclipsePlugin.getDefault().getSerializationManager();
+    }
+
     @Override
     public void stop(boolean force) {
 
@@ -250,45 +248,22 @@ public class SlingLaunchpadBehaviour ext
             return null;
         }
 
-        if (SlingclipseHelper.CONTENT_XML.equals(info.getName())) {
+        if (serializationManager.isSerializationFile(info.getLocation())) {
             try {
                 IFile file = (IFile) resource.getAdapter(IFile.class);
                 InputStream contents = file.getContents();
-                BufferedReader reader = new BufferedReader(new InputStreamReader(contents));
-                StringBuilder out = new StringBuilder();
-                String line;
-                while ((line = reader.readLine()) != null) {
-                    out.append(line);
-                }
-                Map<String, String> properties = getModifiedProperties(out.toString());
-                return repository.newUpdateContentNodeCommand(info, properties);
+                Map<String, String> serializationData = serializationManager.readSerializationData(contents);
+                return repository.newUpdateContentNodeCommand(info, serializationData);
             } catch (IOException e) {
                 // TODO logging
                 e.printStackTrace();
                 return null;
-            } catch (JSONException e) {
-                // TODO logging
-                e.printStackTrace();
-                return null;
             }
         } else {
             return repository.newAddNodeCommand(info);
         }
     }
 
-    private Map<String, String> getModifiedProperties(String fileContent) throws JSONException {
-        Map<String, String> properties = new HashMap<String, String>();
-        JSONObject json = JSONML.toJSONObject(fileContent);
-        json.remove(SlingclipseHelper.TAG_NAME);
-        for (Iterator<?> keys = json.keys(); keys.hasNext();) {
-            String key = (String) keys.next();
-            if (!ProtectedNodes.exists(key) && !key.contains("xmlns")) {
-                properties.put(key, json.optString(key));
-            }
-        }
-        return properties;
-    }
-
     private FileInfo createFileInfo(IModuleResource resource) {
 
         IResource file = (IFile) resource.getAdapter(IFile.class);
@@ -299,19 +274,13 @@ public class SlingLaunchpadBehaviour ext
         if (file == null) {
             // Usually happens on server startup, it seems to be safe to ignore for now
             System.out.println("Got null '" + IFile.class.getSimpleName() + "' and '" + IFolder.class.getSimpleName()
-                    + "'for " + resource);
+                    + "' for " + resource);
             return null;
         }
 
-        IPath rootPath = resource.getModuleRelativePath().removeLastSegments(1); // TODO correct name
-
-        String relativePath = rootPath.toOSString();
-
-        if (file.getName().equals(SlingclipseHelper.CONTENT_XML)) {
-            relativePath = rootPath.removeLastSegments(1).toOSString();
-        }
+        IPath relativePath = resource.getModuleRelativePath().removeLastSegments(1);
 
-        FileInfo info = new FileInfo(file.getLocation().toOSString(), relativePath, file.getName());
+        FileInfo info = new FileInfo(file.getLocation().toOSString(), relativePath.toOSString(), file.getName());
 
         System.out.println("For " + resource + " built fileInfo " + info);
 

Modified: sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/ui/internal/ImportWizard.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/ui/internal/ImportWizard.java?rev=1504905&r1=1504904&r2=1504905&view=diff
==============================================================================
--- sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/ui/internal/ImportWizard.java (original)
+++ sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/ui/internal/ImportWizard.java Fri Jul 19 15:03:52 2013
@@ -22,13 +22,13 @@ import java.util.Iterator;
 
 import org.apache.sling.ide.eclipse.wst.internal.SlingLaunchpadBehaviour;
 import org.apache.sling.ide.eclipse.wst.internal.SlingLaunchpadServer;
+import org.apache.sling.ide.serialization.SerializationManager;
 import org.apache.sling.slingclipse.SlingclipsePlugin;
 import org.apache.sling.slingclipse.api.Command;
 import org.apache.sling.slingclipse.api.Repository;
 import org.apache.sling.slingclipse.api.RepositoryException;
 import org.apache.sling.slingclipse.api.ResponseType;
 import org.apache.sling.slingclipse.api.Result;
-import org.apache.sling.slingclipse.helper.SlingclipseHelper;
 import org.apache.sling.slingclipse.helper.Tracer;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IFolder;
@@ -55,12 +55,14 @@ import org.json.JSONObject;
  */
 public class ImportWizard extends Wizard implements IImportWizard {
 	private ImportWizardPage mainPage;
+    private SerializationManager serializationManager;
 
 	/**
 	 * Construct a new Import Wizard container instance.
 	 */
 	public ImportWizard() {
 		super();
+        serializationManager = SlingclipsePlugin.getDefault().getSerializationManager();
 	}
 
 	/*
@@ -200,9 +202,9 @@ public class ImportWizard extends Wizard
 			createFolder(project, projectRelativePath.append(path));
 			String content = executeCommand(repository.newGetNodeContentCommand(path, ResponseType.JSON), tracer);
 			JSONObject jsonContent = new JSONObject(content);
-			jsonContent.put(SlingclipseHelper.TAG_NAME, Repository.JCR_ROOT);
 			String contentXml = JSONML.toString(jsonContent);		
-			createFile( project, projectRelativePath.append( path+"/"+SlingclipseHelper.CONTENT_XML), contentXml.getBytes(Charset.forName("UTF-8") /* TODO is this enough? */));
+            createFile(project, projectRelativePath.append(serializationManager.getSerializationFilePath(path)),
+                    contentXml.getBytes(Charset.forName("UTF-8") /* TODO is this enough? */));
 		}
  		
         for (Iterator<?> keys = json.keys(); keys.hasNext();) {

Modified: sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/ui/internal/ImportWizardPage.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/ui/internal/ImportWizardPage.java?rev=1504905&r1=1504904&r2=1504905&view=diff
==============================================================================
--- sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/ui/internal/ImportWizardPage.java (original)
+++ sling/whiteboard/asanso/plugins/eclipse/slingclipse-wst/src/org/apache/sling/ide/eclipse/wst/ui/internal/ImportWizardPage.java Fri Jul 19 15:03:52 2013
@@ -21,7 +21,6 @@ import java.util.List;
 
 import org.apache.sling.slingclipse.helper.SlingclipseHelper;
 import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.jface.viewers.IStructuredSelection;
@@ -104,10 +103,6 @@ public class ImportWizardPage extends Wi
     @Override
 	protected void createSourceGroup(Composite parent) {
 
-        // TODO: Currently only supports first selection
-        IResource resource = ((IResource) selection.getFirstElement());
-        String pathStr = resource.getFullPath().toPortableString();
-
 		Composite container = new Composite(parent, SWT.NONE);
 		container.setLayout(new GridLayout(2, false));
 		GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
@@ -135,10 +130,6 @@ public class ImportWizardPage extends Wi
         path = new Text(container, SWT.BORDER);
         path.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
         path.addModifyListener(modifyListener);
-
-        if (SlingclipseHelper.isValidSlingProjectPath(pathStr)) {
-            path.setText(SlingclipseHelper.getSlingProjectPath(pathStr));
-        }
 	}
 
 	/*
@@ -207,9 +198,7 @@ public class ImportWizardPage extends Wi
 			return false;
 		}
 		
-        IPath containerNameField = super.getResourcePath();
-        // TODO - we should force it to be JCR_ROOT for now
-        if (!containerNameField.toOSString().endsWith(SlingclipseHelper.JCR_ROOT)) {
+        if (!getResourcePath().toOSString().endsWith(SlingclipseHelper.JCR_ROOT)) {
 			setErrorMessage("Please enter a valid Sling project folder (e.g. jcr_root)");
 			return false;
 		}