Package org.apache.qpid.server.model

Examples of org.apache.qpid.server.model.PreferencesProvider


                AuthenticationProvider authenticationProvider = _recoverer.create(recovererProvider, authenticationProviderEntry,
                        _broker);
                assertNotNull("Authentication provider was not recovered", authenticationProvider);
                assertEquals("Unexpected name", "test-authenticator", authenticationProvider.getName());
                assertEquals("Unexpected id", authenticationId, authenticationProvider.getId());
                PreferencesProvider preferencesProvider = authenticationProvider.getPreferencesProvider();
                assertNotNull("Preferences provider was not recovered", preferencesProvider);
                assertEquals("Unexpected path", file.getAbsolutePath(),
                        preferencesProvider.getAttribute(FileSystemPreferencesProvider.PATH));
            }
            finally
            {
                file.delete();
            }
View Full Code Here


            }

            @Override
            public Map<String, Object> setPreferences(Map<String, Object> preferences)
            {
                PreferencesProvider preferencesProvider = getPreferencesProvider();
                if (preferencesProvider == null)
                {
                    return null;
                }
                return preferencesProvider.setPreferences(this.getName(), preferences);
            }
View Full Code Here

            }

            @Override
            public boolean deletePreferences()
            {
                PreferencesProvider preferencesProvider = getPreferencesProvider();
                if (preferencesProvider == null)
                {
                    return false;
                }
                String[] deleted = preferencesProvider.deletePreferences(this.getName());
                return deleted.length == 1;
            }
View Full Code Here

        {
            String name = MapValueConverter.getStringAttribute(PreferencesProvider.NAME, attributes);
            String type = MapValueConverter.getStringAttribute(PreferencesProvider.TYPE, attributes);
            PreferencesProviderFactory factory = PreferencesProviderFactory.FACTORIES.get(type);
            UUID id = UUIDGenerator.generatePreferencesProviderUUID(name, getName());
            PreferencesProvider pp = factory.createInstance(id, attributes, this);
            pp.setDesiredState(State.INITIALISING, State.ACTIVE);
            _preferencesProvider = pp;
            return (C)pp;
        }
        throw new IllegalArgumentException("Cannot create child of class " + childClass.getSimpleName());
    }
View Full Code Here

                {
                    try
                    {
                        String userName = _user.getName();
                        deleteUser(userName);
                        PreferencesProvider preferencesProvider = getPreferencesProvider();
                        if (preferencesProvider != null)
                        {
                            preferencesProvider.deletePreferences(userName);
                        }
                    }
                    catch (AccountNotFoundException e)
                    {
                        LOGGER.warn("Failed to delete user " + _user, e);
View Full Code Here

            }

            @Override
            public Map<String, Object> getPreferences()
            {
                PreferencesProvider preferencesProvider = getPreferencesProvider();
                if (preferencesProvider == null)
                {
                    return null;
                }
                return preferencesProvider.getPreferences(this.getName());
            }
View Full Code Here

                AuthenticationProvider authenticationProvider = _recoverer.create(recovererProvider, authenticationProviderEntry,
                        _broker);
                assertNotNull("Authentication provider was not recovered", authenticationProvider);
                assertEquals("Unexpected name", "test-authenticator", authenticationProvider.getName());
                assertEquals("Unexpected id", authenticationId, authenticationProvider.getId());
                PreferencesProvider preferencesProvider = authenticationProvider.getPreferencesProvider();
                assertNotNull("Preferences provider was not recovered", preferencesProvider);
                assertEquals("Unexpected path", file.getAbsolutePath(),
                        preferencesProvider.getAttribute(FileSystemPreferencesProvider.PATH));
            }
            finally
            {
                file.delete();
            }
View Full Code Here

    @Override
    protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws IOException,
            ServletException
    {
        PreferencesProvider preferencesProvider = getPreferencesProvider(request);
        if (preferencesProvider == null)
        {
            response.sendError(HttpServletResponse.SC_NOT_FOUND, "Preferences provider is not configured");
            return;
        }
        String userName = getAuthenticatedUserName(request);
        Map<String, Object> preferences = preferencesProvider.getPreferences(userName);
        if (preferences == null)
        {
            preferences = Collections.<String, Object>emptyMap();
        }
        sendJsonResponse(preferences, request, response);
View Full Code Here

     */
    @Override
    protected void doPutWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException
    {
        PreferencesProvider preferencesProvider = getPreferencesProvider(request);
        if (preferencesProvider == null)
        {
            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)
        {
            preferences = Collections.<String, Object>emptyMap();
        }
        sendJsonResponse(preferences, request, response);
View Full Code Here

     */
    @Override
    protected void doPostWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException
    {
        PreferencesProvider preferencesProvider = getPreferencesProvider(request);
        if (preferencesProvider == null)
        {
            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();
        }
        sendJsonResponse(preferences, request, response);
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.model.PreferencesProvider

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.