Package com.volantis.mcs.accessors.xml

Examples of com.volantis.mcs.accessors.xml.ZipArchive$ZipArchiveEntry


        String deviceName = element.getAttributeValue(
                DeviceRepositorySchemaConstants.DEVICE_NAME_ATTRIBUTE);

        // copy the repository archive in case anything goes wrong.
        ZipArchive archive = new ZipArchive(repositoryArchive);

        removeFile(archive, DeviceRepositoryConstants.STANDARD_DEVICE_DIRECTORY, true, deviceName);
        removeFile(archive, DeviceRepositoryConstants.CUSTOM_DEVICE_DIRECTORY, false, deviceName);
        element.detach();
View Full Code Here


                            "device-not-found-cannot-rename",
                            deviceName));
        }

        // copy the archive in case anything goes wrong
        ZipArchive archive = new ZipArchive(repositoryArchive);

        Element parent = element.getParent();

        // Detach the element to remove it from any event-driven view.
        element.detach();
View Full Code Here

    public void writeIdentifiers() throws RepositoryException {
        try {
            // If we have an identification document, then output it.
            if (xmlIdentificationDocument != null) {
                // copy the archive in case anything goes wrong
                ZipArchive archive = new ZipArchive(repositoryArchive);

                OutputStream out = archive.getOutputTo(DeviceRepositoryConstants.IDENTIFICATION_XML);
                writeDocument(xmlIdentificationDocument, out);

                repositoryArchive = archive;
            }
        } catch (IOException e) {
View Full Code Here

    public void writeTACs() throws RepositoryException {
        try {
            // If we have an identification document, then output it.
            if (xmlTACIdentificationDocument != null) {
                // copy the archive in case anything goes wrong
                ZipArchive archive = new ZipArchive(repositoryArchive);

                OutputStream out = archive.getOutputTo(DeviceRepositoryConstants.TAC_IDENTIFICATION_XML);
                writeDocument(xmlTACIdentificationDocument, out);

                repositoryArchive = archive;
            }
        } catch (IOException e) {
View Full Code Here

    public void writeHierarchy() throws RepositoryException {
        try {
            // If we have a hierarchy document, then output it.
            if (xmlHierarchyDocument != null) {
                // copy the archive in case anything goes wrong
                ZipArchive archive = new ZipArchive(repositoryArchive);

                OutputStream out = archive.getOutputTo(DeviceRepositoryConstants.HIERARCHY_XML);
                writeDocument(xmlHierarchyDocument, out);

                repositoryArchive = archive;
            } else {
                // Repository is invalid without a hierarchy.
View Full Code Here

                customDefRoot.addContent(clone);
            }
        }

        // copy the archive in case anything goes wrong
        ZipArchive archive = new ZipArchive(repositoryArchive);

        removeFile(archive, DeviceRepositoryConstants.CUSTOM_DEFINITIONS_DIRECTORY, false,
                DeviceRepositorySchemaConstants.DEFINITIONS_DOCUMENT_NAME);
        if (hasCustomDefs) {
            writeFile(archive, DeviceRepositoryConstants.CUSTOM_DEFINITIONS_DIRECTORY,
View Full Code Here

                        }
                    }
                }

                // copy the archive in case anything goes wrong
                ZipArchive archive = new ZipArchive(repositoryArchive);
                // remove the custom file
                removeFile(archive, DeviceRepositoryConstants.CUSTOM_DEVICE_DIRECTORY,
                        false, deviceName);
                if (customDeviceDocument != null) {
                    writeFile(archive, DeviceRepositoryConstants.CUSTOM_DEVICE_DIRECTORY,
View Full Code Here

                        standardProps.setProperty(name, value);
                    }
                }

                // copy the archive in case anything goes wrong
                ZipArchive archive = new ZipArchive(repositoryArchive);

                // The standard properties path is guaranteed to be non-null if
                // this code is being executed. If the path is null, an
                // IOException is thrown by {@link createMergedProperties}
                // (which is called by the constructor).
                standardPropsOut = archive.getOutputTo(standardPropertiesPath);
                try {
                    standardProps.store(standardPropsOut, null);
                } catch (IOException e) {
                    throw new RepositoryException(e);
                }

                if (customProps.size() > 0) {
                    // The properties path will already be set if there were
                    // any custom properties in the repository. Otherwise,
                    // these are the first custom properties to be defined and
                    // written, so set the custom path to a suitable default.
                    if (customPropertiesPath == null) {
                        customPropertiesPath =
                                DeviceRepositoryConstants.CUSTOM_POLICIES_PROPERTIES_PREFIX +
                                DeviceRepositoryConstants.POLICIES_PROPERTIES_SUFFIX;
                    }
                    customPropsOut = archive.getOutputTo(customPropertiesPath);
                    try {
                        customProps.store(customPropsOut, null);
                    } catch (IOException e) {
                        throw new RepositoryException(e);
                    }
View Full Code Here

     * @throws RepositoryException if an error occurs reading or upgrading
     *                             the repository.
     */
    public ZipArchive getArchive() throws RepositoryException {
        try {
            ZipArchive archive = new ZipArchive(archiveFileName);
            if (willBeModifiedOnLoad()) {
                try {
                    InputStream styleSheetInput = MDPRArchiveAccessor.class.
                            getResourceAsStream("MDPRTACIdentification.xsl");
                    InputStream hierarchyInput =
                            archive.getInputFrom(HIERARCHY_FILE_3_0);
                    Source stylesheet = new StreamSource(styleSheetInput);
                    Source hierarchy = new StreamSource(hierarchyInput);
                    // NOTE: transformer factory will be guaranteed to be
                    // non-null here since we have already called
                    // willBeModifiedOnLoad...
                    Transformer transformer = transformerFactory.
                            newTransformer(stylesheet);
                    OutputStream tacOutput = archive.getOutputTo(
                            TAC_IDENTIFICATION_FILE_3_0);
                    transformer.transform(hierarchy,
                            new StreamResult(tacOutput));
                    tacOutput.flush();
                    tacOutput.close();
View Full Code Here

     * @throws RepositoryException if an error occurs reading from or upgrading
     *                             the device repository.
     */
    public InputStream getArchiveEntryInputStream(String fileName)
            throws RepositoryException {
        ZipArchive za = null;
        try {
            if (TAC_IDENTIFICATION_FILE_3_0.equals(fileName) &&
                    willBeModifiedOnLoad()) {
                za = getArchive();
            } else {
                za = new ZipArchive(archiveFileName);
            }

            return za.getInputFrom(fileName);
        } catch (IOException ioe) {
            throw new RepositoryException(ioe);
        }
    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.accessors.xml.ZipArchive$ZipArchiveEntry

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.