Lists the access control entries of a given resource.<p>

@param resourceName the name of the resource
@throws Exception if something goes wrong
191640
public void lsacc(String resourceName) throws Exception {

        List<CmsAccessControlEntry> acList = m_cms.getAccessControlEntries(resourceName);
        for (int i = 0; i < acList.size(); i++) {
            CmsAccessControlEntry ace = acList.get(i);
            I_CmsPrincipal acePrincipal = m_cms.lookupPrincipal(ace.getPrincipal());
            String pName = (acePrincipal != null) ? acePrincipal.getName() : ace.getPrincipal().toString();
            m_shell.getOut().println(pName + ": " + ace.getPermissions().getPermissionString() + " " + ace);
        }
    }
1068317
public void lockResource(CmsResource resource) throws CmsException {

        getResourceType(resource).lockResource(this, m_securityManager, resource, CmsLockType.EXCLUSIVE);
    }
856646
public void actionShow() throws Exception {

        // try to load the historical resource
        if (CmsStringUtil.isNotEmpty(getParamVersion())) {
            showHistoricVersion();
        } else {
            String resourceStr = getParamResource();
            // trying to read the resource
            CmsResource resource = readResource(resourceStr);
            if (isDeleted(resource)) {
                // resource has been deleted in offline project
                throw new CmsVfsResourceNotFoundException(Messages.get().container(
                    Messages.ERR_RESOURCE_DELETED_2,
                    resourceStr,
                    getCms().getRequestContext().getCurrentProject().getName()));
            }

            // check for release / expiration time window
            autoTimeWarp(resource);

            // code for display resource after all tests for displayability (exists, not deleted)
            //            if (CmsResourceTypeXmlContainerPage.isContainerPage(resource)) {
            //                // if we have a container page look for the first sitemap entry
            //                // and use that to display the container page
            //                List<CmsInternalSitemapEntry> entries = OpenCms.getSitemapManager().getEntriesForStructureId(
            //                    getJsp().getCmsObject(),
            //                    resource.getStructureId());
            //                if (!entries.isEmpty()) {
            //                    CmsInternalSitemapEntry entry = entries.get(0);
            //                    resourceStr = entry.getRootPath();
            //                }
            //            }
            if (OpenCms.getSiteManager().isSharedFolder(getCms().getRequestContext().getSiteRoot())) {
                if (!OpenCms.getSiteManager().startsWithShared(resourceStr)) {
                    resourceStr = CmsStringUtil.joinPaths(OpenCms.getSiteManager().getSharedFolder(), resourceStr);
                }
            }
            String url = getJsp().link(resourceStr);
            // if in online project
            if ((url.indexOf("://") < 0) && getCms().getRequestContext().getCurrentProject().isOnlineProject()) {
                url = prependSiteRoot(url);
            }
            getJsp().getResponse().sendRedirect(url);
        }
    }
690600
public Observable<Page<ClusterInner>> listByResourceGroupAsync(final String resourceGroupName) {
        return listByResourceGroupWithServiceResponseAsync(resourceGroupName)
            .map(new Func1<ServiceResponse<Page<ClusterInner>>, Page<ClusterInner>>() {
                @Override
                public Page<ClusterInner> call(ServiceResponse<Page<ClusterInner>> response) {
                    return response.body();
                }
            });
    }
1039398
public static void useResource(String host, int port, String user, String password, Authentication authType)
    throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
  {
    // create the client
    DatabaseClient client = DatabaseClientFactory.newClient(host, port, user, password, authType);

    // create the resource extension client
    DictionaryManager dictionaryMgr = new DictionaryManager(client);

    // specify the identifier for the dictionary
    String uri = "/example/metasyn.xml";

    // create the dictionary
    String[] words = {
      "foo", "bar", "baz", "qux", "quux", "wibble", "wobble", "wubble"
    };
    dictionaryMgr.createDictionary(uri, words);

    System.out.println("Created a dictionary on the server at "+uri);

    // check the validity of the dictionary
    Document[] list = dictionaryMgr.checkDictionaries(uri);
    if (list == null || list.length == 0)
      System.out.println("Could not check the validity of the dictionary at "+uri);
    else
      System.out.println(
        "Checked the validity of the dictionary at "+uri+": "+
          !"invalid".equals(list[0].getDocumentElement().getNodeName())
      );

    dictionaryMgr.getMimetype(uri);
    // use a resource service to check the correctness of a word
    String word = "biz";
    if (!dictionaryMgr.isCorrect(word, uri)) {
      System.out.println("Confirmed that '"+word+"' is not in the dictionary at "+uri);

      // use a resource service to look up suggestions
      String[] suggestions = dictionaryMgr.suggest(word, null, null, uri);

      System.out.println("Nearest matches for '"+word+"' in the dictionary at "+uri);
      for (String suggestion: suggestions) {
        System.out.println("    "+suggestion);
      }
    }

    // delete the dictionary
    dictionaryMgr.deleteDictionary(uri);

    // release the client
    client.release();
  }
