Package org.apache.axis2.mex.om

Examples of org.apache.axis2.mex.om.Metadata


      //  Instantiate Metadata instance to build the WS-Mex Metadata element
        SOAPEnvelope envelope = msgContext.getEnvelope();
        String soapNamespaceURI = envelope.getNamespace().getNamespaceURI();
        SOAPFactory factory = MexUtil.getSOAPFactory(soapNamespaceURI);
       
        Metadata metadata = new Metadata(factory, mexNamespaceValue);
    DataRetrievalRequest requestOptions = new DataRetrievalRequest();
       
        String identifier_value = null;
    // Check if Identifier element included in request
        OMElement dialectElem = aReq.getFirstChildWithName(new QName(
                mexNamespaceValue, MexConstants.SPEC.DIALECT));
       
        if (dialectElem != null)  {
        OMElement identifier = dialectElem.getFirstChildWithName(new QName(
                    mexNamespaceValue, MexConstants.SPEC.IDENTIFIER));
           
        if (identifier != null) {
          identifier_value = identifier.getText();
          if (identifier_value != null && identifier_value.length() > 0) {
            requestOptions.putIdentifier(identifier_value);
          }
        }
        }
       
    // Process the request and append MetadataSection to Metadata
    // Loop through the metadata_request_list for Dialect(s)), and setup requestOptions.
    // Basically, one requestOptions is setup for each supported outputForm for the Dialect
    // and Identifier specified in the GetMetadata request.
    int len = metadata_request_list.size();
    OutputForm[] outputforms;
   
    for (int i = 0; i < len; i++) { // metadata request

            String dialect = "";
      try {
        dialect = (String) metadata_request_list.get(i);

        requestOptions.putDialect(dialect);

        outputforms = MexUtil.determineOutputForm(dialect, axisConfigMEXParm, serviceConfigMEXParm);
        // Loop to call AxisService::getData API to retrieve data
        // for the Dialect and Identifier(if specified) in the request
        // for each
        // supported output form.
       
        for (int j = 0; j < outputforms.length; j++) { // output form
          requestOptions.putOutputForm(outputforms[j]);

          Data[] result =  msgContext.getAxisService().getData(requestOptions,
              msgContext);

          ArrayList sections = processData(result, outputforms[j], dialect,
                 identifier_value, factory);
          metadata.addMetadatSections(sections);
        }

      } catch (DataRetrievalException e) {
        log.error("Data Retrieval exception detected for dialect, " + dialect, e);
       
View Full Code Here


  }
 
   public static Metadata fromEPR(EndpointReference epr) throws MexException {
    ArrayList eprMetdata = epr.getMetaData();
    OMElement mexElement = null;
    Metadata metadata = null;
    if (eprMetdata != null) {
      mexElement = (OMElement) eprMetdata.get(0);
    } else {
      ArrayList refParm = epr.getExtensibleElements();
      if (refParm != null) {
View Full Code Here

   * @throws MexException if invalid mex:Metadata element content is detected
   */

  
    public static Metadata fromOM(OMElement omElement) throws MexException{
        Metadata metadata = fromOM(omElement, MexConstants.Spec_2004_09.NS_URI);
        return metadata;
 
View Full Code Here

   * @throws MexException if invalid mex:Metadata element content is detected
   */  
  public static Metadata fromOM(OMElement omElement, String mexNamespaceValue) throws MexException{
   
    SOAPFactory factory = MexUtil.getSOAPFactory(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
    Metadata metadata = new Metadata(factory, mexNamespaceValue);
    metadata = metadata.fromOM(omElement);
    return metadata;
  }
View Full Code Here

     * @return Policy from the mex service
     */
    public static Policy getPolicyFromMetadataRef(OMElement mex) throws RampartException {
       
        try {
            Metadata metadata = new Metadata();
            metadata.fromOM(mex.getFirstElement());
           
            MetadataSection[] metadataSections = metadata.getMetadatSections();
            MetadataReference reference = metadataSections[0].getMetadataReference();
           
            MexClient serviceClient = new MexClient();

            Options options = serviceClient.getOptions();
            options.setTo(reference.getEPR());
            options.setAction(DRConstants.SPEC.Actions.GET_METADATA_REQUEST);
           
            OMElement request = serviceClient.setupGetMetadataRequest(
                                                        MexConstants.SPEC.DIALECT_TYPE_POLICY,null);
            OMElement result = serviceClient.sendReceive(request);
           
            metadata.fromOM(result);
            MetadataSection[] mexSecs =  metadata.getMetadataSection(MexConstants.SPEC.DIALECT_TYPE_POLICY, null);
            OMElement policyElement = (OMElement) mexSecs[0].getInlineData();
           
            return PolicyEngine.getPolicy(policyElement);
           
           
View Full Code Here

     * @return Policy from the mex service
     */
    public static Policy getPolicyFromMetadataRef(OMElement mex) throws RampartException {
       
        try {
            Metadata metadata = new Metadata();
            metadata.fromOM(mex.getFirstElement());
           
            MetadataSection[] metadataSections = metadata.getMetadatSections();
            MetadataReference reference = metadataSections[0].getMetadataReference();
           
            MexClient serviceClient = new MexClient();

            Options options = serviceClient.getOptions();
            options.setTo(reference.getEPR());
            options.setAction(DRConstants.SPEC.Actions.GET_METADATA_REQUEST);
           
            OMElement request = serviceClient.setupGetMetadataRequest(
                                                        MexConstants.SPEC.DIALECT_TYPE_POLICY,null);
            OMElement result = serviceClient.sendReceive(request);
           
            metadata.fromOM(result);
            MetadataSection[] mexSecs =  metadata.getMetadataSection(MexConstants.SPEC.DIALECT_TYPE_POLICY, null);
            OMElement policyElement = (OMElement) mexSecs[0].getInlineData();
           
            return PolicyEngine.getPolicy(policyElement);
           
           
View Full Code Here

        section.setinlineData(getPolicy());
       
        List lst = new ArrayList();
        lst.add(section);
       
        Metadata mdata = new Metadata();
        mdata.setMetadatSections(lst);
       
        return mdata.toOM();
       
    }
View Full Code Here

    serviceConfigMEXParm = theService.getParameter(MexConstants.MEX_CONFIG.MEX_PARM);
   
    check_MEX_disabled(serviceConfigMEXParm);
   
    try {
      Metadata metadata = handleRequest(msgContext);
            theService.setEndpointURL(msgContext.getTo().getAddress());

      if (metadata != null) {
        SOAPEnvelope envelope = newmsgContext.getEnvelope();
        if (envelope == null) {
          SOAPFactory fac = getSOAPFactory(msgContext);
          envelope = fac.getDefaultEnvelope();
        }
          
        OMElement result = metadata.toOM();
        if (result != null) {
          AxisService service = msgContext.getAxisService();
          result.declareNamespace(service.getTargetNamespace(),
              service.getTargetNamespacePrefix());
          envelope.getBody().addChild(result);
View Full Code Here

   * Handle GetMetadata Request
   * Interprete GetMetadata request and process request.
   * @returns Metadata object
   */
  private Metadata handleRequest(MessageContext msgContext) throws AxisFault {
    Metadata metadata = null;
    SOAPEnvelope envelope = msgContext.getEnvelope();

    SOAPBody body = envelope.getBody();
    OMElement aReq = body.getFirstChildWithName(new QName(
                MexConstants.Spec_2004_09.NS_URI,
View Full Code Here

      //  Instantiate Metadata instance to build the WS-Mex Metadata element
        SOAPEnvelope envelope = msgContext.getEnvelope();
        String soapNamespaceURI = envelope.getNamespace().getNamespaceURI();
        SOAPFactory factory = MexUtil.getSOAPFactory(soapNamespaceURI);
       
        Metadata metadata = new Metadata(factory, mexNamespaceValue);
    DataRetrievalRequest requestOptions = new DataRetrievalRequest();
       
        String identifier_value = null;
    // Check if Identifier element included in request
        OMElement dialectElem = aReq.getFirstChildWithName(new QName(
                mexNamespaceValue, MexConstants.SPEC.DIALECT));
       
        if (dialectElem != null)  {
        OMElement identifier = dialectElem.getFirstChildWithName(new QName(
                    mexNamespaceValue, MexConstants.SPEC.IDENTIFIER));
           
        if (identifier != null) {
          identifier_value = identifier.getText();
          if (identifier_value != null && identifier_value.length() > 0) {
            requestOptions.putIdentifier(identifier_value);
          }
        }
        }
       
    // Process the request and append MetadataSection to Metadata
    // Loop through the metadata_request_list for Dialect(s)), and setup requestOptions.
    // Basically, one requestOptions is setup for each supported outputForm for the Dialect
    // and Identifier specified in the GetMetadata request.
    int len = metadata_request_list.size();
    OutputForm[] outputforms;
   
    for (int i = 0; i < len; i++) { // metadata request

            String dialect = "";
      try {
        dialect = (String) metadata_request_list.get(i);

        requestOptions.putDialect(dialect);

        outputforms = MexUtil.determineOutputForm(dialect, axisConfigMEXParm, serviceConfigMEXParm);
        // Loop to call AxisService::getData API to retrieve data
        // for the Dialect and Identifier(if specified) in the request
        // for each
        // supported output form.
       
        for (int j = 0; j < outputforms.length; j++) { // output form
          requestOptions.putOutputForm(outputforms[j]);

          Data[] result =  msgContext.getAxisService().getData(requestOptions,
              msgContext);

          ArrayList sections = processData(result, outputforms[j], dialect,
                 identifier_value, factory);
          metadata.addMetadatSections(sections);
        }

      } catch (DataRetrievalException e) {
        log.error("Data Retrieval exception detected for dialect, " + dialect, e);
       
View Full Code Here

TOP

Related Classes of org.apache.axis2.mex.om.Metadata

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.