ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1510451 - in /ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin: AddArtifactWindow.java VaadinClient.java VaadinServlet.java
Date Mon, 05 Aug 2013 12:31:43 GMT
Author: bramk
Date: Mon Aug  5 12:31:43 2013
New Revision: 1510451

URL: http://svn.apache.org/r1510451
Log:
ACE-403 Added optional configuration param for OBR index filename

Modified:
    ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/AddArtifactWindow.java
    ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinClient.java
    ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinServlet.java

Modified: ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/AddArtifactWindow.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/AddArtifactWindow.java?rev=1510451&r1=1510450&r2=1510451&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/AddArtifactWindow.java
(original)
+++ ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/AddArtifactWindow.java
Mon Aug  5 12:31:43 2013
@@ -280,11 +280,11 @@ abstract class AddArtifactWindow extends
         }
     }
 
-    private static final String REPOSITORY_XML = "repository.xml";
     private static final String XPATH_QUERY = "/repository/resource[@uri]";
 
     private final File m_sessionDir;
     private final URL m_obrUrl;
+    private final String m_repositoryXML;
 
     private final List<File> m_uploadedArtifacts = new ArrayList<File>();
     private final Button m_searchButton;
@@ -297,11 +297,12 @@ abstract class AddArtifactWindow extends
      * @param sessionDir the session directory to temporary place artifacts in;
      * @param obrUrl the URL of the OBR to use.
      */
