Examples of OperationDefinition


Examples of org.rhq.core.domain.operation.OperationDefinition

        assert resourceType.getParentResourceTypes().iterator().next().getName().equals("OuterServerB");
    }

    private void assertVersion1(ResourceType resourceType) {
        assert resourceType.getOperationDefinitions().size() == 1;
        OperationDefinition op = resourceType.getOperationDefinitions().iterator().next();
        assert op.getName().equals(OP_NAME);
        assert op.getTimeout().intValue() == OP_TIMEOUT;
        assert op.getDescription().equals(OP_DESC);
    }
View Full Code Here

Examples of org.rhq.core.domain.operation.OperationDefinition

        assert op.getDescription().equals(OP_DESC);
    }

    private void assertVersion2(ResourceType resourceType) {
        assert resourceType.getOperationDefinitions().size() == 1;
        OperationDefinition op = resourceType.getOperationDefinitions().iterator().next();
        assert op.getName().equals(NEW_OP_NAME);
        assert op.getTimeout().intValue() == NEW_OP_TIMEOUT;
        assert op.getDescription().equals(NEW_OP_DESC);
    }
View Full Code Here

Examples of org.rhq.core.domain.operation.OperationDefinition

        @ApiParam("Id of the definition to retrieve") @PathParam("id") int definitionId,
        @ApiParam("Id of a resource that supports this operation") @QueryParam("resourceId") Integer resourceId,
        @Context UriInfo uriInfo,
        @Context Request request) {

        OperationDefinition def;
        def = getFromCache(definitionId, OperationDefinition.class);
        if (def==null) {
            try {
                def = opsManager.getOperationDefinition(caller,definitionId);
                putToCache(definitionId,OperationDefinition.class,def);
            }
            catch (OperationDefinitionNotFoundException ode) {
                throw new StuffNotFoundException("Operation definition with id " + definitionId);
            }
        }

        EntityTag eTag = new EntityTag(Integer.toHexString(def.hashCode()));
        Response.ResponseBuilder builder = request.evaluatePreconditions(eTag);
        if (builder==null) {

            OperationDefinitionRest odr = new OperationDefinitionRest();
            odr.setId(def.getId());
            odr.setName(def.getName());

            copyParamsForDefinition(def, odr);

            builder=Response.ok(odr);
View Full Code Here

Examples of org.rhq.core.domain.operation.OperationDefinition

        catch (ResourceNotFoundException rnfe) {
            throw new StuffNotFoundException("resource with id " + resourceId);
        }


        OperationDefinition opDef;
        try {
            opDef = opsManager.getOperationDefinition(caller,definitionId);
        }
        catch (OperationDefinitionNotFoundException odnfe) {
            throw new StuffNotFoundException("Operation definition with id " + definitionId);
        }
        OperationRest operationRest = new OperationRest(resourceId,definitionId);
        operationRest.setId((int)System.currentTimeMillis()); // TODO better id (?)(we need one for pUT later on)
        operationRest.setReadyToSubmit(false);
        operationRest.setName(opDef.getName());
        ConfigurationDefinition paramDefinition = opDef.getParametersConfigurationDefinition();
        if (paramDefinition != null) {
            for (PropertyDefinition propDefs : paramDefinition.getNonGroupedProperties()) { // TODO extend to all properties ?
                operationRest.getParams().put(propDefs.getName(),"TODO"); // TODO type and value of the value
            }
        }
View Full Code Here

Examples of org.rhq.core.domain.operation.OperationDefinition

        Configuration parameters = ConfigurationHelper.mapToConfiguration(operation.getParams());

        if (operation.isReadyToSubmit()) {

            OperationDefinition opDef = opsManager.getOperationDefinition(caller,operation.getDefinitionId());

            // Validate parameters
            ConfigurationDefinition parameterDefinition = opDef.getParametersConfigurationDefinition();
            if (parameterDefinition!=null) {
                // There are parameters defined, so lets validate them.
                List<String> errorMessages = ConfigurationHelper.checkConfigurationWrtDefinition(parameters, parameterDefinition);

                if (errorMessages.size()>0) {
View Full Code Here

Examples of org.rhq.core.domain.operation.OperationDefinition

            throw new IllegalArgumentException("OperationParameters does not support objects of type "
                + schedule.getClass().getSimpleName());
        }

        OperationManagerLocal operationManager = LookupUtil.getOperationManager();
        OperationDefinition definition;

        try {
            definition = operationManager
                .getOperationDefinitionByResourceTypeAndName(type.getId(), operationName, true);
        } catch (OperationDefinitionNotFoundException odnfe) {
            throw new PluginReloadedException("The plugin for " + type.getName()
                + " has been updated since this schedule was created, and the operation " + operationName
                + " no longer exists");
        }

        this.configurationDefinition = definition.getParametersConfigurationDefinition();
    }
View Full Code Here

Examples of org.rhq.core.domain.operation.OperationDefinition

    protected ConfigurationDefinition lookupConfigurationDefinition() {
        try {
            Subject subject = EnterpriseFacesContextUtility.getSubject();
            int operationId = Integer.valueOf(FacesContextUtility.getRequiredRequestParameter("opId"));

            OperationDefinition operationDefinition = operationManager.getOperationDefinition(subject, operationId);
            ConfigurationDefinition definition = operationDefinition.getParametersConfigurationDefinition();

            return definition;
        } catch (Exception e) {
            return null;
        }
View Full Code Here

Examples of org.rhq.core.domain.operation.OperationDefinition

            String opName;
            try {
                Integer resourceTypeId = condition.getAlertDefinition().getResource().getResourceType().getId();
                String operationName = condition.getName();

                OperationDefinition definition = operationManager.getOperationDefinitionByResourceTypeAndName(
                    resourceTypeId, operationName, false);
                opName = definition.getDisplayName();
            } catch (Exception e) {
                opName = condition.getName(); // can't look up the op display name (are we in a test?), just use the op name
            }

            String status = condition.getOption();
View Full Code Here

Examples of org.rhq.core.domain.operation.OperationDefinition

        throws PluginContainerException {
        try {
            final OperationInvocation[] theJob = new OperationInvocation[1]; // need array so we can use it in the timer task
            final long invocationTime = System.currentTimeMillis();

            OperationDefinition operationDefinition = getOperationDefinition(resourceId, operationName);
            if (operationDefinition != null && operationDefinition.getParametersConfigurationDefinition() != null
                && parameterConfig != null) {
                ConfigurationUtility.normalizeConfiguration(parameterConfig, operationDefinition
                    .getParametersConfigurationDefinition());
            }

            // create our timer task that will force the operation invocation to time out if it takes too long to complete
            final long operationTimeout = getOperationTimeout(operationDefinition, parameterConfig);
View Full Code Here

Examples of org.rhq.core.domain.operation.OperationDefinition

            // create a new session even if user is logged in elsewhere, we don't want to attach to that user's session
            user = getUserWithSession(schedule.getSubject(), false);
            ResourceGroup group = schedule.getGroup();

            // we need the operation definition to fill in the history item
            OperationDefinition op;
            op = operationManager.getSupportedGroupOperation(user, group.getId(), schedule.getOperationName(), false);

            // first we need to create an INPROGRESS *group* history item
            Configuration parameters = schedule.getParameters();
            if (parameters != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.