incubator-ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r794263 - in /incubator/ace/trunk/webui: src/org/apache/ace/client/ src/org/apache/ace/client/services/ src/org/apache/ace/server/ war/ war/WEB-INF/
Date Wed, 15 Jul 2009 13:23:29 GMT
Author: marrs
Date: Wed Jul 15 13:23:28 2009
New Revision: 794263

URL: http://svn.apache.org/viewvc?rev=794263&view=rev
Log:
ACE-28 applied the ace-28.patch

Added:
    incubator/ace/trunk/webui/src/org/apache/ace/client/services/AssociationService.java 
 (with props)
    incubator/ace/trunk/webui/src/org/apache/ace/client/services/AssociationServiceAsync.java
  (with props)
    incubator/ace/trunk/webui/src/org/apache/ace/server/AssociationServiceImpl.java   (with
props)
Modified:
    incubator/ace/trunk/webui/src/org/apache/ace/client/BundleTable.java
    incubator/ace/trunk/webui/src/org/apache/ace/client/GroupTable.java
    incubator/ace/trunk/webui/src/org/apache/ace/client/LicenseTable.java
    incubator/ace/trunk/webui/src/org/apache/ace/client/Main.java
    incubator/ace/trunk/webui/src/org/apache/ace/client/ObjectTable.java
    incubator/ace/trunk/webui/src/org/apache/ace/client/TargetTable.java
    incubator/ace/trunk/webui/src/org/apache/ace/client/services/BundleDescriptor.java
    incubator/ace/trunk/webui/src/org/apache/ace/client/services/GroupDescriptor.java
    incubator/ace/trunk/webui/src/org/apache/ace/client/services/LicenseDescriptor.java
    incubator/ace/trunk/webui/src/org/apache/ace/client/services/TargetDescriptor.java
    incubator/ace/trunk/webui/src/org/apache/ace/server/BundleServiceImpl.java
    incubator/ace/trunk/webui/war/WEB-INF/web.xml
    incubator/ace/trunk/webui/war/webui.html

Modified: incubator/ace/trunk/webui/src/org/apache/ace/client/BundleTable.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/client/BundleTable.java?rev=794263&r1=794262&r2=794263&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/client/BundleTable.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/client/BundleTable.java Wed Jul 15 13:23:28
2009
@@ -33,7 +33,7 @@
     private BundleServiceAsync m_bundleService = GWT.create(BundleService.class);
 
     BundleTable(StatusHandler handler) {
-        super(handler, "Name");
+        super(handler);
     }
 
     @Override
@@ -42,11 +42,8 @@
     }
 
     @Override
-    protected String getValue(BundleDescriptor gd, int column) {
-        switch(column) {
-        case 0: return gd.getName();
-        }
-        return null;
+    protected String getText(BundleDescriptor gd) {
+        return gd.getName();
     }
 
     @Override

Modified: incubator/ace/trunk/webui/src/org/apache/ace/client/GroupTable.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/client/GroupTable.java?rev=794263&r1=794262&r2=794263&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/client/GroupTable.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/client/GroupTable.java Wed Jul 15 13:23:28
2009
@@ -34,7 +34,7 @@
     private GroupServiceAsync m_groupService = GWT.create(GroupService.class);
 
     GroupTable(StatusHandler handler) {
-        super(handler, "Name");
+        super(handler);
     }
 
     @Override
@@ -43,11 +43,8 @@
     }
 
     @Override