1049209
public List<ISubmission> getSubmissions(String resourceUrl) throws Exception{
		ParadataFetcher fetcher = new ParadataFetcher(node, resourceUrl);
		return fetcher.getSubmissions();
	}
1248961
public static void actionRename(PageContext pc, Resource directory, String strNewdirectory, String serverPassword, boolean createPath, Object acl, String storage)
	    throws PageException {
	// check directory
	SecurityManager securityManager = pc.getConfig().getSecurityManager();
	securityManager.checkFileLocation(pc.getConfig(), directory, serverPassword);

	if (!directory.exists()) throw new ApplicationException("the directory [" + directory.toString() + "] doesn't exist");
	if (!directory.isDirectory()) throw new ApplicationException("the file [" + directory.toString() + "] exists, but it isn't a directory");
	if (!directory.canRead()) throw new ApplicationException("no access to read directory [" + directory.toString() + "]");

	if (strNewdirectory == null) throw new ApplicationException("the attribute [newDirectory] is not defined");

	// real to source
	Resource newdirectory = toDestination(pc, strNewdirectory, directory);

	securityManager.checkFileLocation(pc.getConfig(), newdirectory, serverPassword);
	if (newdirectory.exists()) throw new ApplicationException("new directory [" + newdirectory.toString() + "] already exists");
	if (createPath) {
	    newdirectory.getParentResource().mkdirs();

	}
	try {
	    directory.moveTo(newdirectory);
	}
	catch (Throwable t) {
	    ExceptionUtil.rethrowIfNecessary(t);
	    throw Caster.toPageException(t);
	}

	// set S3 stuff
	setS3Attrs(pc, directory, acl, storage);

    }
1553
@Override
    public List<ProviderAccount> listProviderAccounts(String url,
                                               String username,
                                               String password) {
        return duraCloudDao.listProviderAccounts(url, username, password);
    }
194239
public void writePropertyObject(String resourcename, CmsProperty property) throws CmsException {

        CmsResource resource = readResource(resourcename, CmsResourceFilter.IGNORE_EXPIRATION);
        getResourceType(resource).writePropertyObject(this, m_securityManager, resource, property);
    }
392727
public PagedList<MediaServiceInner> listByResourceGroup(String resourceGroupName) {
        PageImpl<MediaServiceInner> page = new PageImpl<>();
        page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName).toBlocking().single().body());
        page.setNextPageLink(null);
        return new PagedList<MediaServiceInner>(page) {
            @Override
            public Page<MediaServiceInner> nextPage(String nextPageLink) {
                return null;
            }
        };
    }
800879
@Override
    public void listScopes(final SecurityContext securityContext, final AsyncResponse asyncResponse) {
        long traceId = LoggerHelpers.traceEnter(log, "listScopes");

        final Principal principal;
        final List<String> authHeader = getAuthorizationHeader();

        try {
            principal = restAuthHelper.authenticate(authHeader);
            restAuthHelper.authorize(authHeader, AuthResourceRepresentation.ofScopes(), principal, READ);
        } catch (AuthException e) {
            log.warn("Get scopes failed due to authentication failure.", e);
            asyncResponse.resume(Response.status(Status.fromStatusCode(e.getResponseCode())).build());
            LoggerHelpers.traceLeave(log, "listScopes", traceId);
            return;
        }

        controllerService.listScopes()
                         .thenApply(scopesList -> {
                             ScopesList scopes = new ScopesList();
                             scopesList.forEach(scope -> {
                                 try {
                                     if (restAuthHelper.isAuthorized(authHeader,
                                             AuthResourceRepresentation.ofScope(scope),
                                             principal, READ)) {
                                         scopes.addScopesItem(new ScopeProperty().scopeName(scope));
                                     }
                                 } catch (AuthException e) {
                                     log.warn(e.getMessage(), e);
                                     // Ignore. This exception occurs under abnormal circumstances and not to determine
                                     // whether the user is authorized. In case it does occur, we assume that the user
                                     // is unauthorized.
                                 }
                             });
                             return Response.status(Status.OK).entity(scopes).build(); })
                         .exceptionally(exception -> {
                             log.warn("listScopes failed with exception: ", exception);
                             return Response.status(Status.INTERNAL_SERVER_ERROR).build(); })
                         .thenApply(response -> {
                             asyncResponse.resume(response);
                             LoggerHelpers.traceLeave(log, "listScopes", traceId);
                             return response;
                         });
    }
