Package com.volantis.mcs.repository

Examples of com.volantis.mcs.repository.RepositoryEnumeration


        Set result = new HashSet();

        RepositoryConnection connection = repository.connect();
        try {
            RepositoryEnumeration policyNames =
                    accessor.enumeratePolicyNames(connection);
            try {
                while (policyNames.hasNext()) {
                    String policyName = (String) policyNames.next();
                    result.add(policyName);
                }
            } finally {
                policyNames.close();
            }
        } finally {
            repository.disconnect(connection);
        }
View Full Code Here


        final List names = new LinkedList();
        try {
            final RepositoryConnection connection = repository.connect();
            try {
                final RepositoryEnumeration e =
                    accessor.enumerateCategoryNames(connection);
                try {
                    while (e.hasNext()) {
                        final String categoryName = (String) e.next();
                        names.add(categoryName);
                    }
                } finally {
                    e.close();
                }
            } finally {
                repository.disconnect(connection);
            }
        } catch (RepositoryException e) {
View Full Code Here

        if (category != null) {
            names = new ArrayList();
            try {
                RepositoryConnection connection = repository.connect();
                try {
                    RepositoryEnumeration e = accessor.enumeratePolicyNames(
                            connection, category);
                    try {
                        while (e.hasNext()) {
                            String policyName = (String) e.next();
                            if (isPolicyNameAccessible(policyName)) {
                                names.add(policyName);
                            }
                        }
                    } finally {
                        e.close();
                    }
                } finally {
                    repository.disconnect(connection);
                }
            } catch (RepositoryException e) {
View Full Code Here

        final List names = new LinkedList();
        try {
            final RepositoryConnection connection = repository.connect();
            try {
                final RepositoryEnumeration e = accessor.enumerateDevicesChildren(
                        connection, deviceName);
                try {
                    while (e.hasNext()) {
                        final String childName = (String) e.next();
                        names.add(childName);
                    }
                } finally {
                    e.close();
                }
            } finally {
                repository.disconnect(connection);
            }
        } catch (RepositoryException e) {
View Full Code Here

        Set result = new HashSet();

        RepositoryConnection connection = repository.connect();
        try {
            RepositoryEnumeration policyNames =
                    accessor.enumeratePolicyNames(connection);
            try {
                while (policyNames.hasNext()) {
                    String policyName = (String) policyNames.next();
                    if (isPolicyNameAccessible(policyName)) {
                        result.add(policyName);
                    }
                }
            } finally {
                policyNames.close();
            }
        } finally {
            repository.disconnect(connection);
        }
View Full Code Here

                info("no-transfer-requested", null);
            }
            return;
        }

        RepositoryEnumeration e;
        if(transferType == TRANSFER_ALL) {
            e = srcPolicyAccessor.enumeratePolicyNames(policyType);
        } else {
            // Create an enumeration of identities from the list of names.
            e = args.getValueEnumerator(policyArgument);
        }
        try {
            while(e.hasNext ()) {
                String name = (String) e.next ();

                transferPolicy(policyType, name);
            }
        }
        finally {
            e.close ();
        }
    }
View Full Code Here

        copyCategoryDescriptors(srcDeviceAccessor, dstDeviceAccessor);

        copyPolicyDescriptors(srcDeviceAccessor, dstDeviceAccessor);

        // Transfer the devices.
        RepositoryEnumeration deviceNames;
        if (transferType == TRANSFER_ALL) {
            deviceNames = srcDeviceAccessor.enumerateDevicesChildren(null);
        } else {
            deviceNames = args.getValueEnumerator(DEVICE);
        }
View Full Code Here

     */
    private static void copyPolicyDescriptors(DeviceTransferAccessor srcAccessor,
            DeviceTransferAccessor dstAccessor)
            throws RepositoryException {
        // Now
        RepositoryEnumeration names = srcAccessor.enumerateDevicePolicyNames();

        try {
            while (names.hasNext()) {
                String policyName = (String) names.next();
                if (logger.isDebugEnabled()) {
                    logger.debug("Copying policy descriptor " +
                            "for '" + policyName + "'");
                }

                // Read the descriptors from the source for this policy.
                List policyDescriptors;
                try {
                    policyDescriptors =
                        srcAccessor.retrievePolicyDescriptors(policyName);
                } catch (RepositoryException e) {
                    throw new RepositoryException(
                            exceptionLocalizer.format(
                                    "cannot-read-policy-descriptor",
                        policyName), e);
                }

                for (Iterator iter = policyDescriptors.iterator();
                     iter.hasNext();) {

                    final PolicyDescriptor policyDescriptor =
                        (PolicyDescriptor) iter.next();
                    // Write the descriptors to the destination for this policy.
                    try {
                        dstAccessor.addPolicyDescriptor(policyName,
                                policyDescriptor);
                    } catch (RepositoryException e) {
                        throw new RepositoryException(
                                exceptionLocalizer.format(
                                        "cannot-write-policy-descriptor",
                            new Object[]{policyName, policyDescriptor}), e);
                    }
                }
            }
        } finally {
            names.close();
        }
    }
View Full Code Here

    private static void copyCategoryDescriptors(DeviceTransferAccessor srcAccessor,
            DeviceTransferAccessor dstAccessor)
            throws RepositoryException {
        // Now loop over all the source category names, copying the related
        // category descriptors from the source to the destination.
        RepositoryEnumeration names = srcAccessor.enumerateCategoryNames();

        try {
            while (names.hasNext()) {
                String categoryName = (String) names.next();
                if (logger.isDebugEnabled()) {
                    logger.debug("Copying category descriptor " +
                            "for '" + categoryName + "'");
                }

                // Read the descriptors from the source for this policy.
                List categoryDescriptors;
                try {
                    categoryDescriptors =
                        srcAccessor.retrieveCategoryDescriptors(
                            categoryName);
                } catch (RepositoryException e) {
                    throw new RepositoryException(
                        exceptionLocalizer.format(
                            "cannot-read-category-descriptor", categoryName),
                        e);
                }

                for (Iterator iter = categoryDescriptors.iterator();
                     iter.hasNext();) {

                    final CategoryDescriptor categoryDescriptor =
                        (CategoryDescriptor) iter.next();
                    // Write the descriptors to the destination for this
                    // category.
                    try {
                        dstAccessor.addCategoryDescriptor(
                            categoryName, categoryDescriptor);
                    } catch (RepositoryException e) {
                        throw new RepositoryException(
                                exceptionLocalizer.format(
                                        "cannot-write-policy-descriptor",
                            new Object[]{categoryName, categoryDescriptor}), e);
                    }
                }
            }
        } finally {
            names.close();
        }
    }
View Full Code Here

                    exception("unexpected-exception", re);
                }
            }
        }

        RepositoryEnumeration children =
                srcDeviceAccessor.enumerateDevicesChildren(deviceName);

        transferDevices(children, srcDeviceAccessor, dstDeviceAccessor);
    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.repository.RepositoryEnumeration

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.