Examples of ClassPath


Examples of org.apache.bcel.util.ClassPath

     *  system class path; returns null if the class file can't be
     *  found
     */
    public static ClassPath.ClassFile lookupClassFile( String class_name ) {
        try {
            ClassPath path = _repository.getClassPath();
            if (path == null) {
                return null;
            }
            return path.getClassFile(class_name);
        } catch (IOException e) {
            return null;
        }
    }
View Full Code Here

Examples of org.apache.bcel.util.ClassPath

                }
            }
        }

        private void initUsedClasses(JarFile jarFile) {
            SyntheticRepository repository = SyntheticRepository.getInstance(new ClassPath(jarFile.getName()));
            for (String className : containedClasses) {
                try {
                    analyzeClass(className, repository.loadClass(className));
                } catch (ClassNotFoundException cnfe) {
                    cnfe.printStackTrace();
View Full Code Here

Examples of org.apache.bcel.util.ClassPath

        pathSB.append(classPathStrings[i]);
      }
    }
    pathSB.append(pathSeparator);
    pathSB.append(ClassPath.SYSTEM_CLASS_PATH.toString());
    classPath = new ClassPath(pathSB.toString());
    if (verbose) System.out.println("cp for repository: " + classPath.toString());
    repository = SyntheticRepository.getInstance(classPath);
    try {
      triggerClass = repository.loadClass("org.mitre.sim.Trigger");
    }
View Full Code Here

Examples of org.apache.felix.ipojo.manipulator.util.Classpath

            if (file != null && file.isFile()) {
                urls.add(file.getAbsolutePath());
            }
        }
        getLog().debug("Compute classpath: " + urls);
        Classpath classpath = new Classpath(urls);

        if (isXML()) {
            is = new ByteArrayInputStream(m_metadata.getBytes());
        } else {
            // If the metadata is not set,
            // first check if ./src/main/ipojo exists, if so look into it.
            if (m_metadata == null) {
                File m = new File(m_project.getBasedir(), "src/main/ipojo");
                if (m.isDirectory()) {
                    metadata = m;
                    getLog().info("Metadata directory : " + metadata.getAbsolutePath());
                } else {
                    // Else check target/classes/metadata.xml
                    File meta = new File(m_outputDirectory + File.separator + "metadata.xml");
                    if (!meta.exists()) {
                        // If it still does not exist, try ./metadata.xml
                        meta = new File(m_project.getBasedir() + File.separator + "metadata.xml");
                    }

                    if (meta.exists()) {
                        metadata = meta;
                        getLog().info("Metadata file : " + metadata.getAbsolutePath());
                    }

                    // No metadata.
                }
            } else {
                // metadata path set.
                File m = new File(m_project.getBasedir(), m_metadata);
                if (!m.exists()) {
                    throw new MojoExecutionException("The metadata file does not exist : " + m.getAbsolutePath());
                }
                metadata = m;
                if (m.isDirectory()) {
                    getLog().info("Metadata directory : " + metadata.getAbsolutePath());
                } else {
                    getLog().info("Metadata file : " + metadata.getAbsolutePath());
                }
            }

            if (metadata == null) {
                // Verify if annotations are ignored
                if (m_ignoreAnnotations) {
                    getLog().info("No metadata file found - ignoring annotations");
                    return;
                } else {
                    getLog().info("No metadata file found - trying to use only annotations");
                }
            }
        }

        // Get input bundle, we use the already create artifact.
        File in = null;
        if (m_inputClassifier == null) {
            in = m_project.getArtifact().getFile();
            getLog().info("Input Bundle File : " + in.getAbsolutePath());
            if (!in.exists()) {
                throw new MojoExecutionException("The specified bundle file does not exist : " + in.getAbsolutePath());
            }
        } else {
            // Look from attached artifacts.
            @SuppressWarnings("unchecked")
            List<Artifact> attached = m_project.getAttachedArtifacts();
            for (int i = 0; in == null && attached != null && i < attached.size(); i++) {
                Artifact artifact = attached.get(i);
                if (artifact.hasClassifier() && m_inputClassifier.equals(artifact.getClassifier())) {
                    in = artifact.getFile();
                }
            }

            if (in == null) {
                throw new MojoExecutionException("Cannot find the file to manipulate, " +
                        "no attached artifact with classifier " + m_inputClassifier);
            }

            getLog().info("Input Bundle File : " + in.getAbsolutePath());
            if (!in.exists()) {
                throw new MojoExecutionException("The specified bundle file does not exist : " + in.getAbsolutePath());
            }
        }

        File out = new File(m_buildDirectory + File.separator + "_out.jar");

        Reporter reporter = new MavenReporter(getLog());
        Pojoization pojo = new Pojoization(reporter);
        if (m_ignoreAnnotations) {
            pojo.disableAnnotationProcessing();
        }
        if (!m_ignoreEmbeddedXSD) {
            pojo.setUseLocalXSD();
        }

        // Executes the pojoization.
        if (is == null) {
            if (metadata == null) { // No metadata.
                pojo.pojoization(in, out, (File) null, classpath.createClassLoader()); // Only annotations
            } else {
                pojo.pojoization(in, out, metadata, classpath.createClassLoader()); // Metadata set
            }
        } else { // In-Pom metadata.
            pojo.pojoization(in, out, is, classpath.createClassLoader());
        }

        for (int i = 0; i < reporter.getWarnings().size(); i++) {
            getLog().warn((String) reporter.getWarnings().get(i));
        }
