Package org.openquark.cal.metadata

Examples of org.openquark.cal.metadata.MetadataManager


    protected StoreBasedVault(CALSourceStore sourceStore, MetadataStore metadataStore,
                              GemDesignStore gemDesignStore, WorkspaceDeclarationStore workspaceDeclarationStore,
                              CarStore carStore, UserResourceStore userResourceStore) {

        CALSourceManager vaultSourceManager = new CALSourceManager(sourceStore);
        MetadataManager vaultMetadataManager = new MetadataManager(metadataStore);
        GemDesignManager vaultGemDesignManager = new GemDesignManager(gemDesignStore);
        WorkspaceDeclarationManager vaultWorkspaceDeclarationManager = new WorkspaceDeclarationManager(workspaceDeclarationStore);
        CarManager vaultCarManager = new CarManager(carStore);
        UserResourceManager vaultUserResourceManager = new UserResourceManager(userResourceStore);
       
View Full Code Here


     * @param metaModule the metamodule whose metadata to save.
     * @param status the tracking status object.
     */
    private void saveMetadata(MetaModule metaModule, Status status) {

        MetadataManager metadataManager = resourceManagerRegistry.getMetadataManager();
        if (metadataManager == null) {
            status.add(new Status(Status.Severity.WARNING, "No registered metadata manager for this vault: " + toString(), null));
            return;
        }
        MetadataStore metadataStore = (MetadataStore)metadataManager.getResourceStore();
       
        // Clear old metadata.
        metadataStore.removeModuleResources(metaModule.getName(), status);

        // Get the features in the module.
        Set<CALFeatureName> moduleFeatureNames = metaModule.getFeatureNames();

        // Save metadata for each of the features.
        for (final CALFeatureName featureName : moduleFeatureNames) {
            List<ResourceName> metadataResourceNames = metaModule.getMetadataResourceNamesForAllLocales(featureName);
           
            for (int i = 0, n = metadataResourceNames.size(); i < n; i++) {
                ResourceName resourceName = metadataResourceNames.get(i);
                Locale locale = LocalizedResourceName.localeOf(resourceName);
               
                if (!metadataManager.saveMetadata(metaModule.getMetadata(featureName, locale), status)) {
                    status.add(new Status(Status.Severity.WARNING, "Could not save metadata for feature: " + featureName.toString(), null));
                }
            }
        }
    }
View Full Code Here

            Nullary workspace = new Nullary();
           
            // Register the resource managers.
            workspace.registerNonCarAwareResourceManager(new CALSourceManager(new CALSourceNullaryStore()));
            workspace.registerNonCarAwareResourceManager(new MetadataManager(new MetadataNullaryStore()));
            workspace.registerNonCarAwareResourceManager(new GemDesignManager(new GemDesignNullaryStore()));
            workspace.registerNonCarAwareResourceManager(new CarManager(new CarNullaryStore()));
            workspace.registerNonCarAwareResourceManager(new WorkspaceDeclarationManager(new WorkspaceDeclarationNullaryStore()));
            workspace.registerNonCarAwareResourceManager(new UserResourceManager(new UserResourceNullaryStore()));
           
View Full Code Here

           
            Discrete workspace = new Discrete(workspaceID, rootDirectory, workspaceDescriptionFile);
           
            // Register the resource managers.
            workspace.registerNonCarAwareResourceManager(new CALSourceManager(new CALSourceFileStore(rootDirectory)));
            workspace.registerNonCarAwareResourceManager(new MetadataManager(new MetadataFileStore(rootDirectory)));
            workspace.registerNonCarAwareResourceManager(new GemDesignManager(new GemDesignFileStore(rootDirectory)));
            workspace.registerNonCarAwareResourceManager(new CarManager(new CarFileStore(rootDirectory)));
            workspace.registerNonCarAwareResourceManager(new UserResourceManager(new UserResourceFileStore(rootDirectory)));
           
            return workspace;
View Full Code Here

    /**
     * @param locale the locale associated with the metadata.
     * @return the metadata for the module. If the module has no metadata, then default metadata is returned.
     */
    public ModuleMetadata getMetadata(Locale locale) {
        MetadataManager metadataManager = virtualResourceManager.getMetadataManager(getName());
        if (metadataManager == null) {
            return MetadataManager.getEmptyMetadata(this, locale);
        }
        return metadataManager.getMetadata(this, locale);
    }
View Full Code Here

    public CALFeatureMetadata getMetadata(CALFeatureName featureName, Locale locale) {
        if (!(featureName.hasModuleName() && featureName.toModuleName().equals(getName()))) {
            throw new IllegalArgumentException("Feature must be a member of module: " + getName());
        }

        MetadataManager metadataManager = virtualResourceManager.getMetadataManager(getName());
        if (metadataManager == null) {
            return MetadataManager.getEmptyMetadata(featureName, locale);
        }
       
        return metadataManager.getMetadata(featureName, locale);
    }
View Full Code Here

    public List<ResourceName> getMetadataResourceNamesForAllLocales(CALFeatureName featureName) {
        if (!(featureName.hasModuleName() && featureName.toModuleName().equals(getName()))) {
            throw new IllegalArgumentException("Feature must be a member of module: " + getName());
        }

        MetadataManager metadataManager = virtualResourceManager.getMetadataManager(getName());
        if (metadataManager == null) {
            return Collections.emptyList();
        }
       
        return metadataManager.getMetadataResourceNamesForAllLocales(featureName);
    }
View Full Code Here

            }
           
            this.jarFileManager = jarFileManager;
            resourceManagerRegistry = new ResourceManagerRegistry();
            resourceManagerRegistry.registerResourceManager(new CALSourceManager(new CALSourceJarStore(jarFileManager)));
            resourceManagerRegistry.registerResourceManager(new MetadataManager(new MetadataJarStore(jarFileManager)));
            resourceManagerRegistry.registerResourceManager(new GemDesignManager(new GemDesignJarStore(jarFileManager)));
            resourceManagerRegistry.registerResourceManager(new WorkspaceDeclarationManager(new WorkspaceDeclarationJarStore(jarFileManager)));
            resourceManagerRegistry.registerResourceManager(new UserResourceManager(new UserResourceJarStore(jarFileManager)));
        }
