Package org.codehaus.classworlds

Examples of org.codehaus.classworlds.ClassRealm


            {
                getLogger().fatalError(
                                        configurator.getClass().getName() + "#configureComponent(...) caused a linkage error ("
                                            + e.getClass().getName() + ") and may be out-of-date. Check the realms:" );

                ClassRealm pluginRealm = mojoDescriptor.getPluginDescriptor().getClassRealm();
                StringBuffer sb = new StringBuffer();
                sb.append( "Plugin realm = " + pluginRealm.getId() ).append( '\n' );
                for ( int i = 0; i < pluginRealm.getConstituents().length; i++ )
                {
                    sb.append( "urls[" + i + "] = " + pluginRealm.getConstituents()[i] );
                    if ( i != ( pluginRealm.getConstituents().length - 1 ) )
                    {
                        sb.append( '\n' );
                    }
                }
                getLogger().fatalError( sb.toString() );

                ClassRealm containerRealm = container.getContainerRealm();
                sb = new StringBuffer();
                sb.append( "Container realm = " + containerRealm.getId() ).append( '\n' );
                for ( int i = 0; i < containerRealm.getConstituents().length; i++ )
                {
                    sb.append( "urls[" + i + "] = " + containerRealm.getConstituents()[i] );
                    if ( i != ( containerRealm.getConstituents().length - 1 ) )
                    {
                        sb.append( '\n' );
                    }
                }
                getLogger().fatalError( sb.toString() );
View Full Code Here


        DefaultPlexusContainer child = new DefaultPlexusContainer();

        child.classWorld = classWorld;

        ClassRealm childRealm = null;

        String childRealmId = getName() + ".child-container[" + name + "]";
        try
        {
            childRealm = classWorld.getRealm( childRealmId );
        }
        catch ( NoSuchRealmException e )
        {
            try
            {
                childRealm = classWorld.newRealm( childRealmId );
            }
            catch ( DuplicateRealmException impossibleError )
            {
                getLogger().error( "An impossible error has occurred. After getRealm() failed, newRealm() " +
                    "produced duplication error on same id!", impossibleError );
            }
        }

        childRealm.setParent( plexusRealm );

        child.coreRealm = childRealm;

        child.plexusRealm = childRealm;
View Full Code Here

        {
            if ( container != null )
            {
                container.dispose();

                ClassRealm realm = container.getContainerRealm();

                if ( realm != null )
                {
                    realm.getWorld().disposeRealm( realm.getId() );
                }
            }
        }
    }
View Full Code Here

        }
        catch ( LinkageError e )
        {
            if ( getLog().isErrorEnabled() )
            {
                ClassRealm reportPluginRealm = mojoDescriptor.getPluginDescriptor().getClassRealm();
                StringBuilder sb = new StringBuilder( 1024 );
                sb.append( report.getClass().getName() ).append( "#generate(...) caused a linkage error (" );
                sb.append( e.getClass().getName() )
                        .append( ") and may be out-of-date. Check the realms:" ).append( EOL );
                sb.append( "Maven Report Plugin realm = " ).append( reportPluginRealm.getId() ).append( EOL );
                for ( int i = 0; i < reportPluginRealm.getConstituents().length; i++ )
                {
                    sb.append( "urls[" ).append( i ).append( "] = " ).append( reportPluginRealm.getConstituents()[i] );
                    if ( i != ( reportPluginRealm.getConstituents().length - 1 ) )
                    {
                        sb.append( EOL );
                    }
                }
View Full Code Here

        }
        catch ( LinkageError e )
        {
            if ( getLog().isErrorEnabled() )
            {
                ClassRealm reportPluginRealm = mojoDescriptor.getPluginDescriptor().getClassRealm();
                StringBuffer sb = new StringBuffer();
                sb.append( report.getClass().getName() ).append( "#generate(...) caused a linkage error (" );
                sb.append( e.getClass().getName() )
                        .append( ") and may be out-of-date. Check the realms:" ).append( EOL );
                sb.append( "Maven Report Plugin realm = " + reportPluginRealm.getId() ).append( EOL );
                for ( int i = 0; i < reportPluginRealm.getConstituents().length; i++ )
                {
                    sb.append( "urls[" + i + "] = " + reportPluginRealm.getConstituents()[i] );
                    if ( i != ( reportPluginRealm.getConstituents().length - 1 ) )
                    {
                        sb.append( EOL );
                    }
                }
View Full Code Here

   * @throws LauncherException the exception
   */
  public void performLaunch() throws LauncherException {
    Throwable throwable = null;
    try {
      ClassRealm mainRealm = getMainRealm();

      Class clazz = mainRealm.loadClass(mainClassName);

      Class classworldClass = mainRealm.loadClass(CLASSWORLD_CLASS_NAME);

      Method method = ReflectionUtil.getMainMethodWithTwoParameters(clazz, classworldClass);

      try {
        ReflectionUtil.launchClass(method, new Object[] { args, classWorld },
View Full Code Here

   *
   * @param libPaths the list of library paths
   * @throws Exception the exception
   */
  protected void addLibraries(List<String> libPaths) throws Exception {
    ClassRealm classRealm = getMainRealm();

    for (String libPath : libPaths) {
      File libPathFile = new File(libPath);

      if (libPathFile.isDirectory()) {
        File[] files = libPathFile.listFiles();

        for (File file : files) {
          classRealm.addConstituent(file.toURI().toURL());
        }
      }
    }
  }
View Full Code Here

    String realmName = getRealmName();

    classworldLauncher.setAppMain(mainClassName, realmName);

    try {
      ClassRealm curRealm = classWorld.newRealm(realmName, parentClassLoader);

      configuredRealms.put(realmName, curRealm);
    }
    catch (DuplicateRealmException e) {
      throw new LauncherException(e);
View Full Code Here

    try {
      System.out.println(this);
      System.out.println(classworldLauncher.getWorld());
      System.out.println(classworldLauncher.getMainRealmName());

      ClassRealm realm = classworldLauncher.getMainRealm();

      URL[] constituents = realm.getConstituents();

      System.out.println("---------------------------------------------------");

      for (int i = 0; i < constituents.length; i++) {
        System.out.println("constituent[" + i + "]: " + constituents[i]);
View Full Code Here

      int j = realmName.lastIndexOf('.');

      if (j > 0) {
        String parentRealmName = realmName.substring(0, j);

        ClassRealm parentRealm = configuredRealms.get(parentRealmName);

        if (parentRealm != null) {
          ClassRealm realm = configuredRealms.get(realmName);

          realm.setParent(parentRealm);
        }
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.codehaus.classworlds.ClassRealm

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.