Examples of ServiceDescription


Examples of org.apache.felix.scrplugin.description.ServiceDescription

     *            The service annotations.
     * @param scannedClass
     *            The scanned class
     */
    private ServiceDescription createService(final List<ClassAnnotation> descs, final ScannedClass scannedClass) {
        final ServiceDescription service = new ServiceDescription(descs.get(0));

        final List<String> listedInterfaces = new ArrayList<String>();
        for (final ClassAnnotation d : descs) {
            if (d.getBooleanValue("serviceFactory", false)) {
                service.setServiceFactory(true);
            }
            if (d.getValue("value") != null) {
                final String[] interfaces = (String[]) d.getValue("value");
                for (String t : interfaces) {
                    listedInterfaces.add(t);
                }
            }
        }

        if (listedInterfaces.size() > 0 && !listedInterfaces.contains(AutoDetect.class.getName())) {
            for (final String i : listedInterfaces) {
                service.addInterface(i);
            }
        } else {
            // auto detection
            addInterfaces(service, scannedClass.getScannedClass());
        }
View Full Code Here

Examples of org.apache.felix.scrplugin.description.ServiceDescription

        }

        // generate ServiceDescription if required
        final boolean generateService = cad.getBooleanValue("generateService", true);
        if (generateService) {
            final ServiceDescription sd = new ServiceDescription(cad);
            sd.addInterface("javax.servlet.Servlet");
            classDescription.add(sd);
        }

        // generate PropertyDescriptions
View Full Code Here

Examples of org.apache.felix.scrplugin.description.ServiceDescription

        }

        // generate ServiceDescription if required
        final boolean generateService = cad.getBooleanValue("generateService", true);
        if (generateService) {
            final ServiceDescription sd = new ServiceDescription(cad);
            sd.addInterface("javax.servlet.Filter");
            classDescription.add(sd);
        }

        // generate PropertyDescriptions
        // property order = service.ranking
View Full Code Here

