|
| 1 | +# Turing AEM Plugin Sample |
| 2 | + |
| 3 | +This is a sample implementation of the Turing AEM Connector Plugin that demonstrates how to create custom extensions for Adobe Experience Manager (AEM) content indexing and search integration with Viglet Turing. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The AEM Plugin Sample provides a working example of how to: |
| 8 | +- Extend AEM content indexing capabilities |
| 9 | +- Implement custom content processors for AEM fragments |
| 10 | +- Configure delta indexing for incremental content updates |
| 11 | +- Set up AEM-to-Turing integration with the WKND sample site |
| 12 | + |
| 13 | +## What This Sample Includes |
| 14 | + |
| 15 | +### Core Components |
| 16 | + |
| 17 | +- **Custom Extensions**: Sample implementations of AEM extension interfaces |
| 18 | + - `TurAemExtSampleDeltaDate`: Handles delta date processing for incremental indexing |
| 19 | + - `TurAemExtSampleModelJson`: Processes AEM content fragments and model JSON data |
| 20 | + |
| 21 | +- **Configuration**: Pre-configured setup for the WKND sample site |
| 22 | + - Source configuration with AEM author/publish endpoints |
| 23 | + - Attribute mappings for content indexing |
| 24 | + - Locale-specific path configurations |
| 25 | + |
| 26 | +- **Scripts**: Automated build and deployment scripts |
| 27 | + - Build automation with Maven and Ant |
| 28 | + - Runtime configuration for different environments |
| 29 | + - Ready-to-run connector setup |
| 30 | + |
| 31 | +### Sample Data Model |
| 32 | + |
| 33 | +The sample includes a `TurAemSampleModel` bean that demonstrates how to handle AEM content fragments with custom properties like `fragmentPath`. |
| 34 | + |
| 35 | +## Prerequisites |
| 36 | + |
| 37 | +Before deploying this sample, ensure you have: |
| 38 | + |
| 39 | +1. **Java 21+** ☕ |
| 40 | +2. **Maven 3.6+** 📦 |
| 41 | +3. **Apache Ant** (for build scripts) 🐜 |
| 42 | +4. **Adobe Experience Manager 6.5+** running locally or remotely |
| 43 | +5. **Viglet Turing** server running and accessible |
| 44 | +6. **AEM WKND Sample Site** (recommended for testing) |
| 45 | + |
| 46 | +## Quick Start |
| 47 | + |
| 48 | +### 1. Clone and Build |
| 49 | + |
| 50 | +```bash |
| 51 | +# Navigate to the sample directory |
| 52 | +cd turing-aem/aem-plugin-sample |
| 53 | + |
| 54 | +# Build the sample using the provided script |
| 55 | +compile-and-run.cmd |
| 56 | +``` |
| 57 | + |
| 58 | +This will: |
| 59 | +- Clean and compile the Maven project |
| 60 | +- Package the sample plugin |
| 61 | +- Copy required JARs to the distribution directory |
| 62 | +- Launch the connector |
| 63 | + |
| 64 | +### 2. Manual Build Process |
| 65 | + |
| 66 | +If you prefer to build manually: |
| 67 | + |
| 68 | +```bash |
| 69 | +# Build the sample plugin |
| 70 | +./mvnw clean install package |
| 71 | + |
| 72 | +# Build using Ant (creates dist/wknd directory) |
| 73 | +ant wknd |
| 74 | + |
| 75 | +# Navigate to the distribution directory |
| 76 | +cd dist/wknd |
| 77 | + |
| 78 | +# Run the connector |
| 79 | +run.cmd |
| 80 | +``` |
| 81 | + |
| 82 | +## Configuration |
| 83 | + |
| 84 | +### Environment Configuration |
| 85 | + |
| 86 | +Edit `scripts/wknd/env.cmd` to configure your environment: |
| 87 | + |
| 88 | +```batch |
| 89 | +set TURING_URL=http://localhost:2700 |
| 90 | +set TURING_API_KEY=your_api_key_here |
| 91 | +``` |
| 92 | + |
| 93 | +### AEM Source Configuration |
| 94 | + |
| 95 | +The sample includes a pre-configured WKND source in `scripts/wknd/export/wknd.json`: |
| 96 | + |
| 97 | +```json |
| 98 | +{ |
| 99 | + "sources": [ |
| 100 | + { |
| 101 | + "name": "WKND", |
| 102 | + "endpoint": "http://localhost:4502", |
| 103 | + "username": "admin", |
| 104 | + "password": "admin", |
| 105 | + "rootPath": "/content/wknd", |
| 106 | + "contentType": "cq:Page", |
| 107 | + "authorSNSite": "wknd-author", |
| 108 | + "publishSNSite": "wknd-publish" |
| 109 | + } |
| 110 | + ] |
| 111 | +} |
| 112 | +``` |
| 113 | + |
| 114 | +### Key Configuration Parameters |
| 115 | + |
| 116 | +| Parameter | Description | Default Value | |
| 117 | +|-----------|-------------|---------------| |
| 118 | +| `endpoint` | AEM instance URL | `http://localhost:4502` | |
| 119 | +| `username` | AEM admin username | `admin` | |
| 120 | +| `password` | AEM admin password | `admin` | |
| 121 | +| `rootPath` | Content root path to index | `/content/wknd` | |
| 122 | +| `authorURLPrefix` | Author instance URL prefix | `http://localhost:4502` | |
| 123 | +| `publishURLPrefix` | Publish instance URL prefix | `https://wknd.site` | |
| 124 | + |
| 125 | +## Deployment |
| 126 | + |
| 127 | +### Option 1: Using Build Scripts |
| 128 | + |
| 129 | +1. **Configure environment variables** in `scripts/wknd/env.cmd` |
| 130 | +2. **Run the automated build and deployment**: |
| 131 | + ```cmd |
| 132 | + compile-and-run.cmd |
| 133 | + ``` |
| 134 | + |
| 135 | +### Option 2: Manual Deployment |
| 136 | + |
| 137 | +1. **Build the project**: |
| 138 | + ```bash |
| 139 | + ./mvnw clean install package |
| 140 | + ``` |
| 141 | + |
| 142 | +2. **Create distribution directory**: |
| 143 | + ```bash |
| 144 | + mkdir -p dist/wknd/libs |
| 145 | + ``` |
| 146 | + |
| 147 | +3. **Copy required files**: |
| 148 | + ```bash |
| 149 | + # Copy sample plugin |
| 150 | + cp target/aem-plugin-sample.jar dist/wknd/libs/ |
| 151 | + |
| 152 | + # Copy AEM plugin |
| 153 | + cp ../aem-plugin/target/aem-plugin.jar dist/wknd/libs/ |
| 154 | + |
| 155 | + # Copy connector application |
| 156 | + cp ../../turing-connector/connector-app/target/turing-connector.jar dist/wknd/ |
| 157 | + |
| 158 | + # Copy scripts |
| 159 | + cp -r scripts/wknd/* dist/wknd/ |
| 160 | + ``` |
| 161 | + |
| 162 | +4. **Run the connector**: |
| 163 | + ```bash |
| 164 | + cd dist/wknd |
| 165 | + java -Dloader.path=libs \ |
| 166 | + -Dturing.url=http://localhost:2700 \ |
| 167 | + -Dturing.apiKey=your_api_key \ |
| 168 | + -Dspring.h2.console.enabled=true \ |
| 169 | + -jar turing-connector.jar |
| 170 | + ``` |
| 171 | + |
| 172 | +## Usage |
| 173 | + |
| 174 | +### Starting the Connector |
| 175 | + |
| 176 | +Once deployed, start the connector with: |
| 177 | + |
| 178 | +```cmd |
| 179 | +cd dist/wknd |
| 180 | +run.cmd |
| 181 | +``` |
| 182 | + |
| 183 | +The connector will: |
| 184 | +1. Load the sample plugin extensions |
| 185 | +2. Connect to your AEM instance |
| 186 | +3. Connect to Turing server |
| 187 | +4. Start indexing content from the configured root path |
| 188 | + |
| 189 | +### Monitoring |
| 190 | + |
| 191 | +- **H2 Console**: Access at `http://localhost:8080/h2-console` (if enabled) |
| 192 | +- **Logs**: Monitor console output for indexing progress |
| 193 | +- **Turing Dashboard**: Check indexed content at your Turing URL |
| 194 | + |
| 195 | +### Custom Extensions |
| 196 | + |
| 197 | +To create your own extensions: |
| 198 | + |
| 199 | +1. **Implement the required interfaces**: |
| 200 | + - `TurAemExtContentInterface` for content processing |
| 201 | + - `TurAemExtDeltaDateInterface` for delta indexing |
| 202 | + |
| 203 | +2. **Add your extension classes to the configuration**: |
| 204 | + ```json |
| 205 | + { |
| 206 | + "deltaClass": "com.your.package.YourDeltaExtension", |
| 207 | + "attributes": [ |
| 208 | + { |
| 209 | + "className": "com.your.package.YourContentExtension" |
| 210 | + } |
| 211 | + ] |
| 212 | + } |
| 213 | + ``` |
| 214 | + |
| 215 | +## Troubleshooting |
| 216 | + |
| 217 | +### Common Issues |
| 218 | + |
| 219 | +**Q: Connection refused to AEM** |
| 220 | +A: Verify AEM is running and accessible at the configured endpoint. Check username/password. |
| 221 | + |
| 222 | +**Q: Turing API key invalid** |
| 223 | +A: Ensure your API key is correct in `env.cmd` and that Turing server is running. |
| 224 | + |
| 225 | +**Q: No content being indexed** |
| 226 | +A: Check that the `rootPath` exists in AEM and contains the specified `contentType`. |
| 227 | + |
| 228 | +**Q: Build fails** |
| 229 | +A: Ensure Java 21+ is installed and `JAVA_HOME` is set correctly. |
| 230 | + |
| 231 | +### Debugging |
| 232 | + |
| 233 | +Enable debug logging by adding to your run command: |
| 234 | +```bash |
| 235 | +-Dlogging.level.com.viglet.turing=DEBUG |
| 236 | +``` |
| 237 | + |
| 238 | +### Support |
| 239 | + |
| 240 | +- 📋 [GitHub Discussions](https://github.com/openviglet/turing/discussions) |
| 241 | +- 🐛 [Report Issues](https://github.com/openviglet/turing/issues) |
| 242 | +- 📖 [Main Documentation](../../README.adoc) |
| 243 | + |
| 244 | +## Next Steps |
| 245 | + |
| 246 | +1. **Explore the code**: Review the extension implementations in `src/main/java` |
| 247 | +2. **Customize configuration**: Modify `wknd.json` for your specific AEM setup |
| 248 | +3. **Create custom extensions**: Implement your own content processors |
| 249 | +4. **Test with real content**: Replace WKND with your actual AEM content structure |
| 250 | + |
| 251 | +This sample provides a foundation for building production-ready AEM-to-Turing integrations. Customize the extensions and configuration to match your specific content models and indexing requirements. |
0 commit comments