Package org.osgi.service.blueprint.reflect

Examples of org.osgi.service.blueprint.reflect.ServiceMetadata


            } else if (metadata instanceof ReferenceMetadata) {
                ReferenceMetadata rmd = (ReferenceMetadata) metadata;
                processingStack.add("Reference named " + rmd.getId() + "->");
                return processReferenceMetadata(rmd);
            } else if (metadata instanceof ServiceMetadata) {
                ServiceMetadata smd = (ServiceMetadata) metadata;
                processingStack.add("Service named " + smd.getId() + "->");
                return processServiceMetadata(smd);
            } else if (metadata instanceof CollectionMetadata) {
                CollectionMetadata cmd = (CollectionMetadata) metadata;
                processingStack.add("Collection of type " + cmd.getCollectionClass() + "->");
                return processCollectionMetadata(cmd);
View Full Code Here


            } else if (metadata instanceof ReferenceMetadata) {
                ReferenceMetadata rmd = (ReferenceMetadata) metadata;
                processingStack.add("Reference named " + rmd.getId() + "->");
                return processReferenceMetadata(rmd);
            } else if (metadata instanceof ServiceMetadata) {
                ServiceMetadata smd = (ServiceMetadata) metadata;
                processingStack.add("Service named " + smd.getId() + "->");
                return processServiceMetadata(smd);
            } else if (metadata instanceof CollectionMetadata) {
                CollectionMetadata cmd = (CollectionMetadata) metadata;
                processingStack.add("Collection of type " + cmd.getCollectionClass() + "->");
                return processCollectionMetadata(cmd);
View Full Code Here

    List<ExportedService> result = new ArrayList<ExportedService>();
    Set<String> names = cdr.getComponentDefinitionNames();
    for (String name: names) {
      ComponentMetadata compMetadata = cdr.getComponentDefinition(name);
      if (compMetadata instanceof ServiceMetadata) {
        ServiceMetadata serviceMetadata = (ServiceMetadata)compMetadata;
        String serviceName;
        int ranking;
        Collection<String> interfaces = new ArrayList<String>();
        Map<String, Object> serviceProps = new HashMap<String, Object>();

        ranking = serviceMetadata.getRanking();
        for (Object i : serviceMetadata.getInterfaces()) {
          interfaces.add((String)i);
        }
       
        // get the service properties
        List<MapEntry> props = serviceMetadata.getServiceProperties();
        for (MapEntry entry : props) {
          String key = ((ValueMetadata)entry.getKey()).getStringValue();
         
          Metadata value = entry.getValue();
          if (value instanceof CollectionMetadata) {
            List<Metadata> values = ((CollectionMetadata)value).getValues();
            String[] theseValues = new String[values.size()];
            for (int i=0; i < values.size(); i++) {
              Metadata m = values.get(i);
              theseValues[i] = ((ValueMetadata)m).getStringValue();
            }
            serviceProps.put(key, theseValues);
          } else {
            serviceProps.put(key, ((ValueMetadata)entry.getValue()).getStringValue());
          }
        }

        // serviceName: use the service id unless that's not set,
        // in which case we use the bean id.
        serviceName = serviceMetadata.getId();
       
        // If the Service references a Bean, export the bean id as a service property
        // as per 121.6.5 p669 of the blueprint 1.0 specification
        Target t = serviceMetadata.getServiceComponent();
        String targetId = null;
        if (t instanceof RefMetadata) {
          targetId = ((RefMetadata)t).getComponentId();
        } else if (t instanceof BeanMetadata) {
          targetId = ((BeanMetadata)t).getId();
View Full Code Here

            } else if (metadata instanceof ReferenceMetadata) {
                ReferenceMetadata rmd = (ReferenceMetadata) metadata;
                processingStack.add("Reference named " + rmd.getId() + "->");
                return processReferenceMetadata(rmd);
            } else if (metadata instanceof ServiceMetadata) {
                ServiceMetadata smd = (ServiceMetadata) metadata;
                processingStack.add("Service named " + smd.getId() + "->");
                return processServiceMetadata(smd);
            } else if (metadata instanceof CollectionMetadata) {
                CollectionMetadata cmd = (CollectionMetadata) metadata;
                processingStack.add("Collection of type " + cmd.getCollectionClass() + "->");
                return processCollectionMetadata(cmd);
View Full Code Here

        boolean suppressAnonymousServices) {
      _logger.debug(LOG_ENTRY, "parseCDRForServices", new Object[]{cdr, suppressAnonymousServices});
      List<ExportedService> result = new ArrayList<ExportedService>();
      for (ComponentMetadata compMetadata : findAllComponents(cdr)) {
        if (compMetadata instanceof ServiceMetadata) {
          ServiceMetadata serviceMetadata = (ServiceMetadata)compMetadata;
          String serviceName;
          int ranking;
          Collection<String> interfaces = new ArrayList<String>();
          Map<String, Object> serviceProps = new HashMap<String, Object>();

          ranking = serviceMetadata.getRanking();
          for (Object i : serviceMetadata.getInterfaces()) {
            interfaces.add((String)i);
          }
         
          // get the service properties
          List<MapEntry> props = serviceMetadata.getServiceProperties();
          for (MapEntry entry : props) {
            String key = ((ValueMetadata)entry.getKey()).getStringValue();
           
            Metadata value = entry.getValue();
            if (value instanceof CollectionMetadata) {
              processMultiValueProperty(serviceProps, key, value);
            } else {
              serviceProps.put(key, ((ValueMetadata)entry.getValue()).getStringValue());
            }
          }

          // serviceName: use the service id unless that's not set,
          // in which case we use the bean id.
          serviceName = serviceMetadata.getId();
         
          // If the Service references a Bean, export the bean id as a service property
          // as per 121.6.5 p669 of the blueprint 1.0 specification
          Target t = serviceMetadata.getServiceComponent();
          String targetId = null;
          if (t instanceof RefMetadata) {
            targetId = ((RefMetadata)t).getComponentId();
          } else if (t instanceof BeanMetadata) {
            targetId = ((BeanMetadata)t).getId();
View Full Code Here

            for (BeanProperty property : bean.getProperties()) {
                traverse(property.getValue(), output);
            }
           
        } else if (component instanceof ServiceMetadata) {
            ServiceMetadata service = (ServiceMetadata) component;
                       
            traverse(service.getServiceComponent(), output);
           
            for (RegistrationListener listener : service.getRegistrationListeners()) {
                 traverse(listener.getListenerComponent(), output);
            }
           
            for (MapEntry e : service.getServiceProperties()) {
                traverse(e.getKey(), output);
                traverse(e.getValue(), output);
            }
           
        } else if (component instanceof ServiceReferenceMetadata) {
View Full Code Here

            } else if (metadata instanceof ReferenceMetadata) {
                ReferenceMetadata rmd = (ReferenceMetadata) metadata;
                processingStack.add("Reference named " + rmd.getId() + "->");
                return processReferenceMetadata(rmd);
            } else if (metadata instanceof ServiceMetadata) {
                ServiceMetadata smd = (ServiceMetadata) metadata;
                processingStack.add("Service named " + smd.getId() + "->");
                return processServiceMetadata(smd);
            } else if (metadata instanceof CollectionMetadata) {
                CollectionMetadata cmd = (CollectionMetadata) metadata;
                processingStack.add("Collection of type " + cmd.getCollectionClass() + "->");
                return processCollectionMetadata(cmd);
View Full Code Here

TOP

Related Classes of org.osgi.service.blueprint.reflect.ServiceMetadata

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.