Package com.eviware.soapui.SoapUIExtensionClassLoader

Examples of com.eviware.soapui.SoapUIExtensionClassLoader.SoapUIClassLoaderState


    log.info( "Added default schema from " + url.getPath() + " with targetNamespace " + targetNamespace );
  }

  public static SchemaTypeSystem loadSchemaTypes( String wsdlUrl, SchemaLoader loader ) throws SchemaException
  {
    SoapUIClassLoaderState state = SoapUIExtensionClassLoader.ensure();

    try
    {
      log.info( "Loading schema types from [" + wsdlUrl + "]" );
      ArrayList<XmlObject> schemas = new ArrayList<XmlObject>( getSchemas( wsdlUrl, loader ).values() );

      return buildSchemaTypes( schemas );
    }
    catch( Exception e )
    {
      SoapUI.logError( e );
      if( e instanceof SchemaException )
        throw ( SchemaException )e;
      else
        throw new SchemaException( "Error loading schema types", e );
    }
    finally
    {
      state.restore();
    }
  }
View Full Code Here


  public final static SoapVersion11 instance = new SoapVersion11();

  private SoapVersion11()
  {
    SoapUIClassLoaderState state = SoapUIExtensionClassLoader.ensure();

    try
    {
      XmlOptions options = new XmlOptions();
      options.setCompileNoValidation();
      options.setCompileNoPvrRule();
      options.setCompileDownloadUrls();
      options.setCompileNoUpaRule();
      options.setValidateTreatLaxAsSkip();

      // soapSchemaXml = XmlObject.Factory.parse(
      // SoapUI.class.getResource(
      // "/com/eviware/soapui/resources/xsds/soapEnvelope.xsd" ), options );
      soapSchemaXml = XmlUtils.createXmlObject(
          SoapUI.class.getResource( "/com/eviware/soapui/resources/xsds/soapEnvelope.xsd" ), options );
      soapSchema = XmlBeans.loadXsd( new XmlObject[] { soapSchemaXml } );

      soapEnvelopeType = soapSchema.findDocumentType( envelopeQName );
      soapFaultType = soapSchema.findDocumentType( faultQName );

      // soapEncodingXml = XmlObject.Factory.parse(
      // SoapUI.class.getResource(
      // "/com/eviware/soapui/resources/xsds/soapEncoding.xsd" ), options );
      soapEncodingXml = XmlUtils.createXmlObject(
          SoapUI.class.getResource( "/com/eviware/soapui/resources/xsds/soapEncoding.xsd" ), options );
    }
    catch( Exception e )
    {
      SoapUI.logError( e );
    }
    finally
    {
      state.restore();
    }
  }
View Full Code Here

  // private static URLClassLoader hermesClassLoader;

  private static Context getHermes( String key, String hermesConfigPath ) throws IOException, MalformedURLException,
      NamingException
  {
    SoapUIClassLoaderState state = SoapUIExtensionClassLoader.ensure();
    if( !hermesJarsLoaded )
    {
      addHermesJarsToClasspath();
      hermesJarsLoaded = true;
    }

    if( contextMap.containsKey( key ) )
    {
      return contextMap.get( key );
    }

    // ClassLoader cl = Thread.currentThread().getContextClassLoader();

    try
    {
      Thread.currentThread().setContextClassLoader( JAXBHermesLoader.class.getClassLoader() );
      Properties props = new Properties();
      props.put( Context.INITIAL_CONTEXT_FACTORY, HermesInitialContextFactory.class.getName() );
      props.put( Context.PROVIDER_URL, hermesConfigPath + File.separator + HERMES_CONFIG_XML );
      props.put( "hermes.loader", JAXBHermesLoader.class.getName() );
      Context ctx = new InitialContext( props );
      contextMap.put( key, ctx );
      return ctx;
    }
    finally
    {
      state.restore();
    }
  }
View Full Code Here

   *
   * @throws NamingException
   */
  public static Hermes getHermes( WsdlProject project, String sessionName ) throws NamingException
  {
    SoapUIClassLoaderState state = SoapUIExtensionClassLoader.ensure();
    try
    {
      Context ctx = hermesContext( project );

      Hermes hermes = ( Hermes )ctx.lookup( sessionName );
      return hermes;
    }
    catch( NamingException ne )
    {
      UISupport
          .showErrorMessage( "Hermes configuration is not valid. Please check that 'Hermes Config' project property is set to path of proper hermes-config.xml file" );
      throw new NamingException( "Session name '" + sessionName
          + "' does not exist in Hermes configuration or path to Hermes config ( " + project.getHermesConfig()
          + " )is not valid !!!!" );
    }
    catch( MalformedURLException mue )
    {
      SoapUI.logError( mue );
    }
    catch( IOException ioe )
    {
      SoapUI.logError( ioe );
    }
    finally
    {
      state.restore();
    }
    return null;
  }
View Full Code Here

  private XmlObject soapSchemaXml;
  private XmlObject soapEncodingXml;

  private SoapVersion12()
  {
    SoapUIClassLoaderState state = SoapUIExtensionClassLoader.ensure();

    try
    {
      // soapSchemaXml = XmlObject.Factory.parse( SoapUI.class
      // .getResource(
      // "/com/eviware/soapui/resources/xsds/soapEnvelope12.xsd" ) );
      soapSchemaXml = XmlUtils.createXmlObject( SoapUI.class
          .getResource( "/com/eviware/soapui/resources/xsds/soapEnvelope12.xsd" ) );
      soapSchema = XmlBeans.loadXsd( new XmlObject[] { soapSchemaXml } );
      // soapEncodingXml = XmlObject.Factory.parse( SoapUI.class
      // .getResource(
      // "/com/eviware/soapui/resources/xsds/soapEncoding12.xsd" ) );
      soapEncodingXml = XmlUtils.createXmlObject( SoapUI.class
          .getResource( "/com/eviware/soapui/resources/xsds/soapEncoding12.xsd" ) );
    }
    catch( Exception e )
    {
      SoapUI.logError( e );
    }
    finally
    {
      state.restore();
    }
  }
View Full Code Here

        String fileName = file.getAbsolutePath();
        if (fileName == null) {
            return;
        }

        SoapUIClassLoaderState state = SoapUIExtensionClassLoader.ensure();
        try {
            WsdlProject project = (WsdlProject) workspace.importProject(fileName);
            if (project != null) {
                UISupport.select(project);
            }
        } catch (Exception ex) {
            UISupport.showErrorMessage(ex);
        } finally {
            state.restore();
        }
    }
View Full Code Here

    public ImportRemoteWsdlProjectAction() {
        super(messages.get("title"), messages.get("description"));
    }

    public void perform(WorkspaceImpl workspace, Object param) {
        SoapUIClassLoaderState state = SoapUIExtensionClassLoader.ensure();
        try {
            String url = UISupport.prompt(messages.get("prompt.text"), messages.get("prompt.title"), "");

            if (url != null) {
                WsdlProject project = (WsdlProject) workspace.importRemoteProject(url);
                if (project != null) {
                    UISupport.select(project);
                }
            }
        } catch (Exception ex) {
            UISupport.showErrorMessage(ex);
        } finally {
            state.restore();
        }
    }
View Full Code Here

            }
        });
    }

    public static void initDefaultSchemas() {
        SoapUIClassLoaderState state = SoapUIExtensionClassLoader.ensure();

        try {
            defaultSchemas.clear();

            String root = "/com/eviware/soapui/resources/xsds";

            loadDefaultSchema(SoapUI.class.getResource(root + "/xop.xsd"));
            loadDefaultSchema(SoapUI.class.getResource(root + "/XMLSchema.xsd"));
            loadDefaultSchema(SoapUI.class.getResource(root + "/xml.xsd"));
            loadDefaultSchema(SoapUI.class.getResource(root + "/swaref.xsd"));
            loadDefaultSchema(SoapUI.class.getResource(root + "/xmime200505.xsd"));
            loadDefaultSchema(SoapUI.class.getResource(root + "/xmime200411.xsd"));
            loadDefaultSchema(SoapUI.class.getResource(root + "/soapEnvelope.xsd"));
            loadDefaultSchema(SoapUI.class.getResource(root + "/soapEncoding.xsd"));
            loadDefaultSchema(SoapUI.class.getResource(root + "/soapEnvelope12.xsd"));
            loadDefaultSchema(SoapUI.class.getResource(root + "/soapEncoding12.xsd"));

            String schemaDirectory = SoapUI.getSettings().getString(WsdlSettings.SCHEMA_DIRECTORY, null);
            if (StringUtils.hasContent(schemaDirectory)) {
                loadSchemaDirectory(schemaDirectory);
            }
        } catch (Exception e) {
            SoapUI.logError(e);
        } finally {
            state.restore();
        }
    }
View Full Code Here

        log.info("Added default schema from " + url.getPath() + " with targetNamespace " + targetNamespace);
    }

    public static SchemaTypeSystem loadSchemaTypes(String wsdlUrl, SchemaLoader loader) throws SchemaException {
        SoapUIClassLoaderState state = SoapUIExtensionClassLoader.ensure();

        try {
            log.info("Loading schema types from [" + wsdlUrl + "]");
            ArrayList<XmlObject> schemas = new ArrayList<XmlObject>(getSchemas(wsdlUrl, loader).values());

            return buildSchemaTypes(schemas);
        } catch (Exception e) {
            SoapUI.logError(e);
            if (e instanceof SchemaException) {
                throw (SchemaException) e;
            } else {
                throw new SchemaException("Error loading schema types", e);
            }
        } finally {
            state.restore();
        }
    }
View Full Code Here

    // private static URLClassLoader hermesClassLoader;

    private static Context getHermes(String key, String hermesConfigPath) throws IOException, MalformedURLException,
            NamingException {
        SoapUIClassLoaderState state = SoapUIExtensionClassLoader.ensure();
        if (!hermesJarsLoaded) {
            addHermesJarsToClasspath();
            hermesJarsLoaded = true;
        }

        if (contextMap.containsKey(key)) {
            return contextMap.get(key);
        }

        // ClassLoader cl = Thread.currentThread().getContextClassLoader();

        try {
            Thread.currentThread().setContextClassLoader(JAXBHermesLoader.class.getClassLoader());
            Properties props = new Properties();
            props.put(Context.INITIAL_CONTEXT_FACTORY, HermesInitialContextFactory.class.getName());
            props.put(Context.PROVIDER_URL, hermesConfigPath + File.separator + HERMES_CONFIG_XML);
            props.put("hermes.loader", JAXBHermesLoader.class.getName());
            Context ctx = new InitialContext(props);
            contextMap.put(key, ctx);
            return ctx;
        } finally {
            state.restore();
        }
    }
View Full Code Here

TOP

Related Classes of com.eviware.soapui.SoapUIExtensionClassLoader.SoapUIClassLoaderState

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.