-    protected String getValue(GroupDescriptor gd, int column) {
-        switch(column) {
-        case 0: return gd.getName();
-        }
-        return null;
+    protected String getText(GroupDescriptor gd) {
+        return gd.getName();
     }
     
     void addNew() {

Modified: incubator/ace/trunk/webui/src/org/apache/ace/client/LicenseTable.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/client/LicenseTable.java?rev=794263&r1=794262&r2=794263&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/client/LicenseTable.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/client/LicenseTable.java Wed Jul 15 13:23:28
2009
@@ -34,7 +34,7 @@
     private LicenseServiceAsync m_licenseService = GWT.create(LicenseService.class);
 
     LicenseTable(StatusHandler handler) {
-        super(handler, "Name");
+        super(handler);
     }
 
     @Override
@@ -43,11 +43,8 @@
     }
 
     @Override
-    protected String getValue(LicenseDescriptor ld, int column) {
-        switch(column) {
-        case 0: return ld.getName();
-        }
-        return null;
+    protected String getText(LicenseDescriptor ld) {
+        return ld.getName();
     }
 
     void addNew() {

Modified: incubator/ace/trunk/webui/src/org/apache/ace/client/Main.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/client/Main.java?rev=794263&r1=794262&r2=794263&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/client/Main.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/client/Main.java Wed Jul 15 13:23:28 2009
@@ -21,11 +21,17 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.ace.client.services.AssociationService;
+import org.apache.ace.client.services.AssociationServiceAsync;
+
 import com.google.gwt.core.client.EntryPoint;
+import com.google.gwt.core.client.GWT;
 import com.google.gwt.core.client.impl.StringBuilderImpl;
 import com.google.gwt.event.dom.client.ClickEvent;
 import com.google.gwt.event.dom.client.ClickHandler;
 import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.rpc.AsyncCallback;
 import com.google.gwt.user.client.ui.Button;
 import com.google.gwt.user.client.ui.Label;
 import com.google.gwt.user.client.ui.RootPanel;
@@ -42,6 +48,8 @@
     private LicenseTable m_licenseTable = new LicenseTable(m_statusLabel);
     private TargetTable m_targetTable = new TargetTable(m_statusLabel);
     
+    AssociationServiceAsync m_assocationService = GWT.create(AssociationService.class);
+    
     /**
      * Interface for the columns, that they can use to indicate their status of
      * communication with the server.
@@ -101,7 +109,53 @@
         scrollPanel.setStyleName("objectTable");
         RootPanel.get("targetColumnContainer").add(scrollPanel);
         
-        // Set a time to regularly update the UI
+        // Create the association buttons
+        Button b2g = new Button("<->");
+        RootPanel.get("b2gButton").add(b2g);
+        
+        b2g.addClickHandler(new ClickHandler() {
+            public void onClick(ClickEvent event) {
+                m_assocationService.link(m_bundleTable.getSelectedObject(), m_groupTable.getSelectedObject(),
new AsyncCallback<Void>() {
+                    public void onFailure(Throwable caught) {
+                        Window.alert("Error creating association");
+                    }
+                    public void onSuccess(Void result) {
+                        // Hurrah!
+                    }
+                });
+            }
+        });
+        
+        Button g2l = new Button("<->");
+        RootPanel.get("g2lButton").add(g2l);
+        g2l.addClickHandler(new ClickHandler() {
+            public void onClick(ClickEvent event) {
+                m_assocationService.link(m_groupTable.getSelectedObject(), m_licenseTable.getSelectedObject(),
new AsyncCallback<Void>() {
+                    public void onFailure(Throwable caught) {
+                        Window.alert("Error creating association");
+                    }
+                    public void onSuccess(Void result) {
+                        // Hurrah!
+                    }
+                });
+            }
+        });
+        Button l2t = new Button("<->");
+        RootPanel.get("l2tButton").add(l2t);
+        l2t.addClickHandler(new ClickHandler() {
+            public void onClick(ClickEvent event) {
+                m_assocationService.link(m_licenseTable.getSelectedObject(), m_targetTable.getSelectedObject(),
new AsyncCallback<Void>() {
+                    public void onFailure(Throwable caught) {
+                        Window.alert("Error creating association");
+                    }
+                    public void onSuccess(Void result) {
+                        // Hurrah!
+                    }
+                });
+            }
+        });
+        
+        // Set a timer to regularly update the UI
         Timer refreshTimer = new Timer() {
             @Override
             public void run() {

Modified: incubator/ace/trunk/webui/src/org/apache/ace/client/ObjectTable.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/client/ObjectTable.java?rev=794263&r1=794262&r2=794263&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/client/ObjectTable.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/client/ObjectTable.java Wed Jul 15 13:23:28
2009
@@ -18,51 +18,98 @@
  */
 package org.apache.ace.client;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.ace.client.Main.StatusHandler;
 
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
 import com.google.gwt.user.client.rpc.AsyncCallback;
 import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.ToggleButton;
 
 /**
- * Basic table for using a valueobject per row. Remember to call the constructor with 
- * the right colunm names.
+ * Basic table for using a valueobject per row.
  */
 public abstract class ObjectTable<T> extends FlexTable {
-    private final String[] m_columnNames;
     private final StatusHandler m_handler;
+    
+    private final Map<T, ToggleButton> m_widgets = new HashMap<T, ToggleButton>();
+    
+    /**
+     * This callback is used for all 'get*' calls.
+     */
     private AsyncCallback<T[]> m_asyncCallback = new AsyncCallback<T[]>() {
         public void onFailure(Throwable caught) {
             m_handler.handleFail(getTableID());
         }
         public void onSuccess(T[] result) {
             m_handler.handleSuccess(getTableID());
-            int row = 1;
+            int row = 0;
+            // Create a button for every element, and reuse buttons for the ones we already
know.
             for (T t : result) {
-                for (int i = 0; i < m_columnNames.length; i++) {
-                    setText(row, i, getValue(t, i));
+                ToggleButton button = m_widgets.get(t);
+                if (button == null) {
+                    button = new ToggleButton();
+                    button.addClickHandler(m_buttonGroup);
+                    m_widgets.put(t, button);
+                }
+                button.setText(getText(t));
+                if (getRowCount() <= row || !getWidget(row, 0).equals(button)) {
+                    // Setting the widget again might screw up focus
+                    setWidget(row, 0, button);
                 }
                 row++;
             }
-            while (row <= getRowCount()) {
+            while (row < getRowCount()) {
                 // Looks like we removed something...
                 removeRow(row);
             }
         }
     };
+    
+    /**
+     * Pops up all other buttons in the same group when one gets clicked;
+     * this way, we end up with a single selected button.
+     */
+    private final ClickHandler m_buttonGroup = new ClickHandler() {
+        public void onClick(ClickEvent event) {
+            for (ToggleButton w : m_widgets.values()) {
+                if (!w.equals(event.getSource())) {
+                    w.setDown(false);
+                }
+            }
+        }
+    };
 
-    public ObjectTable(StatusHandler handler, String... columnNames) {
+    public ObjectTable(StatusHandler handler) {
         m_handler = handler;
-        m_columnNames = columnNames;
-        // We do not want column names for now
-//        for (int i = 0; i < m_columnNames.length; i++) {
-//            setText(0, i, m_columnNames[i]);
-//        }
+    }
+    
+    /**
+     * Finds the currently selected object, or <code>null</code> if none is found.
+     */
+    T getSelectedObject() {
+        for (Map.Entry<T, ToggleButton> entry : m_widgets.entrySet()) {
+            if (entry.getValue() instanceof ToggleButton && ((ToggleButton) entry.getValue()).isDown())
{
+                return entry.getKey();
+            }
+        }
+        return null;
     }
 
     /**
+     * Updates the contents of this table
+     */
+    void updateTable() {
+        callService(m_asyncCallback);
+    }
+    
+    /**
      * Interprets the given value object for some column.
      */
-    protected abstract String getValue(T object, int column);
+    protected abstract String getText(T object);
     
     /**
      * Gets a unique ID for this table.
@@ -75,8 +122,4 @@
      * set of value objects from the server, passing the given callback.
      */
     protected abstract void callService(AsyncCallback<T[]> callback);
-    
-    void updateTable() {
-        callService(m_asyncCallback);
-    }
 }

Modified: incubator/ace/trunk/webui/src/org/apache/ace/client/TargetTable.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/client/TargetTable.java?rev=794263&r1=794262&r2=794263&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/client/TargetTable.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/client/TargetTable.java Wed Jul 15 13:23:28
2009
@@ -33,7 +33,7 @@
     private TargetServiceAsync m_targetService = GWT.create(TargetService.class);
 
     TargetTable(StatusHandler handler) {
-        super(handler, "Name", "Status");
+        super(handler);
     }
 
     @Override
@@ -42,17 +42,12 @@
     }
 
     @Override
-    protected String getValue(TargetDescriptor td, int column) {
-        switch(column) {
-        case 0: return td.getName();
-        case 1: return td.getProvisioningState().toString();
-        }
-        return null;
+    protected String getText(TargetDescriptor td) {
+        return td.getName() + " - " + td.getProvisioningState().toString();
     }
 
     @Override
     protected String getTableID() {
         return "targets";
     }
-
 }

Added: incubator/ace/trunk/webui/src/org/apache/ace/client/services/AssociationService.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/client/services/AssociationService.java?rev=794263&view=auto
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/client/services/AssociationService.java (added)
+++ incubator/ace/trunk/webui/src/org/apache/ace/client/services/AssociationService.java Wed
Jul 15 13:23:28 2009
@@ -0,0 +1,45 @@
+/*
+ * 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.ace.client.services;
+
+import com.google.gwt.user.client.rpc.RemoteService;
+import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
+
+/**
+ * Service that can create links between the various objects.
+ */
+@RemoteServiceRelativePath("associations")
+public interface AssociationService extends RemoteService {
+    /**
+     * Links a bundle and a group; note that this will create a link to a given bundle,
+     * not to its symbolic name.
+     */
+    void link(BundleDescriptor bundle, GroupDescriptor group) throws Exception;
+    
+    /**
+     * Links a group and a license by name.
+     */
+    void link(GroupDescriptor group, LicenseDescriptor license) throws Exception;
+    
+    /**
+     * Links a license and a target. If the target is not yet registered, it will be,
+     * and the 'auto approve' will be turned on.
+     */
+    void link(LicenseDescriptor license, TargetDescriptor target) throws Exception;
+}

Propchange: incubator/ace/trunk/webui/src/org/apache/ace/client/services/AssociationService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/ace/trunk/webui/src/org/apache/ace/client/services/AssociationServiceAsync.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/client/services/AssociationServiceAsync.java?rev=794263&view=auto
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/client/services/AssociationServiceAsync.java
(added)
+++ incubator/ace/trunk/webui/src/org/apache/ace/client/services/AssociationServiceAsync.java
Wed Jul 15 13:23:28 2009
@@ -0,0 +1,30 @@
+/*
+ * 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.ace.client.services;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+/**
+ * Asynchronous AssociationService (GWT boiler plate)
+ */
+public interface AssociationServiceAsync {
+    void link(BundleDescriptor bundle, GroupDescriptor group, AsyncCallback<Void> callback);
+    void link(GroupDescriptor group, LicenseDescriptor license, AsyncCallback<Void>
callback);
+    void link(LicenseDescriptor license, TargetDescriptor target, AsyncCallback<Void>
callback);
+}

Propchange: incubator/ace/trunk/webui/src/org/apache/ace/client/services/AssociationServiceAsync.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/ace/trunk/webui/src/org/apache/ace/client/services/BundleDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/client/services/BundleDescriptor.java?rev=794263&r1=794262&r2=794263&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/client/services/BundleDescriptor.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/client/services/BundleDescriptor.java Wed
Jul 15 13:23:28 2009
@@ -40,4 +40,17 @@
     public String getName() {
         return m_name;
     }
+    
+    @Override
+    public boolean equals(Object obj) {
+        if (obj.getClass().equals(getClass())) {
+            return m_name.equals(((BundleDescriptor) obj).m_name);
+        }
+        return false;
+    }
+    
+    @Override
+    public int hashCode() {
+        return m_name.hashCode();
+    }
 }

Modified: incubator/ace/trunk/webui/src/org/apache/ace/client/services/GroupDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/client/services/GroupDescriptor.java?rev=794263&r1=794262&r2=794263&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/client/services/GroupDescriptor.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/client/services/GroupDescriptor.java Wed
Jul 15 13:23:28 2009
@@ -40,4 +40,18 @@
     public String getName() {
         return m_name;
     }
+    
+    @Override
+    public boolean equals(Object obj) {
+        if (obj.getClass().equals(getClass())) {
+            return m_name.equals(((GroupDescriptor) obj).m_name);
+        }
+        return false;
+    }
+    
+    @Override
+    public int hashCode() {
+        return m_name.hashCode();
+    }
+
 }

Modified: incubator/ace/trunk/webui/src/org/apache/ace/client/services/LicenseDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/client/services/LicenseDescriptor.java?rev=794263&r1=794262&r2=794263&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/client/services/LicenseDescriptor.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/client/services/LicenseDescriptor.java Wed
Jul 15 13:23:28 2009
@@ -40,4 +40,17 @@
     public String getName() {
         return m_name;
     }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj.getClass().equals(getClass())) {
+            return m_name.equals(((LicenseDescriptor) obj).m_name);
+        }
+        return false;
+    }
+    
+    @Override
+    public int hashCode() {
+        return m_name.hashCode();
+    }
 }

