Package com.volantis.mcs.devices.policy.types

Examples of com.volantis.mcs.devices.policy.types.PolicyType


        try {
            PolicyDescriptor descriptor =
                    policyDescriptorAccessor.getPolicyDescriptor(
                            policyName, Locale.getDefault());
            if (descriptor != null) {
                PolicyType type = descriptor.getPolicyType();
                if (type instanceof StructurePolicyType) {
                    value = createStructuredPolicyValue(device, policyName,
                            (StructurePolicyType) type);
                } else {
                    try {
View Full Code Here


            try {
                String fieldName = (String) i.next();
                String fullName = policyName + "." + fieldName;

                SimplePolicyValue fieldValue = null;
                PolicyType fieldType = (PolicyType) fieldTypes.get(fieldName);
                if (!(fieldType instanceof SimplePolicyType)) {
                    throw new IllegalStateException(
                            "Can only have simple types inside a structured type");
                }
                // Extract the policy value as a string.
View Full Code Here

            // Test the retrieval of a policy descriptor from VMTYPES
            int id = populateWithSimpleTypes(0);
            policyDescriptor = accessor.retrievePolicyDescriptor(
                    connection, "Policy1", locale);
            assertNotNull("Policy Descriptor should be found", policyDescriptor);
            PolicyType policyType = policyDescriptor.getPolicyType();
            assertTrue("Type should match",
                    policyType instanceof BooleanPolicyType);
            assertEquals("PolicyDescName1",
                policyDescriptor.getPolicyDescriptiveName());
            assertEquals("PolicyHelp1", policyDescriptor.getPolicyHelp());
View Full Code Here

                createTables(conn);

                DefaultPolicyDescriptor descriptor =
                        new DefaultPolicyDescriptor();
                descriptor.setCategory("category");
                PolicyType type = new DefaultBooleanPolicyType();
                descriptor.setPolicyType(type);

                accessor.addPolicyDescriptor(connection, "boolean", descriptor);

                // Check the database contents
View Full Code Here

                createTables(conn);

                DefaultPolicyDescriptor descriptor =
                        new DefaultPolicyDescriptor();
                descriptor.setCategory("category");
                PolicyType type = new DefaultRangePolicyType(1, 100);
                descriptor.setPolicyType(type);
                accessor.addPolicyDescriptor(connection, "range", descriptor);

                // Check the database contents
                checkPolicyTypeRow(conn, null, "range", 0, 0);
View Full Code Here

                policyTypeCount+=2;
                typesCount+=2;
                checkCounts(conn);

                // ordered set
                PolicyType oset = new DefaultUnorderedSetPolicyType(
                                new DefaultBooleanPolicyType());
                descriptor.setPolicyType(oset);
                accessor.addPolicyDescriptor(connection, "oset1", descriptor);
                accessor.addPolicyDescriptor(connection, "oset2", descriptor);
                policyTypeCount+=2;
                typesCount+=4;
                typesSetCount+=2;
                checkCounts(conn);

                // unordered set
                descriptor.setCategory("category3");
                PolicyType uset = new DefaultUnorderedSetPolicyType(
                                new DefaultIntPolicyType());
                descriptor.setPolicyType(uset);
                accessor.addPolicyDescriptor(connection, "uset1", descriptor);
                accessor.addPolicyDescriptor(connection, "uset2", descriptor);
                policyCategoryCount+=1;
View Full Code Here

                        policyName));
            }

            // OK, we have the type, so create the descriptor for it.
            PolicyTypeCreator creator = new PolicyTypeCreator();
            PolicyType policyType = creator.calculate(type);
            descriptor.setPolicyType(policyType);
        }

        // And return the completed object
        return descriptor;
View Full Code Here

                int type = rs.getInt(1);
                int typeID = rs.getInt(2);
                // Close the result set.
                rs.close();

                PolicyType policyType = getPolicyType(
                        jdbcConnection, projectName, type, typeID);

                descriptor = new DefaultPolicyDescriptor();
                descriptor.setPolicyType(policyType);
            }
View Full Code Here

                                     String projectName,
                                     int typeID,
                                     int typeInstanceID)
            throws RepositoryException {

        PolicyType policyType = null;
        switch (typeID) {
            case BOOLEAN_TYPE_ID:
                policyType = new DefaultBooleanPolicyType();
                break;
View Full Code Here

     */
    private PolicyType getReferencedType(
            JDBCRepositoryConnection jdbcConnection, String projectName,
            int typeInstanceID) throws RepositoryException {

        PolicyType policyType = null;

        Connection connection = jdbcConnection.getConnection();

        // Resolve field names.
        String typeIDField = resolveFieldName(jdbcConnection, TYPE_ID_COLUMN_NAMES);
View Full Code Here

TOP

Related Classes of com.volantis.mcs.devices.policy.types.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.