/** * Factory method creating a new <code>RegistryNode</code> from a node at a given Registry path. * * @param path Registry path of the node * @return A new instance representing the Registry node at <code>path</code> * @throws CmisObjectNotFoundException if <code>path</code> does not identify a Registry node * @throws CmisRuntimeException */ public RegistryObject getNode(String path) throws RegistryException { return create(repository.get(path)); }
private static void removeEndpointDependencies(String servicePath, Registry registry) throws RegistryException { // update lock check removed from for loop to prevent the database lock Association[] associations = registry.getAllAssociations(servicePath); for (Association association : associations) { String path = association.getDestinationPath(); if (registry.resourceExists(path)) { Resource endpointResource = registry.get(path); if (CommonConstants.ENDPOINT_MEDIA_TYPE.equals(endpointResource.getMediaType())) { registry.removeAssociation(servicePath, path, CommonConstants.DEPENDS); registry.removeAssociation(path, servicePath, CommonConstants.USED_BY); } } } }
protected List<String> getServersToDiscover(Registry registry) throws RegistryException, IOException { Resource resource = registry.get(serverIdPropertyFilePath); if (resource != null) { Properties serverProperties = new Properties(); serverProperties.load(resource.getContentStream()); String serverStr = serverProperties.getProperty(SERVERS_PROPERTY); if (serverStr != null) { String[] servers = serverStr.split(SERVER_ID_SEPARATOR); return Arrays.asList(servers); } } return Collections.emptyList(); }
public RegistryObject next() { try { return create(getRepository().get(newListIterator.next())); } catch (RegistryException e) { String msg = "Error while iterating the node list "; log.error(msg, e); throw new CmisRuntimeException(msg, e); } }
public static Resource getResourceById(Registry repository, String resourceId){ Resource resource = null; try { resource = repository.get(getPathById(resourceId)); } catch (RegistryException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } return resource; }
/** * Method to make an aspect to default. * @param path path of the resource * @param aspect the aspect to be removed. * @param registry registry instance to be used */ public static void setDefaultLifeCycle(String path, String aspect, Registry registry) throws RegistryException { Resource resource = registry.get(path); if(resource != null) { resource.setProperty("registry.LC.name", aspect); registry.put(path, resource); } }
public static String getLifecycleConfigurationVersion(String name, Registry registry) throws RegistryException, XMLStreamException { String path = getContextRoot() + name; Resource resource; if (lifeCycleExists(name, registry)) { resource = registry.get(path); return String.valueOf(((ResourceImpl)resource).getVersionNumber()); } return null; }
public RegistryVersion next() { String nextVersion = iterator.next(); try { return new RegistryVersion(getRepository(), getRepository().get(nextVersion), nextVersion, typeManager, pathManager); } catch (RegistryException e) { throw new CmisRuntimeException("Error iterating over versions"); } }
@Override public boolean handleCreateLink(RequestContext requestContext) throws RegistryException { String targetPath = requestContext.getTargetPath(); if (!requestContext.getRegistry().resourceExists(targetPath)) { return false; } Resource targetResource = requestContext.getRegistry().get(targetPath); String mType = targetResource.getMediaType(); return mType != null && (invert != (mType.matches( "application/vnd\\.[a-zA-Z0-9.-]+\\+xml") & !mType.matches( "application/vnd.wso2-service\\+xml"))); } },
public PublisherDataHolder retrieveSubscriber(String id, boolean returnSecrets) throws EntitlementException { try { if (registry.resourceExists(PDPConstants.ENTITLEMENT_POLICY_PUBLISHER + RegistryConstants.PATH_SEPARATOR + id)) { Resource resource = registry.get(PDPConstants.ENTITLEMENT_POLICY_PUBLISHER + RegistryConstants.PATH_SEPARATOR + id); return new PublisherDataHolder(resource, returnSecrets); } } catch (RegistryException e) { log.error("Error while retrieving subscriber detail of id : " + id, e); throw new EntitlementException("Error while retrieving subscriber detail of id : " + id, e); } throw new EntitlementException("No Subscriber is defined for given Id"); }
private void deleteRecursively(String path,Registry registry) throws RegistryException { Resource currentResource = registry.get(path); if((currentResource instanceof Collection) && ((Collection)currentResource).getChildCount() == 0 ){ registry.delete(path); deleteRecursively(currentResource.getParentPath(),registry); } }
private void deleteRecursively (Registry registry, Resource resource) throws RegistryException { if (resource instanceof Collection) { for(String childResource : ((Collection) resource).getChildren()){ deleteRecursively(registry, registry.get(childResource)); } } registry.delete(resource.getPath()); }
public static String getLifecycleConfiguration(String name, Registry registry) throws RegistryException, XMLStreamException { String path = getContextRoot() + name; Resource resource; if (lifeCycleExists(name, registry)) { resource = registry.get(path); return RegistryUtils.decodeBytes((byte[])resource.getContent()); } return null; } public static String getLifecycleConfigurationVersion(String name, Registry registry) throws RegistryException, XMLStreamException {
public ProfilesBean getUserProfile(String path) throws RegistryException,UserStoreException{ Registry registry = getConfigSystemRegistry(); Resource resource = registry.get(path); String contentString = (String)resource.getContent(); ProfilesBean profbean = new ProfilesBean(); profbean.setMainDataString(contentString); // profilebean.calculatevalues(); return profbean; } }
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); } }
private void deleteChildRecursively(String path,Registry registry) throws RegistryException { Resource currentResource = registry.get(path); if((currentResource instanceof Collection) && ((Collection)currentResource).getChildCount() == 0 ){ String[] childPaths = ((Collection)currentResource).getChildren(); for (String childPath : childPaths) { deleteChildRecursively(childPath,registry); } registry.delete(path); } else { registry.delete(path); } } }
public static void removeRegistryResource(String resourcePath) throws RegistryException { int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); Registry registry = ServiceHolder.getRegistryService().getConfigSystemRegistry(tenantId); if (registry.resourceExists(resourcePath)) { Resource resource = registry.get(resourcePath); registry.delete(resourcePath); } }
public void putChild(RequestContext requestContext) throws RegistryException { Registry registry = requestContext.getRegistry(); String thisCollectionPath = requestContext.getParentPath(); String thisCollectionName = RegistryUtils.getResourceName(thisCollectionPath); String parentContainerPath = RegistryUtils.getParentPath(thisCollectionPath); Resource parentContainer = registry.get(parentContainerPath); if (thisCollectionName.equals(parentContainer.getProperty( CommonConstants.LATEST_VERSION_PROP_NAME))) { String resourcePath = requestContext.getResourcePath().getPath(); String resourceName = RegistryUtils.getResourceName(resourcePath); registry.createLink(parentContainerPath + RegistryConstants.PATH_SEPARATOR + resourceName, resourcePath); } }
public static String getCurrentUserID() throws Exception { Registry registry = getRegistryService().getSystemRegistry(); Resource shutterbugCollection = registry.get(DEFAULT_SHUTTERBUG_HOME); UserRegistry userRegistry = CommonUtil.getUserRegistry(Utils.getRegistryService()); String tenantUser = TENANT_USER_PREFIX + userRegistry.getTenantId() + "." + userRegistry.getUserName(); return shutterbugCollection.getProperty(tenantUser); }
@Override public void createLink(RequestContext requestContext) throws RegistryException { String symlinkPath = requestContext.getResourcePath().getPath(); String targetResourcePath = requestContext.getTargetPath(); if (requestContext.getRegistry().resourceExists(targetResourcePath)) { Resource r = requestContext.getRegistry().get(targetResourcePath); r.addProperty("registry.resource.symlink.path", symlinkPath); requestContext.getRegistry().put(targetResourcePath, r); } }