Package org.apache.muse.tools.generator.util

Examples of org.apache.muse.tools.generator.util.Capability


      newLine(2,code);
    }
  }

  private void generateNSDeclarations(ClassInfo classInfo, StringBuffer code) {
    Capability capability = classInfo.getCapability();
    indent(code);
    statement("String PREFIX = \"tns\";", code);
    newLine(2,code);
   
    indent(code);
    statement("String NAMESPACE_URI = \""+ capability.getURI() +"\";", code);
    newLine(2,code);
  }
View Full Code Here


    writeToFileCheck(descriptorDocument, descriptorFile);
  }

  protected Class getResourceClass(Map capabilities) {
    for(Iterator i = capabilities.values().iterator(); i.hasNext();) {
      Capability capability = (Capability)i.next();
      if(capability.getProperties().size() > 0) {
        return org.apache.muse.ws.resource.impl.SimpleWsResource.class;
      }
    }
    return org.apache.muse.core.SimpleResource.class;
  }
View Full Code Here

    ignoreSet.add(new File(classFileName));
  }
 
  protected void endHeaderCode(ClassInfo classInfo) {
    generateImports(classInfo, _headerCode);
    Capability capability = classInfo.getCapability()
    String[] interfaces = null;
    if(!capability.isEmpty()) {
      interfaces = new String[]{ ReflectUtils.getShortName(generateClassName(INTERFACE_PREFIX,capability)) };
    }
    String parentClass = convertType(getBaseClass(capability), classInfo);
    generateClassDef(_className, parentClass, interfaces , false, _headerCode)
  }
View Full Code Here

    String parentClass = convertType(getBaseClass(capability), classInfo);
    generateClassDef(_className, parentClass, interfaces , false, _headerCode)
  }
 
  protected void generatePropertiesDeclarations(ClassInfo classInfo, StringBuffer code) {
    Capability capability = classInfo.getCapability();
   
    if(capability.getProperties().size() == 0) {
      return;
    }
   
    indent(code);
    code.append("private static final "
      + convertType(QName.class, classInfo)
      + "[] _PROPERTIES = new "
      + convertType(QName.class, classInfo)
      + "[]");
    newLine(code);
    addImport(QName.class);
   
    indent(code);
    generateOpenBlock(code);
    newLine(code);
   
    for(Iterator i=capability.getProperties().iterator(); i.hasNext();) {
      JavaProperty property = (JavaProperty)i.next();
      indent(2,code);
      code.append("new "
        + convertType(QName.class, classInfo)
        + "(NAMESPACE_URI, \""
        + getPropertyName(property, false)
        + "\", PREFIX)");
      if(i.hasNext()) {
        code.append(",");
      }
      newLine(code);
    }
   
    indent(code);
    generateCloseBlock(code);
    statement(";",code);
    newLine(2,code);
   
    indent(code);
    code.append("public "
      + convertType(QName.class, classInfo)
      + "[] getPropertyNames()");
    newLine(code);
   
    indent(code);
    generateOpenBlock(code);
    newLine(code);
   
    indent(2,code);
    code.append("return _PROPERTIES;");
   
    newLine(code);
    indent(code);
    generateCloseBlock(code);
    newLine(2,code);
   
    for(Iterator i=capability.getProperties().iterator(); i.hasNext();) {
      JavaProperty property = (JavaProperty)i.next();
      indent(code);
      code.append("private "
        + convertType(property.getJavaType(), classInfo)
        + " _"
View Full Code Here

    writeToFileCheck(descriptorDocument, descriptorFile);
  }

  protected Class getResourceClass(Map capabilities) {
    for(Iterator i = capabilities.values().iterator(); i.hasNext();) {
      Capability capability = (Capability)i.next();
      if(capability.getProperties().size() > 0) {
        return org.apache.muse.ws.resource.impl.SimpleWsResource.class;
      }
    }
    return org.apache.muse.core.SimpleResource.class;
  }
View Full Code Here

   *         The inspector that ran against the current WSDL
   * @param capabilities
   *         A Map of capability objects (URI->Capability)
   */
  private void extractProperties(ResourceInspector inspector, Map capabilities) {
    Capability capability = null;
   
    Collection properties = inspector.getProperties();   

    if (properties != null) {
      for (Iterator i = properties.iterator(); i.hasNext();) {
        QName property = (QName) i.next();
        capability = getCapability(property,capabilities);
        capability.addProperty(makeJavaProperty(property, inspector));
      }
    }
  }
View Full Code Here

   *         The inspector that ran against the current WSDL
   * @param capabilities
   *         A Map of capability objects (URI->Capability)
   */
  private void extractOperations(ResourceInspector inspector, Map capabilities) {   
    Capability capability = null;

    Map methods = inspector.getJavaMethods();

    for (Iterator i = methods.values().iterator(); i.hasNext();) {
      JavaMethod method = (JavaMethod) i.next();
     
      capability = getCapability(method.getName(), capabilities);
           
      String actionURI = (String) _internalActionMap.get(method.getName());
      if(actionURI != null) {
        method.setActionURI(actionURI);
      }
     
      capability.addOperation(method);
    }
  }
View Full Code Here

           
    Capability[] capsFromDescriptor = helper.getCapabilities();
    Map currentCapabilityMap = _capabilityMaps[resourceIndex];
   
    for(int i=0; i < capsFromDescriptor.length; i++) {
      Capability capability = capsFromDescriptor[i];
     
      //
      // If the capability is in the capability map then
      // it means that we found some wsdl operations or properties. If
      // it isn't in this map then it's something that has no wsdl properties
      // or operations which means it's one of those empty capabilities. We
      // want to generate code for this, just in case.
      //
      String uri = capability.getURI();
      Capability existingCapability = (Capability) currentCapabilityMap.get(uri);

      if(existingCapability != null) {
        String implClass = capability.getImplementingClass();
       
        if(implClass != null) {
          String existingClass = existingCapability.getImplementingClass();
          if(existingClass == null) {
            existingCapability.setImplementingClass(implClass);
            existingCapability.setBuiltIn(false);
          } else {
            if(!existingClass.equals(implClass)) {
              existingCapability.setImplementingClass(implClass);
              existingCapability.setBuiltIn(false)
            }
          }
        } 
      } else {
        //
View Full Code Here

   *         A new wrapped capability or an existing capability.
   */
  private Capability getCapability(QName qname, Map capabilities) {
    String capabilityURI = getCapabilityURI(qname);
   
    Capability capability = (Capability) capabilities.get(capabilityURI);

    if (capability == null) {
      capability = new Capability(capabilityURI);
      capabilities.put(capabilityURI, capability);
    }

    Class implementingClass = (Class)_internalImplMap.get(capabilityURI);
    if(implementingClass != null) {
      capability.setImplementingClass(implementingClass.getName());
      capability.setBuiltIn(true);
    }
   
    return capability;
  }
View Full Code Here

    initializeCode(className);
   
    ClassInfo classInfo = new ClassInfo();
   
    for (Iterator i = capabilityMap.values().iterator(); i.hasNext();) {
      Capability capability = (Capability)i.next();
               
      if(needsGeneratedCode(_baseClientClass, capability)) {
        classInfo.setCapability(capability);
        updateCode(classInfo);
      }
View Full Code Here

TOP

Related Classes of org.apache.muse.tools.generator.util.Capability

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.