Package org.itsnat.impl.core.clientdoc

Examples of org.itsnat.impl.core.clientdoc.ClientDocumentAttachedClientImpl


        ItsNatAttachedClientEventImpl event = listener.createItsNatAttachedClientEvent(getRequestAttachedClientEvent());

        ItsNatAttachedClientEventListenerUtil.handleEventIncludingGlobalListeners(event);

        ClientDocumentAttachedClientImpl clientDoc = getClientDocumentAttachedClient();
        clientDoc.attachedClientEventReceived();

        if (clientDoc.isInvalid() || (clientDoc.getPhase() == ItsNatAttachedClientEvent.UNLOAD))
        {
            // Lo hacemos antes de enviar el c�digo JavaScript pues al desregistrar se invalida tambi�n
            // el cliente (si no lo est�) y se genera tambi�n c�digo JavaScript
            clientDoc.invalidateAndUnregister(); // Se desregistra de la sesi�n
        }
    }
View Full Code Here


        return (ClientDocumentAttachedClientImpl)getClientDocument();
    }

    protected void processResponse()
    {
        ClientDocumentAttachedClientImpl clientDoc = getClientDocumentAttachedClient();

        copyCacheFromOwner(clientDoc); // Antes de ejecutar c�digo del usuario o notificar a los componentes, en general cualquier c�digo que acceda al DOM.
        clientDoc.registerInSession();
       
        // Caso ItsNatAttachedClientEvent.LOAD:
        responseDelegate.processResponse();
    }
View Full Code Here

        // Aunque sea en carga, se procesa como si fuera un evento.

        ItsNatAttachedClientEventImpl event = createItsNatAttachedClientEvent();
        ItsNatAttachedClientEventListenerUtil.handleEventIncludingGlobalListeners(event);

        ClientDocumentAttachedClientImpl clientDoc = getClientDocumentAttachedClient();
        int phase = clientDoc.getPhase();
        if (phase == ItsNatAttachedClientEvent.UNLOAD) return;

        // Ahora s� tenemos claro que desde el cliente se deben enviar eventos

        int commMode = clientDoc.getCommModeDeclared();

        String nodeRefForUnload;
        String unloadType;
        if (clientDoc.getBrowser().isClientWindowEventTarget())
        {
            nodeRefForUnload = "itsNatDoc.win";
            unloadType = "unload";
        }
        else
        {
            nodeRefForUnload = "itsNatDoc.doc.documentElement";
            unloadType = "SVGUnload"// En ASV  no se ejecuta pero en fin, por coherencia
        }

        String code = "itsNatDoc.addAttachUnloadListener(" + nodeRefForUnload + ",\"" + unloadType + "\"," + commMode + ");\n";

        clientDoc.addCodeToSend(code);

        clientDoc.startAttachedClient()// Genera el JavaScript adecuado para enviar al servidor el primer evento para empezar a sincronizar (inicio de Comet o el primer evento timer).
    }
View Full Code Here

    }
   
    public ItsNatAttachedClientEventImpl createItsNatAttachedClientEvent()
    {
        RequestAttachedClientLoadDocImpl request = getRequestAttachedClientLoadDoc();
        ClientDocumentAttachedClientImpl clientDoc = getClientDocumentAttachedClient();
        return request.createItsNatAttachedClientEvent(clientDoc);
    }
