Package org.apache.camel.dataformat.bindy

Examples of org.apache.camel.dataformat.bindy.BindyKeyValuePairFactory


            outputStream.write(crlf);
        }
    }

    public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
        BindyKeyValuePairFactory factory = (BindyKeyValuePairFactory)getFactory(exchange.getContext().getPackageScanClassResolver());

        // List of Pojos
        List<Map<String, Object>> models = new ArrayList<Map<String, Object>>();

        // Pojos of the model
        Map<String, Object> model;
       
        // Map to hold the model @OneToMany classes while binding
        Map<String, List<Object>> lists = new HashMap<String, List<Object>>();

        InputStreamReader in = new InputStreamReader(inputStream, IOHelper.getCharsetName(exchange));

        // Scanner is used to read big file
        Scanner scanner = new Scanner(in);

        // Retrieve the pair separator defined to split the record
        ObjectHelper.notNull(factory.getPairSeparator(), "The pair separator property of the annotation @Message");
        String separator = factory.getPairSeparator();

        int count = 0;
        try {
            while (scanner.hasNextLine()) {
                // Read the line
                String line = scanner.nextLine().trim();

                if (ObjectHelper.isEmpty(line)) {
                    // skip if line is empty
                    continue;
                }

                // Increment counter
                count++;

                // Create POJO
                model = factory.factory();

                // Split the message according to the pair separator defined in
                // annotated class @Message
                List<String> result = Arrays.asList(line.split(separator));

                if (result.size() == 0 || result.isEmpty()) {
                    throw new java.lang.IllegalArgumentException("No records have been defined in the KVP");
                }

                if (result.size() > 0) {
                    // Bind data from message with model classes
                    // Counter is used to detect line where error occurs
                    factory.bind(result, model, count, lists);

                    // Link objects together
                    factory.link(model);

                    // Add objects graph to the list
                    models.add(model);

                    LOG.debug("Graph of objects created: {}", model);
View Full Code Here


            IOHelper.close(in, "in", LOG);
        }
    }

    protected BindyAbstractFactory createModelFactory(PackageScanClassResolver resolver) throws Exception {
        return new BindyKeyValuePairFactory(resolver, getPackages());
    }
View Full Code Here

            outputStream.write(crlf);
        }
    }

    public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
        BindyKeyValuePairFactory factory = (BindyKeyValuePairFactory)getFactory(exchange.getContext().getPackageScanClassResolver());

        // List of Pojos
        List<Map<String, Object>> models = new ArrayList<Map<String, Object>>();

        // Pojos of the model
        Map<String, Object> model;

        InputStreamReader in = new InputStreamReader(inputStream);

        // Scanner is used to read big file
        Scanner scanner = new Scanner(in);

        // Retrieve the pair separator defined to split the record
        ObjectHelper.notNull(factory.getPairSeparator(), "The pair separator property of the annotation @Message");
        String separator = factory.getPairSeparator();

        int count = 0;
        try {
            while (scanner.hasNextLine()) {
                // Read the line
                String line = scanner.nextLine().trim();

                if (ObjectHelper.isEmpty(line)) {
                    // skip if line is empty
                    continue;
                }

                // Increment counter
                count++;

                // Create POJO
                model = factory.factory();

                // Split the message according to the pair separator defined in
                // annotated class @Message
                List<String> result = Arrays.asList(line.split(separator));

                if (result.size() == 0 || result.isEmpty()) {
                    throw new java.lang.IllegalArgumentException("No records have been defined in the KVP !");
                }

                if (result.size() > 0) {

                    // Bind data from message with model classes
                    // Counter is used to detect line where error occurs
                    factory.bind(result, model, count);

                    // Link objects together
                    factory.link(model);

                    // Add objects graph to the list
                    models.add(model);

                    if (LOG.isDebugEnabled()) {
View Full Code Here

            IOHelper.close(in, "in", LOG);
        }
    }

    protected BindyAbstractFactory createModelFactory(PackageScanClassResolver resolver) throws Exception {
        return new BindyKeyValuePairFactory(resolver, getPackages());
    }
View Full Code Here

            outputStream.write(crlf);
        }
    }

    public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
        BindyKeyValuePairFactory factory = (BindyKeyValuePairFactory)getFactory(exchange.getContext().getPackageScanClassResolver());

        // List of Pojos
        List<Map<String, Object>> models = new ArrayList<Map<String, Object>>();

        // Pojos of the model
        Map<String, Object> model;
       
        // Map to hold the model @OneToMany classes while binding
        Map<String, List<Object>> lists = new HashMap<String, List<Object>>();

        InputStreamReader in = new InputStreamReader(inputStream);

        // Scanner is used to read big file
        Scanner scanner = new Scanner(in);

        // Retrieve the pair separator defined to split the record
        ObjectHelper.notNull(factory.getPairSeparator(), "The pair separator property of the annotation @Message");
        String separator = factory.getPairSeparator();

        int count = 0;
        try {
            while (scanner.hasNextLine()) {
                // Read the line
                String line = scanner.nextLine().trim();

                if (ObjectHelper.isEmpty(line)) {
                    // skip if line is empty
                    continue;
                }

                // Increment counter
                count++;

                // Create POJO
                model = factory.factory();

                // Split the message according to the pair separator defined in
                // annotated class @Message
                List<String> result = Arrays.asList(line.split(separator));

                if (result.size() == 0 || result.isEmpty()) {
                    throw new java.lang.IllegalArgumentException("No records have been defined in the KVP");
                }

                if (result.size() > 0) {
                    // Bind data from message with model classes
                    // Counter is used to detect line where error occurs
                    factory.bind(result, model, count, lists);

                    // Link objects together
                    factory.link(model);

                    // Add objects graph to the list
                    models.add(model);

                    LOG.debug("Graph of objects created: {}", model);
View Full Code Here

            IOHelper.close(in, "in", LOG);
        }
    }

    protected BindyAbstractFactory createModelFactory(PackageScanClassResolver resolver) throws Exception {
        return new BindyKeyValuePairFactory(resolver, getPackages());
    }
View Full Code Here

            outputStream.write(crlf);
        }
    }

    public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
        BindyKeyValuePairFactory factory = (BindyKeyValuePairFactory)getFactory(exchange.getContext().getPackageScanClassResolver());

        // List of Pojos
        List<Map<String, Object>> models = new ArrayList<Map<String, Object>>();

        // Pojos of the model
        Map<String, Object> model;
       
        // Map to hold the model @OneToMany classes while binding
        Map<String, List<Object>> lists = new HashMap<String, List<Object>>();

        InputStreamReader in = new InputStreamReader(inputStream, IOHelper.getCharsetName(exchange));

        // Scanner is used to read big file
        Scanner scanner = new Scanner(in);

        // Retrieve the pair separator defined to split the record
        ObjectHelper.notNull(factory.getPairSeparator(), "The pair separator property of the annotation @Message");
        String separator = factory.getPairSeparator();

        int count = 0;
        try {
            while (scanner.hasNextLine()) {
                // Read the line
                String line = scanner.nextLine().trim();

                if (ObjectHelper.isEmpty(line)) {
                    // skip if line is empty
                    continue;
                }

                // Increment counter
                count++;

                // Create POJO
                model = factory.factory();

                // Split the message according to the pair separator defined in
                // annotated class @Message
                List<String> result = Arrays.asList(line.split(separator));

                if (result.size() == 0 || result.isEmpty()) {
                    throw new java.lang.IllegalArgumentException("No records have been defined in the KVP");
                }

                if (result.size() > 0) {
                    // Bind data from message with model classes
                    // Counter is used to detect line where error occurs
                    factory.bind(result, model, count, lists);

                    // Link objects together
                    factory.link(model);

                    // Add objects graph to the list
                    models.add(model);

                    LOG.debug("Graph of objects created: {}", model);
View Full Code Here

            IOHelper.close(in, "in", LOG);
        }
    }

    protected BindyAbstractFactory createModelFactory(PackageScanClassResolver resolver) throws Exception {
        return new BindyKeyValuePairFactory(resolver, getPackages());
    }
View Full Code Here

            outputStream.write(crlf);
        }
    }

    public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
        BindyKeyValuePairFactory factory = (BindyKeyValuePairFactory)getFactory(exchange.getContext().getPackageScanClassResolver());

        // List of Pojos
        List<Map<String, Object>> models = new ArrayList<Map<String, Object>>();

        // Pojos of the model
        Map<String, Object> model;

        InputStreamReader in = new InputStreamReader(inputStream);

        // Scanner is used to read big file
        Scanner scanner = new Scanner(in);

        // Retrieve the pair separator defined to split the record
        ObjectHelper.notNull(factory.getPairSeparator(), "The pair separator property of the annotation @Message");
        String separator = factory.getPairSeparator();

        int count = 0;
        try {
            while (scanner.hasNextLine()) {
                // Read the line
                String line = scanner.nextLine().trim();

                if (ObjectHelper.isEmpty(line)) {
                    // skip if line is empty
                    continue;
                }

                // Increment counter
                count++;

                // Create POJO
                model = factory.factory();

                // Split the message according to the pair separator defined in
                // annotated class @Message
                List<String> result = Arrays.asList(line.split(separator));

                if (result.size() == 0 || result.isEmpty()) {
                    throw new java.lang.IllegalArgumentException("No records have been defined in the KVP !");
                }

                if (result.size() > 0) {
                    // Bind data from message with model classes
                    // Counter is used to detect line where error occurs
                    factory.bind(result, model, count);

                    // Link objects together
                    factory.link(model);

                    // Add objects graph to the list
                    models.add(model);

                    LOG.debug("Graph of objects created : {}", model);
View Full Code Here

            IOHelper.close(in, "in", LOG);
        }
    }

    protected BindyAbstractFactory createModelFactory(PackageScanClassResolver resolver) throws Exception {
        return new BindyKeyValuePairFactory(resolver, getPackages());
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.dataformat.bindy.BindyKeyValuePairFactory

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.