502265
public function getMetadataByResourceName($resourceName)
    {
        $this->getAllMetadata();

        if (!isset($this->resourceClassMap[$resourceName])) {
            throw Exception::resourceNotFound($resourceName);
        }

        return $this->loadedMetadata[$this->resourceClassMap[$resourceName]];
    }
911231
public void setResourceAwsIamAccessKeyUserName(java.util.Collection<StringFilter> resourceAwsIamAccessKeyUserName) {
        if (resourceAwsIamAccessKeyUserName == null) {
            this.resourceAwsIamAccessKeyUserName = null;
            return;
        }

        this.resourceAwsIamAccessKeyUserName = new java.util.ArrayList<StringFilter>(resourceAwsIamAccessKeyUserName);
    }
558851
public static Object actionList(PageContext pageContext, Resource directory, String serverPassword, int type, ResourceFilter filter, int listInfo, boolean recurse, String sort)
	    throws PageException {
	// check directory
	SecurityManager securityManager = pageContext.getConfig().getSecurityManager();
	securityManager.checkFileLocation(pageContext.getConfig(), directory, serverPassword);

	if (type != TYPE_ALL) {
	    ResourceFilter typeFilter = (type == TYPE_DIR) ? DIRECTORY_FILTER : FILE_FILTER;
	    if (filter == null) filter = typeFilter;
	    else filter = new AndResourceFilter(new ResourceFilter[] { typeFilter, filter });
	}

	// create query Object
	String[] names = new String[] { "name", "size", "type", "dateLastModified", "attributes", "mode", "directory" };
	String[] types = new String[] { "VARCHAR", "DOUBLE", "VARCHAR", "DATE", "VARCHAR", "VARCHAR", "VARCHAR" };

	boolean hasMeta = directory instanceof ResourceMetaData;
	if (hasMeta) {
	    names = new String[] { "name", "size", "type", "dateLastModified", "attributes", "mode", "directory", "meta" };
	    types = new String[] { "VARCHAR", "DOUBLE", "VARCHAR", "DATE", "VARCHAR", "VARCHAR", "VARCHAR", "OBJECT" };
	}
	Array array = null;
	Query query = null;
	Object rtn;
	if (listInfo == LIST_INFO_QUERY_ALL || listInfo == LIST_INFO_QUERY_NAME) {
	    boolean listOnlyNames = listInfo == LIST_INFO_QUERY_NAME;
	    rtn = query = new QueryImpl(listOnlyNames ? new String[] { "name" } : names, listOnlyNames ? new String[] { "VARCHAR" } : types, 0, "query");
	}
	else rtn = array = new ArrayImpl();

	if (!directory.exists()) {
	    if (directory instanceof FileResource) return rtn;
	    throw new ApplicationException("directory [" + directory.toString() + "] doesn't exist");
	}
	if (!directory.isDirectory()) {
	    if (directory instanceof FileResource) return rtn;
	    throw new ApplicationException("file [" + directory.toString() + "] exists, but isn't a directory");
	}
	if (!directory.isReadable()) {
	    if (directory instanceof FileResource) return rtn;
	    throw new ApplicationException("no access to read directory [" + directory.toString() + "]");
	}

	long startNS = System.nanoTime();

	try {
	    // Query All
	    if (listInfo == LIST_INFO_QUERY_ALL) _fillQueryAll(query, directory, filter, 0, hasMeta, recurse);

	    // Query Name
	    else if (listInfo == LIST_INFO_QUERY_NAME) {
		if (recurse || type != TYPE_ALL) _fillQueryNamesRec("", query, directory, filter, 0, recurse);
		else _fillQueryNames(query, directory, filter, 0);
	    }

	    // Array Name/Path
	    else if (listInfo == LIST_INFO_ARRAY_NAME || listInfo == LIST_INFO_ARRAY_PATH) {
		boolean onlyName = listInfo == LIST_INFO_ARRAY_NAME;
		if (!onlyName || recurse || type != TYPE_ALL) _fillArrayPathOrName(array, directory, filter, 0, recurse, onlyName);// QueryNamesRec("",query, directory, filter,
																   // 0,recurse);
		else _fillArrayName(array, directory, filter, 0);
	    }

	}
	catch (IOException e) {
	    throw Caster.toPageException(e);
	}

	// sort
	if (sort != null && query != null) {
	    String[] arr = sort.toLowerCase().split(",");
	    for (int i = arr.length - 1; i >= 0; i--) {
		try {
		    String[] col = arr[i].trim().split("\\s+");
		    if (col.length == 1) query.sort(col[0].trim());
		    else if (col.length == 2) {
			String order = col[1].toLowerCase().trim();
			if (order.equals("asc")) query.sort(col[0], lucee.runtime.type.Query.ORDER_ASC);
			else if (order.equals("desc")) query.sort(col[0], lucee.runtime.type.Query.ORDER_DESC);
			else throw new ApplicationException("invalid order type [" + col[1] + "]");
		    }
		}
		catch (Throwable t) {
		    ExceptionUtil.rethrowIfNecessary(t);
		}
	    }
	}
	if (query != null) query.setExecutionTime(System.nanoTime() - startNS);
	return rtn;
    }
