You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by st...@apache.org on 2014/06/12 15:59:46 UTC

svn commit: r1602169 - in /sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal: Activator.java SlingLaunchpadBehaviour.java

Author: stefanegli
Date: Thu Jun 12 13:59:46 2014
New Revision: 1602169

URL: http://svn.apache.org/r1602169
Log:
SLING-3550 related : not doing a bundle deploy if the META-INF/MANIFEST.MF file cannot be found (and issuing a console log message accordingly)

Modified:
    sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/Activator.java
    sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadBehaviour.java

Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/Activator.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/Activator.java?rev=1602169&r1=1602168&r2=1602169&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/Activator.java (original)
+++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/Activator.java Thu Jun 12 13:59:46 2014
@@ -16,17 +16,23 @@
  */
 package org.apache.sling.ide.eclipse.core.internal;
 
+import java.util.HashMap;
+import java.util.Map;
+
 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.apache.sling.ide.filter.FilterLocator;
 import org.apache.sling.ide.osgi.OsgiClientFactory;
 import org.apache.sling.ide.serialization.SerializationManager;
+import org.apache.sling.ide.transport.CommandExecutionProperties;
 import org.apache.sling.ide.transport.RepositoryFactory;
 import org.eclipse.core.runtime.Plugin;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventAdmin;
 import org.osgi.util.tracker.ServiceTracker;
 
 /**
@@ -45,6 +51,7 @@ public class Activator extends Plugin {
 	// The shared instance
 	private static Activator plugin;
 
+    private ServiceTracker<EventAdmin, EventAdmin> eventAdmin;
     private ServiceTracker<RepositoryFactory, RepositoryFactory> repositoryFactory;
     private ServiceTracker<SerializationManager, SerializationManager> serializationManager;
     private ServiceTracker<FilterLocator, FilterLocator> filterLocator;
@@ -59,6 +66,10 @@ public class Activator extends Plugin {
 
         tracerRegistration = PluginLoggerRegistrar.register(this);
 
+        eventAdmin = new ServiceTracker<EventAdmin, EventAdmin>(context, EventAdmin.class,
+                null);
+        eventAdmin.open();
+
         repositoryFactory = new ServiceTracker<RepositoryFactory, RepositoryFactory>(context, RepositoryFactory.class,
                 null);
         repositoryFactory.open();
@@ -127,4 +138,19 @@ public class Activator extends Plugin {
     public PluginLogger getPluginLogger() {
         return (PluginLogger) ServiceUtil.getNotNull(tracer);
     }
+    
+    public void issueConsoleLog(String actionType, String path, String message) {
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put(CommandExecutionProperties.RESULT_TEXT, message);
+        props.put(CommandExecutionProperties.ACTION_TYPE, actionType);
+        props.put(CommandExecutionProperties.ACTION_TARGET, path);
+        props.put(CommandExecutionProperties.TIMESTAMP_START, System.currentTimeMillis());
+        props.put(CommandExecutionProperties.TIMESTAMP_END, System.currentTimeMillis());
+        Event event = new Event(CommandExecutionProperties.REPOSITORY_TOPIC, props);
+        getEventAdmin().postEvent(event);
+    }
+    
+    public EventAdmin getEventAdmin() {
+        return (EventAdmin) ServiceUtil.getNotNull(eventAdmin);
+    }
 }

Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadBehaviour.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadBehaviour.java?rev=1602169&r1=1602168&r2=1602169&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadBehaviour.java (original)
+++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadBehaviour.java Thu Jun 12 13:59:46 2014
@@ -288,6 +288,16 @@ public class SlingLaunchpadBehaviour ext
 
             IFolder outputFolder = (IFolder) project.getWorkspace().getRoot().findMember(javaProject.getOutputLocation());
             IPath outputLocation = outputFolder.getLocation();
+            //ensure the MANIFEST.MF exists - if it doesn't then let the publish fail with a warn (instead of an error)
+            IResource manifest = outputFolder.findMember("META-INF/MANIFEST.MF");
+            if (manifest==null) {
+                Activator.getDefault().getPluginLogger().warn("Project "+project+" does not have a META-INF/MANIFEST.MF (yet) - not publishing this time");
+                Activator.getDefault().issueConsoleLog("InstallBundle", outputFolder.getLocation().toOSString(), "Project "+project+" does not have a META-INF/MANIFEST.MF (yet) - not publishing this time");
+                monitor.done();
+                setModulePublishState(module, IServer.PUBLISH_STATE_FULL);
+                return;
+            }
+            
             monitor.worked(1);
 
             if ( installLocally ) {