Free Adobe AD0-E134 Exam Actual Questions

The questions for AD0-E134 were last updated On Nov 20, 2024

Question No. 1

An AEM application development team is assigned a task to create an Event-Driven Data Layer implementation for an Analytics solution.

Which Adobe recommended best practice should the developer choose?

Show Answer Hide Answer
Question No. 2

A developer is on an AEM application that is being used to calculate an employee's salary. The calculation is done in an OSGi service called CalculationService. This service class has a dependency on one other service, called the EmployeeService.

How should the developer make sure that the critical code in the CalculationService has a high unit test coverage?

Show Answer Hide Answer
Question No. 3

An AEM Developer receives requirements for Sling Models in a human-readable yaml format. A custom application needs to be built. The dependency is as shown:

Show Answer Hide Answer
Correct Answer: C

To create Sling Models that can export data in a human-readable yaml format, the following steps are required:

Create Sling models to export as yaml. Sling models are Java classes that can be used to represent resources in AEM. Sling models can use annotations to define how they can be adapted from a resource and how they can export data in different formats. To export data in yaml format, the Sling model class needs to use the @Model annotation with the resourceType parameter set to the resource type of the resource that the model represents. The Sling model class also needs to implement the org.apache.sling.models.annotations.Exporter annotation with the name parameter set to ''jackson'' and the extensions parameter set to ''yaml''. The Sling model class also needs to use the @JsonProperty annotation on the fields or methods that need to be exported in yaml format.

Configure mime type in Apache Sling MIME Type Service. The Apache Sling MIME Type Service is an OSGi service that maps file extensions to MIME types and vice vers

a. To enable the yaml format for Sling models, the MIME Type Service needs to be configured with a new entry for the yaml extension and its corresponding MIME type, which is ''application/x-yaml''. This can be done by creating an OSGi configuration for the org.apache.sling.commons.mime.internal.MimeTypeServiceImpl service and adding the entry ''yaml=application/x-yaml'' to the mime.types property. Reference: https://sling.apache.org/documentation/bundles/models.html https://sling.apache.org/documentation/bundles/mime-type-support-commons-mime.html


Question No. 4

After defining a Sling Model, what step is required to enable JSON export on any component?

Show Answer Hide Answer
Correct Answer: A

To enable JSON export on any component after defining a Sling Model, you need to annotate the Sling Model interface with @Exporter annotation. This annotation is part of the Sling Model Exporter framework which allows Sling Models to be exported in JSON format.

Here is the detailed step-by-step explanation:

Define the Sling Model: Define your Sling Model with the necessary annotations and methods. For example:

@Model(adaptables = Resource.class)

public class MyModel {

@Inject

private String title;

public String getTitle() {

return title;

}

}

Annotate with @Exporter: Annotate the Sling Model class with @Exporter to enable JSON export. The @Exporter annotation configures the model to be exported as JSON.

@Model(adaptables = Resource.class)

@Exporter(name = 'jackson', extensions = 'json')

public class MyModel {

@Inject

private String title;

public String getTitle() {

return title;

}

}

Access the JSON Output: Once annotated, the JSON representation of the model can be accessed through the .model.json extension. For example, if your component is at /content/mysite/en, you can access the JSON output at:

http://localhost:4502/content/mysite/en.model.json

This approach leverages the Sling Model Exporter framework to seamlessly convert Sling Models to JSON format, making it easy to integrate with front-end frameworks and other systems that consume JSON data.


Adobe Sling Model Exporter

AEM Core Components JSON Export

Question No. 5

A customer is having trouble with some search queries and provides the following information:

* The logs show the following warning occurs many time: WARN* Traversed 1000 nodes with filter Filter (query=select...)

* The client has more than 100,000 stored in their AEM instance

* The client uses a custom page property to help search for pages of a given type

What should the AEM Developer do to help resolve the client's issue?

Show Answer Hide Answer
Correct Answer: A

The warning WARN* Traversed 1000 nodes with filter Filter (query=select...) indicates that the query is performing a traversal instead of using an index. This results in poor performance, especially when the client has a large number of nodes (e.g., more than 100,000).

To resolve this issue, you should create a custom Oak index for the custom page property. This ensures that the queries can leverage the index for efficient data retrieval.

Steps to create a custom Oak index:

Define the Oak Index:

Navigate to the /oak:index node in CRXDE Lite (http://localhost:4502/crx/de).

Create a new node of type oak:QueryIndexDefinition.

Configure the Index:

Set the properties of the new index node to define the indexing rules for the custom page property.

{

'jcr:primaryType': 'oak:QueryIndexDefinition',

'type': 'property',

'propertyNames': ['customPageProperty'],

'reindex': true,

'async': 'async'

}

Deploy and Reindex:

Save the changes and initiate a reindexing process.

Ensure that the reindex flag is set to true for the newly created index.

Validate the Index:

Use the Index Manager or the AEM Web Console to validate that the new index is enabled and functioning correctly.

By creating a custom Oak index for the custom page property, the queries will be optimized to use the index, significantly improving the search performance and resolving the client's issue.


Adobe Experience Manager - Oak Indexing

Apache Jackrabbit Oak - Indexing