Package org.teiid.adminapi

Examples of org.teiid.adminapi.AdminProcessingException


  @Override
  public void assignToModel(String vdbName, int vdbVersion, String modelName, String sourceName, String translatorName, String dsName) throws AdminException {
    ManagedComponent mc = getVDBManagedComponent(vdbName, vdbVersion);
    if (mc == null) {
      throw new AdminProcessingException(IntegrationPlugin.Util.getString("vdb_not_found", vdbName, vdbVersion)); //$NON-NLS-1$
    }
   
    ManagedProperty mp = mc.getProperty("models");//$NON-NLS-1$
    List<ManagedObject> models = (List<ManagedObject>)MetaValueFactory.getInstance().unwrap(mp.getValue());
    ManagedObject managedModel = null;
    if (models != null && !models.isEmpty()) {
      for(ManagedObject mo:models) {
        String name = ManagedUtil.getSimpleValue(mo, "name", String.class); //$NON-NLS-1$
        if (modelName.equals(name)) {
          managedModel = mo;
        }
      }   
    }
   
    if (managedModel == null) {
      throw new AdminProcessingException(IntegrationPlugin.Util.getString("model_not_found", modelName, vdbName, vdbVersion)); //$NON-NLS-1$
    }
   
        ManagedProperty sourceMappings = managedModel.getProperty("sourceMappings");//$NON-NLS-1$
        if (sourceMappings != null){
            List<ManagedObject> mappings = (List<ManagedObject>)MetaValueFactory.getInstance().unwrap(sourceMappings.getValue());
            for (ManagedObject mo:mappings) {
                String sName = ManagedUtil.getSimpleValue(mo, "name", String.class);//$NON-NLS-1$
                if (sName.equals(sourceName)) {
                 
                  ManagedProperty translatorProperty = mo.getProperty("translatorName"); //$NON-NLS-1$
                  if (translatorProperty == null) {
                    translatorProperty = new WritethroughManagedPropertyImpl(mo, new DefaultFieldsImpl("translatorName")); //$NON-NLS-1$
                  }
                  translatorProperty.setValue(ManagedUtil.wrap(SimpleMetaType.STRING, translatorName));
                 
                  // set the jndi name for the ds.
                  ManagedProperty jndiProperty = mo.getProperty("connectionJndiName"); //$NON-NLS-1$
                  if (jndiProperty == null) {
                    jndiProperty = new WritethroughManagedPropertyImpl(mo, new DefaultFieldsImpl("connectionJndiName")); //$NON-NLS-1$
                  }
                  jndiProperty.setValue(ManagedUtil.wrap(SimpleMetaType.STRING, dsName));
                }
            }
        } else {
          //TODO: this can be in the default situation when no source mappings are specified
          throw new AdminProcessingException(IntegrationPlugin.Util.getString("sourcename_not_found", sourceName, vdbName, vdbVersion, modelName)); //$NON-NLS-1$
        }
       
    try {
      getView().updateComponent(mc);
    } catch (Exception e) {
View Full Code Here


  }

  private void manageRoleToDataPolicy(String vdbName, int vdbVersion, String policyName, String role, boolean addthrows AdminException {
    ManagedComponent mc = getVDBManagedComponent(vdbName, vdbVersion);
    if (mc == null) {
      throw new AdminProcessingException(IntegrationPlugin.Util.getString("vdb_not_found", vdbName, vdbVersion)); //$NON-NLS-1$
    }
   
    ManagedProperty mp = mc.getProperty("dataPolicies");//$NON-NLS-1$
    List<ManagedObject> policies = (List<ManagedObject>)MetaValueFactory.getInstance().unwrap(mp.getValue());
    ManagedObject managedPolicy = null;
    if (policies != null && !policies.isEmpty()) {
      for(ManagedObject mo:policies) {
        String name = ManagedUtil.getSimpleValue(mo, "name", String.class); //$NON-NLS-1$
        if (policyName.equals(name)) {
          managedPolicy = mo;
        }
      }   
    }
   
    if (managedPolicy == null) {
      throw new AdminProcessingException(IntegrationPlugin.Util.getString("policy_not_found", policyName, vdbName, vdbVersion)); //$NON-NLS-1$
    }
   
    if (role != null) {
          ManagedProperty mappedRoleNames = managedPolicy.getProperty("mappedRoleNames");//$NON-NLS-1$
          CollectionValueSupport roleCollection = (CollectionValueSupport)mappedRoleNames.getValue();
View Full Code Here

  @Override
  public void createDataSource(String deploymentName, String templateName, Properties properties) throws AdminException {
    try {
      ManagedComponent mc = getDatasource(deploymentName);
      if (mc != null) {
        throw new AdminProcessingException(IntegrationPlugin.Util.getString("datasource_exists",deploymentName)); //$NON-NLS-1$; 
      }
     
      DeploymentTemplateInfo info = getView().getTemplate(templateName);
      if(info == null) {
        throw new AdminProcessingException(IntegrationPlugin.Util.getString("datasource_template_not_found", templateName)); //$NON-NLS-1$
      }
     
      // template properties specific to the template
      Map<String, ManagedProperty> propertyMap = info.getProperties();
     
View Full Code Here

        if (canThrowComponentException) {
          return new TeiidComponentException(exception);
        }
        if (canThrowAdminException) {
      if (exception instanceof TeiidProcessingException) {
        return new AdminProcessingException(exception);
      }
          return new AdminComponentException(exception);
    }
        if (canThrowXATransactionException) {
          return new XATransactionException(exception);
View Full Code Here

      return;
    }
    try {
      cancelTransactions(threadId, false);
    } catch (XATransactionException e) {
      throw new AdminProcessingException(e);
    }
  }
View Full Code Here

TOP

Related Classes of org.teiid.adminapi.AdminProcessingException

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.