-    public AddArtifactWindow(File sessionDir, URL obrUrl) {
+    public AddArtifactWindow(File sessionDir, URL obrUrl, String repositoryXML) {
         super("Add artifact");
 
         m_sessionDir = sessionDir;
         m_obrUrl = obrUrl;
+        m_repositoryXML = repositoryXML;
 
         setModal(true);
         setWidth("50em");
@@ -710,7 +711,7 @@ abstract class AddArtifactWindow extends
     private List<OBREntry> parseOBRRepository(URL obrBaseUrl) throws XPathExpressionException,
IOException {
         URL url = null;
         try {
-            url = new URL(obrBaseUrl, REPOSITORY_XML);
+            url = new URL(obrBaseUrl, m_repositoryXML);
         }
         catch (MalformedURLException e) {
             logError("Error retrieving repository.xml from " + obrBaseUrl);

Modified: ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinClient.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinClient.java?rev=1510451&r1=1510450&r2=1510451&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinClient.java
(original)
+++ ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinClient.java
Mon Aug  5 12:31:43 2013
@@ -150,6 +150,7 @@ public class VaadinClient extends com.va
     private Window m_mainWindow;
 
     private final URL m_obrUrl;
+    private final String m_repositoryXML;
     private final URL m_repository;
     private final boolean m_useAuth;
     private final String m_userName;
@@ -198,7 +199,7 @@ public class VaadinClient extends com.va
      * @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(DependencyManager manager, URL aceHost, URL obrUrl, boolean useAuth,
String userName) {
+    public VaadinClient(DependencyManager manager, URL aceHost, URL obrUrl, String repositoryXML,
boolean useAuth, String userName) {
     	m_manager = manager;
         try {
             m_repository = new URL(aceHost, endpoint);
@@ -207,6 +208,7 @@ public class VaadinClient extends com.va
             throw new IllegalArgumentException("Need a valid repository URL!", e);
         }
         m_obrUrl = obrUrl;
+        m_repositoryXML = repositoryXML;
         m_useAuth = useAuth;
         m_userName = userName;
 
@@ -995,7 +997,7 @@ public class VaadinClient extends com.va
     }
 
     private void showAddArtifactDialog() {
-        final AddArtifactWindow window = new AddArtifactWindow(m_sessionDir, m_obrUrl) {
+        final AddArtifactWindow window = new AddArtifactWindow(m_sessionDir, m_obrUrl, m_repositoryXML)
{
             @Override
             protected ArtifactRepository getArtifactRepository() {
                 return m_artifactRepository;

Modified: ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinServlet.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinServlet.java?rev=1510451&r1=1510450&r2=1510451&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinServlet.java
(original)
+++ ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinServlet.java
Mon Aug  5 12:31:43 2013
@@ -26,100 +26,113 @@ import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
 
-import org.apache.ace.authentication.api.AuthenticationService;
-import org.apache.ace.client.repository.SessionFactory;
 import org.apache.felix.dm.DependencyManager;
 import org.osgi.service.cm.ConfigurationException;
 import org.osgi.service.cm.ManagedService;
-import org.osgi.service.log.LogService;
-import org.osgi.service.useradmin.UserAdmin;
 
 import com.vaadin.Application;
 import com.vaadin.terminal.gwt.server.AbstractApplicationServlet;
 import com.vaadin.terminal.gwt.server.WebApplicationContext;
 
 public class VaadinServlet extends AbstractApplicationServlet implements ManagedService {
-    private static final int SESSION_TIMEOUT = 30; // in seconds (so 120 = 2 minutes)
 
-	private static final long serialVersionUID = 1L;
-    
+    private static final int SESSION_TIMEOUT = 30; // in seconds (so 120 = 2 minutes)
+    private static final long serialVersionUID = 1L;
     public static final String PID = "org.apache.ace.webui.vaadin";
-    
+
     /** 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";
 
+    /** A string denoting the URL to the management server's OBR. */
+    private static final String KEY_OBR_XML = "obr.xml";
     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;
-    
+    private volatile String m_repositoryXML;
+
     @Override
     protected Class<? extends Application> getApplicationClass() {
         return VaadinClient.class;
     }
 
     @Override
-    protected Application getNewApplication(HttpServletRequest request)	throws ServletException
{
-        return new VaadinClient(m_manager, m_aceHost, m_obrUrl, m_useAuth, m_userName);
+    protected Application getNewApplication(HttpServletRequest request) throws ServletException
{
+        return new VaadinClient(m_manager, m_aceHost, m_obrUrl, m_repositoryXML, m_useAuth,
+            m_userName);
     }
-    
+
     @Override
-	protected WebApplicationContext getApplicationContext(HttpSession session) {
-		if (session.getMaxInactiveInterval() != SESSION_TIMEOUT) {
-			session.setMaxInactiveInterval(SESSION_TIMEOUT);
-		}
-		return super.getApplicationContext(session);
-	}
+    protected WebApplicationContext getApplicationContext(HttpSession session) {
+        if (session.getMaxInactiveInterval() != SESSION_TIMEOUT) {
+            session.setMaxInactiveInterval(SESSION_TIMEOUT);
+        }
+
+        return super.getApplicationContext(session);
+    }
 
     public void updated(Dictionary dictionary) throws ConfigurationException {
-        if (dictionary != null) {
-            URL aceHost;
-            try {
-                String aceHostString = (String) dictionary.get(KEY_ACE_HOST);
-                if (aceHostString == null) {
-                    throw new ConfigurationException(KEY_ACE_HOST, "Missing property");
-                }
-                aceHost = new URL(aceHostString);
-            }
-            catch (MalformedURLException e) {
-                throw new ConfigurationException(KEY_ACE_HOST, "Is not a valid URL", e);
+        if (dictionary == null) {
+            return;
+        }
+        URL aceHost;
+        try {
+            String aceHostString = (String) dictionary.get(KEY_ACE_HOST);
+            if (aceHostString == null) {
+                throw new ConfigurationException(KEY_ACE_HOST, "Missing property");
             }
+            aceHost = new URL(aceHostString);
+        }
+        catch (MalformedURLException e) {
+            throw new ConfigurationException(KEY_ACE_HOST, "Is not a valid URL", e);
+        }
 
-            URL obrUrl;
-            try {
-                String obrUrlString = (String) dictionary.get(KEY_OBR_URL);
-                if (obrUrlString == null) {
-                    throw new ConfigurationException(KEY_OBR_URL, "Missing property");
-                }
-                obrUrl = new URL(obrUrlString);
-            }
-            catch (MalformedURLException e) {
-                throw new ConfigurationException(KEY_OBR_URL, "Is not a valid URL", e);
+        URL obrUrl;
+        try {
+            String obrUrlString = (String) dictionary.get(KEY_OBR_URL);
+            if (obrUrlString == null) {
+                throw new ConfigurationException(KEY_OBR_URL, "Missing property");
             }
+            obrUrl = new URL(obrUrlString);
+        }
+        catch (MalformedURLException 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 repositoryXML = (String) dictionary.get(KEY_OBR_XML);
+        if ((repositoryXML == null) ||
+            (repositoryXML.trim().length() == 0)) {
+            repositoryXML = "repository.xml";
+        }
 
-            String userNameString = (String) dictionary.get(KEY_USER_NAME);
-            if ((userNameString == null) && !useAuth) {
-                throw new ConfigurationException(KEY_USER_NAME, "Missing value; authentication
is disabled!");
-            }
+        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);
 
-            m_useAuth = useAuth;
-            m_userName = userNameString;
-            m_aceHost = aceHost;
-            m_obrUrl = obrUrl;
+        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;
+        m_repositoryXML = repositoryXML;
     }
 }



Mime
View raw message