Examples of org.apache.felix.scrplugin.description.ServiceDescription

                    // TODO: implement the properties tag

                } else if (localName.equals(SERVICE)) {

                    this.currentService = new ServiceDescription(null);
                    this.currentClass.add(this.currentService);

                    if (attributes.getValue(SERVICE_ATTR_FACTORY) != null) {
                        this.currentService.setServiceFactory(Boolean.valueOf(attributes.getValue(SERVICE_ATTR_FACTORY)));
                    }
View Full Code Here

Examples of org.apache.felix.scrplugin.description.ServiceDescription

    /**
     * Process service directives
     */
    private void processServices(final ClassDescription current, final ComponentContainer component) {

        final ServiceDescription serviceDesc = current.getDescription(ServiceDescription.class);
        if ( serviceDesc != null ) {
            ServiceDescription service = component.getServiceDescription();
            if ( service == null ) {
                service = new ServiceDescription(serviceDesc.getAnnotation());
                service.setServiceFactory(false);
                component.setServiceDescription(service);
            }
            if ( serviceDesc.isServiceFactory() ) {
                service.setServiceFactory(true);
            }
            for(final String className : serviceDesc.getInterfaces()) {
                service.addInterface(className);
            }
        }
    }
View Full Code Here

Examples of org.apache.tuscany.sca.implementation.osgi.ServiceDescription

    public ServiceDescriptions read(XMLStreamReader reader, ProcessorContext context) throws XMLStreamException,
        ContributionReadException {
        int event = reader.getEventType();
        ServiceDescriptions sds = null;
        ServiceDescription sd = null;
        String propertyName = null;
        String propertyType = "String";
        Object propertyValue = null;
        String propertyLiteral = null;
        boolean xml = false;
        boolean multiValued = false;
        while (true) {
            switch (event) {
                case XMLStreamConstants.START_ELEMENT:
                    QName name = reader.getName();
                    if (ServiceDescriptions.SERVICE_DESCRIPTIONS_QNAME.equals(name)) {
                        sds = factory.createServiceDescriptions();
                    } else if (ServiceDescriptions.SERVICE_DESCRIPTION_QNAME.equals(name)) {
                        sd = factory.createServiceDescription();
                        sds.add(sd);
                    } else if ("property".equals(name.getLocalPart())) {
                        multiValued = false;
                        propertyName = reader.getAttributeValue(null, "name");
                        propertyType = reader.getAttributeValue(null, "value-type");
                        if (propertyType == null) {
                            propertyType = "String";
                        }
                        propertyLiteral = reader.getAttributeValue(null, "value");
                        //                        if (propertyLiteral == null) {
                        //                            propertyLiteral = reader.getElementText();
                        //                        }
                        if (propertyLiteral != null) {
                            propertyLiteral = propertyLiteral.trim();
                            propertyValue = getPropertyValue(reader, propertyName, propertyLiteral, propertyType);
                        }
                    } else if ("list".equals(name.getLocalPart())) {
                        if (propertyValue != null) {
                            throw new IllegalArgumentException("@value and <list> are both present");
                        }
                        propertyValue = new ArrayList<Object>();
                        multiValued = true;
                    } else if ("array".equals(name.getLocalPart())) {
                        if (propertyValue != null) {
                            throw new IllegalArgumentException("@value and <array> are both present");
                        }
                        propertyValue = new ArrayList<Object>();
                        multiValued = true;
                    } else if ("set".equals(name.getLocalPart())) {
                        if (propertyValue != null) {
                            throw new IllegalArgumentException("@value and <set> are both present");
                        }
                        propertyValue = new HashSet<Object>();
                        multiValued = true;
                    } else if ("xml".equals(name.getLocalPart())) {
                        xml = true;
                    } else if ("value".equals(name.getLocalPart())) {
                        propertyLiteral = reader.getElementText();
                        if (propertyLiteral != null) {
                            propertyLiteral = propertyLiteral.trim();
                            Object value = getPropertyValue(reader, propertyName, propertyLiteral, propertyType);
                            if (multiValued && (propertyValue instanceof Collection)) {
                                ((Collection)propertyValue).add(value);
                            } else if (propertyValue == null) {
                                propertyValue = value;
                            }
                        }
                    } else {
                        // FIXME: [rfeng] The rsa spec says the XML should be saved as String
                        Object value = processor.read(reader, context);
                        if (xml) {
                            if (multiValued && (propertyValue instanceof Collection)) {
                                ((Collection)propertyValue).add(value);
                            } else if (propertyValue == null) {
                                propertyValue = value;
                            }
                        }
                    }
                    break;
                case XMLStreamConstants.END_ELEMENT:
                    name = reader.getName();
                    if (ServiceDescriptions.SERVICE_DESCRIPTION_QNAME.equals(name)) {
                        // Reset the sd
                        sd = null;
                    } else if (ServiceDescriptions.PROPERTY_QNAME.equals(name)) {
                        if (sd != null && propertyName != null) {
                            if (propertyValue == null) {
                                throw new IllegalArgumentException("No value is defined for " + propertyName);
                            }
                            sd.getProperties().put(propertyName, propertyValue);
                        }
                        propertyName = null;
                        propertyType = "String";
                        propertyValue = null;
                        multiValued = false;
View Full Code Here

Examples of org.apache.uima.ducc.transport.event.sm.ServiceDescription

        timer.schedule(linger, linger_time);
    }

    IServiceDescription query()
    {
        IServiceDescription sd = new ServiceDescription();
       
        ArrayList<ADuccId> imp = new ArrayList<ADuccId>();
        for ( DuccId id : implementors.keySet() ) {
            imp.add(id);
        }
        sd.setImplementors(imp);

        ArrayList<ADuccId> ref = new ArrayList<ADuccId>();
        ref.clear();
        for ( DuccId id : references.keySet() ) {
            ref.add(id);
        }
        sd.setReferences(ref);

        sd.setInstances(getNInstances());

        sd.setType(service_type);
        sd.setSubclass(service_class);
        sd.setEndpoint(endpoint);
        sd.setBroker(broker);
        sd.setServiceState(getServiceState());
        //sd.setJobState(job_state);
        sd.setActive(serviceMeta != null);
        sd.setStopped(stopped);
        sd.setAutostart(autostart);
        sd.setLinger(linger_time);
        sd.setId(id);
        sd.setUser(user);
        sd.setDeregistered(isDeregistered());

        if ( serviceMeta != null ) {
            sd.setQueueStatistics(serviceMeta.getServiceStatistics());
        }

        return sd;
    }
View Full Code Here

Examples of org.oasis.wsrp.v1.ServiceDescription

      return result;
   }

   private RefreshResult internalRefresh(boolean forceRefresh) throws PortletInvokerException
   {
      ServiceDescription serviceDescription;

      if (isModifyRegistrationRequired)
      {
         return new RefreshResult(RefreshResult.Status.MODIFY_REGISTRATION_REQUIRED);
      }
View Full Code Here

Examples of org.oasis.wsrp.v2.ServiceDescription

         // only add registration properties if we asked for them
         ModelDescription registrationProperties = needsRegistrationProperties ? this.registrationProperties : null;

         // set the service description details
         ServiceDescription serviceDescription = WSRPTypeFactory.createServiceDescription(false);
         serviceDescription.setRequiresInitCookie(BEA_8_CONSUMER_FIX);
         serviceDescription.getSupportedOptions().addAll(OPTIONS);
         serviceDescription.setRegistrationPropertyDescription(registrationProperties);
         serviceDescription.setRequiresRegistration(requireRegistrations);

         // init supported locales. Note that this doesn't mean that all portlets support all these languages but rather that at least one portlet supports at least one of these languages.
         final Set<String> knownPortletHandles = portletDescriptions.keySet();
         Set<String> supportedLocales = new HashSet<String>(knownPortletHandles.size() * 2);

         // if we asked for portlet decriptions, add them to the service description we will return
         Collection<PortletDescription> portlets;
         if (needsPortletDescriptions)
         {
            // if we don't have a list of portlet handles, select all of them
            if (!ParameterValidation.existsAndIsNotEmpty(portletHandles))
            {
               portletHandles = new ArrayList<String>(knownPortletHandles);
            }

            // for each selected portlet
            portlets = new ArrayList<PortletDescription>(portletHandles.size());
            for (String handle : portletHandles)
            {
               // retrieve the associated description
               PortletDescriptionInfo descriptionInfo = portletDescriptions.get(handle);
               if (descriptionInfo != null)
               {
                  // add the languages that the portlet supports to the set of supported languages
                  supportedLocales.addAll(descriptionInfo.getSupportedLanguages());
                  // and add the best-effort localized description for this portlet based on the locales the consumer asked for
                  portlets.add(descriptionInfo.getBestDescriptionFor(desiredLocales));
               }
            }
            serviceDescription.getOfferedPortlets().addAll(portlets);
         }
         serviceDescription.getLocales().addAll(supportedLocales);

         // events
         Collection<EventDescription> events = eventDescriptions.values();
         serviceDescription.getEventDescriptions().addAll(events);

         return serviceDescription;
      }
View Full Code Here

Examples of org.openhab.io.servicediscovery.ServiceDescription

    }
   
    private ServiceDescription getDefaultServiceDescription() {
    Hashtable<String, String> serviceProperties = new Hashtable<String, String>();
    serviceProperties.put("uri", REST_SERVLET_ALIAS);
    return new ServiceDescription("_openhab-server._tcp.local.", "openHAB", httpPort, serviceProperties);
    }
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.