View Full Code Here

     * Get the metadata for a scoped entity in this module.
     * @param locale the locale associated with the metadata.
     * @return the metadata for this entity. If the entity has no metadata, then default metadata is returned.
     */
    public FunctionalAgentMetadata getMetadata(Locale locale) {
        MetadataManager metadataManager = virtualResourceManager.getMetadataManager(functionalAgent.getName().getModuleName());
        if (metadataManager == null) {
            return (FunctionalAgentMetadata)MetadataManager.getEmptyMetadata(functionalAgent, locale);
        }
        return (FunctionalAgentMetadata)metadataManager.getMetadata(functionalAgent, locale);
    }
View Full Code Here

   
    /**
     * @return an array of the metadata objects for this gem, across all locales.
     */
    public FunctionalAgentMetadata[] getMetadataForAllLocales() {
        MetadataManager metadataManager = virtualResourceManager.getMetadataManager(functionalAgent.getName().getModuleName());
        if (metadataManager == null) {
            return new FunctionalAgentMetadata[0];
        }
       
        CALFeatureName featureName = CALFeatureName.getScopedEntityFeatureName(functionalAgent);
        List<ResourceName> listOfResourceNames = metadataManager.getMetadataResourceNamesForAllLocales(featureName);
       
        int n = listOfResourceNames.size();
        FunctionalAgentMetadata[] result = new FunctionalAgentMetadata[n];
       
        for (int i = 0; i < n; i++) {
            ResourceName resourceName = listOfResourceNames.get(i);
            result[i] = (FunctionalAgentMetadata)metadataManager.getMetadata(featureName, LocalizedResourceName.localeOf(resourceName));
        }
       
        return result;
    }
View Full Code Here

TOP

Related Classes of org.openquark.cal.metadata.MetadataManager

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.