Package org.wso2.carbon.registry.core.service

Examples of org.wso2.carbon.registry.core.service.RegistryService


        }
        return username;
    }

    public static UserRegistry getUserRegistry() throws RegistryException {
        RegistryService registryService =
                MessageBoxServiceValueHolder.getInstance().getRegistryService();

        return registryService.getGovernanceSystemRegistry(CarbonContext.getCurrentContext().getTenantId());

    }
View Full Code Here


    private String rootPath;

    private List<RegistryExtension> extensions = new ArrayList<RegistryExtension>();

    public WSO2Registry() {
        RegistryService registryService = RegistryServiceHolder.getInstance().getRegistryService();
        try {
            configRegistry = registryService.getConfigSystemRegistry(
                    CarbonContext.getCurrentContext().getTenantId());
            governanceRegistry = registryService.getGovernanceSystemRegistry(
                    CarbonContext.getCurrentContext().getTenantId());
            localRegistry = registryService.getLocalRepository();
        } catch (RegistryException e) {
            handleException("Error while initializing the mediation registry adapter", e);
        }
    }
View Full Code Here

        boolean isAuthenticated = isOAuthConsumerValid(oauthConsumer);

        if (isAuthenticated) {
            String tenantDomain = UserCoreUtil.getTenantDomain(OAuthServiceComponent
                    .getRealmService(), oauthConsumer.getOauthConsumerKey());
            RegistryService registryService = OAuthServiceComponent.getRegistryService();
            String username = UserCoreUtil.getTenantLessUsername(oauthConsumer
                    .getOauthConsumerKey());
            RealmService realmService = OAuthServiceComponent.getRealmService();
            int tenantId = realmService.getTenantManager().getTenantId(tenantDomain);
            UserRealm realm = registryService.getUserRealm(tenantId);
            int userId = realm.getUserStoreManager().getUserId(username);

            String baseString = "TenantId:=" + tenantId + "&UserId:=" + userId;
            Registry registry = registryService.getConfigSystemRegistry(tenantId);

            String path = RegistryConstants.PROFILES_PATH + username;
            Collection profile = null;
            if (!registry.resourceExists(path)) {
                return false;
View Full Code Here

                .getServerConfigurationInformation().getSynapseXMLLocation());
        return synapseConfig;
    }

    private UserRegistry getRegistry() {
        RegistryService registrySvc = ServiceBusInitializer.getRegistryService();
        if (registrySvc == null) {
            log.warn("Unable to access the registry service");
            return null;
        }

        try {
            return registrySvc.getConfigSystemRegistry();
        } catch (RegistryException e) {
            log.error("Error while obtaining a system registry instance", e);
            return null;
        }
    }
