Question 1
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 the 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?
<sly data-sly-use.model="com.example.Component"/> <div data-sly-list="${model.pages}"> <p>${item.title}</p> <p>${item.description}</p> <a href= "${item.link}">${"Read more" @ .translate} <a> </div>
<sly data-sly-load.model="cam.example.Component"/> <div data-sly-list.page="${model.pages}"> <p>${page.title}</p> <p>${page.description}</p> <a href= "S{page.link}">${"Read more" @ il8n} <a> </div>
<sly data-sly-use.model="com.example.Camponent"/> <div data-sly-list="$(model.pagesr> <p>${item.title}</p> <p>${item.description}</p> <a href= "${item.link}">${"Read more" @ .118n} <a> </div>
<sly data-sly-use.model="com.example.Component"/> <div data-sly-list="${model.pages}"> <p>${model.title}</p> <p>${model. description}</p> <a href= "Sfitem.linkl">${"Read more" @ .translate} <a> </div>
Question 2
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 that matches almost all requirements, but not all.
What is the most maintainable way for the developer to implement these requirements?
• Use and configure the teaser core component.
• Create a new custom component from scratch.
• Overlay the teaser core component.
• Inherit from the teaser core component.
Question 3
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 stays in the same place but it ignored on pages using the 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 is moved to the initial section of the editable template.
Question 4
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 bundles consuming the service need to import the fully qualified name of the service interface.
• The service needs to correctly declare metatype information.
• The bundle providing the service needs to contain a whitelist of allowed consumer bundles.
• The bundle providing the service needs to contain an adequate SCR descriptor file.
• The bundle providing the service needs to export the java package of the service interface.
Question 5
Which log file contains AEM application request and response entries?
• response.log
• request.log
• history.log
• audit.log
Question 6
A developer wants to extend AEM Core Components to create a custom Carousel Component.
How should the developer extend the Core Components?
• Make changes to the original component and assign a component group.
• Use the sling:resourceSuperType property to point to the core component.
• Use the sling:resourceType property to point to the core component.
• Copy the Core Carousel component to /apps/<project> folder.
Question 7
The developer wants to change the log level for a custom API.
Which OSGi configuration should the developer modify?
• Apache Sling Logging Configuration
• Apache Sling Log Tracker Service
• Apache Sling Logging Writer Configuration
• Adobe Granite Log Analysis Service
Question 8
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?
• AEM instances automatically modify the number of transient nodes based on load balancing.
• Modify the export package manifest header and copy the content package to the AEM installation folder.
• Select the option MergePreserve for the Access Control Handling drop-down in the Install Package dialog box.
• Change the value of Save Threshold in the Install Package dialog box.
Question 9
A developer needs to implement a service component that should be manually configured by operations to react to 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 the 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. 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.
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. Create an annotation interface as an 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 field by the service component runtime.
Question 10
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?
• 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.
• Set the sling:resourceSuperType property to core/wcm/components/page/v2/page on the Page component
• Create a new dialog for the custom Page components.
Question 11
A custom AEM application contains Bundle A and Bundle B. Bundle A has a dependency on Bundle B via Import-Package.
How can both bundles be deployed most efficiently across all environments?
• Use the Felix Web Console to upload the bundles in the correct order.
• Embed both bundles in one content package: the dependency via Import-Package is enough to ensure the 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.
Question 12
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 <aem-install>/crx-qiuckstart/logs/strderr/log, use the following command grep -o‘CRXSessionImpl’ strderr.log| wc -l.
• Go to Tools > Operations > Monitoring. Create a new report based on the Number of Active Sessions as a metric.
• Run the following command to generate thread dumps jstack -l <pid> >> threaddumps.log, analyze thread dumps to find long-running sessions.
• Go to Web Console > Status > Threads, verify the overall thread count.
Question 13
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 the dispatcher flush agent in publish instance.
• Configure the replication agent in the publish instances.
• Configure reverse replication agents for the author. (for publish)
• Configure reverse replication agents for the author.
Question 14
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.adobe.granite.workflow.exec.ParticipantStepChooser
• com.day.cq.workflow.exec.ParticipantChooser
• com.day.cq.workflow.exec.WorkItem
• com.adobe.granite.workflow.exec.WorkflowData
Question 15
From which AEM Web Console should developer access and download full AEM Log Files?
• Web Console -> System Information
• Status -> Log files
• OSGI -> Sing Log Service
• AEM -> Log files
Question 16
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 a 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.
Question 17
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.getResourse().getResourceResolver().
• Create a configuration line in PID com.day.cq.security.ACLSetup for the user that you obtain a session for via ResourceResolverFactory.getResourceResolver(...).
• 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(...).
• 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.
Question 18
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?
• vlt command
• Content Explorer
• http://localhost:4502/crx/checkout
• mvn command
Question 19
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 bundle cq-wcm-api to the content package
• a maven dependency to AEM uber-jar to the application bundle
• a maven dependency to bundle cq-wcm-core to the application bundle
• a maven dependency to AEM uber-jar to the content package
Question 20
How should a developer enable remote debugging of an AEM server without modifying the AEM start script?
Rename the quickstart jar file to include the additional debug settings.
Enable the remote debugging service through the AEM Cloud Services menu.
Include an additional JVM parameter when starting AEM with java -jar
Question 21
Two AEM publish feed a single Dispatcher.
Which part of the Dispatcher configuration should a developer review to ensure both AEM publish instances are used?
• virtualhosts
• cache
• filter
• farms
Question 22
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 Workflow Failures screen and check if any instances of the workflow are present.
• Go to Workflow instances screen and verify that the instance of the workflow is present and check its status.
• Go to the Package Manager screen and reinstall the bundle that contains the workflow so it restarts.
• 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.
Question 23
For each CRX node in the hierarchy, which actions can be configured using the user admin interface?
• Read, Modify, Create, Delete, Read ACL, Edit ACL, Replicate
• Read, Write, Read ACL, Edit ACL, Replicate
• Read, Write, Delete, Edit ACL, Replicate
• Read, Modify, Create, Delete, Read ACL, Edit ACL
Question 24
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 does NOT have a policy.
• The page template has NOT been enabled.
• The page template has NOT been published.
• The Layout Container has NOT been unlocked.
Question 25
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?
• Sticky session is NOT configured properly, resulting in requests being delivered to the wrong server.
• The level of cache invalidation is NOT appropriate for the published content model.
• File globing in the dispatcher configuration is NOT correct.
• The OS file system permissions are NOT properly configured.
Question 26
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/<project>/settings, create the subfolders global and prod and node with name <PID>.conf each and configure the properties via node properties.
• Underneath /config/<project>/settings, create the subfolders config.default and config.prod and a file with the name <PID>.config each and list the properties as key-value pairs in there.
• Underneath /apps/<project>, create the subfolders config and config.prod and a file with the name <PID>.config each and list the properties as key-value pairs in there.
• Underneath /config/<project>/settings, create the subfolders config and config.prod, and a file with the name <PID>.config each and list the properties as key-value pairs in there.
Question 27
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/configMgr and tick the checkbox “encrypt” before saving a configuration.
2. Use encrypted values to work across all instances.
3. When loading the value in the code, call CryptoSupport.unprotect(…) before using the value.
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/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.
Question 28
Which environment variable in the AEM start script should a developer modify to enable remote debugging?
• CQ_HOST
• CQ_RUNMODE
• CQ_JVM_OPTS
• CQ_PORT
Question 29
AEM is installed in $AEM_HOME.
In which subfolder are the command line startup and shutdown scripts located?
• $AEM_HOME/
• $AEM_HOME/crx-quickstart/opt/
• $AEM_HOME/crx-quickstart/bin/
• $AEM_HOME/crx-quickstart/scripts/
Question 30
A customer bundle of an application is in the state “Installed” after deploying it with Maven.
What should a developer do to change it to state “Active”?
• Use the “Update” action for the bundle in the Apache Felix Web Console.
• Ensure all OSGi requirements are met and re-deploy using Maven.
• Use the “Start” action for the bundle in the Apache Felix Web Console.
• Reinstall the content package using the package manager.
Question 31
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
Ref: https://wcmaem.blogspot.com/2019/11/sling-context-aware-configuration-aem.html
Question 32
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 proxy component to point to V2 Component.
• Modify the sling:superType 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.
Question 33
In which maven build phase is the content package assembled?
• deploy
• package
• install
• compile
Explanation:
Maven Goals and Phases, https://www.baeldung.com/maven-goals-phases
Explanation:
package: package compiled source code into the distributable format (jar, war, …)
Question 34
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?
• Use rlog.jar with the following command $ java -jar ../opt/helpers/rlogs.jar -n 10 requests.log to identify long-running requests.
• Use proxy.jar with the following command java -jar proxy.jar <host> <remoteport> <localport> to debug the web server and AEM server communication.
• Download Heapdumps from Tools > Operations > Diagnosis and analyze the Heapdumps using the Memory Analyzer Tool.
• Embed /libs/foundation/components/timing component in the Page Component and verify the page load time.
Reference:
Common critical AEM issues, https://docs.adobe.com/content/help/en/experience-manager-65/deploying/configuring/monitoring-and-maintaining.html
Explanation:
Using rlog.jar to find requests with long duration times
AEM includes various helper tools located in: /crx-quickstart/opt/helpers
One of these, rlog.jar, can be used to quickly sort request.log so that requests are displayed by duration, from longest to shortest time.
Question 35
A developer is working on the following Sling Model that is being used in a component.
java
@Model (adaptables = SlingHttpServletRequest.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
public class SampleModel {
@Inject
private Page currentPage;
private boolean matchingTitle;
@PostConstruct
private void init() {
matchingTitle = title.equals (currentPage.getName());
}
public boolean isMatchingTitle() {
return matchingTitle;
}
}
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
@Via (“jcr:title”)
@Required
private String title;
@ValueMapValue
@via (“jcr:title”)
@Default (values = ”")
private String title;
@ValueMapValue
@Named (“jcr:title”)
@Required
private String title;
@ValueMapValue
@Named (“jcr:title”)
@Default (values = ””)
private String title;
Question 36
A developer has a component named foobar with the following file: FooBar.java
import com.adobe.cq.sightly.WCMUserPojo;
public class Foobar extends WCMUserPojo {
@override
public void activate() throws Excertion { }
public String getLinks() {
return https: //www.foo’ bar.com”;
}
public String getText() {
return “foo’ bar”;
}
}
foobar.html
<div data-sly-use. fooBar="FooBar”>
<a href="S${fooBar.link}” title="${fooBar.text}">
$ {fooBar.text}
</a>
</div>
What is the output when this component is rendered?
<div>
<a href="https: //www.foot%27bar.com” title="foo'bar">
foos'bar
</a>
</div>
<div>
<a href="https://www.foo%27bar.com” title="foo’ bar”>
foos#39;bar
</a>
</div>
<div>
<a href="https: //www.foot#39;bar.com” title="foo'bar”>
£oo0s#39;bar
</a>
</div>
<div>
<a href="https://www.foot%27bar.com” title="foo'bar”>
foo' bar
</a>
</div>
Question 37
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* (OsgiInstallerImp1]
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] (R 526.0): missing requiremen
t [com.adobe.cq.sample-bundle [526] (R 526.0)] osgi.wiring.package; (& (osgi.wiring.package=com.example.customlib) (ve
rsion>=3.8.0) (! (version>=4.0.0))) Unresolved requirements: [[com.adobe.cq.sample-bundle [526] (R 526.0)] osgi.wiring
-package; (&(osgi.wixring.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: Unab
le to resolve com.adobe.cq.sample-bundle [526] (R 526.0): missing requirement [com.adobe.cq.sample-bundle [526] (R 52
6.0)] osgi.wiring.package; (& (osgi.wiring.package=com. example.customlib) (version>=3.8.0) (! (version>=4.0.0))) Unreso
lved requirements: [[com.adobe.cq.sample-bundle [526] (R 526.0)] osgi.wiring.package; (& (osgi-wiring.package=com.exa
mple.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.)
• 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 -oupload.txt’.
• 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.
• 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.
• Upload the file com.example.customlib-3.8.jar into /apps/<project>/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.
Question 38
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 message in the same file from both classes?
• 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 com.aem.xyz with com.aem.abc.
• Configure custom.log in the OSGi web console --> Sling --> Log Support and replace logger com.aem.abc with com.aem.
• Configure custom.log in the OSGi web console --> Sling --> Log Support and replace the package com.aem.abc with com.aem.xyz.
Question 39
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/cam/adobe/training/core/filters/LoggingFilter.java: (26,28] package org.apache.sling.api does not 6
xist
(ERROR) /training/core/src/main/java/cam/adobe/training/core/filters/LoggingFilter.java: (27,31] package org.apache.sling.engine does no
t 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/adebe/training/core/models/HelloWorldModel.java:[{25,33}] package org.apache.sling.settings does
not exist
(ERROR) /training/core/src/main/java/cam/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?
<dependency>
<groupId>com. adobe .aem</groupId>
<artifactId>uber-jar</artifactId>
<version>6.4.0</version>
<classifier>apis</classifier>
<scope>provided</scope>
</dependency>
<repositories>
<repository>
<id>adobe-public-releases</id>
<name>Adobe Public Repository</name>
<url>https://repo.adobe.com/nexus/content/groups/public/</url>
<layout>default</layout>
</repository>
</repositories>
<dependency>
<groupId>com. adobe. aem</groupId>
<artifactId>aem-api</artifactId>
<version>6.4.0</version>
<classifier>apis</classifier>
<scope>provided</scope>
</dependency>
<resources>
<resource>
<directory>srce/mail/content/jcr_root</directory>
<filtering>false</filtering>
<excludes>
<exclude>““/.vlt</exclude>
<exclude>*“/.vltignore</exclude>
<exclude>libs/</exclude>
</excludes>
</resource>
</resources>
Question 40
A developer has a component named foobar with the following file: foobar.html
<div data-one="${ ‘foo’ }" data-two="${2}" data-three="$ {true}"></div>
<div data-one="${‘°'}” data-two="${0}” data-three="${false}"></div>
What is the output when the component is rendered?
<div data-one="foo” data-two=2 data-three=""></div>
<div data-two=0 data-three=""></div>
<div data-one="foo” data-two="2" data-three="true”></div>
<div data-one="" data-two="0" data-three="false”></div>
<div data-one="foo” data-two=2 data-three=""></div>
<div data-one="" data-two=0 data-three=""></div>
<div data-one="foo” data-two="2" data-three></div>
<div data-two="0"></div>
Question 41
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?
Usea file com.proj.ServiceComponent.config with content
name="Service Name”
intVal=1”"5”
Use a file com.proj.ServiceComponent.cfg with content
name="Service Name”
intVal=1"5"
Use afile com.proj.ServiceComponent..al with content
<?xml version="1.0” encoding="UTF-8”?>
<jer:root xmlns:jcr=http: //www.jcp.org/jer/1.0” jcr:primaryType="sling:Osgi
Config”
name="Service Name”
intVal="{Integer}5”/>
Use a file com.proj.ServiceComponent.xml with content
<?xml version="1.0" encoding="UTF-8”?>
<jcr:root jcr:primaryType="sling:OsgiConfig”
name="Service Name”
intVal="5"/>
Question 42
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 (Resource camponentResource) {
final HierarchyNodeInheritanceValueMap properties = componentResource.
adapt To(HierarchyNodeInheritanceValueMap.class) ;
return properties.get (HEADER PAGE LIST, String[].class) ;
}
public String [] getHeaderLinks(Page page) {
final Resource pageContent = page.getContentResource();
final ComponentInheritanceValueMap properties = ComponentIngeritance
\lueMap (pageContent) ;
return properties.get (HEADER_PAGE LIST, String{].class) ;
public String [] getHeaderLinks (Resource componentResource) {
final ComponentInheritanceValueMap properties = componentResource.
adaptTo (Component InheritanceValueMap.class) ;
return properties .getInherited(HEADER_PAGE_LIST, String[].class) ;
}
public String [] getHeaderLinks (Resource camponentResource) {
final HierarchyNodeInheritanceValueMap properties = new HierarchyNo
deInheritanceValueMap(componentResource) ;
return properties.getInherited(HEADER_PAGE_LIST, String[].class);
}
Question 43
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<string, object=""> 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 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 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=systemUser
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 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.
Question 44
One content package of a custom application contains the following content paths.
/apps/myproj/install
/apps/myproj/components
/apps/myproj/il8n
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
<filter root="/apps/myproj”>
<exclude pattern="configuration.*"/>
</filter>
B
<filter root="/apps/myproj”">
<“include pattern=".*"/>
<exclude pattern="configuration.*"/>
</filter>
C
<filter root="/apps/myproj”">
<exclude pattern="/apps/myproj/configuration.*"/>
</filter>
D
<filter root="/apps/myproj” mode="merge”>
E
<filter root="/apps/myproj”">
<include pattern="/apps/myproj/ (install|components|il8n) .*”/>
</filter>
Question 45
A developer identifies that some requests for the page /content/sampleproject/page.html take longer that 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
-IYw-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?
/filter
{
/0023 { /type “allow” /url “/content/*/*/html” /params “tracking_id”}
}
/rules
{
40000 { /glob “** /type “allow” /params “tracking_id”}
}
‘filter
{
/0023 { /type “allow” /url “/content/*/*.html?tracking_id=*”}
}
/ignoreUrl Params
{
40002 { /glob “tracking_id”/type “allow” }
}
Question 46
A developer creates a Sling Servlet. The Sling Servlet is bound to a path (/service/sling/sample). Refer to the resulting code below.
What should the developer do to make the servlet access controlled using the default ACLs?
• Add @SlingServletPrefix(value = “/apps”) annotation.
• Use @SlingServletResourceTypes instead of @SlingServletPaths.
• Modify @SlingServletPaths(value = {“/bin/sling/sample” }).
• Add @SlingServletName(servletName = “AccessControlServlet”) annotation
Question 47
Refer to the following four Client Library Folders.
A developer uses the following:
What is the resulting HTML?
<link rel="stylesheet” href="library.one.css">
<link rel="stylesheet” href="library.three.css”>
<link rel="stylesheet” href="library.four.css”>
<link rel="stylesheet” href="library.two.css”>
<link rel="stylesheet” href="library.one.css”>
<link rel="stylesheet” href="library.three.css”>
<link rel="stylesheet” href="library.four.css”>
<link rel="stylesheet” href="library.three.css”>
<link rel="stylesheet” href="library.one.css”>
<link rel="stylesheet” href="library.three.css”>
<link rel="stylesheet” href="library.four.css”>
<link rel="stylesheet” href="library.one.css">
Question 48
A developer creates a custom component. The component dialog includes the following two fields:
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:
A Null Pointer Exception occurs if NO charLimit values are 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 min=”0”.
• Change the defaultInjectionStrategy of the Truncation Sling Model to DefaultInjectionStrategy.REQUIRED
• Replace the defaultValue=”0” attribute of the charLimit field in the dialog with defaultValue=”{Long}0”.
• Add the @Default annotation to the ‘chatLimit’ variable in the Sling Model.
Question 49
An OSGi bundle Activator.java is registered through a service DevelopInfo.java
DeveloperInfo.java
Activator.java
Maven install generates an error during deployment. Refer to the error information below:
Which action should the developer take to resolve the build error?
• @Service annotation is missing in DeveloperInfo.java.
• Activator class is NOT implementing the DeveloperInfo interface.
• The required Maven repository for OSGi is missing.
• Interface DeveloperInfo does NOT have any method.
Question 50
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?
@Component (immediate=true, service = Servlet.class, property = {Constants.SER
VICE_DESCRIPTION + “=Send NewsLetter Sling Servlet”,
“sling.servlet.method=” + HttpConstants.METHOD PUT,
“sling.servlet.concurrent=" + “false’,
“sling.servlet.interval=" + “*/30«+4#2"
})
public class SendNewsletterServlet extends SlingSafeMethodsServlet {
}
@Component (immediate=true,
enabled=true
service = Importer.class,
property = {
Importer.concurrent + “=false”,
Importer.interval + ="*/30*«+*?”
}
)
public class SendEmailNewsletterImpl implements Importer {
}
@Component (service = EventHandler.class,
immediate = true,
property = {
Constants.SERVICE DESCRIPTION + “=Send NewsLetter”,
EventConstants.EVENT TOPIC + “=org/apache/sling/api/
resource/Resource/*”,
EventConstants.interval + “=
w/30K wen On
})
public class SendNewsletterListener implements EventHandler {
boolean isConcurrent = false;
String interval = %*/30***#2?”
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 =
“demo”)
public static @interface Config {
@AttributeDefinition(name = “Cron-job expression”)
String scheduler_expression() default “*/30***+2%;
@AttributeDefinition (name = “Configure task”, description =“XXXX”)
boolean scheduler_concurrent() default false;
@AttributeDefinition(name = “A Parm”, description =
“/system/console/configurmgzr”)
String myParameter() default “”;
}
Note: Scheduler configs var are scheduler.expression and scheduler.concurrent
Ref: https://sling.apache.org/documentation/bundles/scheduler-service-commons-scheduler.html
Question 51
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:
Refer to the $DOCROOT directory below:
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
• Delete the contents of the DOCROOT directory.
• Change the value of the entry /statfileslevel to “3”.
• Add the entry /0001 { /glob “-.html” /type “allow” } in the /invalidate section.
Question 52
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 =((ValueMap<String, String>) resource.getChild(“x”) .getValueMap()).
get ("y")," ");
String y = null;
Resource x = resource.getChild(“x”);
if (null!=x) {
ValueMap<String> map = x.getValuemap ();
if (null!=map) {
y = map.get(“y","");
}
}
String y = null;
Node x = node.getNode(“x”);
1f (null!=x) {
Properties<Strings, String> properties = x.getProperties();
if (null!=properties) {
Y = properties.get (“y”,”");
}
}
String y = null;
Node x = node.getNode(“x"”);
1f (null!=x) {
ValueMap<Strings, String> map = x.getValueMap();
if (null!=map) {
y = map.get(“y”,”");
}
}
Question 53
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:
What action should the developer take to meet these requirements?
Make the class alsoimplement 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 alsoimplement 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 alsoimplement 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 alsoimplement 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.
Question 54
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 mode structure should the developer use to meet these requirements?
+ component
- jcr: primaryType="cq: Camponent”
- jcr:title="Component”
- componentGroup=" hidden”
+ cq:dialog
+ cq:editConfig
- cq:actions = “[edit]”
+ component
- jcr:primaryType="cq: Camponent”
- jcr:title="Component”
- cq:actions = “[edit]”
+ cq:dialog
+ 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]”
Question 55
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:
The system console shows the following package availability:
Bundle com.custom.package.b to be installed has the following package definition:
What will happen when the developer uploads the bundle com.custom.package.b into the system?
• The bundle will install but fail the activation due to unsatisfied dependency com.sample.package.b.
• The bundle will install and activate successfully.
• 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.
Question 56
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:
The dialog of Component B on path ../cq:dialog/../../items looks like:
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 the align node from Component A to Component B and order them according the requirements.
• Move all 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.
Question 57
A developer has a component foobar that consists of the files listed below:
script-a.js
script-b.js
foobar.html
What is the output when this component is rendered?
<div>
<div class="bar"></div>
<div class="foo"></div>
<div></div>
<div></div>
</div>
<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="f00"></div>
<div class=""></div>
</div>
Question 58
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.)
ResourceResolverFactory resolverFactory;
if (null!=resolverFactory) {
Map<String,Object> authenticationInfo = new HashMap<String, String>();
authenticationInfo.put (“username”, “reposervice”);
Session session - resolverFactory.getAdministrativeResourceResolver (authen
ticationInfo, resolverFactory.getPassworg (“reposervice”)) .adaptTo (Session.class);
}
SlingRepository repo;
if (null != repo) {
Session session = repo.loginService (null, repo.getDefaultWorkspace());
}
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<String,Object> authenticationInfo = new HashMap<String, String>();
authenticationInfo.put (“username”, “admin”);
authenticationInfo.put (“password”, “admin”);
Session session - resolverFactory.getAdministrativeResourceResolver (authen
ticationInfo) .adaptTo(Session.class);
}
Question 59
A developer creates the following code snippet to implement a simple polling importer to fetch stock prices from an external source:
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?
+/apps/system/config/com.adobe.training.core.core.StockDataImporter [sling:0
sgiConfig]
-SCHEME_PROPERTY: “stock”
-source: “ADBE”
-target: “/content”
-interval: 5
+/apps/system/config/com.adobe.training.core.core.StockDataImporter [sling:0
sgiConfig]
-sling:resourceType: com.adobe.training.core.core.StockDataImporter
-SCHEME_PROPERTY: “ADBE”
-target: “/content”
-interval: 5
+/etc/importers/polling/stock
-jcr:mixinTypes: [ “cq:PollConfig”]
-source: “stock:ADBE”
-interval: 300
-target: “/content”
+/etc/importers/polling/stock
-sling:resourceType: com.adobe.training.core.core.StockDataImporter
-stock: “ADBE”
-interval: 300
-target: “/content”
Question 60
What is the artifact ID of the maven dependency that contains all core AEM APIs?
• core-jar
• api-jar
• aem-jar
• uber-jar
Question 64
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 the 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?
<sly data-sly-use.model="com.example.Component"/> <div data-sly-list="${model.pages}"> <p>${item.title}</p> <p>${item.description}</p> <a href= "${item.link}">${"Read more" @ .translate} <a> </div>
<sly data-sly-load.model="cam.example.Component"/> <div data-sly-list.page="${model.pages}"> <p>${page.title}</p> <p>${page.description}</p> <a href= "S{page.link}">${"Read more" @ il8n} <a> </div>
<sly data-sly-use.model="com.example.Camponent"/> <div data-sly-list="$(model.pagesr> <p>${item.title}</p> <p>${item.description}</p> <a href= "${item.link}">${"Read more" @ .118n} <a> </div>
<sly data-sly-use.model="com.example.Component"/> <div data-sly-list="${model.pages}"> <p>${model.title}</p> <p>${model. description}</p> <a href= "Sfitem.linkl">${"Read more" @ .translate} <a> </div>
Question 2
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 that matches almost all requirements, but not all.
What is the most maintainable way for the developer to implement these requirements?
• Use and configure the teaser core component.
• Create a new custom component from scratch.
• Overlay the teaser core component.
• Inherit from the teaser core component.
Question 3
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 stays in the same place but it ignored on pages using the 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 is moved to the initial section of the editable template.
Question 4
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 bundles consuming the service need to import the fully qualified name of the service interface.
• The service needs to correctly declare metatype information.
• The bundle providing the service needs to contain a whitelist of allowed consumer bundles.
• The bundle providing the service needs to contain an adequate SCR descriptor file.
• The bundle providing the service needs to export the java package of the service interface.
Question 5
Which log file contains AEM application request and response entries?
• response.log
• request.log
• history.log
• audit.log
Question 6
A developer wants to extend AEM Core Components to create a custom Carousel Component.
How should the developer extend the Core Components?
• Make changes to the original component and assign a component group.
• Use the sling:resourceSuperType property to point to the core component.
• Use the sling:resourceType property to point to the core component.
• Copy the Core Carousel component to /apps/<project> folder.
Question 7
The developer wants to change the log level for a custom API.
Which OSGi configuration should the developer modify?
• Apache Sling Logging Configuration
• Apache Sling Log Tracker Service
• Apache Sling Logging Writer Configuration
• Adobe Granite Log Analysis Service
Question 8
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?
• AEM instances automatically modify the number of transient nodes based on load balancing.
• Modify the export package manifest header and copy the content package to the AEM installation folder.
• Select the option MergePreserve for the Access Control Handling drop-down in the Install Package dialog box.
• Change the value of Save Threshold in the Install Package dialog box.
Question 9
A developer needs to implement a service component that should be manually configured by operations to react to 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 the 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. 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.
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. Create an annotation interface as an 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 field by the service component runtime.
Question 10
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?
• 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.
• Set the sling:resourceSuperType property to core/wcm/components/page/v2/page on the Page component
• Create a new dialog for the custom Page components.
Question 11
A custom AEM application contains Bundle A and Bundle B. Bundle A has a dependency on Bundle B via Import-Package.
How can both bundles be deployed most efficiently across all environments?
• Use the Felix Web Console to upload the bundles in the correct order.
• Embed both bundles in one content package: the dependency via Import-Package is enough to ensure the 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.
Question 12
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 <aem-install>/crx-qiuckstart/logs/strderr/log, use the following command grep -o‘CRXSessionImpl’ strderr.log| wc -l.
• Go to Tools > Operations > Monitoring. Create a new report based on the Number of Active Sessions as a metric.
• Run the following command to generate thread dumps jstack -l <pid> >> threaddumps.log, analyze thread dumps to find long-running sessions.
• Go to Web Console > Status > Threads, verify the overall thread count.
Question 13
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 the dispatcher flush agent in publish instance.
• Configure the replication agent in the publish instances.
• Configure reverse replication agents for the author. (for publish)
• Configure reverse replication agents for the author.
Question 14
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.adobe.granite.workflow.exec.ParticipantStepChooser
• com.day.cq.workflow.exec.ParticipantChooser
• com.day.cq.workflow.exec.WorkItem
• com.adobe.granite.workflow.exec.WorkflowData
Question 15
From which AEM Web Console should developer access and download full AEM Log Files?
• Web Console -> System Information
• Status -> Log files
• OSGI -> Sing Log Service
• AEM -> Log files
Question 16
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 a 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.
Question 17
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.getResourse().getResourceResolver().
• Create a configuration line in PID com.day.cq.security.ACLSetup for the user that you obtain a session for via ResourceResolverFactory.getResourceResolver(...).
• 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(...).
• 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.
Question 18
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?
• vlt command
• Content Explorer
• http://localhost:4502/crx/checkout
• mvn command
Question 19
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 bundle cq-wcm-api to the content package
• a maven dependency to AEM uber-jar to the application bundle
• a maven dependency to bundle cq-wcm-core to the application bundle
• a maven dependency to AEM uber-jar to the content package
Question 20
How should a developer enable remote debugging of an AEM server without modifying the AEM start script?
Rename the quickstart jar file to include the additional debug settings.
Enable the remote debugging service through the AEM Cloud Services menu.
Include an additional JVM parameter when starting AEM with java -jar
Question 21
Two AEM publish feed a single Dispatcher.
Which part of the Dispatcher configuration should a developer review to ensure both AEM publish instances are used?
• virtualhosts
• cache
• filter
• farms
Question 22
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 Workflow Failures screen and check if any instances of the workflow are present.
• Go to Workflow instances screen and verify that the instance of the workflow is present and check its status.
• Go to the Package Manager screen and reinstall the bundle that contains the workflow so it restarts.
• 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.
Question 23
For each CRX node in the hierarchy, which actions can be configured using the user admin interface?
• Read, Modify, Create, Delete, Read ACL, Edit ACL, Replicate
• Read, Write, Read ACL, Edit ACL, Replicate
• Read, Write, Delete, Edit ACL, Replicate
• Read, Modify, Create, Delete, Read ACL, Edit ACL
Question 24
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 does NOT have a policy.
• The page template has NOT been enabled.
• The page template has NOT been published.
• The Layout Container has NOT been unlocked.
Question 25
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?
• Sticky session is NOT configured properly, resulting in requests being delivered to the wrong server.
• The level of cache invalidation is NOT appropriate for the published content model.
• File globing in the dispatcher configuration is NOT correct.
• The OS file system permissions are NOT properly configured.
Question 26
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/<project>/settings, create the subfolders global and prod and node with name <PID>.conf each and configure the properties via node properties.
• Underneath /config/<project>/settings, create the subfolders config.default and config.prod and a file with the name <PID>.config each and list the properties as key-value pairs in there.
• Underneath /apps/<project>, create the subfolders config and config.prod and a file with the name <PID>.config each and list the properties as key-value pairs in there.
• Underneath /config/<project>/settings, create the subfolders config and config.prod, and a file with the name <PID>.config each and list the properties as key-value pairs in there.
Question 27
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/configMgr and tick the checkbox “encrypt” before saving a configuration.
2. Use encrypted values to work across all instances.
3. When loading the value in the code, call CryptoSupport.unprotect(…) before using the value.
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/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.
Question 28
Which environment variable in the AEM start script should a developer modify to enable remote debugging?
• CQ_HOST
• CQ_RUNMODE
• CQ_JVM_OPTS
• CQ_PORT
Question 29
AEM is installed in $AEM_HOME.
In which subfolder are the command line startup and shutdown scripts located?
• $AEM_HOME/
• $AEM_HOME/crx-quickstart/opt/
• $AEM_HOME/crx-quickstart/bin/
• $AEM_HOME/crx-quickstart/scripts/
Question 30
A customer bundle of an application is in the state “Installed” after deploying it with Maven.
What should a developer do to change it to state “Active”?
• Use the “Update” action for the bundle in the Apache Felix Web Console.
• Ensure all OSGi requirements are met and re-deploy using Maven.
• Use the “Start” action for the bundle in the Apache Felix Web Console.
• Reinstall the content package using the package manager.
Question 31
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
Ref: https://wcmaem.blogspot.com/2019/11/sling-context-aware-configuration-aem.html
Question 32
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 proxy component to point to V2 Component.
• Modify the sling:superType 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.
Question 33
In which maven build phase is the content package assembled?
• deploy
• package
• install
• compile
Explanation:
Maven Goals and Phases, https://www.baeldung.com/maven-goals-phases
Explanation:
package: package compiled source code into the distributable format (jar, war, …)
Question 34
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?
• Use rlog.jar with the following command $ java -jar ../opt/helpers/rlogs.jar -n 10 requests.log to identify long-running requests.
• Use proxy.jar with the following command java -jar proxy.jar <host> <remoteport> <localport> to debug the web server and AEM server communication.
• Download Heapdumps from Tools > Operations > Diagnosis and analyze the Heapdumps using the Memory Analyzer Tool.
• Embed /libs/foundation/components/timing component in the Page Component and verify the page load time.
Reference:
Common critical AEM issues, https://docs.adobe.com/content/help/en/experience-manager-65/deploying/configuring/monitoring-and-maintaining.html
Explanation:
Using rlog.jar to find requests with long duration times
AEM includes various helper tools located in: /crx-quickstart/opt/helpers
One of these, rlog.jar, can be used to quickly sort request.log so that requests are displayed by duration, from longest to shortest time.
Question 35
A developer is working on the following Sling Model that is being used in a component.
java
@Model (adaptables = SlingHttpServletRequest.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
public class SampleModel {
@Inject
private Page currentPage;
private boolean matchingTitle;
@PostConstruct
private void init() {
matchingTitle = title.equals (currentPage.getName());
}
public boolean isMatchingTitle() {
return matchingTitle;
}
}
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
@Via (“jcr:title”)
@Required
private String title;
@ValueMapValue
@via (“jcr:title”)
@Default (values = ”")
private String title;
@ValueMapValue
@Named (“jcr:title”)
@Required
private String title;
@ValueMapValue
@Named (“jcr:title”)
@Default (values = ””)
private String title;
Question 36
A developer has a component named foobar with the following file: FooBar.java
import com.adobe.cq.sightly.WCMUserPojo;
public class Foobar extends WCMUserPojo {
@override
public void activate() throws Excertion { }
public String getLinks() {
return https: //www.foo’ bar.com”;
}
public String getText() {
return “foo’ bar”;
}
}
foobar.html
<div data-sly-use. fooBar="FooBar”>
<a href="S${fooBar.link}” title="${fooBar.text}">
$ {fooBar.text}
</a>
</div>
What is the output when this component is rendered?
<div>
<a href="https: //www.foot%27bar.com” title="foo'bar">
foos'bar
</a>
</div>
<div>
<a href="https://www.foo%27bar.com” title="foo’ bar”>
foos#39;bar
</a>
</div>
<div>
<a href="https: //www.foot#39;bar.com” title="foo'bar”>
£oo0s#39;bar
</a>
</div>
<div>
<a href="https://www.foot%27bar.com” title="foo'bar”>
foo' bar
</a>
</div>
Question 37
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* (OsgiInstallerImp1]
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] (R 526.0): missing requiremen
t [com.adobe.cq.sample-bundle [526] (R 526.0)] osgi.wiring.package; (& (osgi.wiring.package=com.example.customlib) (ve
rsion>=3.8.0) (! (version>=4.0.0))) Unresolved requirements: [[com.adobe.cq.sample-bundle [526] (R 526.0)] osgi.wiring
-package; (&(osgi.wixring.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: Unab
le to resolve com.adobe.cq.sample-bundle [526] (R 526.0): missing requirement [com.adobe.cq.sample-bundle [526] (R 52
6.0)] osgi.wiring.package; (& (osgi.wiring.package=com. example.customlib) (version>=3.8.0) (! (version>=4.0.0))) Unreso
lved requirements: [[com.adobe.cq.sample-bundle [526] (R 526.0)] osgi.wiring.package; (& (osgi-wiring.package=com.exa
mple.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.)
• 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 -oupload.txt’.
• 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.
• 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.
• Upload the file com.example.customlib-3.8.jar into /apps/<project>/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.
Question 38
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 message in the same file from both classes?
• 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 com.aem.xyz with com.aem.abc.
• Configure custom.log in the OSGi web console --> Sling --> Log Support and replace logger com.aem.abc with com.aem.
• Configure custom.log in the OSGi web console --> Sling --> Log Support and replace the package com.aem.abc with com.aem.xyz.
Question 39
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/cam/adobe/training/core/filters/LoggingFilter.java: (26,28] package org.apache.sling.api does not 6
xist
(ERROR) /training/core/src/main/java/cam/adobe/training/core/filters/LoggingFilter.java: (27,31] package org.apache.sling.engine does no
t 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/adebe/training/core/models/HelloWorldModel.java:[{25,33}] package org.apache.sling.settings does
not exist
(ERROR) /training/core/src/main/java/cam/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?
<dependency>
<groupId>com. adobe .aem</groupId>
<artifactId>uber-jar</artifactId>
<version>6.4.0</version>
<classifier>apis</classifier>
<scope>provided</scope>
</dependency>
<repositories>
<repository>
<id>adobe-public-releases</id>
<name>Adobe Public Repository</name>
<url>https://repo.adobe.com/nexus/content/groups/public/</url>
<layout>default</layout>
</repository>
</repositories>
<dependency>
<groupId>com. adobe. aem</groupId>
<artifactId>aem-api</artifactId>
<version>6.4.0</version>
<classifier>apis</classifier>
<scope>provided</scope>
</dependency>
<resources>
<resource>
<directory>srce/mail/content/jcr_root</directory>
<filtering>false</filtering>
<excludes>
<exclude>““/.vlt</exclude>
<exclude>*“/.vltignore</exclude>
<exclude>libs/</exclude>
</excludes>
</resource>
</resources>
Question 40
A developer has a component named foobar with the following file: foobar.html
<div data-one="${ ‘foo’ }" data-two="${2}" data-three="$ {true}"></div>
<div data-one="${‘°'}” data-two="${0}” data-three="${false}"></div>
What is the output when the component is rendered?
<div data-one="foo” data-two=2 data-three=""></div>
<div data-two=0 data-three=""></div>
<div data-one="foo” data-two="2" data-three="true”></div>
<div data-one="" data-two="0" data-three="false”></div>
<div data-one="foo” data-two=2 data-three=""></div>
<div data-one="" data-two=0 data-three=""></div>
<div data-one="foo” data-two="2" data-three></div>
<div data-two="0"></div>
Question 41
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?
Usea file com.proj.ServiceComponent.config with content
name="Service Name”
intVal=1”"5”
Use a file com.proj.ServiceComponent.cfg with content
name="Service Name”
intVal=1"5"
Use afile com.proj.ServiceComponent..al with content
<?xml version="1.0” encoding="UTF-8”?>
<jer:root xmlns:jcr=http: //www.jcp.org/jer/1.0” jcr:primaryType="sling:Osgi
Config”
name="Service Name”
intVal="{Integer}5”/>
Use a file com.proj.ServiceComponent.xml with content
<?xml version="1.0" encoding="UTF-8”?>
<jcr:root jcr:primaryType="sling:OsgiConfig”
name="Service Name”
intVal="5"/>
Question 42
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 (Resource camponentResource) {
final HierarchyNodeInheritanceValueMap properties = componentResource.
adapt To(HierarchyNodeInheritanceValueMap.class) ;
return properties.get (HEADER PAGE LIST, String[].class) ;
}
public String [] getHeaderLinks(Page page) {
final Resource pageContent = page.getContentResource();
final ComponentInheritanceValueMap properties = ComponentIngeritance
\lueMap (pageContent) ;
return properties.get (HEADER_PAGE LIST, String{].class) ;
public String [] getHeaderLinks (Resource componentResource) {
final ComponentInheritanceValueMap properties = componentResource.
adaptTo (Component InheritanceValueMap.class) ;
return properties .getInherited(HEADER_PAGE_LIST, String[].class) ;
}
public String [] getHeaderLinks (Resource camponentResource) {
final HierarchyNodeInheritanceValueMap properties = new HierarchyNo
deInheritanceValueMap(componentResource) ;
return properties.getInherited(HEADER_PAGE_LIST, String[].class);
}
Question 43
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<string, object=""> 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 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 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=systemUser
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 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.
Question 44
One content package of a custom application contains the following content paths.
/apps/myproj/install
/apps/myproj/components
/apps/myproj/il8n
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
<filter root="/apps/myproj”>
<exclude pattern="configuration.*"/>
</filter>
B
<filter root="/apps/myproj”">
<“include pattern=".*"/>
<exclude pattern="configuration.*"/>
</filter>
C
<filter root="/apps/myproj”">
<exclude pattern="/apps/myproj/configuration.*"/>
</filter>
D
<filter root="/apps/myproj” mode="merge”>
E
<filter root="/apps/myproj”">
<include pattern="/apps/myproj/ (install|components|il8n) .*”/>
</filter>
Question 45
A developer identifies that some requests for the page /content/sampleproject/page.html take longer that 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
-IYw-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?
/filter
{
/0023 { /type “allow” /url “/content/*/*/html” /params “tracking_id”}
}
/rules
{
40000 { /glob “** /type “allow” /params “tracking_id”}
}
‘filter
{
/0023 { /type “allow” /url “/content/*/*.html?tracking_id=*”}
}
/ignoreUrl Params
{
40002 { /glob “tracking_id”/type “allow” }
}
Question 46
A developer creates a Sling Servlet. The Sling Servlet is bound to a path (/service/sling/sample). Refer to the resulting code below.
What should the developer do to make the servlet access controlled using the default ACLs?
• Add @SlingServletPrefix(value = “/apps”) annotation.
• Use @SlingServletResourceTypes instead of @SlingServletPaths.
• Modify @SlingServletPaths(value = {“/bin/sling/sample” }).
• Add @SlingServletName(servletName = “AccessControlServlet”) annotation
Question 47
Refer to the following four Client Library Folders.
A developer uses the following:
What is the resulting HTML?
<link rel="stylesheet” href="library.one.css">
<link rel="stylesheet” href="library.three.css”>
<link rel="stylesheet” href="library.four.css”>
<link rel="stylesheet” href="library.two.css”>
<link rel="stylesheet” href="library.one.css”>
<link rel="stylesheet” href="library.three.css”>
<link rel="stylesheet” href="library.four.css”>
<link rel="stylesheet” href="library.three.css”>
<link rel="stylesheet” href="library.one.css”>
<link rel="stylesheet” href="library.three.css”>
<link rel="stylesheet” href="library.four.css”>
<link rel="stylesheet” href="library.one.css">
Question 48
A developer creates a custom component. The component dialog includes the following two fields:
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:
A Null Pointer Exception occurs if NO charLimit values are 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 min=”0”.
• Change the defaultInjectionStrategy of the Truncation Sling Model to DefaultInjectionStrategy.REQUIRED
• Replace the defaultValue=”0” attribute of the charLimit field in the dialog with defaultValue=”{Long}0”.
• Add the @Default annotation to the ‘chatLimit’ variable in the Sling Model.
Question 49
An OSGi bundle Activator.java is registered through a service DevelopInfo.java
DeveloperInfo.java
Activator.java
Maven install generates an error during deployment. Refer to the error information below:
Which action should the developer take to resolve the build error?
• @Service annotation is missing in DeveloperInfo.java.
• Activator class is NOT implementing the DeveloperInfo interface.
• The required Maven repository for OSGi is missing.
• Interface DeveloperInfo does NOT have any method.
Question 50
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?
@Component (immediate=true, service = Servlet.class, property = {Constants.SER
VICE_DESCRIPTION + “=Send NewsLetter Sling Servlet”,
“sling.servlet.method=” + HttpConstants.METHOD PUT,
“sling.servlet.concurrent=" + “false’,
“sling.servlet.interval=" + “*/30«+4#2"
})
public class SendNewsletterServlet extends SlingSafeMethodsServlet {
}
@Component (immediate=true,
enabled=true
service = Importer.class,
property = {
Importer.concurrent + “=false”,
Importer.interval + ="*/30*«+*?”
}
)
public class SendEmailNewsletterImpl implements Importer {
}
@Component (service = EventHandler.class,
immediate = true,
property = {
Constants.SERVICE DESCRIPTION + “=Send NewsLetter”,
EventConstants.EVENT TOPIC + “=org/apache/sling/api/
resource/Resource/*”,
EventConstants.interval + “=
w/30K wen On
})
public class SendNewsletterListener implements EventHandler {
boolean isConcurrent = false;
String interval = %*/30***#2?”
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 =
“demo”)
public static @interface Config {
@AttributeDefinition(name = “Cron-job expression”)
String scheduler_expression() default “*/30***+2%;
@AttributeDefinition (name = “Configure task”, description =“XXXX”)
boolean scheduler_concurrent() default false;
@AttributeDefinition(name = “A Parm”, description =
“/system/console/configurmgzr”)
String myParameter() default “”;
}
Note: Scheduler configs var are scheduler.expression and scheduler.concurrent
Ref: https://sling.apache.org/documentation/bundles/scheduler-service-commons-scheduler.html
Question 51
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:
Refer to the $DOCROOT directory below:
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
• Delete the contents of the DOCROOT directory.
• Change the value of the entry /statfileslevel to “3”.
• Add the entry /0001 { /glob “-.html” /type “allow” } in the /invalidate section.
Question 52
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 =((ValueMap<String, String>) resource.getChild(“x”) .getValueMap()).
get ("y")," ");
String y = null;
Resource x = resource.getChild(“x”);
if (null!=x) {
ValueMap<String> map = x.getValuemap ();
if (null!=map) {
y = map.get(“y","");
}
}
String y = null;
Node x = node.getNode(“x”);
1f (null!=x) {
Properties<Strings, String> properties = x.getProperties();
if (null!=properties) {
Y = properties.get (“y”,”");
}
}
String y = null;
Node x = node.getNode(“x"”);
1f (null!=x) {
ValueMap<Strings, String> map = x.getValueMap();
if (null!=map) {
y = map.get(“y”,”");
}
}
Question 53
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:
What action should the developer take to meet these requirements?
Make the class alsoimplement 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 alsoimplement 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 alsoimplement 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 alsoimplement 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.
Question 54
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 mode structure should the developer use to meet these requirements?
+ component
- jcr: primaryType="cq: Camponent”
- jcr:title="Component”
- componentGroup=" hidden”
+ cq:dialog
+ cq:editConfig
- cq:actions = “[edit]”
+ component
- jcr:primaryType="cq: Camponent”
- jcr:title="Component”
- cq:actions = “[edit]”
+ cq:dialog
+ 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]”
Question 55
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:
The system console shows the following package availability:
Bundle com.custom.package.b to be installed has the following package definition:
What will happen when the developer uploads the bundle com.custom.package.b into the system?
• The bundle will install but fail the activation due to unsatisfied dependency com.sample.package.b.
• The bundle will install and activate successfully.
• 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.
Question 56
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:
The dialog of Component B on path ../cq:dialog/../../items looks like:
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 the align node from Component A to Component B and order them according the requirements.
• Move all 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.
Question 57
A developer has a component foobar that consists of the files listed below:
script-a.js
script-b.js
foobar.html
What is the output when this component is rendered?
<div>
<div class="bar"></div>
<div class="foo"></div>
<div></div>
<div></div>
</div>
<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="f00"></div>
<div class=""></div>
</div>
Question 58
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.)
ResourceResolverFactory resolverFactory;
if (null!=resolverFactory) {
Map<String,Object> authenticationInfo = new HashMap<String, String>();
authenticationInfo.put (“username”, “reposervice”);
Session session - resolverFactory.getAdministrativeResourceResolver (authen
ticationInfo, resolverFactory.getPassworg (“reposervice”)) .adaptTo (Session.class);
}
SlingRepository repo;
if (null != repo) {
Session session = repo.loginService (null, repo.getDefaultWorkspace());
}
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<String,Object> authenticationInfo = new HashMap<String, String>();
authenticationInfo.put (“username”, “admin”);
authenticationInfo.put (“password”, “admin”);
Session session - resolverFactory.getAdministrativeResourceResolver (authen
ticationInfo) .adaptTo(Session.class);
}
Question 59
A developer creates the following code snippet to implement a simple polling importer to fetch stock prices from an external source:
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?
+/apps/system/config/com.adobe.training.core.core.StockDataImporter [sling:0
sgiConfig]
-SCHEME_PROPERTY: “stock”
-source: “ADBE”
-target: “/content”
-interval: 5
+/apps/system/config/com.adobe.training.core.core.StockDataImporter [sling:0
sgiConfig]
-sling:resourceType: com.adobe.training.core.core.StockDataImporter
-SCHEME_PROPERTY: “ADBE”
-target: “/content”
-interval: 5
+/etc/importers/polling/stock
-jcr:mixinTypes: [ “cq:PollConfig”]
-source: “stock:ADBE”
-interval: 300
-target: “/content”
+/etc/importers/polling/stock
-sling:resourceType: com.adobe.training.core.core.StockDataImporter
-stock: “ADBE”
-interval: 300
-target: “/content”
Question 60
What is the artifact ID of the maven dependency that contains all core AEM APIs?
• core-jar
• api-jar
• aem-jar
• uber-jar
Question 61
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. Enable JS/CSS minification in OSGi configuration console for HTML Library Manager.
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. Add the selector debugClientLibs to the page request.
2. Check the JavaScript exception log in the OSGi web console.
1. Add the query parameter debugClientLibs=true to the request.
2. Use the browser JavaScript debugging tools.
Question 62
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?
· Add the line “#base=touch” to the js.txt and css.txt files in the Client Library Folder.
· Create a resource folder called “touch” under the Client Library Folder.
· Set the channels property on the Client Library Folder to “touch”.
· Pass the parameter user-agent=’touch’ when referencing the Client Library.
Question 63
Which xml tag is used within the vault package definition to add a new path to a content package?
· <filter>
· <content>
· <path>
· <rule>
Question 64
A developer wants to automatically truncate request log files once they exceed 10 MB.
Which OSGi configuration should the developer modify?
· Apache Sling Customizable Request Data Logger
· Apache Sling Logging Configuration
· Apache Sling Logging Writer Configuration
· Adobe Granite Log Analysis Service
Question 65
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?
<sly data-sly-use.clientlib=”/libs/granite/sightly/templates/clientlib.html”
data-sly-call=”${clientlib.css @categories=’library.example’}”/>
<sly data-sly-use.clientlib=”/libs/granite/sightly/templates/clientlib.html” data-sly-call=”${clientlib.css @ category=’library.example’}”/>
<sly data-sly-use.clientlib=”/libs/granite/sightly/templates/clientlib.html” data-sly-call=”${clientlib.all @ categories=’library.example.css’}”/>
<sly data-sly-use.clientlib=”/libs/granite/sightly/templates/clientlib.html” data-sly-call=”${clientlib.all @ type=’css’, categories=’library.example’}”/>
Question 66
A developer needs to install a content package on AEM environment. However, a content package with the same name is already installed.
What would you 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.
· Upload the content package to the CRX Package Share before installing it.
· Install the content package using the OSGi web console.
Question 67
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.)
· 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.
· 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.
· Deploy a third party dependency injection container to wire dependencies more efficiently in application code.
Question 68
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 third party bundle in the bundle that depends on it.
· Embed the bundle in a content package to have it automatically deployed.
· Declare the dependency correctly using a link to the OSGi Bundle Repository (OBR).
Question 69
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 efficiency meet these requirements?
· Access CRXDE and upload the files through the interface.
· Make the changes in CRXDE create a content package, download it, and expand it into the working directory after each change.
· Install FileVault bundle in the AEM instance and register the local working directory for synchronization.
· Build a Content Package using maven and deploy
Question 70
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/world
· path/page.bar.html/hello/world
· path/page.foo.bar.html/hello/world
· path/page.infinity.json.bar.html/world
No comments:
Post a Comment
If you have any doubts or questions, please let us know.