1 Flashcards

1
Q

A quickstart jar file needs to allow an AEM author instance to be installed on the localhost on port 6302.

What should this file be renamed before launching?

( ) cq-author-p4502.jar

( ) cq-author-x6302.jar

( ) cq-author-p6302.jar

( ) aem-p6302-author.jar

A

(+) cq-author-p6302.jar

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

AEM is installed in $AEM_HOME.

In which subfolder is the command line startup and shutdown scripts located?

( ) $AEM_HOME/crx-quickstart/bin/

( ) $AEM_HOME/crx-quickstart/opt/

( ) $AEM_HOME/crx-quickstart/scripts/

( ) $AEM_HOME/

A

(+) $AEM_HOME/crx-quickstart/bin/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

For each CRX node in the hierarchy, which actions can be configured using the user admin interface?

( ) Read, Write, Delete, Edit ACL, Replicate

( ) Read, Modify, Create, Delete, Read ACL, Edit ACL, Replicate

( ) Read, Write, Read ACL, Edit ACL, Replicate

( ) Read, Modify, Create, Delete, Read ACL, Edit ACL

A

(+) Read, Modify, Create, Delete, Read ACL, Edit ACL, Replicate

See https://experienceleague.adobe.com/docs/experience-manager-64/administering/security/security.html?lang=en#permissions-in-aem

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

In which two ways can a developer keep simple and maintainable CRX Access Control Lists? (Choose two.)

( ) Assign access rights user by user

( ) Use Deny statements extensively

( ) Assign access rights to user groups rather than users

( ) Use Deny statements sparingly

( ) Delete the everyone group

A

(+) Assign access rights to user groups rather than users

(+) Use Deny statements sparingly

See https://experienceleague.adobe.com/docs/experience-manager-64/administering/security/security.html?lang=en#permission-states

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

An online insurance company website has user-generated content that must be replicated in all publish instances.

What action should the developer take to achieve this?

( ) Configure reverse replication agents for the author

( ) Disable static agent in the author instance

( ) Configure the replication agent in the publish instances

( ) Configure the dispatcher flush agent in publish instance

A

(+) Configure reverse replication agents for the author

Reverse replication is used to get user content generated on a publish instance back to an author instance. This is commonly used for features such as surveys and registration forms.

As the publish environment is usually in the DMZ, to get content back to the author environment THE CONNECTION MUST BE INITIATED FROM THE AUTHOR INSTANCE. This is done with:

  • an outbox in the publish environment where the content is placed.
  • an agent (publish) in the author environment which periodically polls the outbox for new content.

To do this you need:

  • A reverse replication agent in the AUTHOR environment. This acts as the active component to collect information from the outbox in the publish environment:
  • A reverse replication agent in the publish environment (an outbox) This is the passive element as it acts as an “outbox”. User input is placed here, from where it is collected by the agent in the author environment.

https://experienceleague.adobe.com/docs/experience-manager-64/deploying/configuring/replication.html?lang=en#configuring-reverse-replication

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How should a developer configure the replication agent to flush the dispatcher cache for a newly activated page?

( ) Create a reverse replication agent on the author instance

( ) Set the serialization type property of the default agent to dispatcher flush

( ) Create a new replication agent and set transport URI to point to the dispatcher

( ) Create a dispatcher flush agent in publish instance

A

(+) Create a dispatcher flush agent in publish instance

Under certain circumstances, performance gains can be made by transferring cache management from the authoring environment to a publishing instance. It will then be the PUBLISHING environment (not the AEM authoring environment) that sends a cache invalidation request to Dispatcher when a published page is received.

Such circumstances include:

  • Preventing possible timing conflicts between Dispatcher and the publish instance (see Invalidating Dispatcher cache from the Authoring Environment).
  • The system includes several publishing instances that reside on high performance servers, and only one authoring instance.

The dispatcher flush is controlled by a replication AGENT operating on the PUBLISH instance. However, the configuration is made on the authoring environment and then transferred by activating the agent

After configuring, when you ACTIVATE a page FROM author TO publish, this agent (PUBLISH) initiates a standard replication. The log includes messages indicating requests coming from your publish server, similar to the following example:

13:29:47 127.0.0.1 POST /dispatcher/invalidate.cache 200

https://experienceleague.adobe.com/docs/experience-manager-64/deploying/configuring/replication.html?lang=en#configuring-a-dispatcher-flush-agent

https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/configuring/page-invalidate.html?lang=en#invalidating-dispatcher-cache-from-a-publishing-instance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

A developer is monitoring the default replication agent on the author instance. The replication queue is blocked with a single item in it. The developer tests the connection, and the replication test is successful.

What is causing this issue?

( ) The replication agent has NOT been configured on the publish instance.

( ) The publish instance is offline.

( ) The replication user does NOT have permission to replicate the blocking item.

( ) The replication URI is incorrect.

A

(+) The replication user does NOT have permission to replicate the blocking item.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Two AEM publish instances feed a single Dispatcher.

Which part of the Dispatcher configuration should a developer review to ensure both AEM publish instances are used?

( ) cache

( ) filter

( ) farms

( ) virtualhosts

A

(+) farms

https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/configuring/dispatcher-configuration.html?lang=en#defining-farms-farms

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Too many pages are invalidated in the dispatcher cache when a page is published.

What is most likely causing this issue in the dispatcher configuration?

( ) The level of cache invalidation is NOT appropriate for the published content model.

( ) The OS file system permissions are NOT properly configured.

( ) Sticky sessions are NOT configured properly, resulting in requests being delivered to the wrong server.

( ) File globbing in the dispatcher configuration is NOT correct.

A

(+) The level of cache invalidation is NOT appropriate for the published content model.

https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/configuring/dispatcher-configuration.html?lang=en#invalidating-files-by-folder-level

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

There are performance, stability, and security issues with an installed AEM instance

What should a developer do to fix these issues?

( ) Delete and reinstall the AEM instance

( ) Install Adobe-provided Apache configuration file

( ) Install service pack updates from package share

( ) Stop, clear cache files, and restart the AEM instance

A

(+) Install service pack updates from package share

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

A developer installs the latest Service pack to a local AEM author instance.

How should the developer install this package on the publish instance?

( ) Use upload/install from OSGI console of publish instance

( ) Replicate from package manager of author instance

( ) Use upload/install from OSGI console of author instance

( ) Replicate from package manager of publish instance

A

(+) Replicate from package manager of author instance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

A developer needs to create a new component called “Component A”. Component A must show a list of other components that all have a resource type of existing “Component B”. Component A must render this list of tiles for each Component B where the tile rendering is different from the default one. The list of rendered tiles must be reusable by future new components.

How should the developer implement this functionality?

( ) Create a script for tile rendering in Component B and use data-sly-resource attribute with a Sling selector in Component A to render the tile.

( ) Component A overlays Component B and overwrites the base renderer to facilitate the tiles.

( ) Component A inherits from Component B and overwrites the base renderer to facilitate the tiles.

( ) Component A calls the HTL of Component B directly using a data-sly-include attribute.

A

(+) Create a script for tile rendering in Component B and use data-sly-resource attribute with a Sling selector in Component A to render the tile.

See -> https://github.com/adobe/htl-spec/blob/master/SPECIFICATION.md#229-resource

The resourceType-option comes handy if you want to point to a different ‘component’ to render your node, other than the one specified via sling:resourceType on the node level.

<div></div>

renders the ‘foo’ node via the component specified at sling:resourceType

<div></div>

renders the ‘foo’ node via the component a/b/c/d

See -> https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/data-sly-resource-attributes/m-p/210945

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

A developer is working on a custom component with a configurable image. Authors configure this image through the component dialog by editing a field with the following attributes:

+ image
- autoStart=”{Boolean}false”
- class=”cq-droptarget”
- jcr:primaryType=”nt:unstructured”
- sling:resourceType=”cq/gui/components/authoring/dialog/fileupload”
- fileNameParameter=”./fileName”
- fileReferenceParameter=”./fileReference”
- mimeTypes=”[image/gif,image/jpeg,image/png,image/svg+xml,image/tiff,image/webp]”
- multiple=”{Boolean}false”
- name=”./file”
- title=”Image”
- uploadUrl=”${suffix.path}”
- useHTML5=”{Boolean}true”

Authors must be able to drag an image directly from the sidekick into the component to configure the image. The developer needs to add a drop target configuration to the component to meet this requirement.

Which drop target configuration should be used?

( ) + cq:dropTargets
+ image
- jcr:primaryType=”nt:unstructured”
- accept=”[image/gif,image/jpeg,image/png,image/svg+xml,image/tiff,image/webp]”
- groups=”[media]”
- propertyName=”./fileReference”

( ) + cq:dropTargets
+ image
- jcr:primaryType=”nt:unstructured”
- accept=”[image/gif,image/jpeg,image/png,image/svg+xml,image/tiff,image/webp]”
- groups=”[media]”
- propertyName=”./file”

( ) + cq:dropTargets
+ image
- jcr:primaryType=”nt:unstructured”
- accept=”[image/gif,image/jpeg,image/png,image/svg+xml,image/tiff,image/webp]”
- group=”media”
- propertyName=”./file”

( ) + cq:dropTargets
+ image
- jcr:primaryType=”nt:unstructured”
- accept=”[image/gif,image/jpeg,image/png,image/svg+xml,image/tiff,image/webp]”
- group=”media”
- propertyName=”./fileReference”

A

(+) + cq:dropTargets
+ image
- jcr:primaryType=”nt:unstructured”
- accept=”[image/gif,image/jpeg,image/png,image/svg+xml,image/tiff,image/webp]”
- groups=”[media]”
- propertyName=”./fileReference”

http://www.sgaemsolutions.com/2019/01/cqdroptagets-in-cqeditconfig-node-in-aem.html

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

A developer needs to create a component with the following requirements:

The component must be configurable
The component should be editable, NOT removable
An author should be unable to add the component to a page through design mode
Which node structure should the developer use to meet these requirements?

( ) + component
- jcr:primaryType=”cq:Component”
- jcr:title=”Component”
- cq:actions = “[edit]”
+ cq:dialog

( ) + component
- jcr:primaryType=”cq:Component”
- jcr:title=”Component”
- componentGroup=”.hidden”
+ cq:dialog

+ cq:editConfig
- cq:actions = “[edit]”

( ) + component
- jcr:primaryType=”cq:Component”
- jcr:title=”Component”
- componentGroup=”.hidden”
- cq:actions = “[edit]”
+ cq:dialog

( ) + component
- jcr:primaryType=”cq:Component”
- jcr:title=”Component”
- hidden=”true”
+ cq:dialog

+ cq:editConfig
- cq:actions = “[edit]”

A

(+) + component
- jcr:primaryType=”cq:Component”
- jcr:title=”Component”
- componentGroup=”.hidden”
+ cq:dialog

+ cq:editConfig
- cq:actions = “[edit]”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

A developer creates a custom component. The component dialog includes the following two fields:

+ text
- jcr:primaryType=”nt:unstructured”
- sling:resourceType=”granite/ui/components/coral/foundation/form/textarea”
- fieldLabel=”Text”
- name=”./text”

+ charLimit
- jcr:primaryType=”nt:unstructured”
- sling:resourceType=”granite/ui/components/coral/foundation/form/numberfield”
- defaultValue=”0”
- fieldLabel=”Character Limit”
- name=”./charLimit”

The component should display the first ‘X’ characters of the text entered in the ‘text’ input, where ‘X’ is the number entered in the ‘charLimit’ input. If zero, or no value, is entered in the ‘charLimit’ input, then the text should be unaltered. The developer creates the following Sling Model to perform the truncation:

