Examples of EndpointDescription


Examples of com.getperka.flatpack.client.dto.EndpointDescription

                  return e1.getPath().compareTo(e2.getPath());
                }
              });
              Iterator<EndpointDescription> iter = sortedEndpoints.iterator();
              while (iter.hasNext()) {
                EndpointDescription ed = iter.next();
                if (ed.getPath() != null && ed.getPath().contains("{path:.*}")) {
                  iter.remove();
                }
              }
              return sortedEndpoints;
            }
            else if ("flatpackEndpoints".equals(propertyName)) {
              List<EndpointDescription> sortedEndpoints = new ArrayList<EndpointDescription>(
                  apiDescription.getEndpoints());
              Collections.sort(sortedEndpoints, new Comparator<EndpointDescription>() {
                @Override
                public int compare(EndpointDescription e1, EndpointDescription e2) {
                  return e1.getPath().compareTo(e2.getPath());
                }
              });
              Iterator<EndpointDescription> iter = sortedEndpoints.iterator();
              while (iter.hasNext()) {
                if (!hasCustomRequestBuilderClass(iter.next())) {
                  iter.remove();
                }
              }
              return sortedEndpoints;
            }
            else if ("requireNames".equals(propertyName)) {
              return entityRequires;
            }
            return super.getProperty(interp, self, o, property, propertyName);
          }
        });

    group.registerModelAdaptor(EndpointDescription.class,
        new ObjectModelAdaptor() {
          @Override
          public Object getProperty(Interpreter interp, ST self, Object o,
              Object property, String propertyName)
              throws STNoSuchPropertyException {
            EndpointDescription end = (EndpointDescription) o;
            if ("docString".equals(propertyName)) {
              return jsDocString(end.getDocString());
            }
            if ("methodName".equals(propertyName)) {

              String path = end.getPath();
              String[] parts = path.split(Pattern.quote("/"));
              StringBuilder sb = new StringBuilder();
              sb.append(end.getMethod().toLowerCase());
              for (int i = 3, j = parts.length; i < j; i++) {
                String part = parts[i];
                if (part.length() == 0) continue;
                if (!part.startsWith("{") && !part.endsWith("}")) {
                  if (part.contains(".")) {
                    String[] dotPart = part.split(Pattern.quote("."));
                    for (String dot : dotPart) {
                      sb.append(upcase(dot));
                    }
                  }
                  else {
                    sb.append(upcase(part));
                  }
                }
                else {
                  sb.append(upcase(part.substring(1, part.length() - 1)));
                }
              }

              return sb.toString();
            }

            else if ("methodParameterList".equals(propertyName)) {
              String path = end.getPath();
              String[] parts = path.split(Pattern.quote("/"));
              StringBuilder sb = new StringBuilder();
              int paramCount = 0;
              for (int i = 3, j = parts.length; i < j; i++) {
                String part = parts[i];
                if (part.length() == 0) continue;

                if (part.startsWith("{") && part.endsWith("}")) {
                  String name = part.substring(1, part.length() - 1);
                  sb.append(name);
                  paramCount++;
                  if (end.getPathParameters() != null
                    && paramCount < end.getPathParameters().size()) {
                    sb.append(", ");
                  }
                }
              }
              if (end.getEntity() != null) {
                if (paramCount > 0) {
                  sb.append(", ");
                }
                sb.append(getNameForType(end.getEntity()));
              }

              return sb.toString();
            }
            else if ("entityName".equals(propertyName)) {
              return getNameForType(end.getEntity());
            }
            else if ("requestBuilderClassName".equals(propertyName)) {

              if (hasCustomRequestBuilderClass(end)) {
                return getBuilderReturnType(end);
              }
              else {
                return "com.getperka.flatpack.client.JsonRequest";
              }
            }

            else if ("requestBuilderBlockName".equals(propertyName)) {
              return getBuilderReturnType(end) + "Block";
            }

            else if ("pathDecoded".equals(propertyName)) {
              // URL-decode the path in the endpoint description
              try {
                String decoded = URLDecoder.decode(end.getPath(), "UTF8");
                return decoded;
              } catch (UnsupportedEncodingException e) {
                throw new RuntimeException(e);
              }
            }
View Full Code Here

Examples of io.fabric8.dosgi.impl.EndpointDescription

        props.put(Constants.OBJECTCLASS, new String[] { BundleActivator.class.getName() });
        props.put("protocols", new String[]{"foo", "bar"});
        props.put("ints", new int[]{1, 2, 3});
        props.put("endpoint.id", "identifier");
        props.put("service.imported.configs", Collections.<Object>singletonList(Manager.CONFIG));;
        EndpointDescription endpoint1 = new EndpointDescription(props);

        String xml = Utils.getEndpointDescriptionXML(endpoint1);

        EndpointDescription endpoint2 = Utils.getEndpointDescription(xml);

        assertNotNull(endpoint2);
        assertNotNull(endpoint2.getInterfaces());
        assertEquals(1, endpoint2.getInterfaces().size());
        assertEquals(BundleActivator.class.getName(), endpoint2.getInterfaces().get(0));
        assertEquals("identifier", endpoint2.getId());
        assertNotNull(endpoint2.getProperties().get("protocols"));
        assertEquals(2, ((String[]) endpoint2.getProperties().get("protocols")).length);
        assertEquals("foo", ((String[]) endpoint2.getProperties().get("protocols"))[0]);
        assertEquals("bar", ((String[]) endpoint2.getProperties().get("protocols"))[1]);
        assertNotNull(endpoint2.getProperties().get("ints"));
        assertEquals(3, ((int[]) endpoint2.getProperties().get("ints")).length);
        assertEquals(1, ((int[]) endpoint2.getProperties().get("ints"))[0]);
        assertEquals(2, ((int[]) endpoint2.getProperties().get("ints"))[1]);
        assertEquals(3, ((int[]) endpoint2.getProperties().get("ints"))[2]);
    }
View Full Code Here

Examples of org.apache.axis2.jaxws.description.EndpointDescription

   
    /*
     * Gets the right handlers for the port/service/bindings and performs injection.
     */
    protected void configureHandlers() throws Exception {
        EndpointDescription desc = AxisServiceGenerator.getEndpointDescription(this.service);
        if (desc == null) {
            this.binding = new BindingImpl("");
        } else {
            String xml = this.portInfo.getHandlersAsXML();
            HandlerChainsType handlerChains = null;
            if (xml != null) {
                ByteArrayInputStream in = new ByteArrayInputStream(xml.getBytes("UTF-8"));
                handlerChains = DescriptionUtils.loadHandlerChains(in);
                desc.setHandlerChain(handlerChains);
            }
           
            if (LOG.isDebugEnabled()) {
                logHandlers(desc.getHandlerChain());
            }
           
            this.binding = BindingUtils.createBinding(desc);
           
            DescriptionUtils.registerHandlerHeaders(desc.getAxisService(), this.binding.getHandlerChain());           
        }
    }
View Full Code Here

Examples of org.apache.axis2.jaxws.description.EndpointDescription

        return endpointDescription;
    }

    private Class getEndpointSEI(QName portQName) {
        Class endpointSEI = null;
        EndpointDescription endpointDesc = getEndpointDescription(portQName);
        if (endpointDesc != null) {
            EndpointInterfaceDescription endpointInterfaceDesc =
                endpointDesc.getEndpointInterfaceDescription();
            if (endpointInterfaceDesc != null ) {
                endpointSEI = endpointInterfaceDesc.getSEIClass();
            }
        }
        return endpointSEI;
View Full Code Here

Examples of org.apache.axis2.jaxws.description.EndpointDescription

    /* (non-Javadoc)
    * @see org.apache.axis2.jaxws.description.ServiceDescription#getEndpointDescription(javax.xml.namespace.QName)
    */
    public EndpointDescription getEndpointDescription(QName portQName) {
        EndpointDescription returnDesc = null;
        if (!DescriptionUtils.isEmpty(portQName)) {
            returnDesc = endpointDescriptions.get(portQName);
        }
        return returnDesc;
    }
View Full Code Here

Examples of org.apache.axis2.jaxws.description.EndpointDescription

    * @see org.apache.axis2.jaxws.description.ServiceDescription#getServiceClient(javax.xml.namespace.QName)
    */
    public ServiceClient getServiceClient(QName portQName) {
        ServiceClient returnServiceClient = null;
        if (!DescriptionUtils.isEmpty(portQName)) {
            EndpointDescription endpointDesc = getEndpointDescription(portQName);
            if (endpointDesc != null) {
                returnServiceClient = endpointDesc.getServiceClient();
            }
            else {
                // Couldn't find Endpoint Description for port QName
                if (log.isDebugEnabled()) {
                    log.debug("Could not find portQName: " + portQName
View Full Code Here

Examples of org.apache.axis2.jaxws.description.EndpointDescription

     *      Class, QName, org.apache.axis2.jaxws.description.DescriptionFactory.UpdateType)
     */
    public static EndpointDescription updateEndpoint(
            ServiceDescription serviceDescription, Class sei, QName portQName,
            DescriptionFactory.UpdateType updateType) {
        EndpointDescription endpointDesc = null;
        synchronized(serviceDescription) {
                endpointDesc =
                ((ServiceDescriptionImpl)serviceDescription)
                        .updateEndpointDescription(sei, portQName, updateType);
        }
View Full Code Here

Examples of org.apache.axis2.jaxws.description.EndpointDescription

   
    /*
     * Gets the right handlers for the port/service/bindings and performs injection.
     */
    protected void configureHandlers() throws Exception {
        EndpointDescription desc = AxisServiceGenerator.getEndpointDescription(this.service);
        if (desc == null) {
            this.binding = new BindingImpl("");
        } else {
            String xml = this.portInfo.getHandlersAsXML();
            HandlerChainsType handlerChains = null;
            if (xml != null) {
                ByteArrayInputStream in = new ByteArrayInputStream(xml.getBytes("UTF-8"));
                handlerChains = DescriptionUtils.loadHandlerChains(in);
                desc.setHandlerChain(handlerChains);
            }
           
            if (LOG.isDebugEnabled()) {
                logHandlers(desc.getHandlerChain());
            }
           
            this.binding = BindingUtils.createBinding(desc);
           
            DescriptionUtils.registerHandlerHeaders(desc.getAxisService(), this.binding.getHandlerChain());           
        }
    }
View Full Code Here

Examples of org.apache.axis2.jaxws.description.EndpointDescription

                      + portName + "," + bindingId + "," + endpointAddress + ")");
        }
      if(endpointAddress!=null && endpointAddress.trim().length()==0){
        ExceptionFactory.makeWebServiceException(Messages.getMessage("addPortErr1", (portName!=null)?portName.getLocalPart():"", endpointAddress));
      }
        EndpointDescription endpointDesc =
                DescriptionFactory.updateEndpoint(serviceDescription, null, portName,
                                                  DescriptionFactory.UpdateType.ADD_PORT, this, bindingId, endpointAddress);
        // TODO: Need to set endpointAddress and set or check bindingId on the EndpointDesc
        endpointDesc.setEndpointAddress(endpointAddress);
        endpointDesc.setClientBindingID(bindingId);
    }
View Full Code Here

Examples of org.apache.axis2.jaxws.description.EndpointDescription

            throw ExceptionFactory.
               makeWebServiceException(Messages.getMessage("invalidEndpointReference",
                                                           e.toString()));
        }
       
        EndpointDescription endpointDesc =
                DescriptionFactory.updateEndpoint(serviceDescription, null, axis2EPR,
                                                  addressingNamespace,
                                                  DescriptionFactory.UpdateType.CREATE_DISPATCH,
                                                  this);
        if (endpointDesc == null) {
            throw ExceptionFactory.makeWebServiceException(
                   Messages.getMessage("endpointDescriptionConstructionFailure",
                    jaxwsEPR.toString()));
        }

        XMLDispatch<T> dispatch = new XMLDispatch<T>(this, endpointDesc, axis2EPR, addressingNamespace, features);

        if (mode != null) {
            dispatch.setMode(mode);
        } else {
            dispatch.setMode(Service.Mode.PAYLOAD);
        }

        if (serviceClient == null)
            serviceClient = getServiceClient(endpointDesc.getPortQName());
       
        if(type == OMElement.class) {
            if (log.isDebugEnabled()) {
                log.debug("This a Dispatch<OMElement>. The custom builder is installed.");
            }
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.