Skip to content

Commit

Permalink
[#117] Implemented plugin system
Browse files Browse the repository at this point in the history
  • Loading branch information
lioolli committed Feb 10, 2015
1 parent c1ea99c commit eff504b
Show file tree
Hide file tree
Showing 57 changed files with 216 additions and 268 deletions.
Expand Up @@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.navercorp.pinpoint.bootstrap.plugin;
package com.navercorp.pinpoint.bootstrap;

/**
* @author Jongho Moon
Expand Down Expand Up @@ -83,13 +83,13 @@ public <T> T get(Object object) {
}
};

private final Class<? extends Snooper> type;
private final Class<?> type;

private FieldSnooper(Class<? extends Snooper> type) {
private FieldSnooper(Class<?> type) {
this.type = type;
}

public Class<? extends Snooper> getType() {
public Class<?> getType() {
return type;
}

Expand All @@ -100,89 +100,47 @@ public boolean isApplicable(Object object) {
public abstract <T> T get(Object object);





public static FieldSnooper get(int index) {
return VALUES[index];
}



public static boolean getBoolean(Object object) {
return ((BooleanSnooper)object)._$PINPOINT$_getBooleanField();
}

public static int getInt(Object object) {
return ((IntSnooper)object)._$PINPOINT$_getIntField();
}

public static long getLong(Object object) {
return ((LongSnooper)object)._$PINPOINT$_getLongField();
}

public static double getDouble(Object object) {
return ((DoubleSnooper)object)._$PINPOINT$_getDoubleField();
}





private interface BooleanSnooper extends Snooper {
public boolean _$PINPOINT$_getBooleanField();
}

private interface DoubleSnooper extends Snooper {
public double _$PINPOINT$_getDoubleField();
}

public interface LongSnooper extends Snooper {
public long _$PINPOINT$_getLongField();
}

public interface IntSnooper extends Snooper {
public int _$PINPOINT$_getIntField();
}


public interface ObjectSnooper0 extends Snooper {
public interface ObjectSnooper0 {
public Object _$PINPOINT$_getObjectField0();
}

public interface ObjectSnooper1 extends Snooper {
public interface ObjectSnooper1 {
public Object _$PINPOINT$_getObjectField1();
}

public interface ObjectSnooper2 extends Snooper {
public interface ObjectSnooper2 {
public Object _$PINPOINT$_getObjectField2();
}

public interface ObjectSnooper3 extends Snooper {
public interface ObjectSnooper3 {
public Object _$PINPOINT$_getObjectField3();
}

public interface ObjectSnooper4 extends Snooper {
public interface ObjectSnooper4 {
public Object _$PINPOINT$_getObjectField4();
}

public interface ObjectSnooper5 extends Snooper {
public interface ObjectSnooper5 {
public Object _$PINPOINT$_getObjectField5();
}

public interface ObjectSnooper6 extends Snooper {
public interface ObjectSnooper6 {
public Object _$PINPOINT$_getObjectField6();
}

public interface ObjectSnooper7 extends Snooper {
public interface ObjectSnooper7 {
public Object _$PINPOINT$_getObjectField7();
}

public interface ObjectSnooper8 extends Snooper {
public interface ObjectSnooper8 {
public Object _$PINPOINT$_getObjectField8();
}

public interface ObjectSnooper9 extends Snooper {
public interface ObjectSnooper9 {
public Object _$PINPOINT$_getObjectField9();
}

Expand Down
Expand Up @@ -12,9 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.navercorp.pinpoint.bootstrap.plugin;
package com.navercorp.pinpoint.bootstrap;

import com.navercorp.pinpoint.bootstrap.interceptor.tracevalue.TraceValue;

/**
* @author Jongho Moon
Expand Down Expand Up @@ -145,13 +144,13 @@ public <T> void set(Object object, T value) {
};


private final Class<? extends TraceValue> type;
private final Class<?> type;

private MetadataAccessor(Class<? extends TraceValue> type) {
private MetadataAccessor(Class<?> type) {
this.type = type;
}

public Class<? extends TraceValue> getType() {
public Class<?> getType() {
return type;
}

Expand All @@ -166,57 +165,52 @@ public static MetadataAccessor get(int index) {
public abstract <T> T get(Object object);
public abstract <T> void set(Object object, T value);

public interface ObjectAccessor extends TraceValue {
public Object _$PINPOINT$_getObject();
public void _$PINPOINT$_setObject(Object value);
}

public interface ObjectAccessor0 extends TraceValue {
public interface ObjectAccessor0 {
public Object _$PINPOINT$_getObject0();
public void _$PINPOINT$_setObject0(Object value);
}

public interface ObjectAccessor1 extends TraceValue {
public interface ObjectAccessor1 {
public Object _$PINPOINT$_getObject1();
public void _$PINPOINT$_setObject1(Object value);
}

public interface ObjectAccessor2 extends TraceValue {
public interface ObjectAccessor2 {
public Object _$PINPOINT$_getObject2();
public void _$PINPOINT$_setObject2(Object value);
}

public interface ObjectAccessor3 extends TraceValue {
public interface ObjectAccessor3 {
public Object _$PINPOINT$_getObject3();
public void _$PINPOINT$_setObject3(Object value);
}

public interface ObjectAccessor4 extends TraceValue {
public interface ObjectAccessor4 {
public Object _$PINPOINT$_getObject4();
public void _$PINPOINT$_setObject4(Object value);
}

public interface ObjectAccessor5 extends TraceValue {
public interface ObjectAccessor5 {
public Object _$PINPOINT$_getObject5();
public void _$PINPOINT$_setObject5(Object value);
}

public interface ObjectAccessor6 extends TraceValue {
public interface ObjectAccessor6 {
public Object _$PINPOINT$_getObject6();
public void _$PINPOINT$_setObject6(Object value);
}

public interface ObjectAccessor7 extends TraceValue {
public interface ObjectAccessor7 {
public Object _$PINPOINT$_getObject7();
public void _$PINPOINT$_setObject7(Object value);
}

public interface ObjectAccessor8 extends TraceValue {
public interface ObjectAccessor8 {
public Object _$PINPOINT$_getObject8();
public void _$PINPOINT$_setObject8(Object value);
}

public interface ObjectAccessor9 extends TraceValue {
public interface ObjectAccessor9 {
public Object _$PINPOINT$_getObject9();
public void _$PINPOINT$_setObject9(Object value);
}
Expand Down
Expand Up @@ -90,9 +90,9 @@ public interface InstrumentClass {
@Deprecated
void addTraceVariable(String variableName, String setterName, String getterName, String variableType) throws InstrumentException;

void addTraceValue(Class<? extends TraceValue> traceValue, String initValue) throws InstrumentException;
void addTraceValue(Class<?> traceValue, String initValue) throws InstrumentException;

void addTraceValue(Class<? extends TraceValue> traceValue) throws InstrumentException;
void addTraceValue(Class<?> traceValue) throws InstrumentException;

boolean insertCodeAfterConstructor(String[] args, String code);

Expand Down
Expand Up @@ -14,10 +14,16 @@
*/
package com.navercorp.pinpoint.bootstrap.plugin;

import com.navercorp.pinpoint.bootstrap.Agent;

/**
* @author Jongho Moon
*
*/
public enum ApplicationServerProperty {
/**
* If this property is set, the plugin have to manage pinpoint agent's life cycle.
* In other words, the plugin must invoke {@link Agent#start()} and {@link Agent#stop()}
*/
MANAGE_PINPOINT_AGENT_LIFECYCLE;
}
Expand Up @@ -20,8 +20,9 @@
import java.lang.annotation.Target;

/**
* Indicates that an attribute with given name have to be injected to the target.
*
* @author Jongho Moon
*
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER)
Expand Down
Expand Up @@ -19,7 +19,17 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import com.navercorp.pinpoint.bootstrap.instrument.MethodInfo;
import com.navercorp.pinpoint.bootstrap.interceptor.MethodDescriptor;

/**
* Indicates that the target have to be cached.
*
* For now, only {@link MethodDescriptor} can be cached.
* You can also annotate {@link MethodInfo} with this annotation
* but it makes the {@link MethodDescriptor} returned by {@link MethodInfo#getDescriptor()} cached
* not {@link MethodInfo} itself.
*
* @author Jongho Moon
*
*/
Expand Down
Expand Up @@ -16,9 +16,8 @@

package com.navercorp.pinpoint.bootstrap.plugin;

import com.navercorp.pinpoint.common.plugin.ServiceTypeProvider;


public interface ProfilerPlugin extends ServiceTypeProvider {
void setUp(PluginSetupContext context);
public interface ProfilerPlugin {
void setUp(ProfilerPluginSetupContext context);
}
Expand Up @@ -14,11 +14,14 @@
*/
package com.navercorp.pinpoint.bootstrap.plugin;

import com.navercorp.pinpoint.bootstrap.FieldSnooper;
import com.navercorp.pinpoint.bootstrap.MetadataAccessor;

/**
* @author Jongho Moon
*
*/
public interface PluginContext {
public interface ProfilerPluginContext {
public Object setAttribute(String key, Object value);
public Object getAttribute(String key);

Expand Down
Expand Up @@ -15,15 +15,17 @@
package com.navercorp.pinpoint.bootstrap.plugin;

import com.navercorp.pinpoint.bootstrap.config.ProfilerConfig;
import com.navercorp.pinpoint.bootstrap.plugin.editor.ClassEditor;
import com.navercorp.pinpoint.bootstrap.plugin.editor.ClassEditorBuilder;

/**
* @author Jongho Moon
*
*/
public interface PluginSetupContext extends PluginContext {
public interface ProfilerPluginSetupContext extends ProfilerPluginContext {
public ProfilerConfig getConfig();

public ClassEditorBuilder newClassEditorBuilder();

public void addServerTypeDetector(ServerTypeDetector... detectors);
}

This file was deleted.

This file was deleted.

0 comments on commit eff504b

Please sign in to comment.