Package org.openquark.cal.compiler

Examples of org.openquark.cal.compiler.ModuleSourceDefinition


     */
    ModuleSourceDefinition getSource(ModuleName moduleName, Status loadStatus) {
        final CALFeatureName moduleFeatureName = getFeatureName(moduleName);
        final ResourceName moduleResourceName = new ResourceName(moduleFeatureName);
       
        ModuleSourceDefinition moduleSource = new ModuleSourceDefinition(moduleName) {
            @Override
            public InputStream getInputStream(Status status) {
                return sourceStore.getInputStream(moduleResourceName);
            }
           
View Full Code Here


     * @param moduleDefinition the text definition of the module.
     * @param saveStatus the tracking status object.
     * @return whether the source was successfully saved.
     */
    public boolean saveSource(final ModuleName moduleName, final String moduleDefinition, Status saveStatus) {
        ModuleSourceDefinition sourceDefinition = new StringModuleSourceDefinition(moduleName, moduleDefinition);
        return importResource(sourceDefinition, saveStatus) != null;
    }
View Full Code Here

     */
    public void testMakeModule() {
        ModuleName moduleName = ModuleName.make("TEST_MakeModule");
       
        SourceModel.ModuleDefn moduleDefn = SourceModel.ModuleDefn.make(moduleName, new SourceModel.Import[] { SourceModel.Import.make(CAL_Prelude.MODULE_NAME) }, null);
        ModuleSourceDefinition moduleSourceDefn = new SourceModelModuleSource(moduleDefn);

        try {
            CompilerMessageLogger logger = new MessageLogger();
            Severity severity = workspaceManager.makeModule(moduleSourceDefn, logger);
           
View Full Code Here

     */
    public void testMakeModules() {
        ModuleName[] moduleNames = { ModuleName.make("TEST_MakeModules1"), ModuleName.make("TEST_MakeModules2") };
       
        SourceModel.ModuleDefn moduleDefn1 = SourceModel.ModuleDefn.make(moduleNames[0], new SourceModel.Import[] { SourceModel.Import.make(CAL_Prelude.MODULE_NAME) }, null);
        ModuleSourceDefinition moduleSourceDefn1 = new SourceModelModuleSource(moduleDefn1);

        SourceModel.ModuleDefn moduleDefn2 = SourceModel.ModuleDefn.make(moduleNames[1], new SourceModel.Import[] { SourceModel.Import.make(CAL_Prelude.MODULE_NAME) }, null);
        ModuleSourceDefinition moduleSourceDefn2 = new SourceModelModuleSource(moduleDefn2);
       
        ModuleSourceDefinition[] moduleSourceDefns = { moduleSourceDefn1, moduleSourceDefn2 };
       
        ModuleSourceDefinitionGroup mdg = new ModuleSourceDefinitionGroup(moduleSourceDefns);

View Full Code Here

     */
    public void testRemoveModule() {
        ModuleName[] moduleNames = { ModuleName.make("TEST_RemoveModules1"), ModuleName.make("TEST_RemoveModules2") };
       
        SourceModel.ModuleDefn moduleDefn1 = SourceModel.ModuleDefn.make(moduleNames[0], new SourceModel.Import[] { SourceModel.Import.make(CAL_Prelude.MODULE_NAME) }, null);
        ModuleSourceDefinition moduleSourceDefn1 = new SourceModelModuleSource(moduleDefn1);

        SourceModel.ModuleDefn moduleDefn2 = SourceModel.ModuleDefn.make(moduleNames[1], new SourceModel.Import[] { SourceModel.Import.make(CAL_Prelude.MODULE_NAME), SourceModel.Import.make(moduleNames[0]) }, null);
        ModuleSourceDefinition moduleSourceDefn2 = new SourceModelModuleSource(moduleDefn2);
       
        ModuleSourceDefinition[] moduleSourceDefns = { moduleSourceDefn1, moduleSourceDefn2 };
       
        ModuleSourceDefinitionGroup mdg = new ModuleSourceDefinitionGroup(moduleSourceDefns);

View Full Code Here

        if (sourceManager == null) {
            status.add(new Status(Status.Severity.WARNING, "No registered source manager for this vault: " + toString(), null));
            return false;
        }
       
        ModuleSourceDefinition sourceDefinition = workspace.getSourceDefinition(moduleName);
        if (sourceManager.importResource(sourceDefinition, status) == null) {
            status.add(new Status(Status.Severity.WARNING, "Could not save source for module: " + moduleName, null));
        }
       
        return false;
View Full Code Here

        super(sourceStore, metadataStore, designStore, workspaceDeclarationStore, carStore, userResourceStore);

        this.locationString = storedModulePath;
        this.moduleName = moduleName;

        ModuleSourceDefinition sourceDefinition = new FilePathModuleSourceDefinition(storedModulePath, moduleName);
        this.storedModule = new StoredModule(moduleName, sourceDefinition);
    }
View Full Code Here

                    public boolean isWriteable(ModuleName moduleName) {
                        return sourceManager.isWriteable(moduleName);
                    }
                   
                    public String getSource(ModuleName moduleName, CompilerMessageLogger messageLogger){
                        ModuleSourceDefinition moduleSourceDefinition = sourceManager.getSource(moduleName, new Status("getting module source"));
                        return moduleSourceDefinition.getSourceText(new Status("reading source for refactoring"), messageLogger);
                    }

                    public boolean saveSource(ModuleName moduleName, String moduleDefinition, Status saveStatus) {
                        return sourceManager.saveSource(moduleName, moduleDefinition, saveStatus);
                    }
View Full Code Here

            }
        }

        // If the entity being renamed is a module, we need to rename the cal source itself.
        if (oldFeatureName.getType().equals(CALFeatureName.MODULE)) {
            ModuleSourceDefinition sourceToRename = sourceDefinitionGroup.getModuleSource(oldFeatureName.toModuleName());
            ModuleSourceDefinition renamedSource = virtualResourceManager.getSourceManager(newFeatureName.toModuleName()).getSource(newFeatureName.toModuleName(), renameStatus);
           
            // Now remove the reference to the old module from the source definition group and add the new module
            List<ModuleSourceDefinition> newModuleSources = new ArrayList<ModuleSourceDefinition>(Arrays.asList(sourceDefinitionGroup.getModuleSources()));
            newModuleSources.remove(sourceToRename);
            newModuleSources.add(renamedSource);
View Full Code Here

        // Add the source definitions for the given module names.
        for (final ModuleName moduleName : moduleNameSet) {
            CALSourceManager sourceManager = virtualResourceManager.getSourceManager(moduleName);
            if (sourceManager != null) {
               
                ModuleSourceDefinition sourceDefinition = sourceManager.getSource(moduleName, new Status("Source Status"));
               
                if (sourceDefinition != null) {
                    sourceDefinitionList.add(sourceDefinition);
                }
            }
View Full Code Here

TOP

Related Classes of org.openquark.cal.compiler.ModuleSourceDefinition

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.