Package com.volantis.mcs.policies

Examples of com.volantis.mcs.policies.PolicyType


                for (Iterator i = ARGUMENT_2_POLICY_TYPE.entrySet().iterator();
                     i.hasNext();) {
                    Map.Entry entry = (Map.Entry) i.next();
                    String policyArgument = (String) entry.getKey();
                    PolicyType policyType = (PolicyType) entry.getValue();

                    transferPolicies(policyArgument, policyType);
                }

                if(undoable) {
View Full Code Here


     * Check the valid content types for the policy type supported by this
     * asset content section, and set up a series of flags indicating whether
     * the policy supports each possible type of content.
     */
    private void checkContentTypes() {
        PolicyType policyType = context.getPolicyType();
        PolicyModelSet modelSet = PolicyModelSet.getModelSet(policyType);

        Class[] contentTypes = modelSet.getContentClasses();
        if (contentTypes != null) {
            for (int i = 0; i < contentTypes.length; i++) {
View Full Code Here

        final PolicyType[] types = policyModelSet.getFallBackTypes();
        Map typesToTextComponents = new HashMap();

        if (types != null && types.length > 0) {
            for (int i = 0; i < types.length; i++) {
                final PolicyType type = types[i];
                String labelString = EditorMessages.getString(
                        RESOURCE_PREFIX + StringUtils.toLowerIgnoreLocale(
                                types[i].toString()) + ".fallback.label");

                Label fallBackLabel = new Label(parent, SWT.NONE);
                setDefaultColour(fallBackLabel);
                fallBackLabel.setText(labelString);
                GridData data =
                        new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
                fallBackLabel.setLayoutData(data);
                enableableControls.add(fallBackLabel);

                Composite entry = new Composite(parent, SWT.NONE);
                GridLayout layout = new GridLayout(2, false);
                layout.marginHeight = 0;
                layout.marginWidth = 0;
                entry.setLayout(layout);
                data = new GridData(GridData.FILL_HORIZONTAL);
                entry.setLayoutData(data);
                setDefaultColour(entry);

                final Text fallBackText = new Text(entry, SWT.BORDER);
                data = new GridData(GridData.FILL_HORIZONTAL);
                fallBackText.setLayoutData(data);
                typesToTextComponents.put(type, fallBackText);
                enableableControls.add(fallBackText);

                final PolicySelectorBrowseAction browseAction =
                        new PolicySelectorBrowseAction(FileExtension.
                                getFileExtensionForPolicyType(types[i]));

                Button button = new Button(entry, SWT.NONE);
                button.setText("Browse...");
                button.addSelectionListener(new SelectionListener() {
                    private void handleSelection() {
                        String oldText = fallBackText.getText();
                        String policyValue = browseAction.doBrowse(
                                oldText, parent, context);

                        // Has anything changed?
                        if (policyValue != null &&
                                !policyValue.equals(oldText)) {
                            fallBackText.setText(policyValue);
                            setFallbackPolicy(type, policyValue);
                        }
                    }

                    public void widgetSelected(SelectionEvent event) {
                        handleSelection();
                    }

                    public void widgetDefaultSelected(SelectionEvent event) {
                        handleSelection();
                    }
                });
                enableableControls.add(button);
            }

            // Initialise the fallback policies
            ListProxy alternatePolicies =
                    (ListProxy) ((BeanProxy) context.getInteractionModel()).
                            getPropertyProxy(PolicyModel.ALTERNATE_POLICIES);
            int size = alternatePolicies.size();

            for (int i = 0; i < size; i++) {
                Proxy itemProxy = alternatePolicies.getItemProxy(i);
                Object modelObject = itemProxy.getModelObject();
                PolicyReference ref = (PolicyReference) modelObject;
                Text text = (Text) typesToTextComponents
                        .get(ref.getExpectedPolicyType());
                text.setText(ref.getName());
            }

            // Register the listeners for the fallback GUI components
            for (int i = 0; i < types.length; i++) {
                final PolicyType type = types[i];
                final Text text = (Text) typesToTextComponents.get(type);
                text.addModifyListener(new ModifyListener() {
                    public void modifyText(ModifyEvent event) {
                        setFallbackPolicy(type, text.getText());
                    }
View Full Code Here

            } else if (PropertyValue.class == propertyType) {
                addStyleValue(descriptor, synchronizationGroup, false);
            } else if (Integer.class == propertyType || Integer.TYPE == propertyType) {
                addInteger(descriptor);
            } else if (PolicyReference.class == propertyType) {
                PolicyType policyType = null;
                if (policyTypes != null) {
                    policyType = (PolicyType) policyTypes.get(descriptor.getIdentifier());
                }
                addPolicyReference(descriptor, policyType);
            } else {
View Full Code Here

    public void updateErrorStatus() {
        Proxy proxy = context.getInteractionModel();
        List diagnostics = (proxy == null) ? null : proxy.getDiagnostics();
        boolean hasErrors = diagnostics != null && !diagnostics.isEmpty();
        if (hasErrors) {
            final PolicyType policyType = ((PolicyEditorContext) context).getPolicyType();
            if (policyType == null) {
                throw new IllegalArgumentException("Policy type is NOT defined for this context");
            }
            // policyType is used as a key to get a message from bundle
            String policyTypeMessage = EditorMessages.getString(RESOURCE_PREFIX + policyType.toString());
            String errorFormat = EditorMessages.getString(RESOURCE_PREFIX + "errors");
            String errorMessage = MessageFormat.format(errorFormat, new Object[] {
                new Integer(diagnostics.size()),               
                new Integer(0),
                new Integer(0),
View Full Code Here

            for (Iterator i = typeSpecificPartitions.iterator(); i.hasNext();) {
                PolicyTypePartitionConfiguration typePartition =
                        (PolicyTypePartitionConfiguration) i.next();
                List types = typePartition.getPolicyTypes();
                for (int j = 0; j < types.size(); j++) {
                    PolicyType policyType = (PolicyType) types.get(j);
                    type2Partition.put(policyType, typePartition);
                }
            }
        }
View Full Code Here

     * @return An empty instance of the default metadata type for this policy,
     *         or null if one could not be created
     */
    private MetaDataBuilder getDefaultMetaDataBuilder() {
        MetaDataBuilder metaDataBuilder = null;
        PolicyType policyType = context.getPolicyType();
        if (policyType == VariablePolicyType.TEXT) {
            metaDataBuilder = POLICY_FACTORY.createTextMetaDataBuilder();
        } else if (policyType == VariablePolicyType.CHART) {
            metaDataBuilder = POLICY_FACTORY.createChartMetaDataBuilder();
        } else if (policyType == VariablePolicyType.AUDIO) {
View Full Code Here

    protected Value createIdentityValue(
            ExpressionContext context, Project project, String policyName) {

        FileExtension extension =
                FileExtension.getFileExtensionForLocalPolicy(policyName);
        PolicyType policyType = null;
        if (extension != null) {
            policyType = extension.getPolicyType();

        }
        if (policyType == null) {
View Full Code Here

            builder.setCacheControlDefaults(base.getDefaultCacheControl());

            SeparateCacheControlConstraintsMap constraintsMap =
                    new SeparateCacheControlConstraintsMap();
            for (Iterator i = PolicyType.getPolicyTypes().iterator(); i.hasNext();) {
                PolicyType policyType = (PolicyType) i.next();
                PolicyTypePartitionConfiguration typePartitionConfiguration =
                        partition.getTypePartition(policyType);
                CacheControlConstraints typeConstraints;
                groupBuilder = cacheFactory.createGroupBuilder();
                if (typePartitionConfiguration == null) {
View Full Code Here

    // Javadoc inherited.
    public ActivatedPolicy fetchPolicy(RuntimePolicyReference reference) {

        RuntimeProject project = (RuntimeProject) reference.getProject();
        String name = reference.getName();
        PolicyType expectedPolicyType = reference.getExpectedPolicyType();

        ActivatedPolicy policy = null;
        try {
            // Look for the policy in the project.
            policy = retriever.retrievePolicy(project, name);

            // If a specific type was requested then make sure the one that was
            // retrieved matches it. If it does not just ignore it.
            if (policy != null) {
                PolicyType actualPolicyType = policy.getPolicyType();
                if (expectedPolicyType != null &&
                        actualPolicyType != expectedPolicyType) {

                    if (logger.isInfoEnabled()) {
                        logger.info("Expected " + expectedPolicyType +
View Full Code Here

TOP

Related Classes of com.volantis.mcs.policies.PolicyType

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.