Tabnine Logo
RegistryException
Code IndexAdd Tabnine to your IDE (free)

How to use
RegistryException
in
org.wso2.carbon.registry.api

Best Java code snippets using org.wso2.carbon.registry.api.RegistryException (Showing top 18 results out of 315)

origin: org.wso2.carbon.registry/org.wso2.carbon.registry.resource

private static void zipDir(String dirToZip, ZipOutputStream zos) throws org.wso2.carbon.registry.api.RegistryException {
  try {
    File zipDir = new File(dirToZip);
    String[] dirList = zipDir.list();
    byte[] readBuffer = new byte[1024];
    int bytesIn = 0;
    for (int i = 0; i < dirList.length; i++) {
      File f = new File(zipDir,dirList[i]);
      if(f.isDirectory()) {
       zipDir(f.getPath(),zos);
       continue;
      } else {
      FileInputStream fis = new FileInputStream(f.getPath());
      ZipEntry anEntry = new ZipEntry(f.getPath().contains("dependencies") ? "dependencies" + File.separator + f.getName():f.getName());
      zos.putNextEntry(anEntry);
      while ((bytesIn = fis.read(readBuffer)) != -1) {
        zos.write(readBuffer, 0, bytesIn);
      }
      zos.flush();
      fis.close();
    }
    }
  } catch (Exception e) {
    throw new org.wso2.carbon.registry.api.RegistryException("Error occurred while zipping the file");
  }
}

origin: org.wso2.carbon.registry/org.wso2.carbon.registry.jcr

public Repository getLocalRepository(Map map) throws Exception {
  if ((map != null) && (map.get("org.wso2.registry.jcr") != null) && (map.get("org.wso2.registry.jcr").equals("greg"))) {
    InMemoryEmbeddedRegistryService embeddedRegistryService = null;
    try {
      realmService = new DefaultRealmService(null);
    } catch (Exception e) {
      throw new Exception("Unable to create realm service " + e.getMessage());
    }
    RegistryCoreServiceComponent registryComponent = new RegistryCoreServiceComponent() {
      public void setRealmService(RealmService realm) {
        super.setRealmService(realmService);
      }
    };
    RegistryService registryService = null;
    try {
      registryService = registryComponent.buildRegistryService();
      if (regRepo == null) {
        regRepo = new RegistryRepository((EmbeddedRegistryService) registryService);
      }
    } catch (RegistryException e) {
      throw new Exception("Unable to build registry service" + e.getMessage());
    }
    return regRepo;
  }
  return null;
}
origin: org.wso2.carbon.devicemgt-plugins/org.wso2.carbon.device.mgt.mobile.impl

