Examples of UpdateMessage


Examples of net.java.trueupdate.message.UpdateMessage

    @Override
    protected void onInstallationRequest(final UpdateMessage message)
    throws Exception {
        logReceived(message);
        subscribe(message);
        UpdateMessage response;
        try {
            install(message);
            response = installationSuccessResponse(message);
        } catch (Exception ex) {
            response = installationFailureResponse(message);
View Full Code Here

Examples of net.java.trueupdate.message.UpdateMessage

                sendRedeploymentRequest();
                final long stop = System.currentTimeMillis()
                        + HANDSHAKE_TIMEOUT_MILLIS;
                synchronized (sessionManager) {
                    while (true) {
                        final UpdateMessage um = sessionManager.get(request);
                        final Type type = um.type();
                        checkCancelled(type);
                        if (PROCEED_REDEPLOYMENT_RESPONSE.equals(type))
                            break;
                        final long remaining = stop - System.currentTimeMillis();
                        if (0 >= remaining)
                            throw new Exception(
                                    "Timeout while waiting for a redeployment response from the update agent.");
                        sessionManager.wait(remaining);
                    }
                }
            }

            void sendRedeploymentRequest() throws Exception {
                final UpdateMessage redeploymentRequest = responseFor(request)
                        .type(REDEPLOYMENT_REQUEST)
                        .artifactDescriptor(artifactDescriptor())
                        .build();
                sendAndLog(redeploymentRequest);
            }

            void checkCancelled(final Type type) throws Exception {
                if (CANCEL_REDEPLOYMENT_RESPONSE.equals(type))
                    throw new Exception(
                            "The update agent has cancelled the update installation.");
            }

            void onPerformUndeployment() {
                anticipatedDescriptor = request
                        .artifactDescriptor()
                        .update()
                        .version(request.updateVersion())
                        .build();
                anticipatedLocation = request.updateLocation();
            }

            void onRevertUndeployment() {
                anticipatedDescriptor = request.artifactDescriptor();
                anticipatedLocation = request.currentLocation();
            }

            Command checked(final Command cmd) {
                return new Command() {

                    @Override public void perform() throws Exception {
                        // Throw an InterruptedException if requested.
                        Thread.sleep(0);
                        // May be undeployed, so check for null.
                        final UpdateMessage um = sessionManager.get(request);
                        if (null != um) checkCancelled(um.type());
                        cmd.perform();
                    }

                    @Override public void revert() throws Exception {
                        cmd.revert();
                    }
                };
            }

            @Override
            public void transmit(final LogRecord record) throws Exception {
                final UpdateMessage um = responseFor(request)
                        .type(PROGRESS_NOTICE)
                        .artifactDescriptor(anticipatedDescriptor)
                        .currentLocation(anticipatedLocation)
                        .build();
                um.attachedLogs().add(record);
                send(um);
            }
        } // Install

        new Install().call();
View Full Code Here

Examples of net.java.trueupdate.message.UpdateMessage

                sendRedeploymentRequest();
                final long stop = System.currentTimeMillis()
                        + HANDSHAKE_TIMEOUT_MILLIS;
                synchronized (sessionManager) {
                    while (true) {
                        final UpdateMessage um = sessionManager.get(request);
                        final Type type = um.type();
                        checkCancelled(type);
                        if (PROCEED_REDEPLOYMENT_RESPONSE.equals(type))
                            break;
                        final long remaining = stop - System.currentTimeMillis();
                        if (0 >= remaining)
View Full Code Here

Examples of net.java.trueupdate.message.UpdateMessage

        if (null == dto) return null;
        final ArtifactDescriptor ad = new ArtifactDescriptorAdapter()
                .unmarshal(dto.artifactDescriptor);
        final List<LogRecord> lrs = new LogRecordsAdapter()
                .unmarshal(dto.logRecords);
        final UpdateMessage um = UpdateMessage
                .builder()
                .timestamp(dto.timestamp)
                .from(dto.from)
                .to(dto.to)
                .type(Type.values()[dto.type])
                .artifactDescriptor(ad)
                .updateVersion(dto.updateVersion)
                .currentLocation(dto.currentLocation)
                .updateLocation(dto.updateLocation)
                .build();
        um.attachedLogs().addAll(lrs);
        return um;
    }
View Full Code Here

Examples of net.java.trueupdate.message.UpdateMessage

                    }
                }
            }

            void sendRedeploymentRequest() throws Exception {
                final UpdateMessage redeploymentRequest = responseFor(request)
                        .type(REDEPLOYMENT_REQUEST)
                        .artifactDescriptor(artifactDescriptor())
                        .build();
                sendAndLog(redeploymentRequest);
            }
