Examples of ObjectMapper


Examples of org.codehaus.jackson.map.ObjectMapper

            response.sendError(HttpServletResponse.SC_NOT_FOUND, "Preferences provider is not configured");
            return;
        }
        String userName = getAuthenticatedUserName(request);

        ObjectMapper mapper = new ObjectMapper();

        @SuppressWarnings("unchecked")
        Map<String, Object> newPreferences = mapper.readValue(request.getInputStream(), LinkedHashMap.class);

        preferencesProvider.deletePreferences(userName);
        Map<String, Object> preferences = preferencesProvider.setPreferences(userName, newPreferences);
        if (preferences == null)
        {
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper

            response.sendError(HttpServletResponse.SC_NOT_FOUND, "Preferences provider is not configured");
            return;
        }
        String userName = getAuthenticatedUserName(request);

        ObjectMapper mapper = new ObjectMapper();

        @SuppressWarnings("unchecked")
        Map<String, Object> newPreferences = mapper.readValue(request.getInputStream(), LinkedHashMap.class);
        Map<String, Object> preferences = preferencesProvider.setPreferences(userName, newPreferences);
        if (preferences == null)
        {
            preferences = Collections.<String, Object>emptyMap();
        }
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper

            output.add(_objectConverter.convertObjectToMap(configuredObject, getConfiguredClass(),
                    depth));
        }

        final Writer writer = new BufferedWriter(response.getWriter());
        ObjectMapper mapper = new ObjectMapper();
        mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
        mapper.writeValue(writer, output);

        response.setContentType("application/json");
        response.setStatus(HttpServletResponse.SC_OK);
    }
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper

    @Override
    protected void doPutWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {
        response.setContentType("application/json");

        ObjectMapper mapper = new ObjectMapper();
        @SuppressWarnings("unchecked")
        Map<String,Object> providedObject = mapper.readValue(request.getInputStream(), LinkedHashMap.class);


        List<String> names = new ArrayList<String>();
        String[] pathInfoElements = getPathInfoElements(request);
        if(pathInfoElements != null )
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper

    private Map<String, Action> _actions;
    private ObjectMapper _mapper;

    public HelperServlet()
    {
        _mapper = new ObjectMapper();
        _mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);

        Action[] supportedActions = {
                new ListAuthenticationProviderAttributes(),
                new ListBrokerAttribute(Broker.SUPPORTED_VIRTUALHOST_STORE_TYPES, "ListMessageStoreTypes"),
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper

                                        insertStmt.setNull(3, Types.BLOB);
                                    }
                                    else
                                    {
                                        final Map<String, Object> attributes = configuredObject.getAttributes();
                                        byte[] attributesAsBytes = new ObjectMapper().writeValueAsBytes(attributes);
                                        ByteArrayInputStream bis = new ByteArrayInputStream(attributesAsBytes);
                                        insertStmt.setBinaryStream(3, bis, attributesAsBytes.length);
                                    }
                                    insertStmt.execute();
                                }
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper

                        try
                        {
                            stmt2.setString(1, configuredObject.getType());
                            if (configuredObject.getAttributes() != null)
                            {
                                byte[] attributesAsBytes = (new ObjectMapper()).writeValueAsBytes(
                                        configuredObject.getAttributes());
                                ByteArrayInputStream bis = new ByteArrayInputStream(attributesAsBytes);
                                stmt2.setBinaryStream(2, bis, attributesAsBytes.length);
                            }
                            else
                            {
                                stmt2.setNull(2, Types.BLOB);
                            }
                            stmt2.setString(3, configuredObject.getId().toString());
                            stmt2.execute();
                        }
                        finally
                        {
                            stmt2.close();
                        }
                    }
                    else if(createIfNecessary)
                    {
                        PreparedStatement insertStmt = conn.prepareStatement(INSERT_INTO_CONFIGURED_OBJECTS);
                        try
                        {
                            insertStmt.setString(1, configuredObject.getId().toString());
                            insertStmt.setString(2, configuredObject.getType());
                            if(configuredObject.getAttributes() == null)
                            {
                                insertStmt.setNull(3, Types.BLOB);
                            }
                            else
                            {
                                final Map<String, Object> attributes = configuredObject.getAttributes();
                                byte[] attributesAsBytes = new ObjectMapper().writeValueAsBytes(attributes);
                                ByteArrayInputStream bis = new ByteArrayInputStream(attributesAsBytes);
                                insertStmt.setBinaryStream(3, bis, attributesAsBytes.length);
                            }
                            insertStmt.execute();
                        }
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper

                        if (rs.next())
                        {
                            String type = rs.getString(1);
                            String attributes = getBlobAsString(rs, 2);
                            result = new ConfiguredObjectRecord(id, type,
                                    (new ObjectMapper()).readValue(attributes,Map.class));
                        }
                    }
                    finally
                    {
                        rs.close();
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper

    private void loadConfiguredObjects(ConfigurationRecoveryHandler recoveryHandler) throws SQLException, AMQStoreException
    {
        Connection conn = newAutoCommitConnection();

        final ObjectMapper objectMapper = new ObjectMapper();
        try
        {
            PreparedStatement stmt = conn.prepareStatement(SELECT_FROM_CONFIGURED_OBJECTS);
            try
            {
                ResultSet rs = stmt.executeQuery();
                try
                {
                    while (rs.next())
                    {
                        String id = rs.getString(1);
                        String objectType = rs.getString(2);
                        String attributes = getBlobAsString(rs, 3);
                        recoveryHandler.configuredObject(UUID.fromString(id), objectType,
                                objectMapper.readValue(attributes,Map.class));
                    }
                }
                catch (JsonMappingException e)
                {
                    throw new AMQStoreException("Error recovering persistent state: " + e.getMessage(), e);
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper

        outputObject.put("mechanisms", (Object) mechanisms);

        final PrintWriter writer = response.getWriter();

        ObjectMapper mapper = new ObjectMapper();
        mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
        mapper.writeValue(writer, outputObject);

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.