View Full Code Here

    public static String getRelativeUrl() {
        BundleContext context = CarbonUIUtil.getBundleContext();
        ServiceReference reference =
                context.getServiceReference(RegistryService.class.getName());
        RegistryService registryService = (RegistryService) context.getService(reference);
        String url = null;
        try {
            Registry systemRegistry = registryService.getConfigSystemRegistry();
            Resource resource = systemRegistry.get(RegistryResources.CONNECTION_PROPS);
            String servicePath = resource.getProperty("service-path");
            String contextRoot = resource.getProperty("context-root");
            contextRoot = contextRoot.equals("/") ? "" : contextRoot;
            url = contextRoot + servicePath + "/WSDL2CodeService";
View Full Code Here

    return resourceKey;

  }

  private UserRegistry getRegistry() {
    RegistryService registrySvc = ServiceBusInitializer.getRegistryService();
    if (registrySvc == null) {
      log.warn("Unable to access the registry service");
      return null;
    }

    try {
      return registrySvc.getRegistry();
    } catch (RegistryException e) {
      log.error("Error while obtaining a system registry instance", e);
      return null;
    }
  }
View Full Code Here

    public static String getRelativeUrl() {
        BundleContext context = CarbonUIUtil.getBundleContext();
        ServiceReference reference =
                context.getServiceReference(RegistryService.class.getName());
        RegistryService registryService = (RegistryService) context.getService(reference);
        String url = null;
        try {
            Registry systemRegistry = registryService.getConfigSystemRegistry();
            Resource resource = systemRegistry.get(RegistryResources.CONNECTION_PROPS);
            String servicePath = resource.getProperty("service-path");
            String contextRoot = resource.getProperty("context-root");
            contextRoot = contextRoot.equals("/") ? "" : contextRoot;
            url = contextRoot + servicePath + "/WSDL2CodeService";
View Full Code Here

        Enumeration enumeration = bundleContext.getBundle().getEntryPaths(reportResource);
        if (enumeration == null) {
            return;
        }
        try {
            RegistryService registryService = ReportingComponent.getRegistryService();
            Registry registry = registryService.getConfigSystemRegistry();
            registry.beginTransaction();
            Resource reportFilesResource = registry.newResource();
            InputStream xmlStream = null;
            try{
            while (enumeration.hasMoreElements()) {
View Full Code Here

        HttpSession httpSession = request.getSession(false);
        String userName = DBUtils.getUsername(msgContext);
       
        RealmService realmService = DataServicesDSComponent.getRealmService();
        RegistryService registryService = DataServicesDSComponent.getRegistryService();

        /* if session does not exist, return empty array of roles */
        if (httpSession == null) {
          return new String[0];
        }

        /* first return the tenant id from the tenant domain */
        SuperTenantCarbonContext carbonContext = SuperTenantCarbonContext.getCurrentContext(httpSession);
    String tenantDomain = carbonContext.getTenantDomain();
        int tenantId = carbonContext.getTenantId();
        if (tenantId < 0) {
            tenantId = realmService.getTenantManager().getTenantId(tenantDomain);
        }
        if (tenantId < 0) {
            /* the tenant doesn't exist. */
            log.error("The tenant doesn't exist. Tenant domain:" + tenantDomain);
            throw new DataServiceFault("Access Denied. You are not authorized.");
        }
        if (!realmService.getTenantManager().isTenantActive(tenantId)) {
            /* the tenant is not active. */
            log.error("The tenant is not active. Tenant domain:" + tenantDomain);
            throw new DataServiceFault("The tenant is not active. Tenant domain:" + tenantDomain);
        }
        UserRealm realm;
        String roles[];
        try {
            realm = registryService.getUserRealm(tenantId);
            roles = realm.getUserStoreManager().getRoleListOfUser(userName);
        } catch (Exception e) {
            String msg = "Error in retrieving the realm for the tenant id: " + tenantId
                    + ", username: " + userName + ". " + e.getMessage();
            log.error(msg);
View Full Code Here

      /* This is a url file path */
      URL url = new URL(path);
      ins = url.openStream();
    } else if (isRegistryPath(path)) {
      try {
        RegistryService registryService = DataServicesDSComponent.getRegistryService();
        if (registryService == null) {
          throw new DataServiceFault("DBUtils.getInputStreamFromPath(): Registry service is not available");
        }
        Registry registry;
        if (path.startsWith(DBConstants.CONF_REGISTRY_PATH_PREFIX)) {
          if (path.length() > DBConstants.CONF_REGISTRY_PATH_PREFIX.length()) {
            path = path.substring(DBConstants.CONF_REGISTRY_PATH_PREFIX.length());
            registry = registryService.getConfigSystemRegistry(getCurrentTenantId());
          } else {
            throw new DataServiceFault("Empty configuration registry path given");
          }
        } else {
          if (path.length() > DBConstants.GOV_REGISTRY_PATH_PREFIX.length()) {
            path = path.substring(DBConstants.GOV_REGISTRY_PATH_PREFIX.length());
            registry = registryService.getGovernanceSystemRegistry(getCurrentTenantId());
          } else {
            throw new DataServiceFault("Empty governance registry path given");
          }
        }
        if (registry.resourceExists(path)) {
View Full Code Here

TOP

Related Classes of org.wso2.carbon.registry.core.service.RegistryService

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.