incubator-ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r798814 [2/2] - in /incubator/ace/trunk: core/ core/conf/dev-client/ server/src/org/apache/ace/client/repository/ server/src/org/apache/ace/client/repository/impl/ server/src/org/apache/ace/obr/servlet/ test/ test/src/org/apache/ace/client/...
Date Wed, 29 Jul 2009 08:59:49 GMT
Modified: incubator/ace/trunk/webui/src/org/apache/ace/server/Activator.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/server/Activator.java?rev=798814&r1=798813&r2=798814&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/server/Activator.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/server/Activator.java Wed Jul 29 08:59:48
2009
@@ -20,20 +20,15 @@
 
 import java.io.File;
 
-import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
 
+import org.apache.ace.client.repository.SessionFactory;
 import org.apache.felix.dependencymanager.DependencyActivatorBase;
 import org.apache.felix.dependencymanager.DependencyManager;
-import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.log.LogService;
-import org.osgi.service.packageadmin.ExportedPackage;
-import org.osgi.service.packageadmin.PackageAdmin;
-import org.osgi.util.tracker.ServiceTracker;
 
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.core.client.GWT.UncaughtExceptionHandler;
@@ -41,10 +36,9 @@
 public class Activator extends DependencyActivatorBase {
     private static volatile BundleContext m_context;
     private static volatile Activator m_instance;
-    private static final boolean DEBUG = true;
-
-    private volatile PackageAdmin m_packageAdmin;
     
+    private volatile SessionFactory m_sessionFactory;
+
     static Activator instance() {
         return m_instance;
     }
@@ -61,64 +55,45 @@
         return m_context.getDataFile("webui");
     }
     
-    /**
-     * Returns a list of exports that consists of everything this bundle imports. We use
-     * PackageAdmin to figure this out at runtime.
-     */
-    static String getExports() {
-        StringBuffer imports = new StringBuffer();
-        for (Bundle b : m_context.getBundles()) {
-            ExportedPackage[] eps = instance().m_packageAdmin.getExportedPackages(b);
-            if (eps != null) {
-                for (ExportedPackage ep : eps) {
-                    Bundle[] ibs = ep.getImportingBundles();
-                    if (ibs != null) {
-                        for (Bundle ib : ibs) {
-                            if (ib.getBundleId() == m_context.getBundle().getBundleId())
{
-                                if (imports.length() > 0) {
-                                    imports.append(',');
-                                }
-                                imports.append(ep.getName() + ";version=" + ep.getVersion());
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        return imports.toString();
-    }
     
     /**
-     * Gets an instance of the given service, coming from the session-dependent
-     * framework. For debug purposes, it can return the service from the 'outer' framework.
-     * (set the {@link #DEBUG} flag to <code>true</code> to use this feature)
+     * Gets an instance of the given service, belonging to the session context.
      */
     static <T> T getService(HttpServletRequest request, Class<T> clazz) throws
Exception {
-        BundleContext bundleContext;
-        if (DEBUG) {
-            bundleContext = m_context;
+        // lookup the session
+        String id;
+        if (request == null) {
+            System.out.println("!!! Request is null... could not find session service " +
clazz.getSimpleName());
+            return null;
+        }
+        HttpSession session = request.getSession(false);
+        if (session == null) {
+            // create session
+            session = request.getSession(true);
+            id = session.getId();
+            instance().m_sessionFactory.createSession(id);
+//            System.out.println("NEW Session " + id +  " requests service " + clazz.getSimpleName());
         }
         else {
-            HttpSession session = request.getSession();
-            Cookie[] cookies = request.getCookies();
-            StringBuffer cc = new StringBuffer();
-            for (Cookie c : cookies) {
-                if (cc.length() > 0) { cc.append("; "); }
-                cc.append(c.getName() + " = " + c.getValue());
-            }
-            System.out.println("Getting service for request " + request.getRequestURI() +
" cookie " + cc + " with session " + session);
-            bundleContext = SessionFramework.getFramework(session, Activator.getBaseDir()).getBundleContext();
+            id = session.getId();
+//            System.out.println("XST Session " + id +  " requests service " + clazz.getSimpleName());
         }
         
-        ServiceReference reference = bundleContext.getServiceReference(clazz.getName());
+        BundleContext bundleContext = m_context;
+        ServiceReference[] refs = bundleContext.getServiceReferences(clazz.getName(), "("
+ SessionFactory.SERVICE_SID + "=" + id + ")");
+        ServiceReference reference = null;
+        if (refs != null && refs.length == 1) {
+            reference  = refs[0];
+        }
         if (reference != null) {
             @SuppressWarnings("unchecked")
             T result = (T) bundleContext.getService(reference);
+//            System.out.println("Returned service for " + clazz.getSimpleName() + " is "
+ result);
             return result;
         }
-        
+        /*
         // we were not able to find the reference immediately, try again for a few seconds...
-        ServiceTracker tracker = new ServiceTracker(bundleContext, "(" + Constants.OBJECTCLASS
+ "=" + clazz.getName() + ")", null);
+        ServiceTracker tracker = new ServiceTracker(bundleContext, "&((" + Constants.OBJECTCLASS
+ "=" + clazz.getName() + ")(" + SessionFactory.SERVICE_SID + "=" + id + "))", null);
         tracker.open();
         @SuppressWarnings("unchecked")
         T result = (T) tracker.waitForService(5000);
@@ -128,7 +103,24 @@
                 ((LogService) bundleContext.getService(logRef)).log(LogService.LOG_ERROR,
"Error finding service " + clazz.getName());
             }
         }
+        System.out.println("After a little while, the returned service for " + clazz.getSimpleName()
+ " is " + result);
         return result;
+         */
+        System.out.println("!!! Could not find session service " + clazz.getSimpleName());
+        return null;
+    }
+    
+    public static <T> T getService(Class<T> clazz) {
+        BundleContext bundleContext = m_context;
+        ServiceReference reference = bundleContext.getServiceReference(clazz.getName());
+        if (reference != null) {
+            @SuppressWarnings("unchecked")
+            T result = (T) bundleContext.getService(reference);
+            System.out.println("Returned service for " + clazz.getSimpleName() + " is " +
result);
+            return result;
+        }
+        System.out.println("!!! Could not find service " + clazz.getSimpleName());
+        return null;
     }
 
     @Override
@@ -154,7 +146,7 @@
         
         manager.add(createService()
             .setImplementation(this)
-            .add(createServiceDependency().setRequired(true).setService(PackageAdmin.class))
+            .add(createServiceDependency().setRequired(true).setService(SessionFactory.class))
             );
     }
     @Override
@@ -162,4 +154,5 @@
     throws Exception {
     }
 
+
 }

Modified: 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=798814&r1=798813&r2=798814&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/server/AssociationServiceImpl.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/server/AssociationServiceImpl.java Wed Jul
29 08:59:48 2009
@@ -21,6 +21,8 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.servlet.http.HttpServletRequest;
+
 import org.apache.ace.client.repository.RepositoryAdmin;
 import org.apache.ace.client.repository.RepositoryObject;
 import org.apache.ace.client.repository.object.ArtifactObject;
@@ -51,46 +53,51 @@
     private static final long serialVersionUID = 2413722456179463935L;
 
     public void link(BundleDescriptor bundle, GroupDescriptor group) throws Exception {
-        Artifact2GroupAssociationRepository a2gr = Activator.getService(getThreadLocalRequest(),
Artifact2GroupAssociationRepository.class);
+        HttpServletRequest request = getThreadLocalRequest();
+        Artifact2GroupAssociationRepository a2gr = Activator.getService(request, Artifact2GroupAssociationRepository.class);
         
-        ArtifactObject a = (ArtifactObject) ObjectMapping.unwrap(bundle);
-        GroupObject g = (GroupObject) ObjectMapping.unwrap(group);
+        ArtifactObject a = (ArtifactObject) ObjectMapping.unwrap(request, bundle);
+        GroupObject g = (GroupObject) ObjectMapping.unwrap(request, group);
         
         a2gr.create(a, g);
     }
 
     private void unlink(BundleDescriptor bundle, GroupDescriptor group) throws Exception
{
-        Artifact2GroupAssociationRepository a2gr = Activator.getService(getThreadLocalRequest(),
Artifact2GroupAssociationRepository.class);
+        HttpServletRequest request = getThreadLocalRequest();
+        Artifact2GroupAssociationRepository a2gr = Activator.getService(request, Artifact2GroupAssociationRepository.class);
         
-        ArtifactObject a = (ArtifactObject) ObjectMapping.unwrap(bundle);
-        GroupObject g = (GroupObject) ObjectMapping.unwrap(group);
+        ArtifactObject a = (ArtifactObject) ObjectMapping.unwrap(request, bundle);
+        GroupObject g = (GroupObject) ObjectMapping.unwrap(request, group);
         
         a2gr.remove(a.getAssociationsWith(g).get(0));
     }
 
     public void link(GroupDescriptor group, LicenseDescriptor license) throws Exception {
-        Group2LicenseAssociationRepository g2lr = Activator.getService(getThreadLocalRequest(),
Group2LicenseAssociationRepository.class);
+        HttpServletRequest request = getThreadLocalRequest();
+        Group2LicenseAssociationRepository g2lr = Activator.getService(request, Group2LicenseAssociationRepository.class);
 
-        GroupObject g = (GroupObject) ObjectMapping.unwrap(group);
-        LicenseObject l = (LicenseObject) ObjectMapping.unwrap(license);
+        GroupObject g = (GroupObject) ObjectMapping.unwrap(request, group);
+        LicenseObject l = (LicenseObject) ObjectMapping.unwrap(request, license);
         
         g2lr.create(g, l);
     }
 
     private void unlink(GroupDescriptor group, LicenseDescriptor license) throws Exception
{
-        Group2LicenseAssociationRepository g2lr = Activator.getService(getThreadLocalRequest(),
Group2LicenseAssociationRepository.class);
+        HttpServletRequest request = getThreadLocalRequest();
+        Group2LicenseAssociationRepository g2lr = Activator.getService(request, Group2LicenseAssociationRepository.class);
 
-        GroupObject g = (GroupObject) ObjectMapping.unwrap(group);
-        LicenseObject l = (LicenseObject) ObjectMapping.unwrap(license);
+        GroupObject g = (GroupObject) ObjectMapping.unwrap(request, group);
+        LicenseObject l = (LicenseObject) ObjectMapping.unwrap(request, license);
         
         g2lr.remove(g.getAssociationsWith(l).get(0));
     }
 
     public void link(LicenseDescriptor license, TargetDescriptor target) throws Exception
{
-        License2GatewayAssociationRepository l2tr = Activator.getService(getThreadLocalRequest(),
License2GatewayAssociationRepository.class);
+        HttpServletRequest request = getThreadLocalRequest();
+        License2GatewayAssociationRepository l2tr = Activator.getService(request, License2GatewayAssociationRepository.class);
 
-        LicenseObject l = (LicenseObject) ObjectMapping.unwrap(license);
-        StatefulGatewayObject g = (StatefulGatewayObject) ObjectMapping.unwrap(target);
+        LicenseObject l = (LicenseObject) ObjectMapping.unwrap(request, license);
+        StatefulGatewayObject g = (StatefulGatewayObject) ObjectMapping.unwrap(request, target);
         
         if (!g.isRegistered()) {
             g.register();
@@ -101,10 +108,11 @@
     }
 
     private void unlink(LicenseDescriptor license, TargetDescriptor target) throws Exception
{
-        License2GatewayAssociationRepository l2tr = Activator.getService(getThreadLocalRequest(),
License2GatewayAssociationRepository.class);
+        HttpServletRequest request = getThreadLocalRequest();
+        License2GatewayAssociationRepository l2tr = Activator.getService(request, License2GatewayAssociationRepository.class);
 
-        LicenseObject l = (LicenseObject) ObjectMapping.unwrap(license);
-        StatefulGatewayObject g = (StatefulGatewayObject) ObjectMapping.unwrap(target);
+        LicenseObject l = (LicenseObject) ObjectMapping.unwrap(request, license);
+        StatefulGatewayObject g = (StatefulGatewayObject) ObjectMapping.unwrap(request, target);
         
         l2tr.remove(l.getAssociationsWith(g.getGatewayObject()).get(0));
     }
@@ -130,8 +138,9 @@
     }
 
     public Descriptor[] getRelated(Descriptor o) throws Exception {
-        RepositoryObject a = ObjectMapping.unwrap(o);
-        List<RepositoryObject> relatedObjects = getRelated(a);
+        HttpServletRequest request = getThreadLocalRequest();
+        RepositoryObject a = ObjectMapping.unwrap(request, o);
+        List<RepositoryObject> relatedObjects = getRelated(request, a);
         List<Descriptor> descriptors = ObjectMapping.wrap(relatedObjects);
         return descriptors.toArray(new Descriptor[descriptors.size()]);
     }
@@ -139,7 +148,7 @@
     /**
      * Helper method that finds all related {@link RepositoryObject}s for a given one.
      */
-    private List<RepositoryObject> getRelated(RepositoryObject object) throws Exception
{
+    private List<RepositoryObject> getRelated(HttpServletRequest request, RepositoryObject
object) throws Exception {
         List<RepositoryObject> result = new ArrayList<RepositoryObject>();
         if (object instanceof ArtifactObject) {
             List<GroupObject> groups = getRelated(object, GroupObject.class);
@@ -147,7 +156,7 @@
             List<GatewayObject> targets = getRelated(licenses, GatewayObject.class);
             result.addAll(groups);
             result.addAll(licenses);
-            result.addAll(TargetServiceImpl.instance().findSGOs(targets));
+            result.addAll(TargetServiceImpl.instance().findSGOs(request, targets));
         }
         else if (object instanceof GroupObject) {
             List<ArtifactObject> artifacts = getRelated(object, ArtifactObject.class);
@@ -155,7 +164,7 @@
             List<GatewayObject> targets = getRelated(licenses, GatewayObject.class);
             result.addAll(artifacts);
             result.addAll(licenses);
-            result.addAll(TargetServiceImpl.instance().findSGOs(targets));
+            result.addAll(TargetServiceImpl.instance().findSGOs(request, targets));
         }
         else if (object instanceof LicenseObject) {
             List<GroupObject> groups = getRelated(object, GroupObject.class);
@@ -163,7 +172,7 @@
             List<GatewayObject> targets = getRelated(object, GatewayObject.class);
             result.addAll(artifacts);
             result.addAll(groups);
-            result.addAll(TargetServiceImpl.instance().findSGOs(targets));
+            result.addAll(TargetServiceImpl.instance().findSGOs(request, targets));
         }
         else if (object instanceof StatefulGatewayObject) {
             List<LicenseObject> licenses = getRelated(object, LicenseObject.class);

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=798814&r1=798813&r2=798814&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 29
08:59:48 2009
@@ -20,6 +20,8 @@
 
 import java.util.List;
 
+import javax.servlet.http.HttpServletRequest;
+
 import org.apache.ace.client.repository.RepositoryObject;
 import org.apache.ace.client.repository.helper.bundle.BundleHelper;
 import org.apache.ace.client.repository.object.ArtifactObject;
@@ -40,6 +42,7 @@
     private static BundleServiceImpl m_instance;
     
     public BundleServiceImpl() {
+        if (m_instance != null) { System.out.println("Warning, duplicate " + getClass().getSimpleName());
}
         m_instance = this;
     }
     
@@ -72,8 +75,8 @@
     }
     
     @Override
-    public ArtifactObject unwrap(Descriptor descriptor) throws Exception {
-        ArtifactRepository ar = Activator.getService(getThreadLocalRequest(), ArtifactRepository.class);
+    public ArtifactObject unwrap(HttpServletRequest request, Descriptor descriptor) throws
Exception {
+        ArtifactRepository ar = Activator.getService(request, ArtifactRepository.class);
         List<ArtifactObject> list = ar.get(Activator.getContext().createFilter("("
+ ArtifactObject.KEY_ARTIFACT_NAME + "=" + descriptor.getName() + ")"));
         if (list.size() == 1) {
             return list.get(0);

Modified: incubator/ace/trunk/webui/src/org/apache/ace/server/CheckoutServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/server/CheckoutServiceImpl.java?rev=798814&r1=798813&r2=798814&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/server/CheckoutServiceImpl.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/server/CheckoutServiceImpl.java Wed Jul 29
08:59:48 2009
@@ -24,6 +24,7 @@
 
 import org.apache.ace.client.repository.RepositoryAdmin;
 import org.apache.ace.client.repository.RepositoryAdminLoginContext;
+import org.apache.ace.client.repository.stateful.StatefulGatewayRepository;
 import org.apache.ace.client.services.CheckoutService;
 import org.osgi.service.useradmin.User;
 import org.osgi.service.useradmin.UserAdmin;
@@ -46,7 +47,7 @@
     private RepositoryAdmin getRepositoryAdmin() throws Exception {
         RepositoryAdmin admin = Activator.getService(getThreadLocalRequest(), RepositoryAdmin.class);
         if (!m_loggedIn.contains(admin)) {
-            UserAdmin userAdmin = Activator.getService(getThreadLocalRequest(), UserAdmin.class);
+            UserAdmin userAdmin = Activator.getService(UserAdmin.class);
             RepositoryAdminLoginContext context = admin.createLoginContext((User) userAdmin.getRole("d"));
             context.addShopRepository(new URL("http://localhost:8080/repository"), "apache",
"shop", true);
             context.addGatewayRepository(new URL("http://localhost:8080/repository"), "apache",
"gateway", true);

Modified: incubator/ace/trunk/webui/src/org/apache/ace/server/GroupServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/server/GroupServiceImpl.java?rev=798814&r1=798813&r2=798814&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/server/GroupServiceImpl.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/server/GroupServiceImpl.java Wed Jul 29 08:59:48
2009
@@ -22,6 +22,8 @@
 import java.util.List;
 import java.util.Map;
 
+import javax.servlet.http.HttpServletRequest;
+
 import org.apache.ace.client.repository.RepositoryObject;
 import org.apache.ace.client.repository.object.GroupObject;
 import org.apache.ace.client.repository.repository.GroupRepository;
@@ -38,6 +40,7 @@
     private static GroupServiceImpl m_instance;
     
     public GroupServiceImpl() {
+        if (m_instance != null) { System.out.println("Warning, duplicate " + getClass().getSimpleName());
}
         m_instance = this;
     }
     
@@ -79,8 +82,8 @@
     }
     
     @Override
-    public GroupObject unwrap(Descriptor descriptor) throws Exception {
-        GroupRepository gr = Activator.getService(getThreadLocalRequest(), GroupRepository.class);
+    public GroupObject unwrap(HttpServletRequest request, Descriptor descriptor) throws Exception
{
+        GroupRepository gr = Activator.getService(request, GroupRepository.class);
         List<GroupObject> list = gr.get(Activator.getContext().createFilter("(" + GroupObject.KEY_NAME
+ "=" + descriptor.getName() + ")"));
         if (list.size() == 1) {
             return list.get(0);

Modified: incubator/ace/trunk/webui/src/org/apache/ace/server/LicenseServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/server/LicenseServiceImpl.java?rev=798814&r1=798813&r2=798814&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/server/LicenseServiceImpl.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/server/LicenseServiceImpl.java Wed Jul 29
08:59:48 2009
@@ -22,6 +22,8 @@
 import java.util.List;
 import java.util.Map;
 
+import javax.servlet.http.HttpServletRequest;
+
 import org.apache.ace.client.repository.RepositoryObject;
 import org.apache.ace.client.repository.object.LicenseObject;
 import org.apache.ace.client.repository.repository.LicenseRepository;
@@ -38,6 +40,7 @@
     private static LicenseServiceImpl m_instance;
     
     public LicenseServiceImpl() {
+        if (m_instance != null) { System.out.println("Warning, duplicate " + getClass().getSimpleName());
}
         m_instance = this;
     }
     
@@ -78,8 +81,8 @@
     }
 
     @Override
-    public LicenseObject unwrap(Descriptor descriptor) throws Exception {
-        LicenseRepository lr = Activator.getService(getThreadLocalRequest(), LicenseRepository.class);
+    public LicenseObject unwrap(HttpServletRequest request, Descriptor descriptor) throws
Exception {
+        LicenseRepository lr = Activator.getService(request, LicenseRepository.class);
         List<LicenseObject> list = lr.get(Activator.getContext().createFilter("(" +
LicenseObject.KEY_NAME + "=" + descriptor.getName() + ")"));
         if (list.size() == 1) {
             return list.get(0);

Modified: incubator/ace/trunk/webui/src/org/apache/ace/server/ObjectMapping.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/server/ObjectMapping.java?rev=798814&r1=798813&r2=798814&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/server/ObjectMapping.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/server/ObjectMapping.java Wed Jul 29 08:59:48
2009
@@ -21,6 +21,8 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.servlet.http.HttpServletRequest;
+
 import org.apache.ace.client.repository.RepositoryObject;
 import org.apache.ace.client.repository.object.ArtifactObject;
 import org.apache.ace.client.repository.object.GroupObject;
@@ -56,9 +58,10 @@
 
     /**
      * Unwraps a single {@link Descriptor}.
+     * @param request 
      */
-    public static RepositoryObject unwrap(Descriptor descriptor) throws Exception {
-        return findService(descriptor).unwrap(descriptor);
+    public static RepositoryObject unwrap(HttpServletRequest request, Descriptor descriptor)
throws Exception {
+        return findService(descriptor).unwrap(request, descriptor);
     }
     
     /**

Modified: incubator/ace/trunk/webui/src/org/apache/ace/server/ObjectServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/server/ObjectServiceImpl.java?rev=798814&r1=798813&r2=798814&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/server/ObjectServiceImpl.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/server/ObjectServiceImpl.java Wed Jul 29
08:59:48 2009
@@ -21,6 +21,8 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.servlet.http.HttpServletRequest;
+
 import org.apache.ace.client.repository.RepositoryObject;
 import org.apache.ace.client.services.Descriptor;
 
@@ -35,8 +37,9 @@
 
     /**
      * Unwraps the given descriptor, giving back the original repository object.
+     * @param request 
      */
-    public abstract REPOOBJECT unwrap(Descriptor descriptor) throws Exception;
+    public abstract REPOOBJECT unwrap(HttpServletRequest request, Descriptor descriptor)
throws Exception;
     
     /**
      * Wraps the given object, returning a descriptor.
@@ -56,7 +59,7 @@
     }
     
     public void remove(DESCRIPTOR descriptor) throws Exception {
-        remove(unwrap(descriptor));
+        remove(unwrap(getThreadLocalRequest(), descriptor));
     }
     
 }

Modified: incubator/ace/trunk/webui/src/org/apache/ace/server/TargetServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/server/TargetServiceImpl.java?rev=798814&r1=798813&r2=798814&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/server/TargetServiceImpl.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/server/TargetServiceImpl.java Wed Jul 29
08:59:48 2009
@@ -21,6 +21,8 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.servlet.http.HttpServletRequest;
+
 import org.apache.ace.client.repository.RepositoryObject;
 import org.apache.ace.client.repository.object.GatewayObject;
 import org.apache.ace.client.repository.stateful.StatefulGatewayObject;
@@ -38,6 +40,7 @@
     private static TargetServiceImpl m_instance;
     
     public TargetServiceImpl() {
+        if (m_instance != null) { System.out.println("Warning, duplicate " + getClass().getSimpleName());
}
         m_instance = this;
     }
     
@@ -87,8 +90,8 @@
     }
     
     @Override
-    public StatefulGatewayObject unwrap(Descriptor descriptor) throws Exception {
-        StatefulGatewayRepository gr = Activator.getService(getThreadLocalRequest(), StatefulGatewayRepository.class);
+    public StatefulGatewayObject unwrap(HttpServletRequest request, Descriptor descriptor)
throws Exception {
+        StatefulGatewayRepository gr = Activator.getService(request, StatefulGatewayRepository.class);
         List<StatefulGatewayObject> list = gr.get(Activator.getContext().createFilter("("
+ GatewayObject.KEY_ID + "=" + descriptor.getName() + ")"));
         if (list.size() == 1) {
             return list.get(0);
@@ -98,19 +101,30 @@
     
     /**
      * Helper method to find the {@link StatefulGatewayObject} for a given {@link GatewayObject}.
+     * @param request 
      */
-    public StatefulGatewayObject findSGO(GatewayObject go) throws Exception {
-        StatefulGatewayRepository sgr = Activator.getService(getThreadLocalRequest(), StatefulGatewayRepository.class);
+    public StatefulGatewayObject findSGO(HttpServletRequest request, GatewayObject go) throws
Exception {
+        StatefulGatewayRepository sgr = Activator.getService(request, StatefulGatewayRepository.class);
+        
+        
+        // before we go on, let's refresh
+        // this is not the right moment probably, but the question is, WHAT IS? ;)
+        sgr.refresh();
+        
+        
+        
+        
         return sgr.get(Activator.getContext().createFilter("(" + GatewayObject.KEY_ID + "="
+ go.getID() + ")")).get(0);
     }
     
     /**
      * Helper method to find all {@link StatefulGatewayObject}s for some {@link GatewayObject}s.
+     * @param request 
      */
-    public List<StatefulGatewayObject> findSGOs(List<GatewayObject> gos) throws
Exception {
+    public List<StatefulGatewayObject> findSGOs(HttpServletRequest request, List<GatewayObject>
gos) throws Exception {
         List<StatefulGatewayObject> result = new ArrayList<StatefulGatewayObject>();
         for (GatewayObject go : gos) {
-            result.add(findSGO(go));
+            result.add(findSGO(request, go));
         }
         return result;
     }

Added: incubator/ace/trunk/webui/war/WEB-INF/lib/gwt-servlet.jar
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/war/WEB-INF/lib/gwt-servlet.jar?rev=798814&view=auto
==============================================================================
Files incubator/ace/trunk/webui/war/WEB-INF/lib/gwt-servlet.jar (added) and incubator/ace/trunk/webui/war/WEB-INF/lib/gwt-servlet.jar
Wed Jul 29 08:59:48 2009 differ

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



Mime
View raw message