Package org.teiid.adminapi

Examples of org.teiid.adminapi.Translator


    // add required connector managers; if they are not already there
    for (Translator t: deployment.getOverrideTranslators()) {
      VDBTranslatorMetaData data = (VDBTranslatorMetaData)t;
     
      String type = data.getType();
      Translator parent = this.translatorRepository.getTranslatorMetaData(type);
      if ( parent == null) {
        throw new DeploymentException(RuntimePlugin.Util.getString("translator_type_not_found", unit.getName())); //$NON-NLS-1$
      }
     
      Set<String> keys = parent.getProperties().stringPropertyNames();
      for (String key:keys) {
        if (data.getPropertyValue(key) == null && parent.getPropertyValue(key) != null) {
          data.addProperty(key, parent.getPropertyValue(key));
        }
      }
      repo.addTranslatorMetadata(data.getName(), data);
    }
    createConnectorManagers(cmr, repo, deployment);
View Full Code Here


 
  private ExecutionFactory<Object, Object> getExecutionFactory(String name, TranslatorRepository repo, VDBMetaData deployment, IdentityHashMap<Translator, ExecutionFactory<Object, Object>> map, HashSet<String> building) throws DeploymentException {
    if (!building.add(name)) {
      throw new DeploymentException(RuntimePlugin.Util.getString("recursive_delegation", deployment.getName(), deployment.getVersion(), building)); //$NON-NLS-1$
    }
    Translator translator = repo.getTranslatorMetaData(name);
    if (translator == null) {
      translator = this.translatorRepository.getTranslatorMetaData(name);
    }
    if (translator == null) {
      throw new DeploymentException(RuntimePlugin.Util.getString("translator_not_found", deployment.getName(), deployment.getVersion(), name)); //$NON-NLS-1$
View Full Code Here

      if (translatorName == null) {
        throw new DeploymentException(RuntimePlugin.Util.getString("name_not_found", unit.getName())); //$NON-NLS-1$
      }
     
      String type = data.getType();
      Translator parent = this.translatorRepository.getTranslatorMetaData(type);
      if ( parent == null) {
        throw new DeploymentException(RuntimePlugin.Util.getString("translator_type_not_found", unit.getName())); //$NON-NLS-1$
      }
     
      // fill with default properties ignoring the overridden ones.
      Set<String> keys = parent.getProperties().stringPropertyNames();
      for (String key:keys) {
        if (data.getPropertyValue(key) == null && parent.getPropertyValue(key) != null) {
          data.addProperty(key, parent.getPropertyValue(key));
        }
      }
     
            this.translatorRepository.addTranslatorMetadata(translatorName, data);
            LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("translator_added", translatorName)); //$NON-NLS-1$
View Full Code Here

    }
  }
 
  @Test
  public void testGetTemplate() throws Exception {
    Translator translator = admin.getTranslator("oracle");
    for (String key:translator.getProperties().stringPropertyNames()) {
      System.out.println(key+"="+translator.getPropertyValue(key));
    }
    assertEquals("org.teiid.translator.jdbc.oracle.OracleSQLTranslator", translator.getPropertyValue("ExtensionTranslationClassName")); //$NON-NLS-1$
    assertEquals(false, translator.getPropertyValue("XaCapable"));
  }
View Full Code Here

    assertTrue(vdb.getValidityErrors().contains("There is an error in VDB"));
   
    List<Translator> translators = vdb.getOverrideTranslators();
    assertTrue(translators.size() == 1);
   
    Translator translator = translators.get(0);
    assertEquals("oracleOverride", translator.getName());
    assertEquals("oracle", translator.getType());
    assertEquals("my-value", translator.getPropertyValue("my-property"));
       
    List<DataPolicy> roles = vdb.getDataPolicies();
   
    assertTrue(roles.size() == 1);
   
View Full Code Here

    assertTrue(vdb.getValidityErrors().contains("There is an error in VDB")); //$NON-NLS-1$
   
    List<Translator> translators = vdb.getOverrideTranslators();
    assertTrue(translators.size() == 1);
   
    Translator translator = translators.get(0);
    assertEquals("oracleOverride", translator.getName());
    assertEquals("oracle", translator.getType());
    assertEquals("my-value", translator.getPropertyValue("my-property"));
    assertEquals("hello world", translator.getDescription());
    List<DataPolicy> roles = vdb.getDataPolicies();
   
    assertTrue(roles.size() == 1);
   
    DataPolicyMetadata role = vdb.getDataPolicy("roleOne"); //$NON-NLS-1$
View Full Code Here

  public void addTranslatorMetadata(String name, VDBTranslatorMetaData factory) {
    this.translatorRepo.put(name, factory);
 
 
  public Translator getTranslatorMetaData(String name) {
    Translator factory = this.translatorRepo.get(name);
    return factory;
  }
View Full Code Here

TOP

Related Classes of org.teiid.adminapi.Translator

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.