View Full Code Here

Examples of org.apache.felix.ipojo.manipulator.util.Classpath

        for (Jar j : jars) {
            if (j.getSource() != null) {
                paths.add(j.getSource().getAbsolutePath());
            }
        }
        Classpath cp = new Classpath(paths);
        manipulateComponents(reporter, store, cache, cp.createClassLoader());

        int nbComponents = findElements(cache.getMetadatas(), "component").size();
        int nbHandlers = findElements(cache.getMetadatas(), "handler").size();
        this.m_reporter.trace("iPOJO manipulation performed performed in %s ms (%d components, %d handlers).",
                (System.currentTimeMillis() - start),
View Full Code Here

Examples of org.apache.maven.surefire.booter.Classpath

        assertEquals( current, saveAndReload( testStartupConfiguration ).isManifestOnlyJarRequestedAndUsable() );
    }

    private ClasspathConfiguration createClasspathConfiguration()
    {
        Classpath testClassPath = new Classpath( Arrays.asList( "CP1", "CP2" ) );
        Classpath providerClasspath = new Classpath( Arrays.asList( "SP1", "SP2" ) );
        return new ClasspathConfiguration( testClassPath, providerClasspath, Classpath.emptyClasspath(), true, true );
    }
View Full Code Here

Examples of org.apache.maven.surefire.booter.Classpath

        try
        {
            provider.addProviderProperties();
            // cache the provider lookup
            String providerName = provider.getProviderName();
            Classpath providerClasspath = ClasspathCache.getCachedClassPath( providerName );
            if ( providerClasspath == null )
            {
                providerClasspath = provider.getProviderClasspath();
                ClasspathCache.setCachedClasspath( providerName, providerClasspath );

            }
            Artifact surefireArtifact = getCommonArtifact();
            Classpath inprocClassPath = providerClasspath.addClassPathElementUrl( surefireArtifact.getFile().getAbsolutePath() );

            final Classpath testClasspath = generateTestClasspath();

            getLog().debug( testClasspath.getLogMessage( "test" ) );
            getLog().debug( providerClasspath.getLogMessage( "provider" ) );

            getLog().debug( testClasspath.getCompactLogMessage( "test(compact)" ) );
            getLog().debug( providerClasspath.getCompactLogMessage( "provider(compact)" ) );

            final ClasspathConfiguration classpathConfiguration =
                new ClasspathConfiguration( testClasspath, providerClasspath, inprocClassPath,
                                            effectiveIsEnableAssertions(), isChildDelegation() );
View Full Code Here

Examples of org.apache.maven.surefire.booter.Classpath

        //noinspection ResultOfMethodCallIgnored
        tmpDir.mkdirs();

        Artifact shadeFire = getPluginArtifactMap().get( "org.apache.maven.surefire:surefire-shadefire" );

        final Classpath bootClasspathConfiguration =
            getArtifactClasspath( shadeFire != null ? shadeFire : surefireBooterArtifact );

        return new ForkConfiguration( bootClasspathConfiguration, tmpDir, getEffectiveDebugForkedProcess(),
                                      getEffectiveJvm(),
                                      getWorkingDirectory() != null ? getWorkingDirectory() : getBasedir(),
View Full Code Here

Examples of org.apache.maven.surefire.booter.Classpath

        if ( getTestNgArtifact() != null )
        {
            addTestNgUtilsArtifacts( classpath );
        }

        return new Classpath( classpath );
    }
View Full Code Here

Examples of org.apache.maven.surefire.booter.Classpath

        }
    }

    private Classpath getArtifactClasspath( Artifact surefireArtifact )
    {
        Classpath existing = ClasspathCache.getCachedClassPath( surefireArtifact.getArtifactId() );
        if ( existing == null )
        {
            ArtifactResolutionResult result = resolveArtifact( null, surefireArtifact );

            List<String> items = new ArrayList<String>();
            for ( Object o : result.getArtifacts() )
            {
                Artifact artifact = (Artifact) o;

                getLog().debug(
                    "Adding to " + getPluginName() + " booter test classpath: " + artifact.getFile().getAbsolutePath() +
                        " Scope: " + artifact.getScope() );

                items.add( artifact.getFile().getAbsolutePath() );
            }
            existing = new Classpath( items );
            ClasspathCache.setCachedClasspath( surefireArtifact.getArtifactId(), existing );
        }
        return existing;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.