Package org.jboss.managed.api

Examples of org.jboss.managed.api.ManagedComponent


 
 
  @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);
View Full Code Here


  }

  @Override
  public void deleteDataSource(String deployedName) throws AdminException {
    try {
      ManagedComponent mc = getDatasource(deployedName);
      if (mc != null) {
        ManagedUtil.removeArchive(getDeploymentManager(),mc.getDeployment().getName());
      }
    } catch (Exception e) {
      throw new AdminComponentException(e);
    }
  }
View Full Code Here

  }

  @Override
  public CacheStatistics getCacheStats(String cacheType) throws AdminException {
    try {
      ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE);
      MetaValue value = ManagedUtil.executeOperation(mc, "getCacheStatistics", SimpleValueSupport.wrap(cacheType));//$NON-NLS-1$
      return (CacheStatistics)MetaValueFactory.getInstance().unwrap(value, CacheStatisticsMetadata.class)
    } catch (Exception e) {
      throw new AdminComponentException(e.getMessage(), e);
    }
View Full Code Here

  }

  public static String getVDBStatus(ProfileServiceConnection connection,
      String vdbName) {

    ManagedComponent mcVdb = null;
    try {
      mcVdb = ProfileServiceUtil.getManagedComponent(connection,
              new org.jboss.managed.api.ComponentType(
                  PluginConstants.ComponentType.VDB.TYPE,
                  PluginConstants.ComponentType.VDB.SUBTYPE),  vdbName);
View Full Code Here

   * @return count
   * @throws Exception
   */
  private int getErrorCount(ProfileServiceConnection connection,String vdbName) {

    ManagedComponent mcVdb = null;
    try {
      mcVdb = ProfileServiceUtil.getManagedComponent(connection,
              new org.jboss.managed.api.ComponentType(
                  PluginConstants.ComponentType.VDB.TYPE,
                  PluginConstants.ComponentType.VDB.SUBTYPE),vdbName);
    } catch (NamingException e) {
      final String msg = "NamingException in getVDBStatus(): " + e.getExplanation(); //$NON-NLS-1$
      LOG.error(msg, e);
    } catch (Exception e) {
      final String msg = "Exception in getVDBStatus(): " + e.getMessage(); //$NON-NLS-1$
      LOG.error(msg, e);
    }

    // Get models from VDB
    int count = 0;
    ManagedProperty property = mcVdb.getProperty("models"); //$NON-NLS-1$
    CollectionValueSupport valueSupport = (CollectionValueSupport) property.getValue();
    MetaValue[] metaValues = valueSupport.getElements();

    for (MetaValue value : metaValues) {
      GenericValueSupport genValueSupport = (GenericValueSupport) value;
View Full Code Here

  }
 
  @Override
  public Configuration loadResourceConfiguration() {

    ManagedComponent translator = null;
    try {
      translator = ProfileServiceUtil
      .getManagedComponent(getConnection(), new ComponentType(
          PluginConstants.ComponentType.Translator.TYPE,
          PluginConstants.ComponentType.Translator.SUBTYPE), this.name);
    } catch (NamingException e) {
      final String msg = "NamingException in loadResourceConfiguration(): " + e.getExplanation(); //$NON-NLS-1$
      LOG.error(msg, e);
    } catch (Exception e) {
      final String msg = "Exception in loadResourceConfiguration(): " + e.getMessage(); //$NON-NLS-1$
      LOG.error(msg, e);
    }
   
    String translatorName = ProfileServiceUtil.getSimpleValuetranslator, "name", String.class);
    String description = ProfileServiceUtil.getSimpleValuetranslator, "description", String.class);

    Configuration c = resourceConfiguration;
    PropertyList list = new PropertyList("translatorList");
    PropertyMap propMap = null;
    c.put(list);

    // First get translator specific properties
    ManagedProperty translatorProps = translator.getProperty("property");
    try {
      getTranslatorValues(translatorProps.getValue(), propMap, list);
    } catch (Exception e) {
      throw new RuntimeException(e.getMessage());
    }
View Full Code Here

      throws InvalidPluginConfigurationException, Exception {

    Set<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>();
    ProfileServiceConnection connection = ((ApplicationServerComponent) discoveryContext.getParentResourceComponent()).getConnection();
   
    ManagedComponent mc = ProfileServiceUtil.getManagedComponent(connection,
        new ComponentType(
            PluginConstants.ComponentType.Platform.TEIID_TYPE,
            PluginConstants.ComponentType.Platform.TEIID_SUB_TYPE),
            PluginConstants.ComponentType.Platform.TEIID_RUNTIME_ENGINE);
   
    if (mc==null){
      //No Teiid instance found
      return discoveredResources;
    }
   
    String version = ProfileServiceUtil.getSimpleValue(mc, "runtimeVersion", String.class); //$NON-NLS-1$
     
    /**
     *
     * A discovered resource must have a unique key, that must stay the same
     * when the resource is discovered the next time
     */
    DiscoveredResourceDetails detail = new DiscoveredResourceDetails(
        discoveryContext.getResourceType(), // ResourceType
        mc.getName(), // Resource Key
        PluginConstants.ComponentType.Platform.TEIID_ENGINE_RESOURCE_NAME, // Resource name
        version,
        PluginConstants.ComponentType.Platform.TEIID_ENGINE_RESOURCE_DESCRIPTION, // Description
        discoveryContext.getDefaultPluginConfiguration(), // Plugin
        // Config
        null // Process info from a process scan
    );

    Configuration configuration = detail.getPluginConfiguration();
    configuration.put(new PropertySimple("displayPreviewVDBS", Boolean.FALSE));
    detail.setPluginConfiguration(configuration);

    // Add to return values
    discoveredResources.add(detail);
    log.debug("Discovered Teiid instance: " + mc.getName()); //$NON-NLS-1$
    return discoveredResources;

  }
View Full Code Here

    ManagementView managementView = null;
    ComponentType componentType = new ComponentType(
        PluginConstants.ComponentType.VDB.TYPE,
        PluginConstants.ComponentType.VDB.SUBTYPE);

    ManagedComponent managedComponent = null;
    CollectionValueSupport modelsMetaValue = null;
    report.setStatus(ConfigurationUpdateStatus.SUCCESS);
    try {

      managementView = getConnection().getManagementView();
      managedComponent = managementView.getComponent(this.name,
          componentType);
      modelsMetaValue = (CollectionValueSupport) managedComponent
          .getProperty("models").getValue();
      GenericValue[] models = (GenericValue[]) modelsMetaValue
          .getElements();
      List<Property> multiSourceModelsPropertyList = resourceConfiguration
          .getList("multiSourceModels").getList();
      List<Property> singleSourceModelsPropertyList = resourceConfiguration
          .getList("singleSourceModels").getList();
      ArrayList<List<Property>> sourceMappingList = new ArrayList<List<Property>>();
      sourceMappingList.add(singleSourceModelsPropertyList);
      sourceMappingList.add(multiSourceModelsPropertyList);
      PropertyMap model = null;
      Iterator<List<Property>> sourceMappingListIterator = sourceMappingList
          .iterator();
      while (sourceMappingListIterator.hasNext()) {
        List<Property> sourceList = sourceMappingListIterator.next();
        for (int i = 0; i < sourceList.size(); i++) {
          model = (PropertyMap) sourceList.get(i);
          String sourceName = ((PropertySimple) model
              .get("sourceName")).getStringValue(); //$NON-NLS-1$
          if (sourceName.equals("See below"))
            continue; // This is a multisource model which we will
                  // handle separately
          String modelName = ((PropertySimple) model.get("name")) //$NON-NLS-1$
              .getStringValue();
          String dsName = ((PropertySimple) model.get("jndiName")) //$NON-NLS-1$
              .getStringValue();

          ManagedObject managedModel = null;
          if (models != null && models.length != 0) {
            for (GenericValue genValue : models) {
              ManagedObject mo = (ManagedObject) ((GenericValueSupport) genValue)
                  .getValue();
              String name = ProfileServiceUtil.getSimpleValue(mo,
                  "name", String.class); //$NON-NLS-1$
              if (modelName.equals(name)) {
                managedModel = mo;
                break;
              }
            }
          }

          ManagedProperty sourceMappings = null;
          if (managedModel != null) {

            sourceMappings = managedModel
                .getProperty("sourceMappings");//$NON-NLS-1$

            if (sourceMappings != null) {
              CollectionValueSupport mappings = (CollectionValueSupport) sourceMappings
                  .getValue();
              GenericValue[] mappingsArray = (GenericValue[]) mappings
                  .getElements();
              for (GenericValue sourceGenValue : mappingsArray) {
                ManagedObject sourceMo = (ManagedObject) ((GenericValueSupport) sourceGenValue)
                    .getValue();
                String sName = ProfileServiceUtil
                    .getSimpleValue(sourceMo,
                        "name", String.class);//$NON-NLS-1$
                if (sName.equals(sourceName)) {
                  // set the jndi name for the ds.
                  ManagedProperty jndiProperty = sourceMo
                      .getProperty("connectionJndiName"); //$NON-NLS-1$
                  jndiProperty
                      .setValue(ProfileServiceUtil.wrap(
                          SimpleMetaType.STRING,
                          dsName));
                  break;
                }
              }
            }
          }
        }
      }

      try {
        managementView.updateComponent(managedComponent);
        managementView.load();
      } catch (Exception e) {
        LOG.error("Unable to update component ["
            + managedComponent.getName() + "] of type "
            + componentType + ".", e);
        report.setStatus(ConfigurationUpdateStatus.FAILURE);
        report.setErrorMessageFromThrowable(e);
      }
    } catch (Exception e) {
View Full Code Here

  }

  @Override
  public Configuration loadResourceConfiguration() {

    ManagedComponent mcVdb = null;
    try {
      mcVdb = ProfileServiceUtil.getManagedComponent(getConnection(),
          new org.jboss.managed.api.ComponentType(
              PluginConstants.ComponentType.VDB.TYPE,
              PluginConstants.ComponentType.VDB.SUBTYPE),
View Full Code Here

      report.setStatus(ConfigurationUpdateStatus.FAILURE);
      report
          .setErrorMessage("Update not implemented for the component type."); //$NON-NLS-1$
    }

    ManagedComponent managedComponent = null;
    report.setStatus(ConfigurationUpdateStatus.SUCCESS);
    try {

      managementView = getConnection().getManagementView();
      managedComponent = managementView.getComponent(this.name,
          componentType);
      Map<String, ManagedProperty> managedProperties = managedComponent
          .getProperties();

      ProfileServiceUtil.convertConfigurationToManagedProperties(managedProperties, resourceConfig, resourceContext.getResourceType(), null);

      try {
        managementView.updateComponent(managedComponent);
      } catch (Exception e) {
        LOG.error("Unable to update component [" //$NON-NLS-1$
            + managedComponent.getName() + "] of type " //$NON-NLS-1$
            + componentType + ".", e); //$NON-NLS-1$
        report.setStatus(ConfigurationUpdateStatus.FAILURE);
        report.setErrorMessageFromThrowable(e);
      }
    } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.jboss.managed.api.ManagedComponent

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.