Skip to content

Instantly share code, notes, and snippets.

dfparker2002

Block or report user

Report or block dfparker2002

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dfparker2002
dfparker2002 / microservices.md
Created Nov 15, 2019 — forked from remibantos/microservices.md
Microservices - Cheat sheet
View microservices.md

Microservices - Cheat sheet

Based on Microservices presentation by Martin Fowler recorded at GOTO Berlin 2014.

Common caracteristics

  1. Components (= independently upgradable, replaçable) communicating through services (instead of libs for monoliths)
  2. Organized around business capabilities
  3. Smart endpoints and dumb pipes. Routing logic is managed by end-points
  4. Decentralized data management. Each Microservice manages its own data
View ThrowableClassDemo.java
// src: https://github.com/eugenp/tutorials/blob/f9259fce764200d1e12d7b970d01feb8d9267edb/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/catchingthrowable/ThrowableClassDemo.java
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
public class ThrowableClassDemo {
class CapacityException extends Exception {
CapacityException(String message) {
super(message);
@dfparker2002
dfparker2002 / RenditionMetadataWorkflowProcess.java
Created Oct 15, 2019
Sample rendition metadata Workflow Process
View RenditionMetadataWorkflowProcess.java
// src: https://github.com/wcm-io/wcm-io-handler/blob/cd2d552447ca4e60eb7a51bba6dc6406fa402a9f/media/src/main/java/io/wcm/handler/mediasource/dam/impl/metadata/RenditionMetadataWorkflowProcess.java
import static com.day.cq.dam.api.DamConstants.NT_DAM_ASSET;
import java.util.List;
import java.util.concurrent.locks.Lock;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
import org.jetbrains.annotations.NotNull;
import org.osgi.service.component.annotations.Component;
View HertzAbsoluteTimeProcessStepTest.java
// src: https://github.com/NYL123/TestRepo/blob/11157eacd62cbcc3913f9f58b22275b253eadbc0/C2C_Digital_AEM/bundles/platform/src/test/java/com/hertz/digital/platform/workflows/HertzAbsoluteTimeProcessStepTest.java
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Dictionary;
import java.util.Iterator;
import java.util.List;
import javax.jcr.Session;
import org.apache.sling.api.resource.ResourceResolver;
View WorkflowCustom.java
import org.osgi.service.component.annotations.Component;
import com.adobe.granite.workflow.WorkflowException;
import com.adobe.granite.workflow.WorkflowSession;
import com.adobe.granite.workflow.exec.WorkItem;
import com.adobe.granite.workflow.exec.WorkflowProcess;
import com.adobe.granite.workflow.metadata.MetaDataMap;
@Component(immediate = true,service=WorkflowProcess.class, property = {"process.label=Test Workflow"})
public class WorkflowCustom implements WorkflowProcess {
View TriggerWorkflowServlet,java
// src: https://github.com/ani03sha/Technical-Interview-Preparation/blob/56ad166bd0fca7b97c72190415c86a8420a070a7/code/AEM/Workflows/Workflows/core/src/main/java/org/redquark/aem/workflow/TriggerWorkflowServlet.java
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.Servlet;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.resource.ResourceResolver;
View RenditionMetadataWorkflowProcessTest.java
// src: https://github.com/login/oauth/authorize?client_id=7e0a3cd836d3e544dbd9&redirect_uri=https%3A%2F%2Fgist.github.com%2Fauth%2Fgithub%2Fcallback%3Freturn_to%3Dhttps%253A%252F%252Fgist.github.com%252F&response_type=code&state=ffdea12214e56c86feb5fdfa1531460ce3ce2e15dfe37f6c9c922f08a507ce08
import static com.day.cq.commons.jcr.JcrConstants.JCR_LASTMODIFIED;
import static com.day.cq.commons.jcr.JcrConstants.JCR_LAST_MODIFIED_BY;
import static io.wcm.handler.mediasource.dam.impl.metadata.RenditionMetadataNameConstants.NN_RENDITIONS_METADATA;
import static io.wcm.handler.mediasource.dam.impl.metadata.RenditionMetadataNameConstants.PN_IMAGE_HEIGHT;
import static io.wcm.handler.mediasource.dam.impl.metadata.RenditionMetadataNameConstants.PN_IMAGE_WIDTH;
import static io.wcm.handler.mediasource.dam.impl.metadata.WorkflowTestUtil.PKG_ROOT;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assert
@dfparker2002
dfparker2002 / Generics.java
Last active Aug 4, 2019
Generic examples
View Generics.java
//src: https://github.com/eugenp/tutorials/blob/887eeaf802e0b8728ec9367ad23495303f9a1f38/core-java-modules/core-java-lang-syntax/src/main/java/com/baeldung/generics/Generics.java
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
public class Generics {
// definition of a generic method
View RestClientLiveManualTest.java
src: https://github.com/eugenp/tutorials/blob/de257ee78ea86f75fca6d49d6101261dd2cef636/httpclient-simple/src/test/java/com/baeldung/client/RestClientLiveManualTest.java
//package com.baeldung.client;
import static org.apache.http.conn.ssl.SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
import java.io.IOException;
import java.security.GeneralSecurityException;
View Graph.java
// src: https://github.com/eugenp/tutorials/blob/5b5733239c06b595649324d744e97c6a2dc97d68/data-structures/src/main/java/com/baeldung/graph/Graph.java
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class Graph {
private List<List<Integer>> neighbours;
private int n;
You can’t perform that action at this time.