355069
public static void useResource(String host, int port, String user, String password, Authentication authType)
    throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
  {
    // create the client
    DatabaseClient client = DatabaseClientFactory.newClient(host, port, user, password, authType);

    setUpExample(client);

    // create the batch manager
    BatchManager batchMgr = new BatchManager(client);

    // collect the request items
    BatchManager.BatchRequest request = batchMgr.newBatchRequest();
    request.withRead("/batch/read1.xml", "application/xml");
    request.withRead("/batch/read2.xml", Metadata.COLLECTIONS, "application/xml");
    request.withDelete("/batch/delete1.xml");
    request.withWrite("/batch/write1.xml",
      new StringHandle().withFormat(Format.XML).with("<write1/>"));
    DocumentMetadataHandle meta2 = new DocumentMetadataHandle();
    meta2.getCollections().add("/batch/collection2");
    request.withWrite("/batch/write2.xml",
      meta2,
      new StringHandle().withFormat(Format.XML).with("<write2/>"));

    // apply the request
    BatchManager.BatchResponse response = batchMgr.apply(request);

    System.out.println("Applied the batch request with " +
      (response.getSuccess() ? "success" : "failure")+":");

    // iterate over the response items
    while (response.hasNext()){
      BatchManager.OutputItem item = response.next();
      BatchManager.OperationType itemType = item.getOperationType();
      String itemUri = item.getUri();
      if (item.getSuccess()) {
        System.out.println(itemType.name().toLowerCase()+" on "+itemUri);

        // inspect the response for a document read request
        if (itemType == BatchManager.OperationType.READ) {
          BatchManager.ReadOutput readItem = (BatchManager.ReadOutput) item;

          // show the document metadata read from the database
          if (readItem.hasMetadata()) {
            StringHandle metadataHandle = readItem.getMetadata(new StringHandle());
            System.out.println("with metadata:\n"+metadataHandle.get());
          }
          // show the document content read from the database
          if (readItem.hasContent()) {
            StringHandle contentHandle = readItem.getContent(new StringHandle());
            System.out.println("with content:\n"+contentHandle.get());
          }
        }
      } else {
        System.out.println(itemType.name().toLowerCase()+" failed on "+itemUri);
        if (item.hasException()) {
          StringHandle exceptionHandle = item.getException(new StringHandle());
          System.out.println("with exception:\n"+exceptionHandle.get());
        }
      }
    }

    // release the client
    client.release();
  }
615898
public Observable<PolicyEventsQueryResultsInner> listQueryResultsForResourceAsync(String resourceId) {
        return listQueryResultsForResourceWithServiceResponseAsync(resourceId).map(new Func1<ServiceResponse<PolicyEventsQueryResultsInner>, PolicyEventsQueryResultsInner>() {
            @Override
            public PolicyEventsQueryResultsInner call(ServiceResponse<PolicyEventsQueryResultsInner> response) {
                return response.body();
            }
        });
    }
639735
private final List getPrivateResource(final String name) {
		try {
			final Object to = this.resourcesMap.get(name);
			final List list = new ArrayList();
			if (to instanceof URL) {
				list.add((URL) to);
				return list;
			} else if (to instanceof List) {
				final List l = (List) to;
				for (int i = 0; i < l.size(); i++) {
					list.add((URL) l.get(i));
				}
				return list;
			} else {
				return null;
			}
		} finally {
			try {

			} catch (final Exception ignore) {
			}
		}
	}