Package org.rhq.core.domain.cloud

Examples of org.rhq.core.domain.cloud.StorageNode


        final PageList<StorageNodeLoadComposite> result = new PageList<StorageNodeLoadComposite>();
        try {
            long endTime = System.currentTimeMillis();
            long beginTime = endTime - (8 * 60 * 60 * 1000);
            for (StorageNode node : nodes) {
                final StorageNode theNode = node;
                if (node.getOperationMode() != OperationMode.INSTALLED) {
                    ListenableFuture<List<StorageNodeLoadComposite>> compositesFuture = getLoadAsync(subject, node,
                        beginTime, endTime);
                    Futures.addCallback(compositesFuture, new FutureCallback<List<StorageNodeLoadComposite>>() {
                        @Override
View Full Code Here


                while (!resourceIdToStorageNodeMap.containsKey(currentResourceId)) {
                    currentResourceId = entityManager.find(Resource.class, currentResourceId).getParentResource()
                        .getId();
                }
                Integer alertsForResource = alertCountsByResource.get(resourceId);
                StorageNode storageNode = resourceIdToStorageNodeMap.get(currentResourceId);
                Integer count = storageNodeAlertCounts.get(storageNode.getId());
                if (count == null) {
                    storageNodeAlertCounts.put(storageNode.getId(), alertsForResource);
                } else {
                    storageNodeAlertCounts.put(storageNode.getId(), count + alertsForResource);
                }
            }

            return storageNodeAlertCounts;
        } finally {
View Full Code Here

    }

    @Override
    @RequiredPermission(Permission.MANAGE_SETTINGS)
    public boolean updateConfiguration(Subject subject, StorageNodeConfigurationComposite newStorageNodeConfigurationComposite) {
        StorageNode storageNode = findStorageNodeByAddress(newStorageNodeConfigurationComposite.getStorageNode().getAddress());
        if (storageNode == null || storageNode.getResource() == null || !newStorageNodeConfigurationComposite.validate())
            return false;

        // 1. upgrade the resource configuration if there was a change
        Resource storageNodeResource = storageNode.getResource();

        // StorageNodeResourceConfig
        Configuration storageNodeResourceConfig = configurationManager.getResourceConfiguration(subject,
            storageNodeResource.getId());
View Full Code Here

    }

    @Override
    @RequiredPermission(Permission.MANAGE_SETTINGS)
    public void ackFailedOperation(Subject subject, int storageNodeId) {
        StorageNode existingStorageNode = entityManager.find(StorageNode.class, storageNodeId);
        if (null != existingStorageNode) {
            existingStorageNode.setFailedOperation(null);
            existingStorageNode.setErrorMessage(null);
            entityManager.merge(existingStorageNode);
        } else {
            log.info("Storage node did not exist. Cannot ack/clear the failed operation.");
        }
    }
View Full Code Here

*/
public class StorageNodeConfigurationUtilTest {

    @Test
    public void testConfigurationSync() throws Exception {
        StorageNode mockStorageNode = Mockito.mock(StorageNode.class);
        StorageNodeConfigurationComposite oldConfig = new StorageNodeConfigurationComposite(mockStorageNode);
        StorageNodeConfigurationComposite newConfig = new StorageNodeConfigurationComposite(mockStorageNode);

        // These should be copied to newConfig
        String oldLogLocationValue = "oldLogLocation";
View Full Code Here

            new AsyncCallback<PageList<StorageNode>>() {
                public void onSuccess(final PageList<StorageNode> storageNodes) {
                    if (storageNodes == null || storageNodes.isEmpty() || storageNodes.size() != 1) {
                        onFailure(new Exception("No storage nodes have been found."));
                    }
                    final StorageNode node = storageNodes.get(0);
                    header.setContents(MSG.view_adminTopology_storageNodes_node() + " (" + node.getAddress() + ")");

                    prepareDetailsSection(node);
                    fetchStorageNodeConfigurationComposite(node);
                    fetchSparkLineDataForLoadComponent(node);
                    fetchUnackAlerts(storageNodeId, node.getResource() != null);
                }

                public void onFailure(Throwable caught) {
                    CoreGUI.getErrorHandler().handleError(
                        MSG.view_adminTopology_message_fetchServerFail(String.valueOf(storageNodeId)) + " "
View Full Code Here

        configurationSection = section;
        initSectionCount++;
    }

    private void showAlertsForSingleStorageNode() {
        GWTServiceLookup.getStorageService().findResourcesWithAlertDefinitions(new StorageNode(storageNodeId),
            new AsyncCallback<Integer[]>() {
                @Override
                public void onFailure(Throwable caught) {
                    alerts = false;
                    CoreGUI.getErrorHandler().handleError(
View Full Code Here

                            Message msg = new Message(MSG.view_adminTopology_message_fetchServerFail(String
                                .valueOf(storageNodeId)), Message.Severity.Error);
                            CoreGUI.goToView(StorageNodeTableView.VIEW_PATH, msg);
                            return;
                        }
                        final StorageNode node = storageNodes.get(0);
                        header.setContents("<div style='text-align: center; font-weight: bold; font-size: medium;'>"
                            + MSG.view_adminTopology_storageNodes_node() + " (" + node.getAddress() + ")</div>");
                        initialized = true;
                    }

                    public void onFailure(Throwable caught) {
                        CoreGUI.getErrorHandler().handleError(
                            MSG.view_adminTopology_message_fetchServerFail(String.valueOf(storageNodeId)) + " "
                                + caught.getMessage(), caught);
                    }
                });
        } else { // fetch the addresses of all storage nodes
            GWTServiceLookup.getStorageService().getStorageNodes(new AsyncCallback<List<StorageNode>>() {
                public void onSuccess(final List<StorageNode> storageNodes) {
                    if (storageNodes != null && !storageNodes.isEmpty()) {
                        for (StorageNode node : storageNodes) {
                            storageNodeIdToAddressMap.put(node.getId(), node.getAddress());
                        }
                    }
                    initialized = true;
                }
View Full Code Here

    }

    @Override
    public ListGridRecord copyValues(StorageNodeLoadComposite from) {
        ListGridRecord record = new ListGridRecord();
        StorageNode node = from.getStorageNode();
        if (node != null) {
            record.setAttribute(FIELD_ID.propertyName(), node.getId());
            record.setAttribute(FIELD_ADDRESS.propertyName(), from.getHostname());
            record.setAttribute(FIELD_CQL_PORT.propertyName(), node.getCqlPort());
            record.setAttribute(FIELD_OPERATION_MODE.propertyName(), node.getOperationMode());
            record.setAttribute(FIELD_STATUS.propertyName(), node.getStatus().toString());
            record.setAttribute(FIELD_CTIME.propertyName(), node.getCtime());
            record.setAttribute(FIELD_ERROR_MESSAGE.propertyName(), node.getErrorMessage());
            if (node.getFailedOperation() != null && node.getFailedOperation().getResource() != null) {
                ResourceOperationHistory operationHistory = node.getFailedOperation();
                String value = LinkManager.getSubsystemResourceOperationHistoryLink(operationHistory.getResource()
                    .getId(), operationHistory.getId());
                record.setAttribute(FIELD_FAILED_OPERATION.propertyName(), value);
            }
            if (node.getResource() != null) {
                record.setAttribute(FIELD_RESOURCE_ID.propertyName(), node.getResource().getId());
                record.setAttribute(
                    FIELD_AVAILABILITY.propertyName(),
                    ImageManager.getAvailabilityIconFromAvailType(node.getResource().getCurrentAvailability()
                        .getAvailabilityType()));
            } else {
                record.setAttribute(FIELD_AVAILABILITY.propertyName(),
                    ImageManager.getAvailabilityIconFromAvailType(AvailabilityType.UNKNOWN));
            }
        }
        int value = from.getUnackAlerts();
        record.setAttribute(
            FIELD_ALERTS.propertyName(),
            node.getResource() != null ? StorageNodeAdminView.getAlertsString(
                MSG.view_adminTopology_storageNodes_unackAlerts(), node.getId(), value) : MSG
                .view_adminTopology_storageNodes_unackAlerts() + " (0)");
        String memory = null;
        if (from.getHeapPercentageUsed() != null && from.getHeapPercentageUsed().getAggregate().getAvg() != null)
            memory = MeasurementConverterClient.format(from.getHeapPercentageUsed().getAggregate().getAvg(), from
                .getHeapPercentageUsed().getUnits(), true);
View Full Code Here

            return fields;
        }

        @Override
        protected void executeFetch(final DSRequest request, final DSResponse response, StorageNodeCriteria criteria) {
            final StorageNode node = new StorageNode();
            node.setId(storageNodeId);
            // set dummy address because StorageNode.equals method ignores id field
            node.setAddress(String.valueOf(storageNodeId));
            Log.debug("Executing fetch for storage node [id=" + storageNodeId + "]");
            executeFetch(node, new AsyncCallback<StorageNodeLoadComposite>() {
                public void onSuccess(final StorageNodeLoadComposite loadComposite) {
                    Log.debug("Data for storage node [id=" + storageNodeId + "] arrived: " + loadComposite);
                    ListGridRecord[] records = makeListGridRecords(loadComposite);
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.cloud.StorageNode

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.