Examples of EmbeddedRegistryService


Examples of org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService

     *                           failed.
     */
    public EmbeddedRegistryService getEmbeddedRegistryService() throws RegistryException {
        if (embeddedRegistryService == null) {
            try {
                embeddedRegistryService = new EmbeddedRegistryService(this);
            } catch (RegistryException e) {
                String msg = "Couldn't initialize EmbeddedRegistryService. " + e.getMessage();
                log.error(msg, e);
                throw new RegistryException(msg, e);
            }
View Full Code Here

Examples of org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService

    //To store the context path
    private String contextRoot = null;

    public void init(final ServletConfig config) throws ServletException {
        super.init(config);
        EmbeddedRegistryService embeddedRegistryService;

        try {
            // read the registry.xml file from the configured location. if not configured, read the
            // default registry.xml file bundled with the webapp.
            String configPath = config.getInitParameter(RegistryConstants.REGISTRY_CONFIG_PATH);
            InputStream configStream;
            if (configPath != null) {
                try {
                    configStream = new FileInputStream(configPath);
                } catch (FileNotFoundException e) {
                    throw new ServletException("Couldn't find specified config file '" +
                            configPath + "'", e);
                }
            } else {
                configStream =
                        config.getServletContext().getResourceAsStream("/WEB-INF/registry.xml");
            }

            RegistryContext registryContext = RegistryContext.getBaseInstance(configStream,
                    new RegistryContext.RegURLSupplier() {
                        public String getURL() {
                            return config.getServletContext().getRealPath("/WEB-INF");
                        }
                    });

            embeddedRegistryService = registryContext.getEmbeddedRegistryService();

            // create a system registry and put it in the context
            UserRegistry systemRegistry = embeddedRegistryService.getConfigSystemRegistry();

            // add configured handers to the jdbc registry
            // note: no need to do this here. this is done inside the registry context
            //Iterator<HandlerConfiguration> handlers =
            //        registryContext.getHandlerConfigurations().iterator();
View Full Code Here

Examples of org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService

            // user is not logged in. create a anonymous userRegistry for the user.

            ServletContext context = request.getSession().getServletContext();

            EmbeddedRegistryService embeddedRegistryService =
                    (EmbeddedRegistryService) context.getAttribute(RegistryConstants.REGISTRY);

            userRegistry = embeddedRegistryService.getRegistry();
            request.getSession()
                    .setAttribute(RegistryConstants.ROOT_REGISTRY_INSTANCE, userRegistry);
        }

        return userRegistry;
View Full Code Here

Examples of org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService

        UserRegistry registry;
        Object o = request.getSession().getAttribute(RegistryConstants.ROOT_REGISTRY_INSTANCE);
        if (o != null) {
            registry = (UserRegistry) o;
        } else {
            EmbeddedRegistryService embeddedRegistryService = (EmbeddedRegistryService) request.
                    getSession().getServletContext().getAttribute(RegistryConstants.REGISTRY);

            registry = embeddedRegistryService.getRegistry();

            request.getSession().setAttribute(RegistryConstants.ROOT_REGISTRY_INSTANCE, registry);
        }
        return registry;
    }
View Full Code Here

Examples of org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService

    public static void logInUser(HttpServletRequest request, String userName, String password)
            throws RegistryException {

        ServletContext context = request.getSession().getServletContext();
        EmbeddedRegistryService embeddedRegistryService =
                (EmbeddedRegistryService) context.getAttribute(RegistryConstants.REGISTRY);

        UserRegistry userRegistry =
                embeddedRegistryService.getConfigUserRegistry(userName, password);

        request.getSession().setAttribute(RegistryConstants.ROOT_REGISTRY_INSTANCE, userRegistry);
    }
View Full Code Here

Examples of org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService

        InputStream configInputStream = new FileInputStream(getConfigFile());
        RegistryContext registryContext =
                RegistryContext.getBaseInstance(configInputStream, realmService);
        registryContext.setSetup(System.getProperty(RegistryConstants.SETUP_PROPERTY) != null);
        return new EmbeddedRegistryService(registryContext);
    }
View Full Code Here

Examples of org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService

    public void setUp() throws RegistryException {
        super.setUp();
        if (registry == null) {
            super.setUp();
            EmbeddedRegistryService embeddedRegistry = ctx.getEmbeddedRegistryService();
            registry = embeddedRegistry.getGovernanceUserRegistry("admin", "admin");
        }
    }
View Full Code Here

Examples of org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService

    public final String LIFECYCLE_NAME = "DefaultLifecycle";

    public void setUp() throws RegistryException {
        super.setUp();
        ctx.addAspect(LIFECYCLE_NAME, new DefaultLifecycle(), 0);
        EmbeddedRegistryService embeddedRegistry = ctx.getEmbeddedRegistryService();
        new RegistryCoreServiceComponent().registerBuiltInHandlers(embeddedRegistry);
        registry = embeddedRegistry.getRegistry("admin", "admin");
    }
View Full Code Here

Examples of org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService

    public void setUp() throws RegistryException {
        super.setUp();
        if (registry == null) {
            super.setUp();
            EmbeddedRegistryService embeddedRegistry = ctx.getEmbeddedRegistryService();
            RegistryCoreServiceComponent component = new RegistryCoreServiceComponent() {
                {
                    setRealmService(ctx.getRealmService());
                }
            };
            component.registerBuiltInHandlers(embeddedRegistry);
            registry = embeddedRegistry.getGovernanceUserRegistry("admin", "admin");
        }
    }
View Full Code Here

Examples of org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService

    public void setUp() throws RegistryException {
        super.setUp();
        if (registry == null) {
            super.setUp();
            EmbeddedRegistryService embeddedRegistry = ctx.getEmbeddedRegistryService();
            RegistryCoreServiceComponent component = new RegistryCoreServiceComponent() {
                {
                    setRealmService(ctx.getRealmService());
                }
            };
            component.registerBuiltInHandlers(embeddedRegistry);
            registry = embeddedRegistry.getGovernanceUserRegistry("admin", "admin");
        }
    }
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.