@Override
public TenantConfiguration getConfiguration() throws DeviceManagementException {
  Resource resource;
  try {
    String androidRegPath =
        MobileDeviceManagementUtil.getPlatformConfigPath(DeviceManagementConstants.
            MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
    resource = MobileDeviceManagementUtil.getRegistryResource(androidRegPath);
    if (resource != null) {
      JAXBContext context = JAXBContext.newInstance(TenantConfiguration.class);
      Unmarshaller unmarshaller = context.createUnmarshaller();
      return (TenantConfiguration) unmarshaller.unmarshal(
          new StringReader(new String((byte[]) resource.getContent(), Charset.
              forName(MobilePluginConstants.CHARSET_UTF8))));
    }
    return null;
  } catch (MobileDeviceMgtPluginException e) {
    throw new DeviceManagementException(
        "Error occurred while retrieving the Registry instance : " + e.getMessage(), e);
  } catch (JAXBException e) {
    throw new DeviceManagementException(
        "Error occurred while parsing the Android configuration : " + e.getMessage(), e);
  } catch (RegistryException e) {
    throw new DeviceManagementException(
        "Error occurred while retrieving the Registry resource of Android Configuration : " + e.getMessage(), e);
  }
}
origin: org.wso2.carbon.identity.inbound.auth.oauth2/org.wso2.carbon.identity.oauth

private Properties getOIDCScopeProperties(String spTenantDomain) {
  Resource oidcScopesResource = null;
  try {
    int tenantId = IdentityTenantUtil.getTenantId(spTenantDomain);
    startTenantFlow(spTenantDomain, tenantId);
    RegistryService registryService = OAuth2ServiceComponentHolder.getRegistryService();
    if (registryService == null) {
      throw new RegistryException("Registry Service not set in OAuth2 Component. Component may not have " +
          "initialized correctly.");
    }
    oidcScopesResource = registryService.getConfigSystemRegistry(tenantId).get(SCOPE_RESOURCE_PATH);
  } catch (RegistryException e) {
    log.error("Error while obtaining registry collection from registry path:" + SCOPE_RESOURCE_PATH, e);
  } finally {
    PrivilegedCarbonContext.endTenantFlow();
  }
  Properties propertiesToReturn = new Properties();
  if (oidcScopesResource != null) {
    for (Object scopeProperty : oidcScopesResource.getProperties().keySet()) {
      String propertyKey = (String) scopeProperty;
      propertiesToReturn.setProperty(propertyKey, oidcScopesResource.getProperty(propertyKey));
    }
  } else {
    log.error("OIDC scope resource cannot be found at " + SCOPE_RESOURCE_PATH + " for tenantDomain: "
        + spTenantDomain);
  }
  return propertiesToReturn;
}
origin: org.wso2.carbon.devicemgt-plugins/org.wso2.carbon.device.mgt.mobile.impl

@Override
public TenantConfiguration getConfiguration() throws DeviceManagementException {
  Resource resource;
  try {
    String windowsTenantRegistryPath =
        MobileDeviceManagementUtil.getPlatformConfigPath(DeviceManagementConstants.
            MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
    resource = MobileDeviceManagementUtil.getRegistryResource(windowsTenantRegistryPath);
    if (resource != null) {
      JAXBContext context = JAXBContext.newInstance(TenantConfiguration.class);
      Unmarshaller unmarshaller = context.createUnmarshaller();
      return (TenantConfiguration) unmarshaller.unmarshal(
          new StringReader(new String((byte[]) resource.getContent(), Charset.
              forName(MobilePluginConstants.CHARSET_UTF8))));
    }
    return null;
  } catch (MobileDeviceMgtPluginException e) {
    throw new DeviceManagementException(
        "Error occurred while retrieving the Registry instance : " + e.getMessage(), e);
  } catch (JAXBException e) {
    throw new DeviceManagementException(
        "Error occurred while parsing the Windows configuration : " + e.getMessage(), e);
  } catch (RegistryException e) {
    throw new DeviceManagementException(
        "Error occurred while retrieving the Registry resource of Windows configuration : " + e.getMessage(), e);
  }
}
origin: org.wso2.carbon.registry/org.wso2.carbon.registry.resource

public boolean importResource(
    String parentPath,
    String resourceName,
    String mediaType,
    String description,
    String fetchURL,
    String symlinkLocation,
    String[][] properties) throws Exception {
  UserRegistry registry = (UserRegistry) getRootRegistry(ResourceDataHolder.getInstance().getRegistryService());
  if (RegistryUtils.isRegistryReadOnly(registry.getRegistryContext())) {
    return false;
  }
  // Fix for file importation security verification - FileSystemImportationSecurityHotFixTestCase
  if (StringUtils.isNotBlank(fetchURL) && fetchURL.toLowerCase().startsWith("file:")) {
    String msg = "The source URL must not be file in the server's local file system";
    throw new RegistryException(msg);
  }
  // Adding Source URL as property to end of the properties array.
  String[][] newProperties = CommonUtil.setProperties(properties, "sourceURL", fetchURL);
  // Data is directed to below AddResourceUtil.addResource from ImportResourceUtil.importResource
  // Hence resource upload path will now go through put.
  AddResourceUtil.addResource(CommonUtil.calculatePath(parentPath, resourceName),
      mediaType, description, GetTextContentUtil.getByteContent(fetchURL),
      symlinkLocation, registry, newProperties);
  return true;
}
origin: org.wso2.carbon.devicemgt-plugins/org.wso2.carbon.device.mgt.mobile.impl

} catch (RegistryException e) {
  throw new DeviceManagementException(
      "Error occurred while persisting the Registry resource of Windows configuration : " + e.getMessage(), e);
} catch (JAXBException e) {
  throw new DeviceManagementException(
origin: org.wso2.carbon.identity/org.wso2.carbon.user.mgt

private void buildUIPermissionNodeAllSelected(Collection parent, UIPermissionNode parentNode,
                       Registry registry, Registry tenantRegistry) throws RegistryException,
    UserStoreException {
  String[] children = parent.getChildren();
  UIPermissionNode[] childNodes = new UIPermissionNode[children.length];
  for (int i = 0; i < children.length; i++) {
    String child = children[i];
    Resource resource = null;
    if (registry.resourceExists(child)) {
      resource = registry.get(child);
    } else if (tenantRegistry != null) {
      resource = tenantRegistry.get(child);
    } else {
      throw new RegistryException("Permission resource not found in the registry.");
    }
    childNodes[i] = getUIPermissionNode(resource, true);
    if (resource instanceof Collection) {
      buildUIPermissionNodeAllSelected((Collection) resource, childNodes[i], registry,
          tenantRegistry);
    }
  }
  parentNode.setNodeList(childNodes);
}
origin: org.wso2.carbon.devicemgt-plugins/org.wso2.carbon.device.mgt.mobile.impl

} catch (RegistryException e) {
  throw new DeviceManagementException(
      "Error occurred while persisting the Registry resource of Android Configuration : " + e.getMessage(), e);
} catch (JAXBException e) {
  throw new DeviceManagementException(
origin: wso2/carbon-identity-framework

  resource = registry.get(child);
} else {
  throw new RegistryException("Permission resource not found in the registry.");
origin: org.wso2.carbon.devicemgt-plugins/org.wso2.carbon.device.mgt.mobile.impl

public static Resource getRegistryResource(String path) throws MobileDeviceMgtPluginException {
  try {
    if(MobileDeviceManagementUtil.getConfigurationRegistry().resourceExists(path)){
      return MobileDeviceManagementUtil.getConfigurationRegistry().get(path);
    }
    return null;
  } catch (RegistryException e) {
    throw new MobileDeviceMgtPluginException("Error in retrieving registry resource : " +
                         e.getMessage(), e);
  }
}
origin: org.wso2.carbon.identity/org.wso2.carbon.user.mgt

  resource = registry.get(child);
} else {
  throw new RegistryException("Permission resource not found in the registry.");
origin: org.wso2.carbon.devicemgt-plugins/org.wso2.carbon.device.mgt.mobile.impl

public static Registry getConfigurationRegistry() throws MobileDeviceMgtPluginException {
  try {
    int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
    return MobileDeviceManagementDataHolder.getInstance().getRegistryService()
                           .getConfigSystemRegistry(
                               tenantId);
  } catch (RegistryException e) {
    throw new MobileDeviceMgtPluginException(
        "Error in retrieving conf registry instance: " +
        e.getMessage(), e);
  }
}
origin: wso2/carbon-identity-framework

private void buildUIPermissionNodeAllSelected(Collection parent, UIPermissionNode parentNode,
                       Registry registry, Registry tenantRegistry) throws RegistryException,
    UserStoreException {
  String[] children = parent.getChildren();
  UIPermissionNode[] childNodes = new UIPermissionNode[children.length];
  for (int i = 0; i < children.length; i++) {
    String child = children[i];
    Resource resource = null;
    if (registry.resourceExists(child)) {
      resource = registry.get(child);
    } else if (tenantRegistry != null) {
      resource = tenantRegistry.get(child);
    } else {
      throw new RegistryException("Permission resource not found in the registry.");
    }
    childNodes[i] = getUIPermissionNode(resource, true);
    if (resource instanceof Collection) {
      buildUIPermissionNodeAllSelected((Collection) resource, childNodes[i], registry,
          tenantRegistry);
    }
  }
  parentNode.setNodeList(childNodes);
}
origin: org.wso2.carbon.devicemgt-plugins/org.wso2.carbon.device.mgt.mobile.impl

public static boolean createRegistryCollection(String path)
    throws MobileDeviceMgtPluginException {
  try {
    if (! MobileDeviceManagementUtil.getConfigurationRegistry().resourceExists(path)) {
      Resource resource = MobileDeviceManagementUtil.getConfigurationRegistry().newCollection();
      MobileDeviceManagementUtil.getConfigurationRegistry().beginTransaction();
      MobileDeviceManagementUtil.getConfigurationRegistry().put(path, resource);
      MobileDeviceManagementUtil.getConfigurationRegistry().commitTransaction();
    }
    return true;
  } catch (MobileDeviceMgtPluginException e) {
    throw new MobileDeviceMgtPluginException(
        "Error occurred while creating a registry collection : " +
        e.getMessage(), e);
  } catch (RegistryException e) {
    throw new MobileDeviceMgtPluginException(
        "Error occurred while creating a registry collection : " +
        e.getMessage(), e);
  }
}
origin: org.wso2.carbon.identity/org.wso2.carbon.user.mgt

String msg = "Error deleting user from registry " + e.getMessage();
log.error(msg, e);
throw new UserAdminException(msg, e);
origin: wso2/carbon-identity-framework

String msg = "Error deleting user from registry " + e.getMessage();
log.error(msg, e);
throw new UserAdminException(msg, e);
origin: org.wso2.carbon.devicemgt-plugins/org.wso2.carbon.device.mgt.mobile.impl

public static boolean putRegistryResource(String path,
                     Resource resource)
    throws MobileDeviceMgtPluginException {
  boolean status;
  try {
    MobileDeviceManagementUtil.getConfigurationRegistry().beginTransaction();
    MobileDeviceManagementUtil.getConfigurationRegistry().put(path, resource);
    MobileDeviceManagementUtil.getConfigurationRegistry().commitTransaction();
    status = true;
  } catch (RegistryException e) {
    throw new MobileDeviceMgtPluginException(
        "Error occurred while persisting registry resource : " +
        e.getMessage(), e);
  }
  return status;
}
org.wso2.carbon.registry.apiRegistryException

Most used methods

  • <init>
  • getMessage

Popular in Java

  • Creating JSON documents from java classes using gson
  • setScale (BigDecimal)
  • getSharedPreferences (Context)
  • setContentView (Activity)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • BoxLayout (javax.swing)
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now