Modified: incubator/ace/trunk/webui/src/org/apache/ace/client/services/TargetDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/client/services/TargetDescriptor.java?rev=794263&r1=794262&r2=794263&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/client/services/TargetDescriptor.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/client/services/TargetDescriptor.java Wed
Jul 15 13:23:28 2009
@@ -56,4 +56,18 @@
     public ProvisioningState getProvisioningState() {
         return m_provisioningState;
     }
+    
+    @Override
+    public boolean equals(Object obj) {
+        if (obj.getClass().equals(getClass())) {
+            return m_name.equals(((TargetDescriptor) obj).m_name);
+        }
+        return false;
+    }
+    
+    @Override
+    public int hashCode() {
+        return m_name.hashCode();
+    }
+
 }

Added: incubator/ace/trunk/webui/src/org/apache/ace/server/AssociationServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/server/AssociationServiceImpl.java?rev=794263&view=auto
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/server/AssociationServiceImpl.java (added)
+++ incubator/ace/trunk/webui/src/org/apache/ace/server/AssociationServiceImpl.java Wed Jul
15 13:23:28 2009
@@ -0,0 +1,89 @@
+/*
+ * 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.ace.server;
+
+import org.apache.ace.client.repository.RepositoryAdmin;
+import org.apache.ace.client.repository.object.ArtifactObject;
+import org.apache.ace.client.repository.object.GatewayObject;
+import org.apache.ace.client.repository.object.GroupObject;
+import org.apache.ace.client.repository.object.LicenseObject;
+import org.apache.ace.client.repository.repository.Artifact2GroupAssociationRepository;
+import org.apache.ace.client.repository.repository.ArtifactRepository;
+import org.apache.ace.client.repository.repository.Group2LicenseAssociationRepository;
+import org.apache.ace.client.repository.repository.GroupRepository;
+import org.apache.ace.client.repository.repository.License2GatewayAssociationRepository;
+import org.apache.ace.client.repository.repository.LicenseRepository;
+import org.apache.ace.client.repository.stateful.StatefulGatewayObject;
+import org.apache.ace.client.repository.stateful.StatefulGatewayRepository;
+import org.apache.ace.client.services.AssociationService;
+import org.apache.ace.client.services.BundleDescriptor;
+import org.apache.ace.client.services.GroupDescriptor;
+import org.apache.ace.client.services.LicenseDescriptor;
+import org.apache.ace.client.services.TargetDescriptor;
+
+import com.google.gwt.user.server.rpc.RemoteServiceServlet;
+
+/**
+ * Allows the linking of objects; will find the {@link RepositoryAdmin}'s representation
for
+ * each of the descriptor objects.
+ */
+public class AssociationServiceImpl extends RemoteServiceServlet implements AssociationService
{
+    /**
+     * Generated serialVersionUID
+     */
+    private static final long serialVersionUID = 2413722456179463935L;
+
+    public void link(BundleDescriptor bundle, GroupDescriptor group) throws Exception {
+        Artifact2GroupAssociationRepository a2gr = Activator.getService(getThreadLocalRequest(),
Artifact2GroupAssociationRepository.class);
+        ArtifactRepository ar = Activator.getService(getThreadLocalRequest(), ArtifactRepository.class);
+        GroupRepository gr = Activator.getService(getThreadLocalRequest(), GroupRepository.class);
+        
+        ArtifactObject a = ar.get(Activator.getContext().createFilter("(" + ArtifactObject.KEY_ARTIFACT_NAME
+ "=" + bundle.getName() + ")")).get(0);
+        GroupObject g = gr.get(Activator.getContext().createFilter("(" + GroupObject.KEY_NAME
+ "=" + group.getName() + ")")).get(0);
+        
+        a2gr.create(a, g);
+    }
+
+    public void link(GroupDescriptor group, LicenseDescriptor license) throws Exception {
+        Group2LicenseAssociationRepository g2lr = Activator.getService(getThreadLocalRequest(),
Group2LicenseAssociationRepository.class);
+        GroupRepository gr = Activator.getService(getThreadLocalRequest(), GroupRepository.class);
+        LicenseRepository lr = Activator.getService(getThreadLocalRequest(), LicenseRepository.class);
+        
+        GroupObject g = gr.get(Activator.getContext().createFilter("(" + GroupObject.KEY_NAME
+ "=" + group.getName() + ")")).get(0);
+        LicenseObject l = lr.get(Activator.getContext().createFilter("(" + LicenseObject.KEY_NAME
+ "=" + license.getName() + ")")).get(0);
+
+        g2lr.create(g, l);
+    }
+
+    public void link(LicenseDescriptor license, TargetDescriptor target) throws Exception
{
+        License2GatewayAssociationRepository l2tr = Activator.getService(getThreadLocalRequest(),
License2GatewayAssociationRepository.class);
+        LicenseRepository lr = Activator.getService(getThreadLocalRequest(), LicenseRepository.class);
+        StatefulGatewayRepository gr = Activator.getService(getThreadLocalRequest(), StatefulGatewayRepository.class);
+        
+        LicenseObject l = lr.get(Activator.getContext().createFilter("(" + LicenseObject.KEY_NAME
+ "=" + license.getName() + ")")).get(0);
+        StatefulGatewayObject g = gr.get(Activator.getContext().createFilter("(" + GatewayObject.KEY_ID
+ "=" + target.getName() + ")")).get(0);
+
+        if (!g.isRegistered()) {
+            g.register();
+            g.setAutoApprove(true);
+        }
+        
+        l2tr.create(l, g.getGatewayObject());
+    }
+}

