You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sirona.apache.org by rm...@apache.org on 2015/11/13 18:15:54 UTC

svn commit: r1714241 - in /incubator/sirona/trunk: agent/javaagent/src/main/java/org/apache/sirona/javaagent/tracking/ api/src/main/java/org/apache/sirona/pathtracking/

Author: rmannibucau
Date: Fri Nov 13 17:15:54 2015
New Revision: 1714241

URL: http://svn.apache.org/viewvc?rev=1714241&view=rev
Log:
SIRONA-56 adding UniqueIdGenerator

Added:
    incubator/sirona/trunk/api/src/main/java/org/apache/sirona/pathtracking/DefaultUniqueIdGenerator.java
    incubator/sirona/trunk/api/src/main/java/org/apache/sirona/pathtracking/UniqueIdGenerator.java
Modified:
    incubator/sirona/trunk/agent/javaagent/src/main/java/org/apache/sirona/javaagent/tracking/PathTracker.java
    incubator/sirona/trunk/api/src/main/java/org/apache/sirona/pathtracking/Context.java

Modified: incubator/sirona/trunk/agent/javaagent/src/main/java/org/apache/sirona/javaagent/tracking/PathTracker.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/agent/javaagent/src/main/java/org/apache/sirona/javaagent/tracking/PathTracker.java?rev=1714241&r1=1714240&r2=1714241&view=diff
==============================================================================
--- incubator/sirona/trunk/agent/javaagent/src/main/java/org/apache/sirona/javaagent/tracking/PathTracker.java (original)
+++ incubator/sirona/trunk/agent/javaagent/src/main/java/org/apache/sirona/javaagent/tracking/PathTracker.java Fri Nov 13 17:15:54 2015
@@ -24,6 +24,7 @@ import org.apache.sirona.pathtracking.Co
 import org.apache.sirona.pathtracking.PathTrackingEntry;
 import org.apache.sirona.pathtracking.PathTrackingInformation;
 import org.apache.sirona.pathtracking.PathTrackingInvocationListener;
+import org.apache.sirona.pathtracking.UniqueIdGenerator;
 import org.apache.sirona.spi.Order;
 import org.apache.sirona.spi.SPI;
 import org.apache.sirona.store.DataStoreFactory;
@@ -50,12 +51,16 @@ public class PathTracker
         IoCs.findOrCreateInstance( DataStoreFactory.class ).getPathTrackingDataStore();
 
 
+    private static final UniqueIdGenerator ID_GENERATOR =
+        IoCs.findOrCreateInstance( UniqueIdGenerator.class );
+
+
     private static final ThreadLocal<Context> THREAD_LOCAL = new ThreadLocal<Context>()
     {
         @Override
         protected Context initialValue()
         {
-            return new Context();
+            return new Context(ID_GENERATOR.next());
         }
     };
 

Modified: incubator/sirona/trunk/api/src/main/java/org/apache/sirona/pathtracking/Context.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/api/src/main/java/org/apache/sirona/pathtracking/Context.java?rev=1714241&r1=1714240&r2=1714241&view=diff
==============================================================================
--- incubator/sirona/trunk/api/src/main/java/org/apache/sirona/pathtracking/Context.java (original)
+++ incubator/sirona/trunk/api/src/main/java/org/apache/sirona/pathtracking/Context.java Fri Nov 13 17:15:54 2015
@@ -36,9 +36,9 @@ public class Context
 
     private Object startPathObject;
 
-    public Context()
+    public Context(final String uuid)
     {
-        this.uuid = "Sirona-" + UUID.randomUUID().toString();
+        this.uuid = uuid;
         this.level = new AtomicInteger( 0 );
         this.entries = new ArrayList<PathTrackingEntry>();
     }

Added: incubator/sirona/trunk/api/src/main/java/org/apache/sirona/pathtracking/DefaultUniqueIdGenerator.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/api/src/main/java/org/apache/sirona/pathtracking/DefaultUniqueIdGenerator.java?rev=1714241&view=auto
==============================================================================
--- incubator/sirona/trunk/api/src/main/java/org/apache/sirona/pathtracking/DefaultUniqueIdGenerator.java (added)
+++ incubator/sirona/trunk/api/src/main/java/org/apache/sirona/pathtracking/DefaultUniqueIdGenerator.java Fri Nov 13 17:15:54 2015
@@ -0,0 +1,25 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.sirona.pathtracking;
+
+import java.util.UUID;
+
+public class DefaultUniqueIdGenerator implements UniqueIdGenerator {
+    public String next() {
+        return "Sirona-" + UUID.randomUUID().toString();
+    }
+}

Added: incubator/sirona/trunk/api/src/main/java/org/apache/sirona/pathtracking/UniqueIdGenerator.java
URL: http://svn.apache.org/viewvc/incubator/sirona/trunk/api/src/main/java/org/apache/sirona/pathtracking/UniqueIdGenerator.java?rev=1714241&view=auto
==============================================================================
--- incubator/sirona/trunk/api/src/main/java/org/apache/sirona/pathtracking/UniqueIdGenerator.java (added)
+++ incubator/sirona/trunk/api/src/main/java/org/apache/sirona/pathtracking/UniqueIdGenerator.java Fri Nov 13 17:15:54 2015
@@ -0,0 +1,21 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.sirona.pathtracking;
+
+public interface UniqueIdGenerator {
+    String next();
+}