Examples of RemoteServiceEvent


Examples of ch.ethz.iks.r_osgi.RemoteServiceEvent

      final RemoteServiceReference[] refs = (RemoteServiceReference[]) remoteServices
          .values().toArray(
              new RemoteServiceReference[remoteServices.size()]);
      for (int i = 0; i < refs.length; i++) {
        RemoteOSGiServiceImpl
            .notifyRemoteServiceListeners(new RemoteServiceEvent(
                RemoteServiceEvent.UNREGISTERING, refs[i]));
      }

      // uninstall the proxy bundle
      final Bundle[] proxies = (Bundle[]) proxyBundles.values().toArray(
View Full Code Here

Examples of ch.ethz.iks.r_osgi.RemoteServiceEvent

            properties, this);

        remoteServices.put(serviceURI, ref);

        RemoteOSGiServiceImpl
            .notifyRemoteServiceListeners(new RemoteServiceEvent(
                RemoteServiceEvent.REGISTERED, ref));

        return null;
      }
      case LeaseUpdateMessage.SERVICE_MODIFIED: {
        final Dictionary properties = (Dictionary) suMsg.getPayload()[1];
        sanitizeServiceProperties(properties, serviceURI);
        final ServiceRegistration reg = (ServiceRegistration) proxiedServices
            .get(serviceID);
        if (reg != null) {
          reg.setProperties(properties);
        }

        final RemoteServiceReferenceImpl ref = getRemoteReference(serviceURI); //$NON-NLS-1$
        // If r-OSGi receives a SERVICE_MODIFIED for service X before it
        // knows about X (SERVICE_ADDED), there is no point in updating
        // the local service instance. It will fail with an NPE anyway.
        // (see https://bugs.eclipse.org/420433)
        if (ref == null && reg == null) {
          return null;
        }
        ref.setProperties(properties);
        RemoteOSGiServiceImpl
            .notifyRemoteServiceListeners(new RemoteServiceEvent(
                RemoteServiceEvent.MODIFIED, ref));
        return null;
      }
      case LeaseUpdateMessage.SERVICE_REMOVED: {
        if (networkChannel == null) {
          return null;
        }
        final RemoteServiceReference ref = (RemoteServiceReference) remoteServices
            .remove(serviceURI);
        if (ref != null) {
          RemoteOSGiServiceImpl
              .notifyRemoteServiceListeners(new RemoteServiceEvent(
                  RemoteServiceEvent.UNREGISTERING, ref));
        }

        final Bundle bundle = (Bundle) proxyBundles.remove(serviceID);
        if (bundle != null) {
View Full Code Here

Examples of ch.ethz.iks.r_osgi.RemoteServiceEvent

      refs[i] = new RemoteServiceReferenceImpl(serviceInterfaces[i],
          serviceID, properties, this);

      remoteServices.put(refs[i].getURI().toString(), refs[i]);
      RemoteOSGiServiceImpl
          .notifyRemoteServiceListeners(new RemoteServiceEvent(
              RemoteServiceEvent.REGISTERED, refs[i]));
    }
    updateTopics(lease.getTopics(), new String[0]);
    return refs;
  }
View Full Code Here

