├── .github └── workflows │ └── maven.yml ├── .gitignore ├── LICENSE ├── README.en.md ├── README.md ├── architecture-trans-node.png ├── gengine-commons ├── pom.xml └── src │ ├── main │ └── java │ │ └── org │ │ └── gengine │ │ ├── api │ │ └── StableApi.java │ │ ├── content │ │ ├── AbstractContentWorker.java │ │ ├── ContentIOException.java │ │ ├── ContentReference.java │ │ ├── ContentWorkResult.java │ │ ├── ContentWorker.java │ │ ├── file │ │ │ ├── FileProvider.java │ │ │ ├── FileProviderImpl.java │ │ │ └── TempFileProvider.java │ │ ├── handler │ │ │ ├── AbstractUrlContentReferenceHandler.java │ │ │ ├── ContentReferenceHandler.java │ │ │ ├── DelegatingContentHandlerImpl.java │ │ │ ├── FileContentReferenceHandler.java │ │ │ └── FileContentReferenceHandlerImpl.java │ │ └── mediatype │ │ │ ├── FileMediaType.java │ │ │ ├── FileMediaTypeService.java │ │ │ └── FileMediaTypeServiceImpl.java │ │ ├── error │ │ └── GengineRuntimeException.java │ │ └── util │ │ ├── BeanUtils.java │ │ ├── CloneField.java │ │ ├── EqualsHelper.java │ │ ├── I18NUtil.java │ │ ├── Mergable.java │ │ ├── Pair.java │ │ ├── ToStringProperty.java │ │ └── exec │ │ ├── ExecParameterTokenizer.java │ │ └── RuntimeExec.java │ └── test │ ├── java │ └── org │ │ └── gengine │ │ ├── content │ │ ├── file │ │ │ ├── OverridingTempFileProvider.java │ │ │ ├── OverridingTempFileProviderTest.java │ │ │ └── TempFileProviderTest.java │ │ ├── handler │ │ │ ├── DelegatingContentHandlerImplTest.java │ │ │ └── FileContentReferenceHandlerImplTest.java │ │ └── mediatype │ │ │ └── MediaTypeServiceTest.java │ │ └── util │ │ └── exec │ │ ├── ExecParameterTokenizerTest.java │ │ └── RuntimeExecTest.java │ └── resources │ ├── content-handler-a │ ├── file-a-1.txt │ └── file-a-2.txt │ ├── content-handler-b │ ├── file-b-1.txt │ └── file-b-2.txt │ ├── content-handler-c │ ├── file-c-1.txt │ └── file-c-2.txt │ ├── log4j.properties │ └── quick │ ├── quick.mpg │ └── quick.pdf ├── gengine-content-handlers ├── gengine-content-handler-s3 │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── gengine │ │ │ └── content │ │ │ └── handler │ │ │ └── s3 │ │ │ └── S3ContentReferenceHandlerImpl.java │ │ └── test │ │ └── java │ │ └── org │ │ └── gengine │ │ └── content │ │ └── handler │ │ └── s3 │ │ └── S3ContentReferenceHandlerImplTest.java ├── gengine-content-handler-tempfile │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── gengine │ │ └── content │ │ ├── file │ │ └── CleaningTempFileProvider.java │ │ └── handler │ │ └── tempfile │ │ └── TempFileContentReferenceHandlerImpl.java ├── gengine-content-handler-webdav │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── gengine │ │ └── content │ │ └── handler │ │ └── webdav │ │ └── WebDavContentReferenceHandlerImpl.java └── pom.xml ├── gengine-hash ├── gengine-hash-commons │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── gengine │ │ └── content │ │ └── hash │ │ ├── AbstractContentHashWorker.java │ │ ├── ContentHashException.java │ │ └── ContentHashWorker.java ├── gengine-hash-component │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── gengine │ │ └── content │ │ └── hash │ │ └── BaseContentHashComponent.java ├── gengine-hash-messaging │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── gengine │ │ └── content │ │ └── hash │ │ ├── HashReply.java │ │ └── HashRequest.java ├── gengine-hash-worker-javase │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── gengine │ │ │ │ └── content │ │ │ │ └── hash │ │ │ │ └── javase │ │ │ │ └── JavaSeContentHashWorker.java │ │ └── resources │ │ │ └── org │ │ │ └── gengine │ │ │ └── content │ │ │ └── hash │ │ │ └── javase │ │ │ └── JavaSeContentHashWorker.properties │ │ └── test │ │ └── java │ │ └── org │ │ └── gengine │ │ └── content │ │ └── hash │ │ └── javase │ │ └── JavaSeContentHashWorkerTest.java └── pom.xml ├── gengine-health-commons ├── README.md ├── pom.xml └── src │ └── main │ └── java │ └── org │ └── gengine │ └── health │ ├── ComponentUnavailableAction.java │ ├── ComponentUnavailableActionTerminate.java │ ├── ComponentUnavailableException.java │ ├── ComponentUnavailableExceptionHandler.java │ ├── CompositeComponentUnavailableAction.java │ └── heartbeat │ ├── AbstractHeartImpl.java │ ├── Heart.java │ ├── Heartbeat.java │ ├── HeartbeatDao.java │ └── HeartbeatMonitor.java ├── gengine-messaging ├── gengine-messaging-amqp-direct │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── gengine │ │ └── messaging │ │ └── amqp │ │ ├── AmqpDirectEndpoint.java │ │ └── AmqpNodeBootstrapUtils.java ├── gengine-messaging-benchmark │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── gengine │ │ │ └── messaging │ │ │ └── benchmark │ │ │ ├── BenchmarkConsumer.java │ │ │ ├── BenchmarkMessage.java │ │ │ ├── BenchmarkRunner.java │ │ │ ├── Bootstrap.java │ │ │ └── BootstrapArguments.java │ │ └── resources │ │ └── log4j.properties ├── gengine-messaging-camel │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── gengine │ │ │ ├── health │ │ │ └── camel │ │ │ │ ├── ComponentUnavailableActionStopCamelContext.java │ │ │ │ ├── ExceptionProcessor.java │ │ │ │ └── HeartbeatMonitorImpl.java │ │ │ └── messaging │ │ │ └── camel │ │ │ ├── CamelMessageProducer.java │ │ │ └── CamelRequestReplyMessageProducer.java │ │ └── test │ │ └── java │ │ └── org │ │ └── gengine │ │ └── messaging │ │ └── camel │ │ └── dataformat │ │ ├── JacksonDataFormatTest.java │ │ └── SimplePojo.java ├── gengine-messaging-commons │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── gengine │ │ │ ├── content │ │ │ ├── AbstractAsyncComponent.java │ │ │ ├── AbstractComponent.java │ │ │ ├── AbstractContentReply.java │ │ │ ├── AbstractContentRequest.java │ │ │ ├── Component.java │ │ │ └── ContentReply.java │ │ │ └── messaging │ │ │ ├── AbstractReply.java │ │ │ ├── AbstractRequest.java │ │ │ ├── LoggingDeadLetterQueue.java │ │ │ ├── MessageConsumer.java │ │ │ ├── MessageProducer.java │ │ │ ├── MessagingException.java │ │ │ ├── Reply.java │ │ │ ├── Request.java │ │ │ ├── RequestReplyMessageProducer.java │ │ │ └── jackson │ │ │ ├── ObjectMapperFactory.java │ │ │ └── QpidJsonBodyCleanerObjectMapper.java │ │ └── test │ │ └── resources │ │ └── log4j2.properties ├── messaging-broker-activemq │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ └── resources │ │ │ ├── activemq │ │ │ ├── activemq.xml │ │ │ ├── credentials.properties │ │ │ ├── jetty-realm.properties │ │ │ └── jetty.xml │ │ │ └── log4j.properties │ │ └── test │ │ └── webapp │ │ └── admin │ │ ├── 404.html │ │ ├── 500.html │ │ ├── META-INF │ │ ├── LICENSE │ │ └── NOTICE │ │ ├── WEB-INF │ │ ├── classes │ │ │ └── org │ │ │ │ └── apache │ │ │ │ └── activemq │ │ │ │ └── web │ │ │ │ ├── WebConsoleStarter$OsgiUtil.class │ │ │ │ ├── WebConsoleStarter.class │ │ │ │ ├── config │ │ │ │ └── OsgiConfiguration.class │ │ │ │ ├── controller │ │ │ │ ├── CopyMessage.class │ │ │ │ ├── CreateDestination.class │ │ │ │ ├── CreateSubscriber.class │ │ │ │ ├── DeleteDestination.class │ │ │ │ ├── DeleteJob.class │ │ │ │ ├── DeleteMessage.class │ │ │ │ ├── DeleteSubscriber.class │ │ │ │ ├── MoveMessage.class │ │ │ │ ├── PurgeDestination.class │ │ │ │ └── SendMessage.class │ │ │ │ ├── filter │ │ │ │ ├── ApplicationContextFilter$1.class │ │ │ │ ├── ApplicationContextFilter$2.class │ │ │ │ └── ApplicationContextFilter.class │ │ │ │ └── handler │ │ │ │ └── BindingBeanNameUrlHandlerMapping.class │ │ ├── decorators.xml │ │ ├── dispatcher-servlet.xml │ │ ├── jspf │ │ │ ├── headertags.jspf │ │ │ └── old.jspf │ │ ├── tags │ │ │ ├── form │ │ │ │ ├── checkbox.tag │ │ │ │ ├── escape.tag │ │ │ │ ├── forEachMapEntry.tag │ │ │ │ ├── option.tag │ │ │ │ ├── short.tag │ │ │ │ ├── text.tag │ │ │ │ ├── tooltip.tag │ │ │ │ └── uri.tag │ │ │ └── jms │ │ │ │ ├── forEachConnection.tag │ │ │ │ ├── forEachMessage.tag │ │ │ │ ├── formatTimestamp.tag │ │ │ │ └── persistent.tag │ │ ├── web.xml │ │ ├── webconsole-default.xml │ │ ├── webconsole-embedded.xml │ │ ├── webconsole-invm.xml │ │ ├── webconsole-jndi.xml │ │ ├── webconsole-osgi.xml │ │ ├── webconsole-properties.xml │ │ └── webconsole-query.xml │ │ ├── browse.jsp │ │ ├── connection.jsp │ │ ├── connections.jsp │ │ ├── decorators │ │ ├── main.jsp │ │ ├── panel.jsp │ │ └── printable.jsp │ │ ├── graph.jsp │ │ ├── index.jsp │ │ ├── js │ │ ├── common.js │ │ ├── css.js │ │ ├── mochi │ │ │ ├── MochiKit.js │ │ │ └── __package__.js │ │ ├── plotkit │ │ │ ├── Base.js │ │ │ ├── Canvas.js │ │ │ ├── Layout.js │ │ │ ├── SVG.js │ │ │ ├── SweetCanvas.js │ │ │ ├── SweetSVG.js │ │ │ ├── dummy.svg │ │ │ └── iecanvas.htc │ │ ├── prettify.js │ │ └── standardista-table-sorting.js │ │ ├── message.jsp │ │ ├── network.jsp │ │ ├── queueConsumers.jsp │ │ ├── queueGraph.jsp │ │ ├── queues.jsp │ │ ├── scheduled.jsp │ │ ├── send.jsp │ │ ├── slave.jsp │ │ ├── styles │ │ ├── prettify.css │ │ ├── site.css │ │ ├── sorttable.css │ │ └── type-settings.css │ │ ├── subscribers.jsp │ │ ├── test │ │ ├── dummy.jsp │ │ ├── index.jsp │ │ └── systemProperties.jsp │ │ ├── topics.jsp │ │ └── xml │ │ ├── queues.jsp │ │ ├── subscribers.jsp │ │ └── topics.jsp └── pom.xml ├── gengine-node-simple ├── README.md ├── pom.xml └── src │ └── main │ ├── config │ ├── ffmpeg.properties │ ├── imagemagick.properties │ └── j2sehash.properties │ ├── java │ └── org │ │ └── gengine │ │ └── content │ │ └── node │ │ ├── AbstractComponentBootstrapFromProperties.java │ │ ├── HashComponentBootstrapFromProperties.java │ │ ├── SimpleAmqpNodeBootstrap.java │ │ └── TransformerComponentBootstrapFromProperties.java │ └── resources │ └── log4j.properties ├── gengine-transform ├── gengine-transform-commons │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── gengine │ │ │ └── content │ │ │ └── transform │ │ │ ├── AbstractContentTransformerWorker.java │ │ │ ├── AbstractFileContentTransformerWorker.java │ │ │ ├── AbstractRuntimeExecContentTransformerWorker.java │ │ │ ├── ContentTransformerWorker.java │ │ │ ├── ContentTransformerWorkerProgressReporter.java │ │ │ ├── LoggingProgressReporterImpl.java │ │ │ ├── TransformerDebug.java │ │ │ ├── options │ │ │ ├── AbstractTransformationSourceOptions.java │ │ │ ├── AudioTransformationOptions.java │ │ │ ├── CropSourceOptions.java │ │ │ ├── ImageResizeOptions.java │ │ │ ├── ImageTransformationOptions.java │ │ │ ├── PagedSourceOptions.java │ │ │ ├── SerializedTransformationOptionsAccessor.java │ │ │ ├── TemporalSourceOptions.java │ │ │ ├── TransformationOptionLimits.java │ │ │ ├── TransformationOptionPair.java │ │ │ ├── TransformationOptions.java │ │ │ ├── TransformationOptionsImpl.java │ │ │ ├── TransformationSourceOptions.java │ │ │ └── VideoTransformationOptions.java │ │ │ └── util │ │ │ └── TimecodeUtils.java │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── gengine │ │ │ └── content │ │ │ └── transform │ │ │ ├── AbstractContentTransformerWorkerTest.java │ │ │ ├── options │ │ │ ├── TransformationOptionsTest.java │ │ │ └── TransformationSourceOptionsTest.java │ │ │ └── util │ │ │ └── TimecodeUtilsTest.java │ │ └── resources │ │ └── log4j2.properties ├── gengine-transform-component │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── gengine │ │ │ └── content │ │ │ └── transform │ │ │ └── BaseContentTransformerComponent.java │ │ └── test │ │ └── java │ │ └── org │ │ └── gengine │ │ └── messaging │ │ └── marshalling │ │ └── JsonObjectMarshallerImplTest.java ├── gengine-transform-messaging │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── gengine │ │ │ └── content │ │ │ └── transform │ │ │ ├── TransformationReply.java │ │ │ └── TransformationRequest.java │ │ └── test │ │ └── java │ │ └── org │ │ └── gengine │ │ └── content │ │ └── transform │ │ └── TransformationRequestMarshallingTest.java ├── gengine-transform-worker-ffmpeg │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── gengine │ │ │ │ └── content │ │ │ │ └── transform │ │ │ │ └── ffmpeg │ │ │ │ ├── FfmpegContentTransformerWorker.java │ │ │ │ └── FfmpegInputStreamReaderThreadFactory.java │ │ └── resources │ │ │ └── org │ │ │ └── gengine │ │ │ └── content │ │ │ └── transform │ │ │ └── ffmpeg │ │ │ ├── FfmpegContentTransformerWorker.properties │ │ │ └── test.mp4 │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── gengine │ │ │ └── content │ │ │ └── transform │ │ │ └── ffmpeg │ │ │ └── FfmpegContentTransformerWorkerIT.java │ │ └── resources │ │ └── quick │ │ ├── countdown-leader.mp4 │ │ └── quick-1080.mov ├── gengine-transform-worker-imagemagick │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── gengine │ │ │ │ └── content │ │ │ │ └── transform │ │ │ │ └── imagemagick │ │ │ │ └── ImageMagickContentTransformerWorker.java │ │ └── resources │ │ │ └── org │ │ │ └── gengine │ │ │ └── content │ │ │ └── transform │ │ │ └── imagemagick │ │ │ └── ImageMagickContentTransformerWorker.properties │ │ └── test │ │ └── java │ │ └── org │ │ └── gengine │ │ └── content │ │ └── transform │ │ └── imagemagick │ │ └── ImageMagickContentTransformerWorkerIT.java └── pom.xml └── pom.xml /.github/workflows/maven.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a package using Maven and then publish it to GitHub packages when a release is created 2 | # For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path 3 | name: Maven Package 4 | 5 | on: 6 | push: 7 | branches: ["master"] 8 | pull_request: 9 | branches: ["master"] 10 | 11 | defaults: 12 | run: 13 | shell: bash 14 | 15 | jobs: 16 | build: 17 | 18 | runs-on: ubuntu-latest 19 | permissions: 20 | contents: read 21 | packages: write 22 | 23 | steps: 24 | - uses: actions/checkout@v4 25 | - name: Set up JDK 11 26 | uses: actions/setup-java@v4 27 | with: 28 | java-version: '11' 29 | distribution: 'temurin' 30 | server-id: github 31 | settings-path: ${{ github.workspace }} 32 | 33 | - name: Build with Maven 34 | run: mvn -B package -DskipTests --file pom.xml 35 | 36 | # - name: Publish to GitHub Packages Apache Maven 37 | # run: mvn deploy -DskipTests -s $GITHUB_WORKSPACE/settings.xml 38 | # env: 39 | # GITHUB_TOKEN: ${{ github.token }} 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | pom.xml.tag 3 | pom.xml.releaseBackup 4 | pom.xml.versionsBackup 5 | pom.xml.next 6 | .classpath 7 | .project 8 | .settings 9 | .DS_Store 10 | *.iml 11 | .idea/ 12 | 13 | -------------------------------------------------------------------------------- /architecture-trans-node.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenInfo/Gengine/3d32e7c36836a11863d795700e867cc49c48c796/architecture-trans-node.png -------------------------------------------------------------------------------- /gengine-commons/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | org.gengine 6 | gengine-parent 7 | 0.13-SNAPSHOT 8 | ../pom.xml 9 | 10 | 11 | gengine-commons 12 | 13 | 14 | 15 | commons-logging 16 | commons-logging 17 | ${dependency.commons-logging.version} 18 | 19 | 20 | commons-io 21 | commons-io 22 | ${dependency.commons-io.version} 23 | 24 | 25 | org.apache.tika 26 | tika-core 27 | ${dependency.tika.version} 28 | 29 | 30 | org.apache.maven 31 | maven-artifact 32 | 3.6.3 33 | 34 | 35 | org.apache.commons 36 | commons-lang3 37 | ${dependency.commons-lang3.version} 38 | 39 | 40 | 41 | 42 | 43 | 44 | org.apache.maven.plugins 45 | maven-jar-plugin 46 | 3.2.0 47 | 48 | 49 | 50 | test-jar 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /gengine-commons/src/main/java/org/gengine/api/StableApi.java: -------------------------------------------------------------------------------- 1 | package org.gengine.api; 2 | 3 | import java.lang.annotation.Documented; 4 | import java.lang.annotation.ElementType; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | /** 10 | * This annotation is used to denote a class or method as part 11 | * of the set of stable, unchanging elements. 12 | *

13 | * When a class or method 14 | * is so designated it will not change within a minor release, 15 | * i.e. 1.1 -> 1.2, in a way that would make it no longer backwardly compatible 16 | * with an earlier version within the release. 17 | *