Propchange: incubator/ace/trunk/webui/src/org/apache/ace/server/AssociationServiceImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/ace/trunk/webui/src/org/apache/ace/server/BundleServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/server/BundleServiceImpl.java?rev=794263&r1=794262&r2=794263&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/server/BundleServiceImpl.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/server/BundleServiceImpl.java Wed Jul 15
13:23:28 2009
@@ -43,8 +43,8 @@
         
         List<BundleDescriptor> result = new ArrayList<BundleDescriptor>();
         
-        for (ArtifactObject g : ar.get(Activator.getContext().createFilter("(" + ArtifactObject.KEY_MIMETYPE
+ "=" + BundleHelper.MIMETYPE + ")"))) {
-            result.add(new BundleDescriptor(g.getName()));
+        for (ArtifactObject a : ar.get(Activator.getContext().createFilter("(" + ArtifactObject.KEY_MIMETYPE
+ "=" + BundleHelper.MIMETYPE + ")"))) {
+            result.add(new BundleDescriptor(a.getName()));
         }
         
         return result.toArray(new BundleDescriptor[result.size()]);

Modified: incubator/ace/trunk/webui/war/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/war/WEB-INF/web.xml?rev=794263&r1=794262&r2=794263&view=diff
==============================================================================
--- incubator/ace/trunk/webui/war/WEB-INF/web.xml (original)
+++ incubator/ace/trunk/webui/war/WEB-INF/web.xml Wed Jul 15 13:23:28 2009
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE web-app
+<!-- <!DOCTYPE web-app
     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
-    "http://java.sun.com/dtd/web-app_2_3.dtd">
+    "http://java.sun.com/dtd/web-app_2_3.dtd"> -->
 
 <web-app>
 
@@ -62,6 +62,16 @@
   </servlet-mapping>
 
   <servlet>
+    <servlet-name>associationServlet</servlet-name>
+    <servlet-class>org.apache.ace.server.AssociationServiceImpl</servlet-class>
+  </servlet>
+  
+  <servlet-mapping>
+    <servlet-name>associationServlet</servlet-name>
+    <url-pattern>/webui/associations</url-pattern>
+  </servlet-mapping>
+
+  <servlet>
     <servlet-name>obrServlet</servlet-name>
     <servlet-class>org.apache.ace.server.OBRServiceImpl</servlet-class>
   </servlet>

Modified: incubator/ace/trunk/webui/war/webui.html
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/war/webui.html?rev=794263&r1=794262&r2=794263&view=diff
==============================================================================
--- incubator/ace/trunk/webui/war/webui.html (original)
+++ incubator/ace/trunk/webui/war/webui.html Wed Jul 15 13:23:28 2009
@@ -41,17 +41,22 @@
     <h1>Apache ACE</h1>
 
     <table align="center">
-    <tr><td colspan="4" id="buttonPanel"></td></tr>
+    <tr><td colspan="8" id="buttonPanel" /></tr>
     <tr>
         <th><h3 id="bundlesHeader">Bundles</h3></th>
+        <td id="b2gButton"></td>
         <th><h3 id="groupsHeader">Groups</h3></th>
+        <th id="g2lButton"/></td>
         <th><h3 id="licensesHeader">Licenses</h3></th>
-        <th><h3>Targets</h3></th>
-    </tr>
+        <th id="l2tButton"/></td>
+        <th><h3>Targets</h3></th></tr>
     <tr>
         <td id="bundleColumnContainer"></td>
+        <td/>
         <td id="groupColumnContainer"></td>
+        <td/>
         <td id="licenseColumnContainer"></td>
+        <td/>
         <td id="targetColumnContainer"></td>
     </tr>
     </table>



Mime
View raw message