Package org.teiid.metadata.index

Examples of org.teiid.metadata.index.IndexMetadataFactory


      if (url == null) {
        throw new TeiidRuntimeException(RuntimeMetadataPlugin.Util.getString("system_vdb_not_found")); //$NON-NLS-1$
      }
      // uri conversion is only to remove the spaces in URL, note this only with above kind situation 
      URI uri = new URI(url.getProtocol(), url.getPath(), null);
      this.vdbRepository.setSystemStore(new IndexMetadataFactory(uri.toURL()).getMetadataStore(null));
    } catch (URISyntaxException e) {
      throw new TeiidRuntimeException(e, RuntimePlugin.Util.getString("system_vdb_load_error")); //$NON-NLS-1$
    } catch (IOException e) {
      throw new TeiidRuntimeException(e, RuntimePlugin.Util.getString("system_vdb_load_error")); //$NON-NLS-1$
    }
View Full Code Here


   
    // check if this is a VDB with index files, if there are then build the TransformationMetadata
    UDFMetaData udf = unit.getAttachment(UDFMetaData.class);
   
    LinkedHashMap<String, Resource> visibilityMap = null;
    IndexMetadataFactory indexFactory = unit.getAttachment(IndexMetadataFactory.class);   
    if (indexFactory != null) {
      visibilityMap = indexFactory.getEntriesPlusVisibilities();
    }
       
    // add the metadata objects as attachments
    deployment.removeAttachment(IndexMetadataFactory.class);
    deployment.removeAttachment(UDFMetaData.class);
View Full Code Here

    }   
    else if (expectedType.equals(IndexMetadataFactory.class)) {
      if (root == null) {
        root = unit.getAttachment(IndexMetadataFactory.class);
        if (root == null) {
          root = new IndexMetadataFactory();
        }
      }
      IndexMetadataFactory imf = IndexMetadataFactory.class.cast(root);
      imf.addIndexFile(file);
      unit.addAttachment(IndexMetadataFactory.class, imf);
      return expectedType.cast(imf);
    }
    else {
      throw new IllegalArgumentException("Cannot match arguments: expectedClass=" + expectedType ); //$NON-NLS-1$
View Full Code Here

 
  @Override
  protected VDBMetaData mergeMetaData(VFSDeploymentUnit unit, Map<Class<?>, List<Object>> metadata) throws Exception {
    VDBMetaData vdb = getInstance(metadata, VDBMetaData.class);
    UDFMetaData udf = getInstance(metadata, UDFMetaData.class);
    IndexMetadataFactory imf = getInstance(metadata, IndexMetadataFactory.class);
   
    if (vdb == null) {
      LogManager.logError(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("invlaid_vdb_file",unit.getRoot().getName())); //$NON-NLS-1$
      return null;
    }
   
    vdb.setUrl(unit.getRoot().toURL());   
   
    // build the metadata store
    if (imf != null) {
      imf.addEntriesPlusVisibilities(unit.getRoot(), vdb);
      unit.addAttachment(IndexMetadataFactory.class, imf);
             
      // add the cached store.
      File cacheFile = VDBDeployer.buildCachedVDBFileName(this.serializer, unit, vdb);
      // check to see if the vdb has been modified when server is down; if it is then clear the old files
      if (this.serializer.isStale(cacheFile, unit.getRoot().getLastModified())) {
        this.serializer.removeAttachments(unit);
        LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB", unit.getRoot().getName(), "old cached metadata has been removed"); //$NON-NLS-1$ //$NON-NLS-2$       
      }
      MetadataStoreGroup stores = this.serializer.loadSafe(cacheFile, MetadataStoreGroup.class);
      if (stores == null) {       
        // start to build the new metadata
        stores = new MetadataStoreGroup();
        stores.addStore(imf.getMetadataStore(vdbRepository.getSystemStore().getDatatypes()));
      }
      else {
        LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB", unit.getRoot().getName(), "was loaded from cached metadata"); //$NON-NLS-1$ //$NON-NLS-2$
      }
      unit.addAttachment(MetadataStoreGroup.class, stores);       
View Full Code Here

    this.useCallingThread = useCallingThread;
  }
 
  public void deployVDB(String vdbName, String vdbPath) throws Exception {
   
    IndexMetadataFactory imf = VDBMetadataFactory.loadMetadata(new File(vdbPath).toURI().toURL());
    MetadataStore metadata = imf.getMetadataStore(repo.getSystemStore().getDatatypes());
    LinkedHashMap<String, Resource> entries = imf.getEntriesPlusVisibilities();
   
        deployVDB(vdbName, metadata, entries);   
  }
View Full Code Here

TOP

Related Classes of org.teiid.metadata.index.IndexMetadataFactory

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.