18 | * Classes or methods with the annotation may still change in major releases, 19 | * i.e. 1.x -> 2.0. 20 | * 21 | */ 22 | @Target( {ElementType.TYPE,ElementType.METHOD} ) 23 | @Retention(RetentionPolicy.RUNTIME) 24 | @Documented 25 | public @interface StableApi 26 | { 27 | } 28 | -------------------------------------------------------------------------------- /gengine-commons/src/main/java/org/gengine/content/ContentIOException.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content; 2 | 3 | import org.gengine.api.StableApi; 4 | import org.gengine.error.GengineRuntimeException; 5 | 6 | 7 | /** 8 | * Wraps a general Exceptions that occurred while reading or writing 9 | * content. 10 | * 11 | * @see Throwable#getCause() 12 | * 13 | */ 14 | @StableApi 15 | public class ContentIOException extends GengineRuntimeException 16 | { 17 | private static final long serialVersionUID = 3258130249983276087L; 18 | 19 | public ContentIOException(String msg) 20 | { 21 | super(msg); 22 | } 23 | 24 | public ContentIOException(String msg, Throwable cause) 25 | { 26 | super(msg, cause); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /gengine-commons/src/main/java/org/gengine/content/ContentReference.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content; 2 | 3 | import org.gengine.content.handler.ContentReferenceHandler; 4 | 5 | /** 6 | * A reference to content by its URI and media type (mimetype). 7 | * 8 | * @see {@link ContentReferenceHandler} 9 | * 10 | */ 11 | public class ContentReference 12 | { 13 | 14 | private String uri; 15 | private String mediaType; 16 | private Long size; 17 | 18 | public ContentReference() 19 | { 20 | } 21 | 22 | public ContentReference(String uri, String mediaType) 23 | { 24 | super(); 25 | this.uri = uri; 26 | this.mediaType = mediaType; 27 | } 28 | 29 | public ContentReference(String uri, String mediaType, Long size) 30 | { 31 | super(); 32 | this.uri = uri; 33 | this.mediaType = mediaType; 34 | this.size = size; 35 | } 36 | 37 | /** 38 | * Gets the URI for the content reference 39 | * 40 | * @return the content URI 41 | */ 42 | public String getUri() 43 | { 44 | return uri; 45 | } 46 | 47 | /** 48 | * Sets the URI for the content reference 49 | * 50 | * @param uri 51 | */ 52 | public void setUri(String uri) 53 | { 54 | this.uri = uri; 55 | } 56 | 57 | /** 58 | * Gets the media type (mimetype) of the content reference 59 | * 60 | * @return media type 61 | */ 62 | public String getMediaType() 63 | { 64 | return mediaType; 65 | } 66 | 67 | /** 68 | * Sets the media type (mimetype) of the content reference 69 | * 70 | * @param mediaType 71 | */ 72 | public void setMediaType(String mediaType) 73 | { 74 | this.mediaType = mediaType; 75 | } 76 | 77 | /** 78 | * Gets the size of the content binary if available 79 | * 80 | * @return 81 | */ 82 | public Long getSize() 83 | { 84 | return size; 85 | } 86 | 87 | /** 88 | * Sets the size of the content binary 89 | * 90 | * @param size 91 | */ 92 | public void setSize(Long size) 93 | { 94 | this.size = size; 95 | } 96 | 97 | } 98 | -------------------------------------------------------------------------------- /gengine-commons/src/main/java/org/gengine/content/ContentWorkResult.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content; 2 | 3 | import java.util.Map; 4 | 5 | /** 6 | * The result of some operation on content which includes a content reference 7 | * and details about the operation. 8 | *

9 | * The content reference could indicate the source content reference on which the 10 | * work was requested or could be a new target content reference. 11 | * 12 | */ 13 | public class ContentWorkResult 14 | { 15 | private ContentReference contentReference; 16 | private Map details; 17 | 18 | public ContentWorkResult() 19 | { 20 | } 21 | 22 | public ContentWorkResult(ContentReference contentReference, Map details) 23 | { 24 | this.contentReference = contentReference; 25 | this.details = details; 26 | } 27 | 28 | /** 29 | * Gets the content reference associated with the result. 30 | * 31 | * @return the content reference 32 | */ 33 | public ContentReference getContentReference() 34 | { 35 | return contentReference; 36 | } 37 | 38 | /** 39 | * Sets the content reference associated with the result. 40 | * 41 | * @param contentReference 42 | */ 43 | public void setContentReference(ContentReference contentReference) 44 | { 45 | this.contentReference = contentReference; 46 | } 47 | 48 | /** 49 | * Gets the additional details of the result of the content work. 50 | * 51 | * @return additional details 52 | */ 53 | public Map getDetails() 54 | { 55 | return details; 56 | } 57 | 58 | /** 59 | * Sets the additional details of the result of the content work. 60 | * 61 | * @param details 62 | */ 63 | public void setDetails(Map details) 64 | { 65 | this.details = details; 66 | } 67 | 68 | /** 69 | * Convenience method for getting a specific result detail. 70 | * 71 | * @param detailKey 72 | * @return the result detail 73 | */ 74 | public Object getDetail(String detailKey) 75 | { 76 | if (details == null) 77 | { 78 | return null; 79 | } 80 | return details.get(detailKey); 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /gengine-commons/src/main/java/org/gengine/content/ContentWorker.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content; 2 | 3 | /** 4 | * Defines a low-level worker that performs some action on content, i.e. performing 5 | * a transformation, extracting metadata, computing a hash, etc. 6 | * 7 | */ 8 | public interface ContentWorker 9 | { 10 | 11 | /** 12 | * Gets whether or not the dependencies of the worker have been 13 | * properly configured for its normal operation, i.e. content reference handlers, 14 | * command line applications, etc. 15 | * 16 | * @return true if the worker is available 17 | */ 18 | public boolean isAvailable(); 19 | 20 | /** 21 | * Gets a string returning name and version information. 22 | * 23 | * @return the version string 24 | */ 25 | public String getVersionString(); 26 | 27 | 28 | /** 29 | * Gets a string returning detailed version information such as JVM 30 | * or command line application's version output 31 | * 32 | * @return the version string 33 | */ 34 | public String getVersionDetailsString(); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /gengine-commons/src/main/java/org/gengine/content/file/FileProvider.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content.file; 2 | 3 | import java.io.File; 4 | 5 | /** 6 | * Defines methods to create files. Implementations might include leverage Java's temporary 7 | * file components, explicit user-defined directories, etc. 8 | * 9 | */ 10 | public interface FileProvider 11 | { 12 | 13 | /** 14 | * Create a file with the given prefix and suffix. 15 | * 16 | * @param prefix 17 | * @param suffix 18 | * @return the newly created File object 19 | */ 20 | public File createFile(String prefix, String suffix); 21 | 22 | /** 23 | * Determines whether or not the file provider is available. 24 | *

25 | * Some implementations might check permissions via this method. 26 | * 27 | * @return whether or not the file provider is available as configured 28 | */ 29 | public boolean isAvailable(); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /gengine-commons/src/main/java/org/gengine/content/handler/FileContentReferenceHandler.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content.handler; 2 | 3 | import java.io.File; 4 | 5 | import org.gengine.content.ContentIOException; 6 | import org.gengine.content.ContentReference; 7 | 8 | /** 9 | * Adds file handling to the ContentReferenceHandler interface. 10 | * 11 | */ 12 | public interface FileContentReferenceHandler extends ContentReferenceHandler 13 | { 14 | 15 | /** 16 | * Gets a File object for the given content reference, optionally waiting for the 17 | * file to be available and match the expected file size. 18 | *

19 | * This is useful for implementations that already use a file-based implementation 20 | * and can prevent workers from unnecessarily copying I/O streams. 21 | * 22 | * @param contentReference 23 | * @param waitForTransfer 24 | * @return the File for the content reference 25 | * @throws ContentIOException 26 | * @throws InterruptedException 27 | */ 28 | public File getFile(ContentReference contentReference, boolean waitForTransfer) throws ContentIOException, InterruptedException; 29 | } 30 | -------------------------------------------------------------------------------- /gengine-commons/src/main/java/org/gengine/content/mediatype/FileMediaTypeService.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content.mediatype; 2 | 3 | import java.io.File; 4 | 5 | /** 6 | * Defines a service for getting extensions for media types and vice versa. 7 | * 8 | */ 9 | public interface FileMediaTypeService 10 | { 11 | 12 | /** 13 | * Get the extension for the specified internet media type 14 | * 15 | * @param mediaType a valid media type 16 | * @return Returns the default extension for the media type 17 | */ 18 | public String getExtension(String mediaType); 19 | 20 | /** 21 | * Get the internet media type for the specified extension 22 | * 23 | * @param extension a valid file extension 24 | * @return Returns a valid media type if found, or null if does not exist 25 | */ 26 | public String getMediaType(String extension); 27 | 28 | /** 29 | * Get the internet media type for the specified file using only its 30 | * file name, no inspection 31 | * 32 | * @param file 33 | * @return Returns a valid media type if found, or null if does not exist 34 | */ 35 | public String getMediaTypeByName(File file); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /gengine-commons/src/main/java/org/gengine/content/mediatype/FileMediaTypeServiceImpl.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content.mediatype; 2 | 3 | import java.io.File; 4 | 5 | import org.apache.commons.logging.Log; 6 | import org.apache.commons.logging.LogFactory; 7 | import org.apache.tika.Tika; 8 | import org.apache.tika.config.TikaConfig; 9 | import org.apache.tika.mime.MimeType; 10 | import org.apache.tika.mime.MimeTypeException; 11 | import org.gengine.error.GengineRuntimeException; 12 | 13 | /** 14 | * Implementation of FileMediaTypeService which delegates to Apache Tika 15 | * to do the actual work. 16 | * 17 | */ 18 | public class FileMediaTypeServiceImpl implements FileMediaTypeService 19 | { 20 | 21 | private static final Log logger = LogFactory.getLog(FileMediaTypeServiceImpl.class); 22 | 23 | protected TikaConfig tikaConfig; 24 | protected Tika tika; 25 | 26 | public FileMediaTypeServiceImpl(TikaConfig tikaConfig) 27 | { 28 | this.tikaConfig = tikaConfig; 29 | init(); 30 | } 31 | 32 | public void init() 33 | { 34 | if (tikaConfig == null) 35 | { 36 | logger.debug("Initializing with default Tika config"); 37 | tikaConfig = TikaConfig.getDefaultConfig(); 38 | } 39 | if (tika == null) 40 | { 41 | tika = new Tika(tikaConfig); 42 | } 43 | } 44 | 45 | @Override 46 | public String getExtension(String mimetype) 47 | { 48 | try 49 | { 50 | MimeType tikaMimeType = tikaConfig.getMimeRepository().forName(mimetype); 51 | if (tikaMimeType != null) 52 | { 53 | String tikaExtension = tikaMimeType.getExtension(); 54 | if (tikaExtension.startsWith(".")) 55 | { 56 | tikaExtension = tikaExtension.substring(1, tikaExtension.length()); 57 | } 58 | return tikaExtension; 59 | } 60 | } 61 | catch (MimeTypeException e) 62 | { 63 | throw new GengineRuntimeException("Could not get extension for mimetype", e); 64 | } 65 | 66 | return null; 67 | } 68 | 69 | @Override 70 | public String getMediaType(String extension) 71 | { 72 | return tika.detect("*." + extension); 73 | } 74 | 75 | @Override 76 | public String getMediaTypeByName(File file) 77 | { 78 | return tika.detect(file.getName()); 79 | } 80 | 81 | public MimeType getTikaMimeType(String mimetype) throws MimeTypeException 82 | { 83 | return tikaConfig.getMimeRepository().forName(mimetype); 84 | } 85 | 86 | } 87 | -------------------------------------------------------------------------------- /gengine-commons/src/main/java/org/gengine/util/CloneField.java: -------------------------------------------------------------------------------- 1 | package org.gengine.util; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Annotation to be placed on getter methods to indicate the field should 10 | * be copied during copying and merging 11 | * 12 | */ 13 | @Retention(RetentionPolicy.RUNTIME) 14 | @Target(ElementType.METHOD) 15 | public @interface CloneField 16 | { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /gengine-commons/src/main/java/org/gengine/util/Mergable.java: -------------------------------------------------------------------------------- 1 | package org.gengine.util; 2 | 3 | /** 4 | * Defines that a class can be merged with the overriding values from another 5 | * object of the same type. 6 | * 7 | * @param 8 | */ 9 | public interface Mergable 10 | { 11 | 12 | /** 13 | * Merge the non-null field values from the given override object 14 | * 15 | * @param override 16 | */ 17 | public void merge(T override); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /gengine-commons/src/main/java/org/gengine/util/ToStringProperty.java: -------------------------------------------------------------------------------- 1 | package org.gengine.util; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Annotation to indicate that a method should be included in toString 10 | * 11 | */ 12 | @Retention(RetentionPolicy.RUNTIME) 13 | @Target(ElementType.METHOD) 14 | public @interface ToStringProperty 15 | { 16 | 17 | } 18 | -------------------------------------------------------------------------------- /gengine-commons/src/test/java/org/gengine/content/file/OverridingTempFileProvider.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content.file; 2 | 3 | /** 4 | * Class which overrides TempFileProvider's temp file dir for testing 5 | * 6 | */ 7 | public class OverridingTempFileProvider extends TempFileProvider 8 | { 9 | public static final String OVERRIDE_TEMP_FILE_DIR = "GengineTest"; 10 | 11 | protected static String getApplicationTempFileDir() 12 | { 13 | return OVERRIDE_TEMP_FILE_DIR; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /gengine-commons/src/test/java/org/gengine/content/file/OverridingTempFileProviderTest.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content.file; 2 | 3 | import java.io.File; 4 | 5 | import org.junit.Test; 6 | import static org.junit.Assert.*; 7 | 8 | /** 9 | * Tests that TempFileProvider's temp file dir can be overridden 10 | * 11 | */ 12 | public class OverridingTempFileProviderTest 13 | { 14 | 15 | /** 16 | * Tests that TempFileProvider's temp file dir can be overridden 17 | */ 18 | @Test 19 | public void testDir() 20 | { 21 | File tempFile = OverridingTempFileProvider.getTempDir(); 22 | assertTrue(tempFile.getPath().contains(OverridingTempFileProvider.APPLICATION_TEMP_FILE_DIR)); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /gengine-commons/src/test/java/org/gengine/content/file/TempFileProviderTest.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content.file; 2 | 3 | import java.io.File; 4 | 5 | import junit.framework.TestCase; 6 | 7 | /** 8 | * Unit test for TempFileProvider 9 | * 10 | * @see org.gengine.content.file.TempFileProvider 11 | * 12 | */ 13 | public class TempFileProviderTest extends TestCase 14 | { 15 | /** 16 | * test of getTempDir 17 | * 18 | * @throws Exception 19 | */ 20 | public void testTempDir() throws Exception 21 | { 22 | File tempDir = TempFileProvider.getTempDir(); 23 | assertTrue("Not a directory", tempDir.isDirectory()); 24 | File tempDirParent = tempDir.getParentFile(); 25 | 26 | // create a temp file 27 | File tempFile = File.createTempFile("AAAA", ".tmp"); 28 | File tempFileParent = tempFile.getParentFile(); 29 | 30 | // they should be equal 31 | assertEquals("Our temp dir not subdirectory system temp directory", 32 | tempFileParent, tempDirParent); 33 | } 34 | 35 | /** 36 | * test create a temporary file 37 | * 38 | * create another file with the same prefix and suffix. 39 | * @throws Exception 40 | */ 41 | public void testTempFile() throws Exception 42 | { 43 | File tempFile = TempFileProvider.createTempFile("AAAA", ".tmp"); 44 | File tempFileParent = tempFile.getParentFile(); 45 | File tempDir = TempFileProvider.getTempDir(); 46 | assertEquals("Temp file not located in our temp directory", 47 | tempDir, tempFileParent); 48 | 49 | /** 50 | * Create another temp file and then delete it. 51 | */ 52 | File tempFile2 = TempFileProvider.createTempFile("AAAA", ".tmp"); 53 | tempFile2.delete(); 54 | } 55 | 56 | /** 57 | * test create a temporary file with a directory 58 | * 59 | * create another file with the same prefix and suffix. 60 | * @throws Exception 61 | */ 62 | public void testTempFileWithDir() throws Exception 63 | { 64 | File tempDir = TempFileProvider.getTempDir(); 65 | File tempFile = TempFileProvider.createTempFile("AAAA", ".tmp", tempDir); 66 | File tempFileParent = tempFile.getParentFile(); 67 | assertEquals("Temp file not located in our temp directory", 68 | tempDir, tempFileParent); 69 | 70 | /** 71 | * Create another temp file and then delete it. 72 | */ 73 | File tempFile2 = TempFileProvider.createTempFile("AAAA", ".tmp", tempDir); 74 | tempFile2.delete(); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /gengine-commons/src/test/java/org/gengine/content/handler/FileContentReferenceHandlerImplTest.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content.handler; 2 | 3 | import java.util.UUID; 4 | 5 | import org.apache.commons.lang3.StringUtils; 6 | import org.gengine.content.ContentReference; 7 | import org.gengine.content.file.FileProvider; 8 | import org.gengine.content.file.FileProviderImpl; 9 | import org.gengine.content.file.TempFileProvider; 10 | import org.junit.Before; 11 | import org.junit.Test; 12 | 13 | import static junit.framework.Assert.*; 14 | 15 | /** 16 | * Tests of the file content reference handler 17 | * 18 | * @see {@link FileContentReferenceHandler} 19 | */ 20 | public class FileContentReferenceHandlerImplTest 21 | { 22 | private ContentReferenceHandler handler; 23 | 24 | @Before 25 | public void setUp() 26 | { 27 | FileProvider fileProvider = new FileProviderImpl( 28 | TempFileProvider.getTempDir().getPath()); 29 | handler = new FileContentReferenceHandlerImpl(); 30 | ((FileContentReferenceHandlerImpl) handler).setFileProvider(fileProvider); 31 | } 32 | 33 | protected void checkReference(String fileName, String mediaType) 34 | { 35 | ContentReference reference = handler.createContentReference(fileName, mediaType); 36 | assertEquals(mediaType, reference.getMediaType()); 37 | 38 | String uri = reference.getUri(); 39 | String createdFileName = uri.split("\\/")[uri.split("\\/").length-1]; 40 | 41 | String origPrefix = fileName.substring(0, StringUtils.lastIndexOf(fileName, ".")); 42 | String origSuffix = fileName.substring(StringUtils.lastIndexOf(fileName, "."), fileName.length()); 43 | assertTrue("ContentReference file name '" + createdFileName + 44 | "' did not contain original file name prefix '" + origPrefix + "'", 45 | createdFileName.contains(origPrefix)); 46 | assertTrue("ContentReference file name '" + createdFileName + 47 | "' did not contain original file name suffix '" + origPrefix + "'", 48 | createdFileName.contains(origSuffix)); 49 | } 50 | 51 | @Test 52 | public void testSimpleReference() 53 | { 54 | checkReference("myfile.txt", "text/plain"); 55 | } 56 | 57 | @Test 58 | public void testPathReference() 59 | { 60 | checkReference("my.file.txt", "text/plain"); 61 | } 62 | 63 | @Test 64 | public void testFileExists() 65 | { 66 | String fileName = "test-" + UUID.randomUUID().toString() + ".txt"; 67 | ContentReference reference = handler.createContentReference(fileName, "text/plain"); 68 | assertTrue(handler.isContentReferenceExists(reference)); 69 | 70 | String nonExistentFileUri = reference.getUri().replace(fileName, "NONEXISTENTFILE.txt"); 71 | ContentReference nonExistentReference = new ContentReference(nonExistentFileUri, "text/plain"); 72 | assertFalse(handler.isContentReferenceExists(nonExistentReference)); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /gengine-commons/src/test/java/org/gengine/content/mediatype/MediaTypeServiceTest.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content.mediatype; 2 | 3 | import org.junit.Before; 4 | import org.junit.Test; 5 | 6 | import static junit.framework.Assert.*; 7 | 8 | /** 9 | * Tests the media type service 10 | * 11 | * @see {@link FileMediaTypeService} 12 | * 13 | */ 14 | public class MediaTypeServiceTest 15 | { 16 | 17 | private FileMediaTypeService mediaTypeService; 18 | 19 | @Before 20 | public void setUp() 21 | { 22 | mediaTypeService = new FileMediaTypeServiceImpl(null); 23 | ((FileMediaTypeServiceImpl) mediaTypeService).init(); 24 | } 25 | 26 | @Test 27 | public void testGetMediaTypeFromExtension() 28 | { 29 | assertEquals("text/plain", mediaTypeService.getMediaType("txt")); 30 | assertEquals("application/pdf", mediaTypeService.getMediaType("pdf")); 31 | } 32 | 33 | @Test 34 | public void testGetExtensionFromMediaType() 35 | { 36 | assertEquals("txt", mediaTypeService.getExtension("text/plain")); 37 | assertEquals("pdf", mediaTypeService.getExtension("application/pdf")); 38 | } 39 | 40 | @Test 41 | public void testFileMediaType() 42 | { 43 | assertEquals("text/plain", FileMediaType.TEXT_PLAIN.getMediaType()); 44 | assertEquals("application/pdf", FileMediaType.PDF.getMediaType()); 45 | assertEquals("video/x-m4v", FileMediaType.VIDEO_M4V.getMediaType()); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /gengine-commons/src/test/resources/content-handler-a/file-a-1.txt: -------------------------------------------------------------------------------- 1 | This is file 1a 2 | -------------------------------------------------------------------------------- /gengine-commons/src/test/resources/content-handler-a/file-a-2.txt: -------------------------------------------------------------------------------- 1 | This is file 2a 2 | -------------------------------------------------------------------------------- /gengine-commons/src/test/resources/content-handler-b/file-b-1.txt: -------------------------------------------------------------------------------- 1 | This is file 1b 2 | -------------------------------------------------------------------------------- /gengine-commons/src/test/resources/content-handler-b/file-b-2.txt: -------------------------------------------------------------------------------- 1 | This is file 2b 2 | -------------------------------------------------------------------------------- /gengine-commons/src/test/resources/content-handler-c/file-c-1.txt: -------------------------------------------------------------------------------- 1 | This is file 1c 2 | -------------------------------------------------------------------------------- /gengine-commons/src/test/resources/content-handler-c/file-c-2.txt: -------------------------------------------------------------------------------- 1 | This is file 2c 2 | -------------------------------------------------------------------------------- /gengine-commons/src/test/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # Set root logger level to error 2 | log4j.rootLogger=error, Console 3 | 4 | ###### Console appender definition ####### 5 | 6 | # All outputs currently set to be a ConsoleAppender. 7 | log4j.appender.Console=org.apache.log4j.ConsoleAppender 8 | log4j.appender.Console.layout=org.apache.log4j.PatternLayout 9 | 10 | # use log4j NDC to replace %x with tenant domain / username 11 | log4j.appender.Console.layout.ConversionPattern=%d{ISO8601} %x %-5p [%c{3}] [%t] %m%n 12 | #log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n 13 | 14 | log4j.logger.org.gengine=debug 15 | log4j.logger.org.apache.tika=debug 16 | -------------------------------------------------------------------------------- /gengine-commons/src/test/resources/quick/quick.mpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenInfo/Gengine/3d32e7c36836a11863d795700e867cc49c48c796/gengine-commons/src/test/resources/quick/quick.mpg -------------------------------------------------------------------------------- /gengine-commons/src/test/resources/quick/quick.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenInfo/Gengine/3d32e7c36836a11863d795700e867cc49c48c796/gengine-commons/src/test/resources/quick/quick.pdf -------------------------------------------------------------------------------- /gengine-content-handlers/gengine-content-handler-s3/README.md: -------------------------------------------------------------------------------- 1 | 2 | Overview 3 | ======== 4 | 5 | A `ContentReferenceHandler` implementation which can read and write files to Amazon S3. 6 | -------------------------------------------------------------------------------- /gengine-content-handlers/gengine-content-handler-tempfile/README.md: -------------------------------------------------------------------------------- 1 | 2 | Overview 3 | ======== 4 | 5 | A `ContentReferenceHandler` implementation which creates a file provider with a 6 | directory path of the `CleaningTempFileProvider`'s temp dir. 7 | 8 | The `CleaningTempFileProvider` also provides a [Quartz|http://quartz-scheduler.org/] `TempFileCleanerJob`. 9 | -------------------------------------------------------------------------------- /gengine-content-handlers/gengine-content-handler-tempfile/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | org.gengine 6 | gengine-content-handlers 7 | 0.13-SNAPSHOT 8 | ../pom.xml 9 | 10 | 11 | gengine-content-handler-tempfile 12 | 13 | 14 | 2.3.2 15 | 1.7.35 16 | 17 | 18 | 19 | 20 | org.gengine 21 | gengine-commons 22 | ${project.version} 23 | 24 | 25 | org.quartz-scheduler 26 | quartz 27 | ${dependency.quartz.version} 28 | 29 | 30 | org.slf4j 31 | slf4j-api 32 | ${dependency.sl4j.version} 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /gengine-content-handlers/gengine-content-handler-tempfile/src/main/java/org/gengine/content/handler/tempfile/TempFileContentReferenceHandlerImpl.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content.handler.tempfile; 2 | 3 | import org.gengine.content.file.FileProviderImpl; 4 | import org.gengine.content.file.CleaningTempFileProvider; 5 | import org.gengine.content.handler.FileContentReferenceHandlerImpl; 6 | 7 | /** 8 | * A convenience FileContentReferenceHandlerImpl extension which creates a file 9 | * provider with a directory path of the {@link CleaningTempFileProvider}'s temp dir. 10 | * 11 | */ 12 | public class TempFileContentReferenceHandlerImpl extends FileContentReferenceHandlerImpl 13 | { 14 | public TempFileContentReferenceHandlerImpl() 15 | { 16 | super(); 17 | FileProviderImpl fileProvider = new FileProviderImpl(); 18 | fileProvider.setDirectoryPath(CleaningTempFileProvider.getTempDir().getPath()); 19 | setFileProvider(fileProvider); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /gengine-content-handlers/gengine-content-handler-webdav/README.md: -------------------------------------------------------------------------------- 1 | 2 | Overview 3 | ======== 4 | 5 | A `ContentReferenceHandler` implementation which can read and write files to a WebDAV server. 6 | -------------------------------------------------------------------------------- /gengine-content-handlers/gengine-content-handler-webdav/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | org.gengine 6 | gengine-content-handlers 7 | 0.13-SNAPSHOT 8 | ../pom.xml 9 | 10 | 11 | gengine-content-handler-webdav 12 | 13 | 14 | 5.1 15 | 16 | 17 | 18 | 19 | org.gengine 20 | gengine-commons 21 | ${project.version} 22 | 23 | 24 | com.github.lookfirst 25 | sardine 26 | ${dependency.sardine.version} 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /gengine-content-handlers/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | org.gengine 6 | gengine-parent 7 | 0.13-SNAPSHOT 8 | ../pom.xml 9 | 10 | 11 | gengine-content-handlers 12 | pom 13 | 14 | 15 | 4.5.13 16 | 4.4.14 17 | 1.15 18 | 19 | 20 | 21 | gengine-content-handler-s3 22 | gengine-content-handler-webdav 23 | gengine-content-handler-tempfile 24 | 25 | 26 | 27 | 28 | javax.xml.bind 29 | jaxb-api 30 | 2.3.1 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /gengine-hash/gengine-hash-commons/README.md: -------------------------------------------------------------------------------- 1 | 2 | Overview 3 | ======== 4 | 5 | Contains the basic definitions of `ContentHashWorker`s. 6 | -------------------------------------------------------------------------------- /gengine-hash/gengine-hash-commons/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | org.gengine 6 | gengine-hash 7 | 0.13-SNAPSHOT 8 | ../pom.xml 9 | 10 | 11 | gengine-hash-commons 12 | 13 | 14 | 15 | org.gengine 16 | gengine-commons 17 | ${project.version} 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /gengine-hash/gengine-hash-commons/src/main/java/org/gengine/content/hash/ContentHashException.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content.hash; 2 | 3 | /** 4 | * Thrown when an implementation can not perform the requested hashing due 5 | * to configuration or environment. 6 | * 7 | */ 8 | public class ContentHashException extends Exception 9 | { 10 | private static final long serialVersionUID = -5334480453136472986L; 11 | 12 | public ContentHashException() 13 | { 14 | } 15 | 16 | public ContentHashException(String message) 17 | { 18 | super(message); 19 | } 20 | 21 | public ContentHashException(Throwable cause) 22 | { 23 | super(cause); 24 | } 25 | 26 | public ContentHashException(String message, Throwable cause) 27 | { 28 | super(message, cause); 29 | } 30 | 31 | public ContentHashException(String message, Throwable cause, boolean enableSuppression, 32 | boolean writableStackTrace) 33 | { 34 | super(message, cause, enableSuppression, writableStackTrace); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /gengine-hash/gengine-hash-commons/src/main/java/org/gengine/content/hash/ContentHashWorker.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content.hash; 2 | 3 | import java.util.List; 4 | 5 | import org.gengine.content.ContentIOException; 6 | import org.gengine.content.ContentReference; 7 | import org.gengine.content.ContentWorkResult; 8 | import org.gengine.content.ContentWorker; 9 | 10 | /** 11 | * Defines the methods responsible for doing the work of hash computation of content references 12 | * 13 | */ 14 | public interface ContentHashWorker extends ContentWorker 15 | { 16 | public static final String HASH_ALGORITHM_MD5 = "MD5"; 17 | public static final String HASH_ALGORITHM_SHA_256 = "SHA-256"; 18 | public static final String HASH_ALGORITHM_SHA_512 = "SHA-512"; 19 | 20 | public static final String RESULT_DETAIL_HEX_ENCODED_VALUE = "HEX_ENCODED_VALUE"; 21 | 22 | /** 23 | * Generates a hash value for the given content reference using the given algorithm 24 | * 25 | * @param sources 26 | * @param hashAlgorithm 27 | * @return the results with hex encoded hash values 28 | * @throws Exception 29 | */ 30 | public List generateHashes( 31 | List sources, 32 | String hashAlgorithm) throws ContentIOException, InterruptedException, ContentHashException; 33 | 34 | /** 35 | * Determines whether or not the given hash algorithm is supported 36 | * by the implementation. 37 | * 38 | * @param hashAlgorithm 39 | * @return true if the algorithm is supported 40 | */ 41 | public boolean isAlgorithmSupported(String hashAlgorithm); 42 | 43 | } 44 | -------------------------------------------------------------------------------- /gengine-hash/gengine-hash-component/README.md: -------------------------------------------------------------------------------- 1 | 2 | Overview 3 | ======== 4 | 5 | This forms the basis of a content hash component which acts as a 6 | `MessageConsumer` to process `HashRequest` objects and sends 7 | `HashReply` objects to a specified `MessageProducer`. 8 | 9 | No assumptions are made as to how those Java object messages are routed 10 | to or from the hash component. 11 | 12 | A `ContentHashNodeWorker` performs the actual work of computing 13 | the hash value. 14 | -------------------------------------------------------------------------------- /gengine-hash/gengine-hash-component/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | org.gengine 6 | gengine-hash 7 | 0.13-SNAPSHOT 8 | ../pom.xml 9 | 10 | 11 | gengine-hash-component 12 | 13 | 14 | 15 | org.gengine 16 | gengine-hash-commons 17 | ${project.version} 18 | 19 | 20 | org.gengine 21 | gengine-hash-messaging 22 | ${project.version} 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /gengine-hash/gengine-hash-component/src/main/java/org/gengine/content/hash/BaseContentHashComponent.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content.hash; 2 | 3 | import java.util.List; 4 | 5 | import org.apache.commons.logging.Log; 6 | import org.apache.commons.logging.LogFactory; 7 | import org.gengine.content.AbstractComponent; 8 | import org.gengine.content.ContentWorkResult; 9 | import org.gengine.content.hash.HashReply; 10 | import org.gengine.content.hash.HashRequest; 11 | import org.gengine.messaging.MessageProducer; 12 | 13 | /** 14 | * A base implementation of a hash node which receives messages, uses a {@link ContentHashWorker} 15 | * to perform the hash computation, then uses a {@link MessageProducer} to send the reply. 16 | * 17 | */ 18 | public class BaseContentHashComponent extends AbstractComponent 19 | { 20 | private static final Log logger = LogFactory.getLog(BaseContentHashComponent.class); 21 | 22 | protected void onReceiveImpl(Object message) 23 | { 24 | HashRequest request = (HashRequest) message; 25 | if (logger.isDebugEnabled()) 26 | { 27 | logger.info("Processing hash requestId=" + request.getRequestId()); 28 | } 29 | try 30 | { 31 | 32 | List results = worker.generateHashes( 33 | request.getSourceContentReferences(), 34 | request.getHashAlgorithm()); 35 | 36 | HashReply reply = new HashReply(request); 37 | reply.setResults(results); 38 | 39 | if (logger.isDebugEnabled()) 40 | { 41 | logger.debug("Sending reply"); 42 | } 43 | messageProducer.send(reply, request.getReplyTo()); 44 | } 45 | catch (Exception e) 46 | { 47 | logger.error(e.getMessage(), e); 48 | // TODO send error reply 49 | } 50 | } 51 | 52 | public Class getConsumingMessageBodyClass() 53 | { 54 | return HashRequest.class; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /gengine-hash/gengine-hash-messaging/README.md: -------------------------------------------------------------------------------- 1 | 2 | Overview 3 | ======== 4 | 5 | Contains the basic definitions of `HashRequest` and `HashReply` 6 | objects to be sent to content hash nodes. 7 | -------------------------------------------------------------------------------- /gengine-hash/gengine-hash-messaging/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | org.gengine 6 | gengine-hash 7 | 0.13-SNAPSHOT 8 | ../pom.xml 9 | 10 | 11 | gengine-hash-messaging 12 | 13 | 14 | 15 | org.gengine 16 | gengine-messaging-commons 17 | ${project.version} 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /gengine-hash/gengine-hash-messaging/src/main/java/org/gengine/content/hash/HashReply.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content.hash; 2 | 3 | import org.gengine.content.AbstractContentReply; 4 | import org.gengine.messaging.Request; 5 | 6 | /** 7 | * Represents a reply from a content hasher on the status of a hash request. 8 | * 9 | */ 10 | public class HashReply extends AbstractContentReply 11 | { 12 | 13 | public HashReply() 14 | { 15 | super(); 16 | } 17 | 18 | public HashReply(Request request) 19 | { 20 | super(request); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /gengine-hash/gengine-hash-messaging/src/main/java/org/gengine/content/hash/HashRequest.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content.hash; 2 | 3 | import java.util.List; 4 | 5 | import org.gengine.content.AbstractContentRequest; 6 | import org.gengine.content.ContentReference; 7 | import org.gengine.messaging.Request; 8 | 9 | /** 10 | * Represents a request for content hash 11 | * 12 | */ 13 | public class HashRequest extends AbstractContentRequest implements Request 14 | { 15 | private String hashAlgorithm; 16 | 17 | public HashRequest() 18 | { 19 | super(); 20 | } 21 | 22 | public HashRequest(List sourceContentReferences, String hashAlgorithm) 23 | { 24 | super(); 25 | setSourceContentReferences(sourceContentReferences); 26 | this.hashAlgorithm = hashAlgorithm; 27 | } 28 | 29 | /** 30 | * Gets the hash algorithm to be used 31 | * 32 | * @return the hash algorithm 33 | */ 34 | public String getHashAlgorithm() 35 | { 36 | return hashAlgorithm; 37 | } 38 | 39 | /** 40 | * Sets hash algorithm to be used 41 | * 42 | * @param hashAlgorithm 43 | */ 44 | public void setHashAlgorithm(String hashAlgorithm) 45 | { 46 | this.hashAlgorithm = hashAlgorithm; 47 | } 48 | 49 | @Override 50 | public Class getReplyClass() 51 | { 52 | return HashReply.class; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /gengine-hash/gengine-hash-worker-javase/README.md: -------------------------------------------------------------------------------- 1 | 2 | Overview 3 | ======== 4 | 5 | A Java SE implementation which computes a hash 6 | of File objects. 7 | -------------------------------------------------------------------------------- /gengine-hash/gengine-hash-worker-javase/src/main/java/org/gengine/content/hash/javase/JavaSeContentHashWorker.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content.hash.javase; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.math.BigInteger; 6 | import java.security.MessageDigest; 7 | import java.security.NoSuchAlgorithmException; 8 | 9 | import org.gengine.content.ContentIOException; 10 | import org.gengine.content.hash.AbstractContentHashWorker; 11 | import org.gengine.content.hash.ContentHashException; 12 | 13 | /** 14 | * A Java SE implementation of a content hash node worker 15 | * 16 | */ 17 | public class JavaSeContentHashWorker extends AbstractContentHashWorker 18 | { 19 | private static final int BUFFER_SIZE = 8*1024; 20 | 21 | @Override 22 | public String generateHashInternal(InputStream source, String hashAlgorithm) throws ContentIOException, InterruptedException, ContentHashException 23 | { 24 | if (source == null || hashAlgorithm == null) { 25 | throw new IllegalArgumentException("source and hashAlgorithm must not be null"); 26 | } 27 | try 28 | { 29 | MessageDigest messageDigest = MessageDigest.getInstance(hashAlgorithm); 30 | 31 | byte[] buffer = new byte[BUFFER_SIZE]; 32 | 33 | int bytesRead = 0; 34 | while( (bytesRead = source.read(buffer)) > 0) { 35 | messageDigest.update(buffer, 0, bytesRead); 36 | } 37 | 38 | return encodeHex(messageDigest.digest()); 39 | } 40 | catch (IOException e) 41 | { 42 | throw new ContentIOException("Could not read content for hashing", e); 43 | } 44 | catch (NoSuchAlgorithmException e) 45 | { 46 | throw new ContentHashException(e); 47 | } 48 | finally 49 | { 50 | try 51 | { 52 | source.close(); 53 | } 54 | catch (IOException e) 55 | { 56 | } 57 | } 58 | } 59 | 60 | /** 61 | * Performs a hex encoding of the given byte array 62 | * 63 | * @param byteArray 64 | * @return the hex encoded value 65 | */ 66 | protected String encodeHex(byte[] byteArray) 67 | { 68 | BigInteger integer = new BigInteger(1, byteArray); 69 | return integer.toString(16); 70 | } 71 | 72 | @Override 73 | public boolean isAlgorithmSupported(String hashAlgorithm) 74 | { 75 | try 76 | { 77 | MessageDigest.getInstance(hashAlgorithm); 78 | return true; 79 | } 80 | catch (NoSuchAlgorithmException e) 81 | { 82 | return false; 83 | } 84 | } 85 | 86 | } 87 | -------------------------------------------------------------------------------- /gengine-hash/gengine-hash-worker-javase/src/main/resources/org/gengine/content/hash/javase/JavaSeContentHashWorker.properties: -------------------------------------------------------------------------------- 1 | name=Gengine JavaSE Content Hash Worker 2 | version=${project.version} 3 | -------------------------------------------------------------------------------- /gengine-hash/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | org.gengine 6 | gengine-parent 7 | 0.13-SNAPSHOT 8 | ../pom.xml 9 | 10 | 11 | gengine-hash 12 | pom 13 | 14 | 15 | gengine-hash-commons 16 | gengine-hash-messaging 17 | gengine-hash-worker-javase 18 | gengine-hash-component 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /gengine-health-commons/README.md: -------------------------------------------------------------------------------- 1 | 2 | Overview 3 | ======== 4 | 5 | Interfaces and implementations to monitor the health of different components in a system involving 6 | heartbeats and `ComponentUnavailableExceptions`. 7 | -------------------------------------------------------------------------------- /gengine-health-commons/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | org.gengine 6 | gengine-parent 7 | 0.13-SNAPSHOT 8 | ../pom.xml 9 | 10 | 11 | gengine-health-commons 12 | 13 | 14 | 15 | org.gengine 16 | gengine-commons 17 | ${project.version} 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /gengine-health-commons/src/main/java/org/gengine/health/ComponentUnavailableAction.java: -------------------------------------------------------------------------------- 1 | package org.gengine.health; 2 | 3 | /** 4 | * Defines actions to be taken when a service's dependent component is unavailable. 5 | * 6 | */ 7 | public interface ComponentUnavailableAction 8 | { 9 | 10 | /** 11 | * Executes the action using the given exception 12 | * 13 | * @param e the exception 14 | */ 15 | public void execute(Throwable e); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /gengine-health-commons/src/main/java/org/gengine/health/ComponentUnavailableActionTerminate.java: -------------------------------------------------------------------------------- 1 | package org.gengine.health; 2 | 3 | import org.apache.commons.logging.Log; 4 | import org.apache.commons.logging.LogFactory; 5 | 6 | /** 7 | * ComponentUnavailableAction which terminates the JVM with the specified exit code, not to be used lightly. 8 | * 9 | */ 10 | public class ComponentUnavailableActionTerminate implements ComponentUnavailableAction 11 | { 12 | private static final Log logger = LogFactory.getLog(ComponentUnavailableActionTerminate.class); 13 | 14 | private static final Integer DEFAULT_EXIT_STATUS_CODE = new Integer(1); 15 | 16 | @Override 17 | public void execute(Throwable e) 18 | { 19 | logger.fatal("Terminating due to " + e.getClass().getSimpleName() + ": " + e.getMessage()); 20 | Integer statusCode = null; 21 | if (e instanceof ComponentUnavailableException) 22 | { 23 | statusCode = ((ComponentUnavailableException) e).getExitStatusCode(); 24 | } 25 | if (statusCode == null) 26 | { 27 | statusCode = DEFAULT_EXIT_STATUS_CODE; 28 | } 29 | System.exit(statusCode); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /gengine-health-commons/src/main/java/org/gengine/health/ComponentUnavailableException.java: -------------------------------------------------------------------------------- 1 | package org.gengine.health; 2 | 3 | /** 4 | * Thrown when a dependent component such as a database or other service is unavailable. 5 | * 6 | */ 7 | public class ComponentUnavailableException extends RuntimeException 8 | { 9 | 10 | private static final long serialVersionUID = 4814912374901612569L; 11 | 12 | public ComponentUnavailableException() 13 | { 14 | } 15 | 16 | public ComponentUnavailableException(String message) 17 | { 18 | super(message); 19 | } 20 | 21 | public ComponentUnavailableException(Throwable cause) 22 | { 23 | super(cause); 24 | } 25 | 26 | public ComponentUnavailableException(String message, Throwable cause) 27 | { 28 | super(message, cause); 29 | } 30 | 31 | public ComponentUnavailableException(String message, Throwable cause, boolean enableSuppression, 32 | boolean writableStackTrace) 33 | { 34 | super(message, cause, enableSuppression, writableStackTrace); 35 | } 36 | 37 | public Integer getExitStatusCode() 38 | { 39 | return 1; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /gengine-health-commons/src/main/java/org/gengine/health/ComponentUnavailableExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package org.gengine.health; 2 | 3 | import java.util.Map; 4 | 5 | import org.apache.commons.logging.Log; 6 | import org.apache.commons.logging.LogFactory; 7 | 8 | /** 9 | * Determines the {@link ComponentUnavailableAction} to execute when a 10 | * {@link ComponentUnavailableException} is thrown 11 | * 12 | */ 13 | public class ComponentUnavailableExceptionHandler 14 | { 15 | private static final Log logger = LogFactory.getLog(ComponentUnavailableExceptionHandler.class); 16 | 17 | private Map policies; 18 | 19 | /** 20 | * A map of ComponentUnavailableException canonical class names to the 21 | * ComponentUnavailableAction that should be executed. 22 | * 23 | * @param policies 24 | */ 25 | public void setPolicies(Map policies) 26 | { 27 | this.policies = policies; 28 | } 29 | 30 | /** 31 | * Determines the ComponentUnavailableAction to execute based on the given exception 32 | * and executes it. 33 | * 34 | * @param e 35 | */ 36 | public void handle(Throwable e) 37 | { 38 | if (e == null) 39 | { 40 | return; 41 | } 42 | String actionKey = e.getClass().getCanonicalName(); 43 | if (policies == null || !policies.containsKey(actionKey)) 44 | { 45 | logger.error("Received " + actionKey + 46 | " but no corresponding action registered: " + e.getMessage(), e); 47 | } 48 | else 49 | { 50 | policies.get(actionKey).execute(e); 51 | } 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /gengine-health-commons/src/main/java/org/gengine/health/heartbeat/Heart.java: -------------------------------------------------------------------------------- 1 | package org.gengine.health.heartbeat; 2 | 3 | /** 4 | * Defines the object responsible for producing {@link Heartbeat}s 5 | * which let services monitor health of other services in the system. 6 | * 7 | */ 8 | public interface Heart 9 | { 10 | /** 11 | * Starts the repeated sending of {@link Heartbeat} messages 12 | * for health monitoring 13 | */ 14 | public void start(); 15 | 16 | /** 17 | * Stops the repeated sending of {@link Heartbeat} messages 18 | * for health monitoring 19 | */ 20 | public void stop(); 21 | 22 | /** 23 | * Returns a single {@link Heartbeat} object without sending 24 | * via messaging 25 | * 26 | * @return the heartbeat object 27 | */ 28 | public Heartbeat beat(); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /gengine-health-commons/src/main/java/org/gengine/health/heartbeat/HeartbeatDao.java: -------------------------------------------------------------------------------- 1 | package org.gengine.health.heartbeat; 2 | 3 | /** 4 | * Defines the persistence of a heartbeat. Implementations might 5 | * be a log, database, or in-memory queue. 6 | * 7 | */ 8 | public interface HeartbeatDao 9 | { 10 | 11 | /** 12 | * Persists the heartbeat. 13 | * 14 | * @param heartbeat 15 | */ 16 | public void record(Heartbeat heartbeat); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /gengine-health-commons/src/main/java/org/gengine/health/heartbeat/HeartbeatMonitor.java: -------------------------------------------------------------------------------- 1 | package org.gengine.health.heartbeat; 2 | 3 | /** 4 | * Defines an object responsible for listening for the heartbeat. 5 | * Implementations may utilize a {@link HeartbeatDao} to persist the data. 6 | * 7 | */ 8 | public interface HeartbeatMonitor 9 | { 10 | 11 | /** 12 | * Called when a {@link Heartbeat} message is routed to the 13 | * monitor. 14 | * 15 | * @param message 16 | */ 17 | public void onReceive(Object message); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-amqp-direct/README.md: -------------------------------------------------------------------------------- 1 | 2 | Overview 3 | ======== 4 | 5 | A Qpid-based AMQP endpoint which can serve as both a `MessageProducer` and 6 | contains a message listener which accepts messages then unmarshals and 7 | passes them to a specified `MessageConsumer`. 8 | 9 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-amqp-direct/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | org.gengine 6 | gengine-messaging 7 | 0.13-SNAPSHOT 8 | ../pom.xml 9 | 10 | 11 | gengine-messaging-amqp-direct 12 | 13 | 14 | 0.26 15 | 16 | 17 | 18 | 19 | org.gengine 20 | gengine-messaging-commons 21 | ${project.version} 22 | 23 | 24 | org.apache.qpid 25 | qpid-amqp-1-0-client 26 | ${dependency.qpid.version} 27 | 28 | 29 | org.apache.qpid 30 | qpid-amqp-1-0-common 31 | ${dependency.qpid.version} 32 | 33 | 34 | org.apache.qpid 35 | qpid-amqp-1-0-client-jms 36 | ${dependency.qpid.version} 37 | 38 | 39 | org.apache.geronimo.specs 40 | geronimo-jms_1.1_spec 41 | 1.1.1 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-benchmark/README.md: -------------------------------------------------------------------------------- 1 | 2 | Overview 3 | ======== 4 | 5 | A simple benchmark that produces and consumes messages on a single AMQP endpoint 6 | and measures the throughput. 7 | 8 | Usage 9 | ===== 10 | 11 | First build the jar via Maven: 12 | 13 | mvn clean package 14 | 15 | either from this project. 16 | 17 | Start an AMQP broker. See the `messaging-broker-activemq` project. 18 | 19 | The single jar with dependencies should be launched with a parameter of the 20 | brokerUrl and the number of messages to test, i.e. (replace 0.X-SNAPSHOT with appropriate version): 21 | 22 | java -jar target/gengine-messaging-benchmark-0.X-SNAPSHOT-jar-with-dependencies.jar 'tcp://localhost:61616' 10000 23 | 24 | You should see a message indicating that the test is sending messages and the final statistics. 25 | 26 | Advanced Usage 27 | ============== 28 | 29 | Note: In the examples below, replace 0.X-SNAPSHOT with appropriate version. 30 | 31 | You can optionally specify the queue or topic you wish to use in the command line: 32 | 33 | java -jar target/gengine-messaging-benchmark-0.X-SNAPSHOT-jar-with-dependencies.jar 'tcp://localhost:61616' 100 'queue:foo' 34 | java -jar target/gengine-messaging-benchmark-0.X-SNAPSHOT-jar-with-dependencies.jar 'tcp://localhost:61616' 100 'topic:bar.foo' 35 | 36 | You can run just the producer of messages with the `product-only` option: 37 | 38 | java -jar target/gengine-messaging-benchmark-0.X-SNAPSHOT-jar-with-dependencies.jar 'tcp://localhost:61616' 100 'topic:bar.foo' produce-only 39 | 40 | You can run just the consumer of messages with the `consume-only` option, shown with a durable subscriber expecting 100 messages: 41 | 42 | java -jar target/gengine-messaging-benchmark-0.X-SNAPSHOT-jar-with-dependencies.jar 'tcp://localhost:61616' 100 'topic:bar.foo?clientId=1&durableSubscriptionName=bar1' consume-only 43 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-benchmark/src/main/java/org/gengine/messaging/benchmark/BenchmarkConsumer.java: -------------------------------------------------------------------------------- 1 | package org.gengine.messaging.benchmark; 2 | 3 | import org.apache.commons.logging.Log; 4 | import org.apache.commons.logging.LogFactory; 5 | import org.gengine.messaging.MessageConsumer; 6 | 7 | /** 8 | * Consumer of {@link BenchmarkMessage}s which maintains a count of messages received. 9 | * 10 | */ 11 | public class BenchmarkConsumer implements MessageConsumer 12 | { 13 | private static final Log logger = LogFactory.getLog(BenchmarkConsumer.class); 14 | 15 | protected int logAfterNumMessages = 1000; 16 | protected int messageCount = 0; 17 | 18 | public void setLogAfterNumMessages(int logAfterNumMessages) 19 | { 20 | this.logAfterNumMessages = logAfterNumMessages; 21 | } 22 | 23 | @Override 24 | public void onReceive(Object message) 25 | { 26 | if (logger.isTraceEnabled()) 27 | { 28 | logger.trace("Receiving message, current messageCount=" + messageCount + "..."); 29 | } 30 | validateMessage(message); 31 | 32 | messageCount++; 33 | 34 | if (messageCount > 0 && messageCount % logAfterNumMessages == 0) 35 | { 36 | logger.debug("Received " + messageCount + " messages..."); 37 | } 38 | else 39 | { 40 | if (logger.isTraceEnabled()) 41 | { 42 | logger.trace("Received " + messageCount + " messages..."); 43 | } 44 | } 45 | } 46 | 47 | protected void validateMessage(Object message) 48 | { 49 | if (message == null || ((BenchmarkMessage) message).getValue() == null || 50 | !((BenchmarkMessage) message).getValue().equals(BenchmarkMessage.getDefaultValue())) 51 | { 52 | throw new IllegalArgumentException("Could not verify message"); 53 | } 54 | } 55 | 56 | @Override 57 | public Class getConsumingMessageBodyClass() 58 | { 59 | return BenchmarkMessage.class; 60 | } 61 | 62 | public int getMessageCount() 63 | { 64 | return messageCount; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-benchmark/src/main/java/org/gengine/messaging/benchmark/BootstrapArguments.java: -------------------------------------------------------------------------------- 1 | package org.gengine.messaging.benchmark; 2 | 3 | public class BootstrapArguments 4 | { 5 | public String brokerUrl; 6 | public String brokerUsername; 7 | public String brokerPassword; 8 | public int numMessages; 9 | public String endpointSend; 10 | public String endpointReceive; 11 | public boolean runProducer = true; 12 | public boolean runConsumer = true; 13 | public int numSections = 100; // see also BenchmarkMessage 14 | } 15 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-benchmark/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # Set root logger level to error 2 | log4j.rootLogger=error, Console 3 | 4 | ###### Console appender definition ####### 5 | 6 | # All outputs currently set to be a ConsoleAppender. 7 | log4j.appender.Console=org.apache.log4j.ConsoleAppender 8 | log4j.appender.Console.layout=org.apache.log4j.PatternLayout 9 | 10 | # use log4j NDC to replace %x with tenant domain / username 11 | log4j.appender.Console.layout.ConversionPattern=%d{ISO8601} %x %-5p [%c{1}] %m%n 12 | #log4j.appender.Console.layout.ConversionPattern=%d{ISO8601} %x %-5p [%c{3}] [%t] %m%n 13 | #log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n 14 | 15 | log4j.logger.org.gengine=debug 16 | #log4j.logger.org.gengine.messaging.benchmark=trace 17 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-camel/README.md: -------------------------------------------------------------------------------- 1 | 2 | Overview 3 | ======== 4 | 5 | Apache Camel `MessageProducer` and `RequestReplyMessageProducer` implementations. 6 | 7 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-camel/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | org.gengine 6 | gengine-messaging 7 | 0.13-SNAPSHOT 8 | ../pom.xml 9 | 10 | 11 | gengine-messaging-camel 12 | 13 | 14 | 1.7.35 15 | 16 | 17 | 18 | 19 | org.gengine 20 | gengine-messaging-commons 21 | ${project.version} 22 | 23 | 24 | org.gengine 25 | gengine-health-commons 26 | ${project.version} 27 | 28 | 29 | org.apache.camel 30 | camel-core 31 | ${dependency.camel.version} 32 | 33 | 34 | org.apache.camel 35 | camel-jackson 36 | ${dependency.camel.version} 37 | 38 | 39 | org.slf4j 40 | slf4j-api 41 | ${dependency.sl4j.version} 42 | 43 | 44 | org.apache.camel 45 | camel-test 46 | test 47 | ${dependency.camel.version} 48 | 49 | 50 | org.apache.maven 51 | maven-artifact 52 | 3.6.3 53 | test 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-camel/src/main/java/org/gengine/health/camel/ExceptionProcessor.java: -------------------------------------------------------------------------------- 1 | package org.gengine.health.camel; 2 | 3 | import org.apache.camel.Exchange; 4 | import org.apache.camel.Processor; 5 | import org.gengine.health.ComponentUnavailableExceptionHandler; 6 | 7 | /** 8 | * Camel Processor and standard bean which provide methods to pass the exception 9 | * to the specified handler. 10 | * 11 | */ 12 | public class ExceptionProcessor implements Processor 13 | { 14 | private ComponentUnavailableExceptionHandler handler; 15 | 16 | public void setHandler(ComponentUnavailableExceptionHandler handler) 17 | { 18 | this.handler = handler; 19 | } 20 | 21 | @Override 22 | public void process(Exchange exchange) throws Exception 23 | { 24 | Exception cause = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class); 25 | handler.handle(cause); 26 | } 27 | 28 | public void onReceive(Object body) 29 | { 30 | // Handler can only deal with Throwables 31 | if (body instanceof Throwable) 32 | { 33 | handler.handle((Throwable) body); 34 | } 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-camel/src/main/java/org/gengine/health/camel/HeartbeatMonitorImpl.java: -------------------------------------------------------------------------------- 1 | package org.gengine.health.camel; 2 | 3 | import org.apache.camel.Handler; 4 | import org.apache.commons.logging.Log; 5 | import org.apache.commons.logging.LogFactory; 6 | import org.gengine.health.heartbeat.Heartbeat; 7 | import org.gengine.health.heartbeat.HeartbeatDao; 8 | import org.gengine.health.heartbeat.HeartbeatMonitor; 9 | 10 | /** 11 | * HeartbeatMonitor implementation which uses Camel to route {@link Heartbeat} 12 | * messages. 13 | * 14 | */ 15 | public class HeartbeatMonitorImpl implements HeartbeatMonitor 16 | { 17 | private static final Log logger = LogFactory.getLog(HeartbeatMonitorImpl.class); 18 | 19 | private HeartbeatDao heartbeatDao; 20 | 21 | /** 22 | * Sets the DAO used to persist heartbeats. 23 | * 24 | * @param heartbeatDao 25 | */ 26 | public void setHeartbeatDao(HeartbeatDao heartbeatDao) 27 | { 28 | this.heartbeatDao = heartbeatDao; 29 | } 30 | 31 | @Override 32 | @Handler 33 | public void onReceive(Object message) 34 | { 35 | if (!(message instanceof Heartbeat)) 36 | { 37 | logger.warn("Heartbeat message expected but received: " + message.toString()); 38 | return; 39 | } 40 | heartbeatDao.record((Heartbeat) message); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-camel/src/test/java/org/gengine/messaging/camel/dataformat/SimplePojo.java: -------------------------------------------------------------------------------- 1 | package org.gengine.messaging.camel.dataformat; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | public class SimplePojo { 7 | public enum EnumValue { 8 | VALUE_1, VALUE_2 9 | } 10 | 11 | private String field1; 12 | private Integer field2; 13 | private EnumValue field3; 14 | private Map, String> field4; 15 | private Map field5; 16 | 17 | // Constructor 18 | public SimplePojo(String field1, Integer field2, EnumValue field3) { 19 | this.field1 = field1; 20 | this.field2 = field2; 21 | this.field3 = field3; 22 | } 23 | 24 | // Getters and setters for field1, field2, and field3 25 | public String getField1() { 26 | return field1; 27 | } 28 | 29 | public void setField1(String field1) { 30 | this.field1 = field1; 31 | } 32 | 33 | public Integer getField2() { 34 | return field2; 35 | } 36 | 37 | public void setField2(Integer field2) { 38 | this.field2 = field2; 39 | } 40 | 41 | public EnumValue getField3() { 42 | return field3; 43 | } 44 | 45 | public void setField3(EnumValue field3) { 46 | this.field3 = field3; 47 | } 48 | 49 | // Getters and setters for field4 50 | public Map, String> getField4() { 51 | return field4; 52 | } 53 | 54 | public void setField4(Map, String> field4) { 55 | this.field4 = field4; 56 | } 57 | 58 | // Getters and setters for field5 59 | public Map getField5() { 60 | return field5; 61 | } 62 | 63 | public void setField5(Map field5) { 64 | this.field5 = field5; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-commons/README.md: -------------------------------------------------------------------------------- 1 | 2 | Overview 3 | ======== 4 | 5 | Defines generic `MessageConsumer` and `MessageProducer` interfaces which process 6 | and send Java object messages and contains a Jackson-based JSON marshaller. 7 | 8 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-commons/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | org.gengine 6 | gengine-messaging 7 | 0.13-SNAPSHOT 8 | ../pom.xml 9 | 10 | 11 | gengine-messaging-commons 12 | 13 | 14 | 15 | org.gengine 16 | gengine-commons 17 | ${project.version} 18 | 19 | 20 | com.fasterxml.jackson.core 21 | jackson-databind 22 | ${dependency.jackson-databind.version} 23 | 24 | 25 | com.fasterxml.jackson.module 26 | jackson-module-jaxb-annotations 27 | ${dependency.jackson.version} 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-commons/src/main/java/org/gengine/content/AbstractContentReply.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content; 2 | 3 | import java.util.List; 4 | 5 | import org.gengine.messaging.AbstractReply; 6 | import org.gengine.messaging.Request; 7 | 8 | /** 9 | * Base implementation of a content reply 10 | * 11 | */ 12 | public abstract class AbstractContentReply extends AbstractReply implements ContentReply 13 | { 14 | private List results; 15 | 16 | public AbstractContentReply() 17 | { 18 | super(); 19 | } 20 | 21 | public AbstractContentReply(Request request) 22 | { 23 | super(request); 24 | } 25 | 26 | public List getResults() 27 | { 28 | return results; 29 | } 30 | 31 | public void setResults(List results) 32 | { 33 | this.results = results; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-commons/src/main/java/org/gengine/content/AbstractContentRequest.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content; 2 | 3 | import java.util.List; 4 | 5 | import org.gengine.content.ContentReference; 6 | import org.gengine.messaging.AbstractRequest; 7 | 8 | /** 9 | * Represents a request for some operation on content sources. 10 | * 11 | */ 12 | public abstract class AbstractContentRequest extends AbstractRequest 13 | { 14 | private List sourceContentReferences; 15 | 16 | public AbstractContentRequest() 17 | { 18 | super(); 19 | } 20 | 21 | /** 22 | * Gets the source content reference objects 23 | * 24 | * @return source content references 25 | */ 26 | public List getSourceContentReferences() 27 | { 28 | return sourceContentReferences; 29 | } 30 | 31 | /** 32 | * Sets the source content reference objects 33 | * 34 | * @param sourceContentReference 35 | */ 36 | public void setSourceContentReferences(List sourceContentReferences) 37 | { 38 | this.sourceContentReferences = sourceContentReferences; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-commons/src/main/java/org/gengine/content/Component.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content; 2 | 3 | import org.gengine.messaging.MessageConsumer; 4 | 5 | /** 6 | * Defines a component which is a consumer of request for content action messages, 7 | * delegates that work to a worker, and sends a reply with the results. 8 | * 9 | */ 10 | public interface Component extends MessageConsumer 11 | { 12 | /** 13 | * Gets the name of the component, useful for health checks. 14 | * 15 | * @return the component name 16 | */ 17 | public String getName(); 18 | 19 | /** 20 | * Determines whether or not the worker is available. 21 | * 22 | * @return true if the worker is available 23 | * @see {@link ContentWorker#isAvailable()} 24 | */ 25 | public boolean isWorkerAvailable(); 26 | 27 | /** 28 | * Gets a string returning name and version information 29 | * 30 | * @return the version string 31 | * @see {@link ContentWorker#getVersionString()} 32 | */ 33 | public String getWorkerVersionString(); 34 | 35 | 36 | /** 37 | * Gets a string returning detailed version information such as JVM 38 | * or command line application's version output 39 | * 40 | * @return the version string 41 | * @see {@link ContentWorker#getVersionDetailsString()} 42 | */ 43 | public String getWorkerVersionDetailsString(); 44 | 45 | } 46 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-commons/src/main/java/org/gengine/content/ContentReply.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content; 2 | 3 | import java.util.List; 4 | 5 | import org.gengine.messaging.Reply; 6 | 7 | public interface ContentReply extends Reply 8 | { 9 | 10 | /** 11 | * Gets the results of the content operation. 12 | * 13 | * @return the results 14 | */ 15 | public List getResults(); 16 | } 17 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-commons/src/main/java/org/gengine/messaging/AbstractReply.java: -------------------------------------------------------------------------------- 1 | package org.gengine.messaging; 2 | 3 | /** 4 | * Base implementation of a reply. 5 | * 6 | */ 7 | public abstract class AbstractReply implements Reply 8 | { 9 | private String requestId; 10 | 11 | public AbstractReply() { 12 | super(); 13 | } 14 | 15 | public AbstractReply(Request request) 16 | { 17 | super(); 18 | this.requestId = request.getRequestId(); 19 | } 20 | 21 | /** 22 | * Gets the UUID for the original hash request 23 | * 24 | * @return the hash request ID 25 | */ 26 | public String getRequestId() 27 | { 28 | return requestId; 29 | } 30 | 31 | /** 32 | * Sets the UUID for the original hash request 33 | * 34 | * @param requestId 35 | */ 36 | public void setRequestId(String requestId) 37 | { 38 | this.requestId = requestId; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-commons/src/main/java/org/gengine/messaging/AbstractRequest.java: -------------------------------------------------------------------------------- 1 | package org.gengine.messaging; 2 | 3 | import java.util.UUID; 4 | 5 | /** 6 | * Represents a generic messaging request 7 | * 8 | */ 9 | public abstract class AbstractRequest 10 | { 11 | private final String requestId; 12 | private String replyQueueName; 13 | 14 | public AbstractRequest() 15 | { 16 | super(); 17 | this.requestId = UUID.randomUUID().toString(); 18 | } 19 | 20 | /** 21 | * Gets the generated UUID for the transformation request 22 | * 23 | * @return the request ID 24 | */ 25 | public String getRequestId() 26 | { 27 | return requestId; 28 | } 29 | 30 | /** 31 | * Gets the optional overriding reply to queue replies should be sent to 32 | * 33 | * @return the optional override reply to queue 34 | */ 35 | public String getReplyTo() 36 | { 37 | return replyQueueName; 38 | } 39 | 40 | /** 41 | * Sets the optional overriding reply to queue replies should be sent to 42 | * 43 | * @param replyQueueName 44 | */ 45 | public void setReplyTo(String replyQueueName) 46 | { 47 | this.replyQueueName = replyQueueName; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-commons/src/main/java/org/gengine/messaging/LoggingDeadLetterQueue.java: -------------------------------------------------------------------------------- 1 | package org.gengine.messaging; 2 | 3 | import org.apache.commons.logging.Log; 4 | import org.apache.commons.logging.LogFactory; 5 | 6 | /** 7 | * Endpoint which simply logs dead letter messages 8 | * 9 | */ 10 | public class LoggingDeadLetterQueue 11 | { 12 | private static final Log logger = LogFactory.getLog(LoggingDeadLetterQueue.class); 13 | 14 | public void onReceive(Object message) 15 | { 16 | if (logger.isDebugEnabled() && message != null) 17 | { 18 | logger.debug("Received:\n\n" + message.toString() + "\n\n"); 19 | } 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-commons/src/main/java/org/gengine/messaging/MessageConsumer.java: -------------------------------------------------------------------------------- 1 | package org.gengine.messaging; 2 | 3 | /** 4 | * Defines methods for handling messages. A separate message listener is 5 | * responsible for pulling messages off a queue and passing them to the consumer. 6 | * 7 | */ 8 | public interface MessageConsumer 9 | { 10 | 11 | /** 12 | * Performs any processing required upon receiving the given POJO message 13 | * 14 | * @param message 15 | */ 16 | public void onReceive(Object message); 17 | 18 | /** 19 | * The class of POJO messages expected 20 | * 21 | * @return the POJO message class 22 | */ 23 | public Class getConsumingMessageBodyClass(); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-commons/src/main/java/org/gengine/messaging/MessageProducer.java: -------------------------------------------------------------------------------- 1 | package org.gengine.messaging; 2 | 3 | import java.util.Map; 4 | 5 | /** 6 | * Defines methods for sending message objects to a queue. 7 | * 8 | */ 9 | public interface MessageProducer 10 | { 11 | 12 | /** 13 | * Send the given POJO message to the default queue for the producer 14 | * 15 | * @param message 16 | * @throws MessagingException 17 | */ 18 | public void send(Object message) throws MessagingException; 19 | 20 | /** 21 | * Send the given POJO message to the default queue for the producer with the given headers 22 | * 23 | * @param message 24 | * @param headers 25 | * @throws MessagingException 26 | */ 27 | public void send(Object message, Map headers) throws MessagingException; 28 | 29 | /** 30 | * Send the given POJO message to the given queue 31 | * 32 | * @param message 33 | * @param queueName 34 | * @throws MessagingException 35 | */ 36 | public void send(Object message, String queueName) throws MessagingException; 37 | 38 | /** 39 | * Send the given POJO message to the given queue with the given headers 40 | * 41 | * @param message 42 | * @param queueName 43 | * @param headers 44 | * @throws MessagingException 45 | */ 46 | public void send(Object message, String queueName, Map headers) throws MessagingException; 47 | 48 | } 49 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-commons/src/main/java/org/gengine/messaging/MessagingException.java: -------------------------------------------------------------------------------- 1 | package org.gengine.messaging; 2 | 3 | import org.gengine.error.GengineRuntimeException; 4 | 5 | /** 6 | * Exception thrown when a message is unable to be processed. 7 | * 8 | */ 9 | public class MessagingException extends GengineRuntimeException 10 | { 11 | private static final long serialVersionUID = 8192266871339806688L; 12 | 13 | public MessagingException(String message) 14 | { 15 | super(message); 16 | } 17 | 18 | public MessagingException(String message, Throwable cause) 19 | { 20 | super(message, cause); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-commons/src/main/java/org/gengine/messaging/Reply.java: -------------------------------------------------------------------------------- 1 | package org.gengine.messaging; 2 | 3 | /** 4 | * Defines a reply message for a specific {@link Request} message 5 | * 6 | */ 7 | public interface Reply 8 | { 9 | 10 | /** 11 | * The correlating request ID for the reply. 12 | *

13 | * Note that this is unlikely to be the same value as the 14 | * 'native' correlation ID used by a particular messaging transport. 15 | * 16 | * @return the request correlation ID 17 | */ 18 | public String getRequestId(); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-commons/src/main/java/org/gengine/messaging/Request.java: -------------------------------------------------------------------------------- 1 | package org.gengine.messaging; 2 | 3 | /** 4 | * Defines a request message where a {@link Reply} is expected 5 | * 6 | * @param the Reply type 7 | */ 8 | public interface Request 9 | { 10 | /** 11 | * Gets the correlating request ID. 12 | *

13 | * Note that this is unlikely to be the same value as the 14 | * 'native' correlation ID used by a particular messaging transport. 15 | * 16 | * @return the request correlation ID 17 | */ 18 | public String getRequestId(); 19 | 20 | /** 21 | * Gets the class of expected {@link Reply} messages 22 | * 23 | * @return the reply message class 24 | */ 25 | public Class getReplyClass(); 26 | 27 | /** 28 | * Gets the optional overriding reply to queue name 29 | * 30 | * @return the reply to queue name 31 | */ 32 | public String getReplyTo(); 33 | 34 | /** 35 | * Sets the optional overriding reply to queue name 36 | * 37 | * @param replyTo 38 | */ 39 | public void setReplyTo(String replyTo); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-commons/src/main/java/org/gengine/messaging/RequestReplyMessageProducer.java: -------------------------------------------------------------------------------- 1 | package org.gengine.messaging; 2 | 3 | import java.util.concurrent.Future; 4 | 5 | /** 6 | * Defines an asynchronous request-reply message producer 7 | * 8 | * @param 9 | * @param 10 | */ 11 | public interface RequestReplyMessageProducer, RP extends Reply> extends MessageProducer 12 | { 13 | 14 | /** 15 | * Sends the given request message to the configured queue and waits for its reply, 16 | * returning a {@link Future} object that will contain that reply once available. 17 | * 18 | * @param request 19 | * @return an executing future object which will contain the reply once available 20 | * @throws MessagingException 21 | */ 22 | public Future asyncRequest(RQ request) throws MessagingException; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-commons/src/main/java/org/gengine/messaging/jackson/ObjectMapperFactory.java: -------------------------------------------------------------------------------- 1 | package org.gengine.messaging.jackson; 2 | 3 | import com.fasterxml.jackson.core.Version; 4 | import com.fasterxml.jackson.databind.DeserializationFeature; 5 | import com.fasterxml.jackson.databind.ObjectMapper; 6 | import com.fasterxml.jackson.databind.SerializationFeature; 7 | import com.fasterxml.jackson.databind.module.SimpleModule; 8 | import com.fasterxml.jackson.annotation.JsonTypeInfo; 9 | 10 | public class ObjectMapperFactory 11 | { 12 | 13 | public static ObjectMapper createInstance() 14 | { 15 | 16 | QpidJsonBodyCleanerObjectMapper mapper = new QpidJsonBodyCleanerObjectMapper(); 17 | mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); 18 | mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); 19 | mapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY); 20 | SimpleModule module = new SimpleModule("GengineJackson", 21 | new Version(0, 1, 0, "SNAPSHOT", "org.gengine", "gengine-messaging-commons")); 22 | mapper.registerModule(module); 23 | return mapper; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-commons/src/main/java/org/gengine/messaging/jackson/QpidJsonBodyCleanerObjectMapper.java: -------------------------------------------------------------------------------- 1 | package org.gengine.messaging.jackson; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.io.StringWriter; 6 | 7 | import org.apache.commons.io.IOUtils; 8 | 9 | import com.fasterxml.jackson.core.JsonParseException; 10 | import com.fasterxml.jackson.databind.JsonMappingException; 11 | import com.fasterxml.jackson.databind.ObjectMapper; 12 | 13 | /** 14 | * Extension of ObjectMapper which cleans erroneous characters apparently 15 | * added by the Qpid library before the start of a JSON object. 16 | */ 17 | public class QpidJsonBodyCleanerObjectMapper extends ObjectMapper 18 | { 19 | private static final long serialVersionUID = 2568701685293341501L; 20 | 21 | private static final String DEFAULT_ENCODING = "utf8"; 22 | 23 | public T readValue(InputStream inputStream, Class valueType) throws JsonParseException, JsonMappingException, IOException 24 | { 25 | try 26 | { 27 | // Try to unmarshal normally 28 | if (inputStream.markSupported()) 29 | { 30 | inputStream.mark(1024 * 512); 31 | } 32 | return super.readValue(inputStream, valueType); 33 | } 34 | catch (JsonParseException e) 35 | { 36 | if (!inputStream.markSupported()) 37 | { 38 | // We can't reset this stream, bail out 39 | throw e; 40 | } 41 | // Reset the stream 42 | inputStream.reset(); 43 | } 44 | // Clean the message body and try again 45 | StringWriter writer = new StringWriter(); 46 | IOUtils.copy(inputStream, writer, DEFAULT_ENCODING); 47 | String content = writer.toString(); 48 | content = content.substring(content.indexOf("{"), content.length()); 49 | return readValue(content, valueType); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /gengine-messaging/gengine-messaging-commons/src/test/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | # Set root logger level to error 2 | rootLogger.level=error 3 | rootLogger.appenderRef.stdout.ref=ConsoleAppender 4 | 5 | ###### Console appender definition ####### 6 | appender.console.type=Console 7 | appender.console.name=ConsoleAppender 8 | appender.console.layout.type=PatternLayout 9 | appender.console.layout.pattern=%d{ISO8601} %x %-5p [%c{3}] [%t] %replace{%m}{[\r\n]+}{}%n 10 | 11 | ###### Loggers definition ####### 12 | logger.org-gengine.name=org.gengine 13 | logger.org-gengine.level=debug 14 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/README.md: -------------------------------------------------------------------------------- 1 | Overview 2 | ======== 3 | 4 | Runs an [ActiveMQ](http://activemq.apache.org) broker. 5 | 6 | Usage 7 | ===== 8 | 9 | To start the broker run: 10 | 11 | mvn activemq:run 12 | 13 | You can then access the [admin console](http://localhost:8161/admin) 14 | with a username/password of admin/admin. 15 | 16 | If you want to see the logging message you'll have to specify the path in the command: 17 | 18 | mvn activemq:run -Dlog4j.configuration=file:/// 19 | 20 | As of now, runs ActiveMQ 5.8 (note: build & run with JDK 1.7). 21 | 22 | Alternatively, you may choose use docker, for example: 23 | 24 | https://hub.docker.com/r/webcenter/activemq/ (or similar) 25 | 26 | ActiveMQ License 27 | ================ 28 | 29 | Note that the code for the ActiveMQ admin console is included here for convenience and 30 | falls under the [Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0.html) 31 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/main/resources/activemq/credentials.properties: -------------------------------------------------------------------------------- 1 | ## --------------------------------------------------------------------------- 2 | ## Licensed to the Apache Software Foundation (ASF) under one or more 3 | ## contributor license agreements. See the NOTICE file distributed with 4 | ## this work for additional information regarding copyright ownership. 5 | ## The ASF licenses this file to You under the Apache License, Version 2.0 6 | ## (the "License"); you may not use this file except in compliance with 7 | ## the License. You may obtain a copy of the License at 8 | ## 9 | ## http://www.apache.org/licenses/LICENSE-2.0 10 | ## 11 | ## Unless required by applicable law or agreed to in writing, software 12 | ## distributed under the License is distributed on an "AS IS" BASIS, 13 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ## See the License for the specific language governing permissions and 15 | ## limitations under the License. 16 | ## --------------------------------------------------------------------------- 17 | 18 | # Defines credentials that will be used by components (like web console) to access the broker 19 | 20 | activemq.username=system 21 | activemq.password=manager 22 | guest.password=password 23 | 24 | mysql.host= 25 | mysql.database= 26 | mysql.username= 27 | mysql.password= 28 | 29 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/main/resources/activemq/jetty-realm.properties: -------------------------------------------------------------------------------- 1 | ## --------------------------------------------------------------------------- 2 | ## Licensed to the Apache Software Foundation (ASF) under one or more 3 | ## contributor license agreements. See the NOTICE file distributed with 4 | ## this work for additional information regarding copyright ownership. 5 | ## The ASF licenses this file to You under the Apache License, Version 2.0 6 | ## (the "License"); you may not use this file except in compliance with 7 | ## the License. You may obtain a copy of the License at 8 | ## 9 | ## http://www.apache.org/licenses/LICENSE-2.0 10 | ## 11 | ## Unless required by applicable law or agreed to in writing, software 12 | ## distributed under the License is distributed on an "AS IS" BASIS, 13 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ## See the License for the specific language governing permissions and 15 | ## limitations under the License. 16 | ## --------------------------------------------------------------------------- 17 | 18 | # Defines users that can access the web (console, demo, etc.) 19 | # username: password [,rolename ...] 20 | admin: admin, admin 21 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # Set root logger level to error 2 | log4j.rootLogger=info, Console 3 | 4 | ###### Console appender definition ####### 5 | 6 | # All outputs currently set to be a ConsoleAppender. 7 | log4j.appender.Console=org.apache.log4j.ConsoleAppender 8 | log4j.appender.Console.layout=org.apache.log4j.PatternLayout 9 | 10 | # use log4j NDC to replace %x with tenant domain / username 11 | log4j.appender.Console.layout.ConversionPattern=%d{ISO8601} %x %-5p [%c{3}] [%t] %m%n 12 | #log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n 13 | 14 | ###### Log level overrides ####### 15 | 16 | log4j.logger.org.example=debug 17 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/WebConsoleStarter$OsgiUtil.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenInfo/Gengine/3d32e7c36836a11863d795700e867cc49c48c796/gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/WebConsoleStarter$OsgiUtil.class -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/WebConsoleStarter.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenInfo/Gengine/3d32e7c36836a11863d795700e867cc49c48c796/gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/WebConsoleStarter.class -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/config/OsgiConfiguration.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenInfo/Gengine/3d32e7c36836a11863d795700e867cc49c48c796/gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/config/OsgiConfiguration.class -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/controller/CopyMessage.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenInfo/Gengine/3d32e7c36836a11863d795700e867cc49c48c796/gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/controller/CopyMessage.class -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/controller/CreateDestination.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenInfo/Gengine/3d32e7c36836a11863d795700e867cc49c48c796/gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/controller/CreateDestination.class -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/controller/CreateSubscriber.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenInfo/Gengine/3d32e7c36836a11863d795700e867cc49c48c796/gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/controller/CreateSubscriber.class -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/controller/DeleteDestination.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenInfo/Gengine/3d32e7c36836a11863d795700e867cc49c48c796/gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/controller/DeleteDestination.class -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/controller/DeleteJob.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenInfo/Gengine/3d32e7c36836a11863d795700e867cc49c48c796/gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/controller/DeleteJob.class -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/controller/DeleteMessage.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenInfo/Gengine/3d32e7c36836a11863d795700e867cc49c48c796/gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/controller/DeleteMessage.class -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/controller/DeleteSubscriber.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenInfo/Gengine/3d32e7c36836a11863d795700e867cc49c48c796/gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/controller/DeleteSubscriber.class -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/controller/MoveMessage.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenInfo/Gengine/3d32e7c36836a11863d795700e867cc49c48c796/gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/controller/MoveMessage.class -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/controller/PurgeDestination.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenInfo/Gengine/3d32e7c36836a11863d795700e867cc49c48c796/gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/controller/PurgeDestination.class -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/controller/SendMessage.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenInfo/Gengine/3d32e7c36836a11863d795700e867cc49c48c796/gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/controller/SendMessage.class -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/filter/ApplicationContextFilter$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenInfo/Gengine/3d32e7c36836a11863d795700e867cc49c48c796/gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/filter/ApplicationContextFilter$1.class -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/filter/ApplicationContextFilter$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenInfo/Gengine/3d32e7c36836a11863d795700e867cc49c48c796/gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/filter/ApplicationContextFilter$2.class -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/filter/ApplicationContextFilter.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenInfo/Gengine/3d32e7c36836a11863d795700e867cc49c48c796/gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/filter/ApplicationContextFilter.class -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/handler/BindingBeanNameUrlHandlerMapping.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenInfo/Gengine/3d32e7c36836a11863d795700e867cc49c48c796/gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/classes/org/apache/activemq/web/handler/BindingBeanNameUrlHandlerMapping.class -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/decorators.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | /xml/* 22 | /slave.jsp 23 | 24 | 25 | 26 | /* 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/jspf/headertags.jspf: -------------------------------------------------------------------------------- 1 | <%-- 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | --%> 17 | <%@ taglib prefix="decorator" uri="http://www.opensymphony.com/sitemesh/decorator" %> 18 | <%@ taglib prefix="form" tagdir="/WEB-INF/tags/form" %> 19 | <%@ taglib prefix="jms" tagdir="/WEB-INF/tags/jms" %> 20 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 21 | <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> 22 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/jspf/old.jspf: -------------------------------------------------------------------------------- 1 | <%-- 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | --%> 17 | <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 18 | <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 19 | <%@ taglib prefix="display" uri="http://displaytag.sf.net" %> 20 | 21 | <%@ taglib prefix="c" tagdir="/WEB-INF/tags/c" %> 22 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/tags/form/checkbox.tag: -------------------------------------------------------------------------------- 1 | <%-- 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | --%> 17 | <%@ attribute name="name" type="java.lang.String" required="true" %> 18 | 19 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/tags/form/escape.tag: -------------------------------------------------------------------------------- 1 | <%-- 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | --%> 17 | <%@ attribute name="text" type="java.lang.String" required="true" %> 18 | <% 19 | out.println(java.net.URLEncoder.encode(text, "UTF-8")); 20 | %> 21 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/tags/form/forEachMapEntry.tag: -------------------------------------------------------------------------------- 1 | <%-- 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | --%> 17 | <%@ attribute name="var" type="java.lang.String" required="true" %> 18 | <%@ attribute name="items" type="java.util.Map" required="true" %> 19 | <%@ tag import="java.util.Iterator" %> 20 | <% 21 | Iterator iter = items.entrySet().iterator(); 22 | while (iter.hasNext()) { 23 | request.setAttribute(var, iter.next()); 24 | %> 25 | 26 | <% 27 | } 28 | %> 29 | 30 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/tags/form/option.tag: -------------------------------------------------------------------------------- 1 | <%-- 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | --%> 17 | <%@ attribute name="name" type="java.lang.String" required="true" %> 18 | <%@ attribute name="value" type="java.lang.String" required="true" %> 19 | <%@ attribute name="label" type="java.lang.String" required="true" %> 20 | 21 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/tags/form/short.tag: -------------------------------------------------------------------------------- 1 | <%-- 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | --%> 17 | <%@ attribute name="text" type="java.lang.String" required="true" %> 18 | <%@ attribute name="length" type="java.lang.Integer" required="false" %> 19 | <% 20 | text = org.apache.commons.lang3.StringEscapeUtils.escapeHtml(text); 21 | text = org.apache.commons.lang3.StringEscapeUtils.escapeJavaScript(text); 22 | if (length == null || length < 20) 23 | length = 20; 24 | if (text.length() <= length) { 25 | out.print(text); 26 | } else { 27 | out.println(text.substring(0, (length-10)) + "..." + text.substring(text.length() - 5)); 28 | } 29 | %> 30 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/tags/form/text.tag: -------------------------------------------------------------------------------- 1 | <%-- 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | --%> 17 | <%@ attribute name="name" type="java.lang.String" required="true" %> 18 | <%@ attribute name="defaultValue" type="java.lang.String" required="false" %> 19 | <% 20 | String value = request.getParameter(name); 21 | if (value == null || value.trim().length() == 0) { 22 | value = defaultValue; 23 | } 24 | if (value == null) { 25 | value = ""; 26 | } 27 | value = org.apache.commons.lang3.StringEscapeUtils.escapeHtml(value); 28 | 29 | %> 30 | 31 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/tags/form/tooltip.tag: -------------------------------------------------------------------------------- 1 | <%-- 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | --%> 17 | <%@ attribute name="text" type="java.lang.String" required="true" %> 18 | <%@ attribute name="length" type="java.lang.Integer" required="false" %> 19 | <% 20 | text = text.replaceAll("<", "<"); 21 | text = text.replaceAll(">", ">"); 22 | if (length == null) 23 | length = 23; 24 | if (text.length() <= length) { 25 | out.print(text); 26 | } else { 27 | out.println(" " + text.substring(0, length - 3) + "... " + text + ""); 28 | } 29 | %> 30 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/tags/form/uri.tag: -------------------------------------------------------------------------------- 1 | <%-- 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | --%> 17 | <%@ attribute name="name" type="java.lang.String" required="true" %> 18 | 19 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/tags/jms/forEachConnection.tag: -------------------------------------------------------------------------------- 1 | <%-- 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | --%> 17 | <%@ attribute name="connection" type="java.lang.String" required="true" %> 18 | <%@ attribute name="connectionName" type="java.lang.String" required="true" %> 19 | <%@ attribute name="broker" type="org.apache.activemq.web.BrokerFacade" required="true" %> 20 | <%@ attribute name="connectorName" type="java.lang.String" required="true" %> 21 | <%@ tag import="java.util.Iterator" %> 22 | <%@ tag import="org.apache.activemq.broker.jmx.ConnectionViewMBean" %> 23 | <% 24 | Iterator it = broker.getConnections(connectorName).iterator(); 25 | while (it.hasNext()) { 26 | String conName = (String) it.next(); 27 | ConnectionViewMBean con = broker.getConnection(conName); 28 | request.setAttribute(connectionName, conName); 29 | request.setAttribute(connection, con); 30 | %> 31 | 32 | <% 33 | } 34 | %> 35 | 36 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/tags/jms/forEachMessage.tag: -------------------------------------------------------------------------------- 1 | <%-- 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | --%> 17 | <%@ attribute name="var" type="java.lang.String" required="true" %> 18 | <%@ attribute name="queueBrowser" type="javax.jms.QueueBrowser" required="true" %> 19 | <%@ tag import="java.util.Enumeration" %> 20 | <%@ tag import="javax.jms.Message" %> 21 | <% 22 | 23 | Enumeration iter = queueBrowser.getEnumeration(); 24 | while (iter.hasMoreElements()) { 25 | Message message = (Message) iter.nextElement(); 26 | if (message != null) { 27 | request.setAttribute(var, message); 28 | %> 29 | 30 | <% 31 | } 32 | } 33 | %> 34 | 35 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/tags/jms/formatTimestamp.tag: -------------------------------------------------------------------------------- 1 | <%-- 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | --%> 17 | <%@ attribute name="timestamp" type="java.lang.String"%> 18 | <%@ tag import="java.util.Date" %> 19 | <%@ tag import="java.text.SimpleDateFormat" %> 20 | <% 21 | if (timestamp != null) { 22 | long time = Long.parseLong(timestamp); 23 | Date date = new Date(time); 24 | 25 | SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS z"); 26 | 27 | out.println(formatter.format(date)); 28 | } 29 | %> 30 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/tags/jms/persistent.tag: -------------------------------------------------------------------------------- 1 | <%-- 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | --%> 17 | <%@ attribute name="message" type="javax.jms.Message" required="true" %> 18 | <% 19 | if (message != null) { 20 | if (message.getJMSDeliveryMode() == javax.jms.DeliveryMode.PERSISTENT) { 21 | out.println("Persistent"); 22 | } 23 | else { 24 | out.println("Non Persistent"); 25 | } 26 | } 27 | %> 28 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/webconsole-default.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/webconsole-embedded.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | file:${activemq.conf}/credentials.properties 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/webconsole-invm.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/webconsole-jndi.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/webconsole-osgi.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/webconsole-properties.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/WEB-INF/webconsole-query.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/browse.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | --%> 17 | 18 | 19 | Browse <form:short text="${requestContext.queueBrowser.JMSDestination}"/> 20 | 21 | 22 | 23 |

Browse

24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 54 | 55 | 56 | 57 |
Message IDCorrelation IDPersistencePriorityRedeliveredReply ToTimestampTypeOperations
" 43 | title="${row.properties}">${row.JMSMessageID} 52 | &messageId=${row.JMSMessageID}&secret=">Delete 53 |
58 | 59 |
60 | ">View Consumers 61 |
62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/connections.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | --%> 17 | 18 | 19 | Connections 20 | 21 | 22 | 23 |

Connections

24 | 25 | 26 |

Connector ${connectorName}

27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 |
NameRemote AddressActiveSlow
${conName}${con.remoteAddress}${con.active}${con.slow}
49 | 50 |
51 | 52 |
53 |

Network Connectors

54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 |
NameNetwork TTLDynamic OnlyConduit SubscriptionsBridge TempsDecrease PrioritiesDispatch Async
${nc.name}${nc.networkTTL}${nc.dynamicOnly}${nc.conduitSubscriptions}${nc.bridgeTempDestinations}${nc.decreaseNetworkConsumerPriority}${nc.dispatchAsync}
81 |
82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/decorators/panel.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 2 | <%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %> 3 | <%-- 4 | Licensed to the Apache Software Foundation (ASF) under one or more 5 | contributor license agreements. See the NOTICE file distributed with 6 | this work for additional information regarding copyright ownership. 7 | The ASF licenses this file to You under the Apache License, Version 2.0 8 | (the "License"); you may not use this file except in compliance with 9 | the License. You may obtain a copy of the License at 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, software 14 | distributed under the License is distributed on an "AS IS" BASIS, 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | See the License for the specific language governing permissions and 17 | limitations under the License. 18 | --%> 19 |

20 | 21 | 22 | 25 | 26 | 27 | 30 | 31 |
23 | 24 |
28 | 29 |
32 |

33 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/decorators/printable.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 2 | <%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %> 3 | <%-- 4 | Licensed to the Apache Software Foundation (ASF) under one or more 5 | contributor license agreements. See the NOTICE file distributed with 6 | this work for additional information regarding copyright ownership. 7 | The ASF licenses this file to You under the Apache License, Version 2.0 8 | (the "License"); you may not use this file except in compliance with 9 | the License. You may obtain a copy of the License at 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, software 14 | distributed under the License is distributed on an "AS IS" BASIS, 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | See the License for the specific language governing permissions and 17 | limitations under the License. 18 | --%> 19 | 20 | 21 | 22 | <decorator:title default="Welcome!" /> 23 | 24 | 25 | 26 | 27 | Printed on <%=new java.util.Date()%>.
28 |
29 |
30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/graph.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | --%> 17 | 18 | 19 | Browse ${requestContext.queueBrowser.JMSDestination} 20 | 21 | 22 | 23 |

Browse ${requestContext.queueBrowser.JMSDestination}

24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | <%-- 41 | 42 | ---%> 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 56 | 57 | 58 | <%-- 59 | 60 | --%> 61 | 62 |
Message IDCorrelation IDPersistencePriorityRedeliveredReply ToTimestampTypeOperations
${row.JMSMessageID}${row.JMSCorrelationID}${row.JMSPriority}${row.JMSRedelivered}${row.JMSReplyTo}${row.JMSTimestamp}${row.JMSType} 54 | ">Delete 55 |
63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/index.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | --%> 17 | 18 | 19 | ActiveMQ Console 20 | 21 | 22 | 23 |

Welcome!

24 | 25 |

26 | Welcome to the ActiveMQ Console of ${requestContext.brokerQuery.brokerName} (${requestContext.brokerQuery.brokerAdmin.brokerId}) 27 |

28 | 29 |

30 | You can find more information about ActiveMQ on the Apache ActiveMQ Site 31 |

32 | 33 |

Broker

34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 |
Name${requestContext.brokerQuery.brokerAdmin.brokerName}
Version${requestContext.brokerQuery.brokerAdmin.brokerVersion}
ID${requestContext.brokerQuery.brokerAdmin.brokerId}
Uptime${requestContext.brokerQuery.brokerAdmin.uptime}
Store percent used${requestContext.brokerQuery.brokerAdmin.storePercentUsage}
Memory percent used${requestContext.brokerQuery.brokerAdmin.memoryPercentUsage}
Temp percent used${requestContext.brokerQuery.brokerAdmin.tempPercentUsage}
66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/js/mochi/__package__.js: -------------------------------------------------------------------------------- 1 | /*** 2 | 3 | MochiKit.MochiKit 1.3 : PACKED VERSION 4 | 5 | THIS FILE IS AUTOMATICALLY GENERATED. If creating patches, please 6 | diff against the source tree, not this file. 7 | 8 | See for documentation, downloads, license, etc. 9 | 10 | (c) 2005 Bob Ippolito. All rights Reserved. 11 | 12 | ***/ 13 | dojo.hostenv.conditionalLoadModule({"common": ["MochiKit.MochiKit"]}); 14 | dojo.hostenv.moduleLoaded("MochiKit.*"); 15 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/js/plotkit/dummy.svg: -------------------------------------------------------------------------------- 1 | 2 | 8 | 15 | 16 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/js/standardista-table-sorting.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenInfo/Gengine/3d32e7c36836a11863d795700e867cc49c48c796/gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/js/standardista-table-sorting.js -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/network.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | --%> 17 | 18 | 19 | Network Bridges 20 | 21 | 22 | 23 |
24 |

Network Bridges

25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 |
Remote BrokerRemote AddressCreated By DuplexMessages EnqueuedMessages Dequeued
${nb.remoteBrokerName}${nb.remoteAddress}${nb.createdByDuplex}${nb.enqueueCounter}${nb.dequeueCounter}
48 |
49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/queueConsumers.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | --%> 17 | 18 | 19 | Consumers for <c:out value="${requestContext.queueConsumerQuery.JMSDestination}" /> 20 | 21 | 22 | 23 |

Active Consumers for

24 | 25 | 26 | 27 | 28 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 44 | 49 | 50 | 51 | 52 | 53 | 54 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 75 | 79 | 80 | 81 | 82 |
29 | Client ID 30 |
31 | Connection ID 32 |
SessionIdSelectorEnqueuesDequeuesDispatchedDispatched Queue 40 | Prefetch 41 |
42 | Max pending 43 |
45 | Exclusive 46 |
47 | Retroactive 48 |
55 | 56 | 57 | ${row.clientId}
58 |
59 | 60 | ${row.clientId}
61 |
62 |
63 | ${row.connectionId} 64 |
${row.sessionId}${row.selector}${row.enqueueCounter}${row.dequeueCounter}${row.dispatchedCounter}${row.dispatchedQueueSize} 72 | ${row.prefetchSize}
73 | ${row.maximumPendingMessageLimit} 74 |
76 | ${row.exclusive}
77 | ${row.retroactive} 78 |
83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/queueGraph.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | --%> 17 | 18 | 19 | Queues 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 54 | 55 |
56 | 57 | <%--- 58 | Other values we can graph... 59 | 60 | ${row.consumerCount} 61 | ${row.enqueueCount} 62 | ${row.dequeueCount} 63 | --%> 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/scheduled.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | --%> 17 | 18 | 19 | Messages Scheduled for Future Delivery 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 53 | 54 | 55 | 56 |
Job IDCron Entrynext scheduled timestartdelayperiodrepeatOperations
${row.jobId}${row.cronEntry}${row.nextExecutionTime}${row.start}${row.delay}${row.period}${row.repeat} 51 | ">Delete 52 |
57 | 58 | 59 |
60 |

Scheduler not started!

61 |
62 |
63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/styles/prettify.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | /* Pretty printing styles. Used with prettify.js. */ 19 | 20 | .str { color: #080; } 21 | .kwd { color: #008; } 22 | .com { color: #800; } 23 | .typ { color: #606; } 24 | .lit { color: #066; } 25 | .pun { color: #660; } 26 | .pln { color: #000; } 27 | .tag { color: #008; } 28 | .atn { color: #606; } 29 | .atv { color: #080; } 30 | .dec { color: #606; } 31 | pre.prettyprint { padding: 2px; } 32 | 33 | @media print { 34 | .str { color: #060; } 35 | .kwd { color: #006; font-weight: bold; } 36 | .com { color: #600; font-style: italic; } 37 | .typ { color: #404; font-weight: bold; } 38 | .lit { color: #044; } 39 | .pun { color: #440; } 40 | .pln { color: #000; } 41 | .tag { color: #006; font-weight: bold; } 42 | .atn { color: #404; } 43 | .atv { color: #060; } 44 | } 45 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/styles/sorttable.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | table.sortable { 19 | margin: 0px; 20 | padding: 0px; 21 | margin-bottom: 1em; 22 | 23 | margin: 1em auto; 24 | } 25 | 26 | th { 27 | padding: 2px; 28 | padding-left: 10px; 29 | text-align: left; 30 | background-color: #ccc; 31 | } 32 | 33 | tfoot { 34 | /* border-top: 1px solid black; */ 35 | } 36 | 37 | td { 38 | padding: 0.5em; 39 | /* border: 1px solid black; */ 40 | /** border-top: 1px solid black; */ 41 | } 42 | 43 | tr { 44 | background-color: #ffffff; 45 | } 46 | 47 | tr.odd { 48 | background-color: #f3f3f3; 49 | } 50 | 51 | td.numeric, 52 | th.numeric { 53 | text-align: right; 54 | } 55 | 56 | /** forms using table layout */ 57 | td.label { 58 | background-color: #f3f3f3; 59 | } 60 | /* 61 | table.layout { 62 | border-bottom: solid white; 63 | border-right: solid white; 64 | } 65 | 66 | td.layout { 67 | border-top: 1px solid black; 68 | border: solid white; 69 | } 70 | */ 71 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/test/dummy.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | --%> 17 | 18 | 19 | Test Pages 20 | 21 | 22 | 23 |

Test Pages

24 | 25 | These pages are used to test out the environment and web framework. 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 |
Values
Broker type${requestContext.brokerQuery.broker.class}
Managed broker${requestContext.brokerQuery.brokerAdmin.broker.class}
Destinations${requestContext.brokerQuery.managedBroker.queueRegion.destinationMap}
48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/test/index.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | --%> 17 | 18 | 19 | Test Pages 20 | 21 | 22 | 23 |

Test Pages

24 | 25 | These pages are used to test out the environment and web framework. 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 |
Headers
request.contextPath${request.contextPath}
request.requestURI${request.requestURI}
request.remoteAddr${request.remoteAddr}
request.remoteHost${request.remoteHost}
request.queryString${request.queryString}
request.scheme${request.scheme}
request.serverName${request.serverName}
request.serverPort${request.serverPort}
Spring applicationContext${applicationContext}
Spring requestContext${requestContext}
System properties<%= System.getProperties() %>
80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/test/systemProperties.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | --%> 17 | 18 | 19 | Test Pages 20 | 21 | 22 | 23 |

Test Pages

24 | 25 | These pages are used to test out the environment and web framework. 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | <% 37 | for (java.util.Iterator iter = System.getProperties().entrySet().iterator(); iter.hasNext(); ) { 38 | request.setAttribute("entry", iter.next()); 39 | %> 40 | 41 | 42 | 43 | 44 | <% 45 | } 46 | %> 47 | 48 |
System PropertyValue
${entry.key}${entry.value}
49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/topics.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Licensed to the Apache Software Foundation (ASF) under one or more 3 | contributor license agreements. See the NOTICE file distributed with 4 | this work for additional information regarding copyright ownership. 5 | The ASF licenses this file to You under the Apache License, Version 2.0 6 | (the "License"); you may not use this file except in compliance with 7 | the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | --%> 17 | 18 | 19 | Topics 20 | 21 | 22 | 23 |
24 |
25 | 26 | "/> 27 | 28 | 29 | 30 | 31 | 32 |
33 |
34 | 35 |

Topics

36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 53 | 54 | 55 | 56 | 65 | 66 | 67 | 68 |
NameNumber Of ConsumersMessages EnqueuedMessages DequeuedOperations
51 | 52 | ">${row.consumerCount}${row.enqueueCount}${row.dequeueCount} 57 | 58 | 59 | ">Send To 60 | 61 | 62 | 63 | ">Delete 64 |
69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/xml/queues.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/xml;charset=ISO-8859-1"%> 2 | <%-- 3 | Licensed to the Apache Software Foundation (ASF) under one or more 4 | contributor license agreements. See the NOTICE file distributed with 5 | this work for additional information regarding copyright ownership. 6 | The ASF licenses this file to You under the Apache License, Version 2.0 7 | (the "License"); you may not use this file except in compliance with 8 | the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | --%> 18 | 19 | 20 | 21 | 22 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/xml/subscribers.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/xml;charset=ISO-8859-1"%> 2 | <%-- 3 | Licensed to the Apache Software Foundation (ASF) under one or more 4 | contributor license agreements. See the NOTICE file distributed with 5 | this work for additional information regarding copyright ownership. 6 | The ASF licenses this file to You under the Apache License, Version 2.0 7 | (the "License"); you may not use this file except in compliance with 8 | the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | --%> 18 | 19 | 20 | " 25 | active="yes" > 26 | 31 | 32 | 33 | 34 | 35 | 36 | " 41 | active="no" > 42 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /gengine-messaging/messaging-broker-activemq/src/test/webapp/admin/xml/topics.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/xml;charset=ISO-8859-1"%> 2 | <%-- 3 | Licensed to the Apache Software Foundation (ASF) under one or more 4 | contributor license agreements. See the NOTICE file distributed with 5 | this work for additional information regarding copyright ownership. 6 | The ASF licenses this file to You under the Apache License, Version 2.0 7 | (the "License"); you may not use this file except in compliance with 8 | the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | --%> 18 | 19 | 20 | 21 | 22 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /gengine-messaging/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | org.gengine 6 | gengine-parent 7 | 0.13-SNAPSHOT 8 | ../pom.xml 9 | 10 | 11 | gengine-messaging 12 | pom 13 | 14 | 15 | gengine-messaging-commons 16 | gengine-messaging-amqp-direct 17 | gengine-messaging-camel 18 | gengine-messaging-benchmark 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /gengine-node-simple/README.md: -------------------------------------------------------------------------------- 1 | 2 | Overview 3 | ======== 4 | 5 | A simple AMQP content node that listens to one queue and 6 | delegates to one content worker for the lightest weight node possible. 7 | 8 | The `SimpleAmqpNodeBootsrap` class uses component bootraps to configure the worker 9 | based on a provided properties file, instantiates an AMQP endpoint, and starts it's message listener. 10 | 11 | The worker from lower level dependencies to be used is specified in the properties file. 12 | 13 | Usage 14 | ===== 15 | 16 | First build the jar via Maven: 17 | 18 | mvn clean install 19 | 20 | either from the parent folder or this project. 21 | 22 | Start an AMQP broker. See the `messaging-broker-activemq` project. 23 | 24 | The single jar with dependencies should be launched with a parameter of the 25 | path to the properties file, i.e. (replace 0.X-SNAPSHOT with appropriate version): 26 | 27 | java -jar target/gengine-node-simple-0.X-SNAPSHOT-jar-with-dependencies.jar target/imagemagick.properties 28 | 29 | You should see a message indicating that the node is waiting for a message. 30 | 31 | Once a message is received the node will send a reply confirming it received the 32 | request and will perform the transformation, then sends another reply message indicating 33 | the transformation is complete. 34 | -------------------------------------------------------------------------------- /gengine-node-simple/src/main/config/ffmpeg.properties: -------------------------------------------------------------------------------- 1 | 2 | gengine.worker.class=org.gengine.content.transform.ffmpeg.FfmpegContentTransformerWorker 3 | 4 | gengine.worker.contentrefhandler.source.class=org.gengine.content.handler.FileContentReferenceHandlerImpl 5 | gengine.worker.contentrefhandler.source.file.dir=./ 6 | #gengine.worker.contentrefhandler.source.class=org.gengine.content.handler.webdav.WebDavContentReferenceHandlerImpl 7 | #gengine.worker.contentrefhandler.source.webdav.url=http://localhost/webdav 8 | #gengine.worker.contentrefhandler.source.webdav.username= 9 | #gengine.worker.contentrefhandler.source.webdav.password= 10 | 11 | gengine.worker.contentrefhandler.target.class=org.gengine.content.handler.FileContentReferenceHandlerImpl 12 | gengine.worker.contentrefhandler.target.file.dir=./ 13 | #gengine.worker.contentrefhandler.target.class=org.gengine.content.handler.webdav.WebDavContentReferenceHandlerImpl 14 | #gengine.worker.contentrefhandler.target.webdav.url=http://localhost/webdav 15 | #gengine.worker.contentrefhandler.target.webdav.username= 16 | #gengine.worker.contentrefhandler.target.webdav.password= 17 | 18 | 19 | gengine.messaging.broker.url=tcp://localhost:5672 20 | #gengine.messaging.broker.username=guest 21 | #gengine.messaging.broker.password=password 22 | gengine.messaging.queue.request=cheninfo.transform.request.video 23 | gengine.messaging.queue.reply=cheninfo.transform.reply.video 24 | -------------------------------------------------------------------------------- /gengine-node-simple/src/main/config/imagemagick.properties: -------------------------------------------------------------------------------- 1 | 2 | gengine.worker.class=org.gengine.content.transform.imagemagick.ImageMagickContentTransformerWorker 3 | 4 | gengine.worker.contentrefhandler.source.class=org.gengine.content.handler.FileContentReferenceHandlerImpl 5 | gengine.worker.contentrefhandler.source.file.dir=./ 6 | #gengine.worker.contentrefhandler.source.class=org.gengine.content.handler.webdav.WebDavContentReferenceHandlerImpl 7 | #gengine.worker.contentrefhandler.source.webdav.url=http://localhost/webdav 8 | #gengine.worker.contentrefhandler.source.webdav.username= 9 | #gengine.worker.contentrefhandler.source.webdav.password= 10 | 11 | gengine.worker.contentrefhandler.target.class=org.gengine.content.handler.FileContentReferenceHandlerImpl 12 | gengine.worker.contentrefhandler.target.file.dir=./ 13 | #gengine.worker.contentrefhandler.target.class=org.gengine.content.handler.webdav.WebDavContentReferenceHandlerImpl 14 | #gengine.worker.contentrefhandler.target.webdav.url=http://localhost/webdav 15 | #gengine.worker.contentrefhandler.target.webdav.username= 16 | #gengine.worker.contentrefhandler.target.webdav.password= 17 | 18 | gengine.messaging.broker.url=tcp://localhost:5672 19 | #gengine.messaging.broker.username=guest 20 | #gengine.messaging.broker.password=password 21 | gengine.messaging.queue.request=cheninfo.transform.request.image 22 | gengine.messaging.queue.reply=cheninfo.transform.reply.image 23 | -------------------------------------------------------------------------------- /gengine-node-simple/src/main/config/j2sehash.properties: -------------------------------------------------------------------------------- 1 | 2 | gengine.worker.class=org.gengine.content.hash.javase.JavaSeContentHashNodeWorker 3 | 4 | gengine.worker.contentrefhandler.source.class=org.gengine.content.handler.FileContentReferenceHandlerImpl 5 | gengine.worker.contentrefhandler.source.file.dir=./ 6 | #gengine.worker.contentrefhandler.source.class=org.gengine.content.handler.webdav.WebDavContentReferenceHandlerImpl 7 | #gengine.worker.contentrefhandler.source.webdav.url=http://localhost/webdav 8 | #gengine.worker.contentrefhandler.source.webdav.username= 9 | #gengine.worker.contentrefhandler.source.webdav.password= 10 | 11 | gengine.worker.contentrefhandler.target.class=org.gengine.content.handler.FileContentReferenceHandlerImpl 12 | gengine.worker.contentrefhandler.target.file.dir=./ 13 | #gengine.worker.contentrefhandler.target.class=org.gengine.content.handler.webdav.WebDavContentReferenceHandlerImpl 14 | #gengine.worker.contentrefhandler.target.webdav.url=http://localhost/webdav 15 | #gengine.worker.contentrefhandler.target.webdav.username= 16 | #gengine.worker.contentrefhandler.target.webdav.password= 17 | 18 | gengine.messaging.broker.url=tcp://localhost:5672 19 | #gengine.messaging.broker.username=guest 20 | #gengine.messaging.broker.password=password 21 | gengine.messaging.queue.request=cheninfo.hash.request 22 | gengine.messaging.queue.reply=cheninfo.hash.reply 23 | -------------------------------------------------------------------------------- /gengine-node-simple/src/main/java/org/gengine/content/node/HashComponentBootstrapFromProperties.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content.node; 2 | 3 | import java.util.Properties; 4 | 5 | import org.gengine.content.AbstractComponent; 6 | import org.gengine.content.handler.ContentReferenceHandler; 7 | import org.gengine.content.hash.AbstractContentHashWorker; 8 | import org.gengine.content.hash.BaseContentHashComponent; 9 | 10 | /** 11 | * Bootraps a hash component 12 | * 13 | * @param 14 | */ 15 | public class HashComponentBootstrapFromProperties extends 16 | AbstractComponentBootstrapFromProperties 17 | { 18 | public HashComponentBootstrapFromProperties(Properties properties, W worker) 19 | { 20 | super(properties, worker); 21 | } 22 | 23 | @SuppressWarnings({ "rawtypes", "unchecked" }) 24 | @Override 25 | protected AbstractComponent createComponent() 26 | { 27 | return new BaseContentHashComponent(); 28 | } 29 | 30 | protected void initWorker() 31 | { 32 | ContentReferenceHandler sourceHandler = createContentReferenceHandler( 33 | PROP_WORKER_CONTENT_REF_HANDLER_SOURCE_PREFIX); 34 | worker.setSourceContentReferenceHandler(sourceHandler); 35 | worker.initialize(); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /gengine-node-simple/src/main/java/org/gengine/content/node/TransformerComponentBootstrapFromProperties.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content.node; 2 | 3 | import java.util.Properties; 4 | 5 | import org.gengine.content.AbstractComponent; 6 | import org.gengine.content.handler.ContentReferenceHandler; 7 | import org.gengine.content.transform.AbstractContentTransformerWorker; 8 | import org.gengine.content.transform.BaseContentTransformerComponent; 9 | 10 | /** 11 | * Bootstraps a transformer component 12 | * 13 | * @param 14 | */ 15 | public class TransformerComponentBootstrapFromProperties extends 16 | AbstractComponentBootstrapFromProperties 17 | { 18 | protected static final String PROP_WORKER_CONTENT_REF_HANDLER_TARGET_PREFIX = 19 | "gengine.worker.contentrefhandler.target"; 20 | 21 | public TransformerComponentBootstrapFromProperties(Properties properties, W worker) 22 | { 23 | super(properties, worker); 24 | } 25 | 26 | @SuppressWarnings({ "rawtypes", "unchecked" }) 27 | @Override 28 | protected AbstractComponent createComponent() 29 | { 30 | return new BaseContentTransformerComponent(); 31 | } 32 | 33 | protected void initWorker() 34 | { 35 | ContentReferenceHandler sourceHandler = createContentReferenceHandler( 36 | PROP_WORKER_CONTENT_REF_HANDLER_SOURCE_PREFIX); 37 | worker.setSourceContentReferenceHandler(sourceHandler); 38 | 39 | ContentReferenceHandler targetHandler = createContentReferenceHandler( 40 | PROP_WORKER_CONTENT_REF_HANDLER_TARGET_PREFIX); 41 | worker.setTargetContentReferenceHandler(targetHandler); 42 | 43 | worker.initialize(); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /gengine-node-simple/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # Set root logger level to error 2 | log4j.rootLogger=error, Console 3 | 4 | ###### Console appender definition ####### 5 | 6 | # All outputs currently set to be a ConsoleAppender. 7 | log4j.appender.Console=org.apache.log4j.ConsoleAppender 8 | log4j.appender.Console.layout=org.apache.log4j.PatternLayout 9 | 10 | # use log4j NDC to replace %x with tenant domain / username 11 | log4j.appender.Console.layout.ConversionPattern=%d{ISO8601} %x %-5p [%c{3}] [%t] %m%n 12 | #log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n 13 | 14 | log4j.logger.org.gengine=debug 15 | -------------------------------------------------------------------------------- /gengine-transform/gengine-transform-commons/README.md: -------------------------------------------------------------------------------- 1 | 2 | Overview 3 | ======== 4 | 5 | Contains the basic definitions of the transformation option objects 6 | to be used by `ContentTransformerWorker`s. 7 | 8 | Note that classes brought from ChenInfoOne were kept as close to their originals 9 | as possible, primarily to aid in the marshalling process without having to make changes 10 | to existing ChenInfoOne code. Items could be changed/renamed more appropriately 11 | and without reference to 'repository' once ChenInfoOne is refactored to use this project. 12 | 13 | -------------------------------------------------------------------------------- /gengine-transform/gengine-transform-commons/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | org.gengine 6 | gengine-transform 7 | 0.13-SNAPSHOT 8 | ../pom.xml 9 | 10 | 11 | gengine-transform-commons 12 | 13 | 14 | 15 | org.gengine 16 | gengine-commons 17 | ${project.version} 18 | 19 | 20 | com.fasterxml.jackson.core 21 | jackson-annotations 22 | ${dependency.jackson.version} 23 | 24 | 25 | 26 | 27 | 28 | 29 | org.apache.maven.plugins 30 | maven-jar-plugin 31 | 2.4 32 | 33 | 34 | 35 | test-jar 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /gengine-transform/gengine-transform-commons/src/main/java/org/gengine/content/transform/AbstractContentTransformerWorker.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content.transform; 2 | 3 | import org.gengine.content.AbstractContentWorker; 4 | import org.gengine.content.ContentReference; 5 | import org.gengine.content.handler.ContentReferenceHandler; 6 | import org.gengine.content.mediatype.FileMediaType; 7 | 8 | /** 9 | * Abstract transform node worker which uses a content reference handler to convert the 10 | * content reference into a usable File object for the actual implementation. 11 | * 12 | */ 13 | public abstract class AbstractContentTransformerWorker 14 | extends AbstractContentWorker implements ContentTransformerWorker 15 | { 16 | protected ContentReferenceHandler targetContentReferenceHandler; 17 | 18 | public void setTargetContentReferenceHandler(ContentReferenceHandler targetContentReferenceHandler) 19 | { 20 | this.targetContentReferenceHandler = targetContentReferenceHandler; 21 | } 22 | 23 | public void initialize() 24 | { 25 | super.initialize(); 26 | } 27 | 28 | protected String getExtension(ContentReference contentReference) 29 | { 30 | return FileMediaType.SERVICE.getExtension(contentReference.getMediaType()); 31 | } 32 | 33 | @Override 34 | public String toString() 35 | { 36 | StringBuilder builder = new StringBuilder(this.getClass().getSimpleName() + "["); 37 | builder.append("sourceContentReferenceHandler: " + sourceContentReferenceHandler.toString()); 38 | builder.append(", "); 39 | builder.append("targetContentReferenceHandler: " + targetContentReferenceHandler.toString()); 40 | builder.append("]"); 41 | return builder.toString(); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /gengine-transform/gengine-transform-commons/src/main/java/org/gengine/content/transform/ContentTransformerWorkerProgressReporter.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content.transform; 2 | 3 | import java.util.List; 4 | 5 | import org.gengine.content.ContentWorkResult; 6 | 7 | /** 8 | * Defines methods for reporting progress on a content transformation. 9 | *

10 | * Implementations might send replies via messaging system or just log 11 | * progress. 12 | * 13 | */ 14 | public interface ContentTransformerWorkerProgressReporter 15 | { 16 | /** 17 | * Called when the transformation has been started 18 | */ 19 | public void onTransformationStarted(); 20 | 21 | /** 22 | * Optionally called when some amount of progress has been made on 23 | * the transformation 24 | * 25 | * @param progress 26 | */ 27 | public void onTransformationProgress(float progress); 28 | 29 | /** 30 | * Called when the transformation has completed 31 | * 32 | * @param results 33 | */ 34 | public void onTransformationComplete(List results); 35 | 36 | /** 37 | * Called when there was an error performing the transformation 38 | * 39 | * @param errorMessage 40 | */ 41 | public void onTransformationError(String errorMessage); 42 | } 43 | -------------------------------------------------------------------------------- /gengine-transform/gengine-transform-commons/src/main/java/org/gengine/content/transform/LoggingProgressReporterImpl.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content.transform; 2 | 3 | import java.util.List; 4 | 5 | import org.apache.commons.logging.Log; 6 | import org.gengine.content.ContentWorkResult; 7 | 8 | /** 9 | * Progress reporter which logs via a given logger. 10 | * 11 | */ 12 | public class LoggingProgressReporterImpl implements ContentTransformerWorkerProgressReporter 13 | { 14 | private Log logger; 15 | 16 | public LoggingProgressReporterImpl(Log logger) 17 | { 18 | this.logger = logger; 19 | } 20 | 21 | public void onTransformationStarted() 22 | { 23 | if (logger.isDebugEnabled()) 24 | { 25 | logger.debug("Starting transformation"); 26 | } 27 | } 28 | 29 | public void onTransformationProgress(float progress) 30 | { 31 | if (logger.isDebugEnabled()) 32 | { 33 | logger.debug(progress*100 + "% progress on transformation"); 34 | } 35 | } 36 | 37 | public void onTransformationComplete(List results) 38 | { 39 | if (logger.isDebugEnabled()) 40 | { 41 | logger.debug("Completed transformation"); 42 | } 43 | } 44 | 45 | @Override 46 | public void onTransformationError(String errorMessage) 47 | { 48 | if (logger.isDebugEnabled()) 49 | { 50 | logger.debug("Error performing transformation: " + errorMessage); 51 | } 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /gengine-transform/gengine-transform-commons/src/main/java/org/gengine/content/transform/TransformerDebug.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content.transform; 2 | 3 | import org.gengine.content.transform.options.TransformationOptionPair; 4 | 5 | /** 6 | * Generates logging for transformers. 7 | *

8 | * Currently contains the minimum contract required by {@link TransformationOptionPair}. 9 | * 10 | */ 11 | public interface TransformerDebug 12 | { 13 | public boolean isEnabled(); 14 | 15 | public T setCause(T t); 16 | 17 | public void debug(String message); 18 | 19 | public void debug(String message, Throwable t); 20 | } 21 | -------------------------------------------------------------------------------- /gengine-transform/gengine-transform-commons/src/main/java/org/gengine/content/transform/options/SerializedTransformationOptionsAccessor.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content.transform.options; 2 | 3 | /** 4 | * Defines methods for retrieving parameter values for use in building 5 | * transformation options. 6 | * 7 | */ 8 | public interface SerializedTransformationOptionsAccessor 9 | { 10 | 11 | /** 12 | * Gets the value for the named parameter. Checks the type of 13 | * the parameter is correct and throws and Exception if it isn't. 14 | * Returns null if the parameter value is null 15 | * 16 | * @param paramName the name of the parameter being checked. 17 | * @param clazz the expected {@link Class} of the parameter value. 18 | * @return the parameter value or null. 19 | */ 20 | public T getCheckedParam(String paramName, Class clazz); 21 | 22 | /** 23 | * Gets the value for the named parameter. Checks the type of the 24 | * parameter is the same as the type of defaultValue and 25 | * throws a {@link RenditionServiceException} if it isn't. Returns 26 | * defaultValue if the parameter value is null 27 | * 28 | * @param 29 | * @param paramName 30 | * @param defaultValue 31 | * @return 32 | */ 33 | public T getParamWithDefault(String paramName, T defaultValue); 34 | 35 | /** 36 | * Gets the int value for the named parameter. Returns 37 | * defaultValue if the parameter value is null. 38 | * 39 | * @param key 40 | * @param defaultValue 41 | * @return 42 | */ 43 | public int getIntegerParam(String key, int defaultValue); 44 | 45 | } 46 | -------------------------------------------------------------------------------- /gengine-transform/gengine-transform-commons/src/main/java/org/gengine/content/transform/options/TransformationSourceOptions.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content.transform.options; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import org.gengine.util.Mergable; 8 | 9 | /** 10 | * Defines options and demarcations needed to describe the details of how 11 | * the source should be transformed, independent of the target requirements. 12 | *

13 | * See {@link PagedSourceOptions} for an example implementation that 14 | * describes the page number that should be used from the source content. 15 | * 16 | */ 17 | public interface TransformationSourceOptions extends Serializable, Mergable 18 | { 19 | 20 | /** 21 | * Gets the list of applicable media types (mimetypes) 22 | * 23 | * @return the applicable media types 24 | */ 25 | public List getApplicableMediaTypes(); 26 | 27 | /** 28 | * Gets whether or not these transformation source options apply for the 29 | * given media type (mimetype) 30 | * 31 | * @param mediaType the media type of the source 32 | * @return if these transformation source options apply 33 | */ 34 | public boolean isApplicableForMediaType(String mediaType); 35 | 36 | /** 37 | * Gets the serializer for the source options. 38 | * 39 | * @return the serializer 40 | */ 41 | public TransformationSourceOptionsSerializer getSerializer(); 42 | 43 | /** 44 | * Defines methods for serializing the source options into a parameter map and 45 | * deserializing from a serialized options accessor. 46 | *

47 | * This is primarily used when interacting with the {@link RenditionService} 48 | * with {@link AbstractRenderingEngine}'s RenderContext being an implementer 49 | * of this interface. 50 | */ 51 | public interface TransformationSourceOptionsSerializer 52 | { 53 | 54 | /** 55 | * Serializes the given transformation source options into the given parameter map. 56 | * 57 | * @param transformationSourceOptions 58 | * @param parameters 59 | */ 60 | public void serialize(TransformationSourceOptions transformationSourceOptions, Map parameters); 61 | 62 | /** 63 | * Gets the parameters from the serialized options accessor and builds a source options object. 64 | * 65 | * @param serializedOptions 66 | * @return the deserialized source options 67 | */ 68 | public TransformationSourceOptions deserialize(SerializedTransformationOptionsAccessor serializedOptions); 69 | 70 | } 71 | 72 | } 73 | 74 | 75 | -------------------------------------------------------------------------------- /gengine-transform/gengine-transform-commons/src/main/java/org/gengine/content/transform/util/TimecodeUtils.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content.transform.util; 2 | 3 | /** 4 | * Utility class for handling timecode strings 5 | * 6 | */ 7 | public class TimecodeUtils 8 | { 9 | 10 | /** 11 | * Convert the given number of seconds into a timecode string of the form 12 | * "HH:mm:ss.SSS" 13 | * 14 | * @param totalSeconds 15 | * @return the timecode string 16 | */ 17 | public static String convertSecondsToTimecode(float totalSeconds) 18 | { 19 | return convertSecondsToTimecode(totalSeconds, 3); 20 | } 21 | 22 | /** 23 | * Convert the given number of seconds into a timecode string of the form 24 | * "HH:mm:ss.SSS" where the given decimalScale indicates the number of 25 | * digits to retain after the decimal point 26 | * 27 | * @param totalSeconds 28 | * @param decimalScale 29 | * @return the timecode string 30 | */ 31 | public static String convertSecondsToTimecode(float totalSeconds, int decimalScale) 32 | { 33 | int hours = new Float((totalSeconds / 3600) % 24).intValue(); 34 | String hoursDisplay = String.format("%02d", hours); 35 | 36 | int minutes = new Float((totalSeconds / 60) % 60).intValue(); 37 | String minutesDisplay = String.format("%02d", minutes); 38 | 39 | float seconds = (totalSeconds % 60); 40 | 41 | String secondsDisplay = String.format( 42 | "%0" + (decimalScale + 3) + "." + decimalScale + "f", seconds); 43 | 44 | return hoursDisplay + ":" + minutesDisplay + ":" + secondsDisplay; 45 | } 46 | 47 | /** 48 | * Converts the given timecode string of the form "HH:mm:ss[.SSS]" to the 49 | * total number of seconds it represents 50 | * 51 | * @param timecode 52 | * @return the total number of seconds 53 | */ 54 | public static float convertTimecodeToSeconds(String timecode) 55 | { 56 | String[] timeParts = timecode.split(":"); 57 | int hours = Integer.parseInt(timeParts[0]); 58 | int minutes = Integer.parseInt(timeParts[1]); 59 | float seconds = Float.parseFloat(timeParts[2]) + (60 * minutes) + (60 * 60 * hours); 60 | return seconds; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /gengine-transform/gengine-transform-commons/src/test/java/org/gengine/content/transform/util/TimecodeUtilsTest.java: -------------------------------------------------------------------------------- 1 | package org.gengine.content.transform.util; 2 | 3 | import org.junit.Test; 4 | 5 | import static junit.framework.Assert.*; 6 | 7 | public class TimecodeUtilsTest 8 | { 9 | 10 | @Test 11 | public void testSecondsToTimecode() 12 | { 13 | float seconds = 50f; 14 | assertEquals("00:00:50.000", TimecodeUtils.convertSecondsToTimecode(seconds)); 15 | 16 | seconds = 70f; 17 | assertEquals("00:01:10.000", TimecodeUtils.convertSecondsToTimecode(seconds)); 18 | 19 | seconds = 5f; 20 | assertEquals("00:00:05.000", TimecodeUtils.convertSecondsToTimecode(seconds)); 21 | 22 | seconds = 5.011f; 23 | assertEquals("00:00:05.011", TimecodeUtils.convertSecondsToTimecode(seconds)); 24 | 25 | seconds = (60*60*2) + (60*11) + 22.123f; 26 | assertEquals("02:11:22.123", TimecodeUtils.convertSecondsToTimecode(seconds)); 27 | 28 | seconds = 5f; 29 | assertEquals("00:00:05.0", TimecodeUtils.convertSecondsToTimecode(seconds, 1)); 30 | } 31 | 32 | @Test 33 | public void testTimecodeToSeconds() 34 | { 35 | String timecode = "00:00:50.000"; 36 | assertEquals(50f, TimecodeUtils.convertTimecodeToSeconds(timecode)); 37 | 38 | timecode = "00:01:10.000"; 39 | assertEquals(70f, TimecodeUtils.convertTimecodeToSeconds(timecode)); 40 | 41 | timecode = "00:00:05.000"; 42 | assertEquals(5f, TimecodeUtils.convertTimecodeToSeconds(timecode)); 43 | 44 | timecode = "00:00:05.011"; 45 | assertEquals(5.011f, TimecodeUtils.convertTimecodeToSeconds(timecode)); 46 | 47 | timecode = "00:00:11.07"; 48 | assertEquals(11.07f, TimecodeUtils.convertTimecodeToSeconds(timecode)); 49 | 50 | timecode = "02:11:22.123"; 51 | assertEquals((60*60*2) + (60*11) + 22.123f, TimecodeUtils.convertTimecodeToSeconds(timecode)); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /gengine-transform/gengine-transform-commons/src/test/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | # Set root logger level to error 2 | rootLogger.level=error 3 | rootLogger.appenderRef.stdout.ref=ConsoleAppender 4 | 5 | ###### Console appender definition ####### 6 | appender.console.type=Console 7 | appender.console.name=ConsoleAppender 8 | appender.console.layout.type=PatternLayout 9 | appender.console.layout.pattern=%d{ISO8601} %x %-5p [%c{3}] [%t] %replace{%m}{[\r\n]+}{}%n 10 | 11 | ###### Loggers definition ####### 12 | logger.org-gengine.name=org.gengine 13 | logger.org-gengine.level=debug 14 | 15 | logger.org-apache-tika.name=org.apache.tika 16 | logger.org-apache-tika.level=debug 17 | -------------------------------------------------------------------------------- /gengine-transform/gengine-transform-component/README.md: -------------------------------------------------------------------------------- 1 | 2 | Overview 3 | ======== 4 | 5 | This forms the basis of a content transformer node which acts as a 6 | `MessageConsumer` to process `TransformationRequest` objects and sends 7 | `TransformationReply` objects to a specified `MessageProducer`. 8 | 9 | No assumptions are made as to how those Java object messages are routed 10 | to or from the transformer node. 11 | 12 | A `ContentTransformerWorker` performs the actual work of converting 13 | the transformation options Java objects to command-line or API 14 | calls against `ContentReference` objects. 15 | -------------------------------------------------------------------------------- /gengine-transform/gengine-transform-component/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | org.gengine 6 | gengine-transform 7 | 0.13-SNAPSHOT 8 | ../pom.xml 9 | 10 | 11 | gengine-transform-component 12 | 13 | 14 | 15 | org.gengine 16 | gengine-transform-messaging 17 | ${project.version} 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /gengine-transform/gengine-transform-messaging/README.md: -------------------------------------------------------------------------------- 1 | 2 | Overview 3 | ======== 4 | 5 | Contains the basic definitions of `TransformationRequest` and `TransformationReply` 6 | objects. 7 | -------------------------------------------------------------------------------- /gengine-transform/gengine-transform-messaging/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | org.gengine 6 | gengine-transform 7 | 0.13-SNAPSHOT 8 | ../pom.xml 9 | 10 | 11 | gengine-transform-messaging 12 | 13 | 14 | 15 | org.gengine 16 | gengine-messaging-commons 17 | ${project.version} 18 | 19 | 20 | org.gengine 21 | gengine-transform-commons 22 | ${project.version} 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /gengine-transform/gengine-transform-worker-ffmpeg/README.md: -------------------------------------------------------------------------------- 1 | 2 | Overview 3 | ======== 4 | 5 | The `FfmpegContentTransformerNodeWorker` contains the code which converts transformation 6 | options Java objects to command-line parameters executed against File objects. 7 | -------------------------------------------------------------------------------- /gengine-transform/gengine-transform-worker-ffmpeg/src/main/resources/org/gengine/content/transform/ffmpeg/FfmpegContentTransformerWorker.properties: -------------------------------------------------------------------------------- 1 | name=Gengine FFmpeg ({0}) Content Transformer Worker 2 | version=${project.version} 3 | -------------------------------------------------------------------------------- /gengine-transform/gengine-transform-worker-ffmpeg/src/main/resources/org/gengine/content/transform/ffmpeg/test.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenInfo/Gengine/3d32e7c36836a11863d795700e867cc49c48c796/gengine-transform/gengine-transform-worker-ffmpeg/src/main/resources/org/gengine/content/transform/ffmpeg/test.mp4 -------------------------------------------------------------------------------- /gengine-transform/gengine-transform-worker-ffmpeg/src/test/resources/quick/countdown-leader.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenInfo/Gengine/3d32e7c36836a11863d795700e867cc49c48c796/gengine-transform/gengine-transform-worker-ffmpeg/src/test/resources/quick/countdown-leader.mp4 -------------------------------------------------------------------------------- /gengine-transform/gengine-transform-worker-ffmpeg/src/test/resources/quick/quick-1080.mov: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenInfo/Gengine/3d32e7c36836a11863d795700e867cc49c48c796/gengine-transform/gengine-transform-worker-ffmpeg/src/test/resources/quick/quick-1080.mov -------------------------------------------------------------------------------- /gengine-transform/gengine-transform-worker-imagemagick/README.md: -------------------------------------------------------------------------------- 1 | 2 | Overview 3 | ======== 4 | 5 | The `ImagemagickContentTransformerNodeWorker` contains the code which converts transformation 6 | options Java objects to command-line parameters executed against File objects. 7 | -------------------------------------------------------------------------------- /gengine-transform/gengine-transform-worker-imagemagick/src/main/resources/org/gengine/content/transform/imagemagick/ImageMagickContentTransformerWorker.properties: -------------------------------------------------------------------------------- 1 | name=Gengine ImageMagick Content Transformer Worker 2 | version=${project.version} 3 | -------------------------------------------------------------------------------- /gengine-transform/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | org.gengine 6 | gengine-parent 7 | 0.13-SNAPSHOT 8 | ../pom.xml 9 | 10 | 11 | gengine-transform 12 | pom 13 | 14 | 15 | gengine-transform-commons 16 | gengine-transform-messaging 17 | gengine-transform-worker-imagemagick 18 | gengine-transform-worker-ffmpeg 19 | gengine-transform-component 20 | 21 | 22 | 23 | --------------------------------------------------------------------------------