Package com.volantis.mcs.accessors.xml.jibx

Examples of com.volantis.mcs.accessors.xml.jibx.JiBXReader


            bytes = docString.getBytes("UTF-8");
        } catch (UnsupportedEncodingException e) {
            EclipseCommonPlugin.handleError(ABPlugin.getDefault(), e);
        }
        final ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
        final JiBXReader reader;
        try {
            reader = new JiBXReader(Class.forName(
                "com.volantis.mcs.policies.impl.variants.layout.LayoutContentBuilderImpl"));
        } catch (ClassNotFoundException e) {
            throw new ExtendedIOException(e);
        }
        final BinaryContentInput content = new BinaryContentInput(inputStream);
        ContentBuilder contentBuilder = null;
        try {
            contentBuilder =
                (ContentBuilder) reader.read(content, file.getName());
        } catch (ArrayIndexOutOfBoundsException e) {
            // HACK : This can happen if we are in the process of removing
            // a grid column. First the grid column count is updated then
            // the columns are removed. But a change event and layout
            // validation is triggered when the column count is altered. As
View Full Code Here


                    InternalPolicyFactory.getInternalInstance();

            // Don't use schema validation, as we may have a partial layout,
            // with missing attributes and empty formats.
            // todo: re-enable validation by avoiding this overload once we have sorted out validation.
            JiBXReader reader =
                    policyFactory.createDangerousNonValidatingPolicyReader();

            String name = getPolicyName(policyResource);

            PolicyBuilder model =
                    (PolicyBuilder) reader.read(content, file.getName());
            model.setName(name);
            return model;
        } catch (CoreException ce) {
            throw new PolicyFileAccessException(ce);
        } catch (IOException e) {
View Full Code Here

            // Don't use schema validation, as we may have a partial layout,
            // with missing attributes and empty formats.
            // todo: re-enable validation by avoiding this overload once we have
            // sorted out validation.
            final JiBXReader reader =
                policyFactory.createDangerousNonValidatingPolicyReader();

            return (PolicyBuilder) reader.read(content, file.getName());
        } catch (CoreException e) {
            throw new PolicyFileAccessException(e);
        } catch (IOException e) {
            throw new PolicyFileAccessException(e);
        } finally {
View Full Code Here

            try {
                ByteArrayInputStream in = new ByteArrayInputStream(buffer);
                ObjectInputStream ois = new ObjectInputStream(in);
                Integer bufferCount = (Integer) ois.readObject();
                Object[] tempRead = new Object[bufferCount.intValue()];
                JiBXReader reader = getJiBXReader();
                for (int i = 0; i < bufferCount.intValue(); i++) {
                    byte[] variantBuffer = (byte[]) ois.readObject();
                    tempRead[i] = byteArrayToObject(reader, variantBuffer);
                }
                readArray = tempRead;
View Full Code Here

        writer.write(out, object);
        return baos.toByteArray();
    }

    protected JiBXReader getJiBXReader() {
        return new JiBXReader(ThemeFactory.getDefaultInstance().getRuleClass());
    }
View Full Code Here

                DeviceRepositoryConstants.IDENTIFICATION_XML);
            Object object = null;
            if (stream != null) {
                final BinaryContentInput content =
                    new BinaryContentInput(stream);
                final JiBXReader jibxReader =
                    new JiBXReader(Identification.class, null);
                object = jibxReader.read(content,
                    DeviceRepositoryConstants.IDENTIFICATION_XML);
            }
            return (Identification) object;
        } catch (IOException e) {
            throw new RepositoryException(EXCEPTION_LOCALIZER.format(
View Full Code Here

    }

    private final JiBXReader jibxReader;

    public ProjectConfigurationReader() {
        this.jibxReader = new JiBXReader(RuntimeProjectConfiguration.class,
                schemaValidator);
    }
View Full Code Here

        try {
            InternalPolicyFactory factory =
                    InternalPolicyFactory.getInternalInstance();
            // todo: re-enable validation by avoiding this overload once we have
            // sorted out validation.
            JiBXReader reader = factory.createDangerousNonValidatingPolicyReader();
            if (resource instanceof IFile && resource.exists()) {
                IFile file = (IFile) resource;
                is = file.getContents();
                BinaryContentInput content = new BinaryContentInput(is);
                Object theme = reader.read(content, file.getName());

                InteractionFactory interactionFactory =
                        InteractionFactory.getDefaultInstance();
                InteractionModel interactionModel = interactionFactory
                        .createInteractionModel(PolicyModel.MODEL_DESCRIPTOR);
View Full Code Here

        StringContentInput content = new StringContentInput(xml);

        InternalPolicyFactory factory =
                InternalPolicyFactory.getInternalInstance();

        JiBXReader jibxReader = factory.createPolicyReader();

        Object object = jibxReader.read(content, url);
        return object;
    }
View Full Code Here

            ZipArchive archive = getZipArchive();
            InputStream stream = archive.getInputFrom(filename);
            Object object = null;
            if (stream != null) {
                BinaryContentInput content = new BinaryContentInput(stream);
                JiBXReader jibxReader = new JiBXReader(expectedClass,
                        schemaValidation ? deviceSchemaValidator : null);
                object = jibxReader.read(content, filename);
            }
            return object;
        } catch (IOException e) {
            throw new RepositoryException(EXCEPTION_LOCALIZER.format(
                    "cannot-read-object", new Object[]{
View Full Code Here

TOP

Related Classes of com.volantis.mcs.accessors.xml.jibx.JiBXReader

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.