Package org.wso2.carbon.registry.core.config

Examples of org.wso2.carbon.registry.core.config.RegistryContext


    }

    public void start() throws Exception {

        RealmService realmService = new InMemoryRealmService();
        RegistryContext regContext = RegistryContext.getBaseInstance(realmService);
        regContext.selectDBConfig("in-memory");
        //RegistryContext.setSingleton(regContext);

        server = new Server(port);
        Context context = new Context(server, null/*RegistryProvider.baseURI*/, Context.SESSIONS);
        ServletHolder servletHolder = new ServletHolder(new AbderaServlet());
View Full Code Here


            throws RegistryException {
        boolean evaluateExports = true;

        String resourcePath = context.getResourcePath().getPath();
        resourceName = resourcePath.substring(resourcePath.lastIndexOf(RegistryConstants.PATH_SEPARATOR) + 1);
        RegistryContext registryContext = context.getRegistryContext();
        // 3rd parameter is false, for importing WSDLs.
        evaluateWSDLsToDefinitions(wsdlURL, context, evaluateExports, false, isPut, skipValidation);
        String wsdlPath = "";
        for (WSDLInfo wsdlInfo : wsdls.values()) {
            Definition wsdlDefinition = wsdlInfo.getWSDLDefinition();
View Full Code Here

        if (!ACTION.equals(action)) {
            throw new RegistryException("Unsupported lifecycle action '" + action +
                                        "'.  Only valid action is '" + ACTION + "'");
        }

        RegistryContext registryContext = context.getRegistry().getRegistryContext();
        Repository repository = registryContext.getRepository();

        Resource resource = context.getResource();
        String originalPath = resource.getProperty(ORIGINAL_PATH);
        if (originalPath == null ) {
            resource.setProperty(ORIGINAL_PATH , resource.getPath());
View Full Code Here

        return userDefinedValue || defaultValue;
    }

    @Override
    public RegistryContext getRegistryContext(RequestContext requestContext) {
        RegistryContext defaultValue = handlerManagers.get(
                DEFAULT_SYSTEM_HANDLER_PHASE).getRegistryContext(requestContext);
        boolean isProcessingComplete = requestContext.isProcessingComplete();
        if (!isProcessingComplete) {
            RegistryContext tenantSpecificValue = handlerManagers.get(
                    TENANT_SPECIFIC_SYSTEM_HANDLER_PHASE).getRegistryContext(requestContext);
            if (tenantSpecificValue != null) {
                defaultValue = tenantSpecificValue;
            }
            isProcessingComplete = requestContext.isProcessingComplete();
        }
        requestContext.setProcessingComplete(false);
        RegistryContext userDefinedValue = handlerManagers.get(
                USER_DEFINED_HANDLER_PHASE).getRegistryContext(requestContext);
        isProcessingComplete |= requestContext.isProcessingComplete();
        // The reporting handler phase needs to know about the state of processing
        requestContext.setProcessingComplete(isProcessingComplete);
        handlerManagers.get(DEFAULT_REPORTING_HANDLER_PHASE).getRegistryContext(requestContext);
View Full Code Here

        return sb.toString();
    }

    // Obtains a registry instance to work with, based on the configuration
    private Registry getRegistry(RequestContext requestContext) throws Exception {
        RegistryContext baseContext = RegistryContext.getBaseInstance();
        if (!isHandlerRegistered && baseContext != null) {
            try {              
                Registry systemRegistry = new UserRegistry(CarbonConstants.REGISTRY_SYSTEM_USERNAME,
                        CurrentSession.getTenantId(), requestContext.getRegistry(),
                        baseContext.getRealmService(), baseContext.getRegistryRoot());

                if (subPath != null) {
                    RegistryUtils.addMountEntry(systemRegistry, RegistryContext.getBaseInstance(),
                            mountPoint, id, subPath, author);
                } else {
                    RegistryUtils.addMountEntry(systemRegistry, RegistryContext.getBaseInstance(),
                            mountPoint, id, true, author);
                }
                isHandlerRegistered = true;
            } catch (RegistryException e) {
                log.error("Unable to add mount entry into Registry", e);
            }
        }
        if (remote) {
            if (registryProvider == null && registryType != null) {
                BundleContext bundleContext = RegistryCoreServiceComponent.getBundleContext();
                if (bundleContext != null) {
                    ServiceTracker tracker =
                            new ServiceTracker(bundleContext, RegistryProvider.class.getName(),
                                    null);
                    tracker.open();
                    ServiceReference[] references = tracker.getServiceReferences();
                    if (references != null) {
                        for (ServiceReference reference : references) {
                            if (registryType.equals(reference.getProperty("type"))) {
                                registryProvider = (RegistryProvider) tracker.getService(reference);
                                break;
                            }
                        }
                    }
                    tracker.close();
                }
            }

            if (registryProvider != null) {
                return registryProvider.getRegistry(this.conURL, this.userName, this.password);
            }

            RegistryUtils.setTrustStoreSystemProperties();
            return new RemoteRegistry(this.conURL, this.userName, this.password);
        }
        if (registryService == null) {
            RegistryContext context = RegistryContext.getCloneContext();
            context.setRegistryRoot(registryRoot);
            context.setReadOnly(readOnly);
            context.setCacheEnabled(cacheEnabled);
            context.selectDBConfig(dbConfig);
            registryService = context.getEmbeddedRegistryService();
        }
        return registryService.getUserRegistry(CurrentSession.getUser(),
                CurrentSession.getCallerTenantId());
    }
View Full Code Here

        if (isInExecution()) {
            return super.getRegistryContext(requestContext);
        } else {
            setInExecution(true);
        }
        RegistryContext registryContext;
        Registry remoteRegistry;
        try {
            remoteRegistry = getRegistry(requestContext);
            beginNestedOperation(new HashMap<String, String>());
            try {
View Full Code Here

            return;
        } else {
            setInExecution(true);
        }
        String fullPath = requestContext.getResourcePath().getPath();
        RegistryContext registryContext = requestContext.getRegistryContext();
        if (fullPath.equals(this.mountPoint)) {
            requestContext.getRegistry().removeLink(requestContext.getResource().getPath());
            if (registryContext != null) {
                HandlerManager hm = registryContext.getHandlerManager();
                hm.removeHandler(this,
                        HandlerLifecycleManager.TENANT_SPECIFIC_SYSTEM_HANDLER_PHASE);
            }
        } else {
            String actualPath = fullPath.substring(this.mountPoint.length(), fullPath.length());
View Full Code Here

        } else {
            setInExecution(true);
        }
        String fullResourcePath = requestContext.getSourcePath();
        String fullTargetPath = requestContext.getTargetPath();
        RegistryContext registryContext = requestContext.getRegistryContext();

        String newPath;
        if (fullResourcePath.equals(this.mountPoint)) {
            newPath = requestContext.getRepository()
                    .rename(new ResourcePath(fullResourcePath), fullTargetPath);
            requestContext.getRegistry().createLink(fullTargetPath, this.id);
            requestContext.getRegistry().removeLink(this.mountPoint);
            if (registryContext != null) {
                HandlerManager hm = registryContext.getHandlerManager();
                hm.removeHandler(this,
                        HandlerLifecycleManager.TENANT_SPECIFIC_SYSTEM_HANDLER_PHASE);
            }
        } else {
            String actualResourcePath = fullResourcePath.substring(
View Full Code Here

        } else {
            setInExecution(true);
        }
        String fullResourcePath = requestContext.getSourcePath();
        String fullTargetPath = requestContext.getTargetPath();
        RegistryContext registryContext = requestContext.getRegistryContext();

        try {
            if (fullResourcePath.equals(this.mountPoint)) {
                requestContext.getRepository()
                        .move(new ResourcePath(fullResourcePath), fullTargetPath);
                requestContext.getRegistry().createLink(fullTargetPath, this.id);
                requestContext.getRegistry().removeLink(this.mountPoint);
                if (registryContext != null) {
                    HandlerManager hm = registryContext.getHandlerManager();
                    hm.removeHandler(this,
                            HandlerLifecycleManager.TENANT_SPECIFIC_SYSTEM_HANDLER_PHASE);
                }
            } else if (fullResourcePath.startsWith(this.mountPoint)) {
                String actualResourcePath = fullResourcePath.substring(
View Full Code Here

            chroot = "/";
        } else if (!chroot.endsWith("/")) {
            chroot += "/";
        }
        context.setResourcePath(new ResourcePath(chroot));
        RegistryContext output =
                registryContext.getHandlerManager().getRegistryContext(context);
        endDBQueryLog(2);
        if (output != null) {
            return output;
        }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.registry.core.config.RegistryContext

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.