@Model(adaptables = SlingHttpServletRequest.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
public class Truncation {

@ValueMapValue
private String text;

@ValueMapValue
private Integer charLimit;

@PostConstruct
private void init() {
    if (text != null && 0 < charLimit && charLimit < text.length()) {
        text = text.substring(0, charLimit);
    }
}

public String getText() {
    return text;
} }

A Null Pointer Exception occurs if NO charLimit value is set in the component dialog.

What should the developer do to resolve this issue?

( ) Replace the defaultValue=”0” attribute of the charLimit field in the dialog with defaultValue=”{Long}0”

( ) Add the @Default annotation to the charLimit variable in the Sling Model

( ) Replace the defaultValue=”0” attribute of the charLimit field in the dialog with min=”0”

( ) Change the defaultInjectionStrategy of the Truncation Sling Model to DefaultInjectionStrategy.REQUIRED

A

(+) Add the @Default annotation to the charLimit variable in the Sling Model

https://sling.apache.org/documentation/bundles/models.html#annotation-reference-1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

A developer has a component foobar that consists of the files listed below:

script-a.js

“use strict”;
use(function () {
return “foo”;
});

script-b.js

“use strict”;
use(function () {
return “”;
});

foobar.html

<div>
<div></div>
<div></div>
<div></div>
<div></div></div>

What is the output when this component is rendered?

( ) <div>
<div class="bar"></div>
<div class="foo"></div>
<div></div>
<div class=""></div>
</div>

( ) <div>
<div class="foo"></div>
<div class="foo"></div>
<div class=""></div>
<div class="foo"></div>
</div>

( ) <div>
<div class="bar"></div>
<div class="bar"></div>
<div class="foo"></div>
<div class=""></div>
</div>

( ) <div>
<div class="bar"></div>
<div class="foo"></div>
<div></div>
<div></div>
</div>

A

(+) <div>
<div class="bar"></div>
<div class="foo"></div>
<div></div>
<div class=""></div>
</div>

https://github.com/adobe/htl-spec/blob/master/SPECIFICATION.md#223-attribute

## Attributes are processed left-to-right:

foobar = {‘id’: ‘foo’, ‘class’: ‘bar’, ‘lang’: ‘’}

<div></div>

<div></div>

<div></div>

<div></div>

## Boolean values allow to control the display of boolean attributes:

## Arrays are cast to strings:

<div></div>

<div></div>

<div></div>

<div></div>

<div></div>

<div></div>

——————————————————————##Numbers are cast to strings (i.e. zero doesn’t remove the attribute):

<div></div>

<div></div>

## Note: Event handler attributes (on*) and the style attribute cannot be generated with data-sly-attribute due to the fact that none of the available display contexts can fully protect against XSS attacks given the range of values that these attributes can contain.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

A developer is creating a custom component that shows a list of pages. For each page, the following items must be shown:

  • Title of the page
  • Description of the page
  • A button with fixed text “Read more” that must be translatable

All of the above fields must be wrapped in a <div> tag.

The logic for obtaining the list of pages must be reusable for future components.

Which snippet should the developer use to meet these requirements?

( )
<div>
<p>${item.title}</p>
<p>${item.description}</p>
<a> ${“Read more” @ .translate} </a><a>
</a></div>

( )
<div>
<p>${page.title}</p>
<p>${page.description}</p>
<a>${“Read more” @ i18n} </a><a>
</a></div>

( )
<div>
<p>${model.title}</p>
<p>${model.description}</p>
<a>${“Read more” @ .translate} </a><a>
</a></div>

( )
<div>
<p>${item.title}</p>
<p>${item.description}</p>
<a>${“Read more” @ i18n} </a><a>
</a></div></div>

A

(+)
<div>
<p>${item.title}</p>
<p>${item.description}</p>
<a>${“Read more” @ i18n} </a><a>
</a></div>

https://github.com/adobe/htl-spec/blob/master/SPECIFICATION.md#227-repeat
https://github.com/adobe/htl-spec/blob/master/SPECIFICATION.md#123-i18n

##Repeats the content of the element for each item of the provided object (which can be an array, or any iterable object).

<p>${item.text}</p>

<p>${childResource.text}</p>

<div>${article.excerpt}</div>

<div>${article.excerpt}</div>

## An additional itemList (respectively List in case a custom identifier/variable was defined using data-sly-repeat.) identifier is also available within the scope, with the following members:

  • index: zero-based counter (0..length-1);
  • count: one-based counter (1..length);
  • first: true for the first element being iterated;
  • middle: true if element being iterated is neither the first nor the last;
  • last: true for the last element being iterated;
  • odd: true if count is odd;
  • even: true if count is even.

##When iterating over Map objects, the item variable contains the key of each map item:

<p>
<span>key: ${item}</span>
<span>value: ${myMap[item]}</span>
</p>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

A developer has a component named ‘foobar’ with the following file:

foobar.html

<div></div>

<div></div>

What is the output when the component is rendered?

( ) <div></div>
<div></div>

( ) <div></div>
<div></div>

( ) <div></div>
<div></div>

( ) <div></div>
<div></div>

A

Follows the same data-sly-attribute rules( https://github.com/adobe/htl-spec/blob/master/SPECIFICATION.md#223-attribute)

(+) <div></div>
<div></div>

## Attributes are processed left-to-right:

foobar = {‘id’: ‘foo’, ‘class’: ‘bar’, ‘lang’: ‘’}

<div></div>

<div></div>

<div></div>

<div></div>

## Boolean values allow to control the display of boolean attributes:

## Arrays are cast to strings:

<div></div>

<div></div>

<div></div>

<div></div>

<div></div>

<div></div>

##Numbers are cast to strings (i.e. zero doesn’t remove the attribute):

<div></div>

<div></div>

## Note: Event handler attributes (on*) and the style attribute cannot be generated with data-sly-attribute due to the fact that none of the available display contexts can fully protect against XSS attacks given the range of values that these attributes can contain.p>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

A developer needs to implement a header component for a website. The component has the following requirements:

  • The component should be configured once on the page highest in the hierarchy.
  • The header component on pages lower in the hierarchy should look the same and show the same data.
  • If necessary, the configuration can be overwritten on a child page.
  • The component should show a list of links that are configured in the header component.

Which code snippet for returning the list of pages should the developer use?

( ) public String[] getHeaderLinks(Page page) {
final Resource pageContent = page.getContentResource();
final ComponentInheritanceValueMap properties = new ComponentInheritanceValueMap(pageContent);
return properties.get(HEADER_PAGE_LIST, String[].class);
}

( ) public String[] getHeaderLinks(Resource componentResource) {
final HierarchyNodeInheritanceValueMap properties = componentResource.adaptTo(HierarchyNodeInheritanceValueMap.class);
return properties.get(HEADER_PAGE_LIST, String[].class);
}

( ) public String[] getHeaderLinks(Resource componentResource) {
final ComponentInheritanceValueMap properties = componentResource.adaptTo(ComponentInheritanceValueMap.class);
return properties.getInherited(HEADER_PAGE_LIST, String[].class);
}

( ) public String[] getHeaderLinks(Resource componentResource) {
final HierarchyNodeInheritanceValueMap properties = new HierarchyNodeInheritanceValueMap(componentResource);
return properties.getInherited(HEADER_PAGE_LIST, String[].class);
}

A

(+) public String[] getHeaderLinks(Resource componentResource) {
final HierarchyNodeInheritanceValueMap properties = new HierarchyNodeInheritanceValueMap(componentResource);
return properties.getInherited(HEADER_PAGE_LIST, String[].class);
}

https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/com/day/cq/commons/inherit/HierarchyNodeInheritanceValueMap.html
https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/com/day/cq/commons/inherit/ComponentInheritanceValueMap.html

## HierarchyNodeInheritanceValueMap

Note that HierarchyNodeInheritanceValueMap searches ONLY the PAGE hierarchy. It will NOT (for instance), look in:

/content/parent/page/jcr:content/footer/@width
See ComponentInheritanceValueMap for that functionality.

For example, given: /content/parent/page/jcr:content/footer/image/@width, the HierarchyNodeInheritanceValueMap will search for a footer/image/@width property in:

  • /content/parent/page/jcr:content/footer/image/@width
  • /content/parent/jcr:content/footer/image/@width
  • /content/jcr:content/footer/image/@width

Having not found it in any of those locations, it will then return null.

## ComponentInheritanceValueMap

An InheritanceValueMap for a given Resource that will inherit values from ancestors up to its ancestral component, but no higher.
For example, given: /content/parent/page/jcr:content/footer/image/@width, the ComponentInheritanceValueMap will search for a width property in:

/content/parent/page/jcr:content/footer/image/@width
/content/parent/page/jcr:content/footer/@width
/content/parent/page/jcr:content/@width
Having not found it in any of those locations, it will then return null.

Note that ComponentInheritanceValueMap searches ONLY the COMPONENT hierarchy. It will NOT (for instance), look in:

/content/parent/jcr:content/footer/image/@width
See HierarchyNodeInheritanceValueMap for that functionality.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

A developer is working on an HTL script for a custom component. The script has the following requirements:

  • This script must list the title of every child page of the current page.
  • If a child page does NOT have any children, then its title should link directly to that page.
  • If a child page has children, then the title of every one of its children should be listed beneath its title.
  • The title of every grandchild page should link directly to that page.

Which HTL script should the developer use to meet these requirements?

( ) <ul>
<li>

            <b>${child.title}</b>
            <ul>
                <li>
                    <a href="%24%7Bgrandchild.path%20@%20extension%20=%20'html'%7D">${grandchild.title}</a>
                </li>
            </ul>
        
        
            <a href="%24%7Bchild.path%20@%20extension%20=%20'html'%7D">${child.title}</a>
        
    </li>
</ul>

( ) <ul>
<li>

            <b>${child.title}</b>
            <ul>
                <li>
                    <a href="%24%7Bgrandchild.path%20@%20extension%20=%20'html'%7D">${grandchild.title}</a>
                </li>
            </ul>
        
        
            <a href="%24%7Bchild.path%20@%20extension%20=%20'html'%7D">${child.title}</a>
        
    </li>
</ul>

( ) <ul>
<li>

            <b>${child.title}</b>
            <ul>
                <li>
                    <a href="%24%7Bgrandchild.path%7D">${grandchild.title}</a>
                </li>
            </ul>
        
        
            <a href="%24%7Bchild.path%7D">${child.title}</a>
        
    </li>
</ul>

( ) <ul>
<li>

            <b>${child.title}</b>
            <ul>
                <li>
                    <a href="%24%7Bgrandchild.path%7D">${grandchild.title}</a>
                </li>
            </ul>
        
        
            <a href="%24%7Bchild.path%7D">${child.title}</a>
        
    </li>
</ul>
A

(+) <ul>
<li>

            <b>${child.title}</b>
            <ul>
                <li>
                    <a href="%24%7Bgrandchild.path%20@%20extension%20=%20'html'%7D">${grandchild.title}</a>
                </li>
            </ul>
        
        
            <a href="%24%7Bchild.path%20@%20extension%20=%20'html'%7D">${child.title}</a>
        
    </li>
</ul>

–> See https://github.com/adobe/htl-spec/blob/master/SPECIFICATION.md#225-test
–> See https://github.com/adobe/htl-spec/blob/master/SPECIFICATION.md#125-uri-manipulation
–> See https://experienceleague.adobe.com/docs/experience-manager-htl/content/global-objects.html?lang=en

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

A developer has a component named ‘foobar’ with the following file:

FooBar.java

import com.adobe.cq.sightly.WCMUsePojo;

public class FooBar extends WCMUsePojo {

@Override
public void activate() throws Exception {}

public String getLink() {
    return "https://www.foo'bar.com";
}

public String getText() {
    return "foo'bar";
} }

foobar.html

<div>
<a>
${fooBar.text}
</a>
</div>

What is the output when the component is rendered?

( ) <div>
<a>
foo’bar
</a>
</div>

( ) <div>
<a>
foo’bar
</a>
</div>

( ) <div>
<a>
foo’bar
</a>
</div>

( ) <div>
<a>
foo’bar
</a>
</div>

A

(+) <div>
<a>
foo’bar
</a>
</div>

https://experienceleague.adobe.com/docs/experience-manager-htl/content/getting-started.html?lang=en#automatic-context-aware-escaping

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

A developer is working with the following HTL expression in a component rendering script:

${‘path/page.infinity.json’ @ extension = ‘html’,
removeSelectors = [‘foo’],
selectors = [‘foo’, ‘bar’],
prependSuffix = ‘hello’,
suffix = ‘world’}

What is the expected output of this expression?

( ) path/page.bar.html/hello/world

( ) path/page.infinity.json.bar.html/world

( ) path/page.foo.bar.html/hello/world

( ) path/page.bar.html/world

A

(+) path/page.bar.html/hello/world

https://github.com/adobe/htl-spec/blob/master/SPECIFICATION.md#125-uri-manipulation

## Note: It seems URI manipulation DOESN’T work like attributes (data-sly-attribute) which are processed from left to right. URI manipulation seems to apply all at once, concurrently

  • selectors - MODIFIES OR REMOVES the selectors from a URI; the selectors are the URI segments between the part that identifies a resource (the resource’s path) and the extension used for representing the resource
  • addSelectors - adds the provided selectors (selectors string or selectors array) to the URI
  • removeSelectors - removes the provided selectors (selectors string or selectors array) from the URI
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

The developer is presented with a component “Component A” which inherits from a component “Component B”.

The dialog of Component A on path ../cq:dialog/../../items looks like:

+ align
- jcr:primaryType=”nt:unstructured”
- sling:resourceType=”granite/ui/components/coral/foundation/form/select”
- fieldLabel=”Align Text”
- name=”./align”

The dialog of Component B on path ../cq:dialog/../../items looks like:

+ title
- jcr:primaryType=”nt:unstructured”
- sling:resourceType=”granite/ui/components/coral/foundation/form/textarea”
- fieldLabel=”Title”
- name=”./title”

+ description
- jcr:primaryType=”nt:unstructured”
- sling:resourceType=”granite/ui/components/coral/foundation/form/textarea”
- fieldLabel=”Description”
- name=”./description”

The requirement for the dialog is that the Align text field is shown after the Title field.

What should the developer do without changing Component B?

( ) Move all the nodes under the item node from Component B to Component A and order them according the requirements.

( ) Extend Component B with the functionality of Component A

( ) Add the property sling:orderBefore=”description” to the align node.

( ) Move the align node from Component A to Component B and order them according the requirements.

A

(+) Add the property sling:orderBefore=”description” to the align node.

https://experienceleague.adobe.com/docs/experience-manager-learn/getting-started-with-aem-headless/spa-editor/react/extend-component.html?lang=en#extend-dialog

https://sling.apache.org/documentation/bundles/resource-merger.html#child-resource-order-1

Our Banner component requires an extra text field in the dialog to capture the bannerText.

Since we are using Sling inheritance, we can use features of the Sling Resource Merger to override or extend portions of the dialog. In this sample a new tab has been added to the dialog to capture additional data from an author to populate the Card Component.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

A developer is working on a dialog for a contact list component. The dialog has the following requirements:

  • The list of contacts must include one or more entries
  • Contact details must include a full name
  • Contact details must include an email address
  • Contact details can optionally include a short bio
  • Authors need to be able to rearrange the contacts in the list

Which dialog configuration should the developer use to meet all of these requirements?

( ) + multi
- sling:resourceType=”granite/ui/components/coral/foundation/form/multifield”
- composite=”{Boolean}true”
- fieldLabel=”Contact List”
- required=”{Boolean}true”
+ field
- sling:resourceType=”granite/ui/components/coral/foundation/container”
- name=”./contacts”
+ items
+ name
- sling:resourceType=”granite/ui/components/coral/foundation/form/textfield”
- fieldLabel=”Full Name”
- name=”./name”
- required=”{Boolean}true”
+ email
- sling:resourceType=”granite/ui/components/coral/foundation/form/textfield”
- fieldLabel=”Email Address”
- name=”./email”
- required=”{Boolean}true”
+ bio
- sling:resourceType=”granite/ui/components/coral/foundation/form/textarea”
- fieldLabel=”Short Bio”
- name=”./bio”

( ) + multi
- sling:resourceType=”granite/ui/components/coral/foundation/form/multifield”
- fieldLabel=”Contact List”
+ field
- sling:resourceType=”granite/ui/components/coral/foundation/container”
- composite=”{Boolean}true”
- name=”./contacts”
+ items
+ name
- sling:resourceType=”granite/ui/components/coral/foundation/form/textfield”
- fieldLabel=”Full Name”
- name=”./name”
+ email
- sling:resourceType=”granite/ui/components/coral/foundation/form/textfield”
- fieldLabel=”Email Address”
- name=”./email”
+ bio
- sling:resourceType=”granite/ui/components/coral/foundation/form/textarea”
- fieldLabel=”Short Bio”
- name=”./bio”
- required=”{Boolean}false”

( ) + multi
- sling:resourceType=”granite/ui/components/coral/foundation/form/multifield”
- composite=”{Boolean}true”
- fieldLabel=”Contact List”
+ field
- sling:resourceType=”granite/ui/components/coral/foundation/container”
- name=”./contacts”
+ items
+ name
- sling:resourceType=”granite/ui/components/coral/foundation/form/textfield”
- fieldLabel=”Full Name”
- name=”./name”
+ email
- sling:resourceType=”granite/ui/components/coral/foundation/form/textfield”
- fieldLabel=”Email Address”
- name=”./email”
+ bio
- sling:resourceType=”granite/ui/components/coral/foundation/form/textarea”
- fieldLabel=”Short Bio”
- name=”./bio”
- required=”{Boolean}false”

( ) + multi
- sling:resourceType=”granite/ui/components/coral/foundation/form/multifield”
- fieldLabel=”Contact List”
- required=”{Boolean}true”
+ field
- sling:resourceType=”granite/ui/components/coral/foundation/container”
- composite=”{Boolean}true”
- name=”./contacts”
+ items
+ name
- sling:resourceType=”granite/ui/components/coral/foundation/form/textfield”
- fieldLabel=”Full Name”
- name=”./name”
- required=”{Boolean}true”
+ email
- sling:resourceType=”granite/ui/components/coral/foundation/form/textfield”
- fieldLabel=”Email Address”
- name=”./email”
- required=”{Boolean}true”
+ bio
- sling:resourceType=”granite/ui/components/coral/foundation/form/textarea”
- fieldLabel=”Short Bio”
- name=”./bio”

A

(+) + multi
- sling:resourceType=”granite/ui/components/coral/foundation/form/multifield”
- composite=”{Boolean}true”
- fieldLabel=”Contact List”
- required=”{Boolean}true”
+ field
- sling:resourceType=”granite/ui/components/coral/foundation/container”
- name=”./contacts”
+ items
+ name
- sling:resourceType=”granite/ui/components/coral/foundation/form/textfield”
- fieldLabel=”Full Name”
- name=”./name”
- required=”{Boolean}true”
+ email
- sling:resourceType=”granite/ui/components/coral/foundation/form/textfield”
- fieldLabel=”Email Address”
- name=”./email”
- required=”{Boolean}true”
+ bio
- sling:resourceType=”granite/ui/components/coral/foundation/form/textarea”
- fieldLabel=”Short Bio”
- name=”./bio”

https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/multifield/index.html

Multifield component allows to add/reorder/remove multiple instances of a field.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

( ) include

( ) categories

( ) embed

( ) dependencies

A

(+) embed

https://experienceleague.adobe.com/docs/experience-manager-65/developing/introduction/clientlibs.html?lang=en#embedding-code-from-other-libraries

## How Client-Side Libraries Work in AEM

By default, cq:ClientLibraryFolder nodes can be placed anywhere within the /apps, /libs and /etc subtrees of the repository (these defaults, and other settings can be controlled through the Adobe Granite HTML Library Manager panel of the System Console).

Each cq:ClientLibraryFolder is populated with a set of JS and/or CSS files, along with a few supporting files (see below). The properties of the cq:ClientLibraryFolder are configured as follows:

  • categories: Identifies the categories into which the set of JS and/or CSS files within this cq:ClientLibraryFolder fall. The categories property, being multi-valued, allows a library folder to be part of more than one category (see below for how this may be useful).
  • dependencies: This is a list of other client library categories on which this library folder depends. For example, given two cq:ClientLibraryFolder nodes F and G, if a file in F requires another file in G in order to function properly, then at least one of the categories of G should be among the dependencies of F.
  • embed: Used to embed code from other libraries. If node F embeds nodes G and H, the resulting HTML will be a concentration of content from nodes G and H.
  • allowProxy: If a client library is located under /apps, this property allows access to it via proxy servlet. See Locating a Client Library Folder and Using the Proxy Client Libraries Servlet below.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

A Client-Side Library has the category “library.example”.

Which HTL statement should a developer use to reference only the CSS files of this Client-Side Library?

( )

( )

( )

( )

A

(+)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

A developer wants to create a Client Library that will only be included on touch enabled devices.

What action should the developer take to achieve this?

( ) Set the channels property on the Client Library Folder to “touch”

( ) Pass the parameter user-agent=’touch’ when referencing the Client Library

( ) Create a resource folder called “touch” under the Client Library Folder

( ) Add the line “#base=touch” to the js.txt and css.txt files in the Client Library Folder

A

(+) Set the channels property on the Client Library Folder to “touch”

https://experienceleague.adobe.com/docs/experience-manager-65/developing/introduction/clientlibs.html?lang=en#using-a-library-for-specific-mobile-groups

## Using a Library for Specific Mobile Groups
Use the channels property of a client library folder to identify the mobile group that uses the library. The channels property is useful when libraries of the same category are designed for different device capabilities.

To associate a client library folder with a device group, add a property to your cq:ClientLibraryFolder node with the following attributes:

Name: channels
Type: String[]
Values: The name of the mobile group.

To exclude the library folder from a group, prefix the name with an exclamation mark (“!”).

For example, the following table lists the value of the channels property for each client library folder of the cq.widgets category:

Client library folder Value of channels property
/libs/cq/analytics/widgets !touch
/libs/cq/analytics/widgets/themes/default !touch
/libs/cq/cloudserviceconfigs/widgets !touch
/libs/cq/searchpromote/widgets !touch
/libs/cq/searchpromote/widgets/themes/default [no value]
/libs/cq/touch/widgets touch
/libs/cq/touch/widgets/themes/default touch
/libs/cq/ui/widgets !touch
/libs/cq/ui/widgets/themes/default !touch

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

A developer is creating a new component. When rendering the component in a browser, the developer is presented with errors in the browser console. The JavaScript code is compressed.

What is the first step the developer should take to resolve this issue?

( ) Check in the browser on which line the error occurs and check all the JavaScript files of the loaded Client Library files to find the error.

( ) Set “Minify” option to false and the “Debug” option to true in the HTML Library Manager service.

( ) Look in the browser if the Client Library is loaded already.

( ) Remove loaded Client Libraries one by one from the page to determine which Client Library contains the errors.

A

(+) Set “Minify” option to false and the “Debug” option to true in the HTML Library Manager service.

https://experienceleague.adobe.com/docs/experience-manager-65/developing/introduction/clientlibs.html?lang=en#configuring-library-handling-for-development-and-production

## The HTML Library Manager service processes cq:ClientLibraryFolder tags and generates the libraries at runtime. The type of environment, development or production, determines how you should configure the service:

Increase security: Disable debugging
Improve performance: Remove whitespace and compress libraries.
Improve readability: Include whitespace and do not compress.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

Refer to the following four Client Library Folders.

+ One
- categories=”[library.one]”
- dependencies=”[library.three, library.four]”
- embed=”[library.two]”

+ Two
- categories=”[library.two]”

+ Three
- categories=”[library.three]”
- dependencies=”[library.four]”

+ Four
- categories=”[library.four]”

A developer uses the following

What is the resulting HTML?

( )

( )

( )

( )

A

(+)

## Note:
- The dependencies are loaded before so that they are available for the library which relies on them
- The embedded libraries are embedded under the name of the embedding library. In this case, the library.two was embedded with the library.one under that name.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

A developer has a component located under the path /apps. This component has a Client Library which is directly loaded onto a page. The publish instance loads the page correctly. The dispatcher also loads the page, but the Client Library is missing.

How should the developer resolve this issue, while taking security into consideration?

( ) Allow the path to the clientlibs on the dispatcher.

( ) Add the property allowProxy with a boolean value true.

( ) Change the ACLs for the Client Library.

( ) Move the Client Library under /apps//library.

A

(+) Add the property allowProxy with a boolean value true.

https://experienceleague.adobe.com/docs/experience-manager-65/developing/introduction/clientlibs.html?lang=en#locating-a-client-library-folder-and-using-the-proxy-client-libraries-servlet

## In order for the client libraries under /apps to be accessible, a proxy servelt is used. The ACLs are still enforced on the client library folder, but the servlet allows for the content to be read via /etc.clientlibs/ if the allowProxy property is set to true.

Adobe recommends locating client libraries under /apps and making them available using the proxy servlet. However keep in mind that best practice still requires that public sites never include anything that is served directly over an /apps or /libs path.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

Refer to the following Client Library node structure.

+ clientlibs
- jcr:primaryType=”cq:ClientLibraryFolder”
- categories=”[clientlibs.example]”
+ js.txt
- jcr:primaryType=”nt:file”
+ css.txt
- jcr:primaryType=”nt:file”
+ js
- jcr:primaryType=”nt:folder”
+ javascript1.js
+ javascript2.js

The js.txt looks like

javascript1.js
javascript2.js

The javascript is NOT present in the Client Library when it is loaded.

What should a developer do to resolve this issue?

( ) Change the js folder to a Client Library node and embed it on the clientlibs node

( ) Change the js folder to a Client Library node and add the property categories=”[clientlibs.example]”

( ) Add #base=js as the first line in the js.txt file

( ) Split the js and css into 2 Client Libraries since they can’t be in the same Client Library

A

base=js

(+) Add #base=js as the first line in the js.txt file

https://experienceleague.adobe.com/docs/experience-manager-65/developing/components/classic-ui-components/widgets.html?lang=en#including-the-client-sided-code-in-a-page

## Client sided javascript and stylesheet code should be placed in a client library.

To create a client library:

  1. Create a node below /apps/ with the following properties:
  • name=“clientlib”
  • jcr:mixinTypes=“[mix:lockable]”
  • jcr:primaryType=“cq:ClientLibraryFolder”
  • sling:resourceType=“widgets/clientlib”
  • categories=“[category-name]”
  • dependencies=“[cq.widgets]”

Note: category-name is the name of the custom library (e.g. “cq.extjstraining”) and is used to include the library on the page.

  1. Below clientlib create the css and js folders (nt:folder).
  2. Below clientlib create the css.txt and js.txt files (nt:files). Those .txt files list the files that are included in the library.
  3. Edit js.txt: it needs to start with ’ #base=js’ followed by the list of the files that will be aggregated by the CQ client library service, eg:

components.js
exercises.js
CustomWidget.js
CustomBrowseField.js
InsertTextPlugin.js

  1. Edit css.txt: it needs to start with ’ #base=css’ followed by the list of the files that will be aggregated by the CQ client library service, eg:

components.css

  1. Below the js folder, place the javascript files that belong to the library.
  2. Below the css folder, place the .css files and the resources used by the css files (e.g. my_icon.png).
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

A developer creates a custom Client Library named foobar.

This Client Library embeds 5 other Client Libraries and contains 10 JavaScript source files. One of these files, called foo.js, has a bug on line 8 which causes an exception. The Client Library is throwing this exception on line 1350 when it is included on a webpage.

How should a developer find the exact line in foo.js where the exception has been thrown?

( ) 1. Add the query parameter debugClientLibs=true to the request
2. Use the browser JavaScript debugging tools

( ) 1. Add the selector debugClientLibs to the page request
2. Check the JavaScript exception log in the OSGi web console

( ) 1. Temporarily remove the embedded Client Libraries of the foobar Client Library
2. Use the browser JavaScript debugging tools

( ) 1. Enable JS/CSS minification in OSGi configuration console for HTML Library Manager
2. Check the JavaScript exception log in the OSGi web console

A

(+) 1. Add the query parameter debugClientLibs=true to the request
2. Use the browser JavaScript debugging tools

https://experienceleague.adobe.com/docs/experience-manager-65/developing/introduction/clientlibs.html?lang=en#see-embedded-files

## To trace the origin of embedded code, or to ensure that embedded client libraries are producing the expected results, you can see the names of the files that are being embedded at runtime. To see the file names, append the debugClientLibs=true parameter to the URL of your web page. The library that is generated contains @import statements instead of the embedded code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

A developer created a Client Library called foobar containing a folder scripts with two JavaScript files.

script-a.js

“use strict”;
var v = “Foo”;

script-b.js

“use strict”;
v = “Bar”;

When the Client Library is included on a page, only the code from script-a.js is available.

What should the developer do to fix this issue?

( ) Add or correct the entry for script-b.js in the file js.txt and redeploy

( ) Add or correct the entry for script-b.js in the file javascript.txt and redeploy

( ) Correct any syntax violations in the file script-b.js and redeploy

( ) Correct violations against strict mode in the file script-b.js and redeploy

A

(+) Add or correct the entry for script-b.js in the file js.txt and redeploy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

A developer wants to extend AEM Core Components to create a custom Carousel Component.

( ) Copy the Core Carousel component to /apps/ folder

( ) Use the sling:resourceSuperType property to point to the core component

( ) Use the sling:resourceType property to point to the core component

( ) Make changes to the original component and assign a component group

A

(+) Use the sling:resourceSuperType property to point to the core component

https://experienceleague.adobe.com/docs/experience-manager-learn/getting-started-with-aem-headless/spa-editor/react/extend-component.html?lang=en#sling-resource-super-type

## Inheritance with Sling Resource Super Type
To extend an existing component set a property named sling:resourceSuperType on your component’s definition. sling:resourceSuperTypeis a property that can be set on an AEM component’s definition that points to another component. This explicitly sets the component to inherit all functionality of the component identified as the sling:resourceSuperType.

If we want to extend the Image component at wknd-spa-react/components/image we need to update the code in the ui.apps module.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

A developer needs to upgrade existing components (Proxy Components) based on Core Components Version 1(v1) to Core Components Version 2(v2).

How should the developer upgrade to V2 Core Components?

( ) Modify the sling:resourceSuperType property on the V1 core components to point to V2 Component

( ) Modify the sling:resourceSuperType property on the proxy component to point to V2 Component

( ) Proxy Components will be automatically upgraded to the V2 Core Component on AEM Restart

( ) Create a new Proxy Component and set sling:resourceType property to V2 Core Component

A

(+) Modify the sling:resourceSuperType property on the proxy component to point to V2 Component

https://experienceleague.adobe.com/docs/experience-manager-core-components/using/get-started/using.html?lang=en#create-proxy-components

## Create Proxy Components
For reasons explained in the Proxy Component Pattern section, Core Components must not be directly referenced from the content. To avoid that, they all belong to a hidden component group ( .core-wcm or .core-wcm-form), which will prevent them from showing up directly in the editor.

Instead, site-specific components must be created, which define the desired component name and group to display to page authors, and refer each to a Core Component as their super-type. These site-specific components are sometimes called “proxy components”, because they don’t need to contain anything and serve mostly to define the version of a component to use for the site. However, when customizing the Core Components, these proxy components play an essential role for markup and logic customization.

So for each Core Component that is desired to be used for a site, you must:

Create a corresponding proxy component in the site’s components folder.

Example
Under /apps/my-site/components create a title node of type cq:Component

Point to the corresponding Core Component version with the super-type.

Example
Add following property:
sling:resourceSuperType=”core/wcm/components/title/v1/title”

Define the component’s group, title, and optionally description. These values are project specific and dictate how the component is exposed to authors.

## Proxy Component Pattern
As each content resource has a sling:resourceType property that references the component to render it, it is usually good practice to have these properties pointing to site-specific components, instead of pointing to components that are shared by multiple sites. This will offer more flexibility and avoid content refactoring if one site needs a different behavior for a component, because this customization can then be achieved on the site-specific component and won’t affect the other sites.

However, for the project-specific components not to duplicate any code, they should each refer to the shared parent component with the sling:resourceSuperType property. These project-specific components that mostly just refer to parent components are called “proxy components”. Proxy components can be entirely empty if they fully inherit the functionality, or they can redefine some aspects of the component.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

A developer wants to consume AEM Page Data in a Single Page Application. The Single Page Application is coded to understand JSON format. Only page content should be exposed through JSON. All the existing components are based on foundation components.

Which change should the developer make in the existing components to support this requirement?

( ) Create a custom sling event handler to handle JSON requests

( ) Implement a Sling Model Exporter for the components

( ) Invoke the page URL with the extension .json to get the values to construct the required output

( ) Add JSON as the default extension in Apache Sling Servlet/Script Resolver and Error Handler Configuration

A

(+) Implement a Sling Model Exporter for the components

https://experienceleague.adobe.com/docs/experience-manager-learn/foundation/development/develop-sling-model-exporter.html?lang=en

https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/implementing/developing/full-stack/components-templates/enabling-json-exporter.html?lang=en

Note:
- The out-of-the-box Sling JSON content representation only outputs the JCR content structure. For instance, when applied to a Page component it will output all page properties in a JSON format excluding any business logic eventually in place during the component rendering.
- The Sling Model Exporter allows the output of all business logic (getters returned by the model during rendering) plus it is possible to add custom JSON content redemption

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

A developer creates Editable Templates based on a custom Page component. The developer wants to leverage the Style System within the Editable Templates to allow authors to switch between the Dark and Light Theme. The Style System dialog is NOT enabled for the site.

What should the developer do to resolve this issue?

( ) Create a new dialog for the custom Page component

( ) Set the sling:resourceSuperType property to core/wcm/components/page/v2/page on the Page component

( ) Define Style definitions using Page Policy dialog on Editable Template

( ) Create two new client libraries with a dark and light theme and map them to the Page component

A

(+) Set the sling:resourceSuperType property to core/wcm/components/page/v2/page on the Page component

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

A developer needs to change the label “Sites” in the navigation of AEM author to “Websites”.

Which action should the developer take to achieve this?

( ) Modify the node /libs/cq/core/content/nav/sites by updating the jcr:title property value

( ) Create a new node /apps/cq/core/content/nav/sites and update the property jcr:title

( ) Modify the code of /libs/granite/ui/components/shell/globalnav/overlay/overlay.jsp to display the new value

( ) Change the code of /libs/granite/ui/components/shell/clientlibs/shell/js/globalnav.js to display the new value

A

(+) Create a new node /apps/cq/core/content/nav/sites and update the property jcr:title

https://experienceleague.adobe.com/docs/experience-manager-65/developing/platform/overlays.html?lang=en

## In this context (extending AEM) an overlay means taking the predefined functionality and imposing your own definitions over that (to customize the standard functionality).

In a standard instance the predefined functionality is held under /libs and it is recommended practice to define your overlay (customizations) under the /apps branch. AEM uses a search path to find a resource, searching first the /apps branch and then the /libs branch (the search path can be configured). This mechanism means that your overlay (and the customizations defined there) will have priority.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

A developer needs to create a banner component. This component shows an image across the full width of the page. A title is shown on top of the image. This text can be aligned to the left, middle, or right. The core components feature a teaser component which matches almost all requirements, but not all.

What is the most maintainable way for the developer to implement these requirements?

( ) Create a new custom component from scratch.

( ) Overlay the teaser core component.

( ) Inherit from the teaser core component.

( ) Use and configure the teaser core component.

A

(+) Inherit from the teaser core component.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

A developer is creating a custom method. This method must return a String property y from child x. The method must use only Sling APIs.

How should the developer retrieve property y of node x, and node x may or may NOT exist?

( ) String y = null;
Node x = node.getNode(“x”);
if (null!=x) {
Properties properties = x.getProperties();
if (null!=properties) {
y = properties.get(“y”,””);
}
}

( ) String y = null;
Node x = node.getChild(“x”);
if (null!=x) {
ValueMap map = x.getValueMap();
if (null!=map) {
y = map.get(“y”,””);
}
}

( ) String y = ((ValueMap) resource.getChild(“x”).getValueMap()).get(“y”,””);

( ) String y = null;
Resource x = resource.getChild(“x”);
if (null!=x) {
ValueMap map = x.getValueMap();
if (null!=map) {
y = map.get(“y”,””);
}
}

A

(+) String y = null;
Resource x = resource.getChild(“x”);
if (null!=x) {
ValueMap map = x.getValueMap();
if (null!=map) {
y = map.get(“y”,””);
}
}

https://experienceleague.adobe.com/docs/experience-manager-learn/foundation/development/understand-java-api-best-practices.html?lang=en#sling-apis

https://sling.apache.org/apidocs/sling10/org/apache/sling/api/resource/ValueMap.html#get-java.lang.String-java.lang.Class-

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

A developer is writing Java code using the Sling API that needs to work with the JCR directly. The code needs to obtain a Session object.

A service user named “reposervice” may be mapped outside the code.

Which two methods could a developer use to obtain a Session without using a deprecated API? (Choose two.)

( ) SlingRepository repository;
if (null != repository) {
Session session = repository.loginAdministrative(“crx.default”);
}

( ) ResourceResolverFactory resolverFactory;
if (null != resolverFactory) {
ResourceResolver resolver = resolverFactory.getServiceResourceResolver(null);
Session session = resolver.adaptTo(Session.class);
}

( ) ResourceResolverFactory resolverFactory;
if (null!=resolverFactory) {
Map authenticationInfo = new HashMap();
authenticationInfo.put(“username”,”admin”);
authenticationInfo.put(“password”,”admin”);
Session session = resolverFactory.getAdministrativeResourceResolver(authenticationInfo).adaptTo(Session.class);
}

( ) ResourceResolverFactory resolverFactory;
if (null!=resolverFactory) {
Map authenticationInfo = new HashMap();
authenticationInfo.put(“username”,”reposervice”);
Session session = resolverFactory.getAdministrativeResourceResolver(authenticationInfo, resolverFactory.getPassword(“reposervice”)).adaptTo(Session.class);
}

( ) SlingRepository repo;
if (null != repo) {
Session session = repo.loginService(null, repo.getDefaultWorkspace());
}

A

(+) ResourceResolverFactory resolverFactory;
if (null != resolverFactory) {
ResourceResolver resolver = resolverFactory.getServiceResourceResolver(null);
Session session = resolver.adaptTo(Session.class);
}

(+) SlingRepository repo;
if (null != repo) {
Session session = repo.loginService(null, repo.getDefaultWorkspace());
}

https://sling.apache.org/apidocs/sling11/org/apache/sling/api/resource/ResourceResolverFactory.html#getServiceResourceResolver-java.util.Map-

https://sling.apache.org/apidocs/sling8/org/apache/sling/jcr/api/SlingRepository.html#loginService-java.lang.String-java.lang.String-

https://sling.apache.org/apidocs/sling8/org/apache/sling/jcr/api/SlingRepository.html#getDefaultWorkspace–

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

A developer needs to write Java code using the JCR API that unlocks a node.

Which code should the developer use?

( ) public void unlock(String path) throws PathNotFoundException, AccessDeniedException, InvalidItemStateException, LockException, RepositoryException {
Resource thisResource = this.getCurrentResource();
Node thisNode = thisResource.getNode();
thisNode.unlock();
}

( ) public void unlock(String path) throws PathNotFoundException, AccessDeniedException, InvalidItemStateException, LockException, RepositoryException {
Resource thisResource = this.getCurrentResource();
ResourceResolver resolver = thisResource.getResourceResolver();
Node thisNode = resolver.adaptTo(Node.class);
LockManager lockMgr = thisNode.getLockManager();
if (lockMgr.isLocked(path)) {
lockMgr.unlock(path);
}
}

( ) public void unlock(String path) throws PathNotFoundException, AccessDeniedException, InvalidItemStateException, LockException, RepositoryException {
Resource thisResource = this.getCurrentResource();
ResourceResolver resolver = thisResource.getResourceResolver();
Session session = resolver.adaptTo(Session.class);
LockManager lockMgr = session.getWorkspace().getLockManager();
if (lockMgr.isLocked(path)) {
lockMgr.unlock(path);
}
}

( ) public void unlock(String path) throws PathNotFoundException, AccessDeniedException, InvalidItemStateException, LockException, RepositoryException {
Resource thisResource = this.getCurrentResource();
ResourceResolver resolver = thisResource.getResourceResolver();
LockManager lockMgr = resolver.adaptTo(LockManager.class);
if (lockMgr.isLocked(path)) {
lockMgr.unlock(path);
}
}

A

(+) public void unlock(String path) throws PathNotFoundException, AccessDeniedException, InvalidItemStateException, LockException, RepositoryException {
Resource thisResource = this.getCurrentResource();
ResourceResolver resolver = thisResource.getResourceResolver();
Session session = resolver.adaptTo(Session.class);
LockManager lockMgr = session.getWorkspace().getLockManager();
if (lockMgr.isLocked(path)) {
lockMgr.unlock(path);
}
}

https://developer.adobe.com/experience-manager/reference-materials/spec/jsr170/javadocs/jcr-2.0/javax/jcr/lock/LockManager.html#unlock(java.lang.String)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q

The model must check if the configured value of the jcr:title property for the component matches the name of the current page. If the jcr:title property of the component has NOT been configured, then isMatchingTitle() must return false.

How should the developer inject the title property in this model?

( ) @ValueMapValue
@Named(“jcr:title”)
@Default(values = “”)
private String title;

( ) @ValueMapValue
@Named(“jcr:title”)
@Required
private String title;

( ) @ValueMapValue
@Via(“jcr:title”)
@Default(values = “”)
private String title;

( ) @ValueMapValue
@Via(“jcr:title”)
@Required
private String title;

A

(+) @ValueMapValue
@Named(“jcr:title”)
@Default(values = “”)
private String title;

https://sling.apache.org/documentation/bundles/models.html#names-1

44
Q

A developer is creating a custom component on the page /latestBlogs.html that needs to list all the titles of the blogs pages under /content/blogs.

How does this component get the list of child pages?

( ) Use PageManager.getPage(“/content/blogs”) of the static PageManager class to instantiate a Page object and then iterate through the child pages and print the title for each.

( ) Use the QueryDebugger to look for all children of /content/blogs and then iterate through the result set and print the title for each.

( ) Instantiate a node object with session.getNode(/content/blogs) and then iterate through the child nodes and print the title for each.

( ) Adapt the resourceResolver to the PageManager service, then use the getPage(/content/blogs) to instantiate a Page object and then iterate through the child pages and print the title for each.

A

(+) Adapt the resourceResolver to the PageManager service, then use the getPage(/content/blogs) to instantiate a Page object and then iterate through the child pages and print the title for each.

https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/com/day/cq/wcm/api/PageManager.html

45
Q

A developer creates an AEM editable template that includes a Layout Container. When the developer creates a page using this template, the Layout Container placeholder does NOT appear.

What is causing this issue?

( ) The Layout Container has NOT been unlocked.

( ) The page template has NOT been enabled.

( ) The Layout Container does NOT have a policy.

( ) The page template has NOT been published.

A

(+) The Layout Container has NOT been unlocked.

46
Q

The structure section of an editable template has a locked component.

What happens to the content of that component when a developer unlocks it?

( ) The content is moved to the initial section of the editable template.

( ) The content is copied to the initial section of the editable template.

( ) The content is deleted after confirmation from the template author.

( ) The content stays in the same place but is ignored on pages using the template.

A

(+) The content is moved to the initial section of the editable template.

https://experienceleague.adobe.com/docs/experience-manager-64/developing/platform/templates/page-templates-editable.html?lang=en#structure

47
Q

A developer creates a template-type for building editable templates.

The resulting editable templates and pages must always contain a specific layout container that can NOT be deleted by the author.

How should the developer meet this requirement?

( ) Add the layout container component by including it on the actual page component

( ) Add the layout container component to the structure section of the template-type

( ) Add the layout container component to the initial section of the template-type

( ) Add a content policy to the template-type to disable the removal of the layout container

A

(+) Add the layout container component by including it on the actual page component

## Note: Template types effectively provide templates for a template. Contraty to standard templates, template-type configurations don’t seem to allow component definition in the template structure

See –> https://experienceleague.adobe.com/docs/experience-manager-64/developing/platform/templates/page-templates-editable.html?lang=en#template-type

## Template types allow you to define:

  • The resource type of the page component.
  • The policy of the root node, which defines the components allowed in the template editor.
  • It is recommended to define the breakpoints for the responsive grid and setup of the mobile emulator at on the template type. This is optional, because the configuration could also be defined on the individual template (see Template Type and Mobile Device Groups).
48
Q

A developer creates an editable template with a Layout Container. The developer needs to restrict the Layout Container to just one column layout.

What should the developer do to the editable template to enforce this restriction?

( ) Using Template Editor, lock the Structure Component for the template

( ) Overlay wcm.foundation.components.page.responsive Client Library and set @max_col to 1

( ) Using Template Editor, set the responsive settings to 1 column for Layout Container Policy

( ) Add responsive column control component to the template and set column type to 1

A

( ) Using Template Editor, set the responsive settings to 1 column for Layout Container Policy

49
Q

A developer is creating templates and/or components using CRXDE Lite. The developer needs to check the files into source control.

Which tool should the developer use to achieve this goal?

( ) mvn command

( ) Content Explorer

( ) http://localhost:4502/crx/checkout

( ) vlt command

A

(+) vlt command

50
Q

A developer running a local AEM instance and working on an AEM project needs to change a large number of files locally in the filesystem. The developer needs to get the changes uploaded to the local AEM instance to verify changes almost immediately in the browser.

What action should the developer take to most efficiently meet these requirements?

( ) Access CRXDE and upload the files through the interface.

( ) Install FileVault bundle in the AEM instance and register the local working directory for synchronization.

( ) Build a Content Package using maven and deploy it after each change.

( ) Make the changes in CRXDE, create a content package, download it, and expand it into the working directory after each change.

A

(+) Install FileVault bundle in the AEM instance and register the local working directory for synchronization.

51
Q

A developer is working on project with the following filter.xml

How should the developer bring the templates and components from another project folder /apps/project2 to the local file system?

( ) 1. Update the filter to add entry for
2. Use vault checkout command

( ) 1. Update the filter to add entry for
2. Use the vault import command

( ) 1. Update the filter to add entry for
2. Use the vault sync command

( ) 1. Update the filter to add entry for
2. Use the vault rcp command

A

(+) 1. Update the filter to add entry for
2. Use vault checkout command

52
Q

A developer needs to implement a functionality that requires creating a Custom Workflow Step.

Which two steps should the developer take to start developing the custom behavior? (Choose two.)

( ) Implement a Java class extending from class com.adobe.granite.workflow.exec.WorkflowProcess

( ) Implement a Java class implementing the interface com.adobe.granite.workflow.exec.WorkflowProcess

( ) Create a Workflow component node of the Super Resource Type “cq/workflow/components/model/process” under the folder /apps//components

( ) Create a Workflow component node of the Super Resource Type “cq/workflow/components/step” under the folder /etc/workflow/models

A

(+) Implement a Java class implementing the interface com.adobe.granite.workflow.exec.WorkflowProcess

(+) Create a Workflow component node of the Super Resource Type “cq/workflow/components/model/process” under the folder /apps//components

https://experienceleague.adobe.com/docs/experience-manager-learn/forms/adaptive-forms/custom-process-step-aem-workflow.html?lang=en

53
Q

A developer developed a workflow that makes a copy of every node created or modified under a certain path to a different one.
The workflow launches but the nodes are not copied over.

Which two methods should the developer use to resolve this issue? (Choose two.)

( ) Go to Package Manager screen and reinstall the bundle that contains the workflow so it restarts.

( ) Go to Workflow Instances screen and verify that the instance of the workflow is present and check its status.

( ) Go to Workflow Failures screen and check if any instances of the workflow are present.

( ) Go to Workflow Models screen, then delete and recreate the workflow.

( ) Go to Workflow Launchers and create a new launcher for the workflow even if one already exists.

A

(+) Go to Workflow Instances screen and verify that the instance of the workflow is present and check its status.

(+) Go to Workflow Failures screen and check if any instances of the workflow are present.

54
Q

A developer needs an existing workflow to run only when pages are created under a certain folder.

What should the developer create to achieve this?

( ) A Launcher with the field path pointing to the folder and nodetype field have the value cq:Page

( ) A Launcher with the field path pointing to the folder and condition field and have the value jcr:content/jcr:primaryType==cq:Page

( ) A Launcher with the field condition that has the value jcr:content/page

( ) A Launcher with the field exclude that has the value !jcr:nodetype==cq:Page

A

(+) A Launcher with the field path pointing to the folder and nodetype field have the value cq:Page

https://experienceleague.adobe.com/docs/experience-manager-64/administering/operations/workflows-starting.html?lang=en#creating-a-launcher-configuration

55
Q

A developer must create a workflow step that assigns a ‘WorkItem’ to the appropriate person based on who has the least amount work to do.

The group that must perform the action is configured into the workflow.

Which non-deprecated interface should the Java implementation class use to perform the assignment?

( ) com.day.cq.workflow.exec.ParticipantChooser

( ) com.adobe.granite.workflow.exec.ParticipantStepChooser

( ) com.adobe.granite.workflow.exec.WorkflowData

( ) com.day.cq.workflow.exec.WorkItem

A

(+) com.adobe.granite.workflow.exec.ParticipantStepChooser

## The ParticipantStepChooser interface is intended for impls that will define the participant dynamically.

56
Q

A developer needs to create an OSGI service to run on an Author instance and send out newsletters at periodic intervals. Intervals should be customized using the Web Console Configuration. Concurrent execution must be prevented.

Which code snippet should a developer use to achieve this?

( ) @Component(immediate=true,service = Servlet.class, property = {
Constants.SERVICE_DESCRIPTION + “=Send Newsletter Sling Servlet”,
“sling.servlet.methods=” + HttpConstants.METHOD_PUT,
“sling.servlet.concurrent=” + “false”,
“sling.servlet.interval=” + “*/30 * * * * ?”})
public class SendNewsletterServlet extends SlingSafeMethodsServlet {

}

( ) @Component(service = EventHandler.class, immediate = true, property = {
Constants.SERVICE_DESCRIPTION + “=Send NewsLetter”,
EventConstants.EVENT_TOPIC + “=org/apache/sling/api/resource/Resource/”,
EventConstants.interval + “=
/30 * * * * ?”})
public class SendNewsletterListener implements EventHandler {

    boolean isConcurrent = false;
    String interval = "*/30 * * * * ?";
    public void handleEvent(final Event event) {
        event.send(isConcurrent, event.getTopic(),interval);
    }
}

( ) @Component(service = Runnable.class)
@Designate(ocd = SendEmailNewsletterImpl.Config.class)
public class SendEmailNewsletterImpl implements Runnable {

    @ObjectClassDefinition(name = "A simple cleanup task", description = "Simple demo for cron-job like task with properties")
    public static @interface Config {    

        @AttributeDefinition(name = "Cron-job expression")
        String scheduler_expression() default "*/30 * * * * ?";    

        @AttributeDefinition(name = "Concurrent task", description = "Whether or not to schedule this task concurrently")
        boolean scheduler_concurrent() default false;    

        @AttributeDefinition(name = "A parameter", description = "Can be configured in /system/console/configMgr")
        String myParameter() default "";
    }
...
}

( ) @Component(immediate=true, enabled=true, service = Importer.class, property = {
Importer.concurrent +”=false”,
Importer.interval + =”*/30 * * * * ?”})
public class SendEmailNewsletterImpl implements Importer {

}

A

( ) @Component(service = Runnable.class)
@Designate(ocd = SendEmailNewsletterImpl.Config.class)
public class SendEmailNewsletterImpl implements Runnable {

    @ObjectClassDefinition(name = "A simple cleanup task", description = "Simple demo for cron-job like task with properties")
    public static @interface Config {    

        @AttributeDefinition(name = "Cron-job expression")
        String scheduler_expression() default "*/30 * * * * ?";    

        @AttributeDefinition(name = "Concurrent task", description = "Whether or not to schedule this task concurrently")
        boolean scheduler_concurrent() default false;    

        @AttributeDefinition(name = "A parameter", description = "Can be configured in /system/console/configMgr")
        String myParameter() default "";
    }
...
}
57
Q

A developer creates a Sling Servlet. The Sling Servlet is bound to a path ( /service/sling/sample). Refer to the resulting code below.

@Component(immediate=true,service = {Servlet.class})
@SlingServletPaths(value = { “/service/sling/sample” })

What should the developer do to make the servlet access controlled using the default ACLs?

( ) Add @SlingServletPrefix(value = “/apps”) annotation

( ) Modify @SlingServletPaths(value = { “/bin/sling/sample” })

( ) Use @SlingServletResourceTypes instead of @SlingServletPaths

( ) Add @SlingServletName(servletName = “AccessControlServlet”) annotation

A

(+) Use @SlingServletResourceTypes instead of @SlingServletPaths

https://sling.apache.org/documentation/the-sling-engine/servlets.html#caveats-when-binding-servlets-by-path

## path-bound servlets cannot be access controlled using the default JCR repository ACLs

58
Q

A developer creates the following code snippet to implement a simple polling importer to fetch stock prices from an external source:

package com.adobe.training.core.core;

@Component(immediate=true, enabled=true, service = Importer.class, property = {Importer.SCHEME_PROPERTY +”=stock”})
public class StockDataImporter implements Importer {

private final Logger logger = LoggerFactory.getLogger(getClass());
private final String SOURCE_URL = "https://query.mystocks.com/v7/finance/quote?symbols=";
private static final String LASTTRADE = "lastTrade";

@Reference
private SlingRepository repo;

@Override
public void importData(final String scheme, final String dataSource, final Resource resource) throws ImportException {
    try {
        ParseJson parseJson = new ParseJson();
        String lastTrade = parseJson.loadJson(SOURCE_URL+dataSource);
        writeToRepository(dataSource, lastTrade, resource);
    } catch (Exception e) {
        logger.error("Exception", e);
    }
}

private void writeToRepository(final String stockSymbol, final String lastTrade, final Resource resource) throws RepositoryException {
    Session session= repo.loginService(null, repo.getDefaultWorkspace());
    Node parent = resource.adaptTo(Node.class);
    Node stockPageNode = JcrUtil.createPath(parent.getPath() + "/" + stockSymbol, "cq:Page", session);
    Node lastTradeNode = JcrUtil.createPath(stockPageNode.getPath() + "/lastTrade", "nt:unstructured", session);
    lastTradeNode.setProperty(LASTTRADE, lastTrade);
    session.save();
    session.logout();
} }

The polling importer needs to fetch stock prices for a specific stock symbol and needs to be triggered every 5 minutes.

Which node structure should the developer create in CRX to make sure that the code shown is executed successfully?

( ) + /etc/importers/polling/stock
- sling:resourceType=com.adobe.training.core.core.StockDataImporter
- stock=”ADBE”
- interval=300
- target=”/content”

( ) + /etc/importers/polling/stock
- jcr:mixinTypes=[ “cq:PollConfig”]
- source=”stock:ADBE”
- interval=300
- target=”/content”

( ) + /apps/system/config/com.adobe.training.core.core.StockDataImporter [sling:OsgiConfig]
- sling:resourceType=com.adobe.training.core.core.StockDataImporter
- SCHEME_PROPERTY=”ADBE”
- target=”/content”
- interval=5

( ) + /apps/system/config/com.adobe.training.core.core.StockDataImporter [sling:OsgiConfig]
- SCHEME_PROPERTY=”stock”
- source=”ADBE”
- target=”/content”
- interval=5

A

(+) + /etc/importers/polling/stock
- jcr:mixinTypes=[ “cq:PollConfig”]
- source=”stock:ADBE”
- interval=300
- target=”/content”

https://developer.adobe.com/experience-manager/reference-materials/6-4/javadoc/com/day/cq/polling/importer/PollConfig.html

59
Q

A developer creates an OSGi service to access JCR content. Refer to the code snippet from the OSGi service below.

public class AccessRepository {
private static final String SERVICE_ACCOUNT_IDENTIFIER = “sample-service”;

private final String getServiceUser() {
final Map authInfo = Collections.singletonMap(ResourceResolverFactory.SUBSERVICE,(Object)
SERVICE_ACCOUNT_IDENTIFIER);
ResourceResolver serviceResolver = resourceResolverFactory.getServiceResourceResolver(authInfo))

}
}

Bundle ID = com.adobe.aem.samples-bundle.

Which set of steps should the developer take to make sure that the code works?

( ) 1. Create a System User called systemUser with appropriate ACLs
2. Modify the Apache Sling Service User Mapper Service Amendment
3. Set user.mapping to com.adobe.aem.samples-bundle:sample-service=systemUser

( ) 1. Create an AEM User called serviceUser with appropriate ACLs
2. Modify the Apache Sling Service User Mapper Service Amendment
3. Set user.mapping to com.adobe.aem.samples-bundle:sample-service=serviceUser

( ) 1. Create a System User called systemUser with appropriate ACLs
2. Modify the Apache Sling Service User Mapper Service
3. Set user.default to com.adobe.aem.samples-bundle:sample-service=systemUser

( ) 1. Create an AEM User called serviceUser with appropriate ACLs
2. Modify the Apache Sling Service User Mapper Service
3. Set user.default to com.adobe.aem.samples-bundle:sample-service=serviceUser

A

(+) 1. Create a System User called systemUser with appropriate ACLs
2. Modify the Apache Sling Service User Mapper Service Amendment
3. Set user.mapping to com.adobe.aem.samples-bundle:sample-service=systemUser

https://sling.apache.org/documentation/the-sling-engine/service-authentication.html#service-user-mappings

60
Q

A banking AEM application contains functionality to calculate a mortgage rate based on user input. A servlet in place calculates the result in the backend. A call to an internal third-party REST service is required to retrieve the average object value based on a given zip code.

The following three service interfaces are used:

‘MortgageCalculationServlet’, ‘MortgageCalculationService’ and ‘ObjectValueLookupRestService’ where ‘MortgageCalculationServlet’ has a dependency to ‘MortgageCalculationService’ and ‘MortgageCalculationService’ has a dependency to ‘ObjectValueLookupRestService’.

The calculation has many combinations of input parameters and edge cases, so the JUnit coverage must be as high as possible.

Which two strategies should the developer use to ensure testability of the application code? (Choose two.)

( ) Deploy a third party dependency injection container to wire dependencies more efficiently in application code

( ) Use the standard OSGi ‘@Reference’ annotation to wire the dependencies in application code

( ) Use a mock framework to be able to create and inject mocks in the test code

( ) Use ‘BundleContext.getServiceReference(…)’ and ‘BundleContext.getService(…)’ in application code to look up the required services just before usage

( ) Use static methods to avoid boilerplate in application code

A

(+) Use the standard OSGi ‘@Reference’ annotation to wire the dependencies in application code

(+) Use a mock framework to be able to create and inject mocks in the test code

–> See https://sling.apache.org/documentation/development/osgi-mock.html#getting-osgi-mock-objects for valid BundleContext examples

61
Q

A custom AEM application contains a service component that needs to access the JCR repository within the activate method. The activate method uses ResourceResolverFactory.getServiceResourceResolver(…) without specifying a sub service name.

What should a developer do to make sure the user service mapping for the service component is available?

( ) Create a field of type ServiceUserMapped and annotate it with @Reference

( ) Wait for the service ServiceUserMapper via BundleContext.getServiceReference(…)

( ) Create a field of type ServiceUserMapper and annotate it with @Reference using ReferencePolicy.STATIC

( ) Create a field of type ServiceUserMapped and annotate it with @Reference using ReferencePolicy.DYNAMIC

A

(+) Create a field of type ServiceUserMapped and annotate it with @Reference

62
Q

The custom AEM application needs to keep a flat list of all page paths underneath /content/thesite in memory for a real-time integration with high performance requirements.

The developer has the following intermediate state of the class:

@Component(immediate = true)
public class PagePathsCacheImpl implements PagePathsCache {

@Reference
ResourceResolverFactory resourceResolverFactory;

List pagePaths = new CopyOnWriteArrayList();

@Activate
public void activate() {
    // ... here the initial state of pagePaths is filled via resourceResolver.findResources(...)
}

public List getPagePaths() {
    return pagePaths;
} }

What action should the developer take to meet these requirements?

( ) Make the class also implement ResourceChangeListener and add
property = {
ResourceChangeListener.CHANGES + “=ADDED”,
ResourceChangeListener.CHANGES + “=REMOVED”,
ResourceChangeListener.PATHS + “=/content/thesite”
}
to the @Component annotation. In method onChange filter received list of ResourceChange for pages only and update field pagePaths accordingly.

( ) Make the class also implement ResourceChangeListener and add
property = {
ResourceChangeListener.CHANGES + “=ADDED”,
ResourceChangeListener.CHANGES + “=REMOVED”,
ResourceChangeListener.PRIMARY_TYPES + “=cq:Page”
ResourceChangeListener.PATHS + “=/content/thesite”
}
to the @Component annotation. In method onChange update field pagePaths according to received list of ResourceChange.

( ) Make the class also implement ResourceObservationManager and add
property = {
ResourceObservationManager.CHANGES + “=ADDED”,
ResourceObservationManager.CHANGES + “=CHANGED”,
ResourceObservationManager.CHANGES + “=REMOVED”,
ResourceObservationManager.PATHS + “=/content/thesite”
}
to the @Component annotation. In method onChange filter received list of ResourceChange for pages only and adjust field pagePaths accordingly.

( ) Make the class also implement ResourceObservationManager and add
property = {
ResourceObservationManager.CHANGES + “=ADDED”,
ResourceObservationManager.CHANGES + “=REMOVED”,
ResourceObservationManager.PRIMARY_TYPES + “=cq:Page”
ResourceObservationManager.PATHS + “=/content/thesite”
}
to the @Component annotation. In method onChange update field pagePaths according to received list of ResourceChange.

A

(+) Make the class also implement ResourceChangeListener and add
property = {
ResourceChangeListener.CHANGES + “=ADDED”,
ResourceChangeListener.CHANGES + “=REMOVED”,
ResourceChangeListener.PATHS + “=/content/thesite”
}
to the @Component annotation. In method onChange filter received list of ResourceChange for pages only and update field pagePaths accordingly.

https://sling.apache.org/apidocs/sling9/org/apache/sling/api/resource/observation/ResourceChangeListener.html

63
Q

A service component periodically retrieves content from an external REST interface and saves the information in JCR. The REST endpoint is configured via an OSGi service property. There is one URL for production (runmode ‘prod’) and another URL for all other environments.

How should a developer configure the OSGi service?

( ) Underneath /apps/, create the sub folders ‘config’ and ‘config.prod’ and a file with the name .config each and list the properties as key value pairs in there

( ) Underneath /config//settings, create the sub folders ‘config’ and ‘config.prod’ and a file with the name .config each and list the properties as key value pairs in there

( ) Underneath /apps//settings, create the sub folders ‘global’ and ‘prod’ and node with name .conf each and configure the properties via node properties

( ) Underneath /config//settings, create the sub folders ‘config.default’ and ‘config.prod’ and a file with the name .config each and list the properties as key value pairs in there

A

(+) Underneath /apps/, create the sub folders ‘config’ and ‘config.prod’ and a file with the name .config each and list the properties as key value pairs in there

64
Q

An application runs specific license checks against certain DAM assets every day. It should send an email to a configured list if it finds warnings, and mark the asset accordingly. A service component that uses the Apache Sling Scheduler Service is created. DAM assets that must NOT be used anymore are hidden using ACLs and the license check must re-check them.

How should a developer obtain a resource resolver that can read and update the DAM assets?

( ) Set up a cron job with curl calls with the admin user and use request.getResource().getResourceResolver()

( ) Configure the user ‘admin’ in PID org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl as user.default and make sure the service user exists and has jcr:read and jcr:write permissions

( ) Create a configuration for PID org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-damaccess that references a pre-created service user with r/w permissions and use ResourceResolverFactory.getServiceResourceResolver(…)

( ) Create a configuration line in PID com.day.cq.security.ACLSetup for the user that you obtain a session for via ResourceResolverFactory.getResourceResolver(…)

A

(+) Create a configuration for PID org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-damaccess that references a pre-created service user with r/w permissions and use ResourceResolverFactory.getServiceResourceResolver(…)

65
Q

A developer needs to implement a service component that should be manually configured by operations to react on operational circumstances. The service component should NOT be active by default. The service has the properties ‘myservice.name’ (one string value) and ‘myservice.stringValues’ (a list of string values) to be configured.

The developer needs to use OSGi Metatype annotations to make those properties configurable in the Apache Felix Web Console.

Which set of steps should the developer take to meet these requirements?

( ) 1. Create an annotation interface as inner class of the service component and annotate it with @ObjectClassDefinition
2. Apply @AttributeDefinition for the methods myservice_name and myservice_stringValues
3. Use the @Component annotation with configurationPolicy = ConfigurationPolicy.REQUIRE on the service component
4. Use the @Designate annotation to link the service component to the created configuration annotation interface
5. Use the activate method of the service component class to get the configuration annotation interface class injected

( ) 1. For the class fields myserviceName and myserviceStringValues, add a @Property annotation each with names set to myservice.name and myservice.stringValues respectively
2. Use the @Component annotation with configurationFactory = true on the service component class
3. Use the @Service service component class
4. The configuration is automatically injected into the fields by the service component runtime.

( ) 1. Create an annotation interface as inner class of the service component and annotate it with @ObjectClassDefinition
2. Apply @AttributeDefinition for the methods myservice.name and myservice.stringValues
3. Use the @Component annotation with configurationPolicy = ConfigurationPolicy.REQUIRE on the service component
4. Use the @Designate annotation to link the service component to the created configuration annotation interface
5. Use the activate method of the service component class to get the configuration annotation interface class injected

( ) 1. For the class fields myserviceName and myserviceStringValues, add a @AttributeDefinition annotation each with names set to myservice.name and myservice.stringValues respectively
2. Use the @Component annotation with configurationFactory = true on the service component class
3. Use the @Service service component class
4. Use the activate method of the service component class to get the configuration annotation interface class injected

A

(+) 1. Create an annotation interface as inner class of the service component and annotate it with @ObjectClassDefinition
2. Apply @AttributeDefinition for the methods myservice_name and myservice_stringValues
3. Use the @Component annotation with configurationPolicy = ConfigurationPolicy.REQUIRE on the service component
4. Use the @Designate annotation to link the service component to the created configuration annotation interface
5. Use the activate method of the service component class to get the configuration annotation interface class injected

http://docs.osgi.org/javadoc/r6/cmpn/org/osgi/service/metatype/annotations/AttributeDefinition.html

The id of this AttributeDefinition is generated from the name of the annotated method. The annotated method name is processed from left to right changing each character as follows:

A dollar sign (‘$’ \u0024) is removed unless it is followed by another dollar sign in which case the two consecutive dollar signs ( ‘$$’) are changed to a single dollar sign.
A low line (‘_’ \u005F) is changed to a full stop ( ‘.’ \u002E) unless is it followed by another low line in which case the two consecutive low lines (‘__’) are changed to a single low line.
All other characters are unchanged.
This id is the value of the id attribute of the generate AD element and is used as the name of the corresponding configuration property.

66
Q

A developer needs to configure sets of values according to the following parameters:

  • Varies for different staging environments
  • Varies for different content paths
  • Differs between author and publish

Which implementation strategy should the developer use to meet these requirements?

( ) A custom cloud configuration

( ) A context aware configuration with buckets using an OSGi configuration

( ) One OSGi configuration for the set of values with runmodes

( ) A JCR property at the content root node of the site with inheritedPageProperties

A

(+) A context aware configuration with buckets using an OSGi configuration

https://sling.apache.org/documentation/bundles/context-aware-configuration/context-aware-configuration.html

67
Q

An OSGi component service factory is expected to have more than 50 configuration items. The property myservice.name is configured to a human readable name to describe the configuration instance.

The readable names of the configuration instances must appear in the list of configurations at `/system/console/configMgr’.

How should the developer implement the object class definition interface to meet the requirements?

( ) Add a method with name webconsole_configurationFactory_nameHint, annotate it with @AttributeDefinition and return the default “{myservice.name}”

( ) Add a method with name webconsoleConfigurationFactoryNameHint, annotate it with @AttributeDefinition and return the default “{myservice.name}”

( ) Add a method with name webconsole_configurationFactory_nameHint, annotate it with @AttributeDefinition and return the default “{myservice_name}”

( ) Add annotation @WebConsoleNameHint(“{myservice.name}”) to object class definition interface

A

(+) Add a method with name webconsole_configurationFactory_nameHint, annotate it with @AttributeDefinition and return the default “{myservice.name}”

68
Q

An application contains an OSGi configuration that contains a password.

How should a developer prevent this sensitive information from being stored in plain text in JCR?

( ) 1. Use console at ‘/system/console/crypto’ to encrypt the value
2. Either create an encrypted value for each AEM instance and use runmodes to apply the different values or make sure relevant instances share the same master key
3. When loading the value in the code, call ‘CryptoSupport.unprotect(…)’ before using the value

( ) 1. Use console at ‘/system/console/crypto’ to encrypt the value
2. Either create an encrypted value for each AEM instance and use runmodes to apply the different values or make sure relevant instances share the same master key
3. Sensitive information is automatically decrypted using the ‘CryptoSupport’ OSGi service before the value is returned

( ) 1. Use console at ‘/system/console/configMgr’ and tick the checkbox “encrypt” before saving a configuration
2. Either create an encrypted value for each AEM instance and use runmodes to apply the different values or make sure relevant instances share the same master key
3. Sensitive information is automatically decrypted using the ‘CryptoSupport’ OSGi service before the value is returned

( ) 1. Use console at ‘/system/console/configMgr’ and tick the checkbox “encrypt” before saving a configuration
2. Use encrypted values work across all instances
3. When loading the value in the code, call ‘CryptoSupport.unprotect(…)’ before using the value

A

(+) 1. Use console at ‘/system/console/crypto’ to encrypt the value
2. Either create an encrypted value for each AEM instance and use runmodes to apply the different values or make sure relevant instances share the same master key
3. When loading the value in the code, call ‘CryptoSupport.unprotect(…)’ before using the value

https://experienceleague.adobe.com/docs/experience-manager-64/administering/security/encryption-support-for-configuration-properties.html?lang=en

## Note: AEM now provides a Configuration Plugin to decrypt configuration properties. This AEM Plugin will AUTOMATICALLY decrypt and retrieve the clear text properties.

## Note: Services that expect an encrypted value need to use the IsProtected check to see if the value is encrypted before trying to decrypt it, as it may already have been decrypted.

69
Q

A custom application contains a service component com.proj.ServiceComponent. A developer needs to configure the string value name and integer value intVal. The actual configuration must be deployed using a content package.

What should the developer do to meet these requirements?

Use a file com.proj.ServiceComponent.xml with content

( )

( ) Use a file com.proj.ServiceComponent.config with content
name=”Service Name”
intVal=I”5”

( ) Use a file com.proj.ServiceComponent.cfg with content
name=”Service Name”
intVal=I”5”

( ) Use a file com.proj.ServiceComponent.xml with content

A

(+) Use a file com.proj.ServiceComponent.config with content
name=”Service Name”
intVal=I”5”

70
Q

A custom AEM application has a run time dependency to a third party OSGi bundle that is NOT included in out-of-the-box AEM. The third party dependency needs to be available for multiple applications and be upgraded separately from the custom AEM application.

How should a developer make sure that the bundle is installed on all environments?

( ) Add the dependency to the third party bundle in the pom.xml of the project bundle

( ) Embed the bundle in a content package to have it automatically deployed

( ) Embed the third party bundle in the bundle that depends on it

( ) Declare the dependency correctly using a link to the OSGi Bundle Repository (OBR)

A

(+) Embed the bundle in a content package to have it automatically deployed

71
Q

A custom AEM application is using the PageManager API.

What should a developer add to make the application compile and run correctly in AEM?

( ) a maven dependency to bunde cq-wcm-api to the content package

( ) a maven dependency to bunde cq-wcm-core to the application bundle

( ) a maven dependency to AEM uber-jar to the content package

( ) a maven dependency to AEM uber-jar to the application bundle

A

(+) a maven dependency to AEM uber-jar to the application bundle

72
Q

A developer is working on a complex project with multiple bundles. One bundle provides an OSGi service for other bundles.

Which two options are necessary to ensure that the other bundles can reference that OSGi service? (Choose two.)

( ) The service needs to correctly declare metatype information.

( ) The bundle providing the service needs to export the java package of the service interface.

( ) The bundles consuming the service need to import the fully qualified name of the service interface.

( ) The bundle providing the service needs to contain an adequate SCR descriptor file.

( ) The bundle providing the service needs to contain a whitelist of allowed consumer bundles.

A

(+) The bundle providing the service needs to export the java package of the service interface.

(+) The bundle providing the service needs to contain an adequate SCR descriptor file.

73
Q

A custom bundle of an application is in state “Installed” after deploying it with Maven.

What should a developer do to change it to state “Active”?

( ) Reinstall the content package using the package manager

( ) Use the “Update” action for the bundle in the Apache Felix Web Console

( ) Use the “Start” action for the bundle in the Apache Felix Web Console

( ) Ensure all OSGi requirements are met and re-deploy using Maven

A

(+) Ensure all OSGi requirements are met and re-deploy using Maven

74
Q

A custom AEM application contains Bundle A and Bundle B. Bundle A has a dependency to Bundle B via Import-Package.

How can both bundles be deployed most efficiently across all environments?

( ) Embed both bundles in one content package; the dependency via Import-Package is enough to ensure correct installation

( ) Create one content package per bundle and use a package dependency to ensure installation order

( ) Embed both bundles in one content package and use property ‘installationOrder’ in package properties for correct bundle installation order

( ) Use the Felix Web Console to upload the bundles in the correct order

A

(+) Embed both bundles in one content package; the dependency via Import-Package is enough to ensure correct installation

75
Q

Which file name contains the rule set of files that will be included in a content package when being built?

Which file name contains the rule set of files that will be included in a content package when being built?

( ) rules.xml

( ) filter.xml

( ) content.xml

( ) vault.xml

A

(+) filter.xml

https://jackrabbit.apache.org/filevault/filter.html

76
Q

In which maven build phase is the content package assembled?

( ) package

( ) deploy

( ) install

( ) compile

A

(+) package

https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

77
Q

Which maven plugin is required to install a content package on a local AEM environment using maven?

( ) Maven Install Plugin

( ) Maven Bundle Plugin

( ) FileVault Package Maven Plugin

( ) Content Package Maven Plugin

A

(+) Content Package Maven Plugin

https://experienceleague.adobe.com/docs/experience-manager-65/developing/devtools/vlt-mavenplugin.html?lang=en

78
Q

What is the artifact ID of the maven dependency that contains all core AEM APIs?

( ) aem-jar

( ) uber-jar

( ) api-jar

( ) core-jar

A

(+) uber-jar

79
Q

Which XML <”tag”> is used within the vault package definition to add a new path to a content package?

( ) filter

( ) path

( ) rule

( )content

A

(+) filter

–> See https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/implementing/developer-tools/maven-plugin.html?lang=en#using-filters

80
Q

While creating a content package, a developer needs to specify the top-level starting place in the content repository in the filter.xml file.

Which attribute of the tag should the developer use to meet this requirement?

( ) root

( ) origin

( ) mode

( ) top

A

(+) root

81
Q

A developer needs to ensure that the path /content//segments exists on all environments with the correct initial content that the developer provides in a package. Content that exists in that path should NOT be affected.

Which import mode should the developer use in the filter definition?

( ) optional

( ) merge

( ) replace

( ) update

A

(+) merge

https://jackrabbit.apache.org/filevault/filter.html#include-and-exclude-elements

82
Q

A developer needs to install a content package on an AEM environment. However a content package with the same name is already installed.

What would be the safest way for the developer to install the content package to make sure only the changes of the new content package get applied?

( ) Use the “Force Upload” option when uploading the new content package.

( ) Uninstall the existing content package before installing the new content package.

( ) Install the content package using the OSGi web console.

( ) Upload the content package to the CRX Package Share before installing it.

A

(+) Use the “Force Upload” option when uploading the new content package.

83
Q

A developer creates a new AEM project based on a maven archetype. The project contains a folder containing all the Java classes and a folder containing the node structure. Building the project results in a project-name.jar and a project-name.zip file.

Which manual step should the developer take to install the project on a local environment?

( ) Install the project-name.zip and project-name.jar at /crx/packmgr/index.jsp

( ) Install the project-name.zip and project-name.jar at /system/console

( ) Install the project-name.zip at /crx/packmgr/index.jsp

( ) Install the project-name.jar at /system/console

A

(+) Install the project-name.zip at /crx/packmgr/index.jsp

84
Q

A developer is working on a project locally and needs to install packages manually. The deployments to the localhost must be automated to speed up development. This functionality must be toggled on and off, depending on the needs of the developer.

Which step should the developer take to achieve this?

( ) Add a maven profile and configure the content package maven plugin within this profile.

( ) Run maven with the deploy phase. Maven will install the package on all local AEM instances running without further configuration.

( ) Configure the maven install plugin by defining the target URL, username, and password as maven properties.

( ) Write a script that does a PUT call to AEM each time maven builds a new package.

A

(+) Add a maven profile and configure the content package maven plugin within this profile.

https://maven.apache.org/settings.html#profiles

85
Q

A developer is installing a content package with the package manager. The developer needs to restrict the approximate number of nodes in a batch that is saved to persistent storage in one transaction.

How should the developer modify the number of transient nodes to be triggered until automatic saving?

( ) Modify the export package manifest header and copy the content package to AEM installation folder.

( ) Change the value of Save Threshold in the Install Package dialog-box.

( ) Select the option MergePreserve for the Access Control Handling drop-down in the Install Package dialog-box.

( ) AEM instances automatically modify the number of transient nodes based on the load balancing.

A

(+) Change the value of Save Threshold in the Install Package dialog-box.

https://experienceleague.adobe.com/docs/experience-manager-65/administering/contentmanagement/package-manager.html?lang=en#installing-packages

86
Q

An AEM project contains a maven module that builds a bundle. The developer needs to update the bundle in an AEM instance without installing a content package.

Which two ways could the developer deploy the bundle directly to the AEM? (Choose two.)

( ) Ensure the plugin org.apache.sling:sling-maven-plugin is configured with the correct slingUrl and execution for the plugin goal install in a profile and run mvn clean install -P… with that profile.

( ) Configure

    org.apache.sling
    sling-maven-plugin
    2.4.0
    
        http://localhost:4502/system/console
        admin
        admin
    

in the pom.xml of the bundle and run mvn clean install

( ) Configure

    org.apache.sling
    maven-install-plugin
    2.4.0

in the pom.xml of the bundle and run mvn clean install

( ) Run mvn clean install org.apache.sling:sling-maven-plugin:2.4.0:install -Dsling.url=http://localhost:4502/system/console regardless of configuration in pom.xml

( ) Run mvn clean install org.apache.sling:maven-install-plugin:2.4.0:install -Dsling.url=http://localhost:4502/system/console regardless of configuration in pom.xml

A

(+) Ensure the plugin org.apache.sling:sling-maven-plugin is configured with the correct slingUrl and execution for the plugin goal install in a profile and run mvn clean install -P… with that profile.

(+) Run mvn clean install org.apache.sling:sling-maven-plugin:2.4.0:install -Dsling.url=http://localhost:4502/system/console regardless of configuration in pom.xml

https://sling.apache.org/components/sling-maven-plugin/plugin-info.html

87
Q

One content package of a custom application contains the following content paths.

/apps/myproj/install
/apps/myproj/components
/apps/myproj/i18n

The server also contains the content path /apps/myproj/configuration that must NOT be touched when installing the package.

Which two filter definitions should a developer use to always update only the contained paths upon installation in the server? (Choose two)

( )

( )

( )

( )

( )

A

(+)

(+)

https://jackrabbit.apache.org/filevault/filter.html#include-and-exclude-elements

## The filter.xml consists of a set of filter elements, each with a mandatory root attribute and an optional list of include and exclude child elements.

88
Q

A developer wants to change the log level for a custom API.

Which OSGi configuration should the developer modify?

( ) Apache Sling Logging Writer Configuration

( ) Apache Sling Log Tracker Service

( ) Apache Sling Logging Logger Configuration

( ) Adobe Granite Log Analysis Service

A

(+) Apache Sling Logging Logger Configuration

Adobe Experience Manager Web Console -> OSGi ->
Configuration

89
Q

A developer wants to automatically truncate request log files once they exceed 10 MB.

Which OSGi configuration should the developer modify?

( ) Apache Sling Logging Configuration

( ) Apache Sling Logging Writer Configuration

( ) Apache Sling Customizable Request Data Logger

( ) Adobe Granite Log Analysis Service

A

(+) Apache Sling Logging Writer Configuration

90
Q

The dependency of an AEM project fails when a developer configures using Apache Maven. Refer to the error information below.

[INFO] ————————————————————-
[ERROR] COMPILATION ERROR :
[INFO] ————————————————————-
[ERROR] /training/core/src/main/java/com/adobe/training/core/listeners/SimpleResourceListener.java:[18,28] package org.apache.sling.api does not exist
[ERROR] /training/core/src/main/java/com/adobe/training/core/filters/LoggingFilter.java:[26,28] package org.apache.sling.api does not exist
[ERROR] /training/core/src/main/java/com/adobe/training/core/filters/LoggingFilter.java:[27,31] package org.apache.sling.engine does not exist
[ERROR] /training/core/src/main/java/com/adobe/training/core/models/HelloWorldModel.java:[22,37] package org.apache.sling.api.resource does not exist
[ERROR] /training/core/src/main/java/com/adobe/training/core/models/HelloWorldModel.java:[25,33] package org.apache.sling.settings does not exist
[ERROR] /training/core/src/main/java/com/adobe/training/core/models/HelloWorldModel.java:[31,13] cannot find symbol
symbol: class SlingSettingsService
location: class com.adobe.training.core.models.HelloWorldModel

What should a developer add to the pom.xml to fix the Maven build?

( )
com.adobe.aem
uber-jar
6.4.0
apis
provided

( )
com.adobe.aem
aem-api
6.4.0
apis
provided

( )

        adobe-public-releases
        Adobe Public Repository
        https://repo.adobe.com/nexus/content/groups/public/
        default
    
    ...

( )

        src/main/content/jcr_root
        false
        
            **/.vlt
            **/.vltignore
            libs/
A

(+)
com.adobe.aem
uber-jar
6.4.0
apis
provided

https://experienceleague.adobe.com/docs/experience-manager-65/deploying/upgrading/upgrading-code-and-customizations.html?lang=en#update-the-aem-uber-jar-version
https://javadoc.io/doc/com.adobe.aem/uber-jar/latest/index.html

91
Q

The following stack trace is written in the error.log file after installing a custom application package.

2.02.2019 15:21:59.659 INFO [OsgiInstallerImpl] org.apache.sling.installer.core.impl.tasks.BundleStartTask Could not start bundle com.adobe.cq.sample-bundle [526]. Reason: {}. Will retry.
org.osgi.framework.BundleException: Unable to resolve com.adobe.cq.sample-bundle 526: missing requirement [com.adobe.cq.sample-bundle 526] osgi.wiring.package; (&(osgi.wiring.package=com.example.customlib)(version>=3.8.0)(!(version>=4.0.0))) Unresolved requirements: [[com.adobe.cq.sample-bundle 526] osgi.wiring.package; (&(osgi.wiring.package=com.example.customlib)(version>=3.8.0)(!(version>=4.0.0)))]
at ….
12.02.2019 15:21:59.671 INFO [OsgiInstallerImpl] org.apache.sling.installer.core.impl.tasks.BundleStartTask Could not start bundle com.adobe.cq.sample-bundle [526]. Reason: {}. Will retry.
org.osgi.framework.BundleException: Unable to resolve com.adobe.cq.sample-bundle 526: missing requirement [com.adobe.cq.sample-bundle 526] osgi.wiring.package; (&(osgi.wiring.package=com.example.customlib)(version>=3.8.0)(!(version>=4.0.0))) Unresolved requirements: [[com.adobe.cq.sample-bundle 526] osgi.wiring.package; (&(osgi.wiring.package=com.example.customlib)(version>=3.8.0)(!(version>=4.0.0)))]
at ….

What are two different ways that the developer could resolve the OSGi bundle dependency error? (Choose two.)

( ) Upload the file com.example.customlib-3.8.jar into /apps//libs folder in CRX DE to make it available for the OSGi bundle.

( ) Go to the project parent pom.xml file and add the dependency with scope “compile” and instruct the bundle plugin to include the dependency in runtime.

( ) Install the jar in AEM via the curl command ‘curl -u username:password -F file=@”./com.example.customlib-3.8.jar” -F name=“Dependency” -F force=true -F install=true http://localhost:4502/crx/packmgr/service.jsp –progress-bar -o upload.txt’.

( ) Create a folder named “deploy” under $AEM_HOME/crx-quickstart/ and copy com.example.customlib-3.8.jar in there so AEM uploads it automatically.

( ) Go to the Dependency Finder in the System Console to find if another bundle is exporting a similar version of the classes and change the project pom.xml to match the same version.

A

(+) Go to the project parent pom.xml file and add the dependency with scope “compile” and instruct the bundle plugin to include the dependency in runtime.

(+) Go to the Dependency Finder in the System Console to find if another bundle is exporting a similar version of the classes and change the project pom.xml to match the same version.

–> See https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#dependency-scope
–> See https://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html

92
Q

An OSGi bundle Activator.java is registered through a service DeveloperInfo.java

DeveloperInfo.java

package com.adobe.training.core;
public interface DeveloperInfo {

}

Activator.java

package com.adobe.training.core;
import org.osgi.service.component.annotations.*;
@Component(service=DeveloperInfo.class)
public class Activator {
private final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(getClass());

@Activate
public void start() {
    logger.info("##################Started##################");
}

@Deactivate
public void stop() {
    logger.info("##################Stopped##################");
} }

Maven install generates an error during deployment. Refer to the error information below:

[INFO] — maven-bundle-plugin:3.3.0:bundle (default-bundle) @ training.core —
[ERROR] Bundle com.adobe:training.core:bundle:0.0.1-SNAPSHOT : Class com.adobe.training.core.Activator is not assignable to specified service com.adobe.training.core.DeveloperInfo
[ERROR] Error(s) found in bundle configuration
[INFO] ————————————————————————
[INFO] BUILD FAILURE
[INFO] ————————————————————————
[INFO] Total time: 5.572 s
[INFO] Finished at: 2019-02-12T16:10:25-08:00
[INFO] Final Memory: 22M/384M
[INFO] ————————————————————————
[ERROR] Failed to execute goal org.apache.felix:maven-bundle-plugin:3.3.0:bundle (default-bundle) on project training.core: Error(s) found in bundle configuration -> [Help 1]

Which action should the developer take to resolve the build error?

( ) Interface DeveloperInfo does NOT have any method

( ) Activator class is NOT implementing DeveloperInfo interface

( ) @Service annotation is missing in DeveloperInfo.java

( ) The required Maven repository for OSGi is missing

A

( ) Activator class is NOT implementing DeveloperInfo interface

93
Q

A developer is creating a new OSGi bundle com.custom.package.b to expose new services.

com.custom.package.a is already installed and active in the system and has the following package definition:

Export-Package: com.custom.package.a;version=”2.0”
Import-Package: com.sample.package.a;version=”[1,2)”
Classpath: .,com.sample.package.b-3.0.jar

The system console shows the following package availability:

com.sample.package.a;version=”1.5”
com.sample.package.c;version=”3.0”

Bundle com.custom.package.b to be installed has the following package definition:

Export-Package: com.custom.package.b;version=”1.0”
Import-Package: com.custom.package.a;version=[1,2)”,com.sample.package.b;version=”[3.0,3.0]”,com.sample.package.c;version=[2,3)

What will happen when the developer uploads the bundle com.custom.package.b into the system?

( ) The bundle will install and activate successfully.

( ) The bundle will install but fail the activation due to unsatisfied dependency com.sample.package.b

( ) The bundle will install but fail the activation due to unsatisfied dependency com.sample.package.c

( ) The bundle will install but fail the activation due to unsatisfied dependencies com.sample.package.b and com.sample.package.c

A

(+) The bundle will install but fail the activation due to unsatisfied dependencies com.sample.package.b and com.sample.package.c

https://docs.oracle.com/middleware/1212/core/MAVEN/maven_version.htm#MAVEN402

94
Q

Which environment variable in the AEM start script should a developer modify to enable remote debugging?

Which environment variable in the AEM start script should a developer modify to enable remote debugging?

( ) CQ_HOST

( ) CQ_PORT

( ) CQ_JVM_OPTS

( ) CQ_RUNMODE

A

(+) CQ_JVM_OPTS

https://experienceleague.adobe.com/docs/experience-manager-65/deploying/deploying/command-line-start-and-stop.html?lang=en

https://www.linkedin.com/pulse/how-start-aem-debug-mode-windows-linux-macos-aliaksei-baranouski/

95
Q

How should a developer enable remote debugging of an AEM server without modifying the AEM start script?

( ) Enable the remote debugging service through the AEM Cloud Services menu

( ) Include an additional JVM parameter when starting AEM with java -jar

( ) Rename the quickstart jar file to include the additional debug settings

( ) Enable the remote debugging service through the AEM Web Console

A

(+) Include an additional JVM parameter when starting AEM with java -jar

96
Q

Which log file should a developer use to search for exception stacktraces?

( ) /crx-quickstart/logs/error.log

( ) /crx-quickstart/logs/info.log

( ) /crx-quickstart/logs/access.log

( ) /crx-quickstart/logs/request.log

A

(+) /crx-quickstart/logs/error.log

97
Q

From which AEM Web Console should a developer access and download full AEM Log Files?

( ) OSGI -> Sling Log Service

( ) Status -> Log files

( ) Web Console -> System Information

( ) AEM -> Log files

A

(+) Status -> Log files

98
Q

Which log file contains AEM application request and response entries?

( ) request.log

( ) response.log

( ) audit.log

( ) history.log

A

(+) request.log

99
Q

An AEM site experiences slower page loads. A developer needs to identify the slow running requests.

How should a developer analyze the requests with long response times?

( ) Download Heapdumps from Tools > Operations > Diagnosis and analyze the Heapdumps using Memory Analyzer Tool

( ) Use rlog.jar with the following command $ java -jar ../opt/helpers/rlog.jar -n 10 request.log to identify long running requests

( ) Embed ‘/libs/foundation/components/timing’ component in the Page Component and verify the page load time

( ) Use proxy.jar with the following command java -jar proxy.jar to debug the webserver and AEM server communication

A

(+) Use rlog.jar with the following command $ java -jar ../opt/helpers/rlog.jar -n 10 request.log to identify long running requests

https://experienceleague.adobe.com/docs/experience-manager-65/deploying/configuring/monitoring-and-maintaining.html?lang=en#using-rlog-jar-to-find-requests-with-long-duration-times

100
Q

Which log file can be used for tracking page added, modified, and deleted events?

( ) access.log

( ) request.log

( ) auditlog.log

( ) history.log

A

( ) history.log

101
Q

A developer needs to analyze log messages for custom Java application. The developer writes the following Java class:

package com.abc.xyz;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MyClass {
private static final Logger logger = LoggerFactory.getLogger(this.getClass());
public void customMethod() {
logger.debug(“A custom log message”) ;
}
}

The developer creates a custom log, named custom.log, with a debug level in OSGi web console for Java package com.abc.xyz.

Where should the developer look in the OSGi web console to view the above message?

( ) OSGi -> Log Service and click logs/custom.log

( ) Sling -> Log Support and click logs/custom.log

( ) Sling -> Metrics and click logs/custom.log

( ) AEM -> Log Support and click logs/custom.log

A

(+) Sling -> Log Support and click logs/custom.log

## Note:
* OSGi -> Log Service * lists all active log services and allows to set limits to the log’s files size through Apache Sling Logging Writer Configuration that pops up when clicking on the service
* Sling -> Log Support * provides logs configuration levels and other settings
* Status -> Log Files * lists all log files contents and allows to download them

102
Q

A developer creates two custom classes. ClassA has the following code:

package com.aem.abc;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ClassA {
private static final Logger logger = LoggerFactory.getLogger(this.getClass());
public void classAMethod() {
logger.debug(“Message from Class A method”) ;
}
}

The developer creates a custom log custom.log with debug level in OSGi sling log support for the Java package com.aem.abc.
The developer adds another class ClassB with the following code:

package com.aem.xyz;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ClassB {
private static final Logger logger = LoggerFactory.getLogger(this.getClass());
public void classBMethod() {
logger.debug(“Message from Class B method”) ;
}
}

Which action must the developer take to see the log messages in the same file from both classes?

( ) Configure custom.log in the OSGi web console –> Sling –> Log Support and replace logger com.aem.abc with com.aem

( ) Create separate a log file in the OSGi web console –> Sling –> Log Support for logger com.aem.xyz

( ) Configure custom.log in the OSGi web console –> Sling –> Log Support and replace the package com.aem.abc with com.aem.xyz

( ) Configure custom.log in OSGi web console –> Sling –> Log Support and replace com.aem.xyz with com.aem.abc

A

(+) Configure custom.log in the OSGi web console –> Sling –> Log Support and replace logger com.aem.abc with com.aem

  • OSGi -> Log Service * lists all active log services and allows to set limits to the log’s files size through Apache Sling Logging Writer Configuration that pops up when clicking on the service
  • Sling -> Log Support * provides logs configuration levels and other settings
  • Status -> Log Files * lists all log files contents and allows to download them
103
Q

After a recent code deployment, an AEM site is experiencing longer than usual query execution time. The deployment package contained some new Lucene index definitions. A developer needs to identify the long running queries and confirm that the new index definitions are getting applied correctly.

Which action should the developer take to investigate this problem?

( ) Goto Tools > Operations > Diagnosis > Download Thread Dumps. Analyze the Thread Dumps to identify long running requests.

( ) Goto Tools > Operations > Diagnosis > Query Performance > Slow Queries. Select a Query and Click on Explain.

( ) Goto Tools > Operations > Diagnosis > Index Manager. Select the new Indexes and run a consistency check.

( ) Goto Tools > Operations > Diagnosis > Log Messages. Configure DEBUG log level on com.day.cq.search to monitor search queries.

A

(+) Goto Tools > Operations > Diagnosis > Query Performance > Slow Queries. Select a Query and Click on Explain.

104
Q

After adding new features, a developer’s environment is experiencing slowness before ultimately running out of memory. The initial log analysis points towards a large number of open sessions.

Which action should the developer take to further monitor the overall session count on this AEM instance?

( ) Go to /crx-quickstart/logs/stderr.log, use the following command grep -o ‘CRXSessionImpl’ stderr.log| wc -l

( ) Go to Tools > Operations > Monitoring, Create a new report based on Number of Active Sessions as metric

( ) Run the following command to generate thread dumps jstack -l &raquo_space; threaddumps.log, analyse thread dumps to find long running sessions

( ) Goto Web Console > Status > Threads, verify the overall thread count

A

(+) Go to Tools > Operations > Monitoring, Create a new report based on Number of Active Sessions as metric

105
Q

A developer identifies that some requests for the page /content/sampleproject/page.html take longer than other requests for the same page.

Refer to the $DOCROOT/content/sampleproject directory below.

[user@group /opt/dispatcher/cache/content/sampleproject ]$ ls -la
total 2
drwxr-xr-x. 5 apache apache 4096 Feb 11 11:41 .
drwxr-xr-x. 3 apache apache 4096 Nov 29 16:07 ..
drwxr-xr-x. 4 apache apache 4096 Feb 7 03:21 page.html
-rw-r–r–. 1 apache apache 0 Feb 7 03:19 .stat

The dispatcher.log file contains the following lines:

[Wed Feb 13 13:14:04 2012] [D] [1376(1532)] checking [/libs/cq/security/userinfo.json]
[Wed Feb 13 13:14:04 2012] [D] [1376(1532)] Caching disabled due to query string: tracking_id=1350373444666
[Wed Feb 13 13:14:04 2012] [D] [1376(1532)] cache-action for [/libs/cq/security/userinfo.json]: NONE

How should the developer make sure that the page is always cached?

( ) Modify the dispatcher.any file to contain the following lines:
/ignoreUrlParams
{

/0002 { /glob “tracking_id” /type “allow” }

}

( ) Modify the dispatcher.any file to contain the following lines:
/filter
{

/0023 { /type “allow” /url “/content//.html” /params “tracking_id”}

}

( ) Modify the dispatcher.any file to contain the following lines:
/rules
{

/0000 { /glob “*” /type “allow” /params “tracking_id” }

}

( ) Modify the dispatcher.any file to contain the following lines:
/filter
{

/0023 { /type “allow” /url “/content//.html?tracking_id=*” }

}

A

(+) Modify the dispatcher.any file to contain the following lines:
/ignoreUrlParams
{

/0002 { /glob “tracking_id” /type “allow” }

}

https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/configuring/dispatcher-configuration.html?lang=en#ignoring-url-parameters

106
Q

A developer determines that the dispatcher is NOT refreshing the cached page /content/sampleproject/sample.html after it is updated.

The dispatcher.any contains the following entries:

/cache
{
/docroot “/opt/dispatcher/cache”
/statfile “/tmp/dispatcher-website.stat”
/statfileslevel “2”

/rules
{
/0000 { /glob “*” /type “allow” }
}

/invalidate
{
/0000 { /glob “*” /type “deny” }
}
}

Refer to the $DOCROOT directory below.

[user@group /opt/dispatcher/cache]$ ls -la
total 2
drwxr-xr-x. 5 apache apache 4096 Feb 11 11:41 .
drwxr-xr-x. 3 apache apache 4096 Nov 29 16:07 ..
drw-r–r–. 4 root root 4096 Feb 7 03:21 content
-rw-r–r–. 1 apache apache 0 Feb 7 03:19 .stat

The dispatcher needs to cache the page and refresh it after it gets updated.

What action should the developer take to meet these requirements?

( ) Remove /statfile or /statfileslevel

( ) Change the value of the entry /statfileslevel to “3”

( ) Delete the contents of the DOCROOT directory

( ) Add the entry /0001 { /glob “*.html” /type “allow” } in the /invalidate section

A

(+) Delete the contents of the DOCROOT directory

https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/configuring/dispatcher-configuration.html?lang=en#defining-farms-farms

## Note:
The /docroot property identifies the directory where cached files are stored.

https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/configuring/dispatcher-configuration.html?lang=en#specifying-the-cache-directory

## Note:
The /rules property controls which documents are cached according to the document path.

https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/configuring/dispatcher-configuration.html?lang=en#specifying-the-documents-to-cache

## Note
Use the /statfileslevel property to INVALIDATE cached files according to their PATH

https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/configuring/dispatcher-configuration.html?lang=en#invalidating-files-by-folder-level

## Note
The /invalidate property defines the documents that are AUTOMATICALLY invalidated when content is UPDATED.

https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/configuring/dispatcher-configuration.html?lang=en#automatically-invalidating-cached-files

## Note
The /allowedClients property defines specific clients that are allowed to flush the cache.

https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/configuring/dispatcher-configuration.html?lang=en#limiting-the-clients-that-can-flush-the-cache