Examples of org.rioproject.event.RemoteServiceEvent

            if(eventNode==null) {
                tableData.clear();
                this.fireTableDataChanged();
                return;
            }
            RemoteServiceEvent event = eventNode.getEvent();
            tableData.clear();
            String impl = "<not declared>";
            Throwable thrown;
            if(event instanceof ProvisionFailureEvent) {
                String label = "ProvisionFailureEvent."+eventNode.getValueAt(0);
                ProvisionFailureEvent pfe = (ProvisionFailureEvent)event;
                ServiceElement elem = pfe.getServiceElement();
                if(elem.getComponentBundle()!=null)
                    impl = elem.getComponentBundle().getClassName();
                thrown = pfe.getThrowable();
                String exception = getExceptionText(thrown);
                tableData.put("Event", label);
                tableData.put("When", Constants.DATE_FORMAT.format(event.getDate()));
                tableData.put("Deployment", elem.getOperationalStringName());
                tableData.put("Service", elem.getName());
                tableData.put("Class", impl);
                StringBuilder builder = new StringBuilder();
                for(String reason : pfe.getFailureReasons()) {
                    if(builder.length()>0)
                        builder.append("\n    ");
                    builder.append(reason);
                }
                tableData.put("Reason", builder.toString());
                if(exception!=null) {
                    tableData.put("Exception", exception);
                    table.setRowHeight(tableData.size(), table.getRowHeight() * 20);
                }

            } else if(event instanceof ProvisionMonitorEvent) {
                String label = "ProvisionMonitorEvent."+eventNode.getValueAt(0);
                tableData.put("Event", label);
                ProvisionMonitorEvent pme = (ProvisionMonitorEvent)event;
                StringBuilder builder = new StringBuilder();
                if(pme.getAction().equals(ProvisionMonitorEvent.Action.OPSTRING_DEPLOYED) ||
                   pme.getAction().equals(ProvisionMonitorEvent.Action.OPSTRING_UNDEPLOYED)) {
                    StringBuilder serviceNameBuilder = new StringBuilder();
                    for(ServiceElement service : pme.getOperationalString().getServices()) {
                        if(serviceNameBuilder.length()>0) {
                            serviceNameBuilder.append(", ");
                        }
                        serviceNameBuilder.append(service.getName());
                    }
                    builder.append(serviceNameBuilder.toString());
                    tableData.put("When", Constants.DATE_FORMAT.format(event.getDate()));
                    tableData.put("Deployment", pme.getOperationalStringName());
                    tableData.put("Services", builder.toString());
                } else {
                    tableData.put("When", Constants.DATE_FORMAT.format(event.getDate()));
                    tableData.put("Deployment", pme.getOperationalStringName());
                    tableData.put("Description", eventNode.getDescription());
                }

            } else if(event instanceof ServiceLogEvent) {
                String label = "ServiceLogEvent."+eventNode.getValueAt(0);
                tableData.put("Event", label);
                ServiceLogEvent sle = (ServiceLogEvent)event;
                thrown = sle.getLogRecord().getThrown();
                String exception = getExceptionText(thrown);
                tableData.put("When", Constants.DATE_FORMAT.format(event.getDate()));
                tableData.put("Deployment", sle.getOpStringName());
                tableData.put("Service", sle.getServiceName());
                tableData.put("Machine", sle.getAddress().getHostName());
                tableData.put("Message", sle.getLogRecord().getLevel()+": "+sle.getLogRecord().getMessage());
                if(exception!=null) {
                    tableData.put("Exception", exception);
                    table.setRowHeight(tableData.size(), table.getRowHeight() * 20);
                }
            } else {
                String label = "SLAThresholdEvent."+eventNode.getValueAt(0);
                tableData.put("Event", label);
                SLAThresholdEvent slaEvent = (SLAThresholdEvent)event;
                StringBuilder builder = new StringBuilder();
                builder.append("low=").append(slaEvent.getSLA().getCurrentLowThreshold());
                builder.append(" high=").append(slaEvent.getSLA().getCurrentHighThreshold());
                tableData.put("When", Constants.DATE_FORMAT.format(event.getDate()));
                tableData.put("Deployment", slaEvent.getServiceElement().getOperationalStringName());
                tableData.put("Service", slaEvent.getServiceElement().getName());
                tableData.put("Machine", slaEvent.getHostAddress());
                tableData.put("Value", numberFormatter.format(slaEvent.getCalculable().getValue()));
                tableData.put("Threshold Values", builder.toString());
View Full Code Here

Examples of org.rioproject.event.RemoteServiceEvent

    class EventWriter implements Runnable {

        public void run() {
            while (true) {
                RemoteServiceEvent event;
                try {
                    event = eventWriteQ.take();
                } catch (InterruptedException e) {
                    logger.debug("EventWriter breaking out of main loop");
                    break;
                }
                File file = new File(persistentEventDirectory, createEventFileName(event));
                if(logger.isDebugEnabled())
                    logger.debug(String.format("Writing %s to %s", event, file.getPath()));
                ObjectOutputStream outputStream = null;
                try {
                    logger.debug(RMIClassLoader.getClassAnnotation(event.getClass()));
                    outputStream = new ObjectOutputStream(new FileOutputStream(file));
                    outputStream.writeObject(new RemoteServiceEventHolder(event));
                    if(logger.isDebugEnabled())
                        logger.debug(String.format("Wrote %d bytes to %s", file.length(), file.getPath()));
                } catch (IOException e) {
View Full Code Here

Examples of org.rioproject.event.RemoteServiceEvent

                                                           null));
    }

    @Test
    public void testPostNotify() throws Exception {
        RemoteServiceEvent event = new RemoteServiceEvent("Test Event");
        eventManager.notify(event);
        Assert.assertEquals(1, eventManager.getEvents().size());
    }
View Full Code Here

Examples of org.rioproject.event.RemoteServiceEvent

    }

    static List<RemoteServiceEvent> createRemoteServiceEvents(int count) {
        List<RemoteServiceEvent> list = new ArrayList<RemoteServiceEvent>();
        for(int i=0; i<count; i++) {
            RemoteServiceEvent event = new RemoteServiceEvent("Test Event "+i);
            event.setSequenceNumber(i);
            list.add(event);
            try {
                Thread.sleep(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
View Full Code Here

Examples of org.rioproject.event.RemoteServiceEvent

    public RemoteServiceEventHolder(RemoteServiceEvent event) throws IOException {
        marshalledEvent = new MarshalledObject<RemoteServiceEvent>(event);
    }

    public RemoteServiceEvent getRemoteServiceEvent() throws ClassNotFoundException {
        RemoteServiceEvent remoteServiceEvent;
        try {
            remoteServiceEvent = marshalledEvent.get();
        } catch (IOException e) {
            throw new ClassNotFoundException("Failed to create client-side remote event", e);
        }
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.