Author: stefanegli
Date: Tue May 20 15:16:53 2014
New Revision: 1596286

URL: http://svn.apache.org/r1596286
Log:
SLING-3587 : only publishing when the corresponding server is configured to 
auto-publish-on-resource-change (ignoring the delay for now)

Modified:
    
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ServerUtil.java

Modified: 
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ServerUtil.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ServerUtil.java?rev=1596286&r1=1596285&r2=1596286&view=diff
==============================================================================
--- 
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ServerUtil.java
 (original)
+++ 
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ServerUtil.java
 Tue May 20 15:16:53 2014
@@ -40,6 +40,15 @@ import org.eclipse.wst.server.core.Serve
 
 public abstract class ServerUtil {
     
+    //TODO: SLING-3587 - following constants are from wst.Server - an internal 
class
+    // we should replace this with proper API - but afaik this information is 
not
+    // accessible via any API ..
+    private static final int AUTO_PUBLISH_DISABLE = 1;
+    private static final int AUTO_PUBLISH_RESOURCE = 2;
+    private static final int AUTO_PUBLISH_BUILD = 3;
+    private static final String PROP_AUTO_PUBLISH_SETTING = 
"auto-publish-setting";
+    private static final String PROP_AUTO_PUBLISH_TIME = "auto-publish-time";
+
     public static Repository getDefaultRepository(IProject project) {
         IServer server = getDefaultServer(project);
         try {
@@ -167,7 +176,12 @@ public abstract class ServerUtil {
             for (Iterator it = servers.iterator(); it.hasNext();) {
                 IServer aServer = (IServer) it.next();
                 if (aServer!=null) {
-                    aServer.publish(IServer.PUBLISH_INCREMENTAL, 
monitorOrNull);
+                    int autoPublishSetting = 
aServer.getAttribute(PROP_AUTO_PUBLISH_SETTING, AUTO_PUBLISH_RESOURCE);
+                    int autoPublishTime = 
aServer.getAttribute(PROP_AUTO_PUBLISH_TIME, 15);
+                    if (autoPublishSetting==AUTO_PUBLISH_RESOURCE) {
+                        //TODO: ignoring the autoPublishTime - SLING-3587
+                        aServer.publish(IServer.PUBLISH_INCREMENTAL, 
monitorOrNull);
+                    }
                 }
             }
         }


Reply via email to