ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1329199 [5/5] - in /ace/trunk: ./ ace-authenticationprocessor-basicauth/src/main/java/org/apache/ace/authenticationprocessor/basicauth/ ace-client-automation/src/main/java/org/apache/ace/client/automation/ ace-client-repository-api/src/mai...
Date Mon, 23 Apr 2012 12:15:06 GMT
Modified: ace/trunk/ace-repository-task/pom.xml
URL: http://svn.apache.org/viewvc/ace/trunk/ace-repository-task/pom.xml?rev=1329199&r1=1329198&r2=1329199&view=diff
==============================================================================
--- ace/trunk/ace-repository-task/pom.xml (original)
+++ ace/trunk/ace-repository-task/pom.xml Mon Apr 23 12:15:01 2012
@@ -71,6 +71,10 @@
             <artifactId>org.apache.ace.scheduler.api</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.apache.ace</groupId>
+            <artifactId>org.apache.ace.connectionfactory</artifactId>
+        </dependency>
+        <dependency>
             <groupId>org.osgi</groupId>
             <artifactId>org.osgi.core</artifactId>
         </dependency>

Modified: ace/trunk/ace-repository-task/src/main/java/org/apache/ace/repository/task/Activator.java
URL: http://svn.apache.org/viewvc/ace/trunk/ace-repository-task/src/main/java/org/apache/ace/repository/task/Activator.java?rev=1329199&r1=1329198&r2=1329199&view=diff
==============================================================================
--- ace/trunk/ace-repository-task/src/main/java/org/apache/ace/repository/task/Activator.java (original)
+++ ace/trunk/ace-repository-task/src/main/java/org/apache/ace/repository/task/Activator.java Mon Apr 23 12:15:01 2012
@@ -20,6 +20,7 @@ package org.apache.ace.repository.task;
 
 import java.util.Properties;
 
+import org.apache.ace.connectionfactory.ConnectionFactory;
 import org.apache.ace.discovery.Discovery;
 import org.apache.ace.scheduler.constants.SchedulerConstants;
 import org.apache.felix.dm.DependencyActivatorBase;