View Full Code Here

Examples of net.java.trueupdate.message.UpdateMessage

                    @Override public void perform() throws Exception {
                        // Throw an InterruptedException if requested.
                        Thread.sleep(0);
                        // May be undeployed, so check for null.
                        final UpdateMessage um = sessionManager.get(request);
                        if (null != um) checkCancelled(um.type());
                        cmd.perform();
                    }

                    @Override public void revert() throws Exception {
                        cmd.revert();
View Full Code Here

Examples of net.java.trueupdate.message.UpdateMessage

                };
            }

            @Override
            public void transmit(final LogRecord record) throws Exception {
                final UpdateMessage um = responseFor(request)
                        .type(PROGRESS_NOTICE)
                        .artifactDescriptor(anticipatedDescriptor)
                        .currentLocation(anticipatedLocation)
                        .build();
                um.attachedLogs().add(record);
                send(um);
            }
View Full Code Here

Examples of org.apache.synapse.mediators.annotations.UpdateMessage

            if (readFromMessage != null) {
                AXIOMXPath axiomXpath = createAxiomXPATH(readFromMessage.value(), f.getAnnotation(Namespaces.class));
                beforeFields.put(f, axiomXpath);
            }

            UpdateMessage updateMessage = f.getAnnotation(UpdateMessage.class);
            if (updateMessage != null) {
                AXIOMXPath axiomXpath = createAxiomXPATH(updateMessage.value(), f.getAnnotation(Namespaces.class));
                afterFields.put(f, axiomXpath);
            }

            ReadAndUpdate readAndUpdate = f.getAnnotation(ReadAndUpdate.class);
            if (readAndUpdate != null) {
                AXIOMXPath axiomXpath = createAxiomXPATH(readAndUpdate.value(), f.getAnnotation(Namespaces.class));
                beforeFields.put(f, axiomXpath);
                afterFields.put(f, axiomXpath);
            }
        }

        for (Method m : commandClass.getDeclaredMethods()) {

            ReadFromMessage readFromMessage = m.getAnnotation(ReadFromMessage.class);
            if (readFromMessage != null) {
                AXIOMXPath axiomXpath = createAxiomXPATH(readFromMessage.value(), m.getAnnotation(Namespaces.class));
                beforeMethods.put(m, axiomXpath);
            }

            UpdateMessage updateMessage = m.getAnnotation(UpdateMessage.class);
            if (updateMessage != null) {
                AXIOMXPath axiomXpath = createAxiomXPATH(updateMessage.value(), m.getAnnotation(Namespaces.class));
                afterMethods.put(m, axiomXpath);
            }

        }
    }
View Full Code Here

Examples of org.apache.synapse.mediators.annotations.UpdateMessage

            if (readFromMessage != null) {
                SynapseXPath axiomXpath = createSynapseXPATH(readFromMessage.value(), f.getAnnotation(Namespaces.class));
                beforeFields.put(f, axiomXpath);
            }

            UpdateMessage updateMessage = f.getAnnotation(UpdateMessage.class);
            if (updateMessage != null) {
                SynapseXPath axiomXpath = createSynapseXPATH(updateMessage.value(), f.getAnnotation(Namespaces.class));
                afterFields.put(f, axiomXpath);
            }

            ReadAndUpdate readAndUpdate = f.getAnnotation(ReadAndUpdate.class);
            if (readAndUpdate != null) {
                SynapseXPath axiomXpath = createSynapseXPATH(readAndUpdate.value(), f.getAnnotation(Namespaces.class));
                beforeFields.put(f, axiomXpath);
                afterFields.put(f, axiomXpath);
            }
        }

        for (Method m : commandClass.getDeclaredMethods()) {

            ReadFromMessage readFromMessage = m.getAnnotation(ReadFromMessage.class);
            if (readFromMessage != null) {
                SynapseXPath axiomXpath = createSynapseXPATH(readFromMessage.value(), m.getAnnotation(Namespaces.class));
                beforeMethods.put(m, axiomXpath);
            }

            UpdateMessage updateMessage = m.getAnnotation(UpdateMessage.class);
            if (updateMessage != null) {
                SynapseXPath axiomXpath = createSynapseXPATH(updateMessage.value(), m.getAnnotation(Namespaces.class));
                afterMethods.put(m, axiomXpath);
            }

        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.