Package org.jboss.managed.api

Examples of org.jboss.managed.api.ManagedDeployment


        for (String deploymentName : deploymentNames) {

            // example of deploymentName: vfszip:/C:/opt/jboss-6.0.0.Final/server/default/deploy/http-invoker.sar/invoker.war/
            try {

                ManagedDeployment managedDeployment = managementView.getDeployment(deploymentName);
                if (!accept(managedDeployment)) {
                    continue;
                }

                String resourceName = managedDeployment.getSimpleName();
                if (resourceName.equals("%Generated%")) {
                    resourceName = deploymentName.substring(deploymentName.lastIndexOf("/") + 1);
                }

                // example of a resource key: {default}http-invoker.sar/invoker.war
View Full Code Here


        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

    private static String buildResourceKey(ManagedDeployment deployment) {
        StringBuilder resourceKey = new StringBuilder();
        resourceKey.append('{').append(ProfileKey.DEFAULT).append("}");
        List<String> ancestryNames = new ArrayList<String>();
        ManagedDeployment parentDeployment = deployment;
        do {
            ancestryNames.add(0, parentDeployment.getSimpleName());
        } while ((parentDeployment = parentDeployment.getParent()) != null);
        for (int i = 0, ancestryNamesSize = ancestryNames.size(); i < ancestryNamesSize; i++) {
            String deploymentSimpleName = ancestryNames.get(i);
            resourceKey.append(deploymentSimpleName);
            if (i != (ancestryNamesSize - 1)) {
                resourceKey.append("/");
View Full Code Here

        if (LOG.isDebugEnabled()) {
            LOG.debug("Removing " + getResourceDescription() + " with component " + toString(managedComponent) + "...");
        }
        ManagementView managementView = getConnection().getManagementView();
        managementView.removeComponent(managedComponent);
        ManagedDeployment parentDeployment = managedComponent.getDeployment();

        if (parentDeployment.getComponents().size() > 1 || !parentDeployment.getChildren().isEmpty()) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Redeploying parent deployment '" + parentDeployment.getName()
                    + "' in order to complete removal of component " + toString(managedComponent) + "...");
            }
            DeploymentProgress progress = deploymentManager.redeploy(parentDeployment.getName());
            DeploymentStatus status = DeploymentUtils.run(progress);
            if (status.isFailed()) {
                LOG.error("Failed to redeploy parent deployment '" + parentDeployment.getName()
                    + "during removal of component " + toString(managedComponent)
                    + " - removal may not persist when the app server is restarted.", status.getFailure());
            }
        } else {
            //this is the last component of the deployment and nothing would be left there after
            //the component was removed. Let's just undeploy it in addition to removing the component.
            //This will make sure that the deployment doesn't leave behind any defunct config files, etc.
            if (LOG.isDebugEnabled()) {
                LOG.debug("Undeploying parent deployment '" + parentDeployment.getName()
                    + "' in order to complete removal of component " + toString(managedComponent) + "...");
            }
            parentDeployment = managementView.getDeployment(parentDeployment.getName());
            DeploymentProgress progress = deploymentManager.remove(parentDeployment.getName());
            DeploymentStatus status = DeploymentUtils.run(progress);
            if (status.isFailed()) {
                LOG.error("Failed to undeploy parent deployment '" + parentDeployment.getName()
                    + "during removal of component " + toString(managedComponent)
                    + " - removal may not persist when the app server is restarted.", status.getFailure());
            }
        }
View Full Code Here

     */
    @Nullable
    private String getContextPath()
            throws NoSuchDeploymentException
    {
        ManagedDeployment deployment = this.managedDeploymentComponent.getManagedDeployment();
        ManagedComponent contextComponent = deployment.getComponent(CONTEXT_COMPONENT_NAME);
        if (contextComponent != null)
        {
            return (String)ManagedComponentUtils.getSimplePropertyValue(contextComponent, "contextRoot");
        }
        else
View Full Code Here

     */
    @Nullable
    private String getContextPath(ResourceDiscoveryContext<AbstractManagedDeploymentComponent> discoveryContext)
        throws NoSuchDeploymentException {
        AbstractManagedDeploymentComponent parentWarComponent = discoveryContext.getParentResourceComponent();
        ManagedDeployment deployment = parentWarComponent.getManagedDeployment();
        ManagedComponent contextComponent = deployment.getComponent(CONTEXT_COMPONENT_NAME);
        // e.g. "/jmx-console"
        if (contextComponent != null) {
            return (String) ManagedComponentUtils.getSimplePropertyValue(contextComponent, "contextRoot");
        } else {
            return null;
View Full Code Here

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

        ManagementView managementView = connection.getManagementView();

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

            return components.get(componentName);
        }

        return null;
View Full Code Here

            // Reload the management view to pickup the ManagedDeployment for the app we just deployed.
            ManagementView managementView = this.profileServiceConnection.getManagementView();
            managementView.load();

            ManagedDeployment managedDeployment = null;
            try {
                managedDeployment = managementView.getDeployment(deploymentName);
            } catch (NoSuchDeploymentException e) {
                LOG.error("Failed to find managed deployment '" + deploymentName + "' after deploying '"
                        + archiveName + "', so cannot start the application.");
                createResourceReport.setStatus(CreateResourceStatus.INVALID_ARTIFACT);
                createResourceReport.setErrorMessage("Unable to start application '" + deploymentName
                        + "' after deploying it, since lookup of the associated ManagedDeployment failed.");
            }
            if (managedDeployment != null) {
                DeploymentState state = managedDeployment.getDeploymentState();
                if (state != DeploymentState.STARTED) {
                    // The app failed to start - do not consider this a FAILURE, since it was at least deployed
                    // successfully. However, set the status to INVALID_ARTIFACT and set an error message, so
                    // the user is informed of the condition.
                    createResourceReport.setStatus(CreateResourceStatus.INVALID_ARTIFACT);
View Full Code Here

        // TODO (ips): Only refresh the ManagementView *once* per runtime discovery scan, rather than every time this
        //             method is called. Do this by providing a runtime scan id in the ResourceDiscoveryContext.
        managementView.load();

        AbstractManagedDeploymentComponent parentResourceComponent = discoveryContext.getParentResourceComponent();
        ManagedDeployment parentDeployment = parentResourceComponent.getManagedDeployment();
        Collection<ManagedComponent> components = parentDeployment.getComponents().values();
        ComponentType componentType = getComponentType(discoveryContext);
        Set<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>();
        for (ManagedComponent component : components) {
            if (component.getType().equals(componentType)) {
                String ejbName = (String)ManagedComponentUtils.getSimplePropertyValue(component, "name");
View Full Code Here

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

        ManagementView managementView = connection.getManagementView();

        Set<ManagedComponent> components = new HashSet<ManagedComponent>();
        ManagedDeployment deploy = managementView.getDeployment(deployName);
        if (deploy != null) {
            if (componentName == null || componentName.equals("*"))
                components.addAll(deploy.getComponents().values());
            else {
                for (ManagedComponent comp : deploy.getComponents().values()) {
                    if (comp.getName().equals(componentName))
                        components.add(comp);
                }
            }
        }
View Full Code Here

TOP

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

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.