@@ -28,15 +29,18 @@ import org.osgi.framework.BundleContext;
 import org.osgi.service.log.LogService;
 
 public class Activator extends DependencyActivatorBase {
+
     @Override
     public void init(BundleContext context, DependencyManager manager) throws Exception {
         Properties props = new Properties();
         props.put(SchedulerConstants.SCHEDULER_NAME_KEY, RepositoryReplicationTask.class.getName());
         props.put(SchedulerConstants.SCHEDULER_DESCRIPTION_KEY, "Synchronizes repositories.");
+
         manager.add(createComponent()
             .setInterface(Runnable.class.getName(), props)
             .setImplementation(RepositoryReplicationTask.class)
             .add(createServiceDependency().setService(Discovery.class).setRequired(true))
+            .add(createServiceDependency().setService(ConnectionFactory.class).setRequired(true))
             .add(createServiceDependency().setService(LogService.class).setRequired(false))
             );
     }

Modified: ace/trunk/ace-repository-task/src/main/java/org/apache/ace/repository/task/RepositoryReplicationTask.java
URL: http://svn.apache.org/viewvc/ace/trunk/ace-repository-task/src/main/java/org/apache/ace/repository/task/RepositoryReplicationTask.java?rev=1329199&r1=1329198&r2=1329199&view=diff
==============================================================================
--- ace/trunk/ace-repository-task/src/main/java/org/apache/ace/repository/task/RepositoryReplicationTask.java (original)
+++ ace/trunk/ace-repository-task/src/main/java/org/apache/ace/repository/task/RepositoryReplicationTask.java Mon Apr 23 12:15:01 2012
@@ -25,6 +25,7 @@ import java.net.URL;
 
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.ace.connectionfactory.ConnectionFactory;
 import org.apache.ace.discovery.Discovery;
 import org.apache.ace.range.RangeIterator;
 import org.apache.ace.range.SortedRangeSet;
@@ -40,51 +41,73 @@ import org.osgi.service.log.LogService;
  * stuff out.
  */
 public class RepositoryReplicationTask implements Runnable {
+    private volatile BundleContext m_context;
     private volatile Discovery m_discovery;
+    private volatile ConnectionFactory m_connectionFactory;
     private volatile LogService m_log;
-    private volatile BundleContext m_context;
 
     public void run() {
         try {
-            URL host = m_discovery.discover();
             ServiceReference[] refs = m_context.getServiceReferences(RepositoryReplication.class.getName(), null);
+            if (refs == null) {
+                return;
+            }
+
             for (ServiceReference ref : refs) {
                 RepositoryReplication repository = (RepositoryReplication) m_context.getService(ref);
-                SortedRangeSet localRange = repository.getRange();
-                Object customer = ref.getProperty("customer");
-                Object name = ref.getProperty("name");
-                String filter = "customer=" + customer + "&name=" + name;
-                URL query = new URL(host, "/replication/query?" + filter);
-                HttpURLConnection connection = (HttpURLConnection) query.openConnection();
-                if (connection.getResponseCode() == HttpServletResponse.SC_OK) {
-                    BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
-                    try {
-                        String line = reader.readLine();
-                        int i = line.lastIndexOf(',');
-                        if (i > 0) {
-                            SortedRangeSet remoteRange = new SortedRangeSet(line.substring(i + 1));
-                            SortedRangeSet delta = localRange.diffDest(remoteRange);
-                            RangeIterator iterator = delta.iterator();
-                            while (iterator.hasNext()) {
-                                long version = iterator.next();
-                                URL get = new URL(host, "/replication/get?" + filter + "&version=" + version);
-                                HttpURLConnection connection2 = (HttpURLConnection) get.openConnection();
-                                repository.put(connection2.getInputStream(), version);
+
+                try {
+                    String filter = getQueryFilter(ref);
+                    URL host = m_discovery.discover();
+                    URL query = new URL(host, "/replication/query?" + filter);
+
+                    HttpURLConnection connection = (HttpURLConnection) m_connectionFactory.createConnection(query);
+
+                    if (connection.getResponseCode() == HttpServletResponse.SC_OK) {
+                        SortedRangeSet localRange = repository.getRange();
+
+                        BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+                        try {
+                            String line = reader.readLine();
+                            int i = line.lastIndexOf(',');
+                            if (i > 0) {
+                                SortedRangeSet remoteRange = new SortedRangeSet(line.substring(i + 1));
+                                SortedRangeSet delta = localRange.diffDest(remoteRange);
+                                RangeIterator iterator = delta.iterator();
+
+                                while (iterator.hasNext()) {
+                                    long version = iterator.next();
+                                    URL get = new URL(host, "/replication/get?" + filter + "&version=" + version);
+                                    
+                                    HttpURLConnection connection2 = (HttpURLConnection) m_connectionFactory.createConnection(get);
+
+                                    repository.put(connection2.getInputStream(), version);
+                                }
                             }
                         }
+                        catch (Exception e) {
+                            m_log.log(LogService.LOG_WARNING, "Error parsing remote range", e);
+                        }
                     }
-                    catch (Exception e) {
-                        m_log.log(LogService.LOG_WARNING, "Error parsing remote range", e);
+                    else {
+                        m_log.log(LogService.LOG_WARNING, "Could not sync repository for customer: " + ref.getProperty("customer") + ", name: " + ref.getProperty("name") + ", because: " + connection.getResponseMessage() + " (" + connection.getResponseCode() + ")");
                     }
                 }
-                else {
-                    m_log.log(LogService.LOG_WARNING, "Could not sync repository for customer " + customer + " name " + name + " because: " + connection.getResponseMessage() + " (" + connection.getResponseCode() + ")");
+                finally {
+                    m_context.ungetService(ref);
                 }
-                m_context.ungetService(ref);
             }
         }
         catch (Exception e) {
             m_log.log(LogService.LOG_WARNING, "Error while replicating", e);
         }
     }
+
+    /**
+     * @param ref
+     * @return
+     */
+    public String getQueryFilter(ServiceReference ref) {
+        return "customer=" + ref.getProperty("customer") + "&name=" + ref.getProperty("name");
+    }
 }
\ No newline at end of file

Modified: ace/trunk/ace-scheduler/src/test/java/org/apache/ace/scheduler/ExecuterTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/ace-scheduler/src/test/java/org/apache/ace/scheduler/ExecuterTest.java?rev=1329199&r1=1329198&r2=1329199&view=diff
==============================================================================
--- ace/trunk/ace-scheduler/src/test/java/org/apache/ace/scheduler/ExecuterTest.java (original)
+++ ace/trunk/ace-scheduler/src/test/java/org/apache/ace/scheduler/ExecuterTest.java Mon Apr 23 12:15:01 2012
@@ -20,6 +20,7 @@ package org.apache.ace.scheduler;
 
 import static org.apache.ace.test.utils.TestUtils.UNIT;
 
+import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
 
@@ -67,4 +68,24 @@ public class ExecuterTest {
         Thread.sleep(100);
         assert m_sem.tryAcquire(1, TimeUnit.SECONDS);
     }
+
+    /* start task, which executes longer than the task interval specifies, causing multiple concurrent tasks to be started. */
+    @Test(groups = { UNIT })
+    public void testTooLongTask() throws Exception {
+        final CountDownLatch latch = new CountDownLatch(5);
+        
+        Executer executer = new Executer(new Runnable() {
+            public void run() {
+                try {
+                    Thread.sleep(20);
+                    latch.countDown();
+                }
+                catch (InterruptedException e) {
+                    e.printStackTrace();
+                }
+            }
+        });
+        executer.start(10);
+        assert latch.await(1, TimeUnit.SECONDS);
+    }
 }

Modified: ace/trunk/ace-scheduler/src/test/java/org/apache/ace/scheduler/SchedulerTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/ace-scheduler/src/test/java/org/apache/ace/scheduler/SchedulerTest.java?rev=1329199&r1=1329198&r2=1329199&view=diff
==============================================================================
--- ace/trunk/ace-scheduler/src/test/java/org/apache/ace/scheduler/SchedulerTest.java (original)
+++ ace/trunk/ace-scheduler/src/test/java/org/apache/ace/scheduler/SchedulerTest.java Mon Apr 23 12:15:01 2012
@@ -23,7 +23,6 @@ import static org.apache.ace.test.utils.
 import java.util.Properties;
 
 import org.apache.ace.test.utils.TestUtils;
-import org.osgi.service.cm.ConfigurationException;
 import org.osgi.service.log.LogService;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;

Modified: ace/trunk/ace-server-log-ui/pom.xml
URL: http://svn.apache.org/viewvc/ace/trunk/ace-server-log-ui/pom.xml?rev=1329199&r1=1329198&r2=1329199&view=diff
==============================================================================
--- ace/trunk/ace-server-log-ui/pom.xml (original)
+++ ace/trunk/ace-server-log-ui/pom.xml Mon Apr 23 12:15:01 2012
@@ -53,6 +53,10 @@
     <dependencies>
         <dependency>
              <groupId>org.apache.ace</groupId>
+             <artifactId>org.apache.ace.client.repository.api</artifactId>
+        </dependency>
+        <dependency>
+             <groupId>org.apache.ace</groupId>
              <artifactId>org.apache.ace.server.log.store</artifactId>
         </dependency>
         <dependency>

Modified: ace/trunk/ace-tageditor/pom.xml
URL: http://svn.apache.org/viewvc/ace/trunk/ace-tageditor/pom.xml?rev=1329199&r1=1329198&r2=1329199&view=diff
==============================================================================
--- ace/trunk/ace-tageditor/pom.xml (original)
+++ ace/trunk/ace-tageditor/pom.xml Mon Apr 23 12:15:01 2012
@@ -65,6 +65,10 @@
         </dependency>
         <dependency>
             <groupId>org.apache.ace</groupId>
+            <artifactId>org.apache.ace.client.repository.api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.ace</groupId>
             <artifactId>org.apache.ace.webui.vaadin</artifactId>
         </dependency>
         <dependency>

Modified: ace/trunk/ace-target-devgateway/pom.xml
URL: http://svn.apache.org/viewvc/ace/trunk/ace-target-devgateway/pom.xml?rev=1329199&r1=1329198&r2=1329199&view=diff
==============================================================================
--- ace/trunk/ace-target-devgateway/pom.xml (original)
+++ ace/trunk/ace-target-devgateway/pom.xml Mon Apr 23 12:15:01 2012
@@ -186,6 +186,11 @@
             <artifactId>org.apache.ace.deployment.task</artifactId>
             <scope>runtime</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.ace</groupId>
+            <artifactId>org.apache.ace.connectionfactory</artifactId>
+            <scope>runtime</scope>
+        </dependency>
     </dependencies>
 
 </project>

Modified: ace/trunk/ace-target-devserver/pom.xml
URL: http://svn.apache.org/viewvc/ace/trunk/ace-target-devserver/pom.xml?rev=1329199&r1=1329198&r2=1329199&view=diff
==============================================================================
--- ace/trunk/ace-target-devserver/pom.xml (original)
+++ ace/trunk/ace-target-devserver/pom.xml Mon Apr 23 12:15:01 2012
@@ -174,6 +174,11 @@
         </dependency>
         <dependency>
             <groupId>org.apache.ace</groupId>
+            <artifactId>org.apache.ace.connectionfactory</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.ace</groupId>
             <artifactId>org.apache.ace.authentication</artifactId>
             <scope>runtime</scope>
         </dependency>

Modified: ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.client.rest.cfg
URL: http://svn.apache.org/viewvc/ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.client.rest.cfg?rev=1329199&r1=1329198&r2=1329199&view=diff
==============================================================================
--- ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.client.rest.cfg (original)
+++ ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.client.rest.cfg Mon Apr 23 12:15:01 2012
@@ -1 +1,2 @@
 org.apache.ace.server.servlet.endpoint=/client
+authentication.enabled=false

Modified: ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.deployment.provider.repositorybased.cfg
URL: http://svn.apache.org/viewvc/ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.deployment.provider.repositorybased.cfg?rev=1329199&r1=1329198&r2=1329199&view=diff
==============================================================================
--- ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.deployment.provider.repositorybased.cfg (original)
+++ ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.deployment.provider.repositorybased.cfg Mon Apr 23 12:15:01 2012
@@ -1,3 +1,3 @@
-url=http://localhost:8080/repository
-name=deployment
-customer=apache
+url = http://localhost:8080/repository
+name = deployment
+customer = apache

Modified: ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.deployment.servlet.cfg
URL: http://svn.apache.org/viewvc/ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.deployment.servlet.cfg?rev=1329199&r1=1329198&r2=1329199&view=diff
==============================================================================
--- ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.deployment.servlet.cfg (original)
+++ ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.deployment.servlet.cfg Mon Apr 23 12:15:01 2012
@@ -1 +1,2 @@
 org.apache.ace.server.servlet.endpoint=/deployment
+authentication.enabled = false

Modified: ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.obr.servlet.cfg
URL: http://svn.apache.org/viewvc/ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.obr.servlet.cfg?rev=1329199&r1=1329198&r2=1329199&view=diff
==============================================================================
--- ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.obr.servlet.cfg (original)
+++ ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.obr.servlet.cfg Mon Apr 23 12:15:01 2012
@@ -1 +1,2 @@
-org.apache.ace.server.servlet.endpoint=/obr
\ No newline at end of file
+org.apache.ace.server.servlet.endpoint=/obr
+authentication.enabled = false

Modified: ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.repository.servlet.RepositoryReplicationServlet.cfg
URL: http://svn.apache.org/viewvc/ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.repository.servlet.RepositoryReplicationServlet.cfg?rev=1329199&r1=1329198&r2=1329199&view=diff
==============================================================================
--- ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.repository.servlet.RepositoryReplicationServlet.cfg (original)
+++ ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.repository.servlet.RepositoryReplicationServlet.cfg Mon Apr 23 12:15:01 2012
@@ -1 +1,2 @@
 org.apache.ace.server.servlet.endpoint=/replication
+authentication.enabled = false

Modified: ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.repository.servlet.RepositoryServlet.cfg
URL: http://svn.apache.org/viewvc/ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.repository.servlet.RepositoryServlet.cfg?rev=1329199&r1=1329198&r2=1329199&view=diff
==============================================================================
--- ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.repository.servlet.RepositoryServlet.cfg (original)
+++ ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.repository.servlet.RepositoryServlet.cfg Mon Apr 23 12:15:01 2012
@@ -1 +1,2 @@
 org.apache.ace.server.servlet.endpoint=/repository
+authentication.enabled = false

Modified: ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.server.log.servlet.factory/auditlog.cfg
URL: http://svn.apache.org/viewvc/ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.server.log.servlet.factory/auditlog.cfg?rev=1329199&r1=1329198&r2=1329199&view=diff
==============================================================================
--- ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.server.log.servlet.factory/auditlog.cfg (original)
+++ ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.server.log.servlet.factory/auditlog.cfg Mon Apr 23 12:15:01 2012
@@ -1,2 +1,3 @@
-name=auditlog
 org.apache.ace.server.servlet.endpoint=/auditlog
+name = auditlog
+authentication.enabled = false

Modified: ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.webui.vaadin.cfg
URL: http://svn.apache.org/viewvc/ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.webui.vaadin.cfg?rev=1329199&r1=1329198&r2=1329199&view=diff
==============================================================================
--- ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.webui.vaadin.cfg (original)
+++ ace/trunk/ace-target-devserver/src/main/resources/conf/org.apache.ace.webui.vaadin.cfg Mon Apr 23 12:15:01 2012
@@ -1,3 +1,10 @@
-org.apache.ace.server.servlet.endpoint=/ace
-aceHost = http://localhost:8080/
-obrUrl = http://localhost:8080/obr/
\ No newline at end of file
+# The endpoint of the Vaadin UI
+org.apache.ace.server.servlet.endpoint = /ace
+# Vaadin UI settings
+ui.authentication.enabled = true
+#ui.authentication.user.name = d
+#ui.authentication.user.password = f
+# ACE MS settings
+ace.host = http://localhost:8080/
+# OBR settings
+obr.url = http://localhost:8080/obr/

Modified: ace/trunk/ace-target-mgmt-ui/pom.xml
URL: http://svn.apache.org/viewvc/ace/trunk/ace-target-mgmt-ui/pom.xml?rev=1329199&r1=1329198&r2=1329199&view=diff
==============================================================================
--- ace/trunk/ace-target-mgmt-ui/pom.xml (original)
+++ ace/trunk/ace-target-mgmt-ui/pom.xml Mon Apr 23 12:15:01 2012
@@ -55,6 +55,10 @@
         </dependency>
         <dependency>
             <groupId>org.apache.ace</groupId>
+            <artifactId>org.apache.ace.client.repository.api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.ace</groupId>
             <artifactId>org.apache.ace.webui.vaadin</artifactId>
         </dependency>
         <dependency>

Modified: ace/trunk/ace-webui-vaadin/pom.xml
URL: http://svn.apache.org/viewvc/ace/trunk/ace-webui-vaadin/pom.xml?rev=1329199&r1=1329198&r2=1329199&view=diff
==============================================================================
--- ace/trunk/ace-webui-vaadin/pom.xml (original)
+++ ace/trunk/ace-webui-vaadin/pom.xml Mon Apr 23 12:15:01 2012
@@ -88,6 +88,10 @@
         </dependency>
         <dependency>
             <groupId>org.apache.ace</groupId>
+            <artifactId>org.apache.ace.connectionfactory</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.ace</groupId>
             <artifactId>org.apache.ace.authentication.api</artifactId>
         </dependency>
         <dependency>

Modified: ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/AddArtifactWindow.java
URL: http://svn.apache.org/viewvc/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/AddArtifactWindow.java?rev=1329199&r1=1329198&r2=1329199&view=diff
==============================================================================
--- ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/AddArtifactWindow.java (original)
+++ ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/AddArtifactWindow.java Mon Apr 23 12:15:01 2012
@@ -287,6 +287,7 @@ abstract class AddArtifactWindow extends
     private final List<File> m_uploadedArtifacts = new ArrayList<File>();
     private final Button m_searchButton;
     private final Button m_closeButton;
+    private final Table m_artifactsTable;
 
     /**
      * Creates a new {@link AddArtifactWindow} instance.
@@ -303,10 +304,10 @@ abstract class AddArtifactWindow extends
         setModal(true);
         setWidth("50em");
 
-        final Table artifacts = new ArtifactTable();
-        artifacts.setCaption("Artifacts in repository");
+        m_artifactsTable = new ArtifactTable();
+        m_artifactsTable.setCaption("Artifacts in repository");
 
-        final IndexedContainer dataSource = (IndexedContainer) artifacts.getContainerDataSource();
+        final IndexedContainer dataSource = (IndexedContainer) m_artifactsTable.getContainerDataSource();
 
         final Table uploadedArtifacts = new ArtifactTable();
         uploadedArtifacts.setCaption("Uploaded artifacts");
@@ -385,7 +386,7 @@ abstract class AddArtifactWindow extends
         m_closeButton = new Button("Add", new ClickListener() {
             public void buttonClick(ClickEvent event) {
                 // Import all "local" (existing) bundles...
-                importLocalBundles(artifacts);
+                importLocalBundles(m_artifactsTable);
                 // Import all "remote" (non existing) bundles...
                 importRemoteBundles(m_uploadedArtifacts);
 
@@ -405,7 +406,7 @@ abstract class AddArtifactWindow extends
         layout.setSpacing(true);
 
         layout.addComponent(searchBar);
-        layout.addComponent(artifacts);
+        layout.addComponent(m_artifactsTable);
         layout.addComponent(uploadArtifact);
         layout.addComponent(finalUploadedArtifacts);
         // The components added to the window are actually added to the window's
@@ -413,14 +414,6 @@ abstract class AddArtifactWindow extends
         layout.addComponent(m_closeButton);
         layout.setComponentAlignment(m_closeButton, Alignment.MIDDLE_RIGHT);
 
-        try {
-            getBundles(artifacts);
-        }
-        catch (Exception e) {
-            showErrorNotification("Failed to retrieve OBR repository!", "Reason: <br/>" + e.getMessage());
-            logError("Failed to retrieve OBR repository!", e);
-        }
-
         searchField.focus();
     }
 
@@ -440,6 +433,25 @@ abstract class AddArtifactWindow extends
             return namedItem.getTextContent();
         }
     }
+    
+    /**
+     * Shows this dialog on the parent window.
+     * 
+     * @param parent the parent for this window, cannot be <code>null</code>.
+     */
+    public final void showWindow(Window parent) {
+        try {
+            // Fill the artifacts table with the data from the OBR...
+            getBundles(m_artifactsTable);
+            
+            parent.addWindow(this);
+        }
+        catch (Exception e) {
+            // We've not yet added this window to the given parent, so we cannot use #showErrorNotification here...
+            parent.showNotification("Failed to retrieve OBR repository!", "Reason: <br/>" + e.getMessage(), Notification.TYPE_ERROR_MESSAGE);
+            logError("Failed to retrieve OBR repository!", e);
+        }
+    }
 
     /**
      * Closes this window.
@@ -556,6 +568,12 @@ abstract class AddArtifactWindow extends
      * @return the log service.
      */
     protected abstract LogService getLogger();
+    
+    /**
+     * @param url the URL to connect to, cannot be <code>null</code>.
+     * @return a valid {@link URLConnection} instance, never <code>null</code>.
+     */
+    protected abstract URLConnection openConnection(URL url) throws IOException;
 
     /**
      * Converts a given artifact object to an OBR entry.
@@ -565,8 +583,7 @@ abstract class AddArtifactWindow extends
      * @return an OBR entry instance, never <code>null</code>.
      */
     private OBREntry convertToOBREntry(ArtifactObject artifactObject, String artifactURL) {
-        return new OBREntry(artifactObject.getName(), artifactObject.getAttribute(BundleHelper.KEY_VERSION), new File(
-            artifactURL).getName());
+        return new OBREntry(artifactObject.getName(), artifactObject.getAttribute(BundleHelper.KEY_VERSION), new File(artifactURL).getName());
     }
 
     /**
@@ -698,9 +715,10 @@ abstract class AddArtifactWindow extends
         InputStream input = null;
         NodeList resources = null;
         try {
-            URLConnection connection = url.openConnection();
+            URLConnection connection = openConnection(url);
             // We always want the newest repository.xml file.
             connection.setUseCaches(false);
+
             input = connection.getInputStream();
 
             try {

Modified: ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java
URL: http://svn.apache.org/viewvc/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java?rev=1329199&r1=1329198&r2=1329199&view=diff
==============================================================================
--- ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java (original)
+++ ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java Mon Apr 23 12:15:01 2012
@@ -20,7 +20,9 @@ package org.apache.ace.webui.vaadin;
 
 import java.io.File;
 import java.io.IOException;
+import java.net.MalformedURLException;
 import java.net.URL;
+import java.net.URLConnection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -49,6 +51,7 @@ import org.apache.ace.client.repository.
 import org.apache.ace.client.repository.repository.FeatureRepository;
 import org.apache.ace.client.repository.stateful.StatefulTargetObject;
 import org.apache.ace.client.repository.stateful.StatefulTargetRepository;
+import org.apache.ace.connectionfactory.ConnectionFactory;
 import org.apache.ace.test.utils.FileUtils;
 import org.apache.ace.webui.NamedObject;
 import org.apache.ace.webui.UIExtensionFactory;
@@ -129,6 +132,7 @@ public class VaadinClient extends com.va
     private volatile Distribution2TargetAssociationRepository m_distribution2targetAssociationRepository;
     private volatile RepositoryAdmin m_admin;
     private volatile LogService m_log;
+    private volatile ConnectionFactory m_connectionFactory;
 
     private String m_sessionID;
     private ArtifactsPanel m_artifactsPanel;
@@ -144,8 +148,10 @@ public class VaadinClient extends com.va
     private Button m_targetToolbar;
     private Window m_mainWindow;
 
-    private final URL m_aceHost;
     private final URL m_obrUrl;
+    private final URL m_repository;
+    private final boolean m_useAuth;
+    private final String m_userName;
 
     private final Associations m_associations = new Associations();
     private final AtomicBoolean m_dependenciesResolved = new AtomicBoolean(false);
@@ -157,9 +163,28 @@ public class VaadinClient extends com.va
         return SESSION_ID++;
     }
 
-    public VaadinClient(URL aceHost, URL obrUrl) {
-        m_aceHost = aceHost;
+    /**
+     * Creates a new {@link VaadinClient} instance.
+     * 
+     * @param aceHost the hostname where the management service can be reached;
+     * @param obrUrl the URL of the OBR to use;
+     * @param useAuth <code>true</code> to use authentication, <code>false</code> to disable authentication;
+     * @param userName the hardcoded username to use when authentication is disabled.
+     */
+    public VaadinClient(URL aceHost, URL obrUrl, boolean useAuth, String userName) {
+        try {
+            m_repository = new URL(aceHost, endpoint);
+        }
+        catch (MalformedURLException e) {
+            throw new IllegalArgumentException("Need a valid repository URL!", e);
+        }
         m_obrUrl = obrUrl;
+        m_useAuth = useAuth;
+        m_userName = userName;
+
+        if (!m_useAuth && (m_userName == null || "".equals(m_userName.trim()))) {
+            throw new IllegalArgumentException("Need a valid user name when no authentication is used!");
+        }
     }
 
     public void setupDependencies(Component component) {
@@ -168,26 +193,17 @@ public class VaadinClient extends com.va
         dir.mkdir();
         m_sessionDir = dir;
         m_sessionFactory.createSession(m_sessionID);
-        addDependency(component, RepositoryAdmin.class);
-        addDependency(component, DistributionRepository.class);
-        addDependency(component, ArtifactRepository.class);
-        addDependency(component, FeatureRepository.class);
-        addDependency(component, Artifact2FeatureAssociationRepository.class);
-        addDependency(component, Feature2DistributionAssociationRepository.class);
-        addDependency(component, Distribution2TargetAssociationRepository.class);
-        addDependency(component, StatefulTargetRepository.class);
-    }
-
-    // @formatter:off
-    private void addDependency(Component component, Class service) {
-        component.add(m_manager.createServiceDependency()
-            .setService(service, "(" + SessionFactory.SERVICE_SID + "=" + m_sessionID + ")")
-            .setRequired(true)
-            .setInstanceBound(true));
+        addSessionDependency(component, RepositoryAdmin.class);
+        addSessionDependency(component, DistributionRepository.class);
+        addSessionDependency(component, ArtifactRepository.class);
+        addSessionDependency(component, FeatureRepository.class);
+        addSessionDependency(component, Artifact2FeatureAssociationRepository.class);
+        addSessionDependency(component, Feature2DistributionAssociationRepository.class);
+        addSessionDependency(component, Distribution2TargetAssociationRepository.class);
+        addSessionDependency(component, StatefulTargetRepository.class);
+        addDependency(component, ConnectionFactory.class);
     }
 
-    // @formatter:on
-
     public void start() {
         m_log.log(LogService.LOG_INFO, "Starting session #" + m_sessionID);
         m_dependenciesResolved.set(true);
@@ -230,7 +246,8 @@ public class VaadinClient extends com.va
 
         setMainWindow(m_mainWindow);
 
-        showLoginWindow();
+        // Authenticate the user either by showing a login window; or by another means...
+        authenticate();
     }
 
     /**
@@ -238,9 +255,9 @@ public class VaadinClient extends com.va
      */
     private void showLoginWindow() {
         LoginWindow loginWindow = new LoginWindow(m_log, this);
-        
+
         m_mainWindow.addWindow(loginWindow);
-        
+
         loginWindow.center();
     }
 
@@ -350,7 +367,7 @@ public class VaadinClient extends com.va
             protected void associateFromRight(String left, String right) {
                 ArtifactObject artifact = getArtifact(left);
                 // if you drop on a resource processor, and try to get it, you
-                // will get null because you cannot associate anything with a 
+                // will get null because you cannot associate anything with a
                 // resource processor so we check for null here
                 if (artifact != null) {
                     if (m_dynamicRelations) {
@@ -369,7 +386,7 @@ public class VaadinClient extends com.va
             protected void associateFromLeft(String left, String right) {
                 ArtifactObject artifact = getArtifact(left);
                 // if you drop on a resource processor, and try to get it, you
-                // will get null because you cannot associate anything with a 
+                // will get null because you cannot associate anything with a
                 // resource processor so we check for null here
                 if (artifact != null) {
                     if (m_dynamicRelations) {
@@ -423,7 +440,8 @@ public class VaadinClient extends com.va
         addListener(m_artifactsPanel, ArtifactObject.TOPIC_ALL, RepositoryAdmin.TOPIC_STATUSCHANGED);
         addListener(m_featuresPanel, FeatureObject.TOPIC_ALL, RepositoryAdmin.TOPIC_STATUSCHANGED);
         addListener(m_distributionsPanel, DistributionObject.TOPIC_ALL, RepositoryAdmin.TOPIC_STATUSCHANGED);
-        addListener(m_targetsPanel, StatefulTargetObject.TOPIC_ALL, TargetObject.TOPIC_ALL, RepositoryAdmin.TOPIC_STATUSCHANGED);
+        addListener(m_targetsPanel, StatefulTargetObject.TOPIC_ALL, TargetObject.TOPIC_ALL,
+            RepositoryAdmin.TOPIC_STATUSCHANGED);
 
         m_mainWindow.addComponent(m_grid);
     }
@@ -453,31 +471,32 @@ public class VaadinClient extends com.va
      * {@inheritDoc}
      */
     public boolean login(String username, String password) {
-        try {
-            User user = m_authenticationService.authenticate(username, password);
-            if (user == null) {
-                return false;
-            }
+        User user = m_authenticationService.authenticate(username, password);
+        setUser(user);
+        return login(user);
+    }
 
-            RepositoryAdminLoginContext context = m_admin.createLoginContext(user);
+    private void addSessionDependency(Component component, Class service) {
+        component.add(m_manager.createServiceDependency()
+            .setService(service, "(" + SessionFactory.SERVICE_SID + "=" + m_sessionID + ")")
+            .setRequired(true)
+            .setInstanceBound(true));
+    }
 
-            // @formatter:off
-            context.addShopRepository(new URL(m_aceHost, endpoint), customerName, shopRepo, true)
-                .setObrBase(m_obrUrl)
-                .addTargetRepository(new URL(m_aceHost, endpoint), customerName, targetRepo, true)
-                .addDeploymentRepository(new URL(m_aceHost, endpoint), customerName, deployRepo, true);
-            // @formatter:on
-            
-            m_admin.login(context);
-            initGrid(user);
-            m_admin.checkout();
-            
-            return true;
-        }
-        catch (IOException e) {
-            m_log.log(LogService.LOG_WARNING, "Login failed!", e);
-            return false;
-        }
+    private void addDependency(Component component, Class service) {
+        component.add(m_manager.createServiceDependency()
+            .setService(service)
+            .setRequired(true)
+            .setInstanceBound(true));
+    }
+
+    /**
+     * @return <code>true</code> if the login succeeded, <code>false</code> otherwise.
+     */
+    private boolean loginAutomatically() {
+        User user = m_userAdmin.getUser("username", m_userName);
+        setUser(user);
+        return login(user);
     }
 
     private void addListener(final Object implementation, final String... topics) {
@@ -492,8 +511,22 @@ public class VaadinClient extends com.va
         // @formatter:on
     }
 
+    /**
+     * Determines how authentication should take place.
+     */
+    private void authenticate() {
+        if (m_useAuth) {
+            showLoginWindow();
+        }
+        else {
+            // Not using authentication; use fallback scenario...
+            loginAutomatically();
+        }
+    }
+
     private GridLayout createToolbar() {
-        MainActionToolbar mainActionToolbar = new MainActionToolbar() {
+        final boolean showLogoutButton = m_useAuth;
+        MainActionToolbar mainActionToolbar = new MainActionToolbar(showLogoutButton) {
             @Override
             protected RepositoryAdmin getRepositoryAdmin() {
                 return m_admin;
@@ -540,14 +573,15 @@ public class VaadinClient extends com.va
                     protected void onOk(String name, String description) throws Exception {
                         object.setDescription(description);
                     }
-                    
+
                     @Override
                     protected void handleError(Exception e) {
-                        getWindow().showNotification("Failed to edit artifact!", "<br/>Reason: " + e.getMessage(), Notification.TYPE_ERROR_MESSAGE);
+                        getWindow().showNotification("Failed to edit artifact!", "<br/>Reason: " + e.getMessage(),
+                            Notification.TYPE_ERROR_MESSAGE);
                     }
                 };
             }
-            
+
             @Override
             protected ArtifactRepository getRepository() {
                 return m_artifactRepository;
@@ -569,14 +603,15 @@ public class VaadinClient extends com.va
                     protected void onOk(String name, String description) throws Exception {
                         object.setDescription(description);
                     }
-                    
+
                     @Override
                     protected void handleError(Exception e) {
-                        getWindow().showNotification("Failed to edit feature!", "<br/>Reason: " + e.getMessage(), Notification.TYPE_ERROR_MESSAGE);
+                        getWindow().showNotification("Failed to edit feature!", "<br/>Reason: " + e.getMessage(),
+                            Notification.TYPE_ERROR_MESSAGE);
                     }
                 };
             }
-            
+
             @Override
             protected FeatureRepository getRepository() {
                 return m_featureRepository;
@@ -598,14 +633,15 @@ public class VaadinClient extends com.va
                     protected void onOk(String name, String description) throws Exception {
                         object.setDescription(description);
                     }
-                    
+
                     @Override
                     protected void handleError(Exception e) {
-                        getWindow().showNotification("Failed to edit distribution!", "<br/>Reason: " + e.getMessage(), Notification.TYPE_ERROR_MESSAGE);
+                        getWindow().showNotification("Failed to edit distribution!", "<br/>Reason: " + e.getMessage(),
+                            Notification.TYPE_ERROR_MESSAGE);
                     }
                 };
             }
-            
+
             @Override
             protected DistributionRepository getRepository() {
                 return m_distributionRepository;
@@ -627,10 +663,11 @@ public class VaadinClient extends com.va
                     protected void onOk(String name, String description) throws Exception {
                         // Nothing to edit!
                     }
-                    
+
                     @Override
                     protected void handleError(Exception e) {
-                        getWindow().showNotification("Failed to edit target!", "<br/>Reason: " + e.getMessage(), Notification.TYPE_ERROR_MESSAGE);
+                        getWindow().showNotification("Failed to edit target!", "<br/>Reason: " + e.getMessage(),
+                            Notification.TYPE_ERROR_MESSAGE);
                     }
 
                     @Override
@@ -638,7 +675,7 @@ public class VaadinClient extends com.va
                         m_name.setCaption("Identifier");
                         m_name.setReadOnly(true);
                         m_description.setVisible(false);
-                        
+
                         super.initDialog(object, factories);
                     }
                 };
@@ -747,7 +784,8 @@ public class VaadinClient extends com.va
 
                     public void handleError(Exception e) {
                         // ACE-241: notify user when the feature-creation failed!
-                        getWindow().showNotification("Failed to add new feature!", "<br/>Reason: " + e.getMessage(), Notification.TYPE_ERROR_MESSAGE);
+                        getWindow().showNotification("Failed to add new feature!", "<br/>Reason: " + e.getMessage(),
+                            Notification.TYPE_ERROR_MESSAGE);
                     }
                 };
                 window.show(getMainWindow());
@@ -773,7 +811,8 @@ public class VaadinClient extends com.va
 
                     public void handleError(Exception e) {
                         // ACE-241: notify user when the distribution-creation failed!
-                        getWindow().showNotification("Failed to add new distribution!", "<br/>Reason: " + e.getMessage(), Notification.TYPE_ERROR_MESSAGE);
+                        getWindow().showNotification("Failed to add new distribution!",
+                            "<br/>Reason: " + e.getMessage(), Notification.TYPE_ERROR_MESSAGE);
                     }
                 };
                 window.show(getMainWindow());
@@ -800,7 +839,8 @@ public class VaadinClient extends com.va
 
                     protected void handleError(Exception e) {
                         // ACE-241: notify user when the target-creation failed!
-                        getWindow().showNotification("Failed to add new target!", "<br/>Reason: " + e.getMessage(), Notification.TYPE_ERROR_MESSAGE);
+                        getWindow().showNotification("Failed to add new target!", "<br/>Reason: " + e.getMessage(),
+                            Notification.TYPE_ERROR_MESSAGE);
                     }
 
                     @Override
@@ -887,6 +927,11 @@ public class VaadinClient extends com.va
             protected ArtifactRepository getArtifactRepository() {
                 return m_artifactRepository;
             }
+            
+            @Override
+            protected URLConnection openConnection(URL url) throws IOException {
+                return m_connectionFactory.createConnection(url);
+            }
 
             @Override
             protected LogService getLogger() {
@@ -895,6 +940,37 @@ public class VaadinClient extends com.va
         };
 
         // Open the subwindow by adding it to the parent window
-        getMainWindow().addWindow(window);
+        window.showWindow(getMainWindow());
+    }
+
+    /**
+     * Authenticates the given user by creating all dependent services.
+     * 
+     * @param user
+     * @throws IOException in case of I/O problems.
+     */
+    private boolean login(final User user) {
+        try {
+            RepositoryAdminLoginContext context = m_admin.createLoginContext(user);
+            
+            // @formatter:off
+            context.setObrBase(m_obrUrl)
+                .add(context.createShopRepositoryContext()
+                    .setLocation(m_repository).setCustomer(customerName).setName(shopRepo).setWriteable())
+                .add(context.createTargetRepositoryContext()
+                    .setLocation(m_repository).setCustomer(customerName).setName(targetRepo).setWriteable())
+                .add(context.createDeploymentRepositoryContext()
+                    .setLocation(m_repository).setCustomer(customerName).setName(deployRepo).setWriteable());
+            // @formatter:on
+
+            m_admin.login(context);
+            initGrid(user);
+            m_admin.checkout();
+            return true;
+        }
+        catch (Exception e) {
+            m_log.log(LogService.LOG_WARNING, "Login failed!", e);
+            return false;
+        }
     }
 }

Modified: ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinServlet.java
URL: http://svn.apache.org/viewvc/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinServlet.java?rev=1329199&r1=1329198&r2=1329199&view=diff
==============================================================================
--- ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinServlet.java (original)
+++ ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinServlet.java Mon Apr 23 12:15:01 2012
@@ -41,11 +41,19 @@ public class VaadinServlet extends Abstr
     
     public static final String PID = "org.apache.ace.webui.vaadin";
     
-    public static final String ACE_HOST = "aceHost";
-    public static final String OBR_URL = "obrUrl";
+    /** A boolean denoting whether or not authentication is enabled. */
+    private static final String KEY_USE_AUTHENTICATION = "ui.authentication.enabled";
+    /** Name of the user to log in as. */
+    private static final String KEY_USER_NAME = "ui.authentication.user.name";
+    /** A string denoting the host name of the management service. */
+    private static final String KEY_ACE_HOST = "ace.host";
+    /** A string denoting the URL to the management server's OBR. */
+    private static final String KEY_OBR_URL = "obr.url";
 
     private volatile DependencyManager m_manager;
 
+    private volatile boolean m_useAuth;
+    private volatile String m_userName;
     private volatile URL m_aceHost;
     private volatile URL m_obrUrl;
     
@@ -56,7 +64,7 @@ public class VaadinServlet extends Abstr
 
     @Override
     protected Application getNewApplication(HttpServletRequest request)	throws ServletException {
-        Application application = new VaadinClient(m_aceHost, m_obrUrl);
+        Application application = new VaadinClient(m_aceHost, m_obrUrl, m_useAuth, m_userName);
         m_manager.add(m_manager.createComponent()
             .setImplementation(application)
             .setCallbacks("setupDependencies", "start", "stop", "destroyDependencies")
@@ -70,7 +78,7 @@ public class VaadinServlet extends Abstr
             )
             .add(m_manager.createServiceDependency()
                 .setService(AuthenticationService.class)
-                .setRequired(true)
+                .setRequired(m_useAuth)
             )
             .add(m_manager.createServiceDependency()
                 .setService(LogService.class)
@@ -84,28 +92,41 @@ public class VaadinServlet extends Abstr
         if (dictionary != null) {
             URL aceHost;
             try {
-                String aceHostString = (String) dictionary.get(ACE_HOST);
+                String aceHostString = (String) dictionary.get(KEY_ACE_HOST);
                 if (aceHostString == null) {
-                    throw new ConfigurationException(ACE_HOST, "Missing property");
+                    throw new ConfigurationException(KEY_ACE_HOST, "Missing property");
                 }
                 aceHost = new URL(aceHostString);
             }
             catch (MalformedURLException e) {
-                throw new ConfigurationException(ACE_HOST, "Is not a valid URL", e);
+                throw new ConfigurationException(KEY_ACE_HOST, "Is not a valid URL", e);
             }
 
             URL obrUrl;
             try {
-                String obrUrlString = (String) dictionary.get(OBR_URL);
+                String obrUrlString = (String) dictionary.get(KEY_OBR_URL);
                 if (obrUrlString == null) {
-                    throw new ConfigurationException(OBR_URL, "Missing property");
+                    throw new ConfigurationException(KEY_OBR_URL, "Missing property");
                 }
                 obrUrl = new URL(obrUrlString);
             }
             catch (MalformedURLException e) {
-                throw new ConfigurationException(OBR_URL, "Is not a valid URL", e);
+                throw new ConfigurationException(KEY_OBR_URL, "Is not a valid URL", e);
+            }
+
+            String useAuthString = (String) dictionary.get(KEY_USE_AUTHENTICATION);
+            if (useAuthString == null || !("true".equalsIgnoreCase(useAuthString) || "false".equalsIgnoreCase(useAuthString))) {
+                throw new ConfigurationException(KEY_USE_AUTHENTICATION, "Missing or invalid value!");
+            }
+            boolean useAuth = Boolean.parseBoolean(useAuthString);
+
+            String userNameString = (String) dictionary.get(KEY_USER_NAME);
+            if ((userNameString == null) && !useAuth) {
+                throw new ConfigurationException(KEY_USER_NAME, "Missing value; authentication is disabled!");
             }
 
+            m_useAuth = useAuth;
+            m_userName = userNameString;
             m_aceHost = aceHost;
             m_obrUrl = obrUrl;
         }

Modified: ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/component/MainActionToolbar.java
URL: http://svn.apache.org/viewvc/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/component/MainActionToolbar.java?rev=1329199&r1=1329198&r2=1329199&view=diff
==============================================================================
--- ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/component/MainActionToolbar.java (original)
+++ ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/component/MainActionToolbar.java Mon Apr 23 12:15:01 2012
@@ -38,7 +38,7 @@ public abstract class MainActionToolbar 
      * Provides a button listener for the logout button.
      */
     private class LogoutButtonListener implements Button.ClickListener, ConfirmationDialog.Callback {
-        
+
         /**
          * {@inheritDoc}
          */
@@ -46,14 +46,18 @@ public abstract class MainActionToolbar 
             final RepositoryAdmin repoAdmin = getRepositoryAdmin();
             try {
                 if (repoAdmin.isModified() && repoAdmin.isCurrent()) {
-                    getWindow().addWindow(new ConfirmationDialog("Revert changes?", "The repository is changed. Are you sure you want to loose all local changes?", this));
+                    getWindow().addWindow(
+                        new ConfirmationDialog("Revert changes?",
+                            "The repository is changed. Are you sure you want to loose all local changes?", this));
                 }
                 else {
                     logout();
                 }
             }
             catch (IOException e) {
-                getWindow().showNotification("Changes not stored", "Failed to store the changes to the server.<br />Reason: " + e.getMessage(), Notification.TYPE_ERROR_MESSAGE);
+                getWindow().showNotification("Changes not stored",
+                    "Failed to store the changes to the server.<br />Reason: " + e.getMessage(),
+                    Notification.TYPE_ERROR_MESSAGE);
             }
         }
 
@@ -75,7 +79,9 @@ public abstract class MainActionToolbar 
          * @param e the exception to handle.
          */
         private void handleIOException(IOException e) {
-            getWindow().showNotification("Warning", "There were errors during the logout procedure.<br />Reason: " + e.getMessage(), Notification.TYPE_ERROR_MESSAGE);
+            getWindow().showNotification("Warning",
+                "There were errors during the logout procedure.<br />Reason: " + e.getMessage(),
+                Notification.TYPE_ERROR_MESSAGE);
         }
 
         /**
@@ -102,7 +108,9 @@ public abstract class MainActionToolbar 
             try {
                 if (repoAdmin.isModified()) {
                     // Warn the user about the possible loss of changes...
-                    getWindow().addWindow(new ConfirmationDialog("Retrieve latest changes?", "The repository is changed. Are you sure you want to loose all local changes?", this));
+                    getWindow().addWindow(
+                        new ConfirmationDialog("Retrieve latest changes?",
+                            "The repository is changed. Are you sure you want to loose all local changes?", this));
                 }
                 else {
                     retrieveData();
@@ -131,7 +139,9 @@ public abstract class MainActionToolbar 
          * @param e the exception to handle.
          */
         private void handleIOException(IOException e) {
-            getWindow().showNotification("Retrieve failed", "Failed to retrieve the data from the server.<br />Reason: " + e.getMessage(), Notification.TYPE_ERROR_MESSAGE);
+            getWindow().showNotification("Retrieve failed",
+                "Failed to retrieve the data from the server.<br />Reason: " + e.getMessage(),
+                Notification.TYPE_ERROR_MESSAGE);
         }
 
         /**
@@ -144,7 +154,7 @@ public abstract class MainActionToolbar 
             doAfterRetrieve();
         }
     }
-    
+
     /**
      * Provides a button listener for the revert button.
      */
@@ -157,11 +167,14 @@ public abstract class MainActionToolbar 
             try {
                 if (getRepositoryAdmin().isModified()) {
                     // Revert all changes...
-                    getWindow().addWindow(new ConfirmationDialog("Revert changes?", "Are you sure you want to overwrite all local changes?", this));
+                    getWindow().addWindow(
+                        new ConfirmationDialog("Revert changes?",
+                            "Are you sure you want to overwrite all local changes?", this));
                 }
                 else {
                     // Nothing to revert...
-                    getWindow().showNotification("Nothing to revert", "There are no local changes that need to be reverted.", Notification.TYPE_WARNING_MESSAGE);
+                    getWindow().showNotification("Nothing to revert",
+                        "There are no local changes that need to be reverted.", Notification.TYPE_WARNING_MESSAGE);
                 }
             }
             catch (IOException e) {
@@ -187,7 +200,8 @@ public abstract class MainActionToolbar 
          * @param e the exception to handle.
          */
         private void handleIOException(IOException e) {
-            getWindow().showNotification("Revert failed", "Failed to revert your changes.<br />Reason: " + e.getMessage(), Notification.TYPE_ERROR_MESSAGE);
+            getWindow().showNotification("Revert failed",
+                "Failed to revert your changes.<br />Reason: " + e.getMessage(), Notification.TYPE_ERROR_MESSAGE);
         }
 
         /**
@@ -217,15 +231,21 @@ public abstract class MainActionToolbar 
                         commitChanges();
                     }
                     else {
-                        getWindow().showNotification("Changes not stored", "Unable to store your changes; repository changed!", Notification.TYPE_WARNING_MESSAGE);
+                        getWindow().showNotification("Changes not stored",
+                            "Unable to store your changes; repository changed!", Notification.TYPE_WARNING_MESSAGE);
                     }
                 }
                 else {
-                    getWindow().showNotification("Nothing to store", "There are no changes that can be stored to the repository.", Notification.TYPE_WARNING_MESSAGE);
+                    getWindow()
+                        .showNotification("Nothing to store",
+                            "There are no changes that can be stored to the repository.",
+                            Notification.TYPE_WARNING_MESSAGE);
                 }
             }
             catch (IOException e) {
-                getWindow().showNotification("Changes not stored", "Failed to store the changes to the server.<br />Reason: " + e.getMessage(), Notification.TYPE_ERROR_MESSAGE);
+                getWindow().showNotification("Changes not stored",
+                    "Failed to store the changes to the server.<br />Reason: " + e.getMessage(),
+                    Notification.TYPE_ERROR_MESSAGE);
             }
         }
 
@@ -240,6 +260,8 @@ public abstract class MainActionToolbar 
         }
     }
 
+    private final boolean m_showLogoutButton;
+
     private Button m_retrieveButton;
     private Button m_storeButton;
     private Button m_revertButton;
@@ -247,10 +269,14 @@ public abstract class MainActionToolbar 
 
     /**
      * Creates a new {@link MainActionToolbar} instance.
+     * 
+     * @param showLogoutButton <code>true</code> if a logout button should be shown, <code>false</code> if it should not.
      */
-    public MainActionToolbar() {
+    public MainActionToolbar(boolean showLogoutButton) {
         super(5, 1);
 
+        m_showLogoutButton = showLogoutButton;
+
         setWidth("100%");
         setSpacing(true);
 
@@ -262,14 +288,17 @@ public abstract class MainActionToolbar 
      */
     public void handleEvent(org.osgi.service.event.Event event) {
         String topic = event.getTopic();
-        if (RepositoryAdmin.TOPIC_STATUSCHANGED.equals(topic) || RepositoryAdmin.TOPIC_REFRESH.equals(topic) || RepositoryAdmin.TOPIC_LOGIN.equals(topic)) {
+        if (RepositoryAdmin.TOPIC_STATUSCHANGED.equals(topic) || RepositoryAdmin.TOPIC_REFRESH.equals(topic)
+            || RepositoryAdmin.TOPIC_LOGIN.equals(topic)) {
 
             boolean modified = false;
             try {
                 modified = getRepositoryAdmin().isModified();
             }
             catch (IOException e) {
-                getWindow().showNotification("Communication failed!", "Failed to communicate with the server.<br />Reason: " + e.getMessage(), Notification.TYPE_ERROR_MESSAGE);
+                getWindow().showNotification("Communication failed!",
+                    "Failed to communicate with the server.<br />Reason: " + e.getMessage(),
+                    Notification.TYPE_ERROR_MESSAGE);
             }
 
             m_storeButton.setEnabled(modified);
@@ -297,7 +326,7 @@ public abstract class MainActionToolbar 
      * @throws IOException
      */
     protected abstract void doAfterRetrieve() throws IOException;
-    
+
     /**
      * Called after a revert has taken place, allows additional UI-updates to be performed.
      * 
@@ -325,15 +354,17 @@ public abstract class MainActionToolbar 
         m_revertButton = new Button("Revert");
         m_revertButton.addListener(new RevertButtonListener());
         addComponent(m_revertButton, 2, 0);
-        
+
         Label spacer = new Label(" ");
         addComponent(spacer, 3, 0);
-        
+
         m_logoutButton = new Button("Logout");
         m_logoutButton.addListener(new LogoutButtonListener());
-        addComponent(m_logoutButton, 4, 0);
+        if (m_showLogoutButton) {
+            addComponent(m_logoutButton, 4, 0);
+        }
 
-        // Ensure the spacer gets all the excessive room, causing the logout 
+        // Ensure the spacer gets all the excessive room, causing the logout
         // button to appear at the right side of the screen....
         setColumnExpandRatio(3, 5);
     }

Modified: ace/trunk/pom.xml
URL: http://svn.apache.org/viewvc/ace/trunk/pom.xml?rev=1329199&r1=1329198&r2=1329199&view=diff
==============================================================================
--- ace/trunk/pom.xml (original)
+++ ace/trunk/pom.xml Mon Apr 23 12:15:01 2012
@@ -74,6 +74,8 @@
         <module>ace-client-repository-helper-user</module>
         <module>ace-client-automation</module>
 
+        <module>ace-connectionfactory</module>
+
         <module>ace-client-rest</module>
 
         <module>ace-deployment-provider-api</module>
@@ -106,7 +108,9 @@
         <module>ace-resourceprocessor-useradmin</module>
         <module>ace-configurator-useradmin-task</module>
 
+<!-- XXX no longer in use?
         <module>ace-client-repository-useradmin</module>
+-->
 
         <module>ace-server-action</module>
         <module>ace-server-action-popupmessage</module>

Modified: ace/trunk/pom/pom.xml
URL: http://svn.apache.org/viewvc/ace/trunk/pom/pom.xml?rev=1329199&r1=1329198&r2=1329199&view=diff
==============================================================================
--- ace/trunk/pom/pom.xml (original)
+++ ace/trunk/pom/pom.xml Mon Apr 23 12:15:01 2012
@@ -501,6 +501,11 @@
             </dependency>
             <dependency>
                 <groupId>org.apache.ace</groupId>
+                <artifactId>org.apache.ace.connectionfactory</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.ace</groupId>
                 <artifactId>org.apache.ace.httplistener</artifactId>
                 <version>${project.version}</version>
             </dependency>



Mime
View raw message