Package org.rhq.plugins.jbossas5.helper

Examples of org.rhq.plugins.jbossas5.helper.JavaSystemProperties


  public Set<DiscoveredResourceDetails> discoverResources(
      ResourceDiscoveryContext discoveryContext)
      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),
View Full Code Here


    getDeployer().deploy(createResourceReport, createResourceReport.getResourceType());

  }
 
    private Deployer getDeployer() {
        ProfileServiceConnection profileServiceConnection = getConnection();
        return new RemoteDeployer(profileServiceConnection, this.resourceContext);
    }
View Full Code Here

  public Set<DiscoveredResourceDetails> discoverResources(
      ResourceDiscoveryContext discoveryContext)
      throws InvalidPluginConfigurationException, Exception {
    Set<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>();
    ProfileServiceConnection connection = ((PlatformComponent) discoveryContext
        .getParentResourceComponent()).getConnection();

    Set<ManagedComponent> vdbs = ProfileServiceUtil
        .getManagedComponents(connection, new ComponentType(
            PluginConstants.ComponentType.VDB.TYPE,
View Full Code Here

      ResourceDiscoveryContext discoveryContext)
      throws InvalidPluginConfigurationException, Exception {
    Set<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>();
    VDBComponent parenComponent = (VDBComponent) discoveryContext
        .getParentResourceComponent();
    ProfileServiceConnection connection = parenComponent.getConnection();

    ManagedComponent mcVdb = ProfileServiceUtil.getManagedComponent(
        connection, new ComponentType(
            PluginConstants.ComponentType.VDB.TYPE,
            PluginConstants.ComponentType.VDB.SUBTYPE),
View Full Code Here

  public void deleteResource() throws Exception {
        Configuration pluginConfiguration = getResourceContext().getPluginConfiguration();
        String fullFileName = pluginConfiguration.getSimple("deployment").getStringValue();
       
        ESB5Component jbossASComponent = (ESB5Component) getResourceContext().getParentResourceComponent();
        ProfileServiceConnection profileServiceConnection = jbossASComponent.getConnection();
        DeploymentManager deployMgr = profileServiceConnection.getDeploymentManager();

        String repositoryName = null;
        String [] arr = deployMgr.getRepositoryNames(new String[] {fullFileName});
        for (int i = 0; i<arr.length; i++) {
          repositoryName = arr[i];
        }
       
        if (repositoryName != null) {
          DeploymentProgress stop   = null;
          try {
            stop = deployMgr.stop(repositoryName);
              if (stop != null)
                stop.run();
          } catch (Throwable t) {
            log.error("Could not find deployment to delete.  " + t.getMessage());  
            return;
          } finally {
              jbossASComponent.disconnectFromProfileService();
          }

          DeploymentStatus stopStatus = stop.getDeploymentStatus();         
          if (stopStatus.isFailed()) {
           
            if ((stopStatus.getFailure() != null) && (stopStatus.getFailure().getCause() != null)
                && (stopStatus.getFailure().getCause() instanceof java.lang.NullPointerException)) {                   
              // jon 2.3 case
              // If we get a NPE here, it means that the .esb deployment has already been deleted
                  // Return here because otherwise JON will not update and remove the deployment
                  log.error("Failed to stop deployment '" + repositoryName + "'.", stopStatus.getFailure());
                  jbossASComponent.disconnectFromProfileService();

                  return;
              } else if ((stopStatus.getFailure().getCause() != null)
                && (stopStatus.getFailure().getCause() instanceof org.jboss.profileservice.spi.NoSuchDeploymentException)) {
                  // jon 2.4 case
                // If we get a NPE here, it means that the .esb deployment has already been deleted
                  // Return here because otherwise JON will not update and remove the deployment
                  log.error("Failed to stop deployment '" + repositoryName + "'.", stopStatus.getFailure());
                  jbossASComponent.disconnectFromProfileService();
     
                  return;
              }
              log.error("Failed to stop deployment '" + repositoryName + "'.", stopStatus.getFailure());
              throw new Exception("Failed to stop deployment '" + repositoryName + "' - cause: "
                  + stopStatus.getFailure());
          }       
            DeploymentProgress remove = deployMgr.remove(repositoryName);       
            if (remove != null) {
                remove.run();
              DeploymentStatus status = remove.getDeploymentStatus();
              if (status.isFailed()) {
                log.error("Failed to remove deployment '" + repositoryName + "'.", status.getFailure());
                throw new Exception("Failed to remove deployment '" + repositoryName + ".    "
                    + "If the deployment has already been removed through other means and you want to "
                    + "remove it from JON, uninventory it from the Resources section.   Cause: "
                    + status.getFailure());
              }
            } else {
              throw new RuntimeException("Did not find Deployment " + fullFileName);         
            }
        }

        ManagementView mView = profileServiceConnection.getManagementView();
        mView.load();
       
        jbossASComponent.disconnectFromProfileService();
   }
View Full Code Here

        try {
            String jbossHomeDir = resourceContext.getParentResourceComponent().getResourceContext()
                .getPluginConfiguration().getSimpleValue(ApplicationServerPluginConfigurationProperties.HOME_DIR, null);
            SystemInfo systemInfo = resourceContext.getSystemInformation();
            ProfileServiceConnection profileServiceConnection = resourceContext.getParentResourceComponent()
                .getConnection();

            ScriptDeployer deployer = new ScriptDeployer(jbossHomeDir, systemInfo, new RemoteDownloader(
                resourceContext, true, profileServiceConnection));
            ResourcePackageDetails packageDetails = packages.iterator().next();
View Full Code Here

        } catch (Exception e) {
            throw new RuntimeException("Failed to backup existing " + resourceTypeName + "'" + deploymentFile
                + "' to '" + backupOfOriginalFile + "'.");
        }

        ProfileServiceConnection connection = getConnection();
        if (connection == null) {
            DeployPackagesResponse response = new DeployPackagesResponse(ContentResponseResult.FAILURE);
            response.setOverallRequestErrorMessage("No profile service connection available");
            return response;
        }

        DeploymentManager deploymentManager = connection.getDeploymentManager();

        // as crazy as it might sound, there is apparently no way for you to ask the profile service
        // if a deployment was deployed to the farm profile. Thus, we must resort to a poor man's solution:
        // if the deployment name has the "farm/" directory in it, assume it needs to be deployed to the farm
        boolean deployFarmed = getDeploymentKey().contains("/farm/");
View Full Code Here

    public void deleteResource() throws Exception {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Deleting " + getResourceDescription() + "...");
        }

        ProfileServiceConnection connection = getConnection();
        if (connection == null) {
            throw new Exception("No profile service connection available");
        }

        DeploymentManager deploymentManager = connection.getDeploymentManager();
        try {
            getManagedDeployment();
        } catch (Exception e) {
            // The deployment no longer exists, so there's nothing for us to do. Someone most likely undeployed it
            // outside of Jopr or EmbJopr, e.g. via the jmx-console or by deleting the app file from the deploy dir.
            LOG.warn("Cannot delete the deployment [" + getDeploymentKey() + "], since it no longer exists");
            return;
        }

        if (LOG.isDebugEnabled()) {
            LOG.debug("Stopping deployment [" + getDeploymentKey() + "]...");
        }

        String deploymentName = getDeploymentName();
        if (deploymentName == null) {
            throw new IllegalStateException("Deployment " + getDeploymentKey() + " has vanished");
        }

        DeploymentProgress progress = deploymentManager.stop(deploymentName);
        DeploymentStatus stopStatus = DeploymentUtils.run(progress);
        if (stopStatus.isFailed()) {
            LOG.error("Failed to stop deployment '" + deploymentName + "'.", stopStatus.getFailure());
            throw new Exception("Failed to stop deployment '" + deploymentName + "' - cause: "
                + stopStatus.getFailure());
        }
        if (LOG.isDebugEnabled()) {
            LOG.debug("Removing deployment [" + deploymentName + "]...");
        }
        progress = deploymentManager.remove(deploymentName);
        DeploymentStatus removeStatus = DeploymentUtils.run(progress);
        if (removeStatus.isFailed()) {
            LOG.error("Failed to remove deployment '" + deploymentName + "'.", removeStatus.getFailure());
            throw new Exception("Failed to remove deployment '" + deploymentName + "' - cause: "
                + removeStatus.getFailure());
        }
        ManagementView managementView = connection.getManagementView();
        managementView.load();
    }
View Full Code Here

    private String getNewResourceKey(ResourceUpgradeContext<ProfileServiceComponent<?>> upgradeContext,
        String existingResourceKey) {

        String newResourceKey;
        ProfileServiceConnection connection = upgradeContext.getParentResourceComponent().getConnection();
        if (connection == null) {
            LOG.warn(getClass().getName() + ": could not upgrade resource, no profile service connection available");
            return null;
        }
        ManagementView managementView = connection.getManagementView();
        ManagedDeployment deployment;
        try {
            deployment = managementView.getDeployment(existingResourceKey);
        } catch (NoSuchDeploymentException e) {
            throw new IllegalStateException(e);
View Full Code Here

            .getStringValue();

        componentName = context.getPluginConfiguration().getSimple(PlatformDiscoveryComponent.PLATFORM_COMPONENT_NAME)
            .getStringValue();

        ProfileServiceConnection connection = context.getParentResourceComponent().getConnection();

        ManagementView managementView = connection.getManagementView();

        ManagedDeployment deploy = managementView.getDeployment(deployName);
        if (deploy != null) {
            Map<String, ManagedComponent> components = deploy.getComponents();
View Full Code Here

TOP

Related Classes of org.rhq.plugins.jbossas5.helper.JavaSystemProperties

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.