Package org.lilyproject.runtime.rapi

Examples of org.lilyproject.runtime.rapi.ModuleSource


        this.moduleDefinition = moduleDefinition;
        this.runtime = runtime;
    }

    private ModuleConfig build() {
        ModuleSource moduleSource = null;
        VersionManager versionManager = new VersionManager(runtime);
        try {
            moduleSource = runtime.getModuleSourceManager().getModuleSource(moduleDefinition.getFile(), moduleDefinition.getSourceType());

            // build classpath
            ClassLoadingConfig classLoadingConfig;
            InputStream is = moduleSource.getClassLoaderConfig();
            if (is != null) {
                try {
                    Document document = DocumentHelper.parse(is);
                    classLoadingConfig = XmlClassLoaderBuilder.build(document.getDocumentElement(), moduleSource, runtime.getArtifactRepository(), versionManager);
                } finally {
                    IOUtils.closeQuietly(is);
                }
            } else {
                ClasspathEntry selfEntry = new ClasspathEntry(new FileArtifactRef(moduleSource.getClassPathEntry()), ArtifactSharingMode.PROHIBITED, moduleSource);
                classLoadingConfig = new ClassLoadingConfigImpl(Collections.singletonList(selfEntry), runtime.getArtifactRepository());
            }

            return new ModuleConfigImpl(moduleDefinition, classLoadingConfig, moduleSource);

        } catch (Throwable e) {
            if (moduleSource != null) {
                try {
                    moduleSource.dispose();
                } catch (Throwable e2) {
                    log.error("Error disposing module source for file " + moduleDefinition.getFile().getAbsolutePath(), e2);
                }
            }
View Full Code Here


    public synchronized ModuleSource getModuleSource(File location, ModuleSourceType moduleSourceType)
            throws ModuleSourceCreationException {
        String key = getKey(location);
        SharedModuleSource moduleSource = moduleSources.get(key);
        if (moduleSource == null) {
            ModuleSource newModuleSource = createModuleSource(location, moduleSourceType);
            moduleSource = new SharedModuleSource(newModuleSource, this, key);
            moduleSources.put(key, moduleSource);
        } else {
            if (getType(moduleSource.getDelegate()) != moduleSourceType) {
                throw new LilyRTException("The same module location was requested earlier but with a different type. Type 1: " + getType(moduleSource) + ", type 2: " + moduleSourceType);
View Full Code Here

    }

    private ModuleSource createModuleSource(File location, ModuleSourceType moduleSourceType)
            throws ModuleSourceCreationException {
        try {
            ModuleSource moduleSource;
            switch (moduleSourceType) {
                case JAR:
                    moduleSource = new JarModuleSource(location);
                    break;
                case EXPANDED_JAR:
View Full Code Here

TOP

Related Classes of org.lilyproject.runtime.rapi.ModuleSource

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.