View Full Code Here

    {
        ItsNatStfulDocumentImpl itsNatDoc = getItsNatStfulDocument();

        if (itsNatDoc.hasBoundElementDocContainers())
        {
            ClientDocumentAttachedClientImpl clientDoc = getClientDocumentAttachedClient();
            MapUniqueId<BoundElementDocContainerImpl> bindInfoList = itsNatDoc.getBoundElementDocContainerMap();
            for(Iterator<Map.Entry<String,BoundElementDocContainerImpl>> it = bindInfoList.entrySet().iterator(); it.hasNext(); )
            {
                Map.Entry<String,BoundElementDocContainerImpl> entry = it.next();
                BoundElementDocContainerImpl bindInfo = entry.getValue();
View Full Code Here

        ClientDocumentAttachedClientImpl[] attachedClients = getClientDocumentAttachedClientArray();
        if (attachedClients != null)
        {
            for(int i = 0; i < attachedClients.length; i++)
            {
                ClientDocumentAttachedClientImpl clientDoc = attachedClients[i];
                ItsNatStfulDocumentImpl itsNatDoc = clientDoc.getItsNatStfulDocument();
                synchronized(itsNatDoc) // No es necesario sincronizar los padres pues esta acci�n s�lo afecta a este documento
                {
                    clientDoc.setInvalid(); // Yo creo que no hace falta pero por si acaso
                }
            }
        }

        // Esto es necesario, porque la invalidaci�n (que puede hacerse el documento de otra sesi�n)
View Full Code Here

        }
    }

    private void addClientDocumentAttachedClient(ClientDocumentAttachedClientImpl clientDoc)
    {
        ClientDocumentAttachedClientImpl res;
        synchronized(attachedClientsById)
        {
            res = attachedClientsById.put(clientDoc);
        }
        if (res != null) throw new ItsNatException("INTERNAL ERROR"); // Asegura el registro una sola vez
View Full Code Here

        if (res != null) throw new ItsNatException("INTERNAL ERROR"); // Asegura el registro una sola vez
    }

    private boolean removeClientDocumentAttachedClient(ClientDocumentAttachedClientImpl clientDoc)
    {
        ClientDocumentAttachedClientImpl res;
        synchronized(attachedClientsById)
        {
            res = attachedClientsById.remove(clientDoc);
        }
        return (res != null)// Si true es que fue removido
View Full Code Here

                        if (itsNatDoc.hasClientDocumentAttachedClient())
                        {
                            ClientDocumentAttachedClientImpl[] clientAttachList = itsNatDoc.getClientDocumentAttachedClientArray();
                            for(int j = 0; j < clientAttachList.length; j++)
                            {
                                ClientDocumentAttachedClientImpl clientDocAttached = clientAttachList[j];
                                ItsNatSessionImpl attachedSession = clientDocAttached.getItsNatSessionImpl();
                                if (attachedSession == this) continue; // No merece la pena, se procesar� despu�s
                                cleanExpiredClientDocumentAttachedClient(clientDocAttached,currentTime); // currentTime vale pero el maxInactiveInterval depende de la sesi�n
                            }
                        }

                        // Ya que estamos aprovechamos para limpiar los attached client excedentes
                        // As� eliminamos los clientes attached excedentes de los documentos
                        // guardados en esta sesi�n est�n expirados o no (cada sesi�n har� lo suyo aunque sean clientes en diferentes sesiones)
                        // obviamente eliminaremos primero los que no han sido tocados durante m�s tiempo

                        cleanExcessClientDocumentAttachedClients(itsNatDoc);
                    }
                }
            }
        }

        // Eliminamos los ClientDocument observadores que pueden estar zombies
        // porque el navegador no ha notificado que se cerr� la ventana.
        // Esta limpieza es redundante (pero necesaria) pues
        // esta impieza ya la hace el cliente propietario del documento (antes de llegar aqu�).
        // De hecho el propietario no hace la limpieza de sus auto-observadores (misma sesi�n) pues
        // ahora se hace aqu� (ver "if (attachedSession == this) continue;")
        ClientDocumentAttachedClientImpl[] clientAttachedList = getClientDocumentAttachedClientArray();
        if (clientAttachedList != null)
        {
            for(int i = 0; i < clientAttachedList.length; i++)
            {
                ClientDocumentAttachedClientImpl clientDoc = clientAttachedList[i];
                cleanExpiredClientDocumentAttachedClient(clientDoc,currentTime);
            }
        }
    }
View Full Code Here

            // Invalidamos los que llevan m�s tiempo sin usar
            Arrays.sort(clientList,COMPARATOR_ATTACHED_CLIENTS);
            for(int i = 0; i < excess; i++)
            {
                ClientDocumentAttachedClientImpl clientDoc = clientList[i];
                clientDoc.invalidateAndUnregister(); // Se desregistra de su sesi�n (puede no ser esta)
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.itsnat.impl.core.clientdoc.ClientDocumentAttachedClientImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.