Package com.eviware.soapui.SoapUIExtensionClassLoader

Examples of com.eviware.soapui.SoapUIExtensionClassLoader.SoapUIClassLoaderState


    {
      SoapUI.setSoapUICore( createSoapUICore(), true );
      SoapUI.initGCTimer();
    }

    SoapUIClassLoaderState state = SoapUIExtensionClassLoader.ensure();

    try
    {
      return runRunner();
    }
    finally
    {
      state.restore();
    }
  }
View Full Code Here


  }

  public synchronized Object run() throws Exception
  {
    saver.lockSave();
    SoapUIClassLoaderState state = SoapUIExtensionClassLoader.ensure();
    try
    {

      if( StringUtils.isNullOrEmpty( scriptText ) )
        return null;

      if( script == null )
      {
        compile();
      }

      Object result = script.run();

      return result;
    }
    finally
    {
      state.restore();
      saver.unlockSave();
    }
  }
View Full Code Here

  public synchronized void compile() throws Exception
  {
    if( script == null )
    {
      SoapUIClassLoaderState state = SoapUIExtensionClassLoader.ensure();
      try
      {
        script = shell.parse( scriptText );
        script.setBinding( binding );
      }
      finally
      {
        state.restore();
      }
    }
  }
View Full Code Here

    return expand( context, content, false );
  }

  public String expand( PropertyExpansionContext context, String content, boolean entitize )
  {
    SoapUIClassLoaderState clState = SoapUIExtensionClassLoader.ensure();

    try
    {

      if( StringUtils.isNullOrEmpty( content ) )
        return content;

      int ix = content.indexOf( "${" );
      if( ix == -1 )
        return content;

      StringBuffer buf = new StringBuffer();
      int lastIx = 0;
      while( ix != -1 )
      {
        if( ix > lastIx && content.charAt( ix - 1 ) == '$' )
        {
          buf.append( content.substring( lastIx, ix - 1 ) );
          lastIx = ix;
          ix = content.indexOf( "${", lastIx + 1 );
          continue;
        }

        if( ix > lastIx )
          buf.append( content.substring( lastIx, ix ) );

        int ix2 = content.indexOf( '}', ix + 2 );
        if( ix2 == -1 )
          break;

        // check for nesting
        int ix3 = content.lastIndexOf( "${", ix2 );
        if( ix3 != ix )
        {
          // buf.append( content.substring( ix, ix3 ));
          content = content.substring( 0, ix3 ) + expand( context, content.substring( ix3, ix2 + 1 ) )
              + content.substring( ix2 + 1 );

          lastIx = ix;
          continue;
        }

        String propertyName = content.substring( ix + 2, ix2 );
        String propertyValue = null;

        if( StringUtils.hasContent( propertyName ) )
        {
          boolean globalOverrideEnabled = SoapUI.getSettings().getBoolean( GlobalPropertySettings.ENABLE_OVERRIDE );

          for( int c = 0; c < propertyResolvers.size() && propertyValue == null; c++ )
          {
            propertyValue = propertyResolvers.get( c ).resolveProperty( context, propertyName,
                globalOverrideEnabled );
          }
        }

        // found a value?
        if( propertyValue != null )
        {
          if( !content.equals( propertyValue ) )
            propertyValue = expand( context, propertyValue );

          if( entitize )
            propertyValue = XmlUtils.entitize( propertyValue );

          buf.append( propertyValue );
        }
        else
        {
          // if( log.isEnabledFor( Priority.WARN ))
          // log.warn( "Missing property value for [" + propertyName + "]"
          // );

          // buf.append( "${" ).append( propertyName ).append( '}' );
        }

        lastIx = ix2 + 1;
        ix = content.indexOf( "${", lastIx );
      }

      if( lastIx < content.length() )
        buf.append( content.substring( lastIx ) );

      return buf.toString();
    }
    finally
    {
      clState.restore();
    }
  }
View Full Code Here

  public void actionPerformed( ActionEvent e )
  {
    // required by IDE plugins
    if( SwingActionDelegate.switchClassloader )
    {
      SoapUIClassLoaderState state = SoapUIExtensionClassLoader.ensure();

      try
      {
        ( ( SoapUIMultiAction )mapping.getAction() ).perform( targets, mapping.getParam() );
      }
      catch( Throwable t )
      {
        SoapUI.logError( t );
      }
      finally
      {
        state.restore();
      }
    }
    else
    {
      try
View Full Code Here

    return mapping;
  }

  public void actionPerformed( ActionEvent e )
  {
    SoapUIClassLoaderState state = SoapUIExtensionClassLoader.ensure();

    try
    {
      mapping.getAction().perform( target, param == null ? mapping.getParam() : param );
    }
    catch( Throwable t )
    {
      SoapUI.logError( t );
    }
    finally
    {
      state.restore();
    }
  }
View Full Code Here

    return getAction();
  }

  public static void invoke( Runnable action )
  {
    SoapUIClassLoaderState state = SoapUIExtensionClassLoader.ensure();

    try
    {
      action.run();
    }
    catch( Throwable t )
    {
      SoapUI.logError